Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -41,24 +41,62 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_editor_emoticons');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'customization' )->emoticons( $this->_getEmoticons() );
|
||||
$tabs = array(
|
||||
'standard' => 'standard_emoji',
|
||||
'custom' => 'custom_emoji',
|
||||
);
|
||||
$activeTab = ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'standard';
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'editor', 'emoticons_edit' ) )
|
||||
if ( $activeTab == 'standard' )
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_customization.js', 'core', 'admin') );
|
||||
if ( \IPS\Settings::i()->getFromConfGlobal('sql_utf8mb4') )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'emoji_style', \IPS\Settings::i()->emoji_style, FALSE, array(
|
||||
'options' => array(
|
||||
'native' => 'emoji_style_native',
|
||||
'twemoji' => 'emoji_style_twemoji',
|
||||
'emojione' => 'emoji_style_emojione',
|
||||
'disabled' => 'emoji_style_disabled',
|
||||
),
|
||||
'toggles' => array(
|
||||
'native' => array( 'emoji_shortcodes', 'emoji_ascii' ),
|
||||
'twemoji' => array( 'emoji_shortcodes', 'emoji_ascii' ),
|
||||
'emojione' => array( 'emoji_shortcodes', 'emoji_ascii' ),
|
||||
),
|
||||
) ) );
|
||||
\IPS\Member::loggedIn()->language()->get( 'emoji_style_native' ); // We need to preload the word before we can add more text to it.
|
||||
\IPS\Member::loggedIn()->language()->words['emoji_style_native'] .= "<br><div class='ipsType_large ipsSpacer_top ipsSpacer_half'><span class='ipsEmoji'>😀</span><span class='ipsEmoji'>😉</span><span class='ipsEmoji'>😂</span><span class='ipsEmoji'>😍</span><span class='ipsEmoji'>🤘</span><span class='ipsEmoji'>🤦♀️</span><span class='ipsEmoji'>🤷♂️</span><span class='ipsEmoji'>🍿</span><span class='ipsEmoji'>🚀</span><span class='ipsEmoji'>🎉</span><span class='ipsEmoji'>🏳️🌈</span></div>"; // Have to do this here because if we try to put it in the actual language string, that will cause an error if not utf8mb4
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'emoji_shortcodes', \IPS\Settings::i()->emoji_shortcodes, FALSE, array(), NULL, NULL, NULL, 'emoji_shortcodes' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'emoji_ascii', \IPS\Settings::i()->emoji_ascii, FALSE, array(), NULL, NULL, NULL, 'emoji_ascii' ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['emoji_cache'] = time();
|
||||
$form->saveAsSettings( $values );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&tab=standard' ), 'saved' );
|
||||
}
|
||||
|
||||
$activeTabContents = $form;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'global' )->message( 'emoji_utf8mb4_required', 'error', NULL, TRUE, TRUE );
|
||||
}
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'editor', 'emoticons_add' ) )
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'emoticons_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('emoticons_add') )
|
||||
),
|
||||
);
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'customization' )->emoticons( $this->_getEmoticons() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_editor_emoticons');
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_customization.js', 'core', 'admin') );
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $activeTabContents;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, $activeTab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=editor&controller=emoticons" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +145,7 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
if ( $values['emoticons_add_group'] === 'create' )
|
||||
{
|
||||
$position = 0;
|
||||
$setId = md5( uniqid() );
|
||||
$setId = mt_rand();
|
||||
\IPS\Lang::saveCustom( 'core', "core_emoticon_group_{$setId}", $values['emoticons_add_newgroup'] );
|
||||
\IPS\Session::i()->log( 'acplog__emoticon_group_created', array( "core_emoticon_group_{$setId}" => TRUE ) );
|
||||
}
|
||||
@@ -185,14 +223,15 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'emoji_cache' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__emoticons_added', array( "core_emoticon_group_{$setId}" => TRUE ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons' ), 'saved' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&tab=custom' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'emoticons_add', $form, FALSE );
|
||||
@@ -242,11 +281,32 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
$setPos++;
|
||||
}
|
||||
}
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'emoji_cache' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
\IPS\Output::i()->json( 'OK' );
|
||||
return;
|
||||
}
|
||||
|
||||
// Do we need to unsquash any values?
|
||||
// Squashed values are json_encoded by javascript to prevent us exceeding max_post_vars
|
||||
// If 'squashedField' isn't in the request it might indicate the user didn't have JS enabled
|
||||
if ( isset( \IPS\Request::i()->emoticons_squashed ) )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->emoticons_squashed ) )
|
||||
{
|
||||
$unsquashed = json_decode( \IPS\Request::i()->emoticons_squashed, TRUE );
|
||||
|
||||
foreach( $unsquashed as $key => $value )
|
||||
{
|
||||
\IPS\Request::i()->$key = $value;
|
||||
}
|
||||
|
||||
unset( \IPS\Request::i()->emoticons_squashed );
|
||||
}
|
||||
}
|
||||
|
||||
$emoticons = $this->_getEmoticons( FALSE );
|
||||
|
||||
foreach ( \IPS\Request::i()->emo as $id => $data )
|
||||
@@ -284,14 +344,15 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'emoji_cache' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__emoticons_edited' );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons' ), 'saved' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&tab=custom' ), 'saved' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,14 +388,15 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__emoticon_deleted' );
|
||||
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'emoji_cache' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
}
|
||||
catch ( \UnderflowException $e ) { }
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons' ), 'saved' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&tab=custom' ), 'saved' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,12 +426,13 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
\IPS\Db::i()->delete( 'core_emoticons', array( 'emo_set=?', $set ) );
|
||||
\IPS\Lang::deleteCustom( 'core', 'core_emoticon_group_'. $set );
|
||||
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'emoji_cache' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons' ), 'saved' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&tab=custom' ), 'saved' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,7 +452,7 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'core', \IPS\Request::i()->key, $values['emoticons_add_newgroup'] );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons' ), 'saved' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&tab=custom' ), 'saved' );
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
|
||||
@@ -56,7 +56,7 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* Work out output */
|
||||
$activeTabContents = call_user_func( array( $this, '_manage'.ucfirst( $this->activeTab ) ) );
|
||||
$activeTabContents = call_user_func( array( $this, '_manage' . mb_ucfirst( $this->activeTab ) ) );
|
||||
|
||||
/* If this is an AJAX request, just return it */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
|
||||
@@ -107,7 +107,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$dummy = new \IPS\Helpers\Form\Editor( 'editor', NULL, FALSE, array( 'autoSaveKey' => md5( uniqid() ), 'allButtons' => TRUE ) );
|
||||
$dummy = new \IPS\Helpers\Form\Editor( 'editor', NULL, FALSE, array( 'autoSaveKey' => md5( mt_rand() ), 'allButtons' => TRUE ) );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_editor_toolbar');
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_customization.js', 'core', 'admin') );
|
||||
@@ -156,8 +156,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => json_encode( $save ) ), array( 'conf_key=?', 'ckeditor_toolbars' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_toolbars' => json_encode( $save ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,10 +171,22 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
$current = json_decode( \IPS\Settings::i()->ckeditor_permissions, TRUE );
|
||||
|
||||
/* Get areas */
|
||||
$areas = array_combine( array_keys( \IPS\Application::allExtensions( 'core', 'EditorLocations', FALSE ) ), array_map( function( $v )
|
||||
{
|
||||
return 'editor__' . $v;
|
||||
}, array_keys( \IPS\Application::allExtensions( 'core', 'EditorLocations', FALSE ) ) ) );
|
||||
$filteredAreas = array_filter(
|
||||
\IPS\Application::allExtensions( 'core', 'EditorLocations', FALSE ),
|
||||
function( $elem ) {
|
||||
return ( !isset( $elem::$buttonLocation ) OR $elem::$buttonLocation !== FALSE );
|
||||
}
|
||||
);
|
||||
$areas = array_combine(
|
||||
array_keys( $filteredAreas ),
|
||||
array_map(
|
||||
function( $v )
|
||||
{
|
||||
return 'editor__' . $v;
|
||||
},
|
||||
array_keys( $filteredAreas )
|
||||
)
|
||||
);
|
||||
|
||||
/* Build Form */
|
||||
$b64Button = base64_encode( $button );
|
||||
@@ -255,8 +266,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
'groups' => $values['editor_permission_groups'],
|
||||
'areas' => $values['editor_permission_areas'],
|
||||
);
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => json_encode( $current ) ), array( 'conf_key=?', 'ckeditor_permissions' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_permissions' => json_encode( $current ) ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
@@ -308,14 +318,13 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Write */
|
||||
$key = 'custom-' . md5( uniqid() );
|
||||
$key = 'custom-' . md5( mt_rand() );
|
||||
$this->_saveCustomPlugin( $key, $values );
|
||||
|
||||
/* Save */
|
||||
$extraPlugins = explode( ',', \IPS\Settings::i()->ckeditor_extraPlugins );
|
||||
$extraPlugins[] = $key;
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => implode( ',', array_filter( array_unique( $extraPlugins ) ) ) ), array( 'conf_key=?', 'ckeditor_extraPlugins' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_extraPlugins' => implode( ',', array_filter( array_unique( $extraPlugins ) ) ) ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
@@ -461,8 +470,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
$extraPlugins = explode( ',', \IPS\Settings::i()->ckeditor_extraPlugins );
|
||||
$extraPlugins[] = $name;
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => implode( ',', array_filter( array_unique( $extraPlugins ) ) ) ), array( 'conf_key=?', 'ckeditor_extraPlugins' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_extraPlugins' => implode( ',', array_filter( array_unique( $extraPlugins ) ) ) ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
@@ -540,8 +548,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
$settingClasses = \IPS\Settings::i()->editor_allowed_classes ? explode( ',', \IPS\Settings::i()->editor_allowed_classes ) : array();
|
||||
$settingClasses = array_unique( array_merge( $settingClasses, $cssClasses ) );
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => implode( ',', $settingClasses ) ), array( 'conf_key=?', 'editor_allowed_classes' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'editor_allowed_classes' => implode( ',', $settingClasses ) ) );
|
||||
}
|
||||
|
||||
/* Figure out data-controllers classes */
|
||||
@@ -563,8 +570,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
$settingControllers = \IPS\Settings::i()->editor_allowed_datacontrollers ? explode( ',', \IPS\Settings::i()->editor_allowed_datacontrollers ) : array();
|
||||
$settingControllers = array_unique( array_merge( $settingControllers, $dataControllers ) );
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => implode( ',', $settingControllers ) ), array( 'conf_key=?', 'editor_allowed_datacontrollers' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'editor_allowed_datacontrollers' => implode( ',', $settingControllers ) ) );
|
||||
}
|
||||
|
||||
$attributes = json_encode( $attributes );
|
||||
@@ -791,8 +797,7 @@ JS;
|
||||
unset( $extraPlugins[ $k ] );
|
||||
}
|
||||
}
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => implode( ',', array_filter( array_unique( $extraPlugins ) ) ) ), array( 'conf_key=?', 'ckeditor_extraPlugins' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_extraPlugins' => implode( ',', array_filter( array_unique( $extraPlugins ) ) ) ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
@@ -850,11 +855,10 @@ JS;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), array( 'conf_key=?', 'ckeditor_extraPlugins' ) );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_extraPlugins' => '' ) );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), array( 'conf_key=?', 'ckeditor_toolbars' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_toolbars' => '' ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
Reference in new issue
Block a user