Naming convention on language strings applied, ACL handling fixed:
[mailer.git] / inc / extensions / ext-payout.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                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  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Version of this extension
44 setThisExtensionVersion('0.3.8');
45
46 // Version history array (add more with , '0.1.0' and so on)
47 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'));
48
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',
62 INDEX (`userid`),
63 INDEX (`payout_id`),
64 PRIMARY KEY (`id`)
65 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Done user payouts (and status)'");
66                 addDropTableSql('payout_types');
67                 addCreateTableSql('payout_types', "(
68 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
69 `type` VARCHAR(255) NOT NULL DEFAULT '',
70 `rate` FLOAT(22,3) UNSIGNED NOT NULL DEFAULT 0.000,
71 `min_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
72 PRIMARY KEY (`id`)
73 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Payout types'");
74                 addAdminMenuSql('setup','config_payouts','Auszahlungen','Auszahlungsarten einstellen, neu anlegen oder l&ouml;schen.',15);
75                 addAdminMenuSql('payouts','list_payouts','Anfragen auflisten','Listet alle Auszahlungsanfragen Ihrer Mitglieder auf.',16);
76                 addMemberMenuSql('main','payout','Auszahlungen','N','N',11);
77                 break;
78
79         case 'remove': // Do stuff when removing extension
80                 // SQL commands to run
81                 addDropTableSql('user_payouts');
82                 addDropTableSql('payout_types');
83                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='payouts'");
84                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='payout'");
85                 break;
86
87         case 'activate': // Do stuff when admin activates this extension
88                 // SQL commands to run
89                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='payout' LIMIT 1");
90                 break;
91
92         case 'deactivate': // Do stuff when admin deactivates this extension
93                 // SQL commands to run
94                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='payout' LIMIT 1");
95                 break;
96
97         case 'update': // Update an extension
98                 switch (getCurrentExtensionVersion()) {
99                         case '0.1.2': // SQL queries for v0.1.2
100                                 addAdminMenuSql('payouts', NULL, 'Auszahlungsmanagement','Management der Auszahlungsarten.',8);
101                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `action`='payouts', `title`='Einstellungen' WHERE `action`='setup' AND `what`='config_payouts' LIMIT 1");
102                                 break;
103
104                         case '0.1.3': // SQL queries for v0.1.3
105                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD from_account VARCHAR(255) NOT NULL DEFAULT ''");
106                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD from_pass VARCHAR(255) NOT NULL DEFAULT ''");
107                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD engine_url VARCHAR(255) NOT NULL DEFAULT ''");
108                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD engine_ret_ok VARCHAR(255) NOT NULL DEFAULT ''");
109                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD engine_ret_failed VARCHAR(255) NOT NULL DEFAULT ''");
110                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD pass_enc ENUM('md5','base64','none') NOT NULL DEFAULT 'md5'");
111                                 break;
112
113                         case '0.1.4': // SQL queries for v0.1.4
114                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD password VARCHAR(255) NOT NULL DEFAULT ''");
115                                 break;
116
117                         case '0.1.5': // SQL queries for v0.1.5
118                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD target_url LONGTEXT NOT NULL");
119                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD banner_url LONGTEXT NOT NULL");
120                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` ADD link_text VARCHAR(30) NOT NULL DEFAULT ''");
121                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` ADD allow_url ENUM('Y','N') NOT NULL DEFAULT 'N'");
122                                 break;
123
124                         case '0.1.6': // SQL queries for v0.1.6
125                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` CHANGE pass_enc pass_enc ENUM('md5','base64','xxx') NOT NULL DEFAULT 'xxx'");
126                                 break;
127
128                         case '0.1.8': // SQL queries for v0.1.8
129                                 // Update notes (these will be set as task text!)
130                                 setExtensionUpdateNotes("Auflistung der Auszahlungen ausgelagert in Template <em>member_payout.tpl</em>.");
131                                 break;
132
133                         case '0.1.9': // SQL queries for v0.1.9
134                                 // Update notes (these will be set as task text!)
135                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
136                                 break;
137
138                         case '0.2.0': // SQL queries for v0.2.0
139                                 // Update notes (these will be set as task text!)
140                                 setExtensionUpdateNotes("5 Nachkommastellen implementiert.");
141                                 break;
142
143                         case '0.2.1': // SQL queries for v0.2.1
144                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_payouts` CHANGE payout_total payout_total FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
145                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_payout_types` CHANGE rate rate FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000");
146
147                                 // Update notes (these will be set as task text!)
148                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
149
150                         case '0.2.2': // SQL queries for v0.2.2
151                                 // Update notes (these will be set as task text!)
152                                 setExtensionUpdateNotes("Buttons aus Aufgabenauflisten ausgelagert");
153                                 break;
154
155                         case '0.2.3': // SQL queries for v0.2.3
156                                 // Update notes (these will be set as task text!)
157                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
158                                 break;
159
160                         case '0.2.4': // SQL queries for v0.2.4
161                                 // Update notes (these will be set as task text!)
162                                 setExtensionUpdateNotes("Ausgabe der Auszahlungsm&ouml;glichkeiten im Mitgliedsbereich repariert.");
163                                 break;
164
165                         case '0.2.5': // SQL queries for v0.2.5
166                                 // Update notes (these will be set as task text!)
167                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
168                                 break;
169
170                         case '0.2.6': // SQL queries for v0.2.6
171                                 // Update notes (these will be set as task text!)
172                                 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
173                                 break;
174
175                         case '0.2.7': // SQL queries for v0.2.7
176                                 // Update notes (these will be set as task text!)
177                                 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
178                                 break;
179
180                         case '0.2.8': // SQL queries for v0.2.8
181                                 // Update notes (these will be set as task text!)
182                                 setExtensionUpdateNotes("Work-Arount-L&ouml;sung zu tempor&auml;ren Problemen mit der Task-Id eingebaut.");
183                                 break;
184
185                         case '0.2.9': // SQL queries for v0.2.9
186                                 // Update notes (these will be set as task text!)
187                                 setExtensionUpdateNotes("Nachricht an Admin bei Auszahlungsanfrage wird endlich versendet.");
188                                 break;
189
190                         case '0.3.0': // SQL queries for v0.3.0
191                                 // Update notes (these will be set as task text!)
192                                 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
193                                 break;
194
195                         case '0.3.1': // SQL queries for v0.3.1
196                                 // Update notes (these will be set as task text!)
197                                 setExtensionUpdateNotes("Fehler in Auszahlungsfunktion beseitigt, wenn Umrechnungsrate ungleich 1 eingestellt ist.");
198                                 break;
199
200                         case '0.3.2': // SQL queries for v0.3.2
201                                 // Update notes (these will be set as task text!)
202                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
203                                 break;
204
205                         case '0.3.3': // SQL queries for v0.3.3
206                                 // Update notes (these will be set as task text!)
207                                 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
208                                 break;
209
210                         case '0.3.4': // SQL queries for v0.3.4
211                                 // Update notes (these will be set as task text!)
212                                 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.");
213                                 break;
214
215                         case '0.3.5': // SQL queries for v0.3.5
216                                 // Update notes (these will be set as task text!)
217                                 setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
218                                 break;
219
220                         case '0.3.6': // SQL queries for v0.3.6
221                                 // Update notes (these will be set as task text!)
222                                 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
223                                 break;
224
225                         case '0.3.7': // SQL queries for v0.3.7
226                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Auszahlungsmanagement' WHERE `action`='payouts' AND (`what`='' OR `what` IS NULL) LIMIT 1");
227
228                                 // Update notes (these will be set as task text!)
229                                 setExtensionUpdateNotes("Verwaltung nach Management umgestellt.");
230                                 break;
231
232                         case '0.3.8': // SQL queries for v0.3.8
233                                 // Update notes (these will be set as task text!)
234                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
235                                 break;
236                 } // END - switch
237                 break;
238
239         case 'modify': // When the extension got modified
240                 break;
241
242         case 'test': // For testing purposes
243                 break;
244
245         case 'init': // Do stuff when extension is initialized
246                 break;
247
248         default: // Unknown extension mode
249                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
250                 break;
251 } // END - switch
252
253 // [EOF]
254 ?>