2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 02/03/2005 *
4 * =================== Last change: 02/03/2005 *
6 * -------------------------------------------------------------------- *
7 * File : ext-doubler.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Double points *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Punkte verdoppeln *
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.1.6');
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'));
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?}_doubler`');
55 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_doubler` (
56 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
57 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
58 `refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
59 `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
60 `remote_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
61 `timemark` VARCHAR(10) NOT NULL DEFAULT '',
62 `completed` ENUM('Y','N') NOT NULL DEFAULT 'N',
63 `is_ref` ENUM('Y','N') NOT NULL DEFAULT 'N',
67 )TYPE={?_TABLE_TYPE?}");
72 // Minimum points to double
73 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_min FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 100.00000");
74 // Maximum points to double
75 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_max FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 10000.00000");
76 // Points left on users account after doubling
77 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_left BIGINT(20) UNSIGNED NOT NULL DEFAULT 1000");
78 // Charge for doubling points which goes to the webmaster (shreddered in fact!)
79 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_charge FLOAT(7,5) UNSIGNED NOT NULL DEFAULT 0.03000");
81 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_ref FLOAT(7,5) UNSIGNED NOT NULL DEFAULT 0.02000");
82 // Shall I use the jackpot to take points from? (Y/N, default=Y)
83 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_jackpot ENUM('Y','N') NOT NULL DEFAULT 'Y'");
84 // A user account to take points from (default: 0->none)
85 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
86 // Total payed out points from your doublers
87 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
88 // Sending mode of mails (immediately/daily reset)
89 // --> This also means who fast the doubled points will be payed out!
90 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_send_mode ENUM('DIRECT','RESET') NOT NULL DEFAULT 'DIRECT'");
91 // Timeout for entries to be purged (default: one week)
92 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('ONE_DAY')*7)."");
93 // Number of newest entries to display
94 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_display_new TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
95 // Number of entries which will be payed out soon
96 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_display_pay TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
97 // Number of entries which are already payed out
98 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_display_old TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
99 // Points used by every member
100 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD doubler_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
101 // Counter for usage of the doubler
102 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_counter BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
105 // --- MENU SYSTEMS ---
108 addAdminMenuSql('doubler', NULL, '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Verdoppler','Einstellungen und Einträge auflisten.', 4);
109 addAdminMenuSql('doubler','list_doubler','Auflisten','Einträge aus der Verdiensttabelle auflisten', 1);
110 addAdminMenuSql('doubler','config_doubler','Einstellungen','Prozentuale Gebühr usw. einstellen.', 2);
112 // Guest menu (informations / default doubler link)
113 addGuestMenuSql('main','doubler','Verdoppeln!','N','Y',3);
116 addMemberMenuSql('main','doubler','Verdoppeln!','N','Y',7);
119 case 'remove': // Do stuff when removing extension
120 // SQL commands to run
121 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_doubler`');
122 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='doubler'");
123 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='doubler'");
124 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='doubler'");
127 case 'activate': // Do stuff when admin activates this extension
128 // SQL commands to run
129 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='doubler' LIMIT 1");
130 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `what`='doubler' LIMIT 1");
131 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N', `hidden`='N', `admin_only`='N', `mem_only`='N' WHERE `module`='doubler' LIMIT 1");
134 case 'deactivate': // Do stuff when admin deactivates this extension
135 // SQL commands to run
136 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='doubler' LIMIT 1");
137 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `what`='doubler' LIMIT 1");
138 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module`='doubler' LIMIT 1");
141 case 'update': // Update an extension
142 switch (getCurrentExtensionVersion()) {
143 case '0.0.1': // SQL queries for v0.0.1
144 // Update notes (these will be set as task text!)
145 setExtensionUpdateNotes("Problem mit Mitglieder-Id behoben.");
148 case '0.0.2': // SQL queries for v0.0.2
150 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_used FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
152 // Update notes (these will be set as task text!)
153 setExtensionUpdateNotes("Gebühr wird vom Verdoppler-Pott abgezogen.");
156 case '0.0.3': // SQL queries for v0.0.3
157 // Update notes (these will be set as task text!)
158 setExtensionUpdateNotes("Drei SQL-Fehler beseitigt.");
161 case '0.0.4': // SQL queries for v0.0.4
162 // Shall I use the doubler's account to take points from? (Y/N, default=Y)
163 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_own ENUM('Y','N') NOT NULL DEFAULT 'Y'");
165 // Update notes (these will be set as task text!)
166 setExtensionUpdateNotes("{?POINTS?}-Guthaben des Verdopplers kann optional nicht mit einbezogen werden.");
169 case '0.0.5': // SQL queries for v0.0.5
170 // Update notes (these will be set as task text!)
171 setExtensionUpdateNotes("Counter-Stand und noch zum Verdoppeln übrige {?POINTS?} in Templates eingebunden. Auflistung in Admin-Bereich komplettiert.");
174 case '0.0.6': // SQL queries for v0.0.6
175 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_max_sent TINYINT(3) UNSIGNED NOT NULL DEFAULT 1");
176 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_group_sent TINYINT(3) UNSIGNED NOT NULL DEFAULT 1");
177 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD doubler_sent_all ENUM('Y','N') NOT NULL DEFAULT 'Y'");
179 // Update notes (these will be set as task text!)
180 setExtensionUpdateNotes("Gebührenabzug wird beim Einzahlen abgezogen (wurde von Auszahlung abgezogen) und maximal bei Auszahlung zu kontrollierende Accounts einstellbar.<br />Template <u>admin_config_doubler_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!");
183 case '0.0.7': // SQL queries for v0.0.7
184 // Update notes (these will be set as task text!)
185 setExtensionUpdateNotes("Wörter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.<br /><br />Minus-Guthaben des Verdoppler-Accounts repariert und Mitgliedsmail erweitert mit Transaktionsummer und IP-Nummer.");
188 case '0.0.8': // SQL queries for v0.0.8
189 // Update notes (these will be set as task text!)
190 setExtensionUpdateNotes("Bitte verschieben Sie die doubler-Templates (Ordner: {?PATH?}/templates/".getLanguage()."/html/) in den neuen Order doubler!");
193 case '0.0.9': // SQL queries for v0.0.9
194 // Update notes (these will be set as task text!)
195 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
198 case '0.1.0': // SQL queries for v0.2.1
199 // Update notes (these will be set as task text!)
200 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
203 case '0.1.1': // SQL queries for v0.1.1
204 // Update notes (these will be set as task text!)
205 setExtensionUpdateNotes("Zwei SQL-Fehler in <strong>inc/doubler_send.php</strong> beseitigt.");
208 case '0.1.2': // SQL queries for v0.1.2
209 // Update notes (these will be set as task text!)
210 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
213 case '0.1.3': // SQL queries for v0.1.3
214 // Update notes (these will be set as task text!)
215 setExtensionUpdateNotes("De-/Aktivieren des mit dieser Erweiterung verknüpften Modules eingebunden.");
218 case '0.1.4': // SQL queries for v0.1.4
219 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='extras', `sort`=4 WHERE `what`='doubler' LIMIT 1");
221 // Update notes (these will be set as task text!)
222 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
225 case '0.1.5': // SQL queries for v0.1.5
226 // Update notes (these will be set as task text!)
227 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
230 case '0.1.6': // SQL queries for v0.1.6
231 // Update notes (these will be set as task text!)
232 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
237 case 'modify': // When the extension got modified
240 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
243 case 'init': // Do stuff when extension is initialized
246 default: // Unknown extension mode
247 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));