1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) |
---|
6 | { |
---|
7 | $edited_file = $_POST['file_to_edit']; |
---|
8 | } |
---|
9 | elseif (isset($_POST['edited_file'])) |
---|
10 | { |
---|
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'; |
---|
16 | } |
---|
17 | else |
---|
18 | { |
---|
19 | $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.get_default_theme().'-rules.css'; |
---|
20 | } |
---|
21 | |
---|
22 | if (file_exists($edited_file)) |
---|
23 | { |
---|
24 | $content_file = file_get_contents($edited_file); |
---|
25 | } |
---|
26 | else |
---|
27 | { |
---|
28 | $content_file = "/* " . l10n('locfiledit_newfile') . " */\n\n"; |
---|
29 | } |
---|
30 | |
---|
31 | $selected = 0; |
---|
32 | // $options[] = l10n('locfiledit_choose_file'); |
---|
33 | // $options[] = '----------------------'; |
---|
34 | $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "css/rules.css"; |
---|
35 | |
---|
36 | $options[$value] = (file_exists($value) ? '✔' : '✘').' local / css / rules.css'; |
---|
37 | if ($edited_file == $value) |
---|
38 | { |
---|
39 | $selected = $value; |
---|
40 | } |
---|
41 | |
---|
42 | // themes are displayed in the same order as on screen |
---|
43 | // [Administration > Configuration > Themes] |
---|
44 | |
---|
45 | include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); |
---|
46 | $themes = new themes(); |
---|
47 | $themes->sort_fs_themes(); |
---|
48 | $default_theme = get_default_theme(); |
---|
49 | $db_themes = $themes->get_db_themes(); |
---|
50 | |
---|
51 | $db_theme_ids = array(); |
---|
52 | foreach ($db_themes as $db_theme) |
---|
53 | { |
---|
54 | array_push($db_theme_ids, $db_theme['id']); |
---|
55 | } |
---|
56 | |
---|
57 | $active_themes = array(); |
---|
58 | $inactive_themes = array(); |
---|
59 | |
---|
60 | foreach ($themes->fs_themes as $theme_id => $fs_theme) |
---|
61 | { |
---|
62 | if ($theme_id == 'default') |
---|
63 | { |
---|
64 | continue; |
---|
65 | } |
---|
66 | |
---|
67 | if (in_array($theme_id, $db_theme_ids)) |
---|
68 | { |
---|
69 | if ($theme_id == $default_theme) |
---|
70 | { |
---|
71 | array_unshift($active_themes, $fs_theme); |
---|
72 | } |
---|
73 | else |
---|
74 | { |
---|
75 | array_push($active_themes, $fs_theme); |
---|
76 | } |
---|
77 | } |
---|
78 | else |
---|
79 | { |
---|
80 | array_push($inactive_themes, $fs_theme); |
---|
81 | } |
---|
82 | } |
---|
83 | |
---|
84 | $options[] = ''; |
---|
85 | $options[] = '----- '.l10n('Active Themes').' -----'; |
---|
86 | $options[] = ''; |
---|
87 | foreach ($active_themes as $theme) |
---|
88 | { |
---|
89 | $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css'; |
---|
90 | |
---|
91 | $options[$value] = (file_exists($value) ? '✔' : '✘').' '.$theme['name']; |
---|
92 | |
---|
93 | if ($default_theme == $theme['id']) |
---|
94 | { |
---|
95 | $options[$value].= ' ('.l10n('default').')'; |
---|
96 | } |
---|
97 | |
---|
98 | if ($edited_file == $value) |
---|
99 | { |
---|
100 | $selected = $value; |
---|
101 | } |
---|
102 | } |
---|
103 | |
---|
104 | $options[] = ''; |
---|
105 | $options[] = '----- '.l10n('Inactive Themes').' -----'; |
---|
106 | $options[] = ''; |
---|
107 | foreach ($inactive_themes as $theme) |
---|
108 | { |
---|
109 | $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css'; |
---|
110 | |
---|
111 | $options[$value] = (file_exists($value) ? '✔' : '✘').' '.$theme['name']; |
---|
112 | |
---|
113 | if ($edited_file == $value) |
---|
114 | { |
---|
115 | $selected = $value; |
---|
116 | } |
---|
117 | } |
---|
118 | |
---|
119 | $template->assign('css_lang_tpl', array( |
---|
120 | 'OPTIONS' => $options, |
---|
121 | 'SELECTED' => $selected |
---|
122 | ) |
---|
123 | ); |
---|
124 | |
---|
125 | $codemirror_mode = 'text/css'; |
---|
126 | |
---|
127 | ?> |
---|