Deprecated action=login (admin area) removed
[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 - 2008 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         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 }
44
45 // Version of this extension
46 EXT_SET_VERSION('0.3.8');
47
48 // Version history array (add more with , '0.1.0' and so on)
49 EXT_SET_VER_HISTORY(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'));
50
51 switch ($EXT_LOAD_MODE)
52 {
53         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
54                 // SQL commands to run
55                 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_payouts`");
56                 ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_payouts` (
57 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
58 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
59 payout_total FLOAT(22,3) UNSIGNED NOT NULL DEFAULT '0.000',
60 target_account VARCHAR(255) NOT NULL DEFAULT '',
61 target_bank VARCHAR(255) NOT NULL DEFAULT '',
62 payout_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
63 payout_timestamp VARCHAR(10) NOT NULL DEFAULT 0,
64 status ENUM('NEW','ACCEPTED','REJECTED') NOT NULL DEFAULT 'NEW',
65 KEY(userid),
66 KEY(payout_id),
67 PRIMARY KEY(id)
68 ) TYPE={!_TABLE_TYPE!}");
69                 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_payout_types`");
70                 ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_payout_types` (
71 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
72 type VARCHAR(255) NOT NULL DEFAULT '',
73 rate FLOAT(22,3) UNSIGNED NOT NULL DEFAULT '0.000',
74 min_points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
75 PRIMARY KEY(id)
76 ) TYPE={!_TABLE_TYPE!}");
77                 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_payouts','Auszahlungen','Auszahlungsarten einstellen, neu anlegen oder l&ouml;schen.','15')");
78                 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('payouts','list_payouts','Anfragen auflisten','Listet alle Auszahlungsanfragen Ihrer Mitglieder auf.','16')");
79                 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','payout','Auszahlungen','N','N','11')");
80                 break;
81
82         case 'remove': // Do stuff when removing extension
83                 // SQL commands to run
84                 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_payouts`");
85                 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_payout_types`");
86                 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='payouts'");
87                 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='payout'");
88                 break;
89
90         case 'activate': // Do stuff when admin activates this extension
91                 // SQL commands to run
92                 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='payout' LIMIT 1");
93                 break;
94
95         case 'deactivate': // Do stuff when admin deactivates this extension
96                 // SQL commands to run
97                 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='payout' LIMIT 1");
98                 break;
99
100         case 'update': // Update an extension
101                 switch ($EXT_VER)
102                 {
103                         case '0.1.2': // SQL queries for v0.1.2
104                                 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('payouts', NULL, 'Auszahlungsmanagement','Management der Auszahlungsarten.','8')");
105                                 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `action`='payouts', `title`='Einstellungen' WHERE `action`='setup' AND `what`='config_payouts' LIMIT 1");
106                                 break;
107
108                         case '0.1.3': // SQL queries for v0.1.3
109                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD from_account VARCHAR(255) NOT NULL DEFAULT ''");
110                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD from_pass VARCHAR(255) NOT NULL DEFAULT ''");
111                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD engine_url VARCHAR(255) NOT NULL DEFAULT ''");
112                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD engine_ret_ok VARCHAR(255) NOT NULL DEFAULT ''");
113                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD engine_ret_failed VARCHAR(255) NOT NULL DEFAULT ''");
114                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD pass_enc ENUM('md5','base64','none') NOT NULL DEFAULT 'md5'");
115                                 break;
116
117                         case '0.1.4': // SQL queries for v0.1.4
118                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD password VARCHAR(255) NOT NULL DEFAULT ''");
119                                 break;
120
121                         case '0.1.5': // SQL queries for v0.1.5
122                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD target_url LONGTEXT NOT NULL");
123                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD banner_url LONGTEXT NOT NULL");
124                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD link_text VARCHAR(30) NOT NULL DEFAULT ''");
125                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD allow_url ENUM('Y','N') NOT NULL DEFAULT 'N'");
126                                 break;
127
128                         case '0.1.6': // SQL queries for v0.1.6
129                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` CHANGE pass_enc pass_enc ENUM('md5','base64','xxx') NOT NULL DEFAULT 'xxx'");
130                                 break;
131
132                         case '0.1.8': // SQL queries for v0.1.8
133                                 // Update notes (these will be set as task text!)
134                                 EXT_SET_UPDATE_NOTES("Auflistung der Auszahlungen ausgelagert in Template <em>member_payout.tpl</em>.");
135                                 break;
136
137                         case '0.1.9': // SQL queries for v0.1.9
138                                 // Update notes (these will be set as task text!)
139                                 EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
140                                 break;
141
142                         case '0.2.0': // SQL queries for v0.2.0
143                                 // Update notes (these will be set as task text!)
144                                 EXT_SET_UPDATE_NOTES("5 Nachkommastellen implementiert.");
145                                 break;
146
147                         case '0.2.1': // SQL queries for v0.2.1
148                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` CHANGE payout_total payout_total FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
149                                 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` CHANGE rate rate FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
150
151                                 // Update notes (these will be set as task text!)
152                                 EXT_SET_UPDATE_NOTES("Problem mit Speicherung der Einstellungen beseitigt.");
153
154                         case '0.2.2': // SQL queries for v0.2.2
155                                 // Update notes (these will be set as task text!)
156                                 EXT_SET_UPDATE_NOTES("Buttons aus Aufgabenauflisten ausgelagert");
157                                 break;
158
159                         case '0.2.3': // SQL queries for v0.2.3
160                                 // Update notes (these will be set as task text!)
161                                 EXT_SET_UPDATE_NOTES("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
162                                 break;
163
164                         case '0.2.4': // SQL queries for v0.2.4
165                                 // Update notes (these will be set as task text!)
166                                 EXT_SET_UPDATE_NOTES("Ausgabe der Auszahlungsm&ouml;glichkeiten im Mitgliedsbereich repariert.");
167                                 break;
168
169                         case '0.2.5': // SQL queries for v0.2.5
170                                 // Update notes (these will be set as task text!)
171                                 EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
172                                 break;
173
174                         case '0.2.6': // SQL queries for v0.2.6
175                                 // Update notes (these will be set as task text!)
176                                 EXT_SET_UPDATE_NOTES("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
177                                 break;
178
179                         case '0.2.7': // SQL queries for v0.2.7
180                                 // Update notes (these will be set as task text!)
181                                 EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
182                                 break;
183
184                         case '0.2.8': // SQL queries for v0.2.8
185                                 // Update notes (these will be set as task text!)
186                                 EXT_SET_UPDATE_NOTES("Work-Arount-L&ouml;sung zu tempor&auml;ren Problemen mit der Task-ID eingebaut.");
187                                 break;
188
189                         case '0.2.9': // SQL queries for v0.2.9
190                                 // Update notes (these will be set as task text!)
191                                 EXT_SET_UPDATE_NOTES("Nachricht an Admin bei Auszahlungsanfrage wird endlich versendet.");
192                                 break;
193
194                         case '0.3.0': // SQL queries for v0.3.0
195                                 // Update notes (these will be set as task text!)
196                                 EXT_SET_UPDATE_NOTES("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
197                                 break;
198
199                         case '0.3.1': // SQL queries for v0.3.1
200                                 // Update notes (these will be set as task text!)
201                                 EXT_SET_UPDATE_NOTES("Fehler in Auszahlungsfunktion beseitigt, wenn Umrechnungsrate ungleich 1 eingestellt ist.");
202                                 break;
203
204                         case '0.3.2': // SQL queries for v0.3.2
205                                 // Update notes (these will be set as task text!)
206                                 EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
207                                 break;
208
209                         case '0.3.3': // SQL queries for v0.3.3
210                                 // Update notes (these will be set as task text!)
211                                 EXT_SET_UPDATE_NOTES("Vorbereitung auf die neue Mediendaten v0.0.4.");
212                                 break;
213
214                         case '0.3.4': // SQL queries for v0.3.4
215                                 // Update notes (these will be set as task text!)
216                                 EXT_SET_UPDATE_NOTES("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.");
217                                 break;
218
219                         case '0.3.5': // SQL queries for v0.3.5
220                                 // Update notes (these will be set as task text!)
221                                 EXT_SET_UPDATE_NOTES("Sicherheitsupdate f&uuml;r die Include-Befehle.");
222                                 break;
223
224                         case '0.3.6': // SQL queries for v0.3.6
225                                 // Update notes (these will be set as task text!)
226                                 EXT_SET_UPDATE_NOTES("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
227                                 break;
228
229                         case '0.3.7': // SQL queries for v0.3.7
230                                 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Auszahlungsmanagement' WHERE action = 'payouts' AND (`what`='' OR `what` IS NULL) LIMIT 1");
231
232                                 // Update notes (these will be set as task text!)
233                                 EXT_SET_UPDATE_NOTES("Verwaltung nach Management umgestellt.");
234                                 break;
235
236                         case '0.3.8': // SQL queries for v0.3.8
237                                 // Update notes (these will be set as task text!)
238                                 EXT_SET_UPDATE_NOTES("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
239                                 break;
240                 }
241                 break;
242
243                         case 'modify': // When the extension got modified
244                                 break;
245
246                         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
247                                 break;
248
249                         default: // Do stuff when extension is loaded
250                                 break;
251 }
252
253 //
254 ?>