2 /************************************************************************
3 * MXChange v0.2.1 Start: 06/17/2004 *
4 * ================ Last change: 01/13/2006 *
6 * -------------------------------------------------------------------- *
7 * File : ext-holiday.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Holiday requests from members *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Ferienantraege von Mitgliedern *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 EXT_SET_VERSION("0.2.1");
43 // Version history array (add more with , "0.1" and so on)
44 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"));
46 switch ($EXT_LOAD_MODE)
48 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
50 ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
51 ADD_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_holidays` (
52 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
53 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
54 holiday_start VARCHAR(10) NOT NULL DEFAULT 0,
55 holiday_end VARCHAR(10) NOT NULL DEFAULT 0,
56 comments LONGBLOB NOT NULL,
59 ) TYPE={!_TABLE_TYPE!}");
61 // Add default values to config
62 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'");
65 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','holiday','Urlaubsschaltung','4','Y','Y')");
68 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.')");
69 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')");
70 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!')");
71 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.')");
73 // Remove 0 max mails per day
74 ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
77 case "remove": // Do stuff when removing extension
78 // SQL commands to run
79 ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
80 ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='holiday' LIMIT 1");
81 ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='holiday' LIMIT 4");
82 ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
83 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_max_receive` (value, comment) VALUES ('0','Urlaub')");
86 case "activate": // Do stuff when admin activates this extension
87 // SQL commands to run
88 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1");
91 case "deactivate": // Do stuff when admin deactivates this extension
92 // SQL commands to run
93 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1");
96 case "update": // Update an extension
99 case "0.0.2": // SQL queries for v0.0.2
100 // Update notes (these will be set as task text!)
101 EXT_SET_UPDATE_NOTES("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
104 case "0.0.3": // SQL queries for v0.0.3
105 // Update notes (these will be set as task text!)
106 EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
109 case "0.0.4": // SQL queries for v0.0.4
110 // Update notes (these will be set as task text!)
111 EXT_SET_UPDATE_NOTES("Problem mit Speicherung der Einstellungen beseitigt.");
114 case "0.0.5": // SQL queries for v0.0.5
115 // Update notes (these will be set as task text!)
116 EXT_SET_UPDATE_NOTES("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
119 case "0.0.6": // SQL queries for v0.0.6
120 // Update notes (these will be set as task text!)
121 EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> überflüssige HTML-Tags entfernt.");
124 case "0.0.7": // SQL queries for v0.0.7
125 // Update notes (these will be set as task text!)
126 EXT_SET_UPDATE_NOTES("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
129 case "0.0.8": // SQL queries for v0.0.8
130 // Update notes (these will be set as task text!)
131 EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
134 case "0.0.9": // SQL queries for v0.0.9
135 // Update notes (these will be set as task text!)
136 EXT_SET_UPDATE_NOTES("Wörter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
139 case "0.1.0": // SQL queries for v0.2.1
140 // Update notes (these will be set as task text!)
141 EXT_SET_UPDATE_NOTES("Sicherheitsupdate: SQL-Anweisungen geschützt.");
144 case "0.1.1": // SQL queries for v0.1.1
145 // Update notes (these will be set as task text!)
146 EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
149 case "0.1.2": // SQL queries for v0.1.2
150 // Update notes (these will be set as task text!)
151 EXT_SET_UPDATE_NOTES("Abspeichern der Urlaubsanfrage korregiert.");
154 case "0.1.3": // SQL queries for v0.1.3
155 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
156 ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
157 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*2)."'");
159 // Update notes (these will be set as task text!)
160 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 "freigegeben" sind!");
163 case "0.1.4": // SQL queries for v0.1.4
164 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
166 // Update notes (these will be set as task text!)
167 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.");
170 case "0.1.5": // SQL queries for v0.1.5
171 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
173 // Update notes (these will be set as task text!)
174 EXT_SET_UPDATE_NOTES("Sicherheitsupdate für die Include-Befehle.");
177 case "0.1.6": // SQL queries for v0.1.6
178 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
180 // Update notes (these will be set as task text!)
181 EXT_SET_UPDATE_NOTES("Fehlende Tabellenspalte hinzugefügt.");
184 case "0.1.7": // SQL queries for v0.1.7
185 // Update notes (these will be set as task text!)
186 EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
189 case "0.1.8": // SQL queries for v0.1.8
190 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')");
191 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')");
192 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')");
194 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
195 EXT_SET_UPDATE_DEPENDS("sql_patches");
197 // Update notes (these will be set as task text!)
198 EXT_SET_UPDATE_NOTES("Erweiterung in's neue Menüsystem integriert.");
201 case "0.1.9": // SQL queries for v0.1.9
202 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='account', `sort`='2', `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1");
204 // Update notes (these will be set as task text!)
205 EXT_SET_UPDATE_NOTES("Mitgliedsmenü komplett umgebaut.");
208 case "0.2.0": // SQL queries for v0.2.0
209 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (what='' OR `what` IS NULL) LIMIT 1");
211 // Update notes (these will be set as task text!)
212 EXT_SET_UPDATE_NOTES("Mitgliedsmenü komplett umgebaut.");
215 case "0.2.1": // SQL queries for v0.2.1
216 // Update notes (these will be set as task text!)
217 EXT_SET_UPDATE_NOTES("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
222 case "modify": // When the extension got modified
225 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
228 default: // Do stuff when extension is loaded