TODOs and ext-network:
[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  * 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  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
24  * This program is free software; you can redistribute it and/or modify *
25  * it under the terms of the GNU General Public License as published by *
26  * the Free Software Foundation; either version 2 of the License, or    *
27  * (at your option) any later version.                                  *
28  *                                                                      *
29  * This program is distributed in the hope that it will be useful,      *
30  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
31  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
32  * GNU General Public License for more details.                         *
33  *                                                                      *
34  * You should have received a copy of the GNU General Public License    *
35  * along with this program; if not, write to the Free Software          *
36  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
42         die();
43 } // END - if
44
45 // Version number
46 setThisExtensionVersion('0.1.1');
47
48 // Version history array (add more with , '0.1.0' and so on)
49 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
51 switch (getExtensionMode()) {
52         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
53                 // SQL commands to run
54                 break;
55
56         case 'remove': // Do stuff when removing extension
57                 // Drop theme table
58                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`");
59
60                 // Delete admin menu
61                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='theme'");
62
63                 // Delete guest menu entries
64                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='themes'");
65
66                 // Delete member menu entries
67                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='themes' OR `what`='themes'");
68
69                 // Unregister filters
70                 unregisterFilter('init', 'HANDLE_THEME_CHANGE', true, getExtensionDryRun());
71                 unregisterFilter('member_login_check', 'SET_USERS_THEME', true, getExtensionDryRun());
72                 break;
73
74         case 'activate': // Do stuff when admin activates this extension
75                 // SQL commands to run
76                 addExtensionSql('');
77                 break;
78
79         case 'deactivate': // Do stuff when admin deactivates this extension
80                 // SQL commands to run
81                 addExtensionSql('');
82                 break;
83
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&uuml;r ein Zeilen-Template ausgelagert.");
89                                 break;
90
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.");
94                                 break;
95
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&uuml;punkt &quot;Pr&uuml;fen&quot; wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.");
99                                 break;
100
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&uuml;r die Include-Befehle.");
104                                 break;
105
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.");
109                                 break;
110
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&auml;ndert.");
114                                 break;
115
116                         case '0.0.7': // SQL queries for v0.0.7
117                                 // Update notes (these will be set as task text!)
118                                 setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
119                                 break;
120
121                         case '0.0.8': // SQL queries for v0.0.8
122                                 // Theme table
123                                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`");
124                                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_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',
130 PRIMARY KEY (`id`),
131 UNIQUE KEY (`theme_path`),
132 INDEX (`theme_active`)
133 ) TYPE={?_TABLE_TYPE?} COMMENT='Themes'");
134
135                                 // Admin menu
136                                 addAdminMenuSql('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres {?mt_word2?}.', 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 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);
139                                 addAdminMenuSql('theme','theme_check','Pr&uuml;fen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3);
140
141                                 // Guest menu
142                                 addGuestMenuSql('themes',NULL,'Design-Auswahl','Y','N',4);
143
144                                 // Memember menu
145                                 addMemberMenuSql('themes',NULL,'Design-Auswahl','N','Y',3);
146                                 addMemberMenuSql('main','themes','Designs','N','Y',6);
147                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=8 WHERE `action`='themes' LIMIT 1");
148                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=1, `title`='Designs' WHERE `what`='themes' LIMIT 1");
149
150                                 // User data
151                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `curr_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
152
153                                 // Update notes (these will be set as task text!)
154                                 setExtensionUpdateNotes("Update von <u>sql_patches</u> &uuml;bertragen. (Kann Fehlermeldungen verursacht haben!)");
155                                 break;
156
157                         case '0.0.9': // SQL queries for v0.0.9
158                                 // Config SQL
159                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `default_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
160
161                                 // Update notes (these will be set as task text!)
162                                 setExtensionUpdateNotes("Fehlende Konfiguration hinzugef&uuml;gt.");
163                                 break;
164
165                         case '0.1.0': // SQL queries for v0.1.0
166                                 // Register filter
167                                 registerFilter('init', 'HANDLE_THEME_CHANGE', false, true, getExtensionDryRun());
168
169                                 // Update notes (these will be set as task text!)
170                                 setExtensionUpdateNotes("&Auml;ndern des Designs nun im Filter (internes TODO).");
171                                 break;
172
173                         case '0.1.1': // SQL queries for v0.1.1
174                                 // Register filter
175                                 registerFilter('member_login_check', 'SET_USERS_THEME', false, true, getExtensionDryRun());
176
177                                 // Update notes (these will be set as task text!)
178                                 setExtensionUpdateNotes("Setzen des Mitgliedes&#39; eigener Design-Auswahl per Filter (internes TODO).");
179                                 break;
180                 } // END - switch
181                 break;
182
183         case 'modify': // When the extension got modified
184                 break;
185
186         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
187                 break;
188
189         case 'init': // Do stuff when extension is initialized
190                 break;
191
192         default: // Unknown extension mode
193                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
194                 break;
195 } // END - switch
196
197 // [EOF]
198 ?>