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_VERSION = "0.2.1";
43 // Auto-set extension version
44 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
46 // Version history array (add more with , "0.1" and so on)
47 $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");
49 switch ($EXT_LOAD_MODE)
51 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
53 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`";
54 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_user_holidays` (
55 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
56 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
57 holiday_start VARCHAR(10) NOT NULL DEFAULT 0,
58 holiday_end VARCHAR(10) NOT NULL DEFAULT 0,
59 comments LONGBLOB NOT NULL,
64 // Add default values to config
65 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'";
68 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','holiday','Urlaubsschaltung','4','Y','Y')";
71 $SQLs[] = "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.')";
72 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')";
73 $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!')";
74 $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.')";
76 // Remove 0 max mails per day
77 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1";
80 case "remove": // Do stuff when removing extension
81 // SQL commands to run
82 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`";
83 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='holiday' LIMIT 1";
84 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='holiday' LIMIT 4";
85 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1";
86 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_max_receive` (value, comment) VALUES ('0','Urlaub')";
89 case "activate": // Do stuff when admin activates this extension
90 // SQL commands to run
91 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1";
94 case "deactivate": // Do stuff when admin deactivates this extension
95 // SQL commands to run
96 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1";
99 case "update": // Update an extension
102 case "0.0.2": // SQL queries for v0.0.2
103 // Update notes (these will be set as task text!)
104 $UPDATE_NOTES = "Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.";
107 case "0.0.3": // SQL queries for v0.0.3
108 // Update notes (these will be set as task text!)
109 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
112 case "0.0.4": // SQL queries for v0.0.4
113 // Update notes (these will be set as task text!)
114 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
117 case "0.0.5": // SQL queries for v0.0.5
118 // Update notes (these will be set as task text!)
119 $UPDATE_NOTES = "Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
122 case "0.0.6": // SQL queries for v0.0.6
123 // Update notes (these will be set as task text!)
124 $UPDATE_NOTES = "Seit <a href=\"#\">Patch 340</a> überflüssige HTML-Tags entfernt.";
127 case "0.0.7": // SQL queries for v0.0.7
128 // Update notes (these will be set as task text!)
129 $UPDATE_NOTES = "IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.";
132 case "0.0.8": // SQL queries for v0.0.8
133 // Update notes (these will be set as task text!)
134 $UPDATE_NOTES = "Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.";
137 case "0.0.9": // SQL queries for v0.0.9
138 // Update notes (these will be set as task text!)
139 $UPDATE_NOTES = "Wörter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.";
142 case "0.1.0": // SQL queries for v0.2.1
143 // Update notes (these will be set as task text!)
144 $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen geschützt.";
147 case "0.1.1": // SQL queries for v0.1.1
148 // Update notes (these will be set as task text!)
149 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
152 case "0.1.2": // SQL queries for v0.1.2
153 // Update notes (these will be set as task text!)
154 $UPDATE_NOTES = "Abspeichern der Urlaubsanfrage korregiert.";
157 case "0.1.3": // SQL queries for v0.1.3
158 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'";
159 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1";
160 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*2)."'";
162 // Update notes (these will be set as task text!)
163 $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!";
166 case "0.1.4": // SQL queries for v0.1.4
167 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'";
169 // Update notes (these will be set as task text!)
170 $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.";
173 case "0.1.5": // SQL queries for v0.1.5
174 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'";
176 // Update notes (these will be set as task text!)
177 $UPDATE_NOTES = "Sicherheitsupdate für die Include-Befehle.";
180 case "0.1.6": // SQL queries for v0.1.6
181 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
183 // Update notes (these will be set as task text!)
184 $UPDATE_NOTES = "Fehlende Tabellenspalte hinzugefügt.";
187 case "0.1.7": // SQL queries for v0.1.7
188 // Update notes (these will be set as task text!)
189 $UPDATE_NOTES = "if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.";
192 case "0.1.8": // SQL queries for v0.1.8
193 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')";
194 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')";
195 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')";
197 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
198 $EXT_UPDATE_DEPENDS = "sql_patches";
200 // Update notes (these will be set as task text!)
201 $UPDATE_NOTES = "Erweiterung in's neue Menüsystem integriert.";
204 case "0.1.9": // SQL queries for v0.1.9
205 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='account', `sort`='2', `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1";
207 // Update notes (these will be set as task text!)
208 $UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
211 case "0.2.0": // SQL queries for v0.2.0
212 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (what='' OR `what` IS NULL) LIMIT 1";
214 // Update notes (these will be set as task text!)
215 $UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
218 case "0.2.1": // SQL queries for v0.2.1
219 // Update notes (these will be set as task text!)
220 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
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