- Timestamp:
- Mar 26, 2008, 12:30:23 AM (17 years ago)
- Location:
- trunk/plugins/LocalFilesEditor
- Files:
-
- 49 added
- 8 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 -
trunk/plugins/LocalFilesEditor/admin.tpl
r2235 r2291 1 {if isset($editarea)} 2 <script type="text/javascript" src="{$editarea.URL}"></script> 3 <script type="text/javascript"> 4 editAreaLoader.init({ldelim} 5 id: "text" 6 {foreach from=$editarea.OPTIONS key=option item=value} 7 , {$option}: {$value|editarea_quote} 8 {/foreach} 9 {rdelim}); 10 </script> 11 {/if} 12 1 13 <div class="titrePage"> 2 14 <h2>LocalFiles Editor</h2> … … 15 27 16 28 {foreach from=$show_default item=file} 17 <a href="{$file.SHOW_DEFAULT}" onclick="window.open( this.href, 'local_file', 'location=no,toolbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes, fullscreen=yes' ); return false;">{'locfiledit_show_default'|@translate} "{$file.FILE}"</a>29 <a href="{$file.SHOW_DEFAULT}" onclick="window.open( this.href, 'local_file', 'location=no,toolbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes,width=800,height=600' ); return false;">{'locfiledit_show_default'|@translate} "{$file.FILE}"</a> 18 30 <br> 19 31 {/foreach} … … 24 36 <b>{$zone_edit.FILE_NAME}</b> 25 37 <br> 26 <textarea rows="30" name="text" style="width:90%;">{$zone_edit.CONTENT_FILE}</textarea>38 <textarea rows="30" name="text" id="text" style="width:90%;">{$zone_edit.CONTENT_FILE}</textarea> 27 39 <br>{'locfiledit_save_bak'|@translate} 28 40 <br><br> 29 41 <input class="submit" type="submit" value="{'locfiledit_save_file'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/> 30 42 {if isset ($restore)} 31 <input class="submit" type="submit" value="{'locfiledit_restore'|@translate}" name="restore" onclick="return confirm('{'locfiledit_restore_confirm'|@translate }');" {$TAG_INPUT_ENABLED}/>43 <input class="submit" type="submit" value="{'locfiledit_restore'|@translate}" name="restore" onclick="return confirm('{'locfiledit_restore_confirm'|@translate|escape:'javascript'}');" {$TAG_INPUT_ENABLED}/> 32 44 {/if} 33 45 {/if} -
trunk/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php
r2235 r2291 40 40 $lang['locfiledit_edit'] = 'Edit'; 41 41 $lang['locfiledit_restore'] = 'Restore the backup file'; 42 $lang['locfiledit_restore_confirm'] = 'Please confirm?\nRestore won\\\'t be effective till next save.'; 42 $lang['locfiledit_restore_confirm'] = 'Please confirm? 43 Restore won\'t be effective till next save.'; 43 44 $lang['locfiledit_bak_loaded1'] = 'Backup file loaded.'; 44 45 $lang['locfiledit_bak_loaded2'] = 'You must save file to restore it.'; -
trunk/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php
r2235 r2291 40 40 $lang['locfiledit_edit'] = 'Editar'; 41 41 $lang['locfiledit_restore'] = 'Cargar el fichero de salvaguardia'; 42 $lang['locfiledit_restore_confirm'] = '¿ Desea cargar el fichero de salvaguardia?\nUsted deberá luego hacer clic Registrar para restaurarlo.'; 42 $lang['locfiledit_restore_confirm'] = '¿ Desea cargar el fichero de salvaguardia? 43 Usted deberá luego hacer clic Registrar para restaurarlo.'; 43 44 $lang['locfiledit_bak_loaded1'] = 'Fichero cargado de salvaguardia'; 44 45 $lang['locfiledit_bak_loaded2'] = 'Usted debe registrarlo para salvaguardarlo.'; -
trunk/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php
r2235 r2291 40 40 $lang['locfiledit_edit'] = 'Editer'; 41 41 $lang['locfiledit_restore'] = 'Charger le fichier de sauvegarde'; 42 $lang['locfiledit_restore_confirm'] = 'Souaitez-vous charger le fichier de sauvegarde?\nVous devrez ensuite cliquer sur Enregistrer pour le restaurer.'; 42 $lang['locfiledit_restore_confirm'] = 'Souaitez-vous charger le fichier de sauvegarde? 43 Vous devrez ensuite cliquer sur Enregistrer pour le restaurer.'; 43 44 $lang['locfiledit_bak_loaded1'] = 'Fichier de sauvegarde chargé'; 44 45 $lang['locfiledit_bak_loaded2'] = 'Vous devez l\'enregistrer pour le sauvegarder.'; -
trunk/plugins/LocalFilesEditor/main.inc.php
r2243 r2291 38 38 function localfiles_admin_menu($menu) 39 39 { 40 array_push($menu, array('NAME' => 'LocalFiles Editor', 41 'URL' => get_admin_plugin_menu_link(LOCALEDIT_PATH . 'admin.php'))); 40 array_push($menu, array( 41 'NAME' => 'LocalFiles Editor', 42 'URL' => get_admin_plugin_menu_link(LOCALEDIT_PATH . 'admin.php'))); 42 43 return $menu; 43 44 } -
trunk/plugins/LocalFilesEditor/show_default.php
r2235 r2291 27 27 define('PHPWG_ROOT_PATH', '../../'); 28 28 include_once(PHPWG_ROOT_PATH . 'include/common.inc.php'); 29 include_once(LOCALEDIT_PATH.'functions.inc.php'); 29 30 check_status(ACCESS_ADMINISTRATOR); 30 31 … … 38 39 39 40 $template->set_filename('show_default', dirname(__FILE__) . '/show_default.tpl'); 40 41 42 // Editarea 43 if (!isset($conf['editarea_options']) or $conf['editarea_options'] !== false) 44 { 45 $editarea = array( 46 'syntax' => 'php', 47 'start_highlight' => true, 48 'is_editable' => false, 49 'language' => substr($user['language'], 0, 2)); 50 51 $template->assign('editarea', array( 52 'URL' => LOCALEDIT_PATH . 'editarea/edit_area_full.js', 53 'OPTIONS' => $editarea)); 54 } 55 41 56 $file = file_get_contents(PHPWG_ROOT_PATH . $path); 42 43 $template->assign(array('DEFAULT_CONTENT' => nl2br($file)));44 57 58 $template->assign(array('DEFAULT_CONTENT' => $file)); 59 45 60 $title = $path; 46 61 $page['page_banner'] = '<h1>'.str_replace('/', ' / ', $path).'</h1>'; … … 48 63 49 64 include(PHPWG_ROOT_PATH.'include/page_header.php'); 50 65 51 66 $template->pparse('show_default'); 52 67 53 68 include(PHPWG_ROOT_PATH.'include/page_tail.php'); 54 69 } -
trunk/plugins/LocalFilesEditor/show_default.tpl
r2235 r2291 1 <div id="content" style="font-family:courier;text-align:left;padding:5px;"> 2 {$DEFAULT_CONTENT} 3 </div> <!-- content --> 1 {if isset($editarea)} 2 <script type="text/javascript" src="{$editarea.URL}"></script> 3 <script type="text/javascript"> 4 editAreaLoader.init({ldelim} 5 id: "text" 6 {foreach from=$editarea.OPTIONS key=option item=value} 7 , {$option}: {$value|editarea_quote} 8 {/foreach} 9 {rdelim}); 10 </script> 11 {/if} 12 13 <textarea rows="30" id="text" cols="90">{$DEFAULT_CONTENT}</textarea>
Note: See TracChangeset
for help on using the changeset viewer.