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 Advanced theming 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 06 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -38,6 +38,11 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
*/
|
||||
public static $toBuild = null;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
protected static $multitons;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -58,7 +63,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
|
||||
if ( \IPS\Theme::load( $setId )->canAccess() !== true )
|
||||
{
|
||||
$setId = \IPS\Theme::defaultTheme();
|
||||
$setId = ( $column == 'skin' ? \IPS\Theme::defaultTheme() : \IPS\Theme::defaultAcpTheme() );
|
||||
|
||||
/* Restore default theme for member */
|
||||
\IPS\Member::loggedIn()->$column = $setId;
|
||||
@@ -67,13 +72,13 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
}
|
||||
else
|
||||
{
|
||||
$setId = \IPS\Theme::defaultTheme();
|
||||
$setId = ( $column == 'skin' ? \IPS\Theme::defaultTheme() : \IPS\Theme::defaultAcpTheme() );
|
||||
}
|
||||
|
||||
static::$currentThemeId = ( static::$currentThemeId ) ? static::$currentThemeId : $setId;
|
||||
|
||||
|
||||
/* Check to make sure the files are there */
|
||||
if ( ! is_dir( static::_getHtmlPath('core') ) OR ! is_dir( static::_getCssPath('core') ) OR ! is_dir( static::_getResourcePath('core') ) )
|
||||
if ( static::$buildingFiles === FALSE and ( ! is_dir( static::_getHtmlPath('core') ) OR ! is_dir( static::_getCssPath('core') ) OR ! is_dir( static::_getResourcePath('core') ) ) )
|
||||
{
|
||||
/* Toggle the setting as something has gone wrong */
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'theme_designers_mode' ) );
|
||||
@@ -359,28 +364,31 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
\IPS\Output::i()->error( 'theme_dm_err_cant_write_into_theme_id', '4S142/4', 403, '' );
|
||||
}
|
||||
|
||||
if ( !file_exists( $dirToWrite . '/lang.php' ) )
|
||||
/* Make sure previous versions of this file are removed */
|
||||
if ( file_exists( $dirToWrite . '/lang.php' ) )
|
||||
{
|
||||
$languageStrings = \IPS\Db::i()->select( 'word_key, word_default', 'core_sys_lang_words', array( 'word_theme=?', static::$currentThemeId ) )->setKeyField('word_key')->setValueField('word_default');
|
||||
|
||||
if( count( $languageStrings ) )
|
||||
{
|
||||
$langToWrite = "\$lang = array(\n";
|
||||
|
||||
foreach( $languageStrings as $key => $string )
|
||||
{
|
||||
$langToWrite .= "'{$key}'\t\t=> '" . str_replace( "'", "\\'", $string ) . "',\n";
|
||||
}
|
||||
|
||||
$langToWrite .= ");";
|
||||
}
|
||||
else
|
||||
{
|
||||
$langToWrite = "\$lang = array(\n\t\n);";
|
||||
}
|
||||
|
||||
@\file_put_contents( $dirToWrite . '/lang.php', '<?' . "php\n\n{$langToWrite}\n" );
|
||||
unlink( $dirToWrite . '/lang.php' );
|
||||
}
|
||||
|
||||
$languageStrings = \IPS\Db::i()->select( 'word_key, word_default', 'core_sys_lang_words', array( 'word_theme=?', static::$currentThemeId ) )->setKeyField('word_key')->setValueField('word_default');
|
||||
|
||||
if( count( $languageStrings ) )
|
||||
{
|
||||
$langToWrite = "\$lang = array(\n";
|
||||
|
||||
foreach( $languageStrings as $key => $string )
|
||||
{
|
||||
$langToWrite .= "'{$key}'\t\t=> '" . str_replace( "'", "\\'", $string ) . "',\n";
|
||||
}
|
||||
|
||||
$langToWrite .= ");";
|
||||
}
|
||||
else
|
||||
{
|
||||
$langToWrite = "\$lang = array(\n\t\n);";
|
||||
}
|
||||
|
||||
@\file_put_contents( $dirToWrite . '/lang.php', '<?' . "php\n\n{$langToWrite}\n" );
|
||||
|
||||
return $dirToWrite;
|
||||
}
|
||||
@@ -594,11 +602,31 @@ class _Theme extends \IPS\Theme\Dev\Theme
|
||||
{
|
||||
$pathToWrite = static::_writeThemePathDirectory( $app, 'html', $app . '/' . $location . '/' . $group );
|
||||
|
||||
/* On case sensitive file systems, ensure that a template with the same name but different case doesn't exist */
|
||||
$fileMap = array();
|
||||
foreach( new \DirectoryIterator( $pathToWrite ) as $file )
|
||||
{
|
||||
if ( $file->isDot() || mb_substr( $file->getFilename(), 0, 1 ) === '.' || $file == 'index.html' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$fileMap[ mb_strtolower( $file->getFilename() ) ][] = $file->getFilename();
|
||||
}
|
||||
|
||||
foreach( $templates[ $app ][ $location ][ $group ] as $name => $data )
|
||||
{
|
||||
$write = '<ips:template parameters="' . $data['template_data'] . '" />' . "\n";
|
||||
$write .= $data['template_content'];
|
||||
|
||||
if ( isset( $fileMap[ mb_strtolower( $data['template_name'] . '.phtml' ) ] ) )
|
||||
{
|
||||
foreach( $fileMap[ mb_strtolower( $data['template_name'] . '.phtml' ) ] as $file )
|
||||
{
|
||||
@unlink( $pathToWrite . '/' . $file );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! @\file_put_contents( $pathToWrite . '/' . $data['template_name'] . '.phtml', $write ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'theme_dm_err_cant_write_template', '4S142/9', 403, '' );
|
||||
|
||||
Reference in new issue
Block a user