Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -40,7 +40,7 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$theme = \IPS\Theme::load( intval( \IPS\Request::i()->cookie['vseThemeId'] ) );
|
||||
$theme = \IPS\Theme::load( \intval( \IPS\Request::i()->cookie['vseThemeId'] ) );
|
||||
|
||||
if ( ! $theme->by_skin_gen )
|
||||
{
|
||||
@@ -65,7 +65,6 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
/* JS */
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'library.js' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'js/jslang.php?langId=' . \IPS\Member::loggedIn()->language()->id, 'core', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jscolor/jscolor.js', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'framework.js' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'app.js' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'vse/vsedata.js', 'core', 'interface' ) );
|
||||
@@ -75,32 +74,49 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
|
||||
|
||||
$css = $theme->getRawCss( 'core', 'front', 'custom', \IPS\Theme::RETURN_ALL, true );
|
||||
$vseCss = null;
|
||||
$customCss = null;
|
||||
|
||||
/* VSE CSS */
|
||||
if ( isset( $css['core']['front']['custom']['vse.css'] ) )
|
||||
{
|
||||
$functionName = "css_" . mt_rand();
|
||||
\IPS\Theme::makeProcessFunction( \IPS\Theme::fixResourceTags( $css['core']['front']['custom']['vse.css']['css_content'], 'front' ), $functionName, '', FALSE, TRUE );
|
||||
$vseCss = call_user_func( 'IPS\\Theme\\'. $functionName );
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $css['core']['front']['custom']['custom.css'] ) )
|
||||
{
|
||||
/* Custom CSS */
|
||||
$functionName = "css_" . mt_rand();
|
||||
\IPS\Theme::makeProcessFunction( \IPS\Theme::fixResourceTags( $css['core']['front']['custom']['custom.css']['css_content'], 'front' ), $functionName, '', FALSE, TRUE );
|
||||
$customCss = call_user_func( 'IPS\\Theme\\'. $functionName );
|
||||
$themeFunction = 'IPS\\Theme\\'. $functionName;
|
||||
$customCss = $themeFunction();
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', NULL );
|
||||
$settings = $theme->getThemeSettings();
|
||||
$settingKeyValues = array();
|
||||
$colorValues = array();
|
||||
|
||||
foreach( $settings as $key => $data )
|
||||
{
|
||||
$settingKeyValues[ $key ] = $data['_value'];
|
||||
|
||||
if( $data['sc_type'] === 'Color' )
|
||||
{
|
||||
if( preg_match( '/^#?[0-9a-fA-F]{6}$/', $data['_value'] ) )
|
||||
{
|
||||
$colorValue = str_replace('#', '', $data['_value']);
|
||||
$rgb = array();
|
||||
|
||||
if( \strlen( $colorValue ) === 3 )
|
||||
{
|
||||
$rgb[] = hexdec( \substr( $colorValue, 0, 1 ) . \substr( $colorValue, 0, 1 ) );
|
||||
$rgb[] = hexdec( \substr( $colorValue, 1, 1 ) . \substr( $colorValue, 1, 1 ) );
|
||||
$rgb[] = hexdec( \substr( $colorValue, 2, 1 ) . \substr( $colorValue, 2, 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$rgb[] = hexdec( \substr( $colorValue, 0, 2 ) );
|
||||
$rgb[] = hexdec( \substr( $colorValue, 2, 2 ) );
|
||||
$rgb[] = hexdec( \substr( $colorValue, 4, 2 ) );
|
||||
}
|
||||
|
||||
$colorValues[ $key ] = implode( $rgb, ', ');
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data['sc_show_in_vse'] )
|
||||
{
|
||||
@@ -122,7 +138,7 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
$content = json_decode( $data['sc_content'], TRUE );
|
||||
|
||||
$options = array();
|
||||
if( is_array( $content ) )
|
||||
if( \is_array( $content ) )
|
||||
{
|
||||
foreach( $content as $_content )
|
||||
{
|
||||
@@ -147,7 +163,8 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Template */
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'vse', 'core', 'front' )->globalTemplate( $vseCss, $customCss, $settingKeyValues, (string) $form, $theme->skin_gen_data );
|
||||
/* @note The first param used to be the VSE CSS, however as of 4.5 we handle the VSE differently and it is no longer used */
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'vse', 'core', 'front' )->globalTemplate( NULL, $customCss, $settingKeyValues, (string) $form, $theme->skin_gen_data, $colorValues );
|
||||
|
||||
\IPS\Output::i()->sendOutput( \IPS\Output::i()->output, 200, 'text/html' );
|
||||
}
|
||||
@@ -203,7 +220,7 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( isset( \IPS\Request::i()->cookie['vseThemeId'] ) )
|
||||
{
|
||||
$theme = \IPS\Theme::load( intval( \IPS\Request::i()->cookie['vseThemeId'] ) );
|
||||
$theme = \IPS\Theme::load( \intval( \IPS\Request::i()->cookie['vseThemeId'] ) );
|
||||
|
||||
if ( ! $theme->by_skin_gen )
|
||||
{
|
||||
@@ -216,7 +233,7 @@ class _vse extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->json( 'NO_PERMISSION', 403 );
|
||||
}
|
||||
|
||||
$theme->vseSave( \IPS\Request::i()->css, \IPS\Request::i()->customcss, \IPS\Request::i()->settings, \IPS\Request::i()->values );
|
||||
$theme->vseSave( \IPS\Request::i()->colors, \IPS\Request::i()->customcss, \IPS\Request::i()->settings );
|
||||
|
||||
\IPS\File::getClass('core_Theme')->deleteContainer( 'css_built_' . $theme->id );
|
||||
$theme->css_map = array();
|
||||
|
||||
Reference in new issue
Block a user