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

+71 -24
View File
@@ -2,9 +2,10 @@
/**
* @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
* @subpackage Content
* @since 16 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -175,7 +176,7 @@ class _Theme extends \IPS\Theme
if ( isset( $master[ $key ] ) )
{
if ( md5( trim( $master[ $key ]['template_content'] ) ) == md5( trim( $html ) ) )
if( \IPS\Login::compareHashes( md5( trim( $master[ $key ]['template_content'] ) ), md5( trim( $html ) ) ) )
{
continue;
}
@@ -342,7 +343,7 @@ class _Theme extends \IPS\Theme
$contents = file_get_contents( static::_getHtmlPath( 'cms', $location->getFilename(), $file->getFilename() ) . '/' . $template->getFilename() );
$key = \IPS\cms\Theme\Template::extractDataFromTag( $contents, 'key' );
$key = $key ? $key : \IPS\Http\Url::seoTitle( $file->getFilename() . '_' . $title );
$key = $key ? $key : \IPS\Http\Url\Friendly::seoTitle( $file->getFilename() . '_' . $title );
$ogroup = \IPS\cms\Theme\Template::extractDataFromTag( $contents, 'original_group' );
$params = \IPS\cms\Theme\Template::extractParamsFromTag( $contents );
$container = NULL;
@@ -429,16 +430,52 @@ class _Theme extends \IPS\Theme
{
$where[] = "template_type='js'";
}
foreach(
\IPS\Db::i()->select(
'*',
'cms_templates',
implode( " AND ", $where ),
'template_location, template_group, template_key, template_user_edited ASC'
)
as $row
) {
$templateNames = array();
$rawTemplates = array();
$originalGroups = array();
$originalTemplates = array();
$originalTemplateNames = array();
$groupMap = array();
foreach( \IPS\Db::i()->select( '*', 'cms_templates', implode( " AND ", $where ), 'template_location, template_group, template_key, template_user_edited ASC' ) as $row )
{
$rawTemplates[] = $row;
$templateNames[ $row['template_original_group'] ][] = $row['template_title'];
$groupMap[ $row['template_original_group'] ] = $row['template_group'];
if ( $row['template_original_group'] )
{
$originalGroups[ $row['template_original_group'] ] = $row['template_original_group'];
}
}
if ( count( $originalGroups ) )
{
foreach( \IPS\Db::i()->select( '*', 'cms_templates', array( array( 'template_original_group = template_group '), array( \IPS\Db::i()->in( 'template_original_group', $originalGroups ) ) ) ) as $row )
{
$originalTemplates[ $row['template_group'] . '_' . $row['template_title'] ] = $row;
$originalTemplateNames[ $row['template_group'] ][] = $row['template_title'];
}
}
/* Now try and see if we can merge in missing templates */
foreach( $originalTemplateNames as $group => $names )
{
if ( isset( $templateNames[ $group ] ) )
{
foreach( $names as $name )
{
if ( ! in_array( $name, $templateNames[ $group ] ) )
{
$rawTemplates[] = array_merge( $originalTemplates[ $group . '_' . $name ], array( 'template_group' => $groupMap[ $group ]) );
}
}
}
}
foreach( $rawTemplates as $row )
{
$row['TemplateKey'] = $row['template_app'] . '_' . $row['template_location'] . '_' . $row['template_group'] . '_' . $row['template_key'];
$row['jsDataKey'] = str_replace( '.', '--', $row['TemplateKey'] );
$row['template_app'] = 'cms';
@@ -545,7 +582,7 @@ class _Theme extends \IPS\Theme
$key = \strtolower( 'template_cms_' .static::makeBuiltTemplateLookupHash( $app, $location, $group ) . '_' . static::cleanGroupName( $group ) );
/* Still here */
if ( !in_array( $key, array_keys( self::$calledTemplates ) ) )
if ( !in_array( $key, array_keys( static::$calledTemplates ) ) )
{
/* If we don't have a compiled template, do that now */
if ( !isset( \IPS\Data\Store::i()->$key ) )
@@ -556,15 +593,21 @@ class _Theme extends \IPS\Theme
/* Still no key? */
if ( ! isset( \IPS\Data\Store::i()->$key ) )
{
\IPS\Log::i( LOG_WARNING )->write( "Template store key: {$key} missing ({$app}, {$location}, {$group})", "template_store_missing" );
\IPS\Log::log( "Template store key: {$key} missing ({$app}, {$location}, {$group})", "template_store_missing" );
throw new \ErrorException('template_store_missing ' . $key);
}
/* Load compiled template */
$compiledGroup = \IPS\Data\Store::i()->$key;
if ( @eval( $compiledGroup ) === FALSE )
try
{
if ( @eval( $compiledGroup ) === FALSE )
{
throw new \UnexpectedValueException;
}
}
catch ( \ParseError $e )
{
throw new \UnexpectedValueException;
}
@@ -574,10 +617,10 @@ class _Theme extends \IPS\Theme
$class = "\IPS\Theme\\{$class}";
/* Init */
self::$calledTemplates[ $key ] = new $class();
static::$calledTemplates[ $key ] = new $class();
}
return self::$calledTemplates[ $key ];
return static::$calledTemplates[ $key ];
}
}
@@ -603,17 +646,21 @@ class _Theme extends \IPS\Theme
/* Any template hooks? */
$templateHooks = array();
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 $k => $data )
{
if ( !class_exists( "IPS\Theme\hook{$k}", FALSE ) )
{
if ( @eval( "namespace IPS\Theme;\n\n" . str_replace( ' extends _HOOK_CLASS_', '', file_get_contents( \IPS\ROOT_PATH . '/' . $data['file'] ) ) ) !== FALSE )
try
{
$class = "IPS\Theme\hook{$data['class']}";
$templateHooks = array_merge( $templateHooks, $class::hookData() );
if ( @eval( "namespace IPS\Theme;\n\n" . str_replace( ' extends _HOOK_CLASS_', '', file_get_contents( \IPS\ROOT_PATH . '/' . $data['file'] ) ) ) !== FALSE )
{
$class = "IPS\Theme\hook{$data['class']}";
$templateHooks = array_merge( $templateHooks, $class::hookData() );
}
}
catch ( \ParseError $e ) {}
}
}
}