RevBomb patch applied (thanks to profi-concept)
[mailer.git] / inc / extensions / ext-holiday.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 06/17/2004 *
4  * ================                             Last change: 01/13/2006 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-holiday.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Holiday requests from members                    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ferienantraege von Mitgliedern                   *
12  * -------------------------------------------------------------------- *
13  * $Revision:: 856                                                    $ *
14  * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author:: stelzi                                                   $ *
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                  *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
42         require($INC);
43 }
44
45 // Version number
46 EXT_SET_VERSION("0.2.1");
47
48 // Version history array (add more with , "0.1" 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"));
50
51 switch ($EXT_LOAD_MODE)
52 {
53 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
54         // Create database
55         ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
56         ADD_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 LONGBLOB NOT NULL,
62 KEY (userid),
63 PRIMARY KEY(id)
64 ) TYPE={!_TABLE_TYPE!}");
65
66         // Add default values to config
67         ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'");
68
69         // Add member menu
70         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','holiday','Urlaubsschaltung','4','Y','Y')");
71
72         // Add admin menus
73         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday', NULL, 'Urlaubsmanagement','4','Hier k&ouml;nnen Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.')");
74         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')");
75         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 &quot;Verstoss gegen unsere AGBs&quot; ein!')");
76         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','config_holiday','Einstellungen','3','Maximale Tage f&uuml;r Urlaub usw. einstellen.')");
77
78         // Remove 0 max mails per day
79         ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
80         break;
81
82 case "remove": // Do stuff when removing extension
83         // SQL commands to run
84         ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_holidays`");
85         ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='holiday' LIMIT 1");
86         ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='holiday' LIMIT 4");
87         ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
88         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_max_receive` (value, comment) VALUES ('0','Urlaub')");
89         break;
90
91 case "activate": // Do stuff when admin activates this extension
92         // SQL commands to run
93         ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1");
94         break;
95
96 case "deactivate": // Do stuff when admin deactivates this extension
97         // SQL commands to run
98         ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1");
99         break;
100
101 case "update": // Update an extension
102         switch ($EXT_VER)
103         {
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.");
107                 break;
108
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.");
112                 break;
113
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.");
117                 break;
118
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&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
122                 break;
123
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> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
127                 break;
128
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.");
132                 break;
133
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>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
137                 break;
138
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&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
142                 break;
143
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&uuml;tzt.");
147                 break;
148
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.");
152                 break;
153
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.");
157                 break;
158
159         case "0.1.3": // SQL queries for v0.1.3
160                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
161                 ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='0' LIMIT 1");
162                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*2)."'");
163
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 &quot;freigegeben&quot; sind!");
166                 break;
167
168         case "0.1.4": // SQL queries for v0.1.4
169                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
170
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.");
173                 break;
174
175         case "0.1.5": // SQL queries for v0.1.5
176                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
177
178                 // Update notes (these will be set as task text!)
179                 EXT_SET_UPDATE_NOTES("Sicherheitsupdate f&uuml;r die Include-Befehle.");
180                 break;
181
182         case "0.1.6": // SQL queries for v0.1.6
183                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
184
185                 // Update notes (these will be set as task text!)
186                 EXT_SET_UPDATE_NOTES("Fehlende Tabellenspalte hinzugef&uuml;gt.");
187                 break;
188
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.");
192                 break;
193
194         case "0.1.8": // SQL queries for v0.1.8
195                 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')");
196                 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')");
197                 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')");
198
199                 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
200                 EXT_SET_UPDATE_DEPENDS("sql_patches");
201
202                 // Update notes (these will be set as task text!)
203                 EXT_SET_UPDATE_NOTES("Erweiterung in's neue Men&uuml;system integriert.");
204                 break;
205
206         case "0.1.9": // SQL queries for v0.1.9
207                 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='account', `sort`='2', `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1");
208
209                 // Update notes (these will be set as task text!)
210                 EXT_SET_UPDATE_NOTES("Mitgliedsmen&uuml; komplett umgebaut.");
211                 break;
212
213         case "0.2.0": // SQL queries for v0.2.0
214                 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (what='' OR `what` IS NULL) LIMIT 1");
215
216                 // Update notes (these will be set as task text!)
217                 EXT_SET_UPDATE_NOTES("Mitgliedsmen&uuml; komplett umgebaut.");
218                 break;
219
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.");
223                 break;
224         }
225         break;
226
227 case "modify": // When the extension got modified
228         break;
229
230 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
231         break;
232
233 default: // Do stuff when extension is loaded
234         break;
235 }
236
237 //
238 ?>