Marked some unfinished extensions as 'work-in-progress'
[mailer.git] / inc / extensions / ext-task.php
index 74c4782d19b018fa275222c4a42eb22ad61c4e52..51a22f659023230d3cf5d13a1995a654c04f393a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 07/10/2004 *
- * ================                             Last change: 09/29/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 07/10/2004 *
+ * ===================                          Last change: 09/29/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-task.php                                     *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Aufgabenverwaltung                               *
  * -------------------------------------------------------------------- *
- * $Revision:: 856                                                    $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. March 2009)             $ *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: stelzi                                                   $ *
+ * $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();
 }
 
 // Version number
-EXT_SET_VERSION("0.3.1");
-
-// Version history array (add more with , "0.1" and so on)
-EXT_SET_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"));
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
-       // SQL commands to run
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('task', NULL, 'Aufgaben-Management','1','Erweitertes Aufgaben-Management zur leichten verwaltung der vom System erzeugten Aufgaben.')");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('task','list_task','Aufgaben auflisten','1','Alle Ihnen zugewiesenen Aufgaben auflisten (keine Updates).')");
-       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `status`='SOLVED' WHERE `status`='CLOSED'");
-       break;
-
-case "remove": // Do stuff when removing extension
-       // SQL commands to run
-       ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='task' LIMIT 2");
-       break;
-
-case "activate": // Do stuff when admin activates this extension
-       // SQL commands to run
-       ADD_SQL("");
-       break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
-       // SQL commands to run
-       ADD_SQL("");
-       break;
-
-case "update": // Update an extension
-       switch ($EXT_VER)
-       {
-       case "0.0.1": // SQL queries for v0.0.1
-               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE ext_name='task' AND ext_has_css='N' LIMIT 1");
-
-               // This update depends on sql_patches update!
-               EXT_SET_UPDATE_DEPENDS("sql_patches");
-
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.");
-               break;
-
-       case "0.0.1": // SQL queries for v0.0.1
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Unn&ouml;tige Script-Teile aus what-list_tasks.php herausgel&ouml;scht; beim Anzeigen einer Extension-Update, oder -Register Aufgabe werden bei eingeschaltetem Verbose-Modus alle SQL-Anweisungen aufgelistet.");
-               break;
-
-       case "0.0.4": // SQL queries for v0.0.4
-               // Update notes (these will be set as task text!)
-               EXT_SET_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;
-
-       case "0.0.5": // SQL queries for v0.0.5
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("&amp;admin= in &amp;amp;admin= umgewandelt.");
-               break;
-
-       case "0.0.6": // SQL queries for v0.0.6
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei ge&auml;ndert.");
-               break;
+setThisExtensionVersion('0.3.2');
 
-       case "0.0.7": // SQL queries for v0.0.7
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Erstellung der Extra-&Uuml;bersichten verbessert.");
-               break;
-
-       case "0.0.8": // SQL queries for v0.0.8
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
-               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', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2'));
 
-       case "0.0.9": // SQL queries for v0.0.9
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Fehler bei Abfrage der payout-Erweiterung beseitigt.");
-               break;
-
-       case "0.1.0": // SQL queries for v0.2.1
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Task-Liste ausgelagert als Template");
-               break;
-
-       case "0.1.1": // SQL queries for v0.1.1
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Design &quot;Solid-Business&quot; eingebaut.");
-               break;
-
-       case "0.1.2": // SQL queries for v0.1.2
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
+// Keep this extension always active!
+setExtensionAlwaysActive('Y');
+
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+               // SQL commands to run
+               addAdminMenuSql('task', NULL, 'Aufgaben-Management','Erweitertes Aufgaben-Management zur leichten verwaltung der vom System erzeugten Aufgaben.',1);
+               addAdminMenuSql('task','list_task','Aufgaben auflisten','Alle Ihnen zugewiesenen Aufgaben auflisten (keine Updates).',1);
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_task_system` SET `status`='SOLVED' WHERE `status`='CLOSED'");
                break;
 
-       case "0.1.3": // SQL queries for v0.1.3
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='task'");
                break;
 
-       case "0.1.4": // SQL queries for v0.1.4
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("W&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.1.5": // SQL queries for v0.1.5
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Links wegen <strong>what=admins_contct</strong> ge&auml;ndert.");
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.1.6": // SQL queries for v0.1.6
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Weitere Direkt-Links eingebaut:<br />
+       case 'update': // Update an extension
+               switch (getCurrentExtensionVersion())
+               {
+                       case '0.0.1': // SQL queries for v0.0.1
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET ext_has_css='Y' WHERE `ext_name`='task' AND ext_has_css='N' LIMIT 1");
+
+                               // This update depends on sql_patches update!
+                               addExtensionUpdateDependency('sql_patches');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.");
+                               break;
+
+                       case '0.0.1': // SQL queries for v0.0.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Unn&ouml;tige Script-Teile aus what-list_tasks.php herausgel&ouml;scht; beim Anzeigen einer Extension-Update, oder -Register Aufgabe werden bei eingeschaltetem Verbose-Modus alle SQL-Anweisungen aufgelistet.");
+                               break;
+
+                       case '0.0.4': // SQL queries for v0.0.4
+                               // 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.5': // SQL queries for v0.0.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("&amp;admin= in &amp;amp;admin= umgewandelt.");
+                               break;
+
+                       case '0.0.6': // SQL queries for v0.0.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei ge&auml;ndert.");
+                               break;
+
+                       case '0.0.7': // SQL queries for v0.0.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Erstellung der Extra-&Uuml;bersichten verbessert.");
+                               break;
+
+                       case '0.0.8': // SQL queries for v0.0.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.0.9': // SQL queries for v0.0.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler bei Abfrage der payout-Erweiterung beseitigt.");
+                               break;
+
+                       case '0.1.0': // SQL queries for v0.2.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Task-Liste ausgelagert als Template");
+                               break;
+
+                       case '0.1.1': // SQL queries for v0.1.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Design &quot;Solid-Business&quot; eingebaut.");
+                               break;
+
+                       case '0.1.2': // SQL queries for v0.1.2
+                               // 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.1.3': // SQL queries for v0.1.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
+                               break;
+
+                       case '0.1.4': // SQL queries for v0.1.4
+                               // 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.5': // SQL queries for v0.1.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Links wegen <strong>what=admins_contct</strong> ge&auml;ndert.");
+                               break;
+
+                       case '0.1.6': // SQL queries for v0.1.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Weitere Direkt-Links eingebaut:<br />
 <ul>
   <li>L&auml;ndercodes</li>
   <li>Wartende Verdopplungen</li>
@@ -160,97 +162,106 @@ case "update": // Update an extension
   <li>Teilnehmer an der Aktiv-Rallye</li>
   <li>Nett hinweisende Linktitel hinzugef&uuml;gt. :-)</li>
 </ul>");
+                               break;
+
+                       case '0.1.7': // SQL queries for v0.1.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Direkt Links zum Sponsorenbereich vorbereitend eingebaut.");
+                               break;
+
+                       case '0.1.8': // SQL queries for v0.1.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Es werden alle installierten und aktivierten Themes angezeigt und verlinkt.");
+                               break;
+
+                       case '0.1.9': // SQL queries for v0.1.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("CSS-Datei in general.css verschmolzen (Patch 435!)");
+                               break;
+
+                       case '0.2.0': // SQL queries for v0.2.0
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Alle Administratoren, Referal-Banner und aktivierte Referal-Banner werden nun eingeblendet.");
+                               break;
+
+                       case '0.2.1': // SQL queries for v0.2.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Problem mit &uuml;berlanger Textbreite beseitigt.");
+                               break;
+
+                       case '0.2.2': // SQL queries for v0.2.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Link zum Freischalten von Sponoren-Accounts korregiert.");
+                               break;
+
+                       case '0.2.3': // SQL queries for v0.2.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Sortierungsreihenfolge grundlegend ge&auml;ndert: Es wird jetzt nach Mitglieder-Id, Aufgabenbereich, Infos und nach dem Erstellunsdatum sortiert.");
+                               break;
+
+                       case '0.2.4': // SQL queries for v0.2.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
+                               break;
+
+                       case '0.2.5': // SQL queries for v0.2.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("<strong>Nur mit bonus v0.6.9 oder h&ouml;her:</strong> Zuschaltbare Bonis werden auch bei der Ermittlung Anzahl teilnehmender Mitglieder mit ber&uumk;cksichtigt.");
+                               break;
+
+                       case '0.2.6': // SQL queries for v0.2.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Teilnehmer der Bettel-Rallye werden angezeigt.");
+                               break;
+
+                       case '0.2.7': // SQL queries for v0.2.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Link zum direkten Aufheben einer Urlaubsschaltung eines Mitgliedes korregiert.");
+                               break;
+
+                       case '0.2.8': // SQL queries for v0.2.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
+                               break;
+
+                       case '0.2.9': // SQL queries for v0.2.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt. Update-Aufgaben werden nach &quot;Bearbeitung&quot; nicht mehr als <strong>Erledigt</strong> gesetzt. Dies hatte sonst den Anschein, die Update-Aufgaben m&uuml;ssten erledigt werden, um die Erweiterungs-Updates einzuspielen, was aber automatisch geschieht.");
+                               break;
+
+                       case '0.3.0': // SQL queries for v0.3.0
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Export-Accounts werden in Task-&Uuml;bersicht aufgelistet.");
+                               break;
+
+                       case '0.3.1': // SQL queries for v0.3.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Diverse Fixes an den Templates (Notice-Hinweise vom PHP-Interpreter entfernt).");
+                               break;
+
+                       case '0.3.2': // SQL queries for v0.3.2
+                               // This update depends on user update
+                               addExtensionUpdateDependency('sql_patches');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("H&auml;ngt nun von <u>ext-user</u> ab.");
+                               break;
+               }
                break;
 
-       case "0.1.7": // SQL queries for v0.1.7
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Direkt Links zum Sponsorenbereich vorbereitend eingebaut.");
-               break;
-
-       case "0.1.8": // SQL queries for v0.1.8
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Es werden alle installierten und aktivierten Themes angezeigt und verlinkt.");
-               break;
-
-       case "0.1.9": // SQL queries for v0.1.9
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("CSS-Datei in general.css verschmolzen (Patch 435!)");
+       case 'modify': // When the extension got modified
                break;
 
-       case "0.2.0": // SQL queries for v0.2.0
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Alle Administratoren, Referal-Banner und aktivierte Referal-Banner werden nun eingeblendet.");
+       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
                break;
 
-       case "0.2.1": // SQL queries for v0.2.1
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Problem mit &uuml;berlanger Textbreite beseitigt.");
+       case 'init': // Do stuff when extension is initialized
                break;
 
-       case "0.2.2": // SQL queries for v0.2.2
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Link zum Freischalten von Sponoren-Accounts korregiert.");
+       default: // Unknown extension mode
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
-
-       case "0.2.3": // SQL queries for v0.2.3
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Sortierungsreihenfolge grundlegend ge&auml;ndert: Es wird jetzt nach Mitglieder-ID, Aufgabenbereich, Infos und nach dem Erstellunsdatum sortiert.");
-               break;
-
-       case "0.2.4": // SQL queries for v0.2.4
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
-               break;
-
-       case "0.2.5": // SQL queries for v0.2.5
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("<strong>Nur mit bonus v0.6.9 oder h&ouml;her:</strong> Zuschaltbare Bonis werden auch bei der Ermittlung Anzahl teilnehmender Mitglieder mit ber&uumk;cksichtigt.");
-               break;
-
-       case "0.2.6": // SQL queries for v0.2.6
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Teilnehmer der Bettel-Rallye werden angezeigt.");
-               break;
-
-       case "0.2.7": // SQL queries for v0.2.7
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Link zum direkten Aufheben einer Urlaubsschaltung eines Mitgliedes korregiert.");
-               break;
-
-       case "0.2.8": // SQL queries for v0.2.8
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Sicherheitsupdate f&uuml;r die Include-Befehle.");
-               break;
-
-       case "0.2.9": // SQL queries for v0.2.9
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt. Update-Aufgaben werden nach &quot;Bearbeitung&quot; nicht mehr als <strong>Erledigt</strong> gesetzt. Dies hatte sonst den Anschein, die Update-Aufgaben m&uuml;ssten erledigt werden, um die Erweiterungs-Updates einzuspielen, was aber automatisch geschieht.");
-               break;
-
-       case "0.3.0": // SQL queries for v0.3.0
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Export-Accounts werden in Task-&Uuml;bersicht aufgelistet.");
-               break;
-
-       case "0.3.1": // SQL queries for v0.3.1
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Diverse Fixes an den Templates (Notice-Hinweise vom PHP-Interpreter entfernt).");
-               break;
-       }
-       break;
-
-case "modify": // When the extension got modified
-       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
-       break;
 }
 
-// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
-
-//
+// [EOF]
 ?>