Marked some unfinished extensions as 'work-in-progress'
[mailer.git] / inc / extensions / ext-other.php
index 2afb6ac1cc3b9aa6f86cb559d2c3cae73a8c7fff..fabc988ff7cfd6ecc5b5eb9430ab32b4e8cfa463 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 09/19/2004 *
- * ================                             Last change: 10/29/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 09/19/2004 *
+ * ===================                          Last change: 10/29/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-other.php                                    *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Weitere administrative Einstellungen             *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $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                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * 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.2.1";
-
-// 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.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");
-
-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[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_other','Sonstige Einstellungen','Sonstige Einstellungen an Ihrem Mailtausch.','13')";
-       break;
-
-case "remove": // Do stuff when removing extension
-       // SQL commands to run
-       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_other' LIMIT 1";
-       break;
-
-case "activate": // Do stuff when admin activates this extension
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "update": // Update an extension
-       switch ($EXT_VER)
-       {
-       case "0.0.1": // SQL queries for v0.0.1
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler <div class=\"admin_failed\">Warning: Missing argument 2 for create_timestamp_from_selections() in {!PATH!}inc/libs/pro_functions.php on line 227</div> behoben.";
-               break;
+setThisExtensionVersion('0.2.5');
 
-       case "0.0.2": // SQL queries for v0.0.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Speichern der Einstellungen vereinfacht. Es wird dazu die Funktion ADMIN_SAVE_SETTINGS() verwendet.";
-               break;
+// Version history array (add more with , '0.1.0' and so on)
+setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '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'));
+
+// Keep this extension always active!
+setExtensionAlwaysActive('Y');
 
-       case "0.0.3": // SQL queries for v0.0.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+               // SQL commands to run
+               addAdminMenuSql('setup','config_other','Sonstige Einstellungen','Sonstige Einstellungen an Ihrem {?mt_word?}.',13);
                break;
 
-       case "0.0.4": // SQL queries for v0.0.4
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD max_comma TINYINT(3) UNSIGNED NOT NULL DEFAULT '3'";
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_other'");
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Angezeigte Kommastellen k&ouml;nnen zwischen 0 und 5 eingestellt werden.";
+               // Unregister filter
+               unregisterFilter('page_footer', 'DISPLAY_DEBUG_SQL', true, getExtensionDryRun());
                break;
 
-       case "0.0.5": // SQL queries for v0.0.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.0.6": // SQL queries for v0.0.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen endlich beseitigt.";
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.0.7": // SQL queries for v0.0.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Ausgabemodus der CSS-Dateien hinzugef&uuml;gt. Bitte auch das Admin-Template aktualisieren!";
-               break;
+       case 'update': // Update an extension
+               switch (getCurrentExtensionVersion()) {
+                       case '0.0.1': // SQL queries for v0.0.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler <div class=\"admin_failed\">Warning: Missing argument 2 for create_timestamp_from_selections() in {?PATH?}inc/libs/pro_functions.php on line 227</div> behoben.");
+                               break;
 
-       case "0.0.8": // SQL queries for v0.0.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Erweiterung bleibt wegen integrierten Schalters immer aktiv.";
-               break;
+                       case '0.0.2': // SQL queries for v0.0.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Speichern der Einstellungen vereinfacht. Es wird dazu die Funktion adminSaveSettings() verwendet.");
+                               break;
 
-       case "0.0.9": // SQL queries for v0.0.9
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern der Einstellungen repariert.";
-               break;
+                       case '0.0.3': // SQL queries for v0.0.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.0.4': // SQL queries for v0.0.4
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD max_comma TINYINT(3) UNSIGNED NOT NULL DEFAULT 3");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Angezeigte Kommastellen k&ouml;nnen zwischen 0 und 5 eingestellt werden.");
+                               break;
 
-       case "0.1.0": // SQL queries for v0.2.1
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Folgende Einstellungen k&ouml;nnen auf 0 gesetzt werden:
+                       case '0.0.5': // SQL queries for v0.0.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
+                               break;
+
+                       case '0.0.6': // SQL queries for v0.0.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen endlich beseitigt.");
+                               break;
+
+                       case '0.0.7': // SQL queries for v0.0.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Ausgabemodus der CSS-Dateien hinzugef&uuml;gt. Bitte auch das Admin-Template aktualisieren!");
+                               break;
+
+                       case '0.0.8': // SQL queries for v0.0.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Erweiterung bleibt wegen integrierten Schalters immer aktiv.");
+                               break;
+
+                       case '0.0.9': // SQL queries for v0.0.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern der Einstellungen repariert.");
+                               break;
+
+                       case '0.1.0': // SQL queries for v0.2.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Folgende Einstellungen k&ouml;nnen auf 0 gesetzt werden:
 <ol>
 <li>Selbe beworbene URL nicht mehr bewerbar (0 = URL kann sofort wieder gebucht werden)</li>
 <li>G&uuml;tigkeitsdauer der Best&auml;tigungslinks (0 = Best&auml;tigungslinks laufen nie ab)</li>
 <li>Sperrzeit des Mitgliedprofiles nach &Auml;nderung (0 = Mitglied kann sein Account immer und sofort &auml;ndern)</li>
 <li>Profilaktualisierungsinterval (0 = Es wird keine Mail zum Profilaktualisierunng durch das Mitglied ausgesendet(</li>
 <li>Erneute Aussendung der Mail (0 = Siehe oben)</li>
-</ol>";
-               break;
+</ol>");
+                               break;
 
-       case "0.1.1": // SQL queries for v0.1.1
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Gast- und Mitgliedsmen&uuml;s lassen sich voneinander getrentt ein- und auschalten.";
-               break;
+                       case '0.1.1': // SQL queries for v0.1.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Gast- und Mitgliedsmen&uuml;s lassen sich voneinander getrentt ein- und auschalten.");
+                               break;
 
-       case "0.1.2": // SQL queries for v0.1.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "W&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.";
-               break;
+                       case '0.1.2': // SQL queries for v0.1.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("W&ouml;rter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
+                               break;
 
-       case "0.1.3": // SQL queries for v0.1.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Wort &quot;Baustelle&quot; vom Auto-Versand entfernt, da dieser nun klappt.";
-               break;
+                       case '0.1.3': // SQL queries for v0.1.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Wort &quot;Baustelle&quot; vom Auto-Versand entfernt, da dieser nun klappt.");
+                               break;
 
-       case "0.1.4": // SQL queries for v0.1.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
-               break;
+                       case '0.1.4': // SQL queries for v0.1.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
+                               break;
 
-       case "0.1.5": // SQL queries for v0.1.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
-               break;
+                       case '0.1.5': // SQL queries for v0.1.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
+                               break;
 
-       case "0.1.6": // SQL queries for v0.1.6
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD reject_url VARCHAR(255) NOT NULL DEFAULT '{!URL!}'";
+                       case '0.1.6': // SQL queries for v0.1.6
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD reject_url VARCHAR(255) NOT NULL DEFAULT '{?URL?}'");
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Bei Ablehnung der URL wird jetzt endlich eine Standart-URL eingesetzt, die konfigurierbar ist. Fehler beim Laden der Konfiguration gefunden.";
-               break;
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Bei Ablehnung der URL wird jetzt endlich eine Standart-URL eingesetzt, die konfigurierbar ist. Fehler beim Laden der Konfiguration gefunden.");
+                               break;
 
-       case "0.1.7": // SQL queries for v0.1.7
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD currency VARCHAR(255) NOT NULL DEFAULT '&euro;'";
+                       case '0.1.7': // SQL queries for v0.1.7
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD currency VARCHAR(255) NOT NULL DEFAULT '&euro;'");
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Standart-W&auml;hrung der Geb&uuml;hren f&uuml;r alle Erweiterungen geltend hinzugef&uuml;gt.";
-               break;
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Standart-W&auml;hrung der Geb&uuml;hren f&uuml;r alle Erweiterungen geltend hinzugef&uuml;gt.");
+                               break;
 
-       case "0.1.8": // SQL queries for v0.1.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Die sonstigen Einstellungen lassen sich nun nur noch &auml;ndern, wenn die Erweiterung <strong>other</strong> auch installiert ist. Anderfalls gibt es einen SQL-Fehler beim Speichern und GROSS_GESCHRIEBENE Worte im Formular.";
-               break;
+                       case '0.1.8': // SQL queries for v0.1.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Die sonstigen Einstellungen lassen sich nun nur noch &auml;ndern, wenn die Erweiterung <strong>other</strong> auch installiert ist. Anderfalls gibt es einen SQL-Fehler beim Speichern und GROSS_GESCHRIEBENE Worte im Formular.");
+                               break;
 
-       case "0.1.9": // SQL queries for v0.1.9
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD mailid_error_redirect ENUM('index','reject') NOT NULL DEFAULT 'index'";
+                       case '0.1.9': // SQL queries for v0.1.9
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD mailid_error_redirect ENUM('index','reject') NOT NULL DEFAULT 'index'");
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Bei fehlerhafter Mail w&auml;hrend der Best&auml;tigung kann wahlweise zur Hauptseite weitergeleitet oder auf die eingestellte Ablehnungsseite umgeleitet werden.";
-               break;
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Bei fehlerhafter Mail w&auml;hrend der Best&auml;tigung kann wahlweise zur Hauptseite weitergeleitet oder auf die eingestellte Ablehnungsseite umgeleitet werden.");
+                               break;
+
+                       case '0.2.0': // SQL queries for v0.2.0
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `mailid_error_redirect` `mailid_error_redirect` ENUM('INDEX','REJECT') NOT NULL DEFAULT 'INDEX'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Bei fehlerhafter Mail w&auml;hrend der Best&auml;tigung kann wahlweise zur Hauptseite weitergeleitet oder auf die eingestellte Ablehnungsseite umgeleitet werden.");
+                               break;
+
+                       case '0.2.1': // SQL queries for v0.2.1
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `min_age` TINYINT(3) UNSIGNED NOT NULL DEFAULT 16");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Minimumalter ist nun konfigurierbar.");
+                               break;
+
+                       case '0.2.2': // SQL queries for v0.2.2
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `display_debug_sqls` ENUM('N','Y') NOT NULL DEFAULT 'N'");
 
-       case "0.2.0": // SQL queries for v0.2.0
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` CHANGE `mailid_error_redirect` `mailid_error_redirect` ENUM('INDEX','REJECT') NOT NULL DEFAULT 'INDEX'";
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("(Fast) alle SQL-Abfragen lassen sich nun zu Debugging-Zwecken (!) einschalten. Nur der Administrator sieht diese unten am Ende der Seite.");
+                               break;
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Bei fehlerhafter Mail w&auml;hrend der Best&auml;tigung kann wahlweise zur Hauptseite weitergeleitet oder auf die eingestellte Ablehnungsseite umgeleitet werden.";
+                       case '0.2.3': // SQL queries for v0.2.3
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `max_send` BIGINT(20) UNSIGNED NOT NULL DEFAULT 10");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehlende Konfiguration hinzugef&uuml;gt.");
+                               break;
+
+                       case '0.2.4': // SQL queries for v0.2.4
+                               // Register filter
+                               registerFilter('page_footer', 'DISPLAY_DEBUG_SQL', false, true, getExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Filter zum Anzeigen (Debug) von ausgef&uuml;hrten SQL-Anweisungen hinzugef&uuml;gt.");
+                               break;
+
+                       case '0.2.5': // SQL queries for v0.2.5
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `code_length` TINYINT(3) UNSIGNED NOT NULL DEFAULT 5");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Codel&auml;nge aus tables.sql rausgeholt.");
+                               break;
+               }
                break;
 
-       case "0.2.1": // SQL queries for v0.2.1
-               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `min_age` TINYINT(3) UNSIGNED NOT NULL DEFAULT 16";
+       case 'modify': // When the extension got modified
+               break;
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Minimumalter ist nun konfigurierbar.";
+       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
                break;
-       }
-       break;
 
-case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
-       break;
+       case 'init': // Do stuff when extension is initialized
+               break;
 
-default: // Do stuff when extension is loaded
-       break;
+       default: // Unknown extension mode
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+               break;
 }
 
-// Keep this extension always active!
-$EXT_ALWAYS_ACTIVE = "Y";
-
-//
+// [EOF]
 ?>