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'])))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
42 $EXT_VERSION = "0.4.0";
44 // Auto-set extension version
45 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
47 // Version history array (add more with , "0.1" and so on)
48 $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");
50 switch ($EXT_LOAD_MODE)
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
53 // SQL commands to run
57 case "remove": // Do stuff when removing extension
58 // SQL commands to run
59 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE
60 (action='theme' AND (what='theme_import' OR what='theme_edit')) OR
61 what='config_extensions' OR
63 what='list_unconfirmed' OR
64 what='config_refid' OR
65 what='config_title' OR
67 what='config_admin' OR
68 what='list_norefs' LIMIT 12";
69 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
70 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE action='themes' LIMIT 1";
71 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE
74 (action='stats' AND what='') OR
75 (action='extras' AND what='') OR
76 (action='rals' AND what='') OR
77 (action='account' AND what='') LIMIT 7";
78 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='main' WHERE
83 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
84 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
85 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
88 case "activate": // Do stuff when admin activates this extension
89 // SQL commands to run
93 case "deactivate": // Do stuff when admin deactivates this extension
94 // SQL commands to run
98 case "update": // Update an extension
101 case "0.0.1": // SQL queries for v0.0.1
102 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD ext_autopurge enum('Y', 'N') not null default 'Y'";
103 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('setup', 'config_extensions', 'Erweitungsmanagement', 'Alle Einstellungen am Erweiterungsmanagement.', 10)";
105 // Update notes (these will be set as task text!)
106 $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.";
109 case "0.0.2": // SQL queries for v0.0.2
110 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config CHANGE auto_purge auto_purge bigint(20) not null default '1209600'";
112 // Update notes (these will be set as task text!)
113 $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.)";
116 case "0.0.3": // SQL queries for v0.0.3
117 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD points_word varchar(255) not null default 'Punkte'";
119 // Update notes (these will be set as task text!)
120 $UPDATE_NOTES = "Das Wort "Punkte" kann nun per Datenbank geändert werden. Damit können Sie anstelle des Wortes Punkte auch Klammlose oder € schreiben.";
123 case "0.0.4": // SQL queries for v0.0.4
124 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mails_page bigint(20) not null default '10'";
126 // Update notes (these will be set as task text!)
127 $UPDATE_NOTES = "Anzahl Mails pro Seite in <STRONG>EMail-Details ansehen</STRONG> und <STRONG>EMail-Archiv</STRONG> hinzugefügt.";
130 case "0.0.5": // SQL queries for v0.0.5
131 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD index_home varchar(255) not null default 'welcome'";
132 $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)";
134 // Update notes (these will be set as task text!)
135 $UPDATE_NOTES = "Die what-welcome.php ist derzeit die "Home"-Seite (Eingangsseite). Dies kann nun per Datenbank geändert werden.";
138 case "0.0.6": // SQL queries for v0.0.6
139 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD ext_has_css enum('Y', 'N') not null default 'N'";
141 // Update notes (these will be set as task text!)
142 $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.";
145 case "0.0.7": // SQL queries for v0.0.7
146 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD verbose_sql enum('Y', 'N') not null default 'Y'";
148 // Update notes (these will be set as task text!)
149 $UPDATE_NOTES = "Die SQL-Anweisungen werden bei eingeschalteter Verbose-Funktion detailiert angezeigt.";
152 case "0.0.8": // SQL queries for v0.0.8
153 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD menu_blur_spacer varchar(255) not null default ' <STRONG><BIG>·</BIG></STRONG> '";
155 // Update notes (these will be set as task text!)
156 $UPDATE_NOTES = "Nette Mouse-Hover-Effekte eingebaut (Anleitung <STRONG>MENUE_HOVER.txt</STRONG> zum Patchen der general.css bitte lesen!)";
159 case "0.0.9": // SQL queries for v0.0.9
160 $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)";
162 // Update notes (these will be set as task text!)
163 $UPDATE_NOTES = "Unbestätigte Maillinks können unter Email-Management -> Unbest. Mails auflisten aufgelistet werden.";
166 case "0.1.0": // SQL queries for v0.1.0
167 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD reg_points_mode enum('ref', 'direct') not null default 'ref'";
169 // Update notes (these will be set as task text!)
170 $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?";
173 case "0.1.1": // SQL queries for v0.1.1
174 $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";
175 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD index_delay tinyint(4) not null default '-1'";
176 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD index_cookie bigint(20) not null default '31536000'";
178 // Update notes (these will be set as task text!)
179 $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.";
182 case "0.1.2": // SQL queries for v0.1.2
183 $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)";
184 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD def_refid bigint(20) not null default '0'";
186 // Update notes (these will be set as task text!)
187 $UPDATE_NOTES = "Standart Referral-ID kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)";
190 case "0.1.3": // SQL queries for v0.1.3
191 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD refid_target enum('register', 'index') not null default 'register'";
193 // Update notes (these will be set as task text!)
194 $UPDATE_NOTES = "Auf welche Seite soll der Ref-Link zeigen? Eingangsseite oder Anmeldeformular?";
197 case "0.1.4": // SQL queries for v0.1.4
198 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD default_theme varchar(255) not null default '".GET_CURR_THEME()."'";
199 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='theme' LIMIT 3";
200 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('theme', '', 'Themes', 'Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)";
201 $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)";
202 $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)";
203 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (action, what, title, sort, visible, locked) VALUES ('themes', '', 'Design-Auswahl', 4, 'Y', 'N')";
204 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('themes', '', 'Design-Auswahl', 3, 'Y', 'N')";
205 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
206 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes (
207 id bigint(20) not null auto_increment,
208 theme_path varchar(255) not null default '',
209 theme_active enum('Y', 'N') not null default 'N',
210 theme_ver varchar(255) not null default '0.0',
214 // Update notes (these will be set as task text!)
215 $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!";
218 case "0.1.5": // SQL queries for v0.1.5
219 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP ext_has_admin";
221 // Update notes (these will be set as task text!)
222 $UPDATE_NOTES = "Spalte <U>ext_has_admin</U> aus der Tabelle <U>"._MYSQL_PREFIX."_extensions</U> entfernt, da sie keinen Sinn mehr macht.";
225 case "0.1.6": // SQL queries for v0.1.6
226 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD enable_title_deco enum('Y', 'N') not null default 'Y'";
227 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD title_left varchar(10) not null default '[--'";
228 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD title_middle varchar(10) not null default '-'";
229 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD title_right varchar(10) not null default '--]'";
230 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD enable_mod_title enum('Y', 'N') not null default 'Y'";
231 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD enable_what_title enum('Y', 'N') not null default 'Y'";
232 $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)";
234 // Update notes (these will be set as task text!)
235 $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.";
238 case "0.1.7": // SQL queries for v0.1.7
239 // Update notes (these will be set as task text!)
240 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
243 case "0.1.8": // SQL queries for v0.1.8
244 // Update notes (these will be set as task text!)
245 $UPDATE_NOTES = "mad_counter und last_mad werden nun aus der Datenbank geladen";
248 case "0.1.9": // SQL queries for v0.1.9
249 // Update notes (these will be set as task text!)
250 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
253 case "0.2.0": // SQL queries for v0.2.0
254 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_jackpot CHANGE points points double(22,5) not null default '0.00000'";
256 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payments CHANGE payment payment double(22,5) not null default '0.00000'";
257 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payments CHANGE price price double(22,5) not null default '0.00000'";
259 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE used_points used_points double(22,5) not null default '0.00000'";
260 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_points CHANGE points points double(22,5) not null default '0.00000'";
261 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_points CHANGE locked_points locked_points double(22,5) not null default '0.00000'";
263 // Update notes (these will be set as task text!)
264 $UPDATE_NOTES = "5 Nachkommastellen implementiert";
267 case "0.2.1": // SQL queries for v0.2.1
268 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD css_php enum('DIRECT', 'FILE') not null default 'FILE'";
270 // Update notes (these will be set as task text!)
271 $UPDATE_NOTES = "Ausgabe der CSS-Dateien entweder per css.php oder sie sind direkt eingebunden.";
274 case "0.2.2": // SQL queries for v0.2.2
275 // Update notes (these will be set as task text!)
276 $UPDATE_NOTES = "Erweiterung bleibt wegen integrierten Schalters immer aktiv.";
279 case "0.2.3": // SQL queries for v0.2.3
280 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD guest_menu enum('Y', 'N') not null default 'Y'";
281 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD member_menu enum('Y', 'N') not null default 'Y'";
282 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD youre_here enum('Y', 'N') not null default 'Y'";
284 // Update notes (these will be set as task text!)
285 $UPDATE_NOTES = "Gast- und Mitgliedsmenüs lassen sich getrennt voneinander abschalten.";
288 case "0.2.4": // SQL queries for v0.2.4
289 $auto_type = "png"; // PNG image is the default
290 if ((file_exists(PATH."theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg'))
292 // Switch to JPEG format
295 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD img_type enum('jpg', 'png') not null default '".$auto_type."'";
297 // Update notes (these will be set as task text!)
298 $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.";
301 case "0.2.5": // SQL queries for v0.2.5
302 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE receive_mails receive_mails bigint(20) not null default '0'";
303 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE max_mails max_mails bigint(20) not null default '0'";
305 // Update notes (these will be set as task text!)
306 $UPDATE_NOTES = "Spalten <U>max_mails</U> und <U>receive_mails</U> auf bigint(20) gesetzt.";
309 case "0.2.6": // SQL queries for v0.2.6
310 $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)";
312 // Update notes (these will be set as task text!)
313 $UPDATE_NOTES = "Abzug von {!POINTS!} nun möglich.";
316 case "0.2.7": // SQL queries for v0.2.7
317 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort) VALUES ('main', 'themes', 'Designs', 6)";
318 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD curr_theme varchar(255) not null default 'default'";
319 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD stats_limit bigint(20) not null default '10'";
320 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='config_stats' WHERE what='stats' LIMIT 1";
322 // Update notes (these will be set as task text!)
323 $UPDATE_NOTES = "<OL>
324 <LI>Das Mitglied kann das derzeitige Design in sein Profil abspeichern.</LI>
325 <LI>Mitgliederstatistik mit Seitennavigation.</LI>
329 case "0.2.8": // SQL queries for v0.2.8
330 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD last_login varchar(10) not null default '0'";
332 // Update notes (these will be set as task text!)
333 $UPDATE_NOTES = "Letzter Login wird gespeichert, Cache wird bei installierter Cache-Erweiterung bei Sprachenänderung aufgefrischt.";
336 case "0.2.9": // SQL queries for v0.2.9
337 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mt_word varchar(255) not null default 'Mailtausch'";
338 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mt_word2 varchar(255) not null default 'Mailtausches'";
339 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD mt_word3 varchar(255) not null default 'Mailtauscher'";
341 // Update notes (these will be set as task text!)
342 $UPDATE_NOTES = "Wörter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
345 case "0.3.0": // SQL queries for v0.3.0
346 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='{!POINTS!}/Referral-Ebenen' WHERE what='config_points' LIMIT 1";
347 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='Mailvergütungen...' WHERE what='payments' LIMIT 1";
349 // Update notes (these will be set as task text!)
350 $UPDATE_NOTES = "Zwei Menüpunkte umbenannt.";
353 case "0.3.1": // SQL queries for v0.3.1
354 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD UNIQUE KEY (ext_name)";
355 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD UNIQUE KEY (theme_path)";
356 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD INDEX (theme_active)";
357 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD UNIQUE KEY (login)";
358 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (status)";
359 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner ADD INDEX (visible)";
360 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths ADD UNIQUE KEY (level)";
361 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem ADD INDEX (level)";
362 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool ADD INDEX (data_type)";
363 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD UNIQUE KEY (module)";
364 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admin_menu ADD INDEX (action)";
365 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admin_menu ADD INDEX (what)";
366 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (task_type)";
367 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (status)";
368 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (task_created)";
369 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD FULLTEXT (subject)";
370 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system ADD INDEX (subject)";
371 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD INDEX (ext_active)";
372 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (status)";
373 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD FULLTEXT (family)";
374 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (max_mails)";
375 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD INDEX (password)";
376 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (action)";
377 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (what)";
378 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (sort)";
379 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (visible)";
380 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_guest_menu ADD INDEX (locked)";
381 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (what)";
382 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (sort)";
383 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (visible)";
384 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_member_menu ADD INDEX (locked)";
385 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats ADD INDEX (visible)";
386 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats ADD INDEX (sort)";
388 // Update notes (these will be set as task text!)
389 $UPDATE_NOTES = "Eindeutige Schlüssel (UNIQUE KEY) und normale Schlüssel (INDEX) gesetzt.";
392 case "0.3.2": // SQL queries for v0.3.2
393 // Connection table between the menu system and the "logical area" system
394 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
395 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_las (
396 id bigint(20) not null auto_increment,
397 la_id varchar(255) not null default '',
398 la_action varchar(255) not null default '',
399 la_what varchar(255) not null default '',
405 // All "logical areas" together
406 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
407 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_las_data (
408 id bigint(20) not null auto_increment,
409 la_id varchar(255) not null default '',
410 la_title varchar(255) not null default '',
411 la_posx bigint(20) not null default '0',
412 la_posy bigint(20) not null default '0',
418 // Which menu do you like?
419 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD admin_menu enum('NEW', 'OLD') not null default 'OLD'";
422 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('setup', 'config_admin', 'Adminmenü', 'Diverse Einstellungen am Adminmenü vornehmen.', 9)";
424 // Update notes (these will be set as task text!)
425 $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.";
428 case "0.3.3": // SQL queries for v0.3.3
429 // Switch of the "intelligent menu sorter" when you want to have a fixed menu structure...
430 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD admin_menu_sorter enum('Y', 'N') not null default 'Y'";
432 // The statistics table
433 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
434 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admin_menu_stats (
435 id bigint(20) not null auto_increment,
436 aid bigint(20) not null default '0',
437 type enum('la', 'action', 'what') not null default 'what',
438 clicks bigint(20) not null default '0',
443 // Update notes (these will be set as task text!)
444 $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.";
447 case "0.3.4": // SQL queries for v0.3.4
448 // List accounts with no referral
449 $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)";
451 // Update notes (these will be set as task text!)
452 $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";
455 case "0.3.5": // SQL queries for v0.3.5
456 // List accounts with no referral
457 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('stats', '', 'Statistiken', 4, 'Y', 'N')";
458 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('stats', 'stats2', 'Framekiller-Mails', 2, 'Y', 'N')";
459 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('extras', '', 'Extras', 5, 'Y', 'N')";
460 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('rals', '', 'Rallyes', 6, 'Y', 'N')";
461 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('account', '', 'Ihr Account', 7, 'Y', 'N')";
462 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET sort='8' WHERE action='themes' LIMIT 1";
463 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='stats', sort='1', title='Klick-Mails' WHERE what='stats' LIMIT 1";
464 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='account', sort='1', title='Designs' WHERE what='themes' LIMIT 1";
465 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='extras', sort='3' WHERE what='reflinks' LIMIT 1";
467 // Update notes (these will be set as task text!)
468 $UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
471 case "0.3.6": // SQL queries for v0.3.6
472 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD salt_length tinyint(4) not null default '9'";
473 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD pass_scramble varchar(255) not null default ''";
474 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data MODIFY password varchar(255) not null default ''";
475 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data MODIFY user_hash varchar(255) not null default ''";
476 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins MODIFY password varchar(255) not null default ''";
477 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD rand_no bigint(20) not null default '0'";
478 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD file_hash varchar(255) not null default ''";
479 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD master_salt varchar(255) not null default ''";
480 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET rand_no=(ROUND(RAND() * 99999) + 100000) WHERE config='0' LIMIT 1";
481 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD has_menu enum('Y', 'N') NOT NULL default 'N'";
482 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET has_menu='Y' WHERE module='admin' OR module='index' OR module='login' LIMIT 3";
484 // Update notes (these will be set as task text!)
485 $UPDATE_NOTES = "Passwort-System mit Zufallshash erweitert (Schutzt gegen Dictionary-Attacks!)";
488 case "0.3.7": // SQL queries for v0.3.7
489 $UPDATE_NOTES = "Problem während des Installationsvorganges behoben.";
492 case "0.3.8": // SQL queries for v0.3.8
493 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admin_menu CHANGE descr descr MEDIUMTEXT NULL";
494 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool CHANGE `text` `text` LONGTEXT NOT NULL";
496 // Update notes (these will be set as task text!)
497 $UPDATE_NOTES = "Beschreibungstexte für Admin-Menüs können länger sein. Diverse Fixes.";
500 case "0.3.9": // SQL queries for v0.3.9
501 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = REPLACE(title, '--POINTS--', '!POINTS!') WHERE title LIKE '%--POINTS--%'";
502 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET descr = REPLACE(descr, '--POINTS--', '!POINTS!') WHERE descr LIKE '%--POINTS--%'";
503 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET title = REPLACE(title, '--POINTS--', '!POINTS!') WHERE title LIKE '%--POINTS--%'";
504 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET title = REPLACE(title, '--POINTS--', '!POINTS!') WHERE title LIKE '%--POINTS--%'";
506 // Update notes (these will be set as task text!)
507 $UPDATE_NOTES = "Beschreibungstexte für Admin-Menüs können länger sein. Diverse Fixes.";
510 case "0.4.0": // SQL queries for v0.4.0
511 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Email-Management' WHERE action = 'email' AND what='' LIMIT 1";
513 // Update notes (these will be set as task text!)
514 $UPDATE_NOTES = "Email-Verwaltung nach Email-Management umbenannt.";
519 default: // Do stuff when extension is loaded
520 $DUMMY = LOAD_CONFIG("0");
522 // When the sql_patches is not installed we cannot load it's configuration... *sigh*
523 if (GET_EXT_VERSION("sql_patches") != "") {
524 $CONFIG['ext_autopurge'] = $DUMMY['ext_autopurge'];
525 $CONFIG['mails_page'] = $DUMMY['mails_page'];
526 $CONFIG['index_home'] = $DUMMY['index_home'];
527 $CONFIG['verbose_sql'] = $DUMMY['verbose_sql'];
528 $CONFIG['middot'] = $DUMMY['menu_blur_spacer'];
529 $CONFIG['reg_points_mode'] = $DUMMY['reg_points_mode'];
530 $CONFIG['index_delay'] = $DUMMY['index_delay'];
531 $CONFIG['index_cookie'] = $DUMMY['index_cookie'];
532 $CONFIG['def_refid'] = $DUMMY['def_refid'];
533 $CONFIG['refid_target'] = $DUMMY['refid_target'];
534 $CONFIG['default_theme'] = $DUMMY['default_theme'];
535 $CONFIG['title_decoration'] = $DUMMY['enable_title_deco'];
536 $CONFIG['title_mod_show'] = $DUMMY['enable_mod_title'];
537 $CONFIG['title_what_show'] = $DUMMY['enable_what_title'];
538 $CONFIG['title_left'] = $DUMMY['title_left'];
539 $CONFIG['title_middle'] = $DUMMY['title_middle'];
540 $CONFIG['title_right'] = $DUMMY['title_right'];
541 $CONFIG['mad_counter'] = $DUMMY['mad_count'];
542 $CONFIG['last_mad'] = $DUMMY['mad_timestamp'];
543 $CONFIG['css_php'] = $DUMMY['css_php'];
544 $CONFIG['guest_menu'] = $DUMMY['guest_menu'];
545 $CONFIG['member_menu'] = $DUMMY['member_menu'];
546 $CONFIG['youre_here'] = $DUMMY['youre_here'];
547 $CONFIG['img_type'] = $DUMMY['img_type'];
548 $CONFIG['stats_limit'] = $DUMMY['stats_limit'];
549 $CONFIG['admin_menu'] = $DUMMY['admin_menu'];
550 $CONFIG['admin_menu_sorter'] = $DUMMY['admin_menu_sorter'];
551 $CONFIG['salt_length'] = $DUMMY['salt_length'];
552 $CONFIG['pass_scramble'] = trim($DUMMY['pass_scramble']);
553 $CONFIG['file_hash'] = trim($DUMMY['file_hash']);
554 $CONFIG['master_salt'] = trim($DUMMY['master_salt']);
555 $CONFIG['secret_key'] = "";
557 // Read key from secret file
558 if ((empty($CONFIG['file_hash'])) || (empty($CONFIG['master_salt'])) || (empty($CONFIG['pass_scramble'])))
560 // Maybe need setup of secret key!
561 require_once(PATH."inc/gen_sql_patches.php");
563 if (GET_EXT_VERSION("cache") >= "0.1.2")
565 // Remove extensions and mod_reg cache file
566 require_once(PATH."inc/libs/cache_functions.php");
567 require_once(PATH."inc/extensions/ext-cache.php");
568 if ($CACHE->cache_file("extensions", true)) $CACHE->cache_destroy();
569 if ($CACHE->cache_file("mod_reg", true)) $CACHE->cache_destroy();
574 if ((!empty($CONFIG['file_hash'])) && (!empty($CONFIG['master_salt'])) && (!empty($CONFIG['pass_scramble'])))
576 // File hash fas generated so we can also file the secret file... hopefully.
577 if ((file_exists(PATH."inc/.secret/.".$CONFIG['file_hash'])) && (is_readable(PATH."inc/.secret/.".$CONFIG['file_hash'])))
579 $CONFIG['secret_key'] = implode("", file(PATH."inc/.secret/.".$CONFIG['file_hash']));
583 // Cannot read secret file!
584 die("Cannot read secret file!");
588 // Transfer words/numbers to constants
589 define('POINTS' , $DUMMY['points_word']);
590 define('MT_WORD' , $DUMMY['mt_word']);
591 define('MT_WORD2', $DUMMY['mt_word2']);
592 define('MT_WORD3', $DUMMY['mt_word3']);
593 define('_MAX' , $DUMMY['rand_no']);
595 // Set some lame ;-) default settings
596 $CONFIG['def_refid'] = 0;
597 $CONFIG['title_decoration'] = "N";
598 $CONFIG['title_mod_show'] = "Y";
599 $CONFIG['title_middle'] = "-";
600 //$CONFIG['verbose_sql'] = "N";
601 define('MT_WORD' , DEFAULT_MT_WORD );
602 define('MT_WORD2', DEFAULT_MT_WORD2);
603 define('POINTS' , DEFAULT_POINTS);
606 // Remove dummy config array
611 // Language file prefix (hmmm, what shall I write with SQL fixes? ;-) )
612 $EXT_LANG_PREFIX = "sql_patches";
614 // Extension is always active?
615 $EXT_ALWAYS_ACTIVE = "Y";