- Timestamp:
- Feb 12, 2013, 11:01:46 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ?>
Note: See TracChangeset
for help on using the changeset viewer.