|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00009 if (!defined('DIR_WS_EDITORS')) define('DIR_WS_EDITORS', 'editors'); 00010 if (!defined('IS_ADMIN_FLAG')) { 00011 die('Illegal Access'); 00012 } 00024 $editors_list['NONE'] = array('desc' => EDITOR_NONE, 'handler' => '', 'special_needs' => ''); // plain text 00025 if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'htmlarea')) $editors_list['HTMLAREA'] = array('desc' => EDITOR_HTMLAREA, 'handler' => 'htmlarea.php', 'special_needs' => ''); 00026 if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'ckeditor')) $editors_list['CKEDITOR'] = array('desc' => EDITOR_CKEDITOR, 'handler' => 'ckeditor.php', 'special_needs' => ''); 00027 if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'tiny_mce')) $editors_list['TINYMCE'] = array('desc' => EDITOR_TINYMCE, 'handler' => 'tinymce.php', 'special_needs' => ''); 00028 00032 $editors_pulldown = array(); 00033 $i = 0; 00034 foreach($editors_list as $key=>$value) { 00035 $i++; 00036 $editors_pulldown[] = array('id' => $i, 'text' => $value['desc'], 'key' => $key); 00037 } 00041 if (!isset($_SESSION['html_editor_preference_status'])) { 00042 $_SESSION['html_editor_preference_status'] = HTML_EDITOR_PREFERENCE; 00043 } 00047 $new_editor_choice = (isset($_GET['action']) && $_GET['action'] == 'set_editor' && isset($_GET['reset_editor'])) ? $_GET['reset_editor'] : -1; 00048 00057 foreach($editors_pulldown as $key=>$value) { 00058 if ($new_editor_choice == $value['id']) $_SESSION['html_editor_preference_status'] = $value['key']; 00059 if ($_SESSION['html_editor_preference_status'] == $value['key']) $current_editor_key = $value['id']; 00060 } 00061 $editor_handler = DIR_WS_INCLUDES . $editors_list[$_SESSION['html_editor_preference_status']]['handler']; 00062 $editor_handler = ($editor_handler == DIR_WS_INCLUDES) ? '' : $editor_handler; 00063 /* if handler not found, reset to NONE */ 00064 if ($editor_handler != '' && !file_exists($editor_handler)) { 00065 $editor_handler = ''; 00066 $_SESSION['html_editor_preference_status'] = 'NONE'; 00067 $current_editor_key = 0; 00068 } 00069 00073 if (false) { 00074 echo '<br /><pre>'; print_r($_GET); echo '</pre>'; 00075 echo '<br />new_editor_choice = ' . $new_editor_choice; 00076 echo '<br />current_editor_key = ' . $current_editor_key; 00077 echo '<br />$_SESSION[html_editor_preference_status] = ' . $_SESSION['html_editor_preference_status']; 00078 echo '<br />editor_handler = ' . $editor_handler; 00079 echo '<br /><pre>'; print_r($editors_list); echo '</pre>'; 00080 echo '<br /><pre>'; print_r($editors_pulldown); echo '</pre>'; 00081 //die('debug end'); 00082 }