2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 03/20/2005 *
4 * =================== Last change: 03/20/2005 *
6 * -------------------------------------------------------------------- *
7 * File : what-themes.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Theme selection for members *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Design-Auswahl fuer Mitglieder *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
41 } elseif (!isMember()) {
42 redirectToIndexMemberOnlyModule();
45 // Add description as navigation point
46 addYouAreHereLink('member', __FILE__);
48 if ((!isExtensionActive('theme')) && (!isAdmin())) {
49 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=theme%}');
53 if (isPostRequestElementSet('member_theme')) {
54 // Save theme to member's profile
55 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `curr_theme`='%s' WHERE `userid`=%s LIMIT 1",
57 postRequestElement('member_theme'),
59 ), __FILE__, __LINE__);
61 // Set new theme for guests
62 $newTheme = SQL_ESCAPE(postRequestElement('member_theme'));
64 // Change to new theme
68 displayMessage('{--MEMBER_THEME_SAVED--}');
73 'theme_unix' => array(), // Unix name from filesystem
74 'theme_name' => array(), // Title
75 'theme_author' => array(), // Theme author's name
76 'theme_email' => array(), // Author's email address
77 'theme_url' => array(), // URL were you can download it from
78 'theme_version' => array(), // Version number of theme
81 // Read directory "themes"
82 $includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images'));
84 // Walk through all entries and add it
85 foreach ($includes as $inc) {
86 // Get directory from it
87 $dir = basename(dirname($inc));
89 // Is the theme active, then include it
90 if (isThemeActive($dir)) {
91 // Found a valid directory so let's load it's theme.php file
94 // Add found theme to array
95 $themes['theme_unix'][] = $dir;
96 $themes['theme_name'][] = $GLOBALS['theme_data']['name'];
97 $themes['theme_author'][] = $GLOBALS['theme_data']['author'];
98 $themes['theme_email'][] = $GLOBALS['theme_data']['email'];
99 $themes['theme_url'][] = $GLOBALS['theme_data']['url'];
100 $themes['theme_version'][] = $GLOBALS['theme_data']['version'];
104 // Remove last theme data
105 unset($GLOBALS['theme_data']);
107 // Sort array by Uni* name
108 array_pk_sort($themes, array('theme_name'));
110 // Generate output lines for the template
112 foreach ($themes['theme_unix'] as $key => $unix) {
114 if (getCurrentTheme() == $unix) {
115 $default = ' checked="checked"';
121 'default' => $default,
122 'theme_name' => $themes['theme_name'][$key],
123 'theme_email' => $themes['theme_email'][$key],
124 'theme_author' => $themes['theme_author'][$key],
125 'theme_url' => $themes['theme_url'][$key],
126 'theme_version' => $themes['theme_version'][$key]
130 $OUT .= loadTemplate('member_themes_row', true, $content);
134 // No themes found???
136 <td colspan="5" class="bottom" height="80">
137 ' . displayMessage('{--MEMBER_NO_THEMES_FOUND--}', true) . '
143 loadTemplate('member_themes', false, $OUT);