Added update_year.sh (still not fully flexible) and updated all years with it.
[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 - 2015 by Mailer Developer Team                   *
20  * For more information visit: http://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.3');
45
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', '0.1.3'));
48
49 switch (getExtensionMode()) {
50         case 'setup': // Do stuff when installation is running
51                 // SQL commands to run
52                 break;
53
54         case 'remove': // Do stuff when removing extension
55                 // Drop theme table
56                 addDropTableSql('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(__FILE__, __LINE__, 'init', 'HANDLE_THEME_CHANGE', TRUE, isExtensionDryRun());
69                 unregisterFilter(__FILE__, __LINE__, 'member_login_check', 'SET_USERS_THEME', TRUE, isExtensionDryRun());
70                 unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'THEME_USER_REGISTRATION_ADD_SQL_COLUMNS', TRUE, isExtensionDryRun());
71                 break;
72
73         case 'activate': // Do stuff when admin activates this extension
74                 // SQL commands to run
75                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y',`locked`='N' WHERE `action`='theme' LIMIT 1");
76                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `action`='themes' OR `what`='themes' LIMIT 2");
77                 break;
78
79         case 'deactivate': // Do stuff when admin deactivates this extension
80                 // SQL commands to run
81                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `action`='theme' LIMIT 1");
82                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `action`='themes' OR `what`='themes' LIMIT 2");
83                 break;
84
85         case 'update': // Update an extension
86                 switch (getCurrentExtensionVersion()) {
87                         case '0.0.1': // SQL queries for v0.0.1
88                                 // Update notes (these will be set as task text!)
89                                 setExtensionUpdateNotes("HTML-Code f&uuml;r ein Zeilen-Template ausgelagert.");
90                                 break;
91
92                         case '0.0.2': // SQL queries for v0.0.2
93                                 // Update notes (these will be set as task text!)
94                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
95                                 break;
96
97                         case '0.0.3': // SQL queries for v0.0.3
98                                 // Update notes (these will be set as task text!)
99                                 setExtensionUpdateNotes("Im Men&uuml;punkt &quot;Pr&uuml;fen&quot; wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.");
100                                 break;
101
102                         case '0.0.4': // SQL queries for v0.0.4
103                                 // Update notes (these will be set as task text!)
104                                 setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
105                                 break;
106
107                         case '0.0.5': // SQL queries for v0.0.5
108                                 // Update notes (these will be set as task text!)
109                                 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
110                                 break;
111
112                         case '0.0.6': // SQL queries for v0.0.6
113                                 // Update notes (these will be set as task text!)
114                                 setExtensionUpdateNotes("Variablen-Handling scripteweit ge&auml;ndert.");
115                                 break;
116
117                         case '0.0.7': // SQL queries for v0.0.7
118                                 // Update notes (these will be set as task text!)
119                                 setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
120                                 break;
121
122                         case '0.0.8': // SQL queries for v0.0.8
123                                 // Theme table
124                                 addDropTableSql('themes');
125                                 addCreateTableSql('themes', "
126 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
127 `theme_path` VARCHAR(255) NOT NULL DEFAULT '',
128 `theme_name` VARCHAR(255) NOT NULL DEFAULT '',
129 `theme_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
130 `theme_ver` VARCHAR(255) NOT NULL DEFAULT '0.0.0',
131 PRIMARY KEY (`id`),
132 UNIQUE INDEX (`theme_path`),
133 INDEX (`theme_active`)", 'Themes');
134
135                                 // Admin menu
136                                 addAdminMenuSql('theme', NULL, 'Themes', 'Verwalten Sie hier alle Designs (Themes) Ihres {OPEN_CONFIG}mt_word2{CLOSE_CONFIG}.', 8);
137                                 addAdminMenuSql('theme', 'theme_import', 'Importieren', 'Es wird das Verzeichnis &quot;theme&quot; nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1);
138                                 addAdminMenuSql('theme', 'theme_edit', 'Modifizieren', '&Auml;ndern Sie Titel, Freigaben usw. an den Themes. Sie k&ouml;nnen bis auf das Standard-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);
139
140                                 // Guest menu
141                                 addGuestMenuSql('themes', NULL, 'Design-Auswahl', 4);
142
143                                 // Memember menu
144                                 addMemberMenuSql('themes', NULL, 'Design-Auswahl', 3);
145                                 addMemberMenuSql('main', 'themes', 'Designs', 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");
148
149                                 // User data
150                                 addExtensionAddTableColumnSql('user_data', 'curr_theme', "VARCHAR(255) NOT NULL DEFAULT 'default'");
151
152                                 // Update notes (these will be set as task text!)
153                                 setExtensionUpdateNotes("Update von <u>sql_patches</u> &uuml;bertragen. (Kann Fehlermeldungen verursacht haben!)");
154                                 break;
155
156                         case '0.0.9': // SQL queries for v0.0.9
157                                 // Config SQL
158                                 addConfigAddSql('default_theme', "VARCHAR(255) NOT NULL DEFAULT 'default'");
159
160                                 // Update notes (these will be set as task text!)
161                                 setExtensionUpdateNotes("Fehlende Konfiguration hinzugef&uuml;gt.");
162                                 break;
163
164                         case '0.1.0': // SQL queries for v0.1.0
165                                 // Register filter
166                                 registerFilter(__FILE__, __LINE__, 'init', 'HANDLE_THEME_CHANGE', FALSE, TRUE, isExtensionDryRun());
167
168                                 // Update notes (these will be set as task text!)
169                                 setExtensionUpdateNotes("&Auml;ndern des Designs nun im Filter (internes TODO).");
170                                 break;
171
172                         case '0.1.1': // SQL queries for v0.1.1
173                                 // Register filter
174                                 registerFilter(__FILE__, __LINE__, 'member_login_check', 'SET_USERS_THEME', FALSE, TRUE, isExtensionDryRun());
175
176                                 // Update notes (these will be set as task text!)
177                                 setExtensionUpdateNotes("Setzen des Mitgliedes&#39; eigener Design-Auswahl per Filter (internes TODO).");
178                                 break;
179
180                         case '0.1.2': // SQL queries for v0.1.2
181                                 // Remove deprecated menu
182                                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='theme_check' LIMIT 1");
183
184                                 // Update notes (these will be set as task text!)
185                                 setExtensionUpdateNotes("Nicht mehr ben&ouml;tigtes Men&uuml; zum Pr&uuml;fen von Theme-Versionen entfernt.");
186                                 break;
187
188                         case '0.1.3': // SQL queries for v0.1.3
189                                 // Register filter
190                                 registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'THEME_USER_REGISTRATION_ADD_SQL_COLUMNS', FALSE, TRUE, isExtensionDryRun());
191
192                                 // This depends on ext-register
193                                 addExtensionDependency('register');
194
195                                 // Update notes (these will be set as task text!)
196                                 setExtensionUpdateNotes("Filter f&uuml;r Mitgliederanmeldung hinzugef&uuml;gt.");
197                                 break;
198                 } // END - switch
199                 break;
200
201         case 'modify': // When the extension got modified
202                 break;
203
204         case 'test': // For testing purposes
205                 break;
206
207         case 'init': // Do stuff when extension is initialized
208                 break;
209
210         default: // Unknown extension mode
211                 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));
212                 break;
213 } // END - switch
214
215 // [EOF]
216 ?>