2 /************************************************************************
3 * MXChange v0.2.1 Start: 08/21/2004 *
4 * ================ Last change: 12/04/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-sql_patches.php *
8 * -------------------------------------------------------------------- *
9 * Short description : SQL fixes for pro versions *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Ausgelagertes "Profildaten aendern" *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 $EXT_VERSION = "0.4.4";
43 // Auto-set extension version
44 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
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");
49 switch ($EXT_LOAD_MODE)
51 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
52 // SQL commands to run
56 case "remove": // Do stuff when removing extension
57 // SQL commands to run
58 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE
59 (action='theme' AND (what='theme_import' OR what='theme_edit')) OR
60 what='config_extensions' OR
62 what='list_unconfirmed' OR
63 what='config_refid' OR
64 what='config_title' OR
66 what='config_admin' OR
67 what='config_proxy' OR
70 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
71 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE action='themes' LIMIT 1";
72 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE
76 (action='stats' AND (what='' OR what IS NULL)) OR
77 (action='extras' AND (what='' OR what IS NULL)) OR
78 (action='rals' AND (what='' OR what IS NULL)) OR
79 (action='account' AND (what='' OR what IS NULL)) LIMIT 8";
80 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='main' WHERE
85 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
86 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
87 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
90 case "activate": // Do stuff when admin activates this extension
91 // SQL commands to run
95 case "deactivate": // Do stuff when admin deactivates this extension
96 // SQL commands to run
100 case "update": // Update an extension
103 case "0.0.1": // SQL queries for v0.0.1
104 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD ext_autopurge ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
105 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('setup', 'config_extensions', 'Erweitungsmanagement', 'Alle Einstellungen am Erweiterungsmanagement.', 10)";
107 // Update notes (these will be set as task text!)
108 $UPDATE_NOTES = "Es kann nun bestimmt werden, ob vom Server gelöschte ext-xxx.php erkannt werden sollen und die verknüpften Daten auch aus der Datenbank entfernt werden sollen.";
111 case "0.0.2": // SQL queries for v0.0.2
112 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config CHANGE auto_purge auto_purge BIGINT(20) NOT NULL DEFAULT '1209600'";
114 // Update notes (these will be set as task text!)
115 $UPDATE_NOTES = "In der Tabelle <STRONG>mxchange_config</STRONG> musste die Spalte <STRONG>auto_purge</STRONG> (autom. Löschen von Bestätigungsmails angepasst werden (war auf dem Testsystem auf tiny(4) gesetzt.)";
118 case "0.0.3": // SQL queries for v0.0.3
119 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD points_word VARCHAR(255) NOT NULL DEFAULT 'Punkte'";
121 // Update notes (these will be set as task text!)
122 $UPDATE_NOTES = "Das Wort "Punkte" kann nun per Datenbank geändert werden. Damit können Sie anstelle des Wortes Punkte auch Klammlose oder € schreiben.";
125 case "0.0.4": // SQL queries for v0.0.4
126 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mails_page BIGINT(20) NOT NULL DEFAULT '10'";
128 // Update notes (these will be set as task text!)
129 $UPDATE_NOTES = "Anzahl Mails pro Seite in <STRONG>EMail-Details ansehen</STRONG> und <STRONG>EMail-Archiv</STRONG> hinzugefügt.";
132 case "0.0.5": // SQL queries for v0.0.5
133 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD index_home VARCHAR(255) NOT NULL DEFAULT 'welcome'";
134 $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üpunkt (what-welcome ist Standart) als Einstiegspunkt in das Menüsystem genutzt werden soll.', 5)";
136 // Update notes (these will be set as task text!)
137 $UPDATE_NOTES = "Die what-welcome.php ist derzeit die "Home"-Seite (Eingangsseite). Dies kann nun per Datenbank geändert werden.";
140 case "0.0.6": // SQL queries for v0.0.6
141 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD ext_has_css ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
143 // Update notes (these will be set as task text!)
144 $UPDATE_NOTES = "Es können nun SQL-Updates von einander abhängig gemacht werden und die CSS-Datei kann per Admin-Bereich (wegen Debuggings) ein- bzw. ausgeschaltet werden.";
147 case "0.0.7": // SQL queries for v0.0.7
148 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD verbose_sql ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
150 // Update notes (these will be set as task text!)
151 $UPDATE_NOTES = "Die SQL-Anweisungen werden bei eingeschalteter Verbose-Funktion detailiert angezeigt.";
154 case "0.0.8": // SQL queries for v0.0.8
155 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD menu_blur_spacer VARCHAR(255) NOT NULL DEFAULT ' <STRONG><BIG>·</BIG></STRONG> '";
157 // Update notes (these will be set as task text!)
158 $UPDATE_NOTES = "Nette Mouse-Hover-Effekte eingebaut (Anleitung <STRONG>MENUE_HOVER.txt</STRONG> zum Patchen der general.css bitte lesen!)";
161 case "0.0.9": // SQL queries for v0.0.9
162 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('email', 'list_unconfirmed', 'Unbest. Mails auflisten', 'Schauen Sie sich hier unbestätigte Maillinks an. Bitte diesen Link nur über dem EMail-Archiv oder EMail-Details aufrufen, direkt aufgerufen bekommen Sie eine Fehlermeldung.', 8)";
164 // Update notes (these will be set as task text!)
165 $UPDATE_NOTES = "Unbestätigte Maillinks können unter Email-Management -> Unbest. Mails auflisten aufgelistet werden.";
168 case "0.1.0": // SQL queries for v0.2.1
169 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD reg_points_mode ENUM('ref', 'direct') NOT NULL DEFAULT 'ref'";
171 // Update notes (these will be set as task text!)
172 $UPDATE_NOTES = "Soll der einmalige Ref-Bonus über das Referral-System (also alle oberen Refs bekommen auch etwas davon ab) oder direkt dem Werber aufgebucht werden?";
175 case "0.1.1": // SQL queries for v0.1.1
176 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='Home-/Eingangsseite', descr='Stellen Sie hier ein, welcher Menüpunkt (what-welcome ist Standart) als Einstiegspunkt in das Menüsystem genutzt werden soll und wie die automatische Weiterleitung in der Eingangsseite funktionieren soll.' WHERE what='config_home' LIMIT 1";
177 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD index_delay TINYINT(3) NOT NULL DEFAULT '-1'";
178 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD index_cookie BIGINT(20) NOT NULL DEFAULT '31536000'";
180 // Update notes (these will be set as task text!)
181 $UPDATE_NOTES = "Sie können nun <A href=\"".URL."/modules.php?module=admin&what=config_home\">hier</A> die Verzögerungszeit in der <A href=\"".URL."/index.php\">Eingangsseite</A> einstellen.";
184 case "0.1.2": // SQL queries for v0.1.2
185 $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 Referral-Link Ihren Mailtausch aufgerufen hat.', 7)";
186 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD def_refid BIGINT(20) NOT NULL DEFAULT '0'";
188 // Update notes (these will be set as task text!)
189 $UPDATE_NOTES = "Standart Referral-ID kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)";
192 case "0.1.3": // SQL queries for v0.1.3
193 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD refid_target ENUM('register', 'index') NOT NULL DEFAULT 'register'";
195 // Update notes (these will be set as task text!)
196 $UPDATE_NOTES = "Auf welche Seite soll der Ref-Link zeigen? Eingangsseite oder Anmeldeformular?";
199 case "0.1.4": // SQL queries for v0.1.4
200 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD default_theme VARCHAR(255) NOT NULL DEFAULT '".GET_CURR_THEME()."'";
201 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='theme' LIMIT 3";
202 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('theme', NULL, 'Themes', 'Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)";
203 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('theme', 'theme_import', 'Importieren', 'Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)";
204 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('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)";
205 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (action, what, title, sort, visible, locked) VALUES ('themes', NULL, 'Design-Auswahl', 4, 'Y', 'N')";
206 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('themes', NULL, 'Design-Auswahl', 3, 'Y', 'N')";
207 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
208 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes (
209 id BIGINT(20) NOT NULL AUTO_INCREMENT,
210 theme_path VARCHAR(255) NOT NULL DEFAULT '',
211 theme_active ENUM('Y', 'N') NOT NULL DEFAULT 'N',
212 theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0',
216 // Update notes (these will be set as task text!)
217 $UPDATE_NOTES = "Theme-Support integriert. Bitte laden Sie sich zu dieser Version das <A href=\"http://www.mxchange.org\">281-Patch</A> (wenn Ihr Script v0.2.0-pre7 ist) herunter, da ansonsten die Themes nicht klappen werden!";
220 case "0.1.5": // SQL queries for v0.1.5
221 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP ext_has_admin";
223 // Update notes (these will be set as task text!)
224 $UPDATE_NOTES = "Spalte <U>ext_has_admin</U> aus der Tabelle <U>"._MYSQL_PREFIX."_extensions</U> entfernt, da sie keinen Sinn mehr macht.";
227 case "0.1.6": // SQL queries for v0.1.6
228 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD enable_title_deco ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
229 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD title_left VARCHAR(10) NOT NULL DEFAULT '[--'";
230 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD title_middle VARCHAR(10) NOT NULL DEFAULT '-'";
231 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD title_right VARCHAR(10) NOT NULL DEFAULT '--]'";
232 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD enable_mod_title ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
233 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD enable_what_title ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
234 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('setup', 'config_title', 'Seitentitel ändern', 'De-/aktivieren Sie hier die Dekorationen, sowie Modul-Titel und what-Titel im Seitentitel.', 8)";
236 // Update notes (these will be set as task text!)
237 $UPDATE_NOTES = "Dekorationen des Seitentiteles lassen sich ein- und ausschalten und selber definieren; Modul-Titel und Titel der <STRONG>what</STRONG>-Dateien kann hinzugefügt werden.";
240 case "0.1.7": // SQL queries for v0.1.7
241 // Update notes (these will be set as task text!)
242 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
245 case "0.1.8": // SQL queries for v0.1.8
246 // Update notes (these will be set as task text!)
247 $UPDATE_NOTES = "mad_counter und last_mad werden nun aus der Datenbank geladen";
250 case "0.1.9": // SQL queries for v0.1.9
251 // Update notes (these will be set as task text!)
252 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
255 case "0.2.0": // SQL queries for v0.2.0
256 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_jackpot CHANGE points points DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
258 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payments CHANGE payment payment DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
259 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payments CHANGE price price DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
261 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE used_points used_points DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
262 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_points CHANGE points points DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
263 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_points CHANGE locked_points locked_points DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
265 // Update notes (these will be set as task text!)
266 $UPDATE_NOTES = "5 Nachkommastellen implementiert";
269 case "0.2.1": // SQL queries for v0.2.1
270 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD css_php ENUM('DIRECT', 'FILE') NOT NULL DEFAULT 'FILE'";
272 // Update notes (these will be set as task text!)
273 $UPDATE_NOTES = "Ausgabe der CSS-Dateien entweder per css.php oder sie sind direkt eingebunden.";
276 case "0.2.2": // SQL queries for v0.2.2
277 // Update notes (these will be set as task text!)
278 $UPDATE_NOTES = "Erweiterung bleibt wegen integrierten Schalters immer aktiv.";
281 case "0.2.3": // SQL queries for v0.2.3
282 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD guest_menu ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
283 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD member_menu ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
284 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD youre_here ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
286 // Update notes (these will be set as task text!)
287 $UPDATE_NOTES = "Gast- und Mitgliedsmenüs lassen sich getrennt voneinander abschalten.";
290 case "0.2.4": // SQL queries for v0.2.4
291 $auto_type = "png"; // PNG image is the default
292 if ((file_exists(PATH."theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg'))
294 // Switch to JPEG format
297 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD img_type ENUM('jpg', 'png') NOT NULL DEFAULT '".$auto_type."'";
299 // Update notes (these will be set as task text!)
300 $UPDATE_NOTES = "Generierung des Mailbestätigungscodes hängt davon ab, ob die PHP-Funktion <U>imagecreatefromjpeg()</U> und das JPEG-Bild vorhanden sind oder nicht.";
303 case "0.2.5": // SQL queries for v0.2.5
304 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE receive_mails receive_mails BIGINT(20) NOT NULL DEFAULT '0'";
305 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE max_mails max_mails BIGINT(20) NOT NULL DEFAULT '0'";
307 // Update notes (these will be set as task text!)
308 $UPDATE_NOTES = "Spalten <U>max_mails</U> und <U>receive_mails</U> auf BIGINT(20) gesetzt.";
311 case "0.2.6": // SQL queries for v0.2.6
312 $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)";
314 // Update notes (these will be set as task text!)
315 $UPDATE_NOTES = "Abzug von {!POINTS!} nun möglich.";
318 case "0.2.7": // SQL queries for v0.2.7
319 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort) VALUES ('main', 'themes', 'Designs', 6)";
320 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'";
321 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD stats_limit BIGINT(20) NOT NULL DEFAULT '10'";
322 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='config_stats' WHERE what='stats' LIMIT 1";
324 // Update notes (these will be set as task text!)
325 $UPDATE_NOTES = "<OL>
326 <LI>Das Mitglied kann das derzeitige Design in sein Profil abspeichern.</LI>
327 <LI>Mitgliederstatistik mit Seitennavigation.</LI>
331 case "0.2.8": // SQL queries for v0.2.8
332 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD last_login VARCHAR(10) NOT NULL DEFAULT '0'";
334 // Update notes (these will be set as task text!)
335 $UPDATE_NOTES = "Letzter Login wird gespeichert, Cache wird bei installierter Cache-Erweiterung bei Sprachenänderung aufgefrischt.";
338 case "0.2.9": // SQL queries for v0.2.9
339 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mt_word VARCHAR(255) NOT NULL DEFAULT 'Mailtausch'";
340 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mt_word2 VARCHAR(255) NOT NULL DEFAULT 'Mailtausches'";
341 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mt_word3 VARCHAR(255) NOT NULL DEFAULT 'Mailtauscher'";
343 // Update notes (these will be set as task text!)
344 $UPDATE_NOTES = "Wörter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
347 case "0.3.0": // SQL queries for v0.3.0
348 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='{!POINTS!}/Referral-Ebenen' WHERE what='config_points' LIMIT 1";
349 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='Mailvergütungen...' WHERE what='payments' LIMIT 1";
351 // Update notes (these will be set as task text!)
352 $UPDATE_NOTES = "Zwei Menüpunkte umbenannt.";
355 case "0.3.1": // SQL queries for v0.3.1
356 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD UNIQUE KEY (ext_name)";
357 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD UNIQUE KEY (theme_path)";
358 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD INDEX (theme_active)";
359 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD UNIQUE KEY (login)";
360 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (status)";
361 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner ADD INDEX (visible)";
362 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths ADD UNIQUE KEY (level)";
363 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem ADD INDEX (level)";
364 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool ADD INDEX (data_type)";
365 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD UNIQUE KEY (module)";
366 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admin_menu ADD INDEX (action)";
367 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admin_menu ADD INDEX (what)";
368 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (task_type)";
369 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (status)";
370 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (task_created)";
371 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD FULLTEXT (subject)";
372 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (subject)";
373 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD INDEX (ext_active)";
374 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (status)";
375 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD FULLTEXT (family)";
376 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (max_mails)";
377 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (password)";
378 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (action)";
379 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (what)";
380 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (sort)";
381 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (visible)";
382 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (locked)";
383 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (what)";
384 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (sort)";
385 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (visible)";
386 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (locked)";
387 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats ADD INDEX (visible)";
388 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats ADD INDEX (sort)";
390 // Update notes (these will be set as task text!)
391 $UPDATE_NOTES = "Eindeutige Schlüssel (UNIQUE KEY) und normale Schlüssel (INDEX) gesetzt.";
394 case "0.3.2": // SQL queries for v0.3.2
395 // Connection table between the menu system and the "logical area" system
396 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
397 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_las (
398 id BIGINT(20) NOT NULL AUTO_INCREMENT,
399 la_id VARCHAR(255) NOT NULL DEFAULT '',
400 la_action VARCHAR(255) NOT NULL DEFAULT '',
401 la_what VARCHAR(255) NOT NULL DEFAULT '',
407 // All "logical areas" together
408 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
409 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_las_data (
410 id BIGINT(20) NOT NULL AUTO_INCREMENT,
411 la_id VARCHAR(255) NOT NULL DEFAULT '',
412 la_title VARCHAR(255) NOT NULL DEFAULT '',
413 la_posx BIGINT(20) NOT NULL DEFAULT '0',
414 la_posy BIGINT(20) NOT NULL DEFAULT '0',
420 // Which menu do you like?
421 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD admin_menu ENUM('NEW', 'OLD') NOT NULL DEFAULT 'OLD'";
424 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('setup', 'config_admin', 'Adminmenü', 'Diverse Einstellungen am Adminmenü vornehmen.', 9)";
426 // Update notes (these will be set as task text!)
427 $UPDATE_NOTES = "Logische Bereiche (Logical Areas = LAs) eingeführt. Dadurch wird das immer stärker anwachsende Admin-Menü in grosse Hauptgruppen unterteilt, wodurch ein Auffinden von Menüpunkten verbessert wird.";
430 case "0.3.3": // SQL queries for v0.3.3
431 // Switch of the "intelligent menu sorter" when you want to have a fixed menu structure...
432 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD admin_menu_sorter ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
434 // The statistics table
435 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
436 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_stats (
437 id BIGINT(20) NOT NULL AUTO_INCREMENT,
438 aid BIGINT(20) NOT NULL DEFAULT '0',
439 type ENUM('la', 'action', 'what') NOT NULL DEFAULT 'what',
440 clicks BIGINT(20) NOT NULL DEFAULT '0',
445 // Update notes (these will be set as task text!)
446 $UPDATE_NOTES = "Admin-abhängig werden nun Klicks im Admin-Menü gezählt, die zur automatischen Anpassung des Menüs in den logischen Bereichen diennen. Dieses "intelligente Unbauen" können Sie auch ganz abschalten.";
449 case "0.3.4": // SQL queries for v0.3.4
450 // List accounts with no referral
451 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('user', 'list_norefs', 'Mitglieder ohne Werber', 'Finden Sie hier alle Mitglieder-Accounts, die von niemandem ({--MAIN_TITLE--} wird in der Mail als Werber angegebenen) geworben wurden.', 7)";
453 // Update notes (these will be set as task text!)
454 $UPDATE_NOTES = "Fügt den Menüpunkt "Mitglieder ohne Werber" in die Mitglieder-Management hinzu. Mit dieser neuen Funktion können Sie nach Mitglieder-Accounts ohne Werber suchen. TODO-ID #2 CLOSED";
457 case "0.3.5": // SQL queries for v0.3.5
458 // List accounts with no referral
459 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('stats', NULL, 'Statistiken', 4, 'Y', 'N')";
460 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('stats', 'stats2', 'Framekiller-Mails', 2, 'Y', 'N')";
461 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('extras', NULL, 'Extras', 5, 'Y', 'N')";
462 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('rals', NULL, 'Rallyes', 6, 'Y', 'N')";
463 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('account', NULL, 'Ihr Account', 7, 'Y', 'N')";
464 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET sort='8' WHERE action='themes' LIMIT 1";
465 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='stats', sort='1', title='Klick-Mails' WHERE what='stats' LIMIT 1";
466 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='account', sort='1', title='Designs' WHERE what='themes' LIMIT 1";
467 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='extras', sort='3' WHERE what='reflinks' LIMIT 1";
469 // Update notes (these will be set as task text!)
470 $UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
473 case "0.3.6": // SQL queries for v0.3.6
474 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD salt_length TINYINT(3) NOT NULL DEFAULT '9'";
475 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD pass_scramble VARCHAR(255) NOT NULL DEFAULT ''";
476 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data MODIFY password VARCHAR(255) NOT NULL DEFAULT ''";
477 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data MODIFY user_hash VARCHAR(255) NOT NULL DEFAULT ''";
478 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins MODIFY password VARCHAR(255) NOT NULL DEFAULT ''";
479 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD rand_no BIGINT(20) NOT NULL DEFAULT '0'";
480 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD file_hash VARCHAR(255) NOT NULL DEFAULT ''";
481 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD master_salt VARCHAR(255) NOT NULL DEFAULT ''";
482 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET rand_no=(ROUND(RAND() * 99999) + 100000) WHERE config=0 LIMIT 1";
483 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD has_menu ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
484 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET has_menu='Y' WHERE module='admin' OR module='index' OR module='login' LIMIT 3";
486 // Update notes (these will be set as task text!)
487 $UPDATE_NOTES = "Passwort-System mit Zufallshash erweitert (Schutzt gegen Dictionary-Attacks!)";
490 case "0.3.7": // SQL queries for v0.3.7
491 $UPDATE_NOTES = "Problem während des Installationsvorganges behoben.";
494 case "0.3.8": // SQL queries for v0.3.8
495 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admin_menu CHANGE descr descr MEDIUMTEXT NULL";
496 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool CHANGE `text` `text` LONGTEXT NOT NULL";
498 // Update notes (these will be set as task text!)
499 $UPDATE_NOTES = "Beschreibungstexte für Admin-Menüs können länger sein. Diverse Fixes.";
502 case "0.3.9": // SQL queries for v0.3.9
503 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = REPLACE(title, '--POINTS--', '!POINTS!') WHERE title LIKE '%--POINTS--%'";
504 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET descr = REPLACE(descr, '--POINTS--', '!POINTS!') WHERE descr LIKE '%--POINTS--%'";
505 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET title = REPLACE(title, '--POINTS--', '!POINTS!') WHERE title LIKE '%--POINTS--%'";
506 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET title = REPLACE(title, '--POINTS--', '!POINTS!') WHERE title LIKE '%--POINTS--%'";
508 // Update notes (these will be set as task text!)
509 $UPDATE_NOTES = "Beschreibungstexte für Admin-Menüs können länger sein. Diverse Fixes.";
512 case "0.4.0": // SQL queries for v0.4.0
513 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Email-Management' WHERE action = 'email' AND (what='' OR what IS NULL) LIMIT 1";
515 // Update notes (these will be set as task text!)
516 $UPDATE_NOTES = "Email-Verwaltung nach Email-Management umbenannt.";
519 case "0.4.1": // SQL queries for v0.4.1
520 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status` , ADD INDEX `status` ( `status` , `max_mails` )";
521 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `show_timings` ENUM ('Y','N') NOT NULL DEFAULT 'Y'";
523 // Update notes (these will be set as task text!)
524 $UPDATE_NOTES = "Tabellen-Schlüssel neu gesetzt und Parsing-Zeit im Footer eingeblendet.";
527 case "0.4.2": // SQL queries for v0.4.2
528 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_online` ADD INDEX `admin_member` (`is_admin`, `is_member`)";
530 // Update notes (these will be set as task text!)
531 $UPDATE_NOTES = "Neuen Schlüssel zur Online-Tabelle hinzugefügt.";
534 case "0.4.3": // SQL queries for v0.4.3
535 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_host` VARCHAR(255) NOT NULL DEFAULT ''";
536 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_port` INT(5) UNSIGNED NOT NULL DEFAULT '0'";
537 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_username` VARCHAR(255) NOT NULL DEFAULT ''";
538 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_password` VARCHAR(255) NOT NULL DEFAULT ''";
539 $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önnen Sie hier MXChange so konfigurieren, dass es Updates durch diesen hindurch sucht!', 15)";
541 // Update notes (these will be set as task text!)
542 $UPDATE_NOTES = "Proxy-Einstellungen hinzugefügt.";
545 case "0.4.4": // SQL queries for v0.4.4
546 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
547 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
548 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
549 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what=NULL WHERE what=''";
550 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET what=NULL WHERE what=''";
551 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET what=NULL WHERE what=''";
552 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
553 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
554 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX `action` (`action`)";
555 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
557 // Update notes (these will be set as task text!)
558 $UPDATE_NOTES = "Schlüssel in Admin-, Gast- und Mitgliedsmenü verbessert.";
563 default: // Do stuff when extension is loaded
564 $dummy = LOAD_CONFIG();
566 // When the sql_patches is not installed we cannot load it's configuration... *sigh*
567 if (GET_EXT_VERSION("sql_patches") != '') {
568 $_CONFIG['secret_key'] = "";
569 //die("<pre>".print_r($dummy, true)."</pre>");
570 $_CONFIG = merge_array($_CONFIG, $dummy);
572 // Read key from secret file
573 if ((empty($_CONFIG['file_hash'])) || (empty($_CONFIG['master_salt'])) || (empty($_CONFIG['pass_scramble']))) {
574 // Maybe need setup of secret key!
575 require_once(PATH."inc/gen_sql_patches.php");
577 if (GET_EXT_VERSION("cache") >= "0.1.2") {
578 // Remove extensions and mod_reg cache file
579 require_once(PATH."inc/libs/cache_functions.php");
580 require_once(PATH."inc/extensions/ext-cache.php");
581 if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
582 if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy();
587 if ((!empty($_CONFIG['file_hash'])) && (!empty($_CONFIG['master_salt'])) && (!empty($_CONFIG['pass_scramble']))) {
588 // File hash fas generated so we can also file the secret file... hopefully.
589 if ((file_exists(PATH."inc/.secret/.".$_CONFIG['file_hash'])) && (is_readable(PATH."inc/.secret/.".$_CONFIG['file_hash']))) {
590 $_CONFIG['secret_key'] = implode("", file(PATH."inc/.secret/.".$_CONFIG['file_hash']));
592 // Cannot read secret file!
593 mxchange_die("Cannot read secret file!");
597 // Transfer words/numbers to constants
598 define('POINTS' , $dummy['points_word']);
599 define('MT_WORD' , $dummy['mt_word']);
600 define('MT_WORD2', $dummy['mt_word2']);
601 define('MT_WORD3', $dummy['mt_word3']);
602 define('_MAX' , $dummy['rand_no']);
604 // Set some lame ;-) default settings
605 $_CONFIG['def_refid'] = 0;
606 $_CONFIG['enable_title_deco'] = "N";
607 $_CONFIG['title_mod_show'] = "Y";
608 $_CONFIG['title_middle'] = "-";
609 //$_CONFIG['verbose_sql'] = "N";
610 define('MT_WORD' , DEFAULT_MT_WORD );
611 define('MT_WORD2', DEFAULT_MT_WORD2);
612 define('POINTS' , DEFAULT_POINTS);
615 // Remove dummy config array
620 // Language file prefix (hmmm, what shall I write with SQL fixes? ;-) )
621 $EXT_LANG_PREFIX = "sql_patches";
623 // Extension is always active?
624 $EXT_ALWAYS_ACTIVE = "Y";