Several fixes for UTF-8, ext-network continued (still unfinished)
[mailer.git] / inc / extensions / ext-order.php
index ff17638453563a78b33d7bd9dbfac596e0af602c..953aa29a1a0c63ab48f348b3d54227a7dbe615a8 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Ausgelagertes Buchungssytem fuer PRO-Version     *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-}
+       die();
+} // END - if
 
 // Version number
-$EXT_VERSION = "0.5.0";
-
-// Auto-set extension version
-if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
-
-// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.1", "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");
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "remove": // Do stuff when removing extension
-       // SQL commands to run
-       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_order' LIMIT 1";
-       break;
-
-case "activate": // Do stuff when admin activates this extension
-       // SQL commands to run
-       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y', locked='N' WHERE what='order' LIMIT 1";
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='order' LIMIT 1";
-       break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
-       // SQL commands to run
-       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET visible='N', locked='Y' WHERE module='order' LIMIT 1";
-       break;
-
-case "update": // Update an extension
-       switch ($EXT_VER)
-       {
-       case "0.1": // SQL queries for v0.1
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'";
-               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.";
-               break;
-
-       case "0.1.1": // SQL queries for v0.1.1
-               $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_order' LIMIT 1";
-               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD mail_orders BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).";
-               break;
-
-       case "0.1.3": // SQL queries for v0.1.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Maximale Mailbuchungen repariert (werden nun hochgezählt und bei täglichem Reset auf 0 gesetzt).";
-               break;
-
-       case "0.1.4": // SQL queries for v0.1.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Dummy-Datenfeld wird wieder gel&ouml;scht, um Probleme zu vermeiden. Fehlende Spalte <I>mail_order</I> korregiert auf <I>mail_orders</I>.";
-               break;
-
-       case "0.1.5": // SQL queries for v0.1.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
-               break;
-
-       case "0.1.6": // SQL queries for v0.1.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
-               break;
-
-       case "0.1.7": // SQL queries for v0.1.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
-               break;
-
-       case "0.1.8": // SQL queries for v0.1.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
-               break;
-
-       case "0.1.9": // SQL queries for v0.1.9
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
-               break;
-
-       case "0.2.0": // SQL queries for v0.2.0
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Seit <A href=\"#\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
-               break;
-
-       case "0.2.1": // SQL queries for v0.2.1
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Templates <U>member_frameset-back.tpl</U> und <U>member_frameset-send.tpl</U> nach <U>member_order_back.tpl</U> und <U>member_order_send.tpl</U> umbenannt.";
-               break;
-
-       case "0.2.2": // SQL queries for v0.2.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Es wird nun &uuml;berpr&uuml;ft ob auch gen&uuml;gend Empf&auml;nger eingegeben worden sind und ob auch gen&uuml;gend empfangsbereit sind.";
-               break;
-
-       case "0.2.3": // SQL queries for v0.2.3
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger";
-               break;
-
-       case "0.2.4": // SQL queries for v0.2.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Anzahl mindestens einszustellende Empf&auml;nger wird nun auch angezeigt.";
-               break;
-
-       case "0.2.5": // SQL queries for v0.2.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Speicherung der Einstellungen klappt.";
-               break;
-
-       case "0.2.6": // SQL queries for v0.2.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler in Mailbuchung behoben: Es wurde beim Ermitteln der n&ouml;tigen {!POINTS!} die maximale Anzahl von Usern in der Kategorie gew&auml;hlt und
-nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User h&auml;tte nicht gen&uuml;gend {!POINTS!} auf dem Konto. Ein Rechenbeispiel:
-<OL>
-  <LI>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</LI>
-  <LI>Es stellt die Mailart <U>&quot;3 {!POINTS!} Kosten / Mail&quot;</U> ein.</LI>
-  <LI>Es hat aber nur {!POINTS!} f&uuml;r 10 Empf&auml;nger und gibt 10 ein.</LI>
-  <LI>Das Script hatte bis zu dieser Version 3 {!POINTS!} * <U>15</U> = 45 {!POINTS!} gerechnet, hat das Mitglied mehr oder gleich 45 {!POINTS!}, fiehl dieser Fehler nicht
-  auf.</LI>
-  <LI>Hatte es aber, wie hier im Beispiel 31 {!POINTS!}, konnte es nicht mehr buchen.</LI>
-  <LI>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</LI>
-</OL>";
-               break;
-
-       case "0.2.7": // SQL queries for v0.2.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler mit <U>__MIN_VALUE</U> behoben.";
-               break;
-
-       case "0.2.8": // SQL queries for v0.2.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Konstantenproblem beseitigt.";
-               break;
-
-       case "0.2.9": // SQL queries for v0.2.9
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Problem mit nicht funktionierenden Mailbuchungen beseitigt.";
-               break;
+setThisExtensionVersion('0.5.1');
 
-       case "0.3.0": // SQL queries for v0.3.0
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Basis-Modul <STRONG>order.php</STRONG> abgesichert, wenn Erweiterung nicht aktiviert ist.";
-               break;
-
-       case "0.3.1": // SQL queries for v0.3.1
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'";
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Beworbene URL wird nun getestet.";
-               break;
-
-       case "0.3.2": // SQL queries for v0.3.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Datumsformat festgelegt auf ausf&uuml;hrlich.";
-               break;
+// Version history array (add more with , '0.1.0' and so on)
+setExtensionVersionHistory(array('0.0', '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'));
 
-       case "0.3.3": // SQL queries for v0.3.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Unter <STRONG>Einstellungen - Mailbuchungsseite</STRONG> war immer die Tabellenspalte <STRONG>Mitgliedsnummer</STRONG> ausgew&auml;hlt.";
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.3.4": // SQL queries for v0.3.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Dateiamenskonflikt zwischen den Erweiterungen <STRONG>support</STRONG> und <STRONG>order</STRONG> behoben.";
-               break;
-
-       case "0.3.5": // SQL queries for v0.3.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Das Mitglied konnte geziehlt die Anzahl Mailbuchungen durch Abspeichern seines Profiles beeinflussen. Der Fehler war eine falsche Tabellenspalte. Dies war <STRONG>max_mails</STRONG>, die durch das Mitglieder ver&auml;nderbar ist und zur Festellung der Maximalen Mailbuchungen herangezogen wurde.";
-               break;
-
-       case "0.3.6": // SQL queries for v0.3.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Im Modul order (<STRONG>inc/modules/order.php</STRONG>) wurde fehlerhafterweise die Erweiterung <STRONG>beg</STRONG> getestet.";
-               break;
-
-       case "0.3.7": // SQL queries for v0.3.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.";
-               break;
-
-       case "0.3.8": // SQL queries for v0.3.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Mailbuchungsseite korregiert.";
-               break;
-
-       case "0.3.9": // SQL queries for v0.3.9
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Erneuten Fehler in Mailbuchungsseite behoben.";
-               break;
-
-       case "0.4.0": // SQL queries for v0.4.0
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = POINTS."-Abzug klappt wieder. Danke an Andreman!";
-               break;
-
-       case "0.4.1": // SQL queries for v0.4.1
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
-               break;
-
-       case "0.4.2": // SQL queries for v0.4.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
-               break;
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='order' LIMIT 1");
+               break;
+
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' LIMIT 1");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `hidden`='N', `locked`='N', `admin_only`='N', `mem_only`='Y' WHERE `module`='order' LIMIT 1");
+               break;
+
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='order' LIMIT 1");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `hidden`='Y', `locked`='Y' WHERE `module`='order' LIMIT 1");
+               break;
+
+       case 'update': // Update an extension
+               switch (getCurrentExtensionVersion()) {
+                       case '0.1.0': // SQL queries for v0.1
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'");
+                               addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Maximale Mailbuchungen sind nun vom maximalen Empfang abh&auml;gig.");
+                               break;
+
+                       case '0.1.1': // SQL queries for v0.1.1
+                               // OLD QUERIES: addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
+                               // OLD QUERIES: addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Maximale Mailbuchung vervollst&auml;ndigt (Admin-Bereich und im Buchungsformular selber).");
+                               break;
+
+                       case '0.1.3': // SQL queries for v0.1.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Maximale Mailbuchungen repariert (werden nun hochgez&auml;hlt und bei t&auml;glichem Reset auf 0 gesetzt).");
+                               break;
+
+                       case '0.1.4': // SQL queries for v0.1.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Dummy-Datenfeld wird wieder gel&ouml;scht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.");
+                               break;
+
+                       case '0.1.5': // SQL queries for v0.1.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.1.6': // SQL queries for v0.1.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.1.7': // SQL queries for v0.1.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.1.8': // SQL queries for v0.1.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
+                               break;
+
+                       case '0.1.9': // SQL queries for v0.1.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
+                               break;
+
+                       case '0.2.0': // SQL queries for v0.2.0
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
+                               break;
+
+                       case '0.2.1': // SQL queries for v0.2.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Templates <u>member_frameset-back.tpl</u> und <u>member_frameset-send.tpl</u> nach <u>member_order_back.tpl</u> und <u>member_order_send.tpl</u> umbenannt.");
+                               break;
+
+                       case '0.2.2': // SQL queries for v0.2.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Es wird nun &uuml;berpr&uuml;ft ob auch gen&uuml;gend Empf&auml;nger eingegeben worden sind und ob auch gen&uuml;gend empfangsbereit sind.");
+                               break;
+
+                       case '0.2.3': // SQL queries for v0.2.3
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger");
+                               break;
+
+                       case '0.2.4': // SQL queries for v0.2.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Anzahl mindestens einszustellende Empf&auml;nger wird nun auch angezeigt.");
+                               break;
+
+                       case '0.2.5': // SQL queries for v0.2.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Speicherung der Einstellungen klappt.");
+                               break;
+
+                       case '0.2.6': // SQL queries for v0.2.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler in Mailbuchung behoben: Es wurde beim Ermitteln der n&ouml;tigen {?POINTS?} die maximale Anzahl von Usern in der Kategorie gew&auml;hlt und
+nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User h&auml;tte nicht gen&uuml;gend {?POINTS?} auf dem Konto. Ein Rechenbeispiel:
+<ol>
+  <li>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</li>
+  <li>Es stellt die Mailart <u>&quot;3 {?POINTS?} Kosten / Mail&quot;</u> ein.</li>
+  <li>Es hat aber nur {?POINTS?} f&uuml;r 10 Empf&auml;nger und gibt 10 ein.</li>
+  <li>Das Script hatte bis zu dieser Version 3 {?POINTS?} * <u>15</u> = 45 {?POINTS?} gerechnet, hat das Mitglied mehr oder gleich 45 {?POINTS?}, fiehl dieser Fehler nicht
+  auf.</li>
+  <li>Hatte es aber, wie hier im Beispiel 31 {?POINTS?}, konnte es nicht mehr buchen.</li>
+  <li>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</li>
+</ol>");
+                               break;
+
+                       case '0.2.7': // SQL queries for v0.2.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler mit <u>__MIN_VALUE</u> behoben.");
+                               break;
+
+                       case '0.2.8': // SQL queries for v0.2.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Konstantenproblem beseitigt.");
+                               break;
+
+                       case '0.2.9': // SQL queries for v0.2.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Problem mit nicht funktionierenden Mailbuchungen beseitigt.");
+                               break;
+
+                       case '0.3.0': // SQL queries for v0.3.0
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Basis-Modul <strong>order.php</strong> abgesichert, wenn Erweiterung nicht aktiviert ist.");
+                               break;
+
+                       case '0.3.1': // SQL queries for v0.3.1
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'");
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Beworbene URL wird nun getestet.");
+                               break;
+
+                       case '0.3.2': // SQL queries for v0.3.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Datumsformat festgelegt auf ausf&uuml;hrlich.");
+                               break;
+
+                       case '0.3.3': // SQL queries for v0.3.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Unter <strong>Einstellungen - Mailbuchungsseite</strong> war immer die Tabellenspalte <strong>Mitgliedsnummer</strong> ausgew&auml;hlt.");
+                               break;
+
+                       case '0.3.4': // SQL queries for v0.3.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Dateiamenskonflikt zwischen den Erweiterungen <strong>support</strong> und <strong>order</strong> behoben.");
+                               break;
+
+                       case '0.3.5': // SQL queries for v0.3.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Das Mitglied konnte geziehlt die Anzahl Mailbuchungen durch Abspeichern seines Profiles beeinflussen. Der Fehler war eine falsche Tabellenspalte. Dies war <strong>max_mails</strong>, die durch das Mitglieder ver&auml;nderbar ist und zur Festellung der Maximalen Mailbuchungen herangezogen wurde.");
+                               break;
+
+                       case '0.3.6': // SQL queries for v0.3.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Im Modul order (<strong>inc/modules/order.php</strong>) wurde fehlerhafterweise die Erweiterung <strong>beg</strong> getestet.");
+                               break;
+
+                       case '0.3.7': // SQL queries for v0.3.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.");
+                               break;
+
+                       case '0.3.8': // SQL queries for v0.3.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Mailbuchungsseite korregiert.");
+                               break;
+
+                       case '0.3.9': // SQL queries for v0.3.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Erneuten Fehler in Mailbuchungsseite behoben.");
+                               break;
+
+                       case '0.4.0': // SQL queries for v0.4.0
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("{?POINTS?}-Abzug klappt wieder. Danke an Andreman!");
+                               break;
+
+                       case '0.4.1': // SQL queries for v0.4.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
+                               break;
+
+                       case '0.4.2': // SQL queries for v0.4.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
+                               break;
+
+                       case '0.4.3': // SQL queries for v0.4.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Neue Urlaubsschaltung mit integriert.");
+                               break;
+
+                       case '0.4.4': // SQL queries for v0.4.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Ein <strong>WHERE &#96;ext_active&#96;='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
+                               break;
+
+                       case '0.4.5': // SQL queries for v0.4.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("De-/Aktivieren des mit dieser Erweiterung verkn&uuml;pften Modules eingebunden.");
+                               break;
+
+                       case '0.4.6': // SQL queries for v0.4.6
+                               addMemberMenuSql('order',NULL,'Mailbuchungen','N','Y',3);
+                               addMemberMenuSql('order','order2','Framekiller-Mails','N','Y',2);
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='order', `sort`=1, `title`='Klick-Mails' WHERE `what`='order' LIMIT 1");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
+                               break;
+
+                       case '0.4.7': // SQL queries for v0.4.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
+                               break;
+
+                       case '0.4.8': // SQL queries for v0.4.8
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Mailbuchung' WHERE `what`='config_order' LIMIT 1");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.");
+                               break;
+
+                       case '0.4.9': // SQL queries for v0.4.9
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Bei L&ouml;schung von Mailbuchungen kann nun global entschieden werden (Einstellungen also), ob die verbliebenen {?POINTS?} wieder gutgeschrieben werden sollen oder in den Jackpot landen.");
+                               break;
+
+                       case '0.5.0': // SQL queries for v0.5.0
+                               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_url_blacklist`");
+                               addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_url_blacklist` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`url` VARCHAR(255) NOT NULL DEFAULT '',
+`pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+INDEX (`pool_id`)
+) TYPE=MYISAM COMMENT='URL blacklist'");
 
-       case "0.4.3": // SQL queries for v0.4.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Neue Urlaubsschaltung mit integriert.";
-               break;
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Tabelle f&uuml;r URL-Sperrliste angelegt.");
+                               break;
 
-       case "0.4.4": // SQL queries for v0.4.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Ein <STRONG>WHERE ext_active='Y'</STRONG> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.";
-               break;
+                       case '0.5.1': // SQL queries for v0.5.1
+                               addMemberMenuSql('main','order','Mailbuchung','N','Y',8);
 
-       case "0.4.5": // SQL queries for v0.4.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "De-/Aktivieren des mit dieser Erweiterung verkn&uuml;pften Modules eingebunden.";
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Weiteren Men&uuml;-Query in Erweiterung verlagert.");
+                               break;
+               }
                break;
 
-       case "0.4.6": // SQL queries for v0.4.6
-               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order',NULL,'Mailbuchungen',3,'Y','N')";
-               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order','order2','Framekiller-Mails',2,'Y','N')";
-               $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='order', sort='1', title='Klick-Mails' WHERE what='order' LIMIT 1";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
+       case 'modify': // When the extension got modified
                break;
 
-       case "0.4.7": // SQL queries for v0.4.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
+       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
                break;
 
-       case "0.4.8": // SQL queries for v0.4.8
-               $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET title='Mailbuchung' WHERE what='config_order' LIMIT 1";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.";
+       case 'init': // Do stuff when extension is initialized
+               // Do daily reset only when installed and extension version is at least 0.1.1
+               if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (getExtensionVersion('order') >= '0.1.1')) {
+                       // Reset mail order values
+                       $result_ext = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
+               } // END - if
                break;
 
-       case "0.4.9": // SQL queries for v0.4.9
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Bei L&ouml;schung von Mailbuchungen kann nun global entschieden werden (Einstellungen also), ob die verbliebenen {!POINTS!} wieder gutgeschrieben werden sollen oder in den Jackpot landen.";
+       case 'init': // Do stuff when extension is initialized
                break;
 
-       case "0.5.0": // SQL queries for v0.5.0
-               $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_url_blacklist`";
-               $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_url_blacklist` (
-`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-`url` VARCHAR(255) NOT NULL DEFAULT '',
-`pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-PRIMARY KEY (`id`),
-INDEX (`pool_id`)
-) TYPE=MYISAM COMMENT='URL blacklist'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Tabelle f&uuml;r URL-Sperrliste angelegt.";
+       default: // Unknown extension mode
+               DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
                break;
-       }
-       break;
-
-case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
-       break;
-
-default: // Do stuff when extension is loaded
-       // Do daily reset only when installed and extension version is at least 0.1.1
-       if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1")) {
-               // Reset mail order values
-               $result_ext = SQL_QUERY("UPDATE `"._MYSQL_PREFIX."_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
-       } // END - if
-       break;
 }
 
-//
+// [EOF]
 ?>