Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+42 -44
View File
@@ -2,9 +2,9 @@
/**
* @brief Javascript Handler
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 12 Aug 2013
* @version SVN_VERSION_NUMBER
*/
@@ -157,8 +157,8 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
$key = md5( $this->app . ';' . $this->location . ';' . $this->path . ';' . $this->name );
\file_put_contents( $path . '/' . $this->name, $this->content );
}
\IPS\Db::i()->replace( 'core_javascript', array(
\IPS\Db::i()->insert( 'core_javascript', array(
'javascript_app' => $this->app,
'javascript_location' => $this->location,
'javascript_plugin' => $this->plugin,
@@ -169,9 +169,6 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
'javascript_version' => $this->version,
'javascript_position' => ( $this->position ) ? $this->position : 2000000,
'javascript_key' => $key
),
array(
'javascript_app', 'javascript_location', 'javascript_path', 'javascript_name'
) );
}
@@ -212,16 +209,18 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
}
$where = array( 'javascript_app=?', 'javascript_location=?', 'javascript_path=?', 'javascript_name=?' );
$bindings = array( $this->app, $this->location, $this->path, $this->name );
$_where = "javascript_app=? AND javascript_location=? AND javascript_path=? AND javascript_name=?";
$where = array( $this->app, $this->location, $this->path, $this->name );
if ( $this->location == 'plugins' )
{
$where[] = 'javascript_plugin=?';
$bindings[] = $this->plugin;
$_where .= " AND javascript_plugin=?";
$where = array_merge( $where, array( $this->plugin ) );
}
\IPS\Db::i()->delete( 'core_javascript', array( implode( ' AND ', $where ), $bindings ) );
array_unshift( $where, $_where );
\IPS\Db::i()->delete( 'core_javascript', $where );
}
/**
@@ -252,7 +251,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
$xml->endAttribute();
/* Loop */
foreach ( \IPS\Db::i()->select( '*', 'core_javascript', ( $app === 'core' ) ? \IPS\Db::i()->in( 'javascript_app', array('core', 'global') ) : array( 'javascript_app=?', $app ), 'javascript_path, javascript_name' ) as $js )
foreach ( \IPS\Db::i()->select( '*', 'core_javascript', ( $app === 'core' ) ? \IPS\Db::i()->in( 'javascript_app', array('core', 'global') ) : array( 'javascript_app=?', $app ), 'javascript_path, javascript_location, javascript_name' ) as $js )
{
/* Initiate the <template> tag */
$xml->startElement('file');
@@ -333,13 +332,18 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
if( $maxExecution = @ini_get( 'max_execution_time' ) )
{
/* If max_execution_time is set to "no limit" we should add a hard limit to prevent browser timeouts */
if ( $maxExecution == -1 )
{
$maxExecution = 30;
}
$cutOff = time() + ( $maxExecution * .5 );
}
/* Open XML file */
$xml = new \XMLReader;
$xml = new \IPS\Xml\XMLReader;
$xml->open( $file );
$xml->read();
$app = $xml->getAttribute('app');
@@ -466,9 +470,8 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
/* Open XML file */
if( file_exists( \IPS\ROOT_PATH . '/applications/' . $app . '/data/javascript.xml' ) )
{
$xml = new \XMLReader;
$xml->open( \IPS\ROOT_PATH . '/applications/' . $app . '/data/javascript.xml' );
$xml = new \IPS\Xml\XMLReader;
$xml->open( \IPS\ROOT_PATH . '/applications/' . $app . '/data/javascript.xml' );
$xml->read();
while( $xml->read() )
@@ -696,20 +699,15 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
public static function compile( $app, $location=null, $file=null )
{
$flagKey = 'js_compiling_' . md5( $app . ',' . $location . ',' . $file );
if ( isset( \IPS\Data\Store::i()->$flagKey ) and ! empty( \IPS\Data\Store::i()->$flagKey ) )
if ( \IPS\Theme::checkLock( $flagKey ) )
{
/* We're currently rebuilding */
if ( time() - \IPS\Data\Store::i()->$flagKey < 30 )
{
return NULL;
}
return NULL;
}
\IPS\Theme::lock( $flagKey );
\IPS\Data\Store::i()->$flagKey = time();
$map = ( isset( \IPS\Data\Store::i()->javascript_map ) ) ? \IPS\Data\Store::i()->javascript_map : array();
$files = ( isset( \IPS\Data\Store::i()->javascript_file_map ) ) ? \IPS\Data\Store::i()->javascript_file_map : array();
$map = ( isset( \IPS\Data\Store::i()->javascript_map ) and is_array( \IPS\Data\Store::i()->javascript_map ) ) ? \IPS\Data\Store::i()->javascript_map : array();
$files = ( isset( \IPS\Data\Store::i()->javascript_file_map ) and is_array( \IPS\Data\Store::i()->javascript_file_map ) ) ? \IPS\Data\Store::i()->javascript_file_map : array();
if ( $location === null and $file === null )
{
@@ -882,7 +880,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
\IPS\Data\Store::i()->javascript_map = $map;
unset( \IPS\Data\Store::i()->$flagKey );
\IPS\Theme::unlock( $flagKey );
/* As the filename has changed, rebuild the JS map */
if ( ( $app !== 'global' and ( $location === NULL or in_array( $location, array( 'admin', 'front', 'global' ) ) ) ) )
@@ -904,8 +902,8 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
*/
protected static function _writeJavascriptFromResultset( $files, $fileName, $app, $location )
{
$content = '';
$jsMap = ( isset( \IPS\Data\Store::i()->javascript_map ) ) ? \IPS\Data\Store::i()->javascript_map : array();
$content = array();
$jsMap = ( isset( \IPS\Data\Store::i()->javascript_map ) and is_array( \IPS\Data\Store::i()->javascript_map ) ) ? \IPS\Data\Store::i()->javascript_map : array();
/* Try and remove any existing files */
try
@@ -969,7 +967,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
/**
* Get javascript language as a script
*
* @param int $lang ID of language to fetch
* @param int $langId ID of language to fetch
* @return string
*/
public static function getJavascriptLanguage( $langId )
@@ -993,9 +991,9 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
foreach ( \IPS\Plugin::plugins() as $plugin )
{
if ( file_exists( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/dev/lang.php" ) )
if ( file_exists( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/dev/jslang.php" ) )
{
require \IPS\ROOT_PATH . "/plugins/{$plugin->location}/dev/lang.php";
require \IPS\ROOT_PATH . "/plugins/{$plugin->location}/dev/jslang.php";
$_lang = array_merge( $_lang, $lang );
}
}
@@ -1096,7 +1094,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
if ( mb_substr( $file, 0, 8 ) === 'js_lang_' )
{
return array( \IPS\Settings::i()->base_url . "/applications/core/interface/js/jslang.php?langId=" . intval( mb_substr( $file, 8, -3 ) ) );
return array( \IPS\Http\Url::baseUrl() . "/applications/core/interface/js/jslang.php?langId=" . intval( mb_substr( $file, 8, -3 ) ) );
}
}
@@ -1147,7 +1145,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
else
{
return array( str_replace( \IPS\ROOT_PATH, \IPS\Settings::i()->base_url, $path ) );
return array( str_replace( \IPS\ROOT_PATH, \IPS\Http\Url::baseUrl(), $path ) );
}
}
@@ -1186,7 +1184,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
continue;
}
$files[ $app ][ $location . '_' . $controllerDir ] = str_replace( \IPS\ROOT_PATH, trim( \IPS\Settings::i()->base_url, '/' ), $controllerPath ) . '/' . $file->getFileName();
$files[ $app ][ $location . '_' . $controllerDir ] = str_replace( \IPS\ROOT_PATH, rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' ), $controllerPath ) . '/' . $file->getFileName();
}
}
}
@@ -1206,7 +1204,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
*/
protected static function _urlToComponents( $url )
{
$url = ltrim( str_replace( \IPS\Settings::i()->base_url . 'applications', '', $url ), '/' );
$url = ltrim( str_replace( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ) . 'applications', '', $url ), '/' );
$bits = explode( "/", $url );
$app = array_shift( $bits );
@@ -1225,7 +1223,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
/**
* Gets app specific Javascript
*
* @param string $key Application
* @param string $app Application
* @param string $location Location (front, global, etc)
* @return void
*/
@@ -1276,7 +1274,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
else if ( \file_exists( $templatesDir . '/ips.templates.' . $key . '.js' ) )
{
$templates = array( str_replace( \IPS\ROOT_PATH, trim( \IPS\Settings::i()->base_url, '/' ), $templatesDir . '/ips.templates.' . $key . '.js' ) );
$templates = array( str_replace( \IPS\ROOT_PATH, rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' ), $templatesDir . '/ips.templates.' . $key . '.js' ) );
}
return array_merge( $templates, $controllers );
@@ -1307,7 +1305,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
else if ( mb_substr( $file->getFileName(), -3 ) === '.js' )
{
$contents[] = str_replace( \IPS\ROOT_PATH, trim( \IPS\Settings::i()->base_url, '/' ), $path ) . '/' . $file->getFileName();
$contents[] = str_replace( \IPS\ROOT_PATH, rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' ), $path ) . '/' . $file->getFileName();
}
}
@@ -1351,7 +1349,7 @@ class _Javascript extends \IPS\Patterns\ActiveRecord
}
else
{
if ( mb_substr( str_replace( \IPS\Settings::i()->base_url . ltrim( str_replace( \IPS\ROOT_PATH, '', $path ), '/' ), '', $url ), 1, (mb_strlen( $item ) ) ) == $item )
if ( mb_substr( str_replace( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ) . ltrim( str_replace( \IPS\ROOT_PATH, '', $path ), '/' ), '', $url ), 1, (mb_strlen( $item ) ) ) == $item )
{
$reordered[] = $url;
}
+148 -55
View File
@@ -2,9 +2,9 @@
/**
* @brief Output Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
@@ -27,7 +27,7 @@ class _Output
* @brief HTTP Statuses
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
*/
protected static $httpStatuses = array( 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 429 => 'Too Many Requests', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported' );
public static $httpStatuses = array( 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 429 => 'Too Many Requests', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported' );
/**
* @brief Singleton Instance
@@ -90,8 +90,11 @@ class _Output
/* Inline Message */
if( isset( $_SESSION['inlineMessage'] ) )
{
static::$instance->inlineMessage = $_SESSION['inlineMessage'];
$_SESSION['inlineMessage'] = NULL;
if( !\IPS\Request::i()->isAjax() )
{
static::$instance->inlineMessage = $_SESSION['inlineMessage'];
$_SESSION['inlineMessage'] = NULL;
}
}
return static::$instance;
@@ -108,6 +111,11 @@ class _Output
* @brief Stored Page Title
*/
public $title = '';
/**
* @brief Should the title show in the header (ACP only)?
*/
public $showTitle = TRUE;
/**
* @brief Stored Content to output
@@ -221,7 +229,7 @@ class _Output
if ( $location === 'interface' AND mb_substr( $file, -3 ) === '.js' )
{
/* @see http://community.invisionpower.com/4bugtrack/some-js-files-get-loaded-with-a-double-in-the-url-r3558/ */
return array( rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' ) . "/applications/{$app}/interface/{$file}?v=" . \IPS\SUITE_UNIQUE_KEY );
return array( rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' ) . "/applications/{$app}/interface/{$file}?v=" . ( defined( \IPS\CACHEBUST_KEY ) ? \IPS\CACHEBUST_KEY : time() ) );
}
elseif ( \IPS\IN_DEV )
{
@@ -310,7 +318,10 @@ class _Output
{
if ( $app === null or $app === 'global' )
{
\IPS\File::getClass('core_Theme')->deleteContainer( 'javascript_global' );
try
{
\IPS\File::getClass('core_Theme')->deleteContainer( 'javascript_global' );
} catch( \Exception $e ) { }
unset( $javascriptObjects['global'] );
}
@@ -319,7 +330,10 @@ class _Output
{
if ( $app === null or $app === $key )
{
\IPS\File::getClass('core_Theme')->deleteContainer( 'javascript_' . $key );
try
{
\IPS\File::getClass('core_Theme')->deleteContainer( 'javascript_' . $key );
} catch( \Exception $e ) { }
unset( $javascriptObjects[ $key ] );
}
@@ -356,7 +370,11 @@ class _Output
{
$title = $this->metaTagsTitle;
}
else
{
$title = htmlspecialchars( $title, \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
if( !\IPS\Settings::i()->site_online )
{
$title = sprintf( \IPS\Member::loggedIn()->language()->get( 'offline_title_wrap' ), $title );
@@ -487,15 +505,15 @@ class _Output
/**
* Display Error Screen
*
* @param string $message language key for error message
* @param mixed $code Error code
* @param int $httpStatusCode HTTP Status Code
* @param string $adminMessage language key for error message to show to admins
* @param array $httpHeaders Additional HTTP Headers
* @param string $extra Additional information (such as API error)
* @return void
* @param string $message language key for error message
* @param mixed $code Error code
* @param int $httpStatusCode HTTP Status Code
* @param string $adminMessage language key for error message to show to admins
* @param array $httpHeaders Additional HTTP Headers
* @param string $extra Additional information (such backtrace or API error) which will be shown to admins
* @param int|string|NULL $faultyAppOrHookId The 3rd party application or the hook id, which caused this error, NULL if it was a core application
*/
public function error( $message, $code, $httpStatusCode=500, $adminMessage=NULL, $httpHeaders=array(), $extra=NULL )
public function error( $message, $code, $httpStatusCode=500, $adminMessage=NULL, $httpHeaders=array(), $extra=NULL, $faultyAppOrHookId=NULL )
{
/* If we just logged out, we don't want to show a "no permission" error */
if ( isset( \IPS\Request::i()->_fromLogout ) )
@@ -516,26 +534,29 @@ class _Output
$title = "{$httpStatusCode}_error_title";
$title = \IPS\Member::loggedIn()->language()->checkKeyExists( $title ) ? \IPS\Member::loggedIn()->language()->addToStack( $title ) : \IPS\Member::loggedIn()->language()->addToStack( 'error_title' );
/* If we're in developer mode, show a backtrace */
$backtrace = '';
if( \IPS\IN_DEV and !$extra )
{
ob_start();
$backtrace = print_r( debug_backtrace( 0 ), TRUE );
}
else
{
$backtrace = $extra;
}
/* If we're in setup, just display it */
if ( \IPS\Dispatcher::i()->controllerLocation === 'setup' )
{
$this->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $title, \IPS\Theme::i()->getTemplate( 'global', 'core' )->error( $title, $message, $code, $backtrace ) ), $httpStatusCode, 'text/html', $httpHeaders, FALSE );
$this->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $title, \IPS\Theme::i()->getTemplate( 'global', 'core' )->error( $title, $message, $code, $extra ) ), $httpStatusCode, 'text/html', $httpHeaders, FALSE );
}
/* Are we an administrator logged in as a member? */
$member = \IPS\Member::loggedIn();
if ( isset( $_SESSION['logged_in_as_key'] ) )
{
try
{
$_member = \IPS\Member::load( $_SESSION['logged_in_from']['id'] );
if ( $_member->member_id == $_SESSION['logged_in_from']['id'] )
{
$member = $_member;
}
}
catch ( \OutOfRangeException $e ) { }
}
/* Which message are we showing? */
if( \IPS\Member::loggedIn()->isAdmin() and $adminMessage )
if( $member->isAdmin() and $adminMessage )
{
$message = $adminMessage;
}
@@ -565,7 +586,7 @@ class _Output
if( \IPS\Settings::i()->error_notify_level and $level >= \IPS\Settings::i()->error_notify_level )
{
\IPS\Email::buildFromTemplate( 'core', 'error_log', array( $code, $message ) )->send( \IPS\Settings::i()->email_in );
\IPS\Email::buildFromTemplate( 'core', 'error_log', array( $code, $message ), \IPS\Email::TYPE_TRANSACTIONAL )->send( \IPS\Settings::i()->email_in );
}
}
@@ -574,10 +595,29 @@ class _Output
{
$this->json( $message, $httpStatusCode );
}
$faulty = '';
/* Try to find the breaking hook */
if ( $faultyAppOrHookId )
{
if ( is_numeric( $faultyAppOrHookId ) )
{
$hookSource = \IPS\Db::i()->select( 'plugin', 'core_hooks', array( 'id=?', $faultyAppOrHookId ) )->first();
$plugin = \IPS\Plugin::load( $hookSource );
$faulty = \IPS\Member::loggedIn()->language()->addToStack( 'faulty_plugin', FALSE, array( 'sprintf' => array( $plugin->name, \IPS\Http\Url::internal('app=core&module=applications&controller=plugins', 'admin' ) ) ) );
}
else
{
$app = \IPS\Application::load( $faultyAppOrHookId );
$faulty = \IPS\Member::loggedIn()->language()->addToStack( 'faulty_app', FALSE, array( 'sprintf' => array( $app->_title, \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications', 'admin' ) ) ) );
}
}
/* Send output */
\IPS\Output::i()->sidebar['enabled'] = FALSE;
$this->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $title, \IPS\Theme::i()->getTemplate( 'global', 'core' )->error( $title, $message, $code, $backtrace ), array( 'app' => \IPS\Dispatcher::i()->application ? \IPS\Dispatcher::i()->application->directory : NULL, 'module' => \IPS\Dispatcher::i()->module ? \IPS\Dispatcher::i()->module->key : NULL, 'controller' => \IPS\Dispatcher::i()->controller ) ), $httpStatusCode, 'text/html', $httpHeaders, FALSE, FALSE );
$this->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $title, \IPS\Theme::i()->getTemplate( 'global', 'core' )->error( $title, $message, $code, $extra, $member, $faulty ), array( 'app' => \IPS\Dispatcher::i()->application ? \IPS\Dispatcher::i()->application->directory : NULL, 'module' => \IPS\Dispatcher::i()->module ? \IPS\Dispatcher::i()->module->key : NULL, 'controller' => \IPS\Dispatcher::i()->controller ) ), $httpStatusCode, 'text/html', $httpHeaders, FALSE, FALSE );
}
/**
@@ -608,11 +648,11 @@ class _Output
/* Set HTTP status */
if( isset( $_SERVER['SERVER_PROTOCOL'] ) and \strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) !== false )
{
$this->sendHeader( "HTTP/1.0 {$httpStatusCode} " . self::$httpStatuses[ $httpStatusCode ] );
$this->sendHeader( "HTTP/1.0 {$httpStatusCode} " . static::$httpStatuses[ $httpStatusCode ] );
}
else
{
$this->sendHeader( "HTTP/1.1 {$httpStatusCode} " . self::$httpStatuses[ $httpStatusCode ] );
$this->sendHeader( "HTTP/1.1 {$httpStatusCode} " . static::$httpStatuses[ $httpStatusCode ] );
}
}
@@ -648,11 +688,12 @@ class _Output
$cacheThisPage and // Some pages can specify not to be cached (for example, when displaying a cached page, you don't want it recached)
!isset( \IPS\Request::i()->cookie['noCache'] ) and // A noCache cookie might get set to not cache a particular guest (for example, if they have added items to their cart in the store)
mb_strtolower( $_SERVER['REQUEST_METHOD'] ) == 'get' and // Is a HTTP GET request (don't cache output for POSTs)
!isset( \IPS\Request::i()->csrfKey ) and // CSRF key isn't present (which would be like a POST request)
$contentType == 'text/html' and // Output is HTML (don't cache RSS feeds, JSON output, etc)
\IPS\Dispatcher::hasInstance() and class_exists( 'IPS\Dispatcher', FALSE ) and \IPS\Dispatcher::i()->controllerLocation === 'front' and // Is a normal, front-end page (necessary to know if user is logged in)
!\IPS\Member::loggedIn()->member_id // User is not logged in
) {
\IPS\Data\Cache::i()->storeWithExpire( 'page_' . md5( ( !empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] ) . '/' . $_SERVER['REQUEST_URI'] ) . '_' . \IPS\Member::loggedIn()->language()->id . '_' . \IPS\Theme::i()->id, array(
\IPS\Data\Cache::i()->storeWithExpire( 'page_' . md5( (int) \IPS\Request::i()->isSecure() . ( !empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] ) . '/' . $_SERVER['REQUEST_URI'] ) . '_' . \IPS\Member::loggedIn()->language()->id . '_' . \IPS\Theme::i()->id, array(
'output' => str_replace( \IPS\Session::i()->csrfKey, '{{csrfKey}}', $output ),
'code' => $httpStatusCode,
'contentType' => $contentType,
@@ -662,7 +703,9 @@ class _Output
}
/* Query Log (has to be done after parseOutputForDisplay because runs queries and after page caching so the log isn't misleading) */
if ( \IPS\QUERY_LOG or \IPS\CACHING_LOG )
$contentTypeTypes = explode( '/', $contentType );
if ( ( \IPS\QUERY_LOG or \IPS\CACHING_LOG ) and in_array( $contentType, array( 'text/html', 'application/json' ) ) )
{
/* Close the session and run tasks now so we can see those queries */
session_write_close();
@@ -683,10 +726,16 @@ class _Output
$output = str_replace( '<!--ipsCachingLog-->', \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->cachingLog( $cachingLog ), $output );
}
}
/* Remove anything from the output buffer that should not be there as it can confuse content-length */
@ob_end_clean();
/* Trim any blank spaces before the beginning of output */
$output = ltrim( $output );
/* Set HTTP status */
$this->sendStatusCodeHeader( $httpStatusCode );
/* Start buffering */
ob_start();
@@ -700,15 +749,13 @@ class _Output
}
}
/* Output */
print $output;
/* Update advertisement impression counts, if appropriate */
if( count( \IPS\core\Advertisement::$advertisementIds ) )
{
\IPS\Db::i()->update( 'core_advertisements', "ad_impressions=ad_impressions+1", "ad_id IN(" . implode( ',', \IPS\core\Advertisement::$advertisementIds ) . ")" );
unset( \IPS\Data\Cache::i()->advertisements );
}
\IPS\core\Advertisement::updateImpressions();
/* Send headers */
$this->sendHeader( "Content-type: {$contentType};charset=UTF-8" );
@@ -757,7 +804,7 @@ class _Output
public function json( $data, $httpStatusCode=200 )
{
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $data );
return $this->sendOutput( json_encode( \IPS\Member::loggedIn()->language()->stripVLETags( $data ) ), $httpStatusCode, 'application/json' );
return $this->sendOutput( json_encode( \IPS\Member::loggedIn()->language()->stripVLETags( $data ) ), $httpStatusCode, 'application/json', $this->httpHeaders );
}
/**
@@ -821,7 +868,7 @@ class _Output
*/
public function parseFileObjectUrls( &$output )
{
if ( mb_stristr( $output, '<fileStore.' ) )
if ( \stristr( $output, '<fileStore.' ) )
{
preg_match_all( '#<fileStore.([\d\w\_]+?)>#', $output, $matches, PREG_SET_ORDER );
@@ -867,10 +914,57 @@ class _Output
$this->title = \IPS\Settings::i()->board_name;
\IPS\Output::i()->sidebar['enabled'] = FALSE;
\IPS\Dispatcher\Front::i()->checkMfa();
$this->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $this->title, $this->output, array( 'app' => \IPS\Dispatcher::i()->application->directory, 'module' => \IPS\Dispatcher::i()->module->key, 'controller' => \IPS\Dispatcher::i()->controller ) ), 503 );
}
/**
* Show Banned
*
* @return void
*/
public function showBanned()
{
$ipBanned = \IPS\Request::i()->ipAddressIsBanned();
$banEnd = \IPS\Member::loggedIn()->isBanned();
$message = 'member_banned';
if ( !$ipBanned and $banEnd instanceof \IPS\DateTime )
{
$message = \IPS\Member::loggedIn()->language()->addToStack( 'member_banned_temp', FALSE, array( 'htmlsprintf' => array( $banEnd->html() ) ) );
}
$member = \IPS\Member::loggedIn();
$warnings = NULL;
if( $member->member_id )
{
try
{
$warningCount = \IPS\Db::i()->select( 'COUNT(*)', 'core_members_warn_logs', array( 'wl_member = ?', $member->member_id ) )->first();
if( $warningCount )
{
$warnings = new \IPS\Helpers\Table\Content( 'IPS\core\Warnings\Warning', \IPS\Http\Url::internal( "app=core&module=system&controller=warnings&id={$member->member_id}", 'front', 'warn_list', $member->members_seo_name ), array( array( 'wl_member=?', $member->member_id ) ) );
$warnings->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'system', 'core', 'front' ), 'warningRow' );
}
}
catch ( \UnderflowException $e ){}
}
$this->bodyClasses[] = 'ipsLayout_minimal';
$this->bodyClasses[] = 'ipsLayout_minimalNoHome';
$this->output = \IPS\Theme::i()->getTemplate( 'system', 'core' )->banned( $message, $warnings, $banEnd );
$this->title = \IPS\Settings::i()->board_name;
\IPS\Output::i()->sidebar['enabled'] = FALSE;
$this->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $this->title, $this->output, array( 'app' => \IPS\Dispatcher::i()->application->directory, 'module' => \IPS\Dispatcher::i()->module->key, 'controller' => \IPS\Dispatcher::i()->controller ) ), 403, 'text/html', array(), FALSE );
}
/**
* Checks and rebuilds JS map if it is broken
*
@@ -972,8 +1066,7 @@ class _Output
}
}
$baseUrl = parse_url( \IPS\Settings::i()->base_url );
$lookFor = '//' . $baseUrl['host'];
$baseUrl = parse_url( \IPS\Settings::i()->base_url );
foreach( $this->metaTags as $name => $value )
{
@@ -984,16 +1077,16 @@ class _Output
foreach( $value as $tag )
{
if ( mb_substr( $tag, 0, mb_strlen( $lookFor ) ) === $lookFor )
if ( mb_substr( $tag, 0, 2 ) === '//' )
{
/* Try to preserve http vs https */
if( isset( $baseUrl['scheme'] ) )
{
$tag = str_replace( $lookFor, $baseUrl['scheme'] . '://' . $baseUrl['host'], $tag );
$tag = str_replace( '//', $baseUrl['scheme'] . '://', $tag );
}
else
{
$tag = str_replace( $lookFor, 'http://' . $baseUrl['host'], $tag );
$tag = str_replace( '//', 'http://', $tag );
}
$this->metaTags[ $name ] = $tag;
@@ -1020,7 +1113,7 @@ class _Output
{
return 'none';
}
elseif ( ( ( $licenseKey['expires'] and strtotime( $licenseKey['expires'] ) < time() ) or ! isset( $licenseKey['active'] ) or !$licenseKey['active'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'licensekey_manage' ) )
elseif ( ( ( isset( $licenseKey['expires'] ) and strtotime( $licenseKey['expires'] ) < time() ) or ! isset( $licenseKey['active'] ) or !$licenseKey['active'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'licensekey_manage' ) )
{
return 'expired';
}
@@ -1057,7 +1150,7 @@ class _Output
{
if( is_subclass_of( $class, 'IPS\Content\Searchable' ) )
{
if ( $class::$includeInSiteSearch )
if ( $class::includeInSiteSearch() )
{
$type = mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) );
$this->globalSearchMenuOptions[ $type ] = $type . '_pl';
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Address formatter
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 6 Aug 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Advertisement
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - DateTime
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 15 July 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Expression
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - File
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 21 April 2015
* @version SVN_VERSION_NUMBER
*/
+31 -16
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Filesize
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Nov 2013
* @version SVN_VERSION_NUMBER
*/
@@ -46,9 +46,10 @@ class _Filesize
* @param int $sizeInBytes Size in bytes
* @param bool $decimal If TRUE, will calculate based on decimal figures rather than binary
* @param bool $json If TRUE, will format for json
* @param bool $get If TRUE, will get the language string rather than add to stack
* @return string
*/
public static function humanReadableFilesize( $sizeInBytes, $decimal=FALSE, $json=FALSE )
public static function humanReadableFilesize( $sizeInBytes, $decimal=FALSE, $json=FALSE, $get=FALSE )
{
$sizeInBytes = floatval( $sizeInBytes );
@@ -57,24 +58,38 @@ class _Filesize
$raised = $decimal ? pow( 1000, $pow / 10 ) : pow( 2, $pow );
if ( $sizeInBytes >= $raised )
{
$format = array( 'sprintf' => round( ( $sizeInBytes / $raised ), 1 ) );
if( $json === TRUE )
if ( $get )
{
$format['json'] = TRUE;
return sprintf( \IPS\Member::loggedIn()->language()->get( 'filesize_' . $sig ), round( ( $sizeInBytes / $raised ), 2 ) );
}
else
{
$format = array( 'sprintf' => round( ( $sizeInBytes / $raised ), 2 ) );
if( $json === TRUE )
{
$format['json'] = TRUE;
}
return \IPS\Member::loggedIn()->language()->addToStack( 'filesize_' . $sig, FALSE, $format );
}
return \IPS\Member::loggedIn()->language()->addToStack( 'filesize_' . $sig, FALSE, $format );
}
}
$format = array( 'sprintf' => $sizeInBytes );
if( $json === TRUE )
if ( $get )
{
$format['json'] = TRUE;
return sprintf( \IPS\Member::loggedIn()->language()->get( 'filesize_b' ), $sizeInBytes );
}
else
{
$format = array( 'sprintf' => $sizeInBytes );
if( $json === TRUE )
{
$format['json'] = TRUE;
}
return \IPS\Member::loggedIn()->language()->addToStack( 'filesize_b', FALSE, $format );
}
return \IPS\Member::loggedIn()->language()->addToStack( 'filesize_b', FALSE, $format );
}
}
+78
View File
@@ -0,0 +1,78 @@
<?php
/**
* @brief Template Plugin - Hex to RGB. Takes a CSS hex code and returns an RGB string
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @since 05 Jan 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Template Plugin - hextorgb
*/
class _Hextorgb
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = TRUE;
/**
* Run the plug-in. Take #ffffff and returns 255,255,255, for example
*
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return string Code to eval
*/
public static function runPlugin( $data, $options )
{
$output = array();
/* If a theme setting key has been passed in, then use that as the value */
if ( isset( \IPS\Theme::i()->settings[ $data ] ) )
{
$data = \IPS\Theme::i()->settings[ $data ];
}
/* Basic validation */
if( !preg_match( "/^#?[0-9a-fA-F]+$/", $data ) OR ( \strlen( str_replace( '#', '', $data ) ) !== 3 AND \strlen( str_replace( '#', '', $data ) ) !== 6 ) )
{
return "htmlspecialchars( '" . $data . "', ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE )";
}
$data = str_replace( '#', '', $data );
if ( \strlen( $data ) == 3 )
{
$output[] = hexdec( \substr( $data, 0, 1 ) . \substr( $data, 0, 1 ) ); // R
$output[] = hexdec( \substr( $data, 1, 1 ) . \substr( $data, 1, 1 ) ); // G
$output[] = hexdec( \substr( $data, 2, 1 ) . \substr( $data, 2, 1 ) ); // B
}
else
{
$output[] = hexdec( \substr( $data, 0, 2 ) ); // R
$output[] = hexdec( \substr( $data, 2, 2 ) ); // G
$output[] = hexdec( \substr( $data, 4, 2 ) ); // B
}
if( isset( $options['opacity'] ) )
{
return "'rgba(" . implode( ',', $output ) . "," . $options['opacity'] . ")'";
}
else
{
return "'rgb(" . implode( ',', $output ) . ")'";
}
}
}
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Include PHP File
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 5 Feb 2015
* @version SVN_VERSION_NUMBER
*/
+7 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Lang
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
@@ -81,6 +81,11 @@ class _Lang
$params[] = '\'wordbreak\' => TRUE';
}
if( isset( $options['escape'] ) )
{
$params[] = '\'escape\' => TRUE';
}
if( isset( $options['ucfirst'] ) )
{
$params[] = '\'ucfirst\' => TRUE';
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Member Data
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Number
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 23 Jan 2014
* @version SVN_VERSION_NUMBER
*/
+3 -3
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Vendor prefix. Takes a CSS property name and returns a prefixed string.
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 12 Aug 2013
* @version SVN_VERSION_NUMBER
*/
@@ -54,7 +54,7 @@ class _Prefix
{
if ( in_array( $data, static::$supportedStyles ) )
{
$output = '';
$output = array();
foreach ( static::$prefixes as $prefix )
{
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Request
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Theme Resource (image, font, theme-specific JS, etc)
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Setting
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Strip HTML tags
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Dec 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Template
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Theme Setting
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+3 -3
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Truncate
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 28 Aug 2013
* @version SVN_VERSION_NUMBER
*/
@@ -48,6 +48,6 @@ class _Truncate
$_argument = ( mb_strpos( $data, '$' ) !== FALSE ) ? $data : '"' . $data . '"';
$_length = ( mb_strpos( $options['length'], '$' ) !== FALSE ) ? $options['length'] : '"' . $options['length'] . '"';
return "htmlspecialchars( mb_substr( {$_argument}, '{$options['start']}', {$_length} ), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . ( ( mb_strlen( {$_argument} ) > {$_length} ) ? '{$options['append']}' : '' )";
return "htmlspecialchars( mb_substr( html_entity_decode( {$_argument} ), '{$options['start']}', {$_length} ), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . ( ( mb_strlen( html_entity_decode( {$_argument} ) ) > {$_length} ) ? '{$options['append']}' : '' )";
}
}
+2 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - URL
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
+3 -2
View File
@@ -2,9 +2,9 @@
/**
* @brief Template Plugin - Wordbreak
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 28 Aug 2013
* @version SVN_VERSION_NUMBER
*/
@@ -31,6 +31,7 @@ class _Wordbreak
/**
* Run the plug-in
*
* @deprecated \IPS\Lang::wordbreak() is deprecated but we left this here to prevent breaking anything
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return string Code to eval
+4 -4
View File
@@ -2,9 +2,9 @@
/**
* @brief Output Class for use when the templating engine isn't available
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 17 Oct 2013
* @version SVN_VERSION_NUMBER
*/
@@ -55,11 +55,11 @@ class _System extends \IPS\Output
/* Set HTTP status */
if( isset( $_SERVER['SERVER_PROTOCOL'] ) and \strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) !== false )
{
header( "HTTP/1.0 {$httpStatusCode} " . self::$httpStatuses[ $httpStatusCode ] );
header( "HTTP/1.0 {$httpStatusCode} " . static::$httpStatuses[ $httpStatusCode ] );
}
else
{
header( "HTTP/1.1 {$httpStatusCode} " . self::$httpStatuses[ $httpStatusCode ] );
header( "HTTP/1.1 {$httpStatusCode} " . static::$httpStatuses[ $httpStatusCode ] );
}
/* Buffer output */