2 /************************************************************************
3 * MXChange v0.2.1 Start: 02/12/2004 *
4 * ================ Last change: 02/12/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-theme_edit.php *
8 * -------------------------------------------------------------------- *
9 * Short description : *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
43 } elseif (!EXT_IS_ACTIVE('theme')) {
44 addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('theme'));
48 // Add description as navigation point
49 ADD_DESCR('admin', __FILE__);
51 // Check for selected themes
53 if (REQUEST_ISSET_POST('sel')) $SEL = countPostSelection();
56 foreach (REQUEST_POST('sel') as $id => $sel) {
58 // Shall I de-/activate or delete themes?
59 if (REQUEST_ISSET_POST(('status'))) {
61 if (REQUEST_POST('active', $id) == 'Y') {
62 $sql = "UPDATE `{!_MYSQL_PREFIX!}_themes` SET theme_active='N' WHERE `id`='".$id."' LIMIT 1";
64 $sql = "UPDATE `{!_MYSQL_PREFIX!}_themes` SET theme_active='Y' WHERE `id`='".$id."' LIMIT 1";
66 $OUT = getMessage('ADMIN_THEMES_UPDATED');
67 } elseif (REQUEST_ISSET_POST('del')) {
69 $sql = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_themes` WHERE `id`='".$id."' LIMIT 1";
70 $OUT = getMessage('ADMIN_THEMES_DELETED');
76 $result = SQL_QUERY($sql, __FILE__, __LINE__);
79 rebuildCacheFiles("themes", "them");
84 if (empty($OUT)) $OUT = getMessage('ADMIN_THEME_NO_OUTPUT');
85 } elseif (REQUEST_ISSET_GET(('default_theme'))) {
86 // Escape string from input
87 $POST['default_theme'] = REQUEST_GET(('default_theme'));
90 setSession('mxchange_theme', $POST['default_theme']);
92 // Set it in config and current theme as well
93 $GLOBALS['curr_theme'] = $POST['default_theme'];
94 setConfigEntry('default_theme', $POST['default_theme']);
97 ADMIN_SAVE_SETTINGS($POST);
100 // Switch to testing mode
101 $GLOBALS['theme_mode'] = 'test';
103 // Generate output lines for the template
105 $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `{!_MYSQL_PREFIX!}_themes` ORDER BY theme_path", __FILE__, __LINE__);
106 if (SQL_NUMROWS($result) > 0) {
107 while ($content = SQL_FETCHARRAY($result)) {
109 $INC = sprintf("theme/%s/theme.php", $content['theme_path']);
111 // Load theme in test mode
114 // Is the loaded theme name != current theme name?
115 $LINK = $content['theme_path'];
116 if ($content['theme_path'] != getCurrentTheme()) $LINK = "<a href=\"{!URL!}/modules.php?module=admin&what=theme_edit&default_theme=".$content['theme_path']."\" title=\"{--ADMIN_SET_AS_NEW_THEME--}\">".$content['theme_path']."</a>";
118 // Prepare data for the row template
121 'id' => $content['id'],
122 'active' => $content['theme_active'],
124 'name' => $content['theme_name'],
125 'is_act' => translateYesNo($content['theme_active']),
126 'email' => "<a href=\"mailto:".$GLOBALS['theme_data']['email']."?Subject=[Theme:] ".$GLOBALS['theme_data']['name']." (".$content['theme_path'].")'.'\">".$GLOBALS['theme_data']['author']."</a>",
127 'url_link' => DEREFERER($GLOBALS['theme_data']['url']),
128 'url_title' => $GLOBALS['theme_data']['url'],
129 'ver' => $content['theme_ver'],
132 // Load row template and switch color
133 $OUT .= LOAD_TEMPLATE("admin_theme_edit_row", true, $content);
138 SQL_FREERESULT($result);
140 // No themes found???
142 <td colspan=\"7\" class=\"bottom2\" height=\"60\">
143 ".LOAD_TEMPLATE('admin_settings_saved', true, getMessage('ADMIN_NO_THEMES_FOUND'))."
148 define('__THEME_LIST', $OUT);
151 LOAD_TEMPLATE("admin_theme_edit");