Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the system integrity backend page.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       Backend
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Thomas Stauer
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: class cTinymce4Configuration {
 19:     private $_perm = false;
 20:     private $_configErrors = array();
 21: 
 22:     /**
 23:      * Constructor function
 24:      * Inits permission
 25:      */
 26:     public function __construct() {
 27:         // decide whether user is allowed to change values
 28:         $this->_perm = ('sysadmin' === cRegistry::getAuth()->getPerms());
 29:     }
 30: 
 31:     /**
 32:      * Generate a div containing a label and a textbox
 33:      * @param string $description Label text before the textbox
 34:      * @param string $name Name of textbox form element
 35:      * @param string $value Default value of textbox
 36:      * @param number $width Width of label in px
 37:      * @return cHTMLDiv The div element containing label and textbox
 38:      */
 39:     private function _addLabelWithTextarea($description, $name, $value = '', $width = 75) {
 40:         $label = new cHTMLLabel($description, $name);
 41:         $label->setClass("sys_config_txt_lbl");
 42:         $label->setStyle('width:' . $width . 'px; vertical-align: top;');
 43: 
 44:         $textarea = new cHTMLTextarea($name);
 45:         $textarea->setValue($value);
 46:         $textarea->setAttribute('style', 'box-sizing: border-box; width: 600px;');
 47:         if (false === $this->_perm) {
 48:             $textarea->updateAttribute('disabled', 'disabled');
 49:         }
 50:         $div = new cHTMLDiv($label .  $textarea, 'systemSetting');
 51: 
 52:         return $div;
 53:     }
 54: 
 55:     /**
 56:      * Generates a cHTMLCheckbox based on function arguments and sets its disabled state based on permission check
 57:      * @param string $description Description that will be displayed in checkbox label
 58:      * @param string $name Name of checkbox, this is important for fetching values from sent form
 59:      * @param string $value The value that will be sent as content in the name key
 60:      * @param bool $checked Whether this checkbox is setup as checked
 61:      * @return cHTMLCheckbox Checkbox with label
 62:      */
 63:     private function _addLabelWithCheckbox($description, $name, $value, $checked) {
 64:         $checkBox = new cHTMLCheckbox($name, $value, str_replace('[]', '_', $name . $value), (true === $checked));
 65:         $checkBox->setLabelText($description);
 66: 
 67:         if (false === $this->_perm) {
 68:             $checkBox->updateAttribute('disabled', 'disabled');
 69:         }
 70: 
 71:         return $checkBox;
 72:     }    
 73: 
 74:     /**
 75:      * Check if a type pattern matches value
 76:      * @param string $type Pattern that is applied to value
 77:      * @param string $value Value that is checked for pattern
 78:      * @return boolean Whether type matches value
 79:      */
 80:     private function _checkType($type, $value) {
 81:         if (true === empty($value)) {
 82:             return true;
 83:         }
 84:         if (true === isset($value)) {
 85:             // parameter is known, check it using type expression
 86:             // preg match returns 1 if match occurs
 87:             return (1 === preg_match($type, $value));
 88:         }
 89: 
 90:         return false;
 91:     }
 92: 
 93:     private function _checkIsset(array $haystack, array $needles) {
 94:         if (count($haystack) !== count($needles)) {
 95:             return false;
 96:         }
 97:         foreach ($needles as $needle) {
 98:             if (false === isset($haystack[$needle])) {
 99:                 return false;
100:             }
101:         }
102: 
103:         return true;
104:     }
105: 
106:     /**
107:      * This function lists all external plugins that should be loaded in a table
108:      * @param string $cmsType The CMS type (e.g. 'CMS_HTML') used to access the variable
109:      * @return string
110:      */
111:     private function _listExternalPlugins($cmsType) {
112:         /// TODO: use a preference loading function for plugins to list
113:         $externalPlugins = static::get(array(), 'raw', $cmsType, 'externalplugins');
114: 
115:         // build a table
116:         $table = new cHTMLTable();
117:         $table->setClass('generic');
118: 
119:         // table row
120:         $headrow = new cHTMLTableRow();
121: 
122:         // table column 1 (plugin name)
123:         $col = new cHTMLTableHead();
124:         $col->appendContent(i18n('Name'));
125:         $headrow->appendContent($col);
126: 
127:         // table column 2 (plugin url)
128:         $col = new cHTMLTableHead();
129:         $col->appendContent(i18n('URL'));
130:         $headrow->appendContent($col);
131: 
132:         // table column 3 (user actions)
133:         $col = new cHTMLTableHead();
134:         $col->appendContent(i18n('Action'));
135:         $headrow->appendContent($col);
136: 
137:         // add columns to table
138:         $table->appendContent($headrow);
139: 
140:         // build table body
141:         $tbody = new cHTMLTableBody();
142:         $i = 0;
143:         $n = count($externalPlugins);
144:         for ($i; $i < $n; $i++) {
145:             // new tr
146:             $row = new cHTMLTableRow();
147: 
148:             // create new td
149:             $td = new cHTMLTableData();
150:             $td->appendContent($externalPlugins[$i]['name']);
151:  
152:             // insert hidden input field
153:             $input = new cHTMLFormElement();
154:             $input->setAttribute('type', 'hidden');
155:             $input->setAttribute('name', $cmsType . '[externalplugins][' . $i . '][name]');
156:             $input->setAttribute('value', $externalPlugins[$i]['name']);
157:             $td->appendContent($input);
158: 
159:             // add td to tr
160:             $row->appendContent($td);
161: 
162:             // create new td
163:             $td = new cHTMLTableData();
164:             $td->appendContent($externalPlugins[$i]['url']);
165: 
166:             // insert hidden input field
167:             $input = new cHTMLFormElement();
168:             $input->setAttribute('type', 'hidden');
169:             $input->setAttribute('name', $cmsType . '[externalplugins][' . $i . '][url]');
170:             $input->setAttribute('value', $externalPlugins[$i]['url']);
171:             $td->appendContent($input);
172: 
173:             // add td to tr
174:             $row->appendContent($td);
175: 
176:             // create new td
177:             $td = new cHTMLTableData();
178:             if (true === $this->_perm) {
179:                 // Edit/delete links only for sysadmin
180:                 $oLinkDelete = new cHTMLLink();
181:                 $oLinkDelete->setCLink(cRegistry::getArea(), cRegistry::getFrame(), "system_wysiwyg_tinymce4_delete_item");
182:                 $oLinkDelete->setCustom("external_plugin_idx", urlencode($i));
183:                 $oLinkDelete->setCustom('cmstype', $cmsType);
184:                 $img = new cHTMLImage(cRegistry::getBackendUrl() . cRegistry::getConfigValue('path', 'images') . 'delete.gif');
185:                 $img->setAttribute('alt', i18n("Delete"));
186:                 $img->setAttribute('title', i18n("Delete"));
187:                 $oLinkDelete->appendContent($img);
188:                 $td->appendContent($oLinkDelete);
189:             }
190: 
191:             // add td to tr
192:             $row->appendContent($td);
193: 
194:             // insert row into table body
195:             $tbody->appendContent($row);
196:         }
197:         // append empty row to let user enter new plugins
198:         $row = new cHTMLTableRow();
199: 
200:         // create new td for plugin name
201:         $td = new cHTMLTableData();
202:         $input = new cHTMLFormElement($cmsType . '[externalplugins][' . $i . '][name]');
203:         $td->appendContent($input);
204:         $row->appendContent($td);
205: 
206:         // create new td for plugin url
207:         $td = new cHTMLTableData();
208:         $input = new cHTMLFormElement($cmsType . '[externalplugins][' . $i . '][url]');
209:         $td->appendContent($input);
210:         $row->appendContent($td);
211: 
212:         // empty action column
213:         $td = new cHTMLTableData();
214:         $row->appendContent($td);
215: 
216:         // append row to table body
217:         $tbody->appendContent($row);
218: 
219: 
220:         // insert table body into table
221:         $table->appendContent($tbody);
222: 
223:         // return table as string
224:         return $table->render();
225:     }
226: 
227:     /**
228:      * Function to check if toolbar data contains valid input
229:      * @param string $toolbarData The toolbar data to check for validity
230:      * @return boolean True if toolbar data is valid, false otherwise
231:      */
232:     private function _validateToolbarN($toolbarData) {
233:         // do not use cRequestValidator instance because it does not support multi-dimensional arrays
234:         if (false === $this->_checkType('/^[a-zA-Z0-9 \-\|_]*$/', $toolbarData)
235:         || false !== strpos($toolbarData, '||')) {
236:             return false;
237:         }
238: 
239:         return true;
240:     }
241: 
242:     /**
243:      * Variadic function to obtain config values using nested key values
244:      * @param mixed $default Default value to use in case no value is set
245:      * @param string keys The keys to access values in configuration
246:      */
247:     public static function get($default) {
248:         $cfg = cRegistry::getConfig();
249:         if (false === isset($cfg['wysiwyg'])
250:         || false === isset($cfg['wysiwyg']['tinymce4'])) {
251:             $configPath = cRegistry::getConfigValue('path', 'contenido_config') . 'config.wysiwyg_tinymce4.php';
252:             // check if configuration file exists
253:             if (true !== cFileHandler::exists($configPath)) {
254:                 return $default;
255:             }
256:             // check if file is reable
257:             if (true !== cFileHandler::readable($configPath)) {
258:                 return $default;
259:             }
260:             // Include configuration file
261:             require_once($configPath);
262:         }
263: 
264:         // check number of keys passed to function
265:         $numargs = func_num_args();
266:         if (0 === $numargs) {
267:             return $default;
268:         }
269: 
270:         // walk through config
271:         $result = cRegistry::getConfig();
272: 
273:         // select ['wysiwyg']['tinymce4'] by default
274:         if (false === isset($result['wysiwyg'])) {
275:             return $default;
276:         }
277:         if (false === $result['wysiwyg']['tinymce4']) {
278:             return $default;
279:         }
280:         $result = $result['wysiwyg']['tinymce4'];
281:         // get values in key path that user requested
282:         for ($i = 0; $i < $numargs -1; $i++) {
283:             if (false === isset($result[func_get_arg(1 + $i)])) {
284:                 return $default;
285:             }
286:             // jump one array level deeper into the result
287:             $result = $result[func_get_arg(1 + $i)];
288:         }
289: 
290:         return $result;
291:     }
292: 
293:     /**
294:      * Function to validate form from showConfigurationForm() 
295:      * @param array $config The post parameters of submitted form
296:      * @return multitype:string |boolean
297:      */
298:     public function validateForm($config) {
299:         // Checks for cross site requests and cross site scripting are omitted due to time constraints
300: 
301:         // User must be system administrator to change the settings
302:         if ('sysadmin' !== cRegistry::getAuth()->getPerms()) {
303:             return false;
304:         }
305: 
306:         // remove not used area field
307:         unset($config['area']);
308:         // remove not used frame field
309:         unset($config['frame']);
310:         // remove not used contenido field
311:         unset($config['contenido']);
312:         
313:         // remove x and y values from image submit button in in form
314:         unset($config['submit_x']);
315:         unset($config['submit_y']);
316: 
317: 
318:         // check if config should be deleted
319:         if (isset($_POST['reset'])) {
320:             $noti = new cGuiNotification();
321: 
322:             // try to delete configuration
323:             $configPath = cRegistry::getConfigValue('path', 'contenido_config');
324:             $configPath .= 'config.wysiwyg_tinymce4.php';
325:             if (cFileHandler::exists($configPath)
326:             && cFileHandler::writeable($configPath)) {
327:                 cFileHandler::remove($configPath);
328:                 $noti->displayNotification(cGuiNotification::LEVEL_INFO, i18n('TinyMCE 4 configuration got reset back to default'));
329:             } else {
330:                 // can not delete config, display message
331:                 $noti->displayNotification(cGuiNotification::LEVEL_ERROR, i18n('Can not delete config file'));
332:             }
333: 
334:             // do not save config
335:             return false;
336:         }
337: 
338:         // check if all array entries actually exist
339:         // abort if too many values are encountered
340:         $shouldArrayStructure =  array (
341:             'tinymce4_full' =>
342:             array (
343:                     'toolbar1',
344:                     'toolbar2',
345:                     'toolbar3',
346:                     'plugins'
347:             ),
348:             'tinymce4_fullscreen' =>
349:             array (
350:                     'toolbar1',
351:                     'toolbar2',
352:                     'toolbar3',
353:                     'plugins'
354:             ),
355:             'contenido_lists',
356:             'contenido_gzip',
357:             'custom',
358:             'externalplugins'
359:         );
360:         // get name of first key
361:         reset($config);
362:         $key = key($config);
363: 
364:         if (false === $this->_checkIsset($config[$key]['tinymce4_full'], $shouldArrayStructure['tinymce4_full'])) {
365:             $this->_configErrors[] = i18n('Fullscreen config of inline editor is erroneous.');
366:             return false;
367:         }
368:         if (false === $this->_checkIsset($config[$key]['tinymce4_fullscreen'], $shouldArrayStructure['tinymce4_fullscreen'])) {
369:             $this->_configErrors[] = i18n('Config of editor on separate editor page is erroneous.');
370:             return false;
371:         }
372:         if (false === isset($config[$key]['custom'])) {
373:             $this->_configErrors[] = i18n('Custom configuration of tinyMCE 4 is not set.');
374:             return false;
375:         }
376: 
377:         // do not use cRequestValidator instance because it does not support multi-dimensional arrays
378:         if (false === $this->_validateToolbarN($config[$key]['tinymce4_full']['toolbar1'])
379:         || false === $this->_validateToolbarN($config[$key]['tinymce4_full']['toolbar2'])
380:         || false === $this->_validateToolbarN($config[$key]['tinymce4_full']['toolbar3'])
381:         || false === $this->_validateToolbarN($config[$key]['tinymce4_fullscreen']['toolbar1'])
382:         || false === $this->_validateToolbarN($config[$key]['tinymce4_fullscreen']['toolbar2'])
383:         || false === $this->_validateToolbarN($config[$key]['tinymce4_fullscreen']['toolbar3'])) {
384:             $this->_configErrors[] = i18n('Toolbar(s) of editor contain erroneous data.');
385:             return false;
386:         }
387: 
388:         // remove last entry of external plugins if it is empty
389:         $lastExternalPlugin = $config[$key]['externalplugins'][count($config[$key]['externalplugins']) -1];
390:         if ('' === $lastExternalPlugin['name']
391:         && '' === $lastExternalPlugin['url']) {
392:             unset($config[$key]['externalplugins'][count($config[$key]['externalplugins']) -1]);
393:         }
394: 
395:         // custom tinymce 4 settings overwrite other fields
396:         if (cRegistry::getConfigValue('simulate_magic_quotes') === true) {
397:             $config[$key]['custom'] = stripslashes($config[$key]['custom']);
398:         }
399: 
400:         // unescape strings then build
401:         $customConfig = (array) json_decode($config[$key]['custom'], true);
402:         switch(json_last_error()) {
403:             case JSON_ERROR_DEPTH:
404:                 $this->_configErrors[] = i18n('Maximum stack depth exceeded while decoding json');
405:             return false;
406:             case JSON_ERROR_CTRL_CHAR:
407:                 $this->_configErrors[] = i18n('Unexpected control character found');
408:             return false;
409:             case JSON_ERROR_SYNTAX:
410:                 $this->_configErrors[] = i18n('Syntax error, malformed JSON');
411:             return false;
412:         }
413: 
414:         // append new config to old config
415:         $origConfig = static::get(array(), 'raw');
416:         $config['raw'] = array_merge($origConfig, $config);
417:         //$config['raw'] = $config;
418: 
419:         // use custom parameters if they are correct JSON
420:         if (JSON_ERROR_NONE === json_last_error()) {
421:             $config[$key] = array_merge($config[$key], $customConfig);
422:         }
423:         unset($config[$key]['custom']);
424: 
425:         // put all config values into ['tinymce4']['tinymce4']
426:         // put the raw settings of config page into ['tinymce4']['raw']
427:         $origConfig = static::get(array(), 'tinymce4');
428:         $config = array_merge($origConfig, $config);
429:         $res = array('tinymce4' => array('tinymce4' =>$config));
430:         //unset($res['tinymce4']['tinymce4']['custom']);
431:         $res['tinymce4']['raw'] = $res['tinymce4']['tinymce4']['raw'];
432:         unset($res['tinymce4']['tinymce4']['raw']);
433: 
434:         // $config contains only valid content, returned processed config
435:         return $res;
436:     }
437: 
438:     /**
439:      * Do not load external plugin if user has permission to request that 
440:      * @param array $form get parameters from deletion link
441:      */
442:     public function removeExternalPluginLoad($form) {
443:         // abort if user has not sufficient permissions
444:         if (false === $this->_perm) {
445:             return;
446:         }
447: 
448:         $pluginToRemoveIdx = (int) $form['external_plugin_idx'];
449: 
450:         // load config through usage of get function
451:         $settings = static::get(false);
452: 
453:         // no config or no external plugins or no plugin with that index means nothing to remove
454:         if (false === $settings
455:         || false === isset($settings['raw']['externalplugins'])
456:         || false === isset($settings['raw']['externalplugins'])
457:         || false === isset($settings['raw']['externalplugins'][$pluginToRemoveIdx])) {
458:             return;
459:         }
460: 
461:         // remove value from raw settings
462:         unset($settings['raw']['externalplugins'][$pluginToRemoveIdx]);
463:         // re-index array
464:         $settings['raw']['externalplugins'] = array_values($settings['raw']['externalplugins']);
465: 
466:         // apply raw settings to computed settings
467:         $settings['tinymce4']['externalplugins'] = $settings['raw']['externalplugins'];
468: 
469:         // apply changes to current config
470:         global $cfg;
471:         $cfg['wysiwyg']['tinymce4'] = $settings;
472: 
473:         // save altered config under tinymce4 key
474:         cTinyMCE4Editor::safeConfig(array('tinymce4' => $settings));
475:     }
476: 
477:     /**
478:      * Generates an HTML form to configure tinymce 4
479:      */
480:     public function showConfigurationForm() {
481:         $page = new cGuiPage('system_wysiwyg_tinymce4', '', '5');
482:         $auth = cRegistry::getAuth();
483:         $frame = cRegistry::getFrame();
484:         $area = cRegistry::getArea();
485: 
486:         // validate if user has permission to edit this area
487:         if (false === cRegistry::getPerm()->have_perm_area_action($area, 'edit_system_wysiwyg_tinymce4')) {
488:             $page->displayCriticalError(i18n('Access denied'));
489:             $page->render();
490:             return;
491:         }
492: 
493:         if (count($this->_configErrors) > 0) {
494:             $errorMessage = i18n('The following errors occurred when trying to verify configuration:') . '<ul>';
495:             foreach ($this->_configErrors as $error) {
496:                 $errorMessage .= '<li>' . $error . '</li>';
497:             }
498:             $errorMessage .= '</ul>';
499:             $page->displayError($errorMessage);
500:         }
501: 
502:         $page->displayInfo(i18n('Currently active WYSIWYG editor: ' . cWYSIWYGEditor::getCurrentWysiwygEditorName()));
503: 
504: 
505:         $oTypeColl = new cApiTypeCollection();
506:         $oTypeColl->select();
507:         $result = '';
508:         while (false !== ($typeEntry = $oTypeColl->next())) {
509:             // specify a shortcut for type field
510:             $curType = $typeEntry->get('type');
511: 
512:             $contentTypeClassName = cTypeGenerator::getContentTypeClassName($curType);
513:             if (false === class_exists($contentTypeClassName)) {
514:                 continue;
515:             }
516:             $cContentType = new $contentTypeClassName(null, 0, array());
517:             if (false === $cContentType->isWysiwygCompatible()) {
518:                 continue;
519:             }
520: 
521: 
522:             $form = new cGuiTableForm('system_wysiwyg_tinymce4_' . strtolower($curType));
523:             $form->setAcceptCharset('UTF-8');
524: 
525:             $form->addHeader(i18n('TinyMCE 4 configuration for ') . $curType);
526: 
527:             $form->setVar('area', $area);
528:             $form->setVar('frame', $frame);
529:             $form->setVar('action', 'edit_tinymce4');
530: 
531: 
532:             $containerDiv = new cHTMLDiv();
533:             if ('CMS_HTMLHEAD' === $curType) {
534:                 $defaultToolbar1 = static::get('undo redo | consave conclose', 'raw','tinymce4_full', 'toolbar1');
535:                 $defaultToolbar2 = static::get('', 'raw','tinymce4_full', 'toolbar2');
536:                 $defaultToolbar3 = static::get('', 'raw','tinymce4_full', 'toolbar3');
537:                 $defaultPlugins = static::get('conclose', 'raw','tinymce4_full', 'plugins');
538:             } else {
539:                 $defaultToolbar1 = static::get('cut copy paste pastetext | searchreplace | undo redo | bold italic underline strikethrough subscript superscript | insertdatetime preview | visualchars nonbreaking template pagebreak | help | fullscreen', 'raw','tinymce4_full', 'toolbar1');
540:                 $defaultToolbar2 = static::get('link unlink anchor image media hr | bullist numlist | outdent indent blockquote | alignleft aligncenter alignright alignfull removeformat | forecolor backcolor | ltr rtl | charmap | code', 'raw','tinymce4_full', 'toolbar2');
541:                 $defaultToolbar3 = static::get('table | formatselect fontselect fontsizeselect | consave conclose', 'raw','tinymce4_full', 'toolbar3');
542:                 $defaultPlugins = static::get('charmap code table conclose hr image link pagebreak layer insertdatetime preview anchor media searchreplace print contextmenu paste directionality fullscreen visualchars nonbreaking template textcolor', 'raw','tinymce4_full', 'plugins');
543:             }
544:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 1:', $curType . '[tinymce4_full][toolbar1]', $defaultToolbar1));
545:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 2:', $curType . '[tinymce4_full][toolbar2]', $defaultToolbar2));
546:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 3:', $curType . '[tinymce4_full][toolbar3]', $defaultToolbar3));
547:             $containerDiv->appendContent($this->_addLabelWithTextarea('Plugins:', $curType . '[tinymce4_full][plugins]', $defaultPlugins));
548:             $form->add(i18n('Settings of editor in separate editor page'), $containerDiv->render());
549: 
550:             $containerDiv = new cHTMLDiv();
551:             if ('CMS_HTMLHEAD' === $curType) {
552:                 $defaultToolbar1 = static::get('undo redo | consave conclose', 'raw','tinymce4_inline', 'toolbar1');
553:                 $defaultToolbar2 = static::get('', 'raw','tinymce4_inline', 'toolbar2');
554:                 $defaultToolbar3 = static::get('', 'raw','tinymce4_inline', 'toolbar3');
555:                 $defaultPlugins = static::get('conclose', 'raw','tinymce4_inline', 'plugins');
556:             } else {
557:                 $defaultToolbar1 = static::get('bold italic underline strikethrough | undo redo | bullist numlist separator forecolor backcolor | alignleft aligncenter alignright | confullscreen | consave conclose', 'raw', 'tinymce4_inline', 'toolbar1');
558:                 $defaultToolbar2 = static::get('', 'raw', 'tinymce4_inline', 'toolbar2');
559:                 $defaultToolbar3 = static::get('', 'raw', 'tinymce4_inline', 'toolbar3');
560:                 $defaultPlugins = static::get('conclose confullscreen media table textcolor', 'raw', 'tinymce4_inline', 'plugins');
561:             }
562:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 1:', $curType . '[tinymce4_inline][toolbar1]', $defaultToolbar1));
563:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 2:', $curType . '[tinymce4_inline][toolbar2]', $defaultToolbar2));
564:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 3:', $curType . '[tinymce4_inline][toolbar3]', $defaultToolbar3));
565:             $containerDiv->appendContent($this->_addLabelWithTextarea('Plugins:', $curType . '[tinymce4_inline][plugins]', $defaultPlugins));
566:             $form->add(i18n('Settings of inline editor in inline mode'), $containerDiv->render());
567: 
568:             $containerDiv = new cHTMLDiv();
569:             if ('CMS_HTMLHEAD' === $curType) {
570:                 $defaultToolbar1 = static::get('undo redo | consave conclose', 'raw','tinymce4_fullscreen', 'toolbar1');
571:                 $defaultToolbar2 = static::get('', 'raw','tinymce4_fullscreen', 'toolbar2');
572:                 $defaultToolbar3 = static::get('', 'raw','tinymce4_fullscreen', 'toolbar3');
573:                 $defaultPlugins = static::get('conclose', 'raw','tinymce4_fullscreen', 'plugins');
574:             } else {
575:                 $defaultToolbar1 = static::get('cut copy paste pastetext | searchreplace | undo redo | bold italic underline strikethrough subscript superscript | insertdatetime preview | visualchars nonbreaking template pagebreak | help | fullscreen', 'raw', 'tinymce4_fullscreen', 'toolbar1');
576:                 $defaultToolbar2 = static::get('link unlink anchor image media | bullist numlist | outdent indent blockquote | alignleft aligncenter alignright alignfull removeformat | forecolor backcolor | ltr rtl | charmap | code', 'raw', 'tinymce4_fullscreen', 'toolbar2');
577:                 $defaultToolbar3 = static::get('table | formatselect fontselect fontsizeselect | consave conclose', 'raw','tinymce4_fullscreen', 'toolbar3');
578:                 $defaultPlugins = static::get('charmap code conclose table hr image link pagebreak layer insertdatetime preview anchor media searchreplace print contextmenu paste directionality fullscreen visualchars nonbreaking template textcolor', 'raw', 'tinymce4_fullscreen', 'plugins');
579:             }
580:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 1:', $curType . '[tinymce4_fullscreen][toolbar1]', $defaultToolbar1));
581:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 2:', $curType . '[tinymce4_fullscreen][toolbar2]', $defaultToolbar2));
582:             $containerDiv->appendContent($this->_addLabelWithTextarea('Toolbar 3:', $curType . '[tinymce4_fullscreen][toolbar3]', $defaultToolbar3));
583:             $containerDiv->appendContent($this->_addLabelWithTextarea('Plugins:', $curType . '[tinymce4_fullscreen][plugins]', $defaultPlugins));
584:             $form->add(i18n('Settings of inline editor in fullscreen mode'), $containerDiv->render());
585: 
586:             // GZIP editor over HTTP using tinymce's library
587:             $containerDiv = new cHTMLDiv();
588:             $checked = 'contenido_gzip' === static::get(false, 'raw', $curType, 'contenido_gzip');
589:             $containerDiv->appendContent($this->_addLabelWithCheckbox(i18n('GZIP TinyMCE (only activate if server does not compress content already)'), $curType . '[contenido_gzip]', 'contenido_gzip', $checked));
590:             $form->add(i18n('contenido_gzip'), $containerDiv->render());
591: 
592:             // Add jump lists to tinymce's dialogs
593:             $containerDiv = new cHTMLDiv();
594:             $checked = true === ('image' === static::get(false, 'raw', $curType, 'contenido_lists', 'image'));
595:             $containerDiv->appendContent($this->_addLabelWithCheckbox(i18n('Provide jump lists in image insertion dialog'), $curType . '[contenido_lists][image]', 'image', $checked));
596:             $checked = true === ('link' === static::get(false, 'raw', $curType, 'contenido_lists', 'link'));
597:             $containerDiv->appendContent($this->_addLabelWithCheckbox(i18n('Provide jump lists in link insertion dialog'), $curType . '[contenido_lists][link]', 'link', $checked));
598:             $form->add(i18n('contenido_lists'), $containerDiv->render());
599: 
600:             // external plugins
601:             $containerDiv = new cHTMLDiv();
602:             $containerDiv->appendContent($this->_listExternalPlugins($curType));
603:             $form->add(i18n('External plugins to load'), $containerDiv);
604: 
605:             //add textarea for custom tinymce 4 settings
606:             $textarea = new cHTMLTextarea($curType . '[custom]');
607:             $textarea->setAttribute('style', 'width: 99%;');
608:             $defaultParams = '';
609:             if ('CMS_HTMLHEAD' === $curType) {
610:                 $defaultParams = '{' . PHP_EOL . '"inline": true,' . PHP_EOL . '"menubar": false' . PHP_EOL . '}';
611:             }
612:             $textarea->setValue(static::get($defaultParams, 'raw', $curType, 'custom'));
613:             $form->add(i18n('Additional parameters (JSON passed to tinymce constructor)'), $textarea->render());
614: 
615:             // check permission to save system wysiwyg editor settings
616:             if (false === $this->_perm) {
617:                 $form->setActionButton('submit', cRegistry::getBackendUrl() . 'images/but_ok_off.gif', i18n("You are not sysadmin. You can't change these settings."), 's');
618:             }
619:             $result .= '<p>' . $form->render() . '</p>';
620:         }
621: 
622:         $configPath = cRegistry::getConfigValue('path', 'contenido_config');
623:         $configPath .= 'config.wysiwyg_tinymce4.php';
624:         if (cFileHandler::exists($configPath)
625:         && cFileHandler::writeable($configPath)) {
626:             $resetForm = new cHTMLForm('system_wysiwyg_tinymce4_general_options', 'main.php', 'post');
627:             $resetForm->setVar('area', $area);
628:             $resetForm->setVar('frame', $frame);
629:             $resetForm->setVar('action', 'edit_tinymce4');
630:             $oResetButton = new cHTMLButton('reset', i18n('Reset configuration back to default'));
631:             $oResetButton->setAttribute('value', i18n('Reset Configuration'));
632:             
633:             $resetForm = $resetForm->appendContent($oResetButton);
634:             $result .= $resetForm->render();
635:         }
636: 
637: 
638:         $page->set('s', 'FORM', $result);
639:         $page->set('s', 'RELOAD_HEADER', (false) ? 'true' : 'false');
640:         $page->render();
641:     }
642: }
643: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen