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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
46 EXT_SET_VERSION('0.2.1');
48 // Version history array (add more with , '0.1.0' and so on)
49 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'));
51 switch ($EXT_LOAD_MODE)
53 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
55 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
56 ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_holidays` (
57 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
58 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
59 holiday_start VARCHAR(10) NOT NULL DEFAULT 0,
60 holiday_end VARCHAR(10) NOT NULL DEFAULT 0,
61 comments LONGTEXT NOT NULL,
64 ) TYPE={!_TABLE_TYPE!}");
66 // Add default values to config
67 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'");
70 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','holiday','Urlaubsschaltung','4','Y','Y')");
73 ADD_EXT_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.')");
74 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`sort`,`descr`) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')");
75 ADD_EXT_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!')");
76 ADD_EXT_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.')");
78 // Remove 0 max mails per day
79 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
82 case 'remove': // Do stuff when removing extension
83 // SQL commands to run
84 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
85 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='holiday' LIMIT 1");
86 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='holiday' LIMIT 4");
87 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
88 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_max_receive` (value, comment) VALUES ('0','Urlaub')");
91 case 'activate': // Do stuff when admin activates this extension
92 // SQL commands to run
93 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1");
96 case 'deactivate': // Do stuff when admin deactivates this extension
97 // SQL commands to run
98 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1");
101 case 'update': // Update an extension
104 case '0.0.2': // SQL queries for v0.0.2
105 // Update notes (these will be set as task text!)
106 EXT_SET_UPDATE_NOTES("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
109 case '0.0.3': // SQL queries for v0.0.3
110 // Update notes (these will be set as task text!)
111 EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
114 case '0.0.4': // SQL queries for v0.0.4
115 // Update notes (these will be set as task text!)
116 EXT_SET_UPDATE_NOTES("Problem mit Speicherung der Einstellungen beseitigt.");
119 case '0.0.5': // SQL queries for v0.0.5
120 // Update notes (these will be set as task text!)
121 EXT_SET_UPDATE_NOTES("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
124 case '0.0.6': // SQL queries for v0.0.6
125 // Update notes (these will be set as task text!)
126 EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> überflüssige HTML-Tags entfernt.");
129 case '0.0.7': // SQL queries for v0.0.7
130 // Update notes (these will be set as task text!)
131 EXT_SET_UPDATE_NOTES("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
134 case '0.0.8': // SQL queries for v0.0.8
135 // Update notes (these will be set as task text!)
136 EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
139 case '0.0.9': // SQL queries for v0.0.9
140 // Update notes (these will be set as task text!)
141 EXT_SET_UPDATE_NOTES("Wörter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
144 case '0.1.0': // SQL queries for v0.2.1
145 // Update notes (these will be set as task text!)
146 EXT_SET_UPDATE_NOTES("Sicherheitsupdate: SQL-Anweisungen geschützt.");
149 case '0.1.1': // SQL queries for v0.1.1
150 // Update notes (these will be set as task text!)
151 EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
154 case '0.1.2': // SQL queries for v0.1.2
155 // Update notes (these will be set as task text!)
156 EXT_SET_UPDATE_NOTES("Abspeichern der Urlaubsanfrage korregiert.");
159 case '0.1.3': // SQL queries for v0.1.3
160 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
161 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
162 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*2)."'");
164 // Update notes (these will be set as task text!)
165 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!");
168 case '0.1.4': // SQL queries for v0.1.4
169 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
171 // Update notes (these will be set as task text!)
172 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.");
175 case '0.1.5': // SQL queries for v0.1.5
176 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
178 // Update notes (these will be set as task text!)
179 EXT_SET_UPDATE_NOTES("Sicherheitsupdate für die Include-Befehle.");
182 case '0.1.6': // SQL queries for v0.1.6
183 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
185 // Update notes (these will be set as task text!)
186 EXT_SET_UPDATE_NOTES("Fehlende Tabellenspalte hinzugefügt.");
189 case '0.1.7': // SQL queries for v0.1.7
190 // Update notes (these will be set as task text!)
191 EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
194 case '0.1.8': // SQL queries for v0.1.8
195 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')");
196 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')");
197 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')");
199 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
200 EXT_ADD_UPDATE_DEPENDS('sql_patches');
202 // Update notes (these will be set as task text!)
203 EXT_SET_UPDATE_NOTES("Erweiterung in's neue Menüsystem integriert.");
206 case '0.1.9': // SQL queries for v0.1.9
207 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='account', `sort`='2', `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1");
209 // Update notes (these will be set as task text!)
210 EXT_SET_UPDATE_NOTES("Mitgliedsmenü komplett umgebaut.");
213 case '0.2.0': // SQL queries for v0.2.0
214 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (`what`='' OR `what` IS NULL) LIMIT 1");
216 // Update notes (these will be set as task text!)
217 EXT_SET_UPDATE_NOTES("Mitgliedsmenü komplett umgebaut.");
220 case '0.2.1': // SQL queries for v0.2.1
221 // Update notes (these will be set as task text!)
222 EXT_SET_UPDATE_NOTES("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
227 case 'modify': // When the extension got modified
230 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
233 default: // Do stuff when extension is loaded