2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 02/12/2004 *
\r
4 * ================ Last change: 02/12/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-theme_edit.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
45 // Check for selected themes
\r
47 if (!empty($_POST['sel'])) $SEL = SELECTION_COUNT($_POST['sel']);
\r
51 foreach ($_POST['sel'] as $id=>$sel)
\r
54 // Shall I de-/activate or delete themes?
\r
55 if (isset($_POST['status']))
\r
58 if ($_POST['active'][$id] == "Y")
\r
60 $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='N' WHERE id='".$id."' LIMIT 1";
\r
64 $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
\r
66 $OUT = ADMIN_THEMES_UPDATED;
\r
68 elseif (isset($_POST['del']))
\r
71 $SQL = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_themes WHERE id='".$id."' LIMIT 1";
\r
72 $OUT = ADMIN_THEMES_DELETED;
\r
76 if (!empty($SQL)) $result = SQL_QUERY($SQL, __FILE__, __LINE__);
\r
79 // Output generated?
\r
80 if (empty($OUT)) ADMIN_THEME_NO_OUTPUT;
\r
82 elseif (!empty($_GET['default_theme']))
\r
85 $POST['default_theme'] = $_GET['default_theme'];
\r
86 @setcookie("mxchange_theme", $POST['default_theme'], (time() + 60*60*24*365), COOKIE_PATH);
\r
87 $_COOKIE['mxchange_theme'] = $POST['default_theme'];
\r
88 ADMIN_SAVE_SETTINGS($POST, "_config", "config='0'");
\r
91 // Switch to testing mode
\r
92 $THEME_MODE = "test";
\r
94 // Generate output lines for the template
\r
96 $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver FROM "._MYSQL_PREFIX."_themes ORDER BY theme_path", __FILE__, __LINE__);
\r
97 if (SQL_NUMROWS($result) > 0)
\r
99 while(list($id, $unix, $active, $ver) = SQL_FETCHROW($result))
\r
101 // Load theme in test mode
\r
102 require(PATH."theme/".$unix."/theme.php");
\r
104 // Is the loaded theme name != current theme name?
\r
106 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>";
\r
108 // Prepare data for the row template
\r
112 'active' => $active,
\r
114 'name' => $THEME_NAME,
\r
115 'is_act' => TRANSLATE_YESNO($active),
\r
116 'email' => "<A href=\"mailto:".$THEME_EMAIL."?Subject=[Theme:] ".$THEME_NAME." (".$unix.")"."\">".$THEME_AUTHOR."</A>",
\r
117 'url_link' => DEREFERER($THEME_URL),
\r
118 'url_title' => $THEME_URL,
\r
122 // Load row template and switch color
\r
123 $OUT .= LOAD_TEMPLATE("admin_theme_edit_row", true, $content);
\r
128 SQL_FREERESULT($result);
\r
132 // No themes found???
\r
134 <TD colspan=\"7\" class=\"bottom2\" height=\"60\">
\r
135 ".LOAD_TEMPLATE("admin_settings_saved", true, ADMIN_NO_THEMES_FOUND)."
\r
140 define('__THEME_LIST', $OUT);
\r
143 LOAD_TEMPLATE("admin_theme_edit");
\r