EDITOR_NONE, 'handler' => '', 'special_needs' => ''); if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'htmlarea')) $editors_list['HTMLAREA'] = array('desc' => EDITOR_HTMLAREA, 'handler' => 'htmlarea.php', 'special_needs' => ''); if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'fckeditor')) $editors_list['FCKEDITOR'] = array('desc' => EDITOR_FCKEDITOR, 'handler' => 'fckeditor.php', 'special_needs' => ''); if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'ckeditor')) $editors_list['CKEDITOR'] = array('desc' => EDITOR_CKEDITOR, 'handler' => 'ckeditor.php', 'special_needs' => ''); if (is_dir(DIR_FS_CATALOG . DIR_WS_EDITORS . 'tiny_mce')) $editors_list['TINYMCE'] = array('desc' => EDITOR_TINYMCE, 'handler' => 'tinymce.php', 'special_needs' => ''); /******* ADDITIONAL EDITORS CAN BE ADDED ABOVE THIS LINE *******/ /** * Prepare pulldown menu for use in various pages where editor selections should be offered */ $editors_pulldown = array(); $i = 0; foreach($editors_list as $key=>$value) { $i++; $editors_pulldown[] = array('id' => $i, 'text' => $value['desc'], 'key' => $key); } /** * Session default is set if no preference has been chosen during this login session */ if (!isset($_SESSION['html_editor_preference_status'])) { $_SESSION['html_editor_preference_status'] = HTML_EDITOR_PREFERENCE; } /** * If a new preference has been selected via a pulldown menu, set the details: */ $new_editor_choice = (isset($_GET['action']) && $_GET['action'] == 'set_editor' && isset($_GET['reset_editor'])) ? $_GET['reset_editor'] : -1; /** * Set a few variables for use in admin pages * * $_SESSION['html_editor_preference_status'] = the key name of the selected editor for this session * $current_editor_key = the numerical index pointer as default for the pulldown menu drawn when offering editor selection * $editor_handler = the path to the handler file containing the logic required for insertion to activate editor features * */ foreach($editors_pulldown as $key=>$value) { if ($new_editor_choice == $value['id']) $_SESSION['html_editor_preference_status'] = $value['key']; if ($_SESSION['html_editor_preference_status'] == $value['key']) $current_editor_key = $value['id']; } $editor_handler = DIR_WS_INCLUDES . $editors_list[$_SESSION['html_editor_preference_status']]['handler']; $editor_handler = ($editor_handler == DIR_WS_INCLUDES) ? '' : $editor_handler; /* if handler not found, reset to NONE */ if ($editor_handler != '' && !file_exists($editor_handler)) { $editor_handler = ''; $_SESSION['html_editor_preference_status'] = 'NONE'; $current_editor_key = 0; } /** * Debug code: */ if (false) { echo '
'; print_r($_GET); echo '
'; echo '
new_editor_choice = ' . $new_editor_choice; echo '
current_editor_key = ' . $current_editor_key; echo '
$_SESSION[html_editor_preference_status] = ' . $_SESSION['html_editor_preference_status']; echo '
editor_handler = ' . $editor_handler; echo '
'; print_r($editors_list); echo '
'; echo '
'; print_r($editors_pulldown); echo '
'; //die('debug end'); }