Changeset 11361 for branches/2.2/plugins/LocalFilesEditor
- Timestamp:
- Jun 14, 2011, 11:57:29 AM (13 years ago)
- Location:
- branches/2.2/plugins/LocalFilesEditor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/plugins/LocalFilesEditor/include/css.inc.php
r10349 r11361 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 $edited_file = isset($_POST['edited_file']) ? $_POST['edited_file'] : '';6 $content_file = '';7 8 5 if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) 9 6 { 10 7 $edited_file = $_POST['file_to_edit']; 11 if (file_exists($edited_file)) 8 } 9 elseif (isset($_POST['edited_file'])) 10 { 11 $edited_file = $_POST['edited_file']; 12 } 13 else 14 { 15 $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.get_default_theme().'-rules.css'; 16 } 17 18 if (file_exists($edited_file)) 19 { 20 $content_file = file_get_contents($edited_file); 21 } 22 else 23 { 24 $content_file = "/* " . l10n('locfiledit_newfile') . " */\n\n"; 25 } 26 27 $selected = 0; 28 // $options[] = l10n('locfiledit_choose_file'); 29 // $options[] = '----------------------'; 30 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "css/rules.css"; 31 32 $options[$value] = (file_exists($value) ? '✔' : '✘').' local / css / rules.css'; 33 if ($edited_file == $value) 34 { 35 $selected = $value; 36 } 37 38 // themes are displayed in the same order as on screen 39 // [Administration > Configuration > Themes] 40 41 include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); 42 $themes = new themes(); 43 $themes->sort_fs_themes(); 44 $default_theme = get_default_theme(); 45 $db_themes = $themes->get_db_themes(); 46 47 $db_theme_ids = array(); 48 foreach ($db_themes as $db_theme) 49 { 50 array_push($db_theme_ids, $db_theme['id']); 51 } 52 53 $active_themes = array(); 54 $inactive_themes = array(); 55 56 foreach ($themes->fs_themes as $theme_id => $fs_theme) 57 { 58 if ($theme_id == 'default') 12 59 { 13 $content_file = file_get_contents($edited_file); 60 continue; 61 } 62 63 if (in_array($theme_id, $db_theme_ids)) 64 { 65 if ($theme_id == $default_theme) 66 { 67 array_unshift($active_themes, $fs_theme); 68 } 69 else 70 { 71 array_push($active_themes, $fs_theme); 72 } 14 73 } 15 74 else 16 75 { 17 $content_file = "/* " . l10n('locfiledit_newfile') . " */\n\n";76 array_push($inactive_themes, $fs_theme); 18 77 } 19 78 } 20 79 21 $selected = 0; 22 $options[] = l10n('locfiledit_choose_file'); 23 $options[] = '----------------------'; 24 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "css/rules.css"; 25 $options[$value] = 'local / css / rules.css'; 26 if ($edited_file == $value) $selected = $value; 27 $options[] = '----------------------'; 80 $options[] = ''; 81 $options[] = '----- '.l10n('Active Themes').' -----'; 82 $options[] = ''; 83 foreach ($active_themes as $theme) 84 { 85 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css'; 28 86 29 foreach (get_dirs($conf['themes_dir']) as $theme_id) 87 $options[$value] = (file_exists($value) ? '✔' : '✘').' '.$theme['name']; 88 89 if ($default_theme == $theme['id']) 90 { 91 $options[$value].= ' ('.l10n('default').')'; 92 } 93 94 if ($edited_file == $value) 95 { 96 $selected = $value; 97 } 98 } 99 100 $options[] = ''; 101 $options[] = '----- '.l10n('Inactive Themes').' -----'; 102 $options[] = ''; 103 foreach ($inactive_themes as $theme) 30 104 { 31 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme_id.'-rules.css'; 32 $options[$value] = 'local / css / '.$theme_id.'-rules.css'; 105 $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css'; 106 107 $options[$value] = (file_exists($value) ? '✔' : '✘').' '.$theme['name']; 108 33 109 if ($edited_file == $value) 110 { 34 111 $selected = $value; 112 } 35 113 } 36 114 -
branches/2.2/plugins/LocalFilesEditor/template/admin.tpl
r10349 r11361 53 53 54 54 {if isset ($css_lang_tpl)} 55 {html_options name=file_to_edit options=$css_lang_tpl.OPTIONS selected=$css_lang_tpl.SELECTED} 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} 59 </select> 60 61 56 62 <input class="submit" type="submit" value="{'locfiledit_edit'|@translate}" name="edit" /> 57 63 <br><br>
Note: See TracChangeset
for help on using the changeset viewer.