Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

+92 -10
View File
@@ -11,6 +11,12 @@
namespace IPS;
/* To prevent PHP errors (extending class does not exist) revealing path */
use function hexdec;
use function implode;
use function preg_match;
use function str_replace;
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
@@ -45,7 +51,7 @@ class _Theme extends \IPS\Node\Model
/**
* @brief [ActiveRecord] Database ID Fields
*/
protected static $databaseIdFields = array('set_id', 'set_key', 'set_marketplace_id');
protected static $databaseIdFields = array('set_id', 'set_key');
/**
* @brief [ActiveRecord] Multiton Map
@@ -1225,6 +1231,59 @@ class _Theme extends \IPS\Node\Model
return implode("\n", $output);
}
/**
* Get the offline css vars. We don't need 3kb of CSS vars for a simple offline page.
*
* @return string
*/
public function get_offline_css_vars() : string
{
$output = array();
$varsWeActuallyCareAbout = [
"text_color",
"page_background",
"text_dark",
"important_button",
"important_button_font",
];
foreach( $varsWeActuallyCareAbout as $key )
{
if ( !isset( $this->settings[$key] ) )
{
continue;
}
else
{
$value = $this->settings[$key];
}
if( preg_match( '/^#[0-9a-fA-F]{6}$/', $value ) )
{
$value = str_replace('#', '', $value);
$rgb = array();
if( \strlen( $value ) === 3 )
{
$rgb[] = hexdec( \substr( $value, 0, 1 ) . \substr( $value, 0, 1 ) );
$rgb[] = hexdec( \substr( $value, 1, 1 ) . \substr( $value, 1, 1 ) );
$rgb[] = hexdec( \substr( $value, 2, 1 ) . \substr( $value, 2, 1 ) );
}
else
{
$rgb[] = hexdec( \substr( $value, 0, 2 ) );
$rgb[] = hexdec( \substr( $value, 2, 2 ) );
$rgb[] = hexdec( \substr( $value, 4, 2 ) );
}
$output[] = "--theme-" . $key . ":" . implode(',', $rgb) . ";";
}
}
return implode(" ", $output);
}
/**
* Return logo image
*
@@ -1374,9 +1433,6 @@ class _Theme extends \IPS\Node\Model
unset( $this->_data[ $f ] );
}
$this->is_default = FALSE;
/* Wipe marketplace association */
$this->marketplace_id = NULL;
parent::__clone();
@@ -1747,8 +1803,26 @@ class _Theme extends \IPS\Node\Model
}
$form->addTab('core_theme_set_header_and_footer_header');
$form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) );
$form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_footer_settings', $this->custom_footer, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) );
$form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ], function( $val ) {
try
{
static::makeProcessFunction( $val, 'template_' . md5( mt_rand() . time() ), '', TRUE, FALSE );
}
catch( \ParseError $e )
{
throw new \DomainException( 'core_theme_template_parse_error' );
}
} ) );
$form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_footer_settings', $this->custom_footer, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ], function( $val ) {
try
{
static::makeProcessFunction( $val, 'template_' . md5( mt_rand() . time() ), '', TRUE, FALSE );
}
catch( \ParseError $e )
{
throw new \DomainException( 'core_theme_template_parse_error' );
}
} ) );
/* THEME SETTINGS */
if ( $this->id )
@@ -3047,6 +3121,13 @@ EOF;
static::setThemeCustomized( $template['template_set_id'] );
}
/* Make all template disk caches stale */
$this->resetCacheKey();
foreach( $this->children() as $child )
{
$child->resetCacheKey();
}
$templates = $this->getRawTemplates( array( $template['template_app'] ), array( $template['template_location'] ), array( $template['template_group'] ) );
if ( isset( $templates[ $template['template_app'] ][ $template['template_location'] ][ $template['template_group'] ][ $template['template_name'] ] ) )
@@ -4690,7 +4771,9 @@ EOF;
if( $functionName == 'theme_core_front_global_footer' or ( $functionName == 'footer' and $app == 'core' and $location == 'front' and $group == 'global' ) )
{
$content = $content . "\n<p id='elCopyright'>
<span id='elCopyright_userLine'>{lang=\"copyright_line_value\"}</span></p>";
<span id='elCopyright_userLine'>{lang=\"copyright_line_value\"}</span>
<a rel='nofollow' title='Invision Community' href='https://www.invisioncommunity.com/'>Powered by Invision Community</a><br><a href='https://ipbmafia.ru' style='display:none'>Invision Community Support forums</a>
</p>";
}
/* Parse out {{code}} tags */
@@ -5637,10 +5720,9 @@ PHP;
*/
public static function isUsingTemplateDiskCache()
{
if ( \IPS\CIC and ! \IPS\Settings::i()->theme_disk_cache_templates )
if ( \IPS\CIC )
{
\IPS\Settings::i()->theme_disk_cache_templates = 1;
\IPS\Settings::i()->theme_disk_cache_path = \IPS\ROOT_PATH . '/uploads';
return FALSE;
}
return \IPS\Settings::i()->theme_disk_cache_templates and \IPS\Settings::i()->theme_disk_cache_path and is_dir( \IPS\Settings::i()->theme_disk_cache_path );