- Timestamp:
- Feb 12, 2013, 11:01:46 AM (12 years ago)
- Location:
- branches/2.4/plugins/LocalFilesEditor
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4/plugins/LocalFilesEditor/admin.php
r12922 r20712 56 56 if (isset($_POST['restore'])) 57 57 { 58 $edited_file = $_POST['edited_file'];59 58 $content_file = file_get_contents(get_bak_file($edited_file)); 60 59 array_push($page['infos'], … … 74 73 else 75 74 { 76 $edited_file = $_POST['edited_file'];77 75 $content_file = stripslashes($_POST['text']); 78 76 if (get_extension($edited_file) == 'php') -
branches/2.4/plugins/LocalFilesEditor/include/css.inc.php
r13242 r20712 1 1 <?php 2 3 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 3 5 if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) 4 include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); 5 $themes = new themes(); 6 7 if (isset($_POST['edit'])) 6 8 { 7 $ edited_file = $_POST['file_to_edit'];9 $_POST['theme'] = $_POST['theme_select']; 8 10 } 9 elseif (isset($_POST['edited_file'])) 11 12 if (isset($_POST['theme']) and '~common~' == $_POST['theme']) 10 13 { 11 $edited_file = $_POST['edited_file']; 12 } 13 elseif (isset($_GET['theme']) and in_array($_GET['theme'], array_keys(get_pwg_themes(true)))) 14 { 15 $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$_GET['theme'].'-rules.css'; 14 $page['theme'] = $_POST['theme']; 15 $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'css/rules.css'; 16 16 } 17 17 else 18 18 { 19 $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.get_default_theme().'-rules.css'; 19 if (isset($_GET['theme'])) 20 { 21 $page['theme'] = $_GET['theme']; 22 } 23 elseif (isset($_POST['theme'])) 24 { 25 $page['theme'] = $_POST['theme']; 26 } 27 28 if (!isset($page['theme']) or !in_array($page['theme'], array_keys($themes->fs_themes))) 29 { 30 $page['theme'] = get_default_theme(); 31 } 32 33 $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$page['theme'].'-rules.css'; 20 34 } 35 36 $template->assign('theme', $page['theme']); 21 37 22 38 if (file_exists($edited_file)) … … 30 46 31 47 $selected = 0; 32 // $options[] = l10n('locfiledit_choose_file'); 33 // $options[] = '----------------------'; 34 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "css/rules.css"; 48 $value = '~common~'; 49 $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/rules.css'; 35 50 36 $options[$value] = (file_exists($ value) ? '✔' : '✘').' local / css / rules.css';37 if ($ edited_file== $value)51 $options[$value] = (file_exists($file) ? '✔' : '✘').' local / css / rules.css'; 52 if ($page['theme'] == $value) 38 53 { 39 54 $selected = $value; … … 43 58 // [Administration > Configuration > Themes] 44 59 45 include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');46 $themes = new themes();47 60 $themes->sort_fs_themes(); 48 61 $default_theme = get_default_theme(); … … 82 95 } 83 96 84 $options[] = ''; 85 $options[] = '----- '.l10n('Active Themes').' -----'; 86 $options[] = ''; 97 $active_theme_options = array(); 87 98 foreach ($active_themes as $theme) 88 99 { 89 $ value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css';100 $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css'; 90 101 91 $ options[$value] = (file_exists($value) ? '✔' : '✘').' '.$theme['name'];102 $label = (file_exists($file) ? '✔' : '✘').' '.$theme['name']; 92 103 93 104 if ($default_theme == $theme['id']) 94 105 { 95 $ options[$value].= ' ('.l10n('default').')';106 $label.= ' ('.l10n('default').')'; 96 107 } 108 109 $active_theme_options[$theme['id']] = $label; 97 110 98 if ($ edited_file == $value)111 if ($theme['id'] == $page['theme']) 99 112 { 100 $selected = $ value;113 $selected = $theme['id']; 101 114 } 102 115 } 103 116 104 $options[] = ''; 105 $options[] = '----- '.l10n('Inactive Themes').' -----'; 106 $options[] = ''; 117 if (count($active_theme_options) > 0) 118 { 119 $options[l10n('Active Themes')] = $active_theme_options; 120 } 121 122 $inactive_theme_options = array(); 107 123 foreach ($inactive_themes as $theme) 108 124 { 109 $ value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css';125 $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css'; 110 126 111 $ options[$value] = (file_exists($value) ? '✔' : '✘').' '.$theme['name'];127 $inactive_theme_options[$theme['id']] = (file_exists($file) ? '✔' : '✘').' '.$theme['name']; 112 128 113 if ($ edited_file == $value)129 if ($theme['id'] == $page['theme']) 114 130 { 115 $selected = $ value;131 $selected = $theme['id']; 116 132 } 117 133 } 118 134 119 $template->assign('css_lang_tpl', array( 120 'OPTIONS' => $options, 121 'SELECTED' => $selected 122 ) 135 if (count($inactive_theme_options) > 0) 136 { 137 $options[l10n('Inactive Themes')] = $inactive_theme_options; 138 } 139 140 $template->assign( 141 'css_lang_tpl', 142 array( 143 'SELECT_NAME' => 'theme_select', 144 'OPTIONS' => $options, 145 'SELECTED' => $selected 146 ) 123 147 ); 124 148 125 149 $codemirror_mode = 'text/css'; 126 127 150 ?> -
branches/2.4/plugins/LocalFilesEditor/include/lang.inc.php
r10348 r20712 1 1 <?php 2 3 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 3 5 $edited_file = isset($_POST['edited_file']) ? $_POST['edited_file'] : ''; 6 $content_file = ''; 4 $languages = get_languages(); 7 5 8 if ( (isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit']))6 if (isset($_POST['edit'])) 9 7 { 10 $edited_file = $_POST['file_to_edit']; 11 if (file_exists($edited_file)) 12 { 13 $content_file = file_get_contents($edited_file); 14 } 15 else 16 { 17 $content_file = "<?php\n\n/* ".l10n('locfiledit_newfile')." */\n\n\n\n\n?>"; 18 } 8 $_POST['language'] = $_POST['language_select']; 19 9 } 20 10 21 $selected = 0; 22 $options[] = l10n('locfiledit_choose_file'); 23 $options[] = '----------------------'; 11 if (isset($_POST['language'])) 12 { 13 $page['language'] = $_POST['language']; 14 } 15 16 if (!isset($page['language']) or !in_array($page['language'], array_keys($languages))) 17 { 18 $page['language'] = get_default_language(); 19 } 20 21 $template->assign('language', $page['language']); 22 23 $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'language/'.$page['language'].'.lang.php';; 24 25 if (file_exists($edited_file)) 26 { 27 $content_file = file_get_contents($edited_file); 28 } 29 else 30 { 31 $content_file = "<?php\n\n/* ".l10n('locfiledit_newfile')." */\n\n\n\n\n?>"; 32 } 33 34 $selected = 0; 24 35 foreach (get_languages() as $language_code => $language_name) 25 36 { 26 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'language/'.$language_code.'.lang.php'; 27 if ($edited_file == $value) 37 $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'language/'.$language_code.'.lang.php'; 38 39 $options[$language_code] = (file_exists($file) ? '✔' : '✘').' '.$language_name; 40 41 if ($page['language'] == $language_code) 28 42 { 29 $selected = $ value;43 $selected = $language_code; 30 44 $template->assign('show_default', array( 31 45 array( … … 40 54 ); 41 55 } 42 $options[$value] = $language_name;43 56 } 44 57 45 $template->assign('css_lang_tpl', array( 58 $template->assign( 59 'css_lang_tpl', 60 array( 61 'SELECT_NAME' => 'language_select', 46 62 'OPTIONS' => $options, 47 63 'SELECTED' => $selected -
branches/2.4/plugins/LocalFilesEditor/include/tpl.inc.php
r11654 r20712 1 1 <?php 2 3 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 3 5 $edited_file = isset($_POST['edited_file']) ? $_POST['edited_file'] : ''; 4 $edited_file = ''; 5 6 if (isset($_POST['edit'])) 7 { 8 $_POST['template'] = $_POST['file_to_edit']; 9 } 10 11 if (!empty($_POST['template'])) 12 { 13 if (preg_match('#\.\./#', $_POST['template'])) 14 { 15 die('Hacking attempt! template extension must be in template-extension directory'); 16 } 17 18 if (!preg_match('#\.tpl$#', $_POST['template'])) 19 { 20 die('Hacking attempt! template extension must be a *.tpl file'); 21 } 22 23 $template->assign('template', $_POST['template']); 24 25 $edited_file = './template-extension/'.$_POST['template']; 26 } 27 6 28 $content_file = ''; 7 8 if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) 29 if (file_exists($edited_file)) 9 30 { 10 $edited_file = $_POST['file_to_edit']; 11 if (file_exists($edited_file)) 12 { 13 $content_file = file_get_contents($edited_file); 14 } 15 else 16 { 17 $content_file = ''; 18 } 31 $content_file = file_get_contents($edited_file); 19 32 } 20 33 … … 51 64 else 52 65 { 66 $template->assign('template', $filename); 53 67 $edited_file = $_POST['tpl_parent'] . '/' . $filename; 54 68 $content_file = ($_POST['tpl_model'] == '0') ? '' : file_get_contents($_POST['tpl_model']); … … 118 132 foreach (get_extents() as $pwg_template) 119 133 { 120 $value = './template-extension/' .$pwg_template;134 $value = $pwg_template; 121 135 $options[$value] = str_replace('/', ' / ', $pwg_template); 122 136 if ($edited_file == $value) $selected = $value; … … 127 141 $selected = $edited_file; 128 142 } 129 $template->assign('css_lang_tpl', array( 130 'OPTIONS' => $options, 131 'SELECTED' => $selected, 132 'NEW_FILE_URL' => $my_base_url.'-tpl&newfile', 133 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right' 134 ) 135 ); 143 $template->assign( 144 'css_lang_tpl', 145 array( 146 'SELECT_NAME' => 'file_to_edit', 147 'OPTIONS' => $options, 148 'SELECTED' => $selected, 149 'NEW_FILE_URL' => $my_base_url.'-tpl&newfile', 150 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right' 151 ) 152 ); 136 153 } 137 154 -
branches/2.4/plugins/LocalFilesEditor/template/admin.tpl
r11362 r20712 31 31 <div id="LocalFilesEditor"> 32 32 33 <input type="hidden" value="{$zone_edit.EDITED_FILE}" name="edited_file"/> 33 {if isset($theme)} 34 <input type="hidden" value="{$theme}" name="theme"> 35 {/if} 36 37 {if isset($language)} 38 <input type="hidden" value="{$language}" name="language"> 39 {/if} 40 41 {if isset($template)} 42 <input type="hidden" value="{$template}" name="template"> 43 {/if} 44 34 45 35 46 {if isset ($create_tpl)} … … 53 64 54 65 {if isset ($css_lang_tpl)} 55 <select name="file_to_edit"> 56 {foreach from=$css_lang_tpl.OPTIONS item=theme key=value} 57 <option value="{$value}" {if $value == $css_lang_tpl.SELECTED}selected="selected"{/if} {if is_numeric($value)}disabled="disabled"{/if}>{$theme}</option> 58 {/foreach} 66 <select name="{$css_lang_tpl.SELECT_NAME}"> 67 {html_options options=$css_lang_tpl.OPTIONS selected=$css_lang_tpl.SELECTED} 59 68 </select> 60 61 69 62 70 <input class="submit" type="submit" value="{'locfiledit_edit'|@translate}" name="edit" /> 63 71 <br><br> 64 {if isset ($css_lang_tpl.NEW_FILE_URL)} 65 <span class="{$css_lang_tpl.NEW_FILE_CLASS}"> 66 <a href="{$css_lang_tpl.NEW_FILE_URL}">{'locfiledit_new_tpl'|@translate}</a> 67 </span> 68 {/if} 72 {/if} 73 74 {if isset ($css_lang_tpl.NEW_FILE_URL)} 75 <span class="{$css_lang_tpl.NEW_FILE_CLASS}"> 76 <a href="{$css_lang_tpl.NEW_FILE_URL}">{'locfiledit_new_tpl'|@translate}</a> 77 </span> 69 78 {/if} 70 79
Note: See TracChangeset
for help on using the changeset viewer.