]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-holiday.php
Re-added, now the right ones
[mailer.git] / inc / extensions / ext-holiday.php
index 12b148373a777bc673de301367d46bb77552b04b..a294e85ccb963d72529cf9dcd20828405497ede3 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Ferienantraege von Mitgliedern                   *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision:: 856                                                    $ *
+ * $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                           *
  * For more information visit: http://www.mxchange.org                  *
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
 
 // Version number
-$EXT_VERSION = "0.2.1";
-
-// Auto-set extension version
-if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
+EXT_SET_VERSION("0.2.1");
 
 // 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");
+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"));
 
 switch ($EXT_LOAD_MODE)
 {
-case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
+case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
        // Create database
-       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_holidays";
-       $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_holidays (
-id bigint(20) not null auto_increment,
-userid bigint(20) not null default '0',
-holiday_start varchar(10) not null default '0',
-holiday_end varchar(10) not null default '0',
-comments longblob not null,
+       ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
+       ADD_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_holidays` (
+id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+holiday_start VARCHAR(10) NOT NULL DEFAULT 0,
+holiday_end VARCHAR(10) NOT NULL DEFAULT 0,
+comments LONGBLOB NOT NULL,
 KEY (userid),
 PRIMARY KEY(id)
-) TYPE=MyISAM";
+) TYPE={!_TABLE_TYPE!}");
 
        // Add default values to config
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD holiday_max bigint(20) not null default '30'";
+       ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'");
 
        // Add member menu
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('main', 'holiday', 'Urlaubsschaltung', '4', 'Y', 'Y')";
+       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','holiday','Urlaubsschaltung','4','Y','Y')");
 
        // Add admin menus
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('holiday', '', 'Urlaubsmanagement', '4', 'Hier können Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.')";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('holiday', 'list_holiday', 'Auflisten', '1', 'Alle Urlaubsschaltungen auflisten.')";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('holiday', 'del_holiday', 'Urlaub beenden', '2', 'Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur "Verstoss gegen unsere AGBs" ein!')";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('holiday', 'config_holiday', 'Einstellungen', '3', 'Maximale Tage für Urlaub usw. einstellen.')";
+       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday', NULL, 'Urlaubsmanagement','4','Hier können Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.')");
+       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')");
+       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','del_holiday','Urlaub beenden','2','Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur "Verstoss gegen unsere AGBs" ein!')");
+       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','config_holiday','Einstellungen','3','Maximale Tage für Urlaub usw. einstellen.')");
 
        // Remove 0 max mails per day
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE value='0' LIMIT 1";
+       ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
        break;
 
 case "remove": // Do stuff when removing extension
        // SQL commands to run
-       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_holidays";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='holiday' LIMIT 1";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='holiday' LIMIT 4";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE value='0' LIMIT 1";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_max_receive (value, comment) VALUES('0', 'Urlaub')";
+       ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
+       ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='holiday' LIMIT 1");
+       ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='holiday' LIMIT 4");
+       ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
+       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_max_receive` (value, comment) VALUES ('0','Urlaub')");
        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 action='main' AND what='holiday' LIMIT 1";
+       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1");
        break;
 
 case "deactivate": // Do stuff when admin deactivates this extension
        // SQL commands to run
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE action='main' AND what='holiday' LIMIT 1";
+       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1");
        break;
 
 case "update": // Update an extension
@@ -102,149 +103,136 @@ case "update": // Update an extension
        {
        case "0.0.2": // SQL queries for v0.0.2
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.";
+               EXT_SET_UPDATE_NOTES("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
                break;
 
        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.";
+               EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
                break;
 
        case "0.0.4": // SQL queries for v0.0.4
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
+               EXT_SET_UPDATE_NOTES("Problem mit Speicherung der Einstellungen beseitigt.");
                break;
 
        case "0.0.5": // SQL queries for v0.0.5
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
+               EXT_SET_UPDATE_NOTES("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
                break;
 
        case "0.0.6": // SQL queries for v0.0.6
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
+               EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
                break;
 
        case "0.0.7": // SQL queries for v0.0.7
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.";
+               EXT_SET_UPDATE_NOTES("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
                break;
 
        case "0.0.8": // SQL queries for v0.0.8
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Link zum Mitgliedsprofil in Funktion <U>ADMIN_USER_PROFILE_LINK()</U> ausgelagert.";
+               EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
                break;
 
        case "0.0.9": // SQL queries for v0.0.9
                // 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.";
+               EXT_SET_UPDATE_NOTES("W&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
                break;
 
        case "0.1.0": // SQL queries for v0.2.1
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.";
+               EXT_SET_UPDATE_NOTES("Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.");
                break;
 
        case "0.1.1": // SQL queries for v0.1.1
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
+               EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
                break;
 
        case "0.1.2": // SQL queries for v0.1.2
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern der Urlaubsanfrage korregiert.";
+               EXT_SET_UPDATE_NOTES("Abspeichern der Urlaubsanfrage korregiert.");
                break;
 
        case "0.1.3": // SQL queries for v0.1.3
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD holiday_active enum('Y', 'N') not null default 'N'";
-               $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE value='0' LIMIT 1";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD holiday_lock bigint(20) not null default '".(60*60*24*2)."'";
+               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
+               ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
+               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*2)."'");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Die Mitglieder-Accounts werden nicht mehr gesperrt, sondern nur auf <STRONG>Urlaub</STRONG> geschaltet. Lassen Sie sich nicht davon verwirren, dass sie &quot;freigegeben&quot; sind!";
+               EXT_SET_UPDATE_NOTES("Die Mitglieder-Accounts werden nicht mehr gesperrt, sondern nur auf <strong>Urlaub</strong> geschaltet. Lassen Sie sich nicht davon verwirren, dass sie &quot;freigegeben&quot; sind!");
                break;
 
        case "0.1.4": // SQL queries for v0.1.4
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD holiday_mode enum('DIRECT', 'RESET') not null default 'RESET'";
+               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Urlaubsschaltung wird erst Abends um 00:00 Uhr aktiv und nicht durch die Beantragung. Dies kann nun auch auf direkte Umstellung eingestellt werden.";
+               EXT_SET_UPDATE_NOTES("Urlaubsschaltung wird erst Abends um 00:00 Uhr aktiv und nicht durch die Beantragung. Dies kann nun auch auf direkte Umstellung eingestellt werden.");
                break;
 
        case "0.1.5": // SQL queries for v0.1.5
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD holiday_mode enum('DIRECT', 'RESET') not null default 'RESET'";
+               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Sicherheitsupdate f&uuml;r die Include-Befehle.";
+               EXT_SET_UPDATE_NOTES("Sicherheitsupdate f&uuml;r die Include-Befehle.");
                break;
 
        case "0.1.6": // SQL queries for v0.1.6
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD holiday_activated bigint(20) not null default '0'";
+               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehlende Tabellenspalte hinzugef&uuml;gt.";
+               EXT_SET_UPDATE_NOTES("Fehlende Tabellenspalte hinzugef&uuml;gt.");
                break;
 
        case "0.1.7": // SQL queries for v0.1.7
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "if-Anweisungen auf Funktion <STRONG>empty()</STRONG> umgestellt.";
+               EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
                break;
 
        case "0.1.8": // SQL queries for v0.1.8
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')";
+               ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')");
+               ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')");
+               ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')");
 
                // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
-               $EXT_UPDATE_DEPENDS = "sql_patches";
+               EXT_SET_UPDATE_DEPENDS("sql_patches");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Erweiterung in's neue Men&uuml;system integriert.";
+               EXT_SET_UPDATE_NOTES("Erweiterung in's neue Men&uuml;system integriert.");
                break;
 
        case "0.1.9": // SQL queries for v0.1.9
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='account', sort='2', title='In Urlaub' WHERE what='holiday' LIMIT 1";
+               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='account', `sort`='2', `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
+               EXT_SET_UPDATE_NOTES("Mitgliedsmen&uuml; komplett umgebaut.");
                break;
 
        case "0.2.0": // SQL queries for v0.2.0
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND what='' LIMIT 1";
+               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (what='' OR `what` IS NULL) LIMIT 1");
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
+               EXT_SET_UPDATE_NOTES("Mitgliedsmen&uuml; komplett umgebaut.");
                break;
 
        case "0.2.1": // SQL queries for v0.2.1
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
+               EXT_SET_UPDATE_NOTES("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
                break;
        }
        break;
 
-default: // Do stuff when extension is loaded
-       $DUMMY = LOAD_CONFIG("0");
-       // Copy data to config array
-       $CONFIG['holiday_max']  = $DUMMY['holiday_max'];  // Maximum days for holiday
-       $CONFIG['holiday_lock'] = $DUMMY['holiday_lock']; // Lock deactivation in member area for X seconds
-       $CONFIG['holiday_mode'] = $DUMMY['holiday_mode']; // Mode for activating holiday
-       unset($DUMMY);
-
-       // Do we have a daily-reset-run?
-       if (((defined('__DAILY_RESET')) && ($CONFIG['holiday_mode'] == "RESET")) || ($CONFIG['holiday_mode'] == "DIRECT"))
-       {
-               // Ok, let's check for finished holidays and unlock those accounts
-               $INC_POOL[] = PATH."inc/reset/reset_holiday.php";
-       }
+case "modify": // When the extension got modified
        break;
-}
 
-// Language file prefix
-$EXT_LANG_PREFIX = "holiday";
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+       break;
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = 'N';
+default: // Do stuff when extension is loaded
+       break;
+}
 
 //
 ?>