Source for file admin.mostlyce.php

Documentation is available at admin.mostlyce.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @author Mambo Foundation Inc see README.php
  5. @copyright Mambo Foundation Inc.
  6. *  See COPYRIGHT.php for copyright notices and details.
  7. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
  8. *  LICENSE.php
  9. *  Mambo is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU General Public License
  11. *  as published by the Free Software Foundation; version 2 of the
  12. *  License.
  13. */ 
  14.  
  15. /** ensure this file is being included by a parent file */
  16. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  17.  
  18. // ensure user has access to this function
  19. if (!($acl->acl_check'administration''edit''users'$my->usertype'components''all' )
  20.                 | $acl->acl_check'administration''edit''users'$my->usertype'components''com_mostlyce' ))) {
  21.         mosRedirect'index2.php'T_('You are not authorized to view this resource.') );
  22. }
  23. /*if (file_exists($mosConfig_absolute_path.'/administrator/components/com_mostlyce/language/'.$mosConfig_lang.'.php')){
  24.    include ($mosConfig_absolute_path.'/administrator/components/com_mostlyce/language/'.$mosConfig_lang.'.php');
  25. }else{
  26.    include ($mosConfig_absolute_path.'/administrator/components/com_mostlyce/language/english.php');
  27. }*/
  28.  
  29. if (!file_exists($mosConfig_absolute_path.'/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php')){
  30.    mosRedirect'index2.php'T_('Cannot find mostlyce_config.php! Please install the MOStlyCE mambot.'));
  31. }
  32.  
  33. include($mosConfig_absolute_path.'/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php');
  34.  
  35. class mosCE_Config extends mosDBTable {
  36.         /** @var int */
  37.         var $editor_themes=null;
  38.         var $editor_compression=null;
  39.         var $editor_lang=null;
  40.         var $editor_lang_list=null;
  41.         var $editor_width=null;
  42.         var $editor_height=null;
  43.         var $editor_css_override=null;
  44.         var $editor_custom_css=null;
  45.         var $editor_newlines=null;
  46.         var $editor_convert_urls=null;
  47.         var $editor_script_acl=null;
  48.         var $editor_script_elms;
  49.         var $editor_iframe_acl=null;
  50.         var $editor_iframe_elms;
  51.         var $editor_xtd_elms=null;
  52.         var $editor_direction=null;
  53.         var $editor_preview_bgcolor=null;
  54.         var $editor_extra_plugins=null;
  55.         var $editor_font_tools_acl=null;
  56.         var $editor_plugin_datetime_acl=null;
  57.         var $editor_plugin_dateformat=null;
  58.         var $editor_plugin_timeformat=null;
  59.         var $editor_plugin_emotions_acl=null;
  60.         var $editor_plugin_print=null;
  61.         var $editor_plugin_searchreplace=null;
  62.         var $editor_plugin_media_acl=null;
  63.         var $editor_plugin_table_acl=null;
  64.         var $editor_plugin_spellchecker=null;
  65.         var $editor_plugin_layer=null;
  66.         var $editor_mosimage_icon=null;
  67.         var $editor_plugin_img_mgr=null;
  68.         var $editor_layout_row1=null;
  69.         var $editor_layout_row2=null;
  70.         var $editor_layout_row3=null;
  71.         var $editor_layout_row4=null;
  72.         var $editor_tmpl_dir=null;
  73.  
  74.         function mosCE_Config({
  75.                 $this->_alias array(
  76.                 'editor_themes'                                 =>'editor_themes',
  77.                 'editor_compression'                         =>'editor_compression',
  78.                 'editor_lang'                                =>'editor_lang',
  79.                 'editor_lang_list'                           =>'editor_lang_list',
  80.                 'editor_width'                               =>'editor_width',
  81.                 'editor_height'                              =>'editor_height',
  82.                 'editor_css_override'                        =>'editor_css_override',
  83.                 'editor_custom_css'                          =>'editor_custom_css',
  84.                 'editor_newlines'                            =>'editor_newlines',
  85.                 'editor_convert_urls'                        =>'editor_convert_urls',
  86.                 'editor_script_acl'                          =>'editor_script_acl',
  87.                 'editor_script_elms'                         =>'editor_script_elms',
  88.                 'editor_iframe_acl'                          =>'editor_iframe_acl',
  89.                 'editor_iframe_elms'                         =>'editor_iframe_elms',
  90.                 'editor_xtd_elms'                            =>'editor_xtd_elms',
  91.                 'editor_direction'                           =>'editor_direction',
  92.                 'editor_extra_plugins'                       =>'editor_extra_plugins',
  93.                 'editor_font_tools_acl'                      =>'editor_font_tools_acl',
  94.                 'editor_plugin_datetime_acl'                 =>'editor_plugin_datetime_acl',
  95.                 'editor_plugin_dateformat'                   =>'editor_plugin_dateformat',
  96.                 'editor_plugin_timeformat'                   =>'editor_plugin_timeformat',
  97.                 'editor_plugin_emotions_acl'                 =>'editor_plugin_emotions_acl',
  98.                 'editor_plugin_print'                        =>'editor_plugin_print',
  99.                 'editor_plugin_searchreplace'                =>'editor_plugin_searchreplace',
  100.                 'editor_plugin_media_acl'                    =>'editor_plugin_media_acl',
  101.                 'editor_plugin_table_acl'                    =>'editor_plugin_table_acl',
  102.                 'editor_plugin_spellchecker'                 =>'editor_plugin_spellchecker',
  103.                 'editor_plugin_layer'                        =>'editor_plugin_layer',
  104.                 'editor_mosimage_icon'                       =>'editor_mosimage_icon',
  105.                 'editor_plugin_img_mgr'                         =>'editor_plugin_img_mgr',    
  106.                 'editor_layout_row1'                         =>'editor_layout_row1',
  107.                 'editor_layout_row2'                         =>'editor_layout_row2',
  108.                 'editor_layout_row3'                         =>'editor_layout_row3',
  109.                 'editor_layout_row4'                         =>'editor_layout_row4',
  110.                 'editor_tmpl_dir'                            =>'editor_tmpl_dir'
  111.                 );
  112.         }
  113.  
  114.         function getVarText({
  115.                 $txt '';
  116.                 foreach ($this->_alias as $k=>$v{
  117.                         $txt .= "\$$v = '".addslashes$this->$k )."';\n";
  118.                 }
  119.                 return $txt;
  120.         }
  121.  
  122.         function bindGlobals({
  123.                 foreach ($this->_alias as $k=>$v{
  124.                         if(isset($GLOBALS[$v]))
  125.                         $this->$k $GLOBALS[$v];
  126.                         else
  127.                         $this->$k "";
  128.                 }
  129.         }
  130. }
  131.  
  132. require_once'components/com_mostlyce/admin.mostlyce.html.php' );
  133. $confightml new HTML_expConfig();
  134.  
  135. switch ($task{
  136.         case 'save':
  137.                 saveconfig();
  138.                 break;
  139.         case 'config':
  140.                 showconfig($confightml$database$option);
  141.                 break;
  142.         default:
  143.                 showconfig($confightml$database$option);
  144.                 break;
  145. }
  146.  
  147. function showconfig($confightml&$database$option{
  148.         global $database$mosConfig_absolute_path;
  149.         $row new mosCE_Config();
  150.         $row->bindGlobals();
  151.  
  152.         // compile list of the languages
  153.         $editor_lang array();
  154.  
  155.         if ($handle=opendir"$mosConfig_absolute_path/mambots/editors/mostlyce/jscripts/tiny_mce/langs/)) {
  156.                 $i=0;
  157.                 while (false !== ($file readdir($handle))) {
  158.                         if ($file <> "." && $file <> ".."{
  159.                                 $editor_lang[mosHTML::makeOptionsubstr($file,0,-3) );
  160.                         }
  161.                 }
  162.         closedir($handle);
  163.       }
  164.  
  165.        // sort list of languages
  166.         sort($editor_lang);
  167.         reset($editor_lang);
  168.  
  169.         $lists array();
  170.  
  171.         $editor_newlines array(
  172.                 mosHTML::makeOption'br'T_('BR Elements') ),
  173.                 mosHTML::makeOption'p'T_('P Elements') )
  174.         );
  175.  
  176.         $editor_themes array(
  177.                 mosHTML::makeOption'advanced'T_('Advanced') ),
  178.                 mosHTML::makeOption'simple'T_('Simple') )
  179.         );
  180.  
  181.         $editor_compression array(
  182.                 mosHTML::makeOption'true'T_('On') ),
  183.                 mosHTML::makeOption'false'T_('Off') )
  184.         );
  185.         
  186.         $editor_direction array(
  187.                 mosHTML::makeOption'ltr'T_('Left to Right') ),
  188.                 mosHTML::makeOption'rtl'T_('Right to Left') )
  189.         );
  190.         
  191.         //Non-specific, used by several plugins
  192.         $editor_true_false array(
  193.                 mosHTML::makeOption'true'T_('Yes') ),
  194.                 mosHTML::makeOption'false'T_('No') )
  195.         );
  196.  
  197.         $php_settings new mosCE_Config();
  198.  
  199.         // build the html select lists
  200.         //Standard Editor options
  201.         $lists['editor_themes']                             mosHTML::selectList$editor_themes'editor_themes''class="inputbox" size="1"''value''text'$row->editor_themes );
  202.  
  203.         $lists['editor_compression']                        mosHTML::selectList$editor_compression'editor_compression''class="inputbox" size="1"''value''text'$row->editor_compression );
  204.  
  205.         $lists['editor_lang']                               mosHTML::selectList$editor_lang'editor_lang''class="inputbox" size="1"''value''text'$row->editor_lang );
  206.  
  207.         $lists['editor_css_override']                       mosHTML::yesnoSelectList'editor_css_override''class="inputbox" size="1"'$row->editor_css_override );
  208.  
  209.         $lists['editor_newlines']                           mosHTML::selectList$editor_newlines'editor_newlines''class="inputbox" size="1"''value''text'$row->editor_newlines );
  210.  
  211.         $lists['editor_convert_urls']                       mosHTML::selectList$editor_true_false'editor_convert_urls''class="inputbox" size="1"''value''text'$row->editor_convert_urls );
  212.  
  213.         $lists['editor_script_acl']                         mosHTML::selectList$editor_true_false'editor_script_acl''class="inputbox" size="1"''value''text'$row->editor_script_acl );
  214.  
  215.         $lists['editor_iframe_acl']                         mosHTML::selectList$editor_true_false'editor_iframe_acl''class="inputbox" size="1"''value''text'$row->editor_iframe_acl );
  216.  
  217.         $lists['editor_direction']                          mosHTML::selectList$editor_direction'editor_direction''class="inputbox" size="1"''value''text'$row->editor_direction );
  218.  
  219.         //Editor Plugin options
  220.         $lists['editor_font_tools_acl']                     mosHTML::selectList$editor_true_false'editor_font_tools_acl''class="inputbox" size="1"''value''text'$row->editor_font_tools_acl );
  221.  
  222.         $lists['editor_plugin_emotions_acl']                mosHTML::selectList$editor_true_false'editor_plugin_emotions_acl''class="inputbox" size="1"''value''text'$row->editor_plugin_emotions_acl );
  223.  
  224.         $lists['editor_plugin_print']                       mosHTML::selectList$editor_true_false'editor_plugin_print''class="inputbox" size="1"''value''text',  $row->editor_plugin_print );
  225.  
  226.         $lists['editor_plugin_searchreplace']               mosHTML::selectList$editor_true_false'editor_plugin_searchreplace''class="inputbox" size="1"''value''text',  $row->editor_plugin_searchreplace );
  227.  
  228.         $lists['editor_plugin_media_acl']                   mosHTML::selectList$editor_true_false'editor_plugin_media_acl''class="inputbox" size="1"''value''text'$row->editor_plugin_media_acl );
  229.         
  230.         $lists['editor_plugin_datetime_acl']                mosHTML::selectList$editor_true_false'editor_plugin_datetime_acl''class="inputbox" size="1"''value''text'$row->editor_plugin_datetime_acl );
  231.  
  232.         $lists['editor_plugin_table_acl']                   mosHTML::selectList$editor_true_false'editor_plugin_table_acl''class="inputbox" size="1"''value''text'$row->editor_plugin_table_acl );
  233.         
  234.         $lists['editor_plugin_spellchecker']                mosHTML::selectList$editor_true_false'editor_plugin_spellchecker''class="inputbox" size="1"''value''text'$row->editor_plugin_spellchecker );
  235.         
  236.         $lists['editor_plugin_layer']                       mosHTML::selectList$editor_true_false'editor_plugin_layer''class="inputbox" size="1"''value''text'$row->editor_plugin_layer );
  237.         
  238.         $lists['editor_plugin_img_mgr']                     mosHTML::selectList$editor_true_false'editor_plugin_img_mgr''class="inputbox" size="1"''value''text'$row->editor_plugin_img_mgr );
  239.         
  240.         $lists['editor_mosimage_icon']                     mosHTML::selectList$editor_true_false'editor_mosimage_icon''class="inputbox" size="1"''value''text'$row->editor_mosimage_icon );
  241.  
  242.         $confightml->showconfig$row$lists$option );
  243. }
  244.  
  245. function saveconfig({
  246.         global $database;
  247.  
  248.         $row new mosCE_Config();
  249.  
  250.         if (!$row->bind$_POST )) {
  251.                 mosRedirect"index2.php?option=com_mostlyce"$row->getError() );
  252.         }
  253.  
  254.         $config "<?php \n";
  255.         $config .= $row->getVarText();
  256.         $config .= '?>';
  257.  
  258.         if ($fp fopen('../mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php''w')) {
  259.                 fputs($fp$configstrlen($config));
  260.                 fclose ($fp);
  261.  
  262.                 mosRedirect'index2.php?option=com_mostlyce&task=config''The configuration details have been updated!' );
  263.         else {
  264.                 mosRedirect'index2.php?option=com_mostlyce&task=config''An Error Has Occurred! Unable to open config file to write!' );
  265.         }
  266. }
  267. ?>

Documentation generated on Mon, 05 May 2008 16:15:48 +0400 by phpDocumentor 1.4.0