Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,12 +1,11 @@
<?php
/**
* @brief Customization AJAX actions
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 07 May 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\customization;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Email template management
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 02 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\customization;
@@ -50,9 +49,22 @@ class _emails extends \IPS\Dispatcher\Controller
$table->limit = 100;
/* Default sort options */
$table->sortBy = $table->sortBy ?: 'template_name';
$table->noSort = array( 'template_name' );
$table->sortDirection = $table->sortDirection ?: 'desc';
$table->quickSearch = function( $val )
{
$matches = \IPS\Member::loggedIn()->language()->searchCustom( 'emailtpl_', $val, TRUE );
if ( count( $matches ) )
{
return '(' . \IPS\Db::i()->in( '`template_name`', array_keys( $matches ) ) . " OR `template_name` LIKE '%{$val}%')";
}
else
{
return "`template_name` LIKE '%{$val}%'";
}
};
/* Custom parsers */
$table->parsers = array(
'template_name' => function( $val, $row )
@@ -113,7 +125,7 @@ class _emails extends \IPS\Dispatcher\Controller
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailtpl_header');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'title', (string) $table );
\IPS\Output::i()->output = (string) $table;
}
/**
@@ -302,7 +314,7 @@ class _emails extends \IPS\Dispatcher\Controller
/* Output */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailtpl_edit');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'emailtpl_edit', $form );
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'customization', 'core', 'admin' ) ), 'email' ) );;
}
/**
@@ -1,12 +1,11 @@
<?php
/**
* @brief themes
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 15 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\customization;
@@ -74,6 +73,14 @@ class _themes extends \IPS\Node\Controller
);
}
\IPS\Output::i()->sidebar['actions']['add'] = array(
'primary' => true,
'icon' => 'plus',
'title' => 'theme_set_add_button',
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=add' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('theme_set_add_button') )
);
parent::manage();
}
@@ -84,14 +91,7 @@ class _themes extends \IPS\Node\Controller
*/
public function _getRootButtons()
{
$nodeClass = $this->nodeClass;
return array( 'add' => array(
'icon' => 'plus',
'title' => 'theme_set_add_button',
'link' => \IPS\Http\Url::internal( "app=core&module=customization&controller=themes&do=add" ),
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('theme_set_add_button') ) : array() )
) );
return array();
}
/**
@@ -655,13 +655,12 @@ class _themes extends \IPS\Node\Controller
$table->sortDirection = $table->sortDirection ?: 'asc';
/* Root Buttons */
$table->rootButtons = array(
'add' => array(
'icon' => 'plus',
'title' => 'core_theme_resources_add',
'data' => array(),
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=resourceForm&set_id=' ) . $setId,
)
\IPS\Output::i()->sidebar['actions']['add'] = array(
'primary' => true,
'icon' => 'plus',
'title' => 'core_theme_resources_add',
'data' => array(),
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=resourceForm&set_id=' ) . $setId,
);
/* Row buttons */
@@ -693,7 +692,7 @@ class _themes extends \IPS\Node\Controller
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'customization/themes.css', 'core', 'admin' ) );
$title = \IPS\Member::loggedIn()->language()->addToStack('theme_custom_resources_page_title', FALSE, array( 'sprintf' => array( $set->_title ) ) );
\IPS\Output::i()->title = $title;
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( $title, (string) $table );
\IPS\Output::i()->output .= (string) $table;
}
/**
@@ -1068,15 +1067,7 @@ class _themes extends \IPS\Node\Controller
{
if ( $xml->name == 'theme' )
{
$groups = array();
foreach( \IPS\Member\Group::groups() as $group )
{
if( $group->g_access_cp )
{
$groups[] = $group->g_id;
}
}
$groups = array_keys( \IPS\Member::administrators()['g'] );
$set->saveSet( array(
'set_name' => $xml->getAttribute('name'),
@@ -1087,7 +1078,7 @@ class _themes extends \IPS\Node\Controller
'set_long_version' => ( $xml->getAttribute('long_version') ) ? $xml->getAttribute('long_version') : \IPS\Application::load('core')->long_version,
'set_is_default' => $set->is_default,
'set_is_acp_default' => $set->is_acp_default,
'set_permissions' => $set->id ? $set->permissions : implode( ',', $groups )
'set_permissions' => implode( ',', $groups )
) );
if ( $xml->getAttribute('editor_skin') )
@@ -1708,13 +1699,12 @@ class _themes extends \IPS\Node\Controller
throw new \InvalidArgumentException( 'form_bad_value' );
}
$location = ( \IPS\Request::i()->theme_css_location_type == 'existing' ) ? \IPS\Request::i()->theme_css_location_existing : \IPS\Request::i()->theme_css_location_new;
$path = ( \IPS\Request::i()->theme_css_group_type == 'existing' ) ? \IPS\Request::i()->theme_css_group_existing : \IPS\Request::i()->theme_css_group_new;
$path = ( \IPS\Request::i()->theme_css_group_type == 'existing' ) ? \IPS\Request::i()->theme_css_group_existing : \IPS\Request::i()->theme_css_group_new;
/* Make sure key is unique */
try
{
$row = \IPS\Db::i()->select( '*', 'core_theme_css', array( \IPS\Db::i()->in( 'css_set_id', array( 0, \IPS\Request::i()->id ) ) . " AND css_app=? AND css_path=? AND css_location=? AND css_name=?", \IPS\Request::i()->theme_css_app, $path, $location, $val ) )->first();
$row = \IPS\Db::i()->select( '*', 'core_theme_css', array( \IPS\Db::i()->in( 'css_set_id', array( 0, \IPS\Request::i()->id ) ) . " AND css_app=? AND css_path=? AND css_location=? AND css_name=?", \IPS\Request::i()->theme_css_app, $path, \IPS\Request::i()->theme_css_location, $val ) )->first();
if ( isset( $row['css_id'] ) )
{
@@ -1744,16 +1734,8 @@ class _themes extends \IPS\Node\Controller
{
$apps[ $key ] = $data->_title;
}
$form->add( new \IPS\Helpers\Form\Radio( 'theme_css_location_type', 'existing', FALSE, array(
'options' => array( 'existing' => 'theme_css_location_o_existing',
'new' => 'theme_css_location_o_new' ),
'toggles' => array( 'existing' => array( 'location_existing' ),
'new' => array( 'location_new' ) )
) ) );
$form->add( new \IPS\Helpers\Form\Text( 'theme_css_location_new', NULL, FALSE, array( 'regex' => '/^([a-z0-9_]+?)?$/' ), NULL, NULL, NULL, 'location_new' ) );
$form->add( new \IPS\Helpers\Form\Select( 'theme_css_location_existing', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'location_existing' ) );
$form->add( new \IPS\Helpers\Form\Select( 'theme_css_location', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'theme_css_location' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'theme_css_group_type', 'existing', FALSE, array(
'options' => array( 'existing' => 'theme_css_group_o_existing',
@@ -1776,7 +1758,7 @@ class _themes extends \IPS\Node\Controller
{
$id = intval( \IPS\Request::i()->id );
$save = array( 'app' => $values['theme_css_app'],
'location' => ( $values['theme_css_location_type'] == 'existing' ) ? $values['theme_css_location_existing'] : $values['theme_css_location_new'],
'location' => $values['theme_css_location'],
'path' => ( $values['theme_css_group_type'] == 'existing' ) ? $values['theme_css_group_existing'] : $values['theme_css_group_new'],
'name' => $values['theme_css_name'],
'added_to' => $id,
@@ -2317,14 +2299,13 @@ class _themes extends \IPS\Node\Controller
{
throw new \InvalidArgumentException( 'form_bad_value' );
}
$location = ( \IPS\Request::i()->theme_template_location_type == 'existing' ) ? \IPS\Request::i()->theme_template_location_existing : \IPS\Request::i()->theme_template_location_new;
$group = ( \IPS\Request::i()->theme_template_group_type == 'existing' ) ? \IPS\Request::i()->theme_template_group_existing : \IPS\Request::i()->theme_template_group_new;
$group = ( \IPS\Request::i()->theme_template_group_type == 'existing' ) ? \IPS\Request::i()->theme_template_group_existing : \IPS\Request::i()->theme_template_group_new;
/* Make sure key is unique */
try
{
$row = \IPS\Db::i()->select( '*', 'core_theme_templates', array( "template_set_id=? AND template_app=? AND template_group=? AND template_location=? AND template_name=?", 0, \IPS\Request::i()->theme_template_app, $group, $location, $val ) )->first();
$row = \IPS\Db::i()->select( '*', 'core_theme_templates', array( "template_set_id=? AND template_app=? AND template_group=? AND template_location=? AND template_name=?", 0, \IPS\Request::i()->theme_template_app, $group, \IPS\Request::i()->theme_template_location, $val ) )->first();
if ( isset( $row['template_id'] ) )
{
@@ -2357,15 +2338,7 @@ class _themes extends \IPS\Node\Controller
$apps[ $key ] = $data->_title;
}
$form->add( new \IPS\Helpers\Form\Radio( 'theme_template_location_type', 'existing', FALSE, array(
'options' => array( 'existing' => 'theme_template_location_o_existing',
'new' => 'theme_template_location_o_new' ),
'toggles' => array( 'existing' => array( 'location_existing' ),
'new' => array( 'location_new' ) )
) ) );
$form->add( new \IPS\Helpers\Form\Text( 'theme_template_location_new', NULL, FALSE, array( 'regex' => '/^([A-Z][A-Z0-9]+?)$/i' ), NULL, NULL, NULL, 'location_new' ) );
$form->add( new \IPS\Helpers\Form\Select( 'theme_template_location_existing', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'location_existing' ) );
$form->add( new \IPS\Helpers\Form\Select( 'theme_template_location', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'location' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'theme_template_group_type', 'existing', FALSE, array(
'options' => array( 'existing' => 'theme_template_group_o_existing',
@@ -2388,8 +2361,8 @@ class _themes extends \IPS\Node\Controller
{
$id = intval( \IPS\Request::i()->id );
$save = array( 'app' => $values['theme_template_app'],
'location' => ( $values['theme_template_location_type'] == 'existing' ) ? $values['theme_template_location_existing'] : $values['theme_template_location_new'],
'group' => ( $values['theme_template_group_type'] == 'existing' ) ? $values['theme_template_group_existing'] : $values['theme_template_group_new'],
'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'],
'added_to' => $id,
'content' => $values['theme_template_content'],
@@ -2910,13 +2883,13 @@ class _themes extends \IPS\Node\Controller
/* Display */
\IPS\Output::i()->responsive = FALSE;
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('theme_editing_title', FALSE, array( 'sprintf' => array( $themeSet->_title ) ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/diff_match_patch.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'customization/templates.css', 'core', 'admin' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_templates.js', 'core' ) );
$name = 'core_theme_set_title_' . $id;
/* Display */
@@ -2930,7 +2903,7 @@ class _themes extends \IPS\Node\Controller
\IPS\Member::loggedIn()->language()->addToStack( $name )
)
);
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'customization' )->templateEditor( $themeSet, $templateNames, $templateBit, array( 'app' => $t_app, 'location' => $t_location, 'group' => $t_group, 'template' => $t_template, 'type' => $t_type, 'item_id' => $itemId ) );
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief theme Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 17 May 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\customization;