2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 04/11/2004 *
4 * =================== Last change: 11/15/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-payout.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Payout extension *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Auszahlung-Erweiterung *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 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')) {
43 // Version of this extension
44 setThisExtensionVersion('0.3.8');
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0', '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', '0.3.7', '0.3.8'));
49 switch (getExtensionMode()) {
50 case 'register': // Do stuff when installation is running
51 // SQL commands to run
52 addDropTableSql('user_payouts');
53 addCreateTableSql('user_payouts', "
54 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
55 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
56 `payout_total` FLOAT(22,3) UNSIGNED NOT NULL DEFAULT 0.000,
57 `target_account` VARCHAR(255) NOT NULL DEFAULT '',
58 `target_bank` VARCHAR(255) NOT NULL DEFAULT '',
59 `payout_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
60 `payout_timestamp` VARCHAR(10) NOT NULL DEFAULT 0,
61 `status` ENUM('NEW','ACCEPTED','REJECTED') NOT NULL DEFAULT 'NEW',
65 'Done user payouts (and status)');
67 addDropTableSql('payout_types');
68 addCreateTableSql('payout_types', "
69 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
70 `type` VARCHAR(255) NOT NULL DEFAULT '',
71 `rate` FLOAT(22,3) UNSIGNED NOT NULL DEFAULT 0.000,
72 `min_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
77 addAdminMenuSql('setup','config_payouts','Auszahlungen','Auszahlungsarten einstellen, neu anlegen oder löschen.',15);
78 addAdminMenuSql('payouts','list_payouts','Anfragen auflisten','Listet alle Auszahlungsanfragen Ihrer Mitglieder auf.',16);
81 addMemberMenuSql('main', 'payout', 'Auszahlungen', 11);
84 case 'remove': // Do stuff when removing extension
85 // SQL commands to run
86 addDropTableSql('user_payouts');
87 addDropTableSql('payout_types');
88 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='payouts'");
89 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='payout'");
92 case 'activate': // Do stuff when admin activates this extension
93 // SQL commands to run
94 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='payout' LIMIT 1");
97 case 'deactivate': // Do stuff when admin deactivates this extension
98 // SQL commands to run
99 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='payout' LIMIT 1");
102 case 'update': // Update an extension
103 switch (getCurrentExtensionVersion()) {
104 case '0.1.2': // SQL queries for v0.1.2
105 addAdminMenuSql('payouts', NULL, 'Auszahlungsmanagement','Management der Auszahlungsarten.',8);
106 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `action`='payouts',`title`='Einstellungen' WHERE `action`='setup' AND `what`='config_payouts' LIMIT 1");
109 case '0.1.3': // SQL queries for v0.1.3
110 addExtensionChangeTableColumnSql('payout_types', 'from_account', "VARCHAR(255) NOT NULL DEFAULT ''");
111 addExtensionChangeTableColumnSql('payout_types', 'from_pass', "VARCHAR(255) NOT NULL DEFAULT ''");
112 addExtensionChangeTableColumnSql('payout_types', 'engine_url', "VARCHAR(255) NOT NULL DEFAULT ''");
113 addExtensionChangeTableColumnSql('payout_types', 'engine_ret_ok', "VARCHAR(255) NOT NULL DEFAULT ''");
114 addExtensionChangeTableColumnSql('payout_types', 'engine_ret_failed', "VARCHAR(255) NOT NULL DEFAULT ''");
115 addExtensionChangeTableColumnSql('payout_types', 'pass_enc', "ENUM('md5','base64','none') NOT NULL DEFAULT 'md5'");
118 case '0.1.4': // SQL queries for v0.1.4
119 addExtensionChangeTableColumnSql('user_payouts', 'password', "VARCHAR(255) NOT NULL DEFAULT ''");
122 case '0.1.5': // SQL queries for v0.1.5
123 addExtensionChangeTableColumnSql('user_payouts', 'target_url', 'LONGTEXT NOT NULL');
124 addExtensionChangeTableColumnSql('user_payouts', 'banner_url', 'LONGTEXT NOT NULL');
125 addExtensionChangeTableColumnSql('user_payouts', 'link_text', "VARCHAR(30) NOT NULL DEFAULT ''");
126 addExtensionChangeTableColumnSql('payout_types', 'allow_url', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
129 case '0.1.6': // SQL queries for v0.1.6
130 addExtensionChangeTableColumnSql('payout_types', 'pass_enc', 'pass_enc', "ENUM('md5','base64','xxx') NOT NULL DEFAULT 'xxx'");
133 case '0.1.8': // SQL queries for v0.1.8
134 // Update notes (these will be set as task text!)
135 setExtensionUpdateNotes("Auflistung der Auszahlungen ausgelagert in Template <span class=\"bad\">member_payout.tpl</span>.");
138 case '0.1.9': // SQL queries for v0.1.9
139 // Update notes (these will be set as task text!)
140 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
143 case '0.2.0': // SQL queries for v0.2.0
144 // Update notes (these will be set as task text!)
145 setExtensionUpdateNotes("5 Nachkommastellen implementiert.");
148 case '0.2.1': // SQL queries for v0.2.1
149 addExtensionChangeTableColumnSql('user_payouts', 'payout_total', 'payout_total', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
150 addExtensionChangeTableColumnSql('payout_types', 'rate', 'rate', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
152 // Update notes (these will be set as task text!)
153 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
156 case '0.2.2': // SQL queries for v0.2.2
157 // Update notes (these will be set as task text!)
158 setExtensionUpdateNotes("Buttons aus Aufgabenauflisten ausgelagert");
161 case '0.2.3': // SQL queries for v0.2.3
162 // Update notes (these will be set as task text!)
163 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
166 case '0.2.4': // SQL queries for v0.2.4
167 // Update notes (these will be set as task text!)
168 setExtensionUpdateNotes("Ausgabe der Auszahlungsmöglichkeiten im Mitgliedsbereich repariert.");
171 case '0.2.5': // SQL queries for v0.2.5
172 // Update notes (these will be set as task text!)
173 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
176 case '0.2.6': // SQL queries for v0.2.6
177 // Update notes (these will be set as task text!)
178 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
181 case '0.2.7': // SQL queries for v0.2.7
182 // Update notes (these will be set as task text!)
183 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
186 case '0.2.8': // SQL queries for v0.2.8
187 // Update notes (these will be set as task text!)
188 setExtensionUpdateNotes("Work-Arount-Lösung zu temporären Problemen mit der Task-Id eingebaut.");
191 case '0.2.9': // SQL queries for v0.2.9
192 // Update notes (these will be set as task text!)
193 setExtensionUpdateNotes("Nachricht an Admin bei Auszahlungsanfrage wird endlich versendet.");
196 case '0.3.0': // SQL queries for v0.3.0
197 // Update notes (these will be set as task text!)
198 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
201 case '0.3.1': // SQL queries for v0.3.1
202 // Update notes (these will be set as task text!)
203 setExtensionUpdateNotes("Fehler in Auszahlungsfunktion beseitigt, wenn Umrechnungsrate ungleich 1 eingestellt ist.");
206 case '0.3.2': // SQL queries for v0.3.2
207 // Update notes (these will be set as task text!)
208 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
211 case '0.3.3': // SQL queries for v0.3.3
212 // Update notes (these will be set as task text!)
213 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
216 case '0.3.4': // SQL queries for v0.3.4
217 // Update notes (these will be set as task text!)
218 setExtensionUpdateNotes("Anzahl zu überweisende {?POINTS?} müssen immer grösser 0 sein, ansonsten bricht das Script mit einer Fehlermeldung an das Mitglied ab.");
221 case '0.3.5': // SQL queries for v0.3.5
222 // Update notes (these will be set as task text!)
223 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
226 case '0.3.6': // SQL queries for v0.3.6
227 // Update notes (these will be set as task text!)
228 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
231 case '0.3.7': // SQL queries for v0.3.7
232 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Auszahlungsmanagement' WHERE `action`='payouts' AND (`what`='' OR `what` IS NULL) LIMIT 1");
234 // Update notes (these will be set as task text!)
235 setExtensionUpdateNotes("Verwaltung nach Management umgestellt.");
238 case '0.3.8': // SQL queries for v0.3.8
239 // Update notes (these will be set as task text!)
240 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
245 case 'modify': // When the extension got modified
248 case 'test': // For testing purposes
251 case 'init': // Do stuff when extension is initialized
254 default: // Unknown extension mode
255 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));