More SQLs rewritten fix_menu.php is now 'pool-ed'
[mailer.git] / inc / extensions / ext-payout.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 04/11/2004 *
4  * ================                             Last change: 11/15/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-payout.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Payout extension                                 *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Auszahlung-Erweiterung                           *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 }
43
44 // Version of this extension
45 setThisExtensionVersion('0.3.8');
46
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(array('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
50 switch (getExtensionMode()) {
51         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52                 // SQL commands to run
53                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_payouts`");
54                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_payouts` (
55 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
56 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
57 payout_total FLOAT(22,3) UNSIGNED NOT NULL DEFAULT '0.000',
58 target_account VARCHAR(255) NOT NULL DEFAULT '',
59 target_bank VARCHAR(255) NOT NULL DEFAULT '',
60 payout_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
61 payout_timestamp VARCHAR(10) NOT NULL DEFAULT 0,
62 status ENUM('NEW','ACCEPTED','REJECTED') NOT NULL DEFAULT 'NEW',
63 KEY (userid),
64 KEY (payout_id),
65 PRIMARY KEY (id)
66 ) TYPE={?_TABLE_TYPE?}");
67                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_payout_types`");
68                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_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,
73 PRIMARY KEY (id)
74 ) TYPE={?_TABLE_TYPE?}");
75                 addAdminMenuSql('setup','config_payouts','Auszahlungen','Auszahlungsarten einstellen, neu anlegen oder l&ouml;schen.',15);
76                 addAdminMenuSql('payouts','list_payouts','Anfragen auflisten','Listet alle Auszahlungsanfragen Ihrer Mitglieder auf.',16);
77                 addMemberMenuSql('main','payout','Auszahlungen','N','N',11);
78                 break;
79
80         case 'remove': // Do stuff when removing extension
81                 // SQL commands to run
82                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_payouts`");
83                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_payout_types`");
84                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='payouts'");
85                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='payout'");
86                 break;
87
88         case 'activate': // Do stuff when admin activates this extension
89                 // SQL commands to run
90                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='payout' LIMIT 1");
91                 break;
92
93         case 'deactivate': // Do stuff when admin deactivates this extension
94                 // SQL commands to run
95                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='payout' LIMIT 1");
96                 break;
97
98         case 'update': // Update an extension
99                 switch (getCurrentExtensionVersion())
100                 {
101                         case '0.1.2': // SQL queries for v0.1.2
102                                 addAdminMenuSql('payouts', NULL, 'Auszahlungsmanagement','Management der Auszahlungsarten.',8);
103                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `action`='payouts', `title`='Einstellungen' WHERE `action`='setup' AND `what`='config_payouts' LIMIT 1");
104                                 break;
105
106                         case '0.1.3': // SQL queries for v0.1.3
107                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD from_account VARCHAR(255) NOT NULL DEFAULT ''");
108                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD from_pass VARCHAR(255) NOT NULL DEFAULT ''");
109                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD engine_url VARCHAR(255) NOT NULL DEFAULT ''");
110                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD engine_ret_ok VARCHAR(255) NOT NULL DEFAULT ''");
111                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD engine_ret_failed VARCHAR(255) NOT NULL DEFAULT ''");
112                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD pass_enc ENUM('md5','base64','none') NOT NULL DEFAULT 'md5'");
113                                 break;
114
115                         case '0.1.4': // SQL queries for v0.1.4
116                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD password VARCHAR(255) NOT NULL DEFAULT ''");
117                                 break;
118
119                         case '0.1.5': // SQL queries for v0.1.5
120                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD target_url LONGTEXT NOT NULL");
121                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD banner_url LONGTEXT NOT NULL");
122                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD link_text VARCHAR(30) NOT NULL DEFAULT ''");
123                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD allow_url ENUM('Y','N') NOT NULL DEFAULT 'N'");
124                                 break;
125
126                         case '0.1.6': // SQL queries for v0.1.6
127                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` CHANGE pass_enc pass_enc ENUM('md5','base64','xxx') NOT NULL DEFAULT 'xxx'");
128                                 break;
129
130                         case '0.1.8': // SQL queries for v0.1.8
131                                 // Update notes (these will be set as task text!)
132                                 setExtensionUpdateNotes("Auflistung der Auszahlungen ausgelagert in Template <em>member_payout.tpl</em>.");
133                                 break;
134
135                         case '0.1.9': // SQL queries for v0.1.9
136                                 // Update notes (these will be set as task text!)
137                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
138                                 break;
139
140                         case '0.2.0': // SQL queries for v0.2.0
141                                 // Update notes (these will be set as task text!)
142                                 setExtensionUpdateNotes("5 Nachkommastellen implementiert.");
143                                 break;
144
145                         case '0.2.1': // SQL queries for v0.2.1
146                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` CHANGE payout_total payout_total FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
147                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` CHANGE rate rate FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
148
149                                 // Update notes (these will be set as task text!)
150                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
151
152                         case '0.2.2': // SQL queries for v0.2.2
153                                 // Update notes (these will be set as task text!)
154                                 setExtensionUpdateNotes("Buttons aus Aufgabenauflisten ausgelagert");
155                                 break;
156
157                         case '0.2.3': // SQL queries for v0.2.3
158                                 // Update notes (these will be set as task text!)
159                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
160                                 break;
161
162                         case '0.2.4': // SQL queries for v0.2.4
163                                 // Update notes (these will be set as task text!)
164                                 setExtensionUpdateNotes("Ausgabe der Auszahlungsm&ouml;glichkeiten im Mitgliedsbereich repariert.");
165                                 break;
166
167                         case '0.2.5': // SQL queries for v0.2.5
168                                 // Update notes (these will be set as task text!)
169                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
170                                 break;
171
172                         case '0.2.6': // SQL queries for v0.2.6
173                                 // Update notes (these will be set as task text!)
174                                 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
175                                 break;
176
177                         case '0.2.7': // SQL queries for v0.2.7
178                                 // Update notes (these will be set as task text!)
179                                 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
180                                 break;
181
182                         case '0.2.8': // SQL queries for v0.2.8
183                                 // Update notes (these will be set as task text!)
184                                 setExtensionUpdateNotes("Work-Arount-L&ouml;sung zu tempor&auml;ren Problemen mit der Task-ID eingebaut.");
185                                 break;
186
187                         case '0.2.9': // SQL queries for v0.2.9
188                                 // Update notes (these will be set as task text!)
189                                 setExtensionUpdateNotes("Nachricht an Admin bei Auszahlungsanfrage wird endlich versendet.");
190                                 break;
191
192                         case '0.3.0': // SQL queries for v0.3.0
193                                 // Update notes (these will be set as task text!)
194                                 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
195                                 break;
196
197                         case '0.3.1': // SQL queries for v0.3.1
198                                 // Update notes (these will be set as task text!)
199                                 setExtensionUpdateNotes("Fehler in Auszahlungsfunktion beseitigt, wenn Umrechnungsrate ungleich 1 eingestellt ist.");
200                                 break;
201
202                         case '0.3.2': // SQL queries for v0.3.2
203                                 // Update notes (these will be set as task text!)
204                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
205                                 break;
206
207                         case '0.3.3': // SQL queries for v0.3.3
208                                 // Update notes (these will be set as task text!)
209                                 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
210                                 break;
211
212                         case '0.3.4': // SQL queries for v0.3.4
213                                 // Update notes (these will be set as task text!)
214                                 setExtensionUpdateNotes("Anzahl zu &uuml;berweisende {?POINTS?} m&uuml;ssen immer gr&ouml;sser 0 sein, ansonsten bricht das Script mit einer Fehlermeldung an das Mitglied ab.");
215                                 break;
216
217                         case '0.3.5': // SQL queries for v0.3.5
218                                 // Update notes (these will be set as task text!)
219                                 setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
220                                 break;
221
222                         case '0.3.6': // SQL queries for v0.3.6
223                                 // Update notes (these will be set as task text!)
224                                 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
225                                 break;
226
227                         case '0.3.7': // SQL queries for v0.3.7
228                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET title = 'Auszahlungsmanagement' WHERE action = 'payouts' AND (`what`='' OR `what` IS NULL) LIMIT 1");
229
230                                 // Update notes (these will be set as task text!)
231                                 setExtensionUpdateNotes("Verwaltung nach Management umgestellt.");
232                                 break;
233
234                         case '0.3.8': // SQL queries for v0.3.8
235                                 // Update notes (these will be set as task text!)
236                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
237                                 break;
238                 }
239                 break;
240
241         case 'modify': // When the extension got modified
242                 break;
243
244         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
245                 break;
246
247         case 'init': // Do stuff when extension is initialized
248                 break;
249
250         default: // Unknown extension mode
251                 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
252                 break;
253 }
254
255 // [EOF]
256 ?>