author | Dan |
Sun, 12 Apr 2009 19:24:33 -0400 | |
changeset 899 | df88cedf0995 |
parent 801 | eb8b23f11744 |
child 976 | 50f8eb4f53e1 |
permissions | -rw-r--r-- |
433 | 1 |
<?php |
2 |
||
3 |
/* |
|
4 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
|
801
eb8b23f11744
Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents:
685
diff
changeset
|
5 |
* Version 1.1.6 (Caoineag beta 1) |
536 | 6 |
* Copyright (C) 2006-2008 Dan Fuhry |
433 | 7 |
* |
8 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
12 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
|
13 |
*/ |
|
14 |
||
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
15 |
function page_Admin_ThemeManager($force_no_json = false) |
433 | 16 |
{ |
17 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
18 |
global $lang; |
|
19 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
20 |
{ |
|
21 |
$login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
|
22 |
echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
|
23 |
echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
|
24 |
return; |
|
25 |
} |
|
26 |
||
471
7906fb190fc1
Implemented all security features on theme disabling and ACLs; added clean_key mode to login API to clean unused encryption keys
Dan
parents:
465
diff
changeset
|
27 |
$system_themes =& $template->system_themes; |
433 | 28 |
|
29 |
// Obtain the list of themes (both available and already installed) and the styles available for each |
|
30 |
$dh = @opendir(ENANO_ROOT . '/themes'); |
|
31 |
if ( !$dh ) |
|
32 |
die('Couldn\'t open themes directory'); |
|
33 |
$themes = array(); |
|
34 |
while ( $dr = @readdir($dh) ) |
|
35 |
{ |
|
36 |
if ( $dr == '.' || $dr == '..' ) |
|
37 |
continue; |
|
38 |
if ( !is_dir(ENANO_ROOT . "/themes/$dr") ) |
|
39 |
continue; |
|
40 |
if ( !file_exists(ENANO_ROOT . "/themes/$dr/theme.cfg") || !is_dir(ENANO_ROOT . "/themes/$dr/css") ) |
|
41 |
continue; |
|
42 |
$cdh = @opendir(ENANO_ROOT . "/themes/$dr/css"); |
|
43 |
if ( !$cdh ) |
|
44 |
continue; |
|
45 |
||
46 |
require(ENANO_ROOT . "/themes/$dr/theme.cfg"); |
|
47 |
global $theme; |
|
48 |
||
49 |
$themes[$dr] = array( |
|
50 |
'css' => array(), |
|
51 |
'theme_name' => $theme['theme_name'] |
|
52 |
); |
|
53 |
while ( $cdr = @readdir($cdh) ) |
|
54 |
{ |
|
55 |
if ( $cdr == '.' || $cdr == '..' ) |
|
56 |
continue; |
|
57 |
if ( preg_match('/\.css$/i', $cdr) ) |
|
58 |
$themes[$dr]['css'][] = substr($cdr, 0, -4); |
|
59 |
} |
|
60 |
} |
|
61 |
||
62 |
// Decide which themes are not installed |
|
63 |
$installable = array_flip(array_keys($themes)); |
|
64 |
// FIXME: sanitize directory names or check with preg_match() |
|
65 |
$where_clause = 'theme_id = \'' . implode('\' OR theme_id = \'', array_flip($installable)) . '\''; |
|
66 |
$q = $db->sql_query('SELECT theme_id, theme_name, enabled FROM ' . table_prefix . "themes WHERE $where_clause;"); |
|
67 |
if ( !$q ) |
|
68 |
$db->_die(); |
|
69 |
||
70 |
while ( $row = $db->fetchrow() ) |
|
71 |
{ |
|
72 |
$tid =& $row['theme_id']; |
|
73 |
unset($installable[$tid]); |
|
74 |
$themes[$tid]['theme_name'] = $row['theme_name']; |
|
75 |
$themes[$tid]['enabled'] = ( $row['enabled'] == 1 ); |
|
76 |
} |
|
77 |
||
78 |
foreach ( $system_themes as $st ) |
|
79 |
{ |
|
80 |
unset($installable[$st]); |
|
81 |
} |
|
82 |
||
83 |
$installable = array_flip($installable); |
|
84 |
||
85 |
// AJAX code |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
86 |
if ( $paths->getParam(0) === 'action.json' && !$force_no_json ) |
433 | 87 |
{ |
88 |
return ajaxServlet_Admin_ThemeManager($themes); |
|
89 |
} |
|
90 |
||
91 |
// List installed themes |
|
92 |
?> |
|
93 |
<div style="float: right;"> |
|
94 |
<a href="#" id="systheme_toggler" onclick="ajaxToggleSystemThemes(); return false;"><?php echo $lang->get('acptm_btn_system_themes_show'); ?></a> |
|
95 |
</div> |
|
96 |
<?php |
|
97 |
echo '<h3>' . $lang->get('acptm_heading_edit_themes') . '</h3>'; |
|
98 |
echo '<div id="theme_list_edit">'; |
|
99 |
foreach ( $themes as $theme_id => $theme_data ) |
|
100 |
{ |
|
101 |
if ( in_array($theme_id, $installable) ) |
|
102 |
continue; |
|
103 |
if ( file_exists(ENANO_ROOT . "/themes/$theme_id/preview.png") ) |
|
104 |
{ |
|
105 |
$preview_path = scriptPath . "/themes/$theme_id/preview.png"; |
|
106 |
} |
|
107 |
else |
|
108 |
{ |
|
109 |
$preview_path = scriptPath . "/images/themepreview.png"; |
|
110 |
} |
|
111 |
$d = ( @$theme_data['enabled'] ) ? '' : ' themebutton_theme_disabled'; |
|
112 |
$st = ( in_array($theme_id, $system_themes) ) ? ' themebutton_theme_system' : ''; |
|
113 |
echo '<div class="themebutton' . $st . '' . $d . '" id="themebtn_edit_' . $theme_id . '" style="background-image: url(' . $preview_path . ');">'; |
|
114 |
if ( in_array($theme_id, $system_themes) ) |
|
115 |
{ |
|
116 |
echo '<a class="tb-inner" href="#" onclick="return false;"> |
|
117 |
' . $lang->get('acptm_btn_theme_system') . ' |
|
118 |
<span class="themename">' . htmlspecialchars($theme_data['theme_name']) . '</span> |
|
119 |
</a>'; |
|
120 |
} |
|
121 |
else |
|
122 |
{ |
|
123 |
echo '<a class="tb-inner" href="#" onclick="ajaxEditTheme(\'' . $theme_id . '\'); return false;"> |
|
124 |
' . $lang->get('acptm_btn_theme_edit') . ' |
|
125 |
<span class="themename">' . htmlspecialchars($theme_data['theme_name']) . '</span> |
|
126 |
</a>'; |
|
127 |
} |
|
128 |
echo '</div>'; |
|
129 |
} |
|
130 |
echo '</div>'; |
|
131 |
echo '<span class="menuclear"></span>'; |
|
132 |
||
133 |
if ( count($installable) > 0 ) |
|
134 |
{ |
|
135 |
echo '<h3>' . $lang->get('acptm_heading_install_themes') . '</h3>'; |
|
136 |
||
137 |
echo '<div id="theme_list_install">'; |
|
138 |
foreach ( $installable as $i => $theme_id ) |
|
139 |
{ |
|
140 |
if ( file_exists(ENANO_ROOT . "/themes/$theme_id/preview.png") ) |
|
141 |
{ |
|
142 |
$preview_path = scriptPath . "/themes/$theme_id/preview.png"; |
|
143 |
} |
|
144 |
else |
|
145 |
{ |
|
146 |
$preview_path = scriptPath . "/images/themepreview.png"; |
|
147 |
} |
|
148 |
echo '<div class="themebutton" id="themebtn_install_' . $theme_id . '" enano:themename="' . htmlspecialchars($themes[$theme_id]['theme_name']) . '" style="background-image: url(' . $preview_path . ');">'; |
|
149 |
echo '<a class="tb-inner" href="#" onclick="ajaxInstallTheme(\'' . $theme_id . '\'); return false;"> |
|
150 |
' . $lang->get('acptm_btn_theme_install') . ' |
|
151 |
<span class="themename">' . htmlspecialchars($themes[$theme_id]['theme_name']) . '</span> |
|
152 |
</a>'; |
|
153 |
echo '</div>'; |
|
154 |
} |
|
155 |
echo '</div>'; |
|
156 |
echo '<span class="menuclear"></span>'; |
|
157 |
} |
|
158 |
} |
|
159 |
||
160 |
function ajaxServlet_Admin_ThemeManager(&$themes) |
|
161 |
{ |
|
162 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
163 |
global $lang; |
|
164 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
165 |
{ |
|
166 |
$login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
|
167 |
echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
|
168 |
echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
|
169 |
return; |
|
170 |
} |
|
171 |
||
172 |
if ( !isset($_POST['r']) ) |
|
173 |
return false; |
|
174 |
||
175 |
try |
|
176 |
{ |
|
177 |
$request = enano_json_decode($_POST['r']); |
|
178 |
} |
|
179 |
catch ( Exception $e ) |
|
180 |
{ |
|
181 |
die('Exception in JSON parser, probably invalid input.'); |
|
182 |
} |
|
183 |
||
184 |
if ( !isset($request['mode']) ) |
|
185 |
{ |
|
186 |
die('No mode specified in JSON request.'); |
|
187 |
} |
|
188 |
||
189 |
switch ( $request['mode'] ) |
|
190 |
{ |
|
191 |
case 'fetch_theme': |
|
192 |
$theme_id = $db->escape($request['theme_id']); |
|
193 |
if ( empty($theme_id) ) |
|
194 |
die('Invalid theme_id'); |
|
195 |
||
196 |
$q = $db->sql_query("SELECT theme_id, theme_name, default_style, enabled, group_policy, group_list FROM " . table_prefix . "themes WHERE theme_id = '$theme_id';"); |
|
197 |
if ( !$q ) |
|
198 |
$db->die_json(); |
|
199 |
||
200 |
if ( $db->numrows() < 1 ) |
|
201 |
die('BUG: no theme with that theme_id installed.'); |
|
202 |
||
203 |
$row = $db->fetchrow(); |
|
204 |
$row['enabled'] = ( $row['enabled'] == 1 ); |
|
205 |
$row['css'] = @$themes[$theme_id]['css']; |
|
206 |
$row['default_style'] = preg_replace('/\.css$/', '', $row['default_style']); |
|
207 |
$row['is_default'] = ( getConfig('theme_default') === $theme_id ); |
|
208 |
$row['group_list'] = ( empty($row['group_list']) ) ? array() : enano_json_decode($row['group_list']); |
|
209 |
||
210 |
// Build a list of group names |
|
211 |
$row['group_names'] = array(); |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
212 |
$q = $db->sql_query('SELECT group_id, group_name FROM ' . table_prefix . 'groups;'); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
213 |
if ( !$q ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
214 |
$db->die_json(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
215 |
while ( $gr = $db->fetchrow() ) |
433 | 216 |
{ |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
217 |
$row['group_names'][ intval($gr['group_id']) ] = $gr['group_name']; |
433 | 218 |
} |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
219 |
$db->free_result(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
220 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
221 |
// Build a list of usernames |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
222 |
$row['usernames'] = array(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
223 |
foreach ( $row['group_list'] as $el ) |
433 | 224 |
{ |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
225 |
if ( !preg_match('/^u:([0-9]+)$/', $el, $match) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
226 |
continue; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
227 |
$uid =& $match[1]; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
228 |
$q = $db->sql_query('SELECT username FROM ' . table_prefix . "users WHERE user_id = $uid;"); |
433 | 229 |
if ( !$q ) |
230 |
$db->die_json(); |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
231 |
if ( $db->numrows() < 1 ) |
433 | 232 |
{ |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
233 |
$db->free_result(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
234 |
continue; |
433 | 235 |
} |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
236 |
list($username) = $db->fetchrow_num(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
237 |
$row['usernames'][$uid] = $username; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
238 |
$db->free_result(); |
433 | 239 |
} |
240 |
||
241 |
echo enano_json_encode($row); |
|
242 |
break; |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
243 |
case 'uid_lookup': |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
244 |
$username = @$request['username']; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
245 |
if ( empty($username) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
246 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
247 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
248 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
249 |
'error' => $lang->get('acptm_err_invalid_username') |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
250 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
251 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
252 |
$username = $db->escape(strtolower($username)); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
253 |
$q = $db->sql_query('SELECT user_id, username FROM ' . table_prefix . "users WHERE " . ENANO_SQLFUNC_LOWERCASE . "(username) = '$username';"); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
254 |
if ( !$q ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
255 |
$db->die_json(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
256 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
257 |
if ( $db->numrows() < 1 ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
258 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
259 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
260 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
261 |
'error' => $lang->get('acptm_err_username_not_found') |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
262 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
263 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
264 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
265 |
list($uid, $username_real) = $db->fetchrow_num(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
266 |
$db->free_result(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
267 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
268 |
echo enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
269 |
'uid' => $uid, |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
270 |
'username' => $username_real |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
271 |
)); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
272 |
break; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
273 |
case 'save_theme': |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
274 |
if ( !isset($request['theme_data']) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
275 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
276 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
277 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
278 |
'error' => 'No theme data in request' |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
279 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
280 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
281 |
$theme_data =& $request['theme_data']; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
282 |
// Perform integrity check on theme data |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
283 |
$chk_theme_exists = isset($themes[@$theme_data['theme_id']]); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
284 |
$theme_data['theme_name'] = trim(@$theme_data['theme_name']); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
285 |
$chk_name_good = !empty($theme_data['theme_name']); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
286 |
$chk_policy_good = in_array(@$theme_data['group_policy'], array('allow_all', 'whitelist', 'blacklist')); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
287 |
$chk_grouplist_good = true; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
288 |
foreach ( $theme_data['group_list'] as $acl_entry ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
289 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
290 |
if ( !preg_match('/^(u|g):[0-9]+$/', $acl_entry) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
291 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
292 |
$chk_grouplist_good = false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
293 |
break; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
294 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
295 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
296 |
$chk_style_good = @in_array(@$theme_data['default_style'], @$themes[@$theme_data['theme_id']]['css']); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
297 |
if ( !$chk_theme_exists || !$chk_name_good || !$chk_policy_good || !$chk_grouplist_good || !$chk_style_good ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
298 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
299 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
300 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
301 |
'error' => $lang->get('acptm_err_save_validation_failed') |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
302 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
303 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
304 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
305 |
$enable = ( $theme_data['enabled'] ) ? '1' : '0'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
306 |
$theme_default = getConfig('theme_default'); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
307 |
$warn_default = ( $theme_default === $theme_data['theme_id'] || $theme_data['make_default'] ) ? |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
308 |
' ' . $lang->get('acptm_warn_access_with_default') . ' ' : |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
309 |
' '; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
310 |
if ( $enable == 0 && ( $theme_default === $theme_data['theme_id'] || $theme_data['make_default'] ) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
311 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
312 |
$enable = '1'; |
471
7906fb190fc1
Implemented all security features on theme disabling and ACLs; added clean_key mode to login API to clean unused encryption keys
Dan
parents:
465
diff
changeset
|
313 |
$warn_default .= '<b>' . $lang->get('acptm_warn_cant_disable_default') . '</b>'; |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
314 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
315 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
316 |
// We're good. Update the theme... |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
317 |
$q = $db->sql_query('UPDATE ' . table_prefix . 'themes SET |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
318 |
theme_name = \'' . $db->escape($theme_data['theme_name']) . '\', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
319 |
default_style = \'' . $db->escape($theme_data['default_style']) . '\', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
320 |
group_list = \'' . $db->escape(enano_json_encode($theme_data['group_list'])) . '\', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
321 |
group_policy = \'' . $db->escape($theme_data['group_policy']) . '\', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
322 |
enabled = ' . $enable . ' |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
323 |
WHERE theme_id = \'' . $db->escape($theme_data['theme_id']) . '\';'); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
324 |
if ( !$q ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
325 |
$db->die_json(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
326 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
327 |
if ( $theme_data['make_default'] ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
328 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
329 |
setConfig('theme_default', $theme_data['theme_id']); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
330 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
331 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
332 |
echo '<div class="info-box"><b>' . $lang->get('acptm_msg_save_success') . '</b>' . $warn_default . '</div>'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
333 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
334 |
page_Admin_ThemeManager(true); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
335 |
break; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
336 |
case 'install': |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
337 |
$theme_id =& $request['theme_id']; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
338 |
if ( !isset($themes[$theme_id]) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
339 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
340 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
341 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
342 |
'error' => 'Theme was deleted from themes/ directory or couldn\'t read theme metadata from filesystem' |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
343 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
344 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
345 |
if ( !isset($themes[$theme_id]['css'][0]) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
346 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
347 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
348 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
349 |
'error' => 'Theme doesn\'t have any files in css/, thus it can\'t be installed. (translators: l10n?)' |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
350 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
351 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
352 |
// build dataset |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
353 |
$theme_name = $db->escape($themes[$theme_id]['theme_name']); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
354 |
$default_style = $db->escape($themes[$theme_id]['css'][0]); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
355 |
$theme_id = $db->escape($theme_id); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
356 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
357 |
// insert it |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
358 |
$q = $db->sql_query('INSERT INTO ' . table_prefix . "themes(theme_id, theme_name, default_style, enabled, group_list, group_policy)\n" |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
359 |
. " VALUES( '$theme_id', '$theme_name', '$default_style', 1, '[]', 'allow_all' );"); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
360 |
if ( !$q ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
361 |
$db->die_json(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
362 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
363 |
// The response isn't processed unless it's in JSON. |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
364 |
echo 'Roger that, over and out.'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
365 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
366 |
break; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
367 |
case 'uninstall': |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
368 |
$theme_id =& $request['theme_id']; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
369 |
$theme_default = getConfig('theme_default'); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
370 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
371 |
// Validation |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
372 |
if ( !isset($themes[$theme_id]) ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
373 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
374 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
375 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
376 |
'error' => 'Theme was deleted from themes/ directory or couldn\'t read theme metadata from filesystem' |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
377 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
378 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
379 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
380 |
if ( $theme_id == $theme_default ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
381 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
382 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
383 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
384 |
'error' => $lang->get('acptm_err_uninstalling_default') |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
385 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
386 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
387 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
388 |
if ( $theme_id == 'oxygen' ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
389 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
390 |
die(enano_json_encode(array( |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
391 |
'mode' => 'error', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
392 |
'error' => $lang->get('acptm_err_uninstalling_oxygen') |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
393 |
))); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
394 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
395 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
396 |
$theme_id = $db->escape($theme_id); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
397 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
398 |
$q = $db->sql_query('DELETE FROM ' . table_prefix . "themes WHERE theme_id = '$theme_id';"); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
399 |
if ( !$q ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
400 |
$db->die_json(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
401 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
402 |
// Change all the users that were on that theme to the default |
477 | 403 |
$default_style = $template->named_theme_list[$theme_default]['default_style']; |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
404 |
$default_style = preg_replace('/\.css$/', '', $default_style); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
405 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
406 |
$theme_default = $db->escape($theme_default); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
407 |
$default_style = $db->escape($default_style); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
408 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
409 |
$q = $db->sql_query('UPDATE ' . table_prefix . "users SET theme = '$theme_default', style = '$default_style' WHERE theme = '$theme_id';"); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
410 |
if ( !$q ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
411 |
$db->die_json(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
412 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
413 |
echo '<div class="info-box">' . $lang->get('acptm_msg_uninstall_success') . '</div>'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
414 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
415 |
page_Admin_ThemeManager(true); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
433
diff
changeset
|
416 |
break; |
433 | 417 |
} |
418 |
} |
|
419 |