diff --git a/include/admin/Settings/CKEditor.php b/include/admin/Settings/CKEditor.php index 2e19335..ccb5b2d 100644 --- a/include/admin/Settings/CKEditor.php +++ b/include/admin/Settings/CKEditor.php @@ -27,6 +27,7 @@ class CKEditor extends \gp\special\Base{ $this->subpages = array( '' => $langmessage['Manage Plugins'], 'Config' => $langmessage['configuration'], + 'CK_Skin' => 'Skin', // /* 425 */ 'Example' => 'Example', ); @@ -67,6 +68,8 @@ class CKEditor extends \gp\special\Base{ case 'Example': $this->Example(); break; + case 'CK_Skin': + $this->CKSkins(); case 'Config': $this->CustomConfigForm(); $this->DisplayCurrent(); @@ -416,6 +419,89 @@ class CKEditor extends \gp\special\Base{ } +/* --------cke skinselector -------------- */ + +public function saveskins() { + global $langmessage; + + if (isset($_POST['skin_select']) && !empty($_POST['skin_select'])) { + + $selected_skin = $_POST['skin_select']; + $config_file = 'include/thirdparty/ckeditor/config.js'; + + // Read the current content of the config file + $current_content = file_get_contents($config_file); + + // Remove any existing config.skin lines + $new_content = preg_replace('/^\s*config\.skin\s*=.*$/m', '', $current_content); + + // Add the new config.skin line after the function opening + $new_content = preg_replace( + '/(CKEDITOR\.editorConfig\s*=\s*function\s*\(?\s*config\s*\)?\s*\{)/i', + "$1\n\tconfig.skin = '$selected_skin';", + $new_content + ); + + // Remove any empty lines that might have been created + $new_content = preg_replace('/^\s*[\r\n]/m', '', $new_content); + + // Write the updated content back to the config file + if (file_put_contents($config_file, $new_content) !== false) { + echo '