Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

@@ -205,8 +205,7 @@ class _themes extends \IPS\Node\Controller
else
{
/* Toggle the setting */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'theme_designers_mode' ) );
unset( \IPS\Data\Store::i()->settings );
\IPS\Settings::i()->changeValues( array( 'theme_designers_mode' => 0 ) );
/* Finished */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=manage' ), 'saved' );
@@ -376,7 +375,7 @@ class _themes extends \IPS\Node\Controller
$_SESSION['theme_dev_import'] = $toImport;
return array( $data, \IPS\Member::loggedIn()->language()->addToStack('theme_dev_import', FALSE, array( 'sprintf' => array( $theme->_title, ucfirst( $app ) ) ) ) );
return array( $data, \IPS\Member::loggedIn()->language()->addToStack('theme_dev_import', FALSE, array( 'sprintf' => array( $theme->_title, mb_ucfirst( $app ) ) ) ) );
}
else
{
@@ -412,8 +411,7 @@ class _themes extends \IPS\Node\Controller
unset( $_SESSION['theme_dev_import'] );
/* Toggle the setting */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'theme_designers_mode' ) );
unset( \IPS\Data\Store::i()->settings );
\IPS\Settings::i()->changeValues( array( 'theme_designers_mode' => 0 ) );
/* Finished */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=manage' ), 'completed' );
@@ -457,8 +455,7 @@ class _themes extends \IPS\Node\Controller
if ( ! $needsBuilding )
{
/* Toggle the setting */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), array( 'conf_key=?', 'theme_designers_mode' ) );
unset( \IPS\Data\Store::i()->settings );
\IPS\Settings::i()->changeValues( array( 'theme_designers_mode' => 1 ) );
/* Finished */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=manage' ), 'completed' );
@@ -591,8 +588,7 @@ class _themes extends \IPS\Node\Controller
function()
{
/* Toggle the setting */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), array( 'conf_key=?', 'theme_designers_mode' ) );
unset( \IPS\Data\Store::i()->settings );
\IPS\Settings::i()->changeValues( array( 'theme_designers_mode' => 1 ) );
/* Finished */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=manage' ), 'completed' );
@@ -828,7 +824,7 @@ class _themes extends \IPS\Node\Controller
\IPS\Member::loggedIn()->language()->words['core_theme_resource_name_choice_o_filename_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('core_theme_resource_name_choice_o_filename_desc'), $current['resource_name'] );
}
$form->add( new \IPS\Helpers\Form\Upload( 'core_theme_resource_filename', ( isset( $current['resource_filename'] ) ? \IPS\File::get( 'core_Theme', $current['resource_filename'] ) : NULL ), FALSE, array( 'obscure' => FALSE, 'maxFileSize' => 1.2, 'storageExtension' => 'core_Theme', 'storageContainer' => 'set_resources_' . $set->_id ), NULL, NULL, NULL, 'core_theme_resource_filename' ) );
$form->add( new \IPS\Helpers\Form\Upload( 'core_theme_resource_filename', ( isset( $current['resource_filename'] ) ? \IPS\File::get( 'core_Theme', $current['resource_filename'] ) : NULL ), TRUE, array( 'obscure' => FALSE, 'maxFileSize' => 1.2, 'storageExtension' => 'core_Theme', 'storageContainer' => 'set_resources_' . $set->_id ), NULL, NULL, NULL, 'core_theme_resource_filename' ) );
if ( $values = $form->values() )
{
@@ -865,7 +861,7 @@ class _themes extends \IPS\Node\Controller
\IPS\Db::i()->select( '*', 'core_theme_resources', array( 'resource_set_id=? and resource_path=? and resource_location=? and resource_app=? and resource_name=?', $set->_id, $save['resource_path'], $save['resource_location'], $save['resource_app'], $save['resource_name'] ) )->first();
$ext = mb_substr( $save['resource_name'], ( mb_strrpos( $save['resource_name'], '.' ) + 1 ) );
$save['resource_name'] = mb_substr( $save['resource_name'], 0, ( mb_strrpos( $save['resource_name'], '.' ) ) ) . '_' . uniqid() . '.' . $ext;
$save['resource_name'] = mb_substr( $save['resource_name'], 0, ( mb_strrpos( $save['resource_name'], '.' ) ) ) . '_' . mt_rand() . '.' . $ext;
}
catch( \UnderflowException $ex ) { }
@@ -894,6 +890,8 @@ class _themes extends \IPS\Node\Controller
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=resources&set_id=' . $set->_id ), 'saved' );
}
\IPS\Theme::setThemeCustomized( $set->_id );
/* Display */
$title = \IPS\Member::loggedIn()->language()->addToStack('theme_custom_resources_page_title', FALSE, array( 'sprintf' => array( $set->_title ) ) );
@@ -1053,7 +1051,7 @@ class _themes extends \IPS\Node\Controller
{
$_SESSION['theme_import'] = array( 'css' => array(), 'isNewSet' => false );
/* Save snaphot */
/* Save snapshot */
\IPS\Theme::load( \IPS\Request::i()->id )->saveHistorySnapshot();
/* Wipe clean conflicts */
@@ -1122,7 +1120,7 @@ class _themes extends \IPS\Node\Controller
}
}
/* Start impoprting */
/* Start importing */
$data = array( 'apps' => array() );
return array( $data, \IPS\Member::loggedIn()->language()->addToStack('processing') );
}
@@ -1220,6 +1218,7 @@ class _themes extends \IPS\Node\Controller
$location = $xml->getAttribute('template_location');
$group = $xml->getAttribute('template_group');
$name = $xml->getAttribute('template_name');
$isMaster = \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_templates', array( 'template_app=? and template_location=? and template_group=? and template_name=? and template_set_id=0 and template_added_to=0', $appKey, $location, $group, $name ) )->first();
if ( isset( $templates[ $appKey ][ $location ][ $group ][ $name ] ) AND $templates[ $appKey ][ $location ][ $group ][ $name ]['template_user_edited'] )
{
@@ -1249,11 +1248,10 @@ class _themes extends \IPS\Node\Controller
'template_content' => $xml->readString(),
'template_updated' => time(),
'template_removable' => 1,
'template_user_added' => 0,
'template_user_added' => $isMaster ? 0 : 1,
'template_user_edited'=> 0,
'template_version' => $version,
'template_added_to' => \IPS\Request::i()->id,
'template_unique_key' => md5( \IPS\Request::i()->id . ';' . $appKey . ';' . $location . ';' . $group . ';' . mb_strtolower( $name ) )
'template_added_to' => \IPS\Request::i()->id
) );
}
break;
@@ -1262,6 +1260,9 @@ class _themes extends \IPS\Node\Controller
$path = $xml->getAttribute('css_path');
$name = $xml->getAttribute('css_name');
$isMaster = \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_css', array( 'css_app=? and css_location=? and css_path=? and css_name=? and css_set_id=0 and css_added_to=0', $appKey, $location, $path, $name ) )->first();
if ( isset( $css[ $appKey ][ $location ][ $path ][ $name ] ) AND $css[ $appKey ][ $location ][ $path ][ $name ]['css_user_edited'] )
{
/* Keep this */
@@ -1286,7 +1287,7 @@ class _themes extends \IPS\Node\Controller
$edited = 0;
$addedTo = \IPS\Request::i()->id;
if ( in_array( $name, $masterCss[ $appKey ][ $location ][ $path ] ) )
if ( $isMaster )
{
$edited = time();
$addedTo = 0;
@@ -1303,8 +1304,7 @@ class _themes extends \IPS\Node\Controller
'css_content' => $xml->readString(),
'css_version' => $version,
'css_user_edited'=> $edited,
'css_added_to' => $addedTo,
'css_unique_key' => md5( \IPS\Request::i()->id . ';' . $xml->getAttribute('css_app') . ';' . $xml->getAttribute('css_location') . ';' . $xml->getAttribute('css_path') . ';' . $xml->getAttribute('css_name') )
'css_added_to' => $addedTo
), true );
}
break;
@@ -1464,6 +1464,8 @@ class _themes extends \IPS\Node\Controller
$app->installThemeSettings( true );
}
\IPS\Theme::setThemeCustomized( $set->id );
/* Conflicts to fix? */
if ( \IPS\Db::i()->select( 'count(*)', 'core_theme_conflict', array( 'conflict_set_id=?', \IPS\Request::i()->id ) )->first() )
{
@@ -1979,7 +1981,7 @@ class _themes extends \IPS\Node\Controller
/* Templates */
$templates = $themeSet->getRawTemplates( $appDir, '', '', \IPS\Theme::RETURN_ALL );
if ( count( $templates[ $appDir->directory ] ) )
if ( isset( $templates[ $appDir->directory ] ) AND count( $templates[ $appDir->directory ] ) )
{
foreach( $templates[ $appDir->directory ] as $loc => $lv )
{
@@ -2360,7 +2362,8 @@ class _themes extends \IPS\Node\Controller
if ( $values = $form->values() )
{
$id = intval( \IPS\Request::i()->id );
$save = array( 'app' => $values['theme_template_app'],
$save = array( 'set_id' => $id,
'app' => $values['theme_template_app'],
'location' => $values['theme_template_location'],
'group' => ( $values['theme_template_group_type'] == 'existing' ) ? $values['theme_template_group_existing'] : $values['theme_template_group_new'],
'name' => $values['theme_template_name'],
@@ -2468,6 +2471,11 @@ class _themes extends \IPS\Node\Controller
{
\IPS\Output::i()->error( 'node_error', '3S121/1', 500, '' );
}
catch( \UnderflowException $ex )
{
/* This means the template to delete was not found - so we really don't need to worry about the error */
$template = array();
}
if ( isset( $template['app'] ) )
{
@@ -2531,8 +2539,14 @@ class _themes extends \IPS\Node\Controller
}
catch( \OutOfRangeException $ex )
{
\IPS\Log::log( $ex, 'template_error' );
\IPS\Output::i()->error( 'node_error', '3S121/2', 500, '' );
}
catch( \UnderflowException $ex )
{
\IPS\Log::log( $ex, 'template_error' );
\IPS\Output::i()->error( 'node_error', '3C163/I', 500, '' );
}
catch( \InvalidArgumentException $ex )
{
$msg = $ex->getMessage();
@@ -2758,7 +2772,7 @@ class _themes extends \IPS\Node\Controller
{
$customVersion = \IPS\Db::i()->select( '*', 'core_theme_templates', array( 'template_id=?', (int) \IPS\Request::i()->t_item_id ) )->first();
$rawTemplates = \IPS\Theme::master()->getRawTemplates( $customVersion['template_app'], $customVersion['template_location'], $customVersion['template_group'], \IPS\Theme::RETURN_ALL, TRUE );
$original = $rawTemplates[ $customVersion['template_app'] ][ $customVersion['template_location'] ][ $customVersion['template_group'] ][ $customVersion['template_name'] ]['template_content'];
$original = isset( $rawTemplates[ $customVersion['template_app'] ][ $customVersion['template_location'] ][ $customVersion['template_group'] ][ $customVersion['template_name'] ] ) ? $rawTemplates[ $customVersion['template_app'] ][ $customVersion['template_location'] ][ $customVersion['template_group'] ][ $customVersion['template_name'] ]['template_content'] : '';
}
\IPS\Output::i()->json( $original );