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 * 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')) {
45 setThisExtensionVersion('0.1.1');
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(array('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'));
50 switch (getExtensionMode()) {
51 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52 // SQL commands to run
55 case 'remove': // Do stuff when removing extension
57 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`");
60 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='theme'");
62 // Delete guest menu entries
63 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='themes'");
65 // Delete member menu entries
66 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='themes' OR `what`='themes'");
69 unregisterFilter('init', 'HANDLE_THEME_CHANGE', true, getExtensionDryRun());
70 unregisterFilter('member_login_check', 'SET_USERS_THEME', true, getExtensionDryRun());
73 case 'activate': // Do stuff when admin activates this extension
74 // SQL commands to run
78 case 'deactivate': // Do stuff when admin deactivates this extension
79 // SQL commands to run
83 case 'update': // Update an extension
84 switch (getCurrentExtensionVersion()) {
85 case '0.0.1': // SQL queries for v0.0.1
86 // Update notes (these will be set as task text!)
87 setExtensionUpdateNotes("HTML-Code für ein Zeilen-Template ausgelagert.");
90 case '0.0.2': // SQL queries for v0.0.2
91 // Update notes (these will be set as task text!)
92 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
95 case '0.0.3': // SQL queries for v0.0.3
96 // Update notes (these will be set as task text!)
97 setExtensionUpdateNotes("Im Menüpunkt "Prüfen" wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.");
100 case '0.0.4': // SQL queries for v0.0.4
101 // Update notes (these will be set as task text!)
102 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
105 case '0.0.5': // SQL queries for v0.0.5
106 // Update notes (these will be set as task text!)
107 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
110 case '0.0.6': // SQL queries for v0.0.6
111 // Update notes (these will be set as task text!)
112 setExtensionUpdateNotes("Variablen-Handling scripteweit geändert.");
115 case '0.0.7': // SQL queries for v0.0.7
116 // Update notes (these will be set as task text!)
117 setExtensionUpdateNotes("Ungültiges Update.");
120 case '0.0.8': // SQL queries for v0.0.8
122 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`");
123 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_themes` (
124 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
125 `theme_path` VARCHAR(255) NOT NULL DEFAULT '',
126 `theme_name` VARCHAR(255) NOT NULL DEFAULT '',
127 `theme_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
128 `theme_ver` VARCHAR(255) NOT NULL DEFAULT '0.0',
130 UNIQUE KEY (`theme_path`),
131 INDEX (`theme_active`)
132 ) TYPE={?_TABLE_TYPE?} COMMENT='Themes'");
135 addAdminMenuSql('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres {?mt_word2?}.', 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 Standart-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);
138 addAdminMenuSql('theme','theme_check','Prüfen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3);
141 addGuestMenuSql('themes',NULL,'Design-Auswahl','Y','N',4);
144 addMemberMenuSql('themes',NULL,'Design-Auswahl','N','Y',3);
145 addMemberMenuSql('main','themes','Designs','N','Y',6);
146 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=8 WHERE `action`='themes' LIMIT 1");
147 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=1, `title`='Designs' WHERE `what`='themes' LIMIT 1");
150 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `curr_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
152 // Update notes (these will be set as task text!)
153 setExtensionUpdateNotes("Update von <u>sql_patches</u> übertragen. (Kann Fehlermeldungen verursacht haben!)");
156 case '0.0.9': // SQL queries for v0.0.9
158 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `default_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
160 // Update notes (these will be set as task text!)
161 setExtensionUpdateNotes("Fehlende Konfiguration hinzugefügt.");
164 case '0.1.0': // SQL queries for v0.1.0
166 registerFilter('init', 'HANDLE_THEME_CHANGE', false, true, getExtensionDryRun());
168 // Update notes (these will be set as task text!)
169 setExtensionUpdateNotes("Ändern des Designs nun im Filter (internes TODO).");
172 case '0.1.1': // SQL queries for v0.1.1
174 registerFilter('member_login_check', 'SET_USERS_THEME', false, true, getExtensionDryRun());
176 // Update notes (these will be set as task text!)
177 setExtensionUpdateNotes("Setzen des Mitgliedes' eigener Design-Auswahl per Filter (internes TODO).");
182 case 'modify': // When the extension got modified
185 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
188 case 'init': // Do stuff when extension is initialized
191 default: // Unknown extension mode
192 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));