2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
46 setThisExtensionVersion('0.2.1');
48 // Version history array (add more with , '0.1.0' and so on)
49 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'));
51 switch (getExtensionMode()) {
52 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
54 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_holidays`');
55 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_holidays` (
56 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
57 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
58 holiday_start VARCHAR(10) NOT NULL DEFAULT 0,
59 holiday_end VARCHAR(10) NOT NULL DEFAULT 0,
60 comments LONGTEXT NOT NULL,
63 ) TYPE={?_TABLE_TYPE?}");
65 // Add default values to config
66 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '30'");
69 addMemberMenuSql('main','holiday','Urlaubsschaltung','Y','Y',4);
72 addAdminMenuSql('holiday', NULL, 'Urlaubsmanagement','Hier können Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.',4);
73 addAdminMenuSql('holiday','list_holiday','Auflisten','Alle Urlaubsschaltungen auflisten.',1);
74 addAdminMenuSql('holiday','del_holiday','Urlaub beenden','Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur "Verstoss gegen unsere AGBs" ein!',2);
75 addAdminMenuSql('holiday','config_holiday','Einstellungen','Maximale Tage für Urlaub usw. einstellen.',3);
77 // Remove 0 max mails per day
78 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value=0 LIMIT 1");
81 case 'remove': // Do stuff when removing extension
82 // SQL commands to run
83 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_holidays`');
84 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='holiday' LIMIT 1");
85 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='holiday' LIMIT 4");
86 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value`=0 LIMIT 1");
87 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (`value`, `comment`) VALUES (0,'Urlaub')");
90 case 'activate': // Do stuff when admin activates this extension
91 // SQL commands to run
92 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='holiday' LIMIT 1");
95 case 'deactivate': // Do stuff when admin deactivates this extension
96 // SQL commands to run
97 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='holiday' LIMIT 1");
100 case 'update': // Update an extension
101 switch (getCurrentExtensionVersion())
103 case '0.0.2': // SQL queries for v0.0.2
104 // Update notes (these will be set as task text!)
105 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
108 case '0.0.3': // SQL queries for v0.0.3
109 // Update notes (these will be set as task text!)
110 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
113 case '0.0.4': // SQL queries for v0.0.4
114 // Update notes (these will be set as task text!)
115 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
118 case '0.0.5': // SQL queries for v0.0.5
119 // Update notes (these will be set as task text!)
120 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
123 case '0.0.6': // SQL queries for v0.0.6
124 // Update notes (these will be set as task text!)
125 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
128 case '0.0.7': // SQL queries for v0.0.7
129 // Update notes (these will be set as task text!)
130 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
133 case '0.0.8': // SQL queries for v0.0.8
134 // Update notes (these will be set as task text!)
135 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
138 case '0.0.9': // SQL queries for v0.0.9
139 // Update notes (these will be set as task text!)
140 setExtensionUpdateNotes("Wörter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
143 case '0.1.0': // SQL queries for v0.2.1
144 // Update notes (these will be set as task text!)
145 setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen geschützt.");
148 case '0.1.1': // SQL queries for v0.1.1
149 // Update notes (these will be set as task text!)
150 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
153 case '0.1.2': // SQL queries for v0.1.2
154 // Update notes (these will be set as task text!)
155 setExtensionUpdateNotes("Abspeichern der Urlaubsanfrage korregiert.");
158 case '0.1.3': // SQL queries for v0.1.3
159 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD holiday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
160 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value=0 LIMIT 1");
161 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_lock BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('ONE_DAY')*2)."'");
163 // Update notes (these will be set as task text!)
164 setExtensionUpdateNotes("Die Mitglieder-Accounts werden nicht mehr gesperrt, sondern nur auf <strong>Urlaub</strong> geschaltet. Lassen Sie sich nicht davon verwirren, dass sie "freigegeben" sind!");
167 case '0.1.4': // SQL queries for v0.1.4
168 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
170 // Update notes (these will be set as task text!)
171 setExtensionUpdateNotes("Urlaubsschaltung wird erst Abends um 00:00 Uhr aktiv und nicht durch die Beantragung. Dies kann nun auch auf direkte Umstellung eingestellt werden.");
174 case '0.1.5': // SQL queries for v0.1.5
175 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD holiday_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'RESET'");
177 // Update notes (these will be set as task text!)
178 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
181 case '0.1.6': // SQL queries for v0.1.6
182 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD holiday_activated BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
184 // Update notes (these will be set as task text!)
185 setExtensionUpdateNotes("Fehlende Tabellenspalte hinzugefügt.");
188 case '0.1.7': // SQL queries for v0.1.7
189 // Update notes (these will be set as task text!)
190 setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
193 case '0.1.8': // SQL queries for v0.1.8
194 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')");
195 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')");
196 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')");
198 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
199 addExtensionUpdateDependency('sql_patches');
201 // Update notes (these will be set as task text!)
202 setExtensionUpdateNotes("Erweiterung in's neue Menüsystem integriert.");
205 case '0.1.9': // SQL queries for v0.1.9
206 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=2, `title`='In Urlaub' WHERE `what`='holiday' LIMIT 1");
208 // Update notes (these will be set as task text!)
209 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
212 case '0.2.0': // SQL queries for v0.2.0
213 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (`what`='' OR `what` IS NULL) LIMIT 1");
215 // Update notes (these will be set as task text!)
216 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
219 case '0.2.1': // SQL queries for v0.2.1
220 // Update notes (these will be set as task text!)
221 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
226 case 'modify': // When the extension got modified
229 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
232 case 'init': // Do stuff when extension is initialized
235 default: // Unknown extension mode
236 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));