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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 setThisExtensionVersion('0.2.3');
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.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', '0.2.2', '0.2.3'));
49 switch (getExtensionMode()) {
50 case 'setup': // Do stuff when installation is running
52 addDropTableSql('user_holidays');
53 addCreateTableSql('user_holidays', "
54 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
55 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
56 `holiday_start` VARCHAR(10) NOT NULL DEFAULT 0,
57 `holiday_end` VARCHAR(10) NOT NULL DEFAULT 0,
58 `comments` LONGTEXT NOT NULL,
63 // Add default values to config
64 addConfigAddSql('holiday_max', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 30');
67 addMemberMenuSql('main', 'holiday', 'Urlaubsschaltung', 4);
70 addAdminMenuSql('holiday', NULL, 'Urlaubsmanagement', 'Hier können Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.', 4);
71 addAdminMenuSql('holiday', 'list_holiday', 'Auflisten', 'Alle Urlaubsschaltungen auflisten.', 1);
72 addAdminMenuSql('holiday', 'del_holiday', 'Urlaub beenden', 'Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur "Verstoss gegen unsere AGBs" ein!', 2);
73 addAdminMenuSql('holiday', 'config_holiday', 'Einstellungen', 'Maximale Tage für Urlaub usw. einstellen.', 3);
75 // Remove 0 max mails per day
76 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value=0 LIMIT 1");
79 case 'remove': // Do stuff when removing extension
80 // SQL commands to run
81 addDropTableSql('user_holidays');
82 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='holiday' LIMIT 1");
83 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='holiday' LIMIT 4");
84 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value`=0 LIMIT 1");
85 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (`value`, `comment`) VALUES (0,'Urlaub')");
88 unregisterFilter(__FILE__, __LINE__, 'user_exclusion_sql', 'HOLIDAY_USER_EXCLUSION_SQL', TRUE, isExtensionDryRun());
89 unregisterFilter(__FILE__, __LINE__, 'pre_mail_recipient_check', 'CHECK_USER_HOLIDAY', TRUE, isExtensionDryRun());
90 unregisterFilter(__FILE__, __LINE__, 'pre_category_mail_order_check', 'PRE_USERID_HOLIDAY_CHECK', TRUE, isExtensionDryRun());
93 case 'activate': // Do stuff when admin activates this extension
94 // SQL commands to run
95 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='holiday' LIMIT 1");
98 case 'deactivate': // Do stuff when admin deactivates this extension
99 // SQL commands to run
100 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='holiday' LIMIT 1");
103 case 'update': // Update an extension
106 case 'modify': // When the extension got modified
109 case 'test': // For testing purposes
112 case 'init': // Do stuff when extension is initialized
115 default: // Unknown extension mode
116 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));