More fixes from bugtracker issues, thanks to profi-concept
[mailer.git] / inc / extensions / ext-sql_patches.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 08/21/2004 *
4  * ================                             Last change: 12/04/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-sql_patches.php                              *
8  * -------------------------------------------------------------------- *
9  * Short description : SQL fixes for pro versions                       *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ausgelagertes "Profildaten aendern"              *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Version number
41 $EXT_VERSION = "0.6.0";
42
43 // Auto-set extension version
44 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
45
46 // Version history array (add more with , "0.1" and so on)
47 $EXT_VER_HISTORY = 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", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0");
48
49 switch ($EXT_LOAD_MODE)
50 {
51 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
52         // SQL commands to run
53         $SQLs[] = "";
54         break;
55
56 case "remove": // Do stuff when removing extension
57         // Drop tables
58         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
59         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
60         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
61         $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_stats_data`";
62         $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_book`";
63         $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_filters`";
64
65         // Delete admin menu entries
66         $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE
67 `what`='config_extensions' OR
68 `what`='config_home' OR
69 `what`='list_unconfirmed' OR
70 `what`='config_refid' OR
71 `what`='config_title' OR
72 `what`='sub_points' OR
73 `what`='config_admin' OR
74 `what`='config_proxy' OR
75 `what`='config_session' OR
76 `what`='list_filter'
77 LIMIT 10";
78
79         // Delete/update member menu entries
80         $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE
81 `what`='stats2' OR
82 `what`='reflist' OR
83 (action='stats' AND (`what`='' OR what IS NULL)) OR
84 (action='extras' AND (`what`='' OR what IS NULL)) OR
85 (action='rals' AND (`what`='' OR what IS NULL)) OR
86 (action='account' AND (`what`='' OR what IS NULL))";
87         $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='main' WHERE
88 action='stats' OR
89 action='extras' OR
90 action='rals' OR
91 action='account'";
92
93         // Drop indexes
94         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP UNIQUE KEY `ext_name`";
95         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP UNIQUE KEY `login`";
96         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status`";
97         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner DROP INDEX `visible`";
98         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths DROP UNIQUE KEY `level`";
99         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem DROP INDEX `level`";
100         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool DROP INDEX `data_type`";
101         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg DROP UNIQUE KEY `module`";
102         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `action`";
103         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `what`";
104         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `task_type`";
105         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `status`";
106         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `task_created`";
107         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP FULLTEXT `subject`";
108         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `subject`";
109         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP INDEX `ext_active`";
110         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status`";
111         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP FULLTEXT `family`";
112         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `max_mails`";
113         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `password`";
114         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `action`";
115         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `what`";
116         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `sort`";
117         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `visible`";
118         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `locked`";
119         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `what`";
120         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `sort`";
121         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `visible`";
122         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `locked`";
123         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX `visible`";
124         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX `sort`";
125         break;
126
127 case "activate": // Do stuff when admin activates this extension
128         // SQL commands to run
129         $SQLs[] = "";
130         break;
131
132 case "deactivate": // Do stuff when admin deactivates this extension
133         // SQL commands to run
134         $SQLs[] = "";
135         break;
136
137 case "update": // Update an extension
138         switch ($EXT_VER)
139         {
140         case "0.0.1": // SQL queries for v0.0.1
141                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD ext_autopurge ENUM('Y','N') NOT NULL DEFAULT 'Y'";
142                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_extensions','Erweitungsmanagement','Alle Einstellungen am Erweiterungsmanagement.', 10)";
143
144                 // Update notes (these will be set as task text!)
145                 $UPDATE_NOTES = "Es kann nun bestimmt werden, ob vom Server gel&ouml;schte ext-xxx.php erkannt werden sollen und die verkn&uuml;pften Daten auch aus der Datenbank entfernt werden sollen.";
146                 break;
147
148         case "0.0.2": // SQL queries for v0.0.2
149                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` CHANGE auto_purge auto_purge BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day')*14)."";
150
151                 // Update notes (these will be set as task text!)
152                 $UPDATE_NOTES = "In der Tabelle <STRONG>"._MYSQL_PREFIX."_config</STRONG> musste die Spalte <STRONG>auto_purge</STRONG> (autom. L&ouml;schen von Best&auml;tigungsmails angepasst werden (war auf dem Testsystem auf TINYINT(4) gesetzt.)";
153                 break;
154
155         case "0.0.3": // SQL queries for v0.0.3
156                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD points_word VARCHAR(255) NOT NULL DEFAULT 'Punkte'";
157
158                 // Update notes (these will be set as task text!)
159                 $UPDATE_NOTES = "Das Wort &quot;Punkte&quot; kann nun per Datenbank ge&auml;ndert werden. Damit k&ouml;nnen Sie anstelle des Wortes Punkte auch Klammlose oder &euro; schreiben.";
160                 break;
161
162         case "0.0.4": // SQL queries for v0.0.4
163                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mails_page BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
164
165                 // Update notes (these will be set as task text!)
166                 $UPDATE_NOTES = "Anzahl Mails pro Seite in <STRONG>EMail-Details ansehen</STRONG> und <STRONG>EMail-Archiv</STRONG> hinzugef&uuml;gt.";
167                 break;
168
169         case "0.0.5": // SQL queries for v0.0.5
170                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD index_home VARCHAR(255) NOT NULL DEFAULT 'welcome'";
171                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_home','Home-Seite festlegen','Stellen Sie hier ein, welcher Men&uuml;punkt (what-welcome ist Standart) als Einstiegspunkt in das Men&uuml;system genutzt werden soll.', 5)";
172
173                 // Update notes (these will be set as task text!)
174                 $UPDATE_NOTES = "Die what-welcome.php ist derzeit die &quot;Home&quot;-Seite (Eingangsseite). Dies kann nun per Datenbank ge&auml;ndert werden.";
175                 break;
176
177         case "0.0.6": // SQL queries for v0.0.6
178                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD ext_has_css ENUM('Y','N') NOT NULL DEFAULT 'N'";
179
180                 // Update notes (these will be set as task text!)
181                 $UPDATE_NOTES = "Es k&ouml;nnen nun SQL-Updates von einander abh&auml;ngig gemacht werden und die CSS-Datei kann per Admin-Bereich (wegen Debuggings) ein- bzw. ausgeschaltet werden.";
182                 break;
183
184         case "0.0.7": // SQL queries for v0.0.7
185                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD verbose_sql ENUM('Y','N') NOT NULL DEFAULT 'Y'";
186
187                 // Update notes (these will be set as task text!)
188                 $UPDATE_NOTES = "Die SQL-Anweisungen werden bei eingeschalteter Verbose-Funktion detailiert angezeigt.";
189                 break;
190
191         case "0.0.8": // SQL queries for v0.0.8
192                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD menu_blur_spacer VARCHAR(255) NOT NULL DEFAULT '&nbsp;<STRONG><BIG>&middot;</BIG></STRONG>&nbsp;'";
193
194                 // Update notes (these will be set as task text!)
195                 $UPDATE_NOTES = "Nette Mouse-Hover-Effekte eingebaut (Anleitung <STRONG>MENUE_HOVER.txt</STRONG> zum Patchen der general.css bitte lesen!)";
196                 break;
197
198         case "0.0.9": // SQL queries for v0.0.9
199                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','list_unconfirmed','Unbest. Mails auflisten','Schauen Sie sich hier unbest&auml;tigte Maillinks an. Bitte diesen Link nur &uuml;ber dem EMail-Archiv oder EMail-Details aufrufen, direkt aufgerufen bekommen Sie eine Fehlermeldung.', 8)";
200
201                 // Update notes (these will be set as task text!)
202                 $UPDATE_NOTES = "Unbest&auml;tigte Maillinks k&ouml;nnen unter Email-Management -&gt; Unbest. Mails auflisten aufgelistet werden.";
203                 break;
204
205         case "0.1.0": // SQL queries for v0.2.1
206                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD reg_points_mode ENUM('ref','direct') NOT NULL DEFAULT 'ref'";
207
208                 // Update notes (these will be set as task text!)
209                 $UPDATE_NOTES = "Soll der einmalige Ref-Bonus &uuml;ber das Referal-System (also alle oberen Refs bekommen auch etwas davon ab) oder direkt dem Werber aufgebucht werden?";
210                 break;
211
212         case "0.1.1": // SQL queries for v0.1.1
213                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET title='Home-/Eingangsseite', descr='Stellen Sie hier ein, welcher Men&uuml;punkt (what-welcome ist Standart) als Einstiegspunkt in das Men&uuml;system genutzt werden soll und wie die automatische Weiterleitung in der Eingangsseite funktionieren soll.' WHERE `what`='config_home' LIMIT 1";
214                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD index_delay TINYINT(3) UNSIGNED NOT NULL DEFAULT '-1'";
215                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD index_cookie BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day')*365)."";
216
217                 // Update notes (these will be set as task text!)
218                 $UPDATE_NOTES = "Sie k&ouml;nnen nun <A href=\"{!URL!}/modules.php?module=admin&amp;`what`=config_home\">hier</A> die Verz&ouml;gerungszeit in der <A href=\"{!URL!}/index.php\">Eingangsseite</A> einstellen.";
219                 break;
220
221         case "0.1.2": // SQL queries for v0.1.2
222                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_refid','Standart-Ref-ID','Stellen Sie hier die User-ID ein, die genommen werden soll, wenn der Gast n icht per Referal-Link Ihren Mailtausch aufgerufen hat.', 7)";
223                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD def_refid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
224
225                 // Update notes (these will be set as task text!)
226                 $UPDATE_NOTES = "Standart Referal-ID kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)";
227                 break;
228
229         case "0.1.3": // SQL queries for v0.1.3
230                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD refid_target ENUM('register','index') NOT NULL DEFAULT 'register'";
231
232                 // Update notes (these will be set as task text!)
233                 $UPDATE_NOTES = "Auf welche Seite soll der Ref-Link zeigen? Eingangsseite oder Anmeldeformular?";
234                 break;
235
236         case "0.1.4": // SQL queries for v0.1.4
237                 // Update notes (these will be set as task text!)
238                 $UPDATE_NOTES = "Ung&uuml;ltiges Update (nach ext-theme.php verschoben!).";
239                 break;
240
241         case "0.1.5": // SQL queries for v0.1.5
242                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP ext_has_admin";
243
244                 // Update notes (these will be set as task text!)
245                 $UPDATE_NOTES = "Spalte <U>ext_has_admin</U> aus der Tabelle <U>"._MYSQL_PREFIX."_extensions</U> entfernt, da sie keinen Sinn mehr macht.";
246                 break;
247
248         case "0.1.6": // SQL queries for v0.1.6
249                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD enable_title_deco ENUM('Y','N') NOT NULL DEFAULT 'Y'";
250                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD title_left VARCHAR(10) NOT NULL DEFAULT '[--'";
251                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD title_middle VARCHAR(10) NOT NULL DEFAULT '-'";
252                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD title_right VARCHAR(10) NOT NULL DEFAULT '--]'";
253                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD enable_mod_title ENUM('Y','N') NOT NULL DEFAULT 'Y'";
254                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD enable_what_title ENUM('Y','N') NOT NULL DEFAULT 'Y'";
255                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_title','Seitentitel &auml;ndern','De-/aktivieren Sie hier die Dekorationen, sowie Modul-Titel und what-Titel im Seitentitel.', 8)";
256
257                 // Update notes (these will be set as task text!)
258                 $UPDATE_NOTES = "Dekorationen des Seitentiteles lassen sich ein- und ausschalten und selber definieren; Modul-Titel und Titel der <STRONG>what</STRONG>-Dateien kann hinzugef&uuml;gt werden.";
259                 break;
260
261         case "0.1.7": // SQL queries for v0.1.7
262                 // Update notes (these will be set as task text!)
263                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
264                 break;
265
266         case "0.1.8": // SQL queries for v0.1.8
267                 // Update notes (these will be set as task text!)
268                 $UPDATE_NOTES = "mad_count und last_mad werden nun aus der Datenbank geladen";
269                 break;
270
271         case "0.1.9": // SQL queries for v0.1.9
272                 // Update notes (these will be set as task text!)
273                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
274                 break;
275
276         case "0.2.0": // SQL queries for v0.2.0
277                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_jackpot CHANGE points points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
278
279                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payments CHANGE payment payment FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
280                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payments CHANGE price price FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
281
282                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE used_points used_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
283                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_points CHANGE points points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
284                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_points CHANGE locked_points locked_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000";
285
286                 // Update notes (these will be set as task text!)
287                 $UPDATE_NOTES = "5 Nachkommastellen implementiert";
288                 break;
289
290         case "0.2.1": // SQL queries for v0.2.1
291                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD css_php ENUM('DIRECT','FILE') NOT NULL DEFAULT 'FILE'";
292
293                 // Update notes (these will be set as task text!)
294                 $UPDATE_NOTES = "Ausgabe der CSS-Dateien entweder per css.php oder sie sind direkt eingebunden.";
295                 break;
296
297         case "0.2.2": // SQL queries for v0.2.2
298                 // Update notes (these will be set as task text!)
299                 $UPDATE_NOTES = "Erweiterung bleibt wegen integrierten Schalters immer aktiv.";
300                 break;
301
302         case "0.2.3": // SQL queries for v0.2.3
303                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD guest_menu ENUM('Y','N') NOT NULL DEFAULT 'Y'";
304                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD member_menu ENUM('Y','N') NOT NULL DEFAULT 'Y'";
305                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD youre_here ENUM('Y','N') NOT NULL DEFAULT 'Y'";
306
307                 // Update notes (these will be set as task text!)
308                 $UPDATE_NOTES = "Gast- und Mitgliedsmen&uuml;s lassen sich getrennt voneinander abschalten.";
309                 break;
310
311         case "0.2.4": // SQL queries for v0.2.4
312                 $auto_type = "png"; // PNG image is the default
313                 if ((FILE_READABLE(PATH."theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg')) {
314                         // Switch to JPEG format
315                         $auto_type = "jpg";
316                 }
317                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD img_type ENUM('jpg','png') NOT NULL DEFAULT '".$auto_type."'";
318
319                 // Update notes (these will be set as task text!)
320                 $UPDATE_NOTES = "Generierung des Mailbest&auml;tigungscodes h&auml;ngt davon ab, ob die PHP-Funktion <U>imagecreatefromjpeg()</U> und das JPEG-Bild vorhanden sind oder nicht.";
321                 break;
322
323         case "0.2.5": // SQL queries for v0.2.5
324                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE receive_mails receive_mails BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
325                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE max_mails max_mails BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
326
327                 // Update notes (these will be set as task text!)
328                 $UPDATE_NOTES = "Spalten <U>max_mails</U> und <U>receive_mails</U> auf BIGINT(20) gesetzt.";
329                 break;
330
331         case "0.2.6": // SQL queries for v0.2.6
332                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','sub_points','{!POINTS!} abziehen','Allen oder einem Mitglied {!POINTS!} abziehen.', 8)";
333
334                 // Update notes (these will be set as task text!)
335                 $UPDATE_NOTES = "Abzug von {!POINTS!} nun m&ouml;glich.";
336                 break;
337
338         case "0.2.7": // SQL queries for v0.2.7
339                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD stats_limit BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
340                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET `what`='config_stats' WHERE `what`='stats' LIMIT 1";
341
342                 // Update notes (these will be set as task text!)
343                 $UPDATE_NOTES = "<OL>
344 <LI>Das Mitglied kann das derzeitige Design in sein Profil abspeichern.</LI>
345 <LI>Mitgliederstatistik mit Seitennavigation.</LI>
346 </OL>";
347                 break;
348
349         case "0.2.8": // SQL queries for v0.2.8
350                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD last_login VARCHAR(10) NOT NULL DEFAULT 0";
351
352                 // Update notes (these will be set as task text!)
353                 $UPDATE_NOTES = "Letzter Login wird gespeichert, Cache wird bei installierter Cache-Erweiterung bei Sprachen&auml;nderung aufgefrischt.";
354                 break;
355
356         case "0.2.9": // SQL queries for v0.2.9
357                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mt_word VARCHAR(255) NOT NULL DEFAULT 'Mailtausch'";
358                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mt_word2 VARCHAR(255) NOT NULL DEFAULT 'Mailtausches'";
359                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mt_word3 VARCHAR(255) NOT NULL DEFAULT 'Mailtauscher'";
360
361                 // Update notes (these will be set as task text!)
362                 $UPDATE_NOTES = "W&ouml;rter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
363                 break;
364
365         case "0.3.0": // SQL queries for v0.3.0
366                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET title='{!POINTS!}/Referal-Ebenen' WHERE `what`='config_points' LIMIT 1";
367                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET title='Mailverg&uuml;tungen...' WHERE `what`='payments' LIMIT 1";
368
369                 // Update notes (these will be set as task text!)
370                 $UPDATE_NOTES = "Zwei Men&uuml;punkte umbenannt.";
371                 break;
372
373         case "0.3.1": // SQL queries for v0.3.1
374                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD UNIQUE KEY (ext_name)";
375                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD UNIQUE KEY (login)";
376                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD INDEX (status)";
377                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner ADD INDEX (visible)";
378                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths ADD UNIQUE KEY (level)";
379                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem ADD INDEX (level)";
380                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool ADD INDEX (data_type)";
381                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD UNIQUE KEY (module)";
382                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` ADD INDEX (action)";
383                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` ADD INDEX (what)";
384                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (task_type)";
385                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (status)";
386                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (task_created)";
387                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD FULLTEXT (subject)";
388                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (subject)";
389                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD INDEX (ext_active)";
390                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD INDEX (status)";
391                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD FULLTEXT (family)";
392                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD INDEX (max_mails)";
393                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD INDEX (password)";
394                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` ADD INDEX (action)";
395                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` ADD INDEX (what)";
396                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` ADD INDEX (sort)";
397                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` ADD INDEX (visible)";
398                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` ADD INDEX (locked)";
399                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX (what)";
400                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX (sort)";
401                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX (visible)";
402                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX (locked)";
403                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats ADD INDEX (visible)";
404                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats ADD INDEX (sort)";
405
406                 // Update notes (these will be set as task text!)
407                 $UPDATE_NOTES = "Eindeutige Schl&uuml;ssel (UNIQUE KEY) und normale Schl&uuml;ssel (INDEX) gesetzt.";
408                 break;
409
410         case "0.3.2": // SQL queries for v0.3.2
411                 // Connection table between the menu system and the "logical area" system
412                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
413                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_las (
414 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
415 la_id VARCHAR(255) NOT NULL DEFAULT '',
416 la_action VARCHAR(255) NOT NULL DEFAULT '',
417 la_what VARCHAR(255) NOT NULL DEFAULT '',
418 INDEX (la_id),
419 INDEX (la_action),
420 INDEX (la_what),
421 PRIMARY KEY(id)
422 ) TYPE=MyISAM";
423                 // All "logical areas" together
424                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
425                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_las_data (
426 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
427 la_id VARCHAR(255) NOT NULL DEFAULT '',
428 la_title VARCHAR(255) NOT NULL DEFAULT '',
429 la_posx BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
430 la_posy BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
431 UNIQUE KEY (la_id),
432 INDEX (la_posx),
433 INDEX (la_posy),
434 PRIMARY KEY(id)
435 ) TYPE=MyISAM";
436                 // Which menu do you like?
437                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD admin_menu ENUM('NEW','OLD') NOT NULL DEFAULT 'OLD'";
438
439                 // Insert menus
440                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_admin','Adminmen&uuml;','Diverse Einstellungen am Adminmen&uuml; vornehmen.', 9)";
441
442                 // Update notes (these will be set as task text!)
443                 $UPDATE_NOTES = "Logische Bereiche (Logical Areas = LAs) eingef&uuml;hrt. Dadurch wird das immer st&auml;rker anwachsende Admin-Men&uuml; in grosse Hauptgruppen unterteilt, wodurch ein Auffinden von Men&uuml;punkten verbessert wird.";
444                 break;
445
446         case "0.3.3": // SQL queries for v0.3.3
447                 // Switch of the "intelligent menu sorter" when you want to have a fixed menu structure...
448                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD admin_menu_sorter ENUM('Y','N') NOT NULL DEFAULT 'Y'";
449
450                 // The statistics table
451                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
452                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_stats (
453 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
454 aid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
455 type ENUM('la','action','what') NOT NULL DEFAULT 'what',
456 clicks BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
457 INDEX (aid),
458 PRIMARY KEY (id)
459 ) TYPE=MyISAM";
460
461                 // Update notes (these will be set as task text!)
462                 $UPDATE_NOTES = "Admin-abh&auml;ngig werden nun Klicks im Admin-Men&uuml; gez&auml;hlt, die zur automatischen Anpassung des Men&uuml;s in den logischen Bereichen diennen. Dieses &quot;intelligente Unbauen&quot; k&ouml;nnen Sie auch ganz abschalten.";
463                 break;
464
465         case "0.3.4": // SQL queries for v0.3.4
466                 // Update notes (these will be set as task text!)
467                 $UPDATE_NOTES = "Veraltetes Update (what=list_user&amp;mode=noref)";
468                 break;
469
470         case "0.3.5": // SQL queries for v0.3.5
471                 // List accounts with no referal
472                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('stats',NULL,'Statistiken',4,'Y','N')";
473                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('stats','stats2','Framekiller-Mails',2,'Y','N')";
474                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('extras',NULL,'Extras',5,'Y','N')";
475                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('rals',NULL,'Rallyes',6,'Y','N')";
476                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('account',NULL,'Ihr Account',7,'Y','N')";
477                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='stats', sort='1', title='Klick-Mails' WHERE `what`='stats' LIMIT 1";
478                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='extras', sort='3' WHERE `what`='reflinks' LIMIT 1";
479
480                 // Update notes (these will be set as task text!)
481                 $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
482                 break;
483
484         case "0.3.6": // SQL queries for v0.3.6
485                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD salt_length TINYINT(3) UNSIGNED NOT NULL DEFAULT '9'";
486                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD pass_scramble VARCHAR(255) NOT NULL DEFAULT ''";
487                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` MODIFY password VARCHAR(255) NOT NULL DEFAULT ''";
488                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` MODIFY user_hash VARCHAR(255) NOT NULL DEFAULT ''";
489                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins MODIFY password VARCHAR(255) NOT NULL DEFAULT ''";
490                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD rand_no BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
491                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD file_hash VARCHAR(255) NOT NULL DEFAULT ''";
492                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD master_salt VARCHAR(255) NOT NULL DEFAULT ''";
493                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_config` SET rand_no=(ROUND(RAND() * 99999) + 100000) WHERE config=0 LIMIT 1";
494                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD has_menu ENUM('Y','N') NOT NULL DEFAULT 'N'";
495                 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET has_menu='Y' WHERE module='admin' OR module='index' OR module='login' LIMIT 3";
496
497                 // Update notes (these will be set as task text!)
498                 $UPDATE_NOTES = "Passwort-System mit Zufallshash erweitert (Schutzt gegen Dictionary-Attacks!)";
499                 break;
500
501         case "0.3.7": // SQL queries for v0.3.7
502                 $UPDATE_NOTES = "Problem w&auml;hrend des Installationsvorganges behoben.";
503                 break;
504
505         case "0.3.8": // SQL queries for v0.3.8
506                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` CHANGE descr descr MEDIUMTEXT NULL";
507                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool CHANGE `text` `text` LONGTEXT NOT NULL";
508
509                 // Update notes (these will be set as task text!)
510                 $UPDATE_NOTES = "Beschreibungstexte f&uuml;r Admin-Men&uuml;s k&ouml;nnen l&auml;nger sein. Diverse Fixes.";
511                 break;
512
513         case "0.3.9": // SQL queries for v0.3.9
514                 $SQLs[] = "UPDATE  `"._MYSQL_PREFIX."_admin_menu` SET title = REPLACE(title, '--POINTS--','!POINTS!') WHERE title LIKE '%--POINTS--%'";
515                 $SQLs[] = "UPDATE  `"._MYSQL_PREFIX."_admin_menu` SET descr = REPLACE(descr, '--POINTS--','!POINTS!') WHERE descr LIKE '%--POINTS--%'";
516                 $SQLs[] = "UPDATE  `"._MYSQL_PREFIX."_guest_menu` SET title = REPLACE(title, '--POINTS--','!POINTS!') WHERE title LIKE '%--POINTS--%'";
517                 $SQLs[] = "UPDATE  `"._MYSQL_PREFIX."_member_menu` SET title = REPLACE(title, '--POINTS--','!POINTS!') WHERE title LIKE '%--POINTS--%'";
518
519                 // Update notes (these will be set as task text!)
520                 $UPDATE_NOTES = "Beschreibungstexte f&uuml;r Admin-Men&uuml;s k&ouml;nnen l&auml;nger sein. Diverse Fixes.";
521                 break;
522
523         case "0.4.0": // SQL queries for v0.4.0
524                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET title = 'Email-Management' WHERE action = 'email' AND (`what`='' OR what IS NULL) LIMIT 1";
525
526                 // Update notes (these will be set as task text!)
527                 $UPDATE_NOTES = "Email-Verwaltung nach Email-Management umbenannt.";
528                 break;
529
530         case "0.4.1": // SQL queries for v0.4.1
531                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status` , ADD INDEX `status` ( `status` , `max_mails` )";
532                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `show_timings` ENUM ('Y','N') NOT NULL DEFAULT 'Y'";
533
534                 // Update notes (these will be set as task text!)
535                 $UPDATE_NOTES = "Tabellen-Schl&uuml;ssel neu gesetzt und Parsing-Zeit im Footer eingeblendet.";
536                 break;
537
538         case "0.4.2": // SQL queries for v0.4.2
539                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_online` ADD INDEX `admin_member` (`is_admin`,`is_member`)";
540
541                 // Update notes (these will be set as task text!)
542                 $UPDATE_NOTES = "Neuen Schl&uuml;ssel zur Online-Tabelle hinzugef&uuml;gt.";
543                 break;
544
545         case "0.4.3": // SQL queries for v0.4.3
546                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_host` VARCHAR(255) NOT NULL DEFAULT ''";
547                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_port` INT(5) UNSIGNED NOT NULL DEFAULT 0";
548                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_username` VARCHAR(255) NOT NULL DEFAULT ''";
549                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_password` VARCHAR(255) NOT NULL DEFAULT ''";
550                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_proxy','Proxy-Einstellungen','Sollte Ihr Webserver sich hinter einem Proxy befinden, so k&ouml;nnen Sie hier MXChange so konfigurieren, dass es Updates durch diesen hindurch sucht!', 15)";
551
552                 // Update notes (these will be set as task text!)
553                 $UPDATE_NOTES = "Proxy-Einstellungen hinzugef&uuml;gt.";
554                 break;
555
556         case "0.4.4": // SQL queries for v0.4.4
557                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
558                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
559                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
560                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET `what`=NULL WHERE `what`=''";
561                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET `what`=NULL WHERE `what`=''";
562                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `what`=NULL WHERE `what`=''";
563                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
564                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
565                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX `action` (`action`)";
566                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
567
568                 // Update notes (these will be set as task text!)
569                 $UPDATE_NOTES = "Schl&uuml;ssel in Admin-, Gast- und Mitgliedsmen&uuml; verbessert.";
570                 break;
571
572         case "0.4.5": // SQL queries for v0.4.5
573                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD last_month CHAR(2) NOT NULL DEFAULT '00'";
574                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD last_week CHAR(2) NOT NULL DEFAULT '00'";
575
576                 // Update notes (these will be set as task text!)
577                 $UPDATE_NOTES = "T&auml;glichen/w&ouml;chentlichen/monatlichen Reset verbessert.";
578                 break;
579
580         case "0.4.6": // SQL queries for v0.4.6
581                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD gender ENUM ('M','F') NOT NULL DEFAULT 'M'";
582                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_user_data` SET gender=sex WHERE sex != 'M'";
583                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP sex";
584
585                 // Update notes (these will be set as task text!)
586                 $UPDATE_NOTES = "Offensives Wort &quot;Sex&quot; gegen &quot;Gender&quot; ausgetauscht.";
587                 break;
588
589         case "0.4.7": // SQL queries for v0.4.7
590                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD login_failtures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
591                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD last_failture TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
592
593                 // Update notes (these will be set as task text!)
594                 $UPDATE_NOTES = "Fehlgeschlagene Login-Versuche werden nun mitgez&auml;hlt und der letzte vermerkt.";
595                 break;
596
597         case "0.4.8": // SQL queries for v0.4.8
598                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (subject)";
599
600                 // Update notes (these will be set as task text!)
601                 $UPDATE_NOTES = "Index f&uuml;r Betreff eingef&uuml;gt.";
602                 break;
603
604         case "0.4.9": // SQL queries for v0.4.9
605                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE `user_hash` `user_hash` VARCHAR(255) NULL DEFAULT NULL";
606                 $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_user_data` SET user_hash=NULL WHERE user_hash IS NOT NULL AND status='CONFIRMED'";
607                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD UNIQUE (`user_hash`)";
608
609                 // Update notes (these will be set as task text!)
610                 $UPDATE_NOTES = "User-Hash zum Best&auml;tigen wird auf NULL gesetzt, wenn Account best&auml;tigt wird.";
611                 break;
612
613         case "0.5.0": // SQL queries for v0.5.0
614                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_refsystem` DROP INDEX `level`";
615                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_refsystem` DROP INDEX `userid`, ADD UNIQUE `userid_level` (`userid`,`level`)";
616
617                 // Update notes (these will be set as task text!)
618                 $UPDATE_NOTES = "Referal-System unterst&uuml;tzt nun detailierte Referal-&Uuml;bersicht und vieles mehr.";
619                 break;
620
621         case "0.5.1": // SQL queries for v0.5.1
622                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP `descr`";
623
624                 // Update notes (these will be set as task text!)
625                 $UPDATE_NOTES = "Beschreibungsspalte von Mitgliedsmen&uuml; entfernt, welche ohnehin nicht genutzt wird.";
626                 break;
627
628         case "0.5.2": // SQL queries for v0.5.2
629                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_refdepths` CHANGE `percents` `percents` FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000";
630
631                 // Update notes (these will be set as task text!)
632                 $UPDATE_NOTES = "Prozents&aum;tze k&ouml;nnen nun f&uuml;nf Stelle hinter dem Komma sein.";
633                 break;
634
635         case "0.5.3": // SQL queries for v0.5.3
636                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD session_save_path VARCHAR(255) NOT NULL DEFAULT ''";
637                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_session','Session-Einstellungen','&Auml;ndern Sie hier den Speicherpfad f&uuml;r Sessiondateien (Sitzungsdateien) ab, falls die Standart-Einstellung bei Ihrem Hoster zu Problem f&uuml;hren sollte.', 16)";
638
639                 // Update notes (these will be set as task text!)
640                 $UPDATE_NOTES = "Session-Speicherpfad konfigurierbar. Beispielsweise ist dies bei all-inkl.com n&ouml;tig.";
641                 break;
642
643         case "0.5.4": // SQL queries for v0.5.4
644                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','reflist','Ref-&Uuml;bersicht',5,'Y','N')";
645
646                 // Depends on refback extension
647                 $EXT_UPDATE_DEPENDS = "refback";
648
649                 // Update notes (these will be set as task text!)
650                 $UPDATE_NOTES = "Ref-&Uuml;bersicht eingebaut. Diese h&auml;ngt von der Erweiterung <strong>refback</strong> ab.";
651                 break;
652
653         case "0.5.5": // SQL queries for v0.5.5
654                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD show_points_unconfirmed ENUM('Y','N') NOT NULL DEFAULT 'Y'";
655
656                 // Update notes (these will be set as task text!)
657                 $UPDATE_NOTES = "Anzeige der {!POINTS!} unter den unbest&auml;tigten Mails kann nun optional abgeschaltet werden.";
658                 break;
659
660         case "0.5.6": // SQL queries for v0.5.6
661                 $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_stats_data`";
662                 $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_user_stats_data` (
663 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
664 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
665 `stats_type` VARCHAR(255) NOT NULL DEFAULT 'unknown',
666 `stats_data` VARCHAR(255) NOT NULL DEFAULT '',
667 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
668 PRIMARY KEY(`id`),
669 INDEX (`userid`),
670 INDEX (`stats_type`)
671 ) TYPE=MyISAM COMMENT='Member statistics data'";
672
673                 // Update notes (these will be set as task text!)
674                 $UPDATE_NOTES = "Mitglieder k&ouml;nnnen nun z.B. in den Mail-Details zu jeder Mail sehen, wann sie diese best&auml;tigt haben. Die neue Statistik-Tabelle ist aber universell einsetzbar.";
675                 break;
676
677         case "0.5.7": // SQL queries for v0.5.7
678                 $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='list_norefs' LIMIT 1";
679
680                 // Update notes (these will be set as task text!)
681                 $UPDATE_NOTES = "Auflistung der Mitglieder ohne Werber nach what=list_user&amp;mode=norefs verschoben.";
682                 break;
683
684         case "0.5.8": // SQL queries for v0.5.8
685                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_extensions` DROP `ext_lang_file`";
686
687                 // Update notes (these will be set as task text!)
688                 $UPDATE_NOTES = "Sprachdateinamen werden nicht mehr in der Datenbank behalten.";
689                 break;
690
691         case "0.5.9": // SQL queries for v0.5.9
692                 $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_filters`";
693                 $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_filters` (
694 `filter_id` BIGINT(20) UNSIGNED AUTO_INCREMENT,
695 `filter_name` VARCHAR(255) NOT NULL DEFAULT '',
696 `filter_function` VARCHAR(255) NOT NULL DEFAULT '',
697 `filter_active` ENUM('N','Y') NOT NULL DEFAULT 'Y',
698 PRIMARY KEY (`filter_id`)
699 ) TYPE=MyISAM COMMENT='Filter system'";
700                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','list_filter','Filter-Management', 'Zeigt alle im System registrierten Filter an und l&auml;sst diese de- bzw. wieder aktivieren.', 17)";
701
702                 // Update notes (these will be set as task text!)
703                 $UPDATE_NOTES = "Tabellen f&uuml;r Filter-System hinzugef&uuml;gt.";
704                 break;
705
706         case "0.6.0": // SQL queries for v0.6.0
707                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_filters` ADD `filter_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
708                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `update_filter_usage` ENUM('N','Y') NOT NULL DEFAULT 'N'";
709
710                 // Update notes (these will be set as task text!)
711                 $UPDATE_NOTES = "Benutzungsstatistik eingebaut. Das Z&auml;hlen der Filterverwendungen sollte <strong>ausschliesslich</strong> zu Debugging-Zwecken eingesetzt werden.";
712                 break;
713         }
714         break;
715
716 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
717         break;
718
719 default: // Do stuff when extension is loaded
720         // When the sql_patches is not installed we cannot load it's configuration... *sigh*
721         if (GET_EXT_VERSION("sql_patches") != '') {
722                 // Init key
723                 $_CONFIG['secret_key'] = "";
724
725                 // Read key from secret file
726                 if ((getConfig('file_hash') == "") || (getConfig('master_salt') == "") || (getConfig('pass_scramble') == "")) {
727                         // Cache instance
728                         global $cacheInstance;
729
730                         // Maybe need setup of secret key!
731                         require_once(PATH."inc/gen_sql_patches.php");
732
733                         // @TODO Rewrite this to a filter!
734                         if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheInstance)) && (is_object($cacheInstance))) {
735                                 // Remove extensions and mod_reg cache file
736                                 require_once(PATH."inc/libs/cache_functions.php");
737                                 require_once(PATH."inc/extensions/ext-cache.php");
738                                 if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
739                                 if ($cacheInstance->loadCacheFile("mod_reg"))          $cacheInstance->destroyCacheFile();
740                         } // END - if
741                 } // END - if
742
743                 // Test again
744                 if ((getConfig('file_hash') != "") && (getConfig('master_salt') != "") && (getConfig('pass_scramble') != "")) {
745                         // File hash fas generated so we can also file the secret file... hopefully.
746                         $hashFile = sprintf("%sinc/.secret/.%s", PATH, getConfig('file_hash'));
747                         if (FILE_READABLE($hashFile)) {
748                                 // Read file
749                                 $_CONFIG['secret_key'] = READ_FILE($hashFile);
750                         } else {
751                                 // Remove it from database
752                                 UPDATE_CONFIG("file_hash", "");
753
754                                 // Cannot read secret file!
755                                 mxchange_die("Cannot read secret file! Please try to reload");
756                         }
757                 } // END - if
758
759                 // Transfer words/numbers to constants
760                 define('POINTS'  , getConfig('points_word'));
761                 define('MT_WORD' , getConfig('mt_word'));
762                 define('MT_WORD2', getConfig('mt_word2'));
763                 define('MT_WORD3', getConfig('mt_word3'));
764                 define('_MAX'    , getConfig('rand_no'));
765         } else {
766                 // Set some lame ( ;-) ) default settings
767                 $_CONFIG['def_refid'] = 0;
768                 $_CONFIG['enable_title_deco'] = "N";
769                 $_CONFIG['title_mod_show']    = "Y";
770                 $_CONFIG['title_middle']      = "-";
771                 // @TODO Can we remove this? $_CONFIG['verbose_sql']       = "N";
772                 define('MT_WORD' , DEFAULT_MT_WORD );
773                 define('MT_WORD2', DEFAULT_MT_WORD2);
774                 define('MT_WORD3', DEFAULT_MT_WORD3);
775                 define('POINTS'  , DEFAULT_POINTS);
776         }
777         break;
778 }
779
780 // Keep this extension always active!
781 $EXT_ALWAYS_ACTIVE = "Y";
782
783 //
784 ?>