2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 - 2009 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')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 if (!isExtensionActive('theme')) {
48 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('theme'));
52 // Check for selected themes
53 if (countPostSelection() > 0) {
55 foreach (postRequestParameter('sel') as $id => $sel) {
57 // Shall I de-/activate or delete themes?
58 if (isPostRequestParameterSet(('status'))) {
60 if (postRequestParameter('active', $id) == 'Y') {
61 $sql = "UPDATE `{?_MYSQL_PREFIX?}_themes` SET theme_active='N' WHERE `id`='".$id."' LIMIT 1";
63 $sql = "UPDATE `{?_MYSQL_PREFIX?}_themes` SET theme_active='Y' WHERE `id`='".$id."' LIMIT 1";
65 $OUT = getMessage('ADMIN_THEMES_UPDATED');
66 } elseif (isPostRequestParameterSet('del')) {
68 $sql = "DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_themes` WHERE `id`='".$id."' LIMIT 1";
69 $OUT = getMessage('ADMIN_THEMES_DELETED');
75 $result = SQL_QUERY($sql, __FILE__, __LINE__);
78 rebuildCache('themes', 'them');
83 if (empty($OUT)) $OUT = getMessage('ADMIN_THEME_NO_OUTPUT');
84 } elseif (isGetRequestParameterSet('default_theme')) {
85 // Escape string from input
86 $postData['default_theme'] = getRequestParameter('default_theme');
89 setTheme($postData['default_theme']);
91 // Set it in config and current theme as well
92 setConfigEntry('default_theme', $postData['default_theme']);
95 adminSaveSettings($postData);
101 // Switch to testing mode
102 $GLOBALS['theme_mode'] = 'test';
104 $result = SQL_QUERY("SELECT
111 `{?_MYSQL_PREFIX?}_themes`
113 `theme_path` ASC", __FILE__, __LINE__);
115 if (SQL_NUMROWS($result) > 0) {
118 while ($content = SQL_FETCHARRAY($result)) {
120 $inc = sprintf("theme/%s/theme.php", $content['theme_path']);
122 // Load theme in test mode
125 // Is the loaded theme name != current theme name?
126 $LINK = $content['theme_path'];
127 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>';
129 // Prepare data for the row template
132 'id' => $content['id'],
133 'active' => $content['theme_active'],
135 'name' => $content['theme_name'],
136 'is_act' => translateYesNo($content['theme_active']),
137 'email' => '<a href="mailto:' . $GLOBALS['theme_data']['email'] . '?Subject=[Theme:] ' . $GLOBALS['theme_data']['name'] . ' (' . $content['theme_path'] . ')\>' . $GLOBALS['theme_data']['author'] . '</a>',
138 'url_link' => generateDerefererUrl($GLOBALS['theme_data']['url']),
139 'url_title' => $GLOBALS['theme_data']['url'],
140 'ver' => $content['theme_ver'],
143 // Load row template and switch color
144 $OUT .= loadTemplate('admin_theme_edit_row', true, $content);
149 SQL_FREERESULT($result);
151 // No themes found???
153 <td colspan=\"7\" class=\"bottom\" height=\"60\">
154 ".loadTemplate('admin_settings_saved', true, getMessage('ADMIN_NO_THEMES_FOUND'))."
160 loadTemplate('admin_theme_edit', false, $OUT);