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\Theme\Advanced;
|
||||
|
||||
/* 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;
|
||||
@@ -49,20 +49,13 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$column = 'skin';
|
||||
|
||||
if( \IPS\Dispatcher::hasInstance() )
|
||||
if ( \IPS\Member::loggedIn()->skin and array_key_exists( \IPS\Member::loggedIn()->skin, \IPS\Theme::themes() ) )
|
||||
{
|
||||
$column = ( \IPS\Dispatcher::i()->controllerLocation == 'admin' ) ? 'acp_skin' : 'skin';
|
||||
}
|
||||
|
||||
if ( \IPS\Member::loggedIn()->$column and array_key_exists( \IPS\Member::loggedIn()->$column, \IPS\Theme::themes() ) )
|
||||
{
|
||||
$setId = \IPS\Member::loggedIn()->$column;
|
||||
$setId = \IPS\Member::loggedIn()->skin;
|
||||
|
||||
if ( \IPS\Theme::load( $setId )->canAccess() !== true )
|
||||
{
|
||||
$setId = ( $column == 'skin' ? \IPS\Theme::defaultTheme() : \IPS\Theme::defaultAcpTheme() );
|
||||
$setId = \IPS\Theme::defaultTheme();
|
||||
|
||||
/* Restore default theme for member */
|
||||
\IPS\Member::loggedIn()->$column = $setId;
|
||||
@@ -71,7 +64,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
}
|
||||
else
|
||||
{
|
||||
$setId = ( $column == 'skin' ? \IPS\Theme::defaultTheme() : \IPS\Theme::defaultAcpTheme() );
|
||||
$setId = \IPS\Theme::defaultTheme();
|
||||
}
|
||||
|
||||
static::$currentThemeId = ( static::$currentThemeId ) ? static::$currentThemeId : $setId;
|
||||
@@ -368,7 +361,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
|
||||
$languageStrings = \IPS\Db::i()->select( 'word_key, word_default', 'core_sys_lang_words', array( 'word_theme=? and lang_id=?', static::$currentThemeId, \IPS\Lang::defaultLanguage() ) )->setKeyField('word_key')->setValueField('word_default');
|
||||
|
||||
if( count( $languageStrings ) )
|
||||
if( \count( $languageStrings ) )
|
||||
{
|
||||
$langToWrite = "\$lang = array(\n";
|
||||
|
||||
@@ -426,9 +419,10 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
/**
|
||||
* Writes the /application/{app}/dev/{container}/{path} directory
|
||||
*
|
||||
* @param string $app Application Directory
|
||||
* @param string $container Path to create (e.g. admin, front)
|
||||
* @return string Path created
|
||||
* @param string $app Application Directory
|
||||
* @param string $container Path to create (e.g. admin, front)
|
||||
* @param string $path Path
|
||||
* @return string Path created
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected static function _writeThemePathDirectory( $app, $container, $path )
|
||||
@@ -469,7 +463,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
static::_writeThemeIdDirectory();
|
||||
static::_writeThemeContainerDirectory( $app, 'resources');
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_theme_resources', array( 'resource_set_id=?', static::$currentThemeId ) )->setKeyField('resource_id') as $resourceId => $resource )
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_theme_resources', array( 'resource_set_id=? and resource_location!=?', static::$currentThemeId, 'admin' ) )->setKeyField('resource_id') as $resourceId => $resource )
|
||||
{
|
||||
static::_writeThemePathDirectory( $app, 'resources', $resource['resource_app'] );
|
||||
$pathToWrite = static::_writeThemePathDirectory( $app, 'resources', $resource['resource_app'] . '/' . $resource['resource_location'] );
|
||||
@@ -509,7 +503,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
static::_writeThemeIdDirectory();
|
||||
static::_writeThemeContainerDirectory( $app, 'css');
|
||||
|
||||
$css = static::load( static::$currentThemeId )->getRawCss();
|
||||
$css = static::load( static::$currentThemeId )->getRawCss( array(), array( 'global', 'front' ) );
|
||||
|
||||
foreach( $css as $app => $data )
|
||||
{
|
||||
@@ -552,7 +546,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
$params[] = 'hidden="1"';
|
||||
}
|
||||
|
||||
if ( count( $params ) )
|
||||
if ( \count( $params ) )
|
||||
{
|
||||
$write .= '/*<ips:css ' . implode( ' ', $params ) . ' />*/' . "\n";
|
||||
}
|
||||
@@ -585,7 +579,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
static::_writeThemeIdDirectory();
|
||||
static::_writeThemeContainerDirectory( $app, 'html');
|
||||
|
||||
$templates = static::load( static::$currentThemeId )->getRawTemplates( $app );
|
||||
$templates = static::load( static::$currentThemeId )->getRawTemplates( $app, array( 'global', 'front' ) );
|
||||
|
||||
foreach( $templates as $app => $data )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user