Missing properties added
[mailer.git] / inc / extensions / ext-holiday.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                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::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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 - 2009 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         die();
42 }
43
44 // Version number
45 setThisExtensionVersion('0.2.1');
46
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(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
50 switch (getExtensionMode()) {
51         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52                 // Create database
53                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_holidays`");
54                 addExtensionSql("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 LONGTEXT NOT NULL,
60 KEY (userid),
61 PRIMARY KEY (id)
62 ) TYPE={?_TABLE_TYPE?}");
63
64                 // Add default values to config
65                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'");
66
67                 // Add member menu
68                 addMemberMenuSql('main','holiday','Urlaubsschaltung','Y','Y',4);
69
70                 // Add admin menus
71                 addAdminMenuSql('holiday', NULL, 'Urlaubsmanagement','Hier k&ouml;nnen Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.',4);
72                 addAdminMenuSql('holiday','list_holiday','Auflisten','Alle Urlaubsschaltungen auflisten.',1);
73                 addAdminMenuSql('holiday','del_holiday','Urlaub beenden','Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur &quot;Verstoss gegen unsere AGBs&quot; ein!',2);
74                 addAdminMenuSql('holiday','config_holiday','Einstellungen','Maximale Tage f&uuml;r Urlaub usw. einstellen.',3);
75
76                 // Remove 0 max mails per day
77                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value=0 LIMIT 1");
78                 break;
79
80         case 'remove': // Do stuff when removing extension
81                 // SQL commands to run
82                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_holidays`");
83                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='holiday' LIMIT 1");
84                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='holiday' LIMIT 4");
85                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value=0 LIMIT 1");
86                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (value, comment) VALUES (0,'Urlaub')");
87                 break;
88
89         case 'activate': // Do stuff when admin activates this extension
90                 // SQL commands to run
91                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1");
92                 break;
93
94         case 'deactivate': // Do stuff when admin deactivates this extension
95                 // SQL commands to run
96                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1");
97                 break;
98
99         case 'update': // Update an extension
100                 switch (getCurrentExtensionVersion())
101                 {
102                         case '0.0.2': // SQL queries for v0.0.2
103                                 // Update notes (these will be set as task text!)
104                                 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
105                                 break;
106
107                         case '0.0.3': // SQL queries for v0.0.3
108                                 // Update notes (these will be set as task text!)
109                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
110                                 break;
111
112                         case '0.0.4': // SQL queries for v0.0.4
113                                 // Update notes (these will be set as task text!)
114                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
115                                 break;
116
117                         case '0.0.5': // SQL queries for v0.0.5
118                                 // Update notes (these will be set as task text!)
119                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
120                                 break;
121
122                         case '0.0.6': // SQL queries for v0.0.6
123                                 // Update notes (these will be set as task text!)
124                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
125                                 break;
126
127                         case '0.0.7': // SQL queries for v0.0.7
128                                 // Update notes (these will be set as task text!)
129                                 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
130                                 break;
131
132                         case '0.0.8': // SQL queries for v0.0.8
133                                 // Update notes (these will be set as task text!)
134                                 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
135                                 break;
136
137                         case '0.0.9': // SQL queries for v0.0.9
138                                 // Update notes (these will be set as task text!)
139                                 setExtensionUpdateNotes("W&ouml;rter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
140                                 break;
141
142                         case '0.1.0': // SQL queries for v0.2.1
143                                 // Update notes (these will be set as task text!)
144                                 setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.");
145                                 break;
146
147                         case '0.1.1': // SQL queries for v0.1.1
148                                 // Update notes (these will be set as task text!)
149                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
150                                 break;
151
152                         case '0.1.2': // SQL queries for v0.1.2
153                                 // Update notes (these will be set as task text!)
154                                 setExtensionUpdateNotes("Abspeichern der Urlaubsanfrage korregiert.");
155                                 break;
156
157                         case '0.1.3': // SQL queries for v0.1.3
158                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
159                                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value=0 LIMIT 1");
160                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('ONE_DAY')*2)."'");
161
162                                 // Update notes (these will be set as task text!)
163                                 setExtensionUpdateNotes("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!");
164                                 break;
165
166                         case '0.1.4': // SQL queries for v0.1.4
167                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
168
169                                 // Update notes (these will be set as task text!)
170                                 setExtensionUpdateNotes("Urlaubsschaltung wird erst Abends um 00:00 Uhr aktiv und nicht durch die Beantragung. Dies kann nun auch auf direkte Umstellung eingestellt werden.");
171                                 break;
172
173                         case '0.1.5': // SQL queries for v0.1.5
174                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
175
176                                 // Update notes (these will be set as task text!)
177                                 setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
178                                 break;
179
180                         case '0.1.6': // SQL queries for v0.1.6
181                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
182
183                                 // Update notes (these will be set as task text!)
184                                 setExtensionUpdateNotes("Fehlende Tabellenspalte hinzugef&uuml;gt.");
185                                 break;
186
187                         case '0.1.7': // SQL queries for v0.1.7
188                                 // Update notes (these will be set as task text!)
189                                 setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
190                                 break;
191
192                         case '0.1.8': // SQL queries for v0.1.8
193                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')");
194                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')");
195                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')");
196
197                                 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
198                                 addExtensionUpdateDependency('sql_patches');
199
200                                 // Update notes (these will be set as task text!)
201                                 setExtensionUpdateNotes("Erweiterung in's neue Men&uuml;system integriert.");
202                                 break;
203
204                         case '0.1.9': // SQL queries for v0.1.9
205                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=2, `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1");
206
207                                 // Update notes (these will be set as task text!)
208                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
209                                 break;
210
211                         case '0.2.0': // SQL queries for v0.2.0
212                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (`what`='' OR `what` IS NULL) LIMIT 1");
213
214                                 // Update notes (these will be set as task text!)
215                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
216                                 break;
217
218                         case '0.2.1': // SQL queries for v0.2.1
219                                 // Update notes (these will be set as task text!)
220                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
221                                 break;
222                 }
223                 break;
224
225         case 'modify': // When the extension got modified
226                 break;
227
228         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
229                 break;
230
231         case 'init': // Do stuff when extension is initialized
232                 break;
233
234         default: // Unknown extension mode
235                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
236                 break;
237 }
238
239 // [EOF]
240 ?>