Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Magic Template Class for IN_DEV mode
|
||||
* @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
|
||||
*/
|
||||
@@ -82,24 +82,31 @@ class _Template extends \IPS\Theme\Template
|
||||
$file = $this->sourceFolder . $bit . '.phtml';
|
||||
}
|
||||
|
||||
/* Get the content */
|
||||
/* Get the content or return an BadMethodCallException if the template doesn't exist */
|
||||
if ( $file === NULL or !file_exists( $file ) )
|
||||
{
|
||||
throw new \BadMethodCallException( 'NO_TEMPLATE_FILE - ' . $file );
|
||||
if ( !$file AND $this->sourceFolder === \IPS\ROOT_PATH . '/plugins' )
|
||||
{
|
||||
throw new \BadMethodCallException( 'NO_PLUGIN_TEMPLATE_FILE - ' . $bit );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \BadMethodCallException( 'NO_TEMPLATE_FILE - ' . $file );
|
||||
}
|
||||
}
|
||||
|
||||
$output = file_get_contents( $file );
|
||||
|
||||
/* Parse the header tag */
|
||||
if ( !preg_match( '/^<ips:template parameters="(.+?)?" \/>(\r\n?|(\r\n?|\n))/', $output, $matches ) )
|
||||
if ( !preg_match( '/^<ips:template parameters="(.+?)?"(\s+)?\/>(\r\n?|(\r\n?|\n))/', $output, $matches ) )
|
||||
{
|
||||
throw new \BadMethodCallException( 'NO_HEADER - ' . $file );
|
||||
}
|
||||
|
||||
/* Strip it */
|
||||
$output = preg_replace( '/^<ips:template parameters="(.+?)?" \/>(\r\n?|\n)/', '', $output );
|
||||
|
||||
if ( \IPS\DEV_DEBUG_TEMPLATES )
|
||||
$output = preg_replace( '/^<ips:template parameters="(.+?)?"(\s+)?\/>(\r\n?|\n)/', '', $output );
|
||||
|
||||
if ( \IPS\DEBUG_TEMPLATES and ! \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
$output = "<!-- " . $functionName . " -->" . $output;
|
||||
}
|
||||
@@ -125,7 +132,7 @@ class _Template extends \IPS\Theme\Template
|
||||
$allowedScriptBlocks = array(
|
||||
'globalTemplate', 'blankTemplate', 'loginTemplate', 'includeJS', 'dashboard',
|
||||
'onlineUsers', 'registrations', 'viglink', 'linkedin', 'reddit', 'poll',
|
||||
'giftvoucherPrint', 'packingLabel', 'packingSheet'
|
||||
'giftvoucherPrint', 'packingLabel', 'packingSheet', 'streamWrapper', 'embedExternal'
|
||||
);
|
||||
|
||||
/* Check we're not being naughty */
|
||||
@@ -137,7 +144,7 @@ class _Template extends \IPS\Theme\Template
|
||||
{
|
||||
// trigger_error( "There is a style block in {$functionName}. Please move all styling into CSS files.", E_USER_ERROR );
|
||||
}
|
||||
if( preg_match( "/<.+?\son(blur|change|click|contextmenu|copy|cut|dblclick|error|focus|focusin|focusout|hashchange|keydown|keypress|keyup|load|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|paste|reset|resize|scroll|select|submit|textinput|unload|wheel)=['\"].+?>/i", $output ) )
|
||||
if( preg_match( '/<[^>]+?\son(blur|change|click|contextmenu|copy|cut|dblclick|error|focus|focusin|focusout|hashchange|keydown|keypress|keyup|load|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|paste|reset|resize|scroll|select|submit|textinput|unload|wheel)=[\'\"].+?>/i', $output ) )
|
||||
{
|
||||
trigger_error( "There is a inline JavaScript {$functionName}. Please move all JavaScript into JS files.", E_USER_ERROR );
|
||||
}
|
||||
|
||||
+15
-19
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief IN_DEV Skin Set
|
||||
* @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 16 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -126,7 +126,7 @@ class _Theme extends \IPS\Theme
|
||||
if ( !isset( $this->templates[ $app ][ $location ][ $group ] ) )
|
||||
{
|
||||
$class = 'Template';
|
||||
if ( isset( \IPS\IPS::$hooks[ "\IPS\Theme\class_{$app}_{$location}_{$group}" ] ) )
|
||||
if ( isset( \IPS\IPS::$hooks[ "\IPS\Theme\class_{$app}_{$location}_{$group}" ] ) AND \IPS\RECOVERY_MODE === FALSE )
|
||||
{
|
||||
foreach ( \IPS\IPS::$hooks[ "\IPS\Theme\class_{$app}_{$location}_{$group}" ] as $id => $data )
|
||||
{
|
||||
@@ -226,7 +226,7 @@ class _Theme extends \IPS\Theme
|
||||
{
|
||||
foreach ( new \GlobIterator( \IPS\ROOT_PATH . '/plugins/' . $plugin->location . '/dev/css/*' ) as $file )
|
||||
{
|
||||
$return[] = str_replace( \IPS\ROOT_PATH, rtrim( \IPS\Settings::i()->base_url, '/' ), $file );
|
||||
$return[] = str_replace( array( 'http://', 'https://' ), '//', \IPS\Settings::i()->base_url ) . "applications/core/interface/css/css.php?css=" . 'plugins/' . $plugin->location . '/dev/css/' . $file->getFilename();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ class _Theme extends \IPS\Theme
|
||||
* @param string $path Path to resource
|
||||
* @param string|null $app Application key
|
||||
* @param string|null $location Location
|
||||
* @return string URL to resource
|
||||
* @return \IPS\Http\Url|NULL URL to resource
|
||||
*/
|
||||
public function resource( $path, $app=NULL, $location=NULL, $noProtocol=FALSE )
|
||||
{
|
||||
@@ -320,10 +320,10 @@ class _Theme extends \IPS\Theme
|
||||
return \IPS\Settings::i()->base_url . "/applications/{$app}/interface/{$path}";
|
||||
}
|
||||
|
||||
$url = $baseUrl . str_replace( \IPS\ROOT_PATH . '/', '', static::_getResourcePath( $app, $location, $path ) );
|
||||
if( $noProtocol )
|
||||
$url = \IPS\Http\Url::createFromString( $baseUrl . str_replace( \IPS\ROOT_PATH . '/', '', static::_getResourcePath( $app, $location, $path ) ), false );
|
||||
if( $noProtocol and $url instanceof \IPS\Http\Url )
|
||||
{
|
||||
$url = str_replace( array( 'http://', 'https://' ), '//', $url );
|
||||
$url = $url->setScheme(NULL);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ class _Theme extends \IPS\Theme
|
||||
{
|
||||
if ( isset( $currentTemplates[ $app ][ $location->getFilename() ][ $group->getFilename() ][ $name ] ) )
|
||||
{
|
||||
if ( md5( trim( $currentTemplates[ $app ][ $location->getFilename() ][ $group->getFilename() ][ $name ]['template_content'] ) ) == md5( trim( $html ) ) )
|
||||
if( \IPS\Login::compareHashes( md5( trim( $html ) ), md5( trim( $currentTemplates[ $app ][ $location->getFilename() ][ $group->getFilename() ][ $name ]['template_content'] ) ) ) )
|
||||
{
|
||||
/* No change */
|
||||
continue;
|
||||
@@ -585,7 +585,7 @@ class _Theme extends \IPS\Theme
|
||||
$css = str_replace( '/* No Content */', '', $css );
|
||||
if ( isset( $currentCss[ $app ][ $location ][ $finalPath ][ $file->getFilename() ] ) )
|
||||
{
|
||||
if ( md5( trim( $currentCss[ $app ][ $location ][ $finalPath ][ $file->getFilename() ]['css_content'] ) ) == md5( trim( $css ) ) )
|
||||
if( \IPS\Login::compareHashes( md5( trim( $css ) ), md5( trim( $currentCss[ $app ][ $location ][ $finalPath ][ $file->getFilename() ]['css_content'] ) ) ) )
|
||||
{
|
||||
/* No change */
|
||||
continue;
|
||||
@@ -720,7 +720,7 @@ class _Theme extends \IPS\Theme
|
||||
/* files larger than 1.5mb don't base64_encode() as they may not get stored in the resources_data column */
|
||||
if ( filesize( $root . $path . $file->getFilename() ) > ( 1.5 * 1024 * 1024 ) )
|
||||
{
|
||||
\IPS\Log::i( LOG_INFO )->write( $root . $path . $file->getFilename() . " too large to import", 'designers_mode_import' );
|
||||
\IPS\Log::log( $root . $path . $file->getFilename() . " too large to import", 'designers_mode_import' );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ class _Theme extends \IPS\Theme
|
||||
|
||||
if ( ! base64_encode( $content ) )
|
||||
{
|
||||
\IPS\Log::i( LOG_INFO )->write( $root . $path . $file->getFilename() . " could not be saved correctly", 'designers_mode_import' );
|
||||
\IPS\Log::log( $root . $path . $file->getFilename() . " could not be saved correctly", 'designers_mode_import' );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ class _Theme extends \IPS\Theme
|
||||
$name = self::makeBuiltTemplateLookupHash($app, $location, $path) . '_' . $file->getFilename();
|
||||
$fileName = (string) \IPS\File::create( 'core_Theme', $name, $content, 'set_resources_' . ( $id == 0 ? 1 : $id ) );
|
||||
|
||||
if ( ! isset( $master[ $file->getFilename() ] ) or $master[ $file->getFilename() ] != md5( $content ) )
|
||||
if ( ! isset( $master[ $file->getFilename() ] ) or !\IPS\Login::compareHashes( md5( $content ), $master[ $file->getFilename() ] ) )
|
||||
{
|
||||
$custom = 1;
|
||||
}
|
||||
@@ -1086,14 +1086,11 @@ class _Theme extends \IPS\Theme
|
||||
\IPS\Db::i()->select(
|
||||
'sv.*, core_theme_settings_fields.*',
|
||||
'core_theme_settings_fields',
|
||||
array( 'sc_set_id=?', 1 ),
|
||||
NULL,
|
||||
NULL,
|
||||
'sc_key'
|
||||
array( 'sc_set_id=?', 1 )
|
||||
)->join(
|
||||
array('core_theme_settings_values', 'sv'),
|
||||
'sv.sv_id=core_theme_settings_fields.sc_id'
|
||||
) as $row
|
||||
)->setKeyField('sc_key') as $row
|
||||
)
|
||||
{
|
||||
$row['sc_default'] = ( $row['sv_value'] ) ? $row['sv_value'] : $row['sc_default'];
|
||||
@@ -1102,7 +1099,6 @@ class _Theme extends \IPS\Theme
|
||||
|
||||
$data[ $row['sc_app'] ][] = $row;
|
||||
}
|
||||
|
||||
foreach( $data as $app => $json )
|
||||
{
|
||||
$file = \IPS\ROOT_PATH . "/applications/{$app}/data/themesettings.json";
|
||||
|
||||
Reference in new issue
Block a user