Changeset 2291 for trunk/plugins/LocalFilesEditor/admin.php
- Timestamp:
- Mar 26, 2008, 12:30:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/LocalFilesEditor/admin.php
r2235 r2291 27 27 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 28 28 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 29 include_once(LOCALEDIT_PATH.'functions.inc.php'); 29 30 load_language('plugin.lang', LOCALEDIT_PATH); 30 31 $my_base_url = get_admin_plugin_menu_link(__FILE__); 31 32 /**33 * returns $code if php syntax is correct34 * else return false35 *36 * @param string php code37 */38 function eval_syntax($code)39 {40 $code = str_replace(array('<?php', '?>'), '', $code);41 $b = 0;42 foreach (token_get_all($code) as $token)43 {44 if ('{' == $token) ++$b;45 else if ('}' == $token) --$b;46 }47 if ($b) return false;48 else49 {50 ob_start();51 $eval = eval('if(0){' . $code . '}');52 ob_end_clean();53 if ($eval === false) return false;54 else return '<?php' . $code . '?>';55 }56 }57 58 32 59 33 // +-----------------------------------------------------------------------+ … … 102 76 */\n\n\n\n\n?>"; 103 77 78 // Editarea options 79 $editarea = array( 80 'start_highlight' => true, 81 'language' => substr($user['language'], 0, 2), 82 'toolbar' => 'search,fullscreen, |,select_font, |, undo, redo, change_smooth_selection, highlight, reset_highlight, |, help'); 83 if (isset($conf['editarea_options']) and is_array($conf['editarea_options'])) 84 { 85 $editarea = array_merge($editarea, $conf['editarea_options']); 86 } 87 104 88 // Edit selected file for CSS, template and language 105 89 if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) … … 128 112 . 'show_default.php?file=include/config_default.inc.php', 129 113 'FILE' => 'config_default.inc.php'))); 130 break;131 114 $editarea['syntax'] = 'php'; 115 break; 132 116 133 117 case 'css': … … 155 139 'OPTIONS' => $options, 156 140 'SELECTED' => $selected)); 157 break;158 141 $editarea['syntax'] = 'css'; 142 break; 159 143 160 144 case 'tpl': … … 182 166 'OPTIONS' => $options, 183 167 'SELECTED' => $selected)); 184 break;185 168 $editarea['syntax'] = 'html'; 169 break; 186 170 187 171 case 'lang': … … 208 192 'OPTIONS' => $options, 209 193 'SELECTED' => $selected)); 194 $editarea['syntax'] = 'php'; 210 195 break; 211 196 … … 214 199 $content_file = file_exists($edited_file) ? 215 200 file_get_contents($edited_file) : $new_file['plug']; 201 $editarea['syntax'] = 'php'; 216 202 break; 217 203 } … … 309 295 } 310 296 297 // Editarea 298 if (!isset($conf['editarea_options']) or $conf['editarea_options'] !== false) 299 { 300 $template->assign('editarea', array( 301 'URL' => LOCALEDIT_PATH . 'editarea/edit_area_full.js', 302 'OPTIONS' => $editarea)); 303 } 304 311 305 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 312 306
Note: See TracChangeset
for help on using the changeset viewer.