Removed comment introduced by Profi-Concept, this comment should fine (in a much...
[mailer.git] / inc / extensions / ext-theme.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 03/22/2004 *
4  * ===================                          Last change: 06/28/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-theme.php                                    *
8  * -------------------------------------------------------------------- *
9  * Short description : Theme Management                                 *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Theme-Management                                 *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Version number
44 setThisExtensionVersion('0.1.2');
45
46 // Version history array (add more with , '0.1.0' and so on)
47 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', '0.1.2'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
51                 // SQL commands to run
52                 break;
53
54         case 'remove': // Do stuff when removing extension
55                 // Drop theme table
56                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`');
57
58                 // Delete admin menu
59                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='theme'");
60
61                 // Delete guest menu entries
62                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='themes'");
63
64                 // Delete member menu entries
65                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='themes' OR `what`='themes'");
66
67                 // Unregister filters
68                 unregisterFilter(__FUNCTION__, __LINE__, 'init', 'HANDLE_THEME_CHANGE', true, isExtensionDryRun());
69                 unregisterFilter(__FUNCTION__, __LINE__, 'member_login_check', 'SET_USERS_THEME', true, isExtensionDryRun());
70                 break;
71
72         case 'activate': // Do stuff when admin activates this extension
73                 // SQL commands to run
74                 addExtensionSql('');
75                 break;
76
77         case 'deactivate': // Do stuff when admin deactivates this extension
78                 // SQL commands to run
79                 addExtensionSql('');
80                 break;
81
82         case 'update': // Update an extension
83                 switch (getCurrentExtensionVersion()) {
84                         case '0.0.1': // SQL queries for v0.0.1
85                                 // Update notes (these will be set as task text!)
86                                 setExtensionUpdateNotes("HTML-Code f&uuml;r ein Zeilen-Template ausgelagert.");
87                                 break;
88
89                         case '0.0.2': // SQL queries for v0.0.2
90                                 // Update notes (these will be set as task text!)
91                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
92                                 break;
93
94                         case '0.0.3': // SQL queries for v0.0.3
95                                 // Update notes (these will be set as task text!)
96                                 setExtensionUpdateNotes("Im Men&uuml;punkt &quot;Pr&uuml;fen&quot; wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.");
97                                 break;
98
99                         case '0.0.4': // SQL queries for v0.0.4
100                                 // Update notes (these will be set as task text!)
101                                 setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
102                                 break;
103
104                         case '0.0.5': // SQL queries for v0.0.5
105                                 // Update notes (these will be set as task text!)
106                                 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
107                                 break;
108
109                         case '0.0.6': // SQL queries for v0.0.6
110                                 // Update notes (these will be set as task text!)
111                                 setExtensionUpdateNotes("Variablen-Handling scripteweit ge&auml;ndert.");
112                                 break;
113
114                         case '0.0.7': // SQL queries for v0.0.7
115                                 // Update notes (these will be set as task text!)
116                                 setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
117                                 break;
118
119                         case '0.0.8': // SQL queries for v0.0.8
120                                 // Theme table
121                                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`');
122                                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_themes` (
123 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
124 `theme_path` VARCHAR(255) NOT NULL DEFAULT '',
125 `theme_name` VARCHAR(255) NOT NULL DEFAULT '',
126 `theme_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
127 `theme_ver` VARCHAR(255) NOT NULL DEFAULT '0.0',
128 PRIMARY KEY (`id`),
129 UNIQUE KEY (`theme_path`),
130 INDEX (`theme_active`)
131 ) TYPE={?_TABLE_TYPE?} COMMENT='Themes'");
132
133                                 // Admin menu
134                                 addAdminMenuSql('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres {OPEN_CONFIG}mt_word2{CLOSE_CONFIG}.', 8);
135                                 addAdminMenuSql('theme','theme_import','Importieren','Es wird das Verzeichnis &quot;theme&quot; nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1);
136                                 addAdminMenuSql('theme','theme_edit','Modifizieren','&Auml;ndern Sie Titel, Freigaben usw. an den Themes. Sie k&ouml;nnen bis auf das Standart-Theme &quot;default&quot; auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server l&ouml;schen, damit es niht erneut importiert werden kann.', 2);
137
138                                 // Guest menu
139                                 addGuestMenuSql('themes',NULL,'Design-Auswahl','Y','N',4);
140
141                                 // Memember menu
142                                 addMemberMenuSql('themes',NULL,'Design-Auswahl','N','Y',3);
143                                 addMemberMenuSql('main','themes','Designs','N','Y',6);
144                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=8 WHERE `action`='themes' LIMIT 1");
145                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=1, `title`='Designs' WHERE `what`='themes' LIMIT 1");
146
147                                 // User data
148                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `curr_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
149
150                                 // Update notes (these will be set as task text!)
151                                 setExtensionUpdateNotes("Update von <u>sql_patches</u> &uuml;bertragen. (Kann Fehlermeldungen verursacht haben!)");
152                                 break;
153
154                         case '0.0.9': // SQL queries for v0.0.9
155                                 // Config SQL
156                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `default_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
157
158                                 // Update notes (these will be set as task text!)
159                                 setExtensionUpdateNotes("Fehlende Konfiguration hinzugef&uuml;gt.");
160                                 break;
161
162                         case '0.1.0': // SQL queries for v0.1.0
163                                 // Register filter
164                                 registerFilter('init', 'HANDLE_THEME_CHANGE', false, true, isExtensionDryRun());
165
166                                 // Update notes (these will be set as task text!)
167                                 setExtensionUpdateNotes("&Auml;ndern des Designs nun im Filter (internes TODO).");
168                                 break;
169
170                         case '0.1.1': // SQL queries for v0.1.1
171                                 // Register filter
172                                 registerFilter('member_login_check', 'SET_USERS_THEME', false, true, isExtensionDryRun());
173
174                                 // Update notes (these will be set as task text!)
175                                 setExtensionUpdateNotes("Setzen des Mitgliedes&#39; eigener Design-Auswahl per Filter (internes TODO).");
176                                 break;
177
178                         case '0.1.2': // SQL queries for v0.1.2
179                                 // Remove deprecated menu
180                                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='theme_check' LIMIT 1");
181
182                                 // Update notes (these will be set as task text!)
183                                 setExtensionUpdateNotes("Nicht mehr ben&ouml;tigtes Men&uuml; zum Pr&uuml;fen von Theme-Versionen entfernt.");
184                                 break;
185                 } // END - switch
186                 break;
187
188         case 'modify': // When the extension got modified
189                 break;
190
191         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
192                 break;
193
194         case 'init': // Do stuff when extension is initialized
195                 break;
196
197         default: // Unknown extension mode
198                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
199                 break;
200 } // END - switch
201
202 // [EOF]
203 ?>