************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
-{
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
+
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-global $CurrTheme;
+global $currTheme;
// Check for selected themes
$SEL = 0;
if (!empty($_POST['sel'])) $SEL = SELECTION_COUNT($_POST['sel']);
-if ($SEL > 0)
-{
+if ($SEL > 0) {
$OUT = "";
- foreach ($_POST['sel'] as $id=>$sel)
- {
+ foreach ($_POST['sel'] as $id=>$sel) {
$SQL = "";
// Shall I de-/activate or delete themes?
- if (isset($_POST['status']))
- {
+ if (isset($_POST['status'])) {
// Change status
- if ($_POST['active'][$id] == 'Y')
- {
+ if ($_POST['active'][$id] == 'Y') {
$SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='N' WHERE id='".$id."' LIMIT 1";
- }
- else
- {
+ } else {
$SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
}
$OUT = ADMIN_THEMES_UPDATED;
- }
- elseif (isset($_POST['del']))
- {
+ } elseif (isset($_POST['del'])) {
// Delete themes
$SQL = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_themes WHERE id='".$id."' LIMIT 1";
$OUT = ADMIN_THEMES_DELETED;
// Output generated?
if (empty($OUT)) ADMIN_THEME_NO_OUTPUT;
} elseif (!empty($_GET['default_theme'])) {
- // Save theme
+ // Escape string from input
$POST['default_theme'] = SQL_ESCAPE($_GET['default_theme']);
- set_session("mxchange_theme", $POST['default_theme'], (time() + 60*60*24*365), COOKIE_PATH);
+
+ // Set session
+ set_session("mxchange_theme", $POST['default_theme']);
+
+ // Set it in config and current theme as well
+ $currTheme = $POST['default_theme'];
+ $_CONFIG['default_theme'] = $POST['default_theme'];
+
+ // Save theme
ADMIN_SAVE_SETTINGS($POST);
}
// Is the loaded theme name != current theme name?
$LINK = $unix;
- if ($unix != $CurrTheme) $LINK = "<A href=\"".URL."/modules.php?module=admin&what=theme_edit&default_theme=".$unix."\" title=\"".ADMIN_SET_AS_NEW_THEME."\">".$unix."</A>";
+ if ($unix != $currTheme) $LINK = "<A href=\"".URL."/modules.php?module=admin&what=theme_edit&default_theme=".$unix."\" title=\"".ADMIN_SET_AS_NEW_THEME."\">".$unix."</A>";
// Prepare data for the row template
$content = array(
// Free memory
SQL_FREERESULT($result);
-}
- else
-{
+} else {
// No themes found???
$OUT .= "<TR>
<TD colspan=\"7\" class=\"bottom2\" height=\"60\">