2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 03/22/2004 *
4 * =================== Last change: 06/28/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-theme.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Theme Management *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Theme-Management *
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://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')) {
44 setThisExtensionVersion('0.1.2');
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2'));
49 switch (getExtensionMode()) {
50 case 'register': // Do stuff when installation is running
51 // SQL commands to run
54 case 'remove': // Do stuff when removing extension
56 addDropTableSql('themes');
59 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='theme'");
61 // Delete guest menu entries
62 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='themes'");
64 // Delete member menu entries
65 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='themes' OR `what`='themes'");
68 unregisterFilter(__FUNCTION__, __LINE__, 'init', 'HANDLE_THEME_CHANGE', true, isExtensionDryRun());
69 unregisterFilter(__FUNCTION__, __LINE__, 'member_login_check', 'SET_USERS_THEME', true, isExtensionDryRun());
72 case 'activate': // Do stuff when admin activates this extension
73 // SQL commands to run
74 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `action`='theme' LIMIT 1");
75 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `action`='themes' OR `what`='themes' LIMIT 2");
78 case 'deactivate': // Do stuff when admin deactivates this extension
79 // SQL commands to run
80 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `action`='theme' LIMIT 1");
81 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `action`='themes' OR `what`='themes' LIMIT 2");
84 case 'update': // Update an extension
85 switch (getCurrentExtensionVersion()) {
86 case '0.0.1': // SQL queries for v0.0.1
87 // Update notes (these will be set as task text!)
88 setExtensionUpdateNotes("HTML-Code für ein Zeilen-Template ausgelagert.");
91 case '0.0.2': // SQL queries for v0.0.2
92 // Update notes (these will be set as task text!)
93 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
96 case '0.0.3': // SQL queries for v0.0.3
97 // Update notes (these will be set as task text!)
98 setExtensionUpdateNotes("Im Menüpunkt "Prüfen" wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.");
101 case '0.0.4': // SQL queries for v0.0.4
102 // Update notes (these will be set as task text!)
103 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
106 case '0.0.5': // SQL queries for v0.0.5
107 // Update notes (these will be set as task text!)
108 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
111 case '0.0.6': // SQL queries for v0.0.6
112 // Update notes (these will be set as task text!)
113 setExtensionUpdateNotes("Variablen-Handling scripteweit geändert.");
116 case '0.0.7': // SQL queries for v0.0.7
117 // Update notes (these will be set as task text!)
118 setExtensionUpdateNotes("Ungültiges Update.");
121 case '0.0.8': // SQL queries for v0.0.8
123 addDropTableSql('themes');
124 addCreateTableSql('themes', "
125 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
126 `theme_path` VARCHAR(255) NOT NULL DEFAULT '',
127 `theme_name` VARCHAR(255) NOT NULL DEFAULT '',
128 `theme_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
129 `theme_ver` VARCHAR(255) NOT NULL DEFAULT '0.0.0',
131 UNIQUE (`theme_path`),
132 INDEX (`theme_active`)", 'Themes');
135 addAdminMenuSql('theme', NULL, 'Themes', 'Verwalten Sie hier alle Designs (Themes) Ihres {OPEN_CONFIG}mt_word2{CLOSE_CONFIG}.', 8);
136 addAdminMenuSql('theme', 'theme_import', 'Importieren', 'Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1);
137 addAdminMenuSql('theme', 'theme_edit', 'Modifizieren', 'Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standard-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2);
140 addGuestMenuSql('themes', NULL, 'Design-Auswahl', 4);
143 addMemberMenuSql('themes', NULL, 'Design-Auswahl', 3);
144 addMemberMenuSql('main', 'themes', 'Designs', 6);
145 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=8 WHERE `action`='themes' LIMIT 1");
146 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=1, `title`='Designs' WHERE `what`='themes' LIMIT 1");
149 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `curr_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
151 // Update notes (these will be set as task text!)
152 setExtensionUpdateNotes("Update von <u>sql_patches</u> übertragen. (Kann Fehlermeldungen verursacht haben!)");
155 case '0.0.9': // SQL queries for v0.0.9
157 addConfigAddSql('default_theme', "VARCHAR(255) NOT NULL DEFAULT 'default'");
159 // Update notes (these will be set as task text!)
160 setExtensionUpdateNotes("Fehlende Konfiguration hinzugefügt.");
163 case '0.1.0': // SQL queries for v0.1.0
165 registerFilter('init', 'HANDLE_THEME_CHANGE', false, true, isExtensionDryRun());
167 // Update notes (these will be set as task text!)
168 setExtensionUpdateNotes("Ändern des Designs nun im Filter (internes TODO).");
171 case '0.1.1': // SQL queries for v0.1.1
173 registerFilter('member_login_check', 'SET_USERS_THEME', false, true, isExtensionDryRun());
175 // Update notes (these will be set as task text!)
176 setExtensionUpdateNotes("Setzen des Mitgliedes' eigener Design-Auswahl per Filter (internes TODO).");
179 case '0.1.2': // SQL queries for v0.1.2
180 // Remove deprecated menu
181 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='theme_check' LIMIT 1");
183 // Update notes (these will be set as task text!)
184 setExtensionUpdateNotes("Nicht mehr benötigtes Menü zum Prüfen von Theme-Versionen entfernt.");
189 case 'modify': // When the extension got modified
192 case 'test': // For testing purposes
195 case 'init': // Do stuff when extension is initialized
198 default: // Unknown extension mode
199 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));