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 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
48 if (!isExtensionActive('theme')) {
49 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('theme'));
53 // Check for selected themes
54 if (ifPostContainsSelections()) {
56 foreach (postRequestParameter('sel') as $id => $sel) {
58 // Shall I de-/activate or delete themes?
59 if (isPostRequestParameterSet(('status'))) {
61 if (postRequestParameter('active', $id) == 'Y') {
62 $sql = "UPDATE `{?_MYSQL_PREFIX?}_themes` SET `theme_active`='N' WHERE `id`=%s LIMIT 1";
64 $sql = "UPDATE `{?_MYSQL_PREFIX?}_themes` SET `theme_active`='Y' WHERE `id`=%s LIMIT 1";
66 $OUT = '{--ADMIN_THEMES_UPDATED--}';
67 } elseif (isFormSent('del')) {
69 $sql = "DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_themes` WHERE `id`=%s LIMIT 1";
70 $OUT = '{--ADMIN_THEMES_DELETED--}';
76 $result = SQL_QUERY_ESC($sql, array(bigintval($id)), __FILE__, __LINE__);
79 rebuildCache('themes', 'them');
84 if (empty($OUT)) $OUT = '{--ADMIN_THEME_NO_OUTPUT--}';
85 } elseif (isGetRequestParameterSet('default_theme')) {
86 // Escape string from input
87 $postData['default_theme'] = getRequestParameter('default_theme');
90 setTheme($postData['default_theme']);
92 // Set it in config and current theme as well
93 setConfigEntry('default_theme', $postData['default_theme']);
96 adminSaveSettings($postData);
102 // Switch to testing mode
103 $GLOBALS['theme_mode'] = 'test';
105 $result = SQL_QUERY("SELECT
112 `{?_MYSQL_PREFIX?}_themes`
114 `theme_path` ASC", __FILE__, __LINE__);
116 if (!SQL_HASZERONUMS($result)) {
117 while ($content = SQL_FETCHARRAY($result)) {
119 $inc = sprintf("theme/%s/theme.php", $content['theme_path']);
121 // Load theme in test mode
124 // Is the loaded theme name != current theme name?
125 $LINK = $content['theme_path'];
126 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>';
128 // Prepare data for the row template
130 'id' => $content['id'],
132 'theme_name' => $content['theme_name'],
133 'theme_active' => $content['theme_active'],
134 'email' => '<a href="mailto:' . $GLOBALS['theme_data']['email'] . '?Subject=[Theme:] ' . $GLOBALS['theme_data']['name'] . ' (' . $content['theme_path'] . ')\>' . $GLOBALS['theme_data']['author'] . '</a>',
135 'url' => $GLOBALS['theme_data']['url'],
136 'theme_version' => $content['theme_version'],
139 // Load row template and switch color
140 $OUT .= loadTemplate('admin_theme_edit_row', true, $content);
144 SQL_FREERESULT($result);
146 // No themes found???
148 <td colspan="7" class="bottom" height="60">
149 ' . loadTemplate('admin_settings_saved', true, '{--ADMIN_NO_THEMES_FOUND--}') . '
155 loadTemplate('admin_theme_edit', false, $OUT);