Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief theme Settings
* @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 17 May 2013
* @version SVN_VERSION_NUMBER
*/
@@ -29,7 +29,9 @@ class _themesettings extends \IPS\Dispatcher\Controller
* @return void
*/
public function execute()
{
{
\IPS\Dispatcher::i()->checkAcpPermission( 'theme_sets_manage' );
parent::execute();
/* Display */
@@ -84,7 +86,7 @@ class _themesettings extends \IPS\Dispatcher\Controller
$_tabs = array_keys( $tabs );
$activeTab = array_shift( $_tabs );
}
/* Create tree */
$self = $this;
$tree = new \IPS\Helpers\Tree\Tree(
@@ -299,7 +301,10 @@ class _themesettings extends \IPS\Dispatcher\Controller
throw new \InvalidArgumentException('core_theme_settings_error_key_not_unique');
}
}
else
{
throw new \InvalidArgumentException('core_theme_settings_error_key_not_unique');
}
}
catch( \UnderflowException $e )
{
@@ -328,13 +333,10 @@ class _themesettings extends \IPS\Dispatcher\Controller
$form->hiddenValues['theme_custom_setting_tab_key_type'] = 'new';
}
$form->add( new \IPS\Helpers\Form\Translatable( 'theme_template_tab_key_new', NULL, FALSE, array(
'app' => 'core',
'key' => ( $current ? "theme_custom_tab_{$current['sc_tab_key']}" : NULL )
),
$form->add( new \IPS\Helpers\Form\Text( 'theme_template_tab_key_new', NULL, FALSE, array( 'regex' => '#[0-9a-z_]+#' ),
function( $val )
{
$val = preg_replace( '#[^0-9a-z_]#', '', mb_strtolower( $val[ \IPS\Lang::defaultLanguage() ] ) );
$val = preg_replace( '#[^0-9a-z_]#', '', mb_strtolower( $val ) );
if ( \IPS\Request::i()->theme_custom_setting_tab_key_type === 'new' )
{
@@ -384,7 +386,7 @@ class _themesettings extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\Stack( 'theme_custom_setting_type_content', ( $id and $current['sc_type'] != 'other' ) ? json_decode( $current['sc_content'], TRUE ) : array(), FALSE, array( 'stackFieldType' => 'KeyValue' ), NULL, NULL, NULL, 'sc_content' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'theme_custom_setting_type_multiple', $id ? $current['sc_multiple'] : FALSE, FALSE, array(), NULL, NULL, NULL, 'sc_multiple' ) );
$form->add( new \IPS\Helpers\Form\Codemirror( 'theme_custom_setting_manual_code', '<?php' . "\n\n" . ( ( $id and $current['sc_type'] == 'other' ) ? $current['sc_content'] : 'return new \IPS\Helpers\Form\Text( "core_theme_setting_title_{$row[\'sc_id\']}", $value, FALSE, array(), NULL, NULL, NULL, \'theme_setting_\' . $row[\'sc_key\'] );' ), NULL, array( 'mode' => 'php' ), function( $val )
$form->add( new \IPS\Helpers\Form\Codemirror( 'theme_custom_setting_manual_code', '<?php' . "\n\n" . ( ( $id and $current['sc_type'] == 'other' ) ? $current['sc_content'] : 'return new \IPS\Helpers\Form\Text( "core_theme_setting_title_{$row[\'sc_id\']}", $value, FALSE, array(), NULL, NULL, NULL, \'theme_setting_\' . $row[\'sc_key\'] );' ), NULL, array( 'mode' => 'php' ), function( $val ) use ( $set )
{
$val = trim( preg_replace( '/^<\?php(.*)$/is', '$1', trim( $val ) ) );
@@ -392,6 +394,7 @@ class _themesettings extends \IPS\Dispatcher\Controller
{
$row = array( 'sc_id' => 0, 'sc_key' => \IPS\Request::i()->theme_custom_setting_key );
$value = NULL;
$theme = $set;
if ( !( eval( $val ) instanceof \IPS\Helpers\Form\FormAbstract ) )
{
throw new \DomainException('theme_custom_setting_manual_code_bad');
@@ -410,6 +413,9 @@ class _themesettings extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\YesNo( 'theme_custom_setting_show_in_vse', $id ? $current['sc_show_in_vse'] : FALSE, FALSE, array(), NULL, NULL, NULL, 'sc_show_in_vse' ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'theme_custom_setting_conditional', $id ? $current['sc_condition'] : FALSE, FALSE, array( 'togglesOn' => array( 'theme_custom_setting_condition' ) ), NULL, NULL, NULL, 'theme_custom_setting_conditional' ) );
$form->add( new \IPS\Helpers\Form\CodeMirror( 'theme_custom_setting_condition', '<?php' . "\n\n" . ( ( $id and $current['sc_condition'] ) ? $current['sc_condition'] : 'return TRUE;' ), FALSE, array( 'mode' => 'php' ), NULL, NULL, NULL, 'theme_custom_setting_condition' ) );
if ( $values = $form->values() )
{
$save = array(
@@ -423,6 +429,7 @@ class _themesettings extends \IPS\Dispatcher\Controller
'sc_show_in_vse' => ( isset( $values['theme_custom_setting_show_in_vse'] ) ) ? $values['theme_custom_setting_show_in_vse'] : 0,
'sc_content' => ( $values['theme_custom_setting_type'] === 'other' ) ? trim( preg_replace( '/^<\?php(.*)$/is', '$1', trim( $values['theme_custom_setting_manual_code'] ) ) ) : json_encode( $values['theme_custom_setting_type_content'] ),
'sc_title' => $values['theme_custom_setting_title'],
'sc_condition' => $values['theme_custom_setting_conditional'] ? trim( preg_replace( '/^<\?php(.*)$/is', '$1', trim( $values['theme_custom_setting_condition'] ) ) ) : NULL
);
$type = ( isset( \IPS\Request::i()->theme_custom_setting_tab_key_type ) ) ? \IPS\Request::i()->theme_custom_setting_tab_key_type : $values['theme_custom_setting_tab_key_type'];
@@ -433,7 +440,7 @@ class _themesettings extends \IPS\Dispatcher\Controller
}
else
{
$save['sc_tab_key'] = preg_replace( '#[^0-9a-z]#', '', mb_strtolower( $values['theme_template_tab_key_new'][ \IPS\Lang::defaultLanguage() ] ) );
$save['sc_tab_key'] = mb_strtolower( $values['theme_template_tab_key_new'] );
}
if ( $current )
@@ -501,6 +508,9 @@ class _themesettings extends \IPS\Dispatcher\Controller
$setId = intval( \IPS\Request::i()->set_id );
\IPS\Dispatcher::i()->checkAcpPermission( 'theme_settings_remove' );
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
try
{