2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/25/2004 *
4 * =================== Last change: 09/25/2004 *
6 * -------------------------------------------------------------------- *
8 * -------------------------------------------------------------------- *
9 * Short description : Begging link *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Bettel-Link *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2015 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.3.6');
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', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6'));
49 switch (getExtensionMode()) {
50 case 'setup': // Do stuff when installation is running
51 // SQL commands to run
53 addAdminMenuSql('setup', 'config_beg', 'Bettel-Link', 'IP-Sperre, {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Vergütung usw. können Sie hier einstellen.', 10);
54 addGuestMenuSql('members', 'beg', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG} erbetteln!', 4);
55 addMemberMenuSql('extras', 'beg', 'Ihr Bettel-Link', 1);
57 addConfigAddSql('beg_timeout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 600');
58 addConfigAddSql('beg_userid_timeout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 1800');
59 addConfigAddSql('beg_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00100');
60 addExtensionAddTableColumnSql('user_data', 'beg_clicks', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
63 addDropTableSql('beg_ips');
64 addCreateTableSql('beg_ips', "
65 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
66 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
67 `remote_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
68 `timeout` VARCHAR(10) NOT NULL DEFAULT '',
71 'IP lock data for beg links');
74 case 'remove': // Do stuff when removing extension
75 // SQL commands to run
76 addDropTableSql('beg_ips');
77 addDropTableSql('beg_referrals');
78 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_beg','list_beg','list_beg_referral_urls')");
79 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='beg'");
80 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('beg','beg2')");
82 // Unregister points data
83 unregisterExtensionPointsData('beg');
84 unregisterExtensionPointsData('monthly_beg');
87 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='beg' LIMIT 1");
90 unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'BEG_RALLYE_USER_REGISTRATION_ADD_SQL_COLUMNS', TRUE, isExtensionDryRun());
91 unregisterFilter(__FILE__, __LINE__, 'init', 'BEG_PURGE_IPS_NOTIFY_USER', TRUE, isExtensionDryRun());
92 unregisterFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXCLUDE_BEG_USERID', TRUE, isExtensionDryRun());
95 case 'activate': // Do stuff when admin activates this extension
96 // SQL commands to run
97 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y',`locked`='N' WHERE `what`='beg' LIMIT 1");
98 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what` IN ('beg','beg2')");
99 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N',`admin_only`='N',`mem_only`='N' WHERE `module`='beg' LIMIT 1");
102 case 'deactivate': // Do stuff when admin deactivates this extension
103 // SQL commands to run
104 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `what`='beg' LIMIT 1");
105 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what` IN('beg','beg2')");
106 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module`='beg' LIMIT 1");
109 case 'update': // Update an extension
112 case 'modify': // When the extension got modified
115 case 'test': // For testing purposes
118 case 'init': // When extension is initialized
121 default: // Unknown extension mode
122 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));