2 /************************************************************************
3 * MXChange v0.2.1 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 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 // Version of this extension
42 $EXT_VERSION = "0.3.8";
44 // Auto-set extension version
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
47 // Version history array (add more with , "0.1" and so on)
48 $EXT_VER_HISTORY = array("0.0", "0.1", "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");
50 switch ($EXT_LOAD_MODE)
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
53 // SQL commands to run
54 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_payouts";
55 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_payouts (
56 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
57 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
58 payout_total DOUBLE(22,3) UNSIGNED NOT NULL DEFAULT '0.000',
59 target_account VARCHAR(255) NOT NULL DEFAULT '',
60 target_bank VARCHAR(255) NOT NULL DEFAULT '',
61 payout_id BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
62 payout_timestamp VARCHAR(10) NOT NULL DEFAULT '0',
63 status ENUM('NEW', 'ACCEPTED', 'REJECTED') NOT NULL DEFAULT 'NEW',
68 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_payout_types";
69 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_payout_types (
70 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
71 type VARCHAR(255) NOT NULL DEFAULT '',
72 rate DOUBLE(22,3) UNSIGNED NOT NULL DEFAULT '0.000',
73 min_points BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
76 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('setup', 'config_payouts', 'Auszahlungen', 'Auszahlungsarten einstellen, neu anlegen oder löschen.', '15')";
77 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('payouts', 'list_payouts', 'Anfragen auflisten', 'Listet alle Auszahlungsanfragen Ihrer Mitglieder auf.', '16')";
78 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, visible, locked, sort) VALUES('main', 'payout', 'Auszahlungen', 'N', 'N', '11')";
81 case "remove": // Do stuff when removing extension
82 // SQL commands to run
83 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_payouts";
84 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_payout_types";
85 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='payouts'";
86 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE action='main' AND what='payout' LIMIT 1";
89 case "activate": // Do stuff when admin activates this extension
90 // SQL commands to run
91 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE action='main' AND what='payout' LIMIT 1";
94 case "deactivate": // Do stuff when admin deactivates this extension
95 // SQL commands to run
96 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE action='main' AND what='payout' LIMIT 1";
99 case "update": // Update an extension
102 case "0.1.2": // SQL queries for v0.1.2
103 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('payouts', NULL, 'Auszahlungsmanagement', 'Management der Auszahlungsarten.', '8')";
104 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET action='payouts', title='Einstellungen' WHERE action='setup' AND what='config_payouts' LIMIT 1";
107 case "0.1.3": // SQL queries for v0.1.3
108 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD from_account VARCHAR(255) NOT NULL DEFAULT ''";
109 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD from_pass VARCHAR(255) NOT NULL DEFAULT ''";
110 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD engine_url VARCHAR(255) NOT NULL DEFAULT ''";
111 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD engine_ret_ok VARCHAR(255) NOT NULL DEFAULT ''";
112 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD engine_ret_failed VARCHAR(255) NOT NULL DEFAULT ''";
113 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD pass_enc ENUM('md5', 'base64', 'none') NOT NULL DEFAULT 'md5'";
116 case "0.1.4": // SQL queries for v0.1.4
117 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_payouts ADD password VARCHAR(255) NOT NULL DEFAULT ''";
120 case "0.1.5": // SQL queries for v0.1.5
121 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_payouts ADD target_url LONGBLOB NOT NULL";
122 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_payouts ADD banner_url LONGBLOB NOT NULL";
123 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_payouts ADD link_text VARCHAR(30) NOT NULL DEFAULT ''";
124 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types ADD allow_url ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
127 case "0.1.6": // SQL queries for v0.1.6
128 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types CHANGE pass_enc pass_enc ENUM('md5', 'base64', 'xxx') NOT NULL DEFAULT 'xxx'";
131 case "0.1.8": // SQL queries for v0.1.8
132 // Update notes (these will be set as task text!)
133 $UPDATE_NOTES = "Auflistung der Auszahlungen ausgelagert in Template <I>member_payout.tpl</I>.";
136 case "0.1.9": // SQL queries for v0.1.9
137 // Update notes (these will be set as task text!)
138 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
141 case "0.2.0": // SQL queries for v0.2.0
142 // Update notes (these will be set as task text!)
143 $UPDATE_NOTES = "5 Nachkommastellen implementiert.";
146 case "0.2.1": // SQL queries for v0.2.1
147 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_payouts CHANGE payout_total payout_total DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
148 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_payout_types CHANGE rate rate DOUBLE(22,5) NOT NULL DEFAULT '0.00000'";
150 // Update notes (these will be set as task text!)
151 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
153 case "0.2.2": // SQL queries for v0.2.2
154 // Update notes (these will be set as task text!)
155 $UPDATE_NOTES = "Buttons aus Aufgabenauflisten ausgelagert";
158 case "0.2.3": // SQL queries for v0.2.3
159 // Update notes (these will be set as task text!)
160 $UPDATE_NOTES = "Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
163 case "0.2.4": // SQL queries for v0.2.4
164 // Update notes (these will be set as task text!)
165 $UPDATE_NOTES = "Ausgabe der Auszahlungsmöglichkeiten im Mitgliedsbereich repariert.";
168 case "0.2.5": // SQL queries for v0.2.5
169 // Update notes (these will be set as task text!)
170 $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> überflüssige HTML-Tags entfernt.";
173 case "0.2.6": // SQL queries for v0.2.6
174 // Update notes (these will be set as task text!)
175 $UPDATE_NOTES = "IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.";
178 case "0.2.7": // SQL queries for v0.2.7
179 // Update notes (these will be set as task text!)
180 $UPDATE_NOTES = "Link zum Mitgliedsprofil in Funktion <U>ADMIN_USER_PROFILE_LINK()</U> ausgelagert.";
183 case "0.2.8": // SQL queries for v0.2.8
184 // Update notes (these will be set as task text!)
185 $UPDATE_NOTES = "Work-Arount-Lösung zu temporären Problemen mit der Task-ID eingebaut.";
188 case "0.2.9": // SQL queries for v0.2.9
189 // Update notes (these will be set as task text!)
190 $UPDATE_NOTES = "Nachricht an Admin bei Auszahlungsanfrage wird endlich versendet.";
193 case "0.3.0": // SQL queries for v0.3.0
194 // Update notes (these will be set as task text!)
195 $UPDATE_NOTES = "HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.";
198 case "0.3.1": // SQL queries for v0.3.1
199 // Update notes (these will be set as task text!)
200 $UPDATE_NOTES = "Fehler in Auszahlungsfunktion beseitigt, wenn Umrechnungsrate ungleich 1 eingestellt ist.";
203 case "0.3.2": // SQL queries for v0.3.2
204 // Update notes (these will be set as task text!)
205 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
208 case "0.3.3": // SQL queries for v0.3.3
209 // Update notes (these will be set as task text!)
210 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
213 case "0.3.4": // SQL queries for v0.3.4
214 // Update notes (these will be set as task text!)
215 $UPDATE_NOTES = "Anzahl zu überweisende {!POINTS!} müssen immer grösser 0 sein, ansonsten bricht das Script mit einer Fehlermeldung an das Mitglied ab.";
218 case "0.3.5": // SQL queries for v0.3.5
219 // Update notes (these will be set as task text!)
220 $UPDATE_NOTES = "Sicherheitsupdate für die Include-Befehle.";
223 case "0.3.6": // SQL queries for v0.3.6
224 // Update notes (these will be set as task text!)
225 $UPDATE_NOTES = "Hash-Erstellung von <STRONG>md5()</STRONG> auf bessere Funktion <STRONG>generateHash()</STRONG> umgestellt.";
228 case "0.3.7": // SQL queries for v0.3.7
229 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Auszahlungsmanagement' WHERE action = 'payouts' AND (what='' OR what IS NULL) LIMIT 1";
231 // Update notes (these will be set as task text!)
232 $UPDATE_NOTES = "Verwaltung nach Management umgestellt.";
235 case "0.3.8": // SQL queries for v0.3.8
236 // Update notes (these will be set as task text!)
237 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
242 default: // Do stuff when extension is loaded
245 // Language file prefix
246 $EXT_LANG_PREFIX = "payout";
248 // Extension is always active?
249 $EXT_ALWAYS_ACTIVE = "N";