2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 10/07/2004 *
\r
4 * ================ Last change: 07/08/2007 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : ext-transfer.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Point transfers between members *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Punktetransfers zwischen Mitgliedern *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
42 $EXT_VERSION = "0.2.9";
\r
44 // Auto-set extension version
\r
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
\r
47 // Version history array (add more with , "0.1" and so on)
\r
48 $EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "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");
\r
50 switch ($EXT_LOAD_MODE)
\r
52 case "register": // Do stuff when installtion is running
\r
53 // SQL commands to run
\r
54 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_transfers_in";
\r
55 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_transfers_out";
\r
57 // Transfer from a member
\r
58 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_transfers_in (
\r
59 id bigint(20) not null auto_increment,
\r
60 userid bigint(20) not null default '0',
\r
61 from_uid bigint(20) not null default '0',
\r
62 points bigint(20) not null default '0',
\r
63 reason varchar(255) not null default '',
\r
64 time_trans varchar(14) not null default '0',
\r
65 trans_id varchar(12) not null default '',
\r
71 // Transfers to a member
\r
72 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_transfers_out (
\r
73 id bigint(20) not null auto_increment,
\r
74 userid bigint(20) not null default '0',
\r
75 to_uid bigint(20) not null default '0',
\r
76 points bigint(20) not null default '0',
\r
77 reason varchar(255) not null default '',
\r
78 time_trans varchar(14) not null default '0',
\r
79 trans_id varchar(12) not null default '',
\r
86 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('transfer', '', '{!POINTS!}-Transfer', 'Verwalten Sie hier die {!POINTS!}-Transaktionen zwischen Ihren Mitgliedern.', 7)";
\r
87 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('transfer', 'list_transfer', 'Auflisten', 'Hier bekommen Sie alle ein- und ausgehende Transaktionen aufgelistet.', 1)";
\r
88 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('transfer', 'config_transfer', 'Einstellungen', 'Stellen Sie ein, wie viele Transaktionen aufgelistet werden sollen und wie alt diese werden dürfen. Die evtl. installierte autopurge-Erweiterung kann dann automatisch die veralteten Transktionen löschen.', 2)";
\r
89 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('transfer', 'del_transfer', 'Manuell löschen', 'Hier können Sie - abgesehen von der automatischen Löschung - Transaktionen selber löschen. Bitte beachten Sie, dass immer aus- und eingehende Transaktionen gleichzeitig gelöscht werden.', 3)";
\r
92 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, visible, locked, sort) VALUES ('main', 'transfer', '{!POINTS!}-Transfer', 'Y', 'Y', 5)";
\r
94 // Add config values
\r
95 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD transfer_max bigint(20) not null default '50'";
\r
96 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD transfer_age bigint(20) not null default '".(ONE_DAY*28)."'";
\r
97 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD transfer_timeout bigint(20) not null default '".ONE_DAY."'";
\r
98 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD transfer_balance bigint(20) not null default '100'";
\r
99 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD transfer_code bigint(20) not null default '5'";
\r
101 // Add row(s) to user's data
\r
102 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD opt_in enum('Y', 'N') not null default 'N'";
\r
105 case "remove": // Do stuff when removing extension
\r
106 // SQL commands to run
\r
107 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_transfers_in";
\r
108 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_transfers_out";
\r
109 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='transfer' LIMIT 4";
\r
110 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='transfer' LIMIT 1";
\r
111 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP transfer_max";
\r
112 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP transfer_age";
\r
113 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP transfer_timeout";
\r
114 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP transfer_balance";
\r
115 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP transfer_code";
\r
116 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data DROP opt_in";
\r
119 case "activate": // Do stuff when admin activates this extension
\r
120 // SQL commands to run
\r
121 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='transfer' LIMIT 1";
\r
124 case "deactivate": // Do stuff when admin deactivates this extension
\r
125 // SQL commands to run
\r
126 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='transfer' LIMIT 1";
\r
129 case "update": // Update an extension
\r
132 case "0.0.2": // SQL queries for v0.0.2
\r
133 // Update notes (these will be set as task text!)
\r
134 $UPDATE_NOTES = "Fehler <FONT class=\"admin_failed\">Warning: Missing argument 2 for create_timestamp_from_selections() in ".PATH."inc/libs/pro_functions.php on line 227</FONT> behoben.";
\r
137 case "0.0.3": // SQL queries for v0.0.3
\r
138 // Update notes (these will be set as task text!)
\r
139 $UPDATE_NOTES = "Überflüssige unset()-Anweisungen aus der what-config_transfer.php entfernt. Dies wird bereits von der eigenen Funktion ADMIN_SAVE_SETTINGS() erledigt.";
\r
142 case "0.0.3": // SQL queries for v0.0.3
\r
143 // Update notes (these will be set as task text!)
\r
144 $UPDATE_NOTES = "Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.";
\r
147 case "0.0.5": // SQL queries for v0.0.5
\r
148 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD ap_transfer enum('Y', 'N') not null default 'Y'";
\r
150 // Update notes (these will be set as task text!)
\r
151 $UPDATE_NOTES = "Link <I>Auflisten</LI> im Admin-Bereich hatte das eingeloggte Mitglied und nicht den eingeloggten Admin abgefragt. Automatisches Löschen von veraltete Einträgen kann unabhängig von der autopurge-Erweiterung de-/aktiviert werden. Bitte aktualisieren Sie auch die beiden Admin-Templates!";
\r
154 case "0.0.6": // SQL queries for v0.0.6
\r
155 // Update notes (these will be set as task text!)
\r
156 $UPDATE_NOTES = "Wegen des Theme-Supportes hat sich die URL zur CSS-Datei geändert.";
\r
159 case "0.0.7": // SQL queries for v0.0.7
\r
160 // Update notes (these will be set as task text!)
\r
161 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
\r
164 case "0.0.8": // SQL queries for v0.0.8
\r
165 // Update notes (these will be set as task text!)
\r
166 $UPDATE_NOTES = "Problem mit E in Transaktionsnummer beseitigt.";
\r
169 case "0.0.9": // SQL queries for v0.0.9
\r
170 // Update notes (these will be set as task text!)
\r
171 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
\r
174 case "0.1.0": // SQL queries for v0.1.0
\r
175 // Update notes (these will be set as task text!)
\r
176 $UPDATE_NOTES = "Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
\r
179 case "0.1.1": // SQL queries for v0.1.1
\r
180 // Update notes (these will be set as task text!)
\r
181 $UPDATE_NOTES = "Design "Solid-Business" eingebaut.";
\r
184 case "0.1.2": // SQL queries for v0.1.2
\r
185 // Update notes (these will be set as task text!)
\r
186 $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> überflüssige HTML-Tags entfernt.";
\r
189 case "0.1.3": // SQL queries for v0.1.3
\r
190 // Update notes (these will be set as task text!)
\r
191 $UPDATE_NOTES = "IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.";
\r
194 case "0.1.4": // SQL queries for v0.1.4
\r
195 // Update notes (these will be set as task text!)
\r
196 $UPDATE_NOTES = "Link zum Mitgliedsprofil in Funktion <U>ADMIN_USER_PROFILE_LINK()</U> ausgelagert.";
\r
199 case "0.1.5": // SQL queries for v0.1.5
\r
200 // Update notes (these will be set as task text!)
\r
201 $UPDATE_NOTES = "Template <u>admin_config_transfer_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!";
\r
204 case "0.1.6": // SQL queries for v0.1.6
\r
205 // Update notes (these will be set as task text!)
\r
206 $UPDATE_NOTES = "Wörter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
\r
209 case "0.1.7": // SQL queries for v0.1.7
\r
210 // Update notes (these will be set as task text!)
\r
211 $UPDATE_NOTES = "Wort <STRONG>Punkte</STRONG> dynamisiert.";
\r
214 case "0.1.8": // SQL queries for v0.1.8
\r
215 // Update notes (these will be set as task text!)
\r
216 $UPDATE_NOTES = "HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.";
\r
219 case "0.1.9": // SQL queries for v0.1.9
\r
220 // Update notes (these will be set as task text!)
\r
221 $UPDATE_NOTES = "Parser-Error im Mitgliedsbereich beseitigt.";
\r
224 case "0.2.0": // SQL queries for v0.2.0
\r
225 // Update notes (these will be set as task text!)
\r
226 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
\r
229 case "0.2.1": // SQL queries for v0.2.1
\r
230 // Update notes (these will be set as task text!)
\r
231 $UPDATE_NOTES = "Durchführung des Transfers korregiert.";
\r
234 case "0.2.2": // SQL queries for v0.2.2
\r
235 // Update notes (these will be set as task text!)
\r
236 $UPDATE_NOTES = "Sicherheitsupdate für die Include-Befehle.";
\r
239 case "0.2.3": // SQL queries for v0.2.3
\r
240 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'list_transfer')";
\r
241 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'del_transfer')";
\r
242 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', '', 'config_transfer')";
\r
244 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
\r
245 $EXT_UPDATE_DEPENDS = "sql_patches";
\r
247 // Update notes (these will be set as task text!)
\r
248 $UPDATE_NOTES = "Erweiterung in's neue Menüsystem integriert.";
\r
251 case "0.2.4": // SQL queries for v0.2.4
\r
252 // Update notes (these will be set as task text!)
\r
253 $UPDATE_NOTES = "<STRONG>Touring-Code wiederholen</STRONG> nach <STRONG>Touring-Code eingeben</STRONG> hin geändert.";
\r
256 case "0.2.5": // SQL queries for v0.2.5
\r
257 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='extras', sort='5' WHERE what='transfer' LIMIT 1";
\r
259 // Update notes (these will be set as task text!)
\r
260 $UPDATE_NOTES = "Mitgliedsmenü komplett geändert.";
\r
263 case "0.2.6": // SQL queries for v0.2.6
\r
264 // Update notes (these will be set as task text!)
\r
265 $UPDATE_NOTES = "Hash-Erstellung von <STRONG>md5()</STRONG> auf bessere Funktion <STRONG>generateHash()</STRONG> umgestellt.";
\r
268 case "0.2.7": // SQL queries for v0.2.7
\r
269 // Update notes (these will be set as task text!)
\r
270 $UPDATE_NOTES = "Die ".POINTS." können nun wieder wie gewohnt transferiert werden. Der Grund für <em>".TRANSFER_INVALID_PASSWORD."</em> war, dass der Cookie-Hash ein anderer ist, als der in der Datenbank... :-/";
\r
273 case "0.2.8": // SQL queries for v0.2.8
\r
274 // Update notes (these will be set as task text!)
\r
275 $UPDATE_NOTES = "Fehlermeldung <em>Notice: Undefined index: to_uid in ".PATH."/inc/modules/member/what-transfer.php on line 301</em> gefixt. Danke an <a href=\"http://forum.mxchange.org/profile-8.html\" target=\"_blank\" title=\"Forumprofil von Piter01\">Piter01</a>.";
\r
278 case "0.2.9": // SQL queries for v0.2.9
\r
279 // Update notes (these will be set as task text!)
\r
280 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
\r
285 default: // Do stuff when extension is loaded
\r
286 $DUMMY = LOAD_CONFIG("0");
\r
287 // Maximum of listed transfers for out- and in-transfers
\r
288 $CONFIG['transfer_max'] = $DUMMY['transfer_max'];
\r
290 $CONFIG['transfer_age'] = $DUMMY['transfer_age'];
\r
291 // Lock timeout for member settings
\r
292 $CONFIG['transfer_timeout'] = $DUMMY['transfer_timeout'];
\r
293 // Balance after points transfer
\r
294 $CONFIG['transfer_balance'] = $DUMMY['transfer_balance'];
\r
295 // Length of touring code
\r
296 $CONFIG['transfer_code'] = $DUMMY['transfer_code'];
\r
297 // Length of touring code
\r
298 $CONFIG['ap_transfer'] = $DUMMY['ap_transfer'];
\r
301 if ((defined('__DAILY_RESET')) && ($CONFIG['ap_transfer'] == "Y"))
\r
303 // Automatically remove outdated or not displayed transactions
\r
304 TRANSFER_AUTPPURGE($CONFIG['transfer_max'], $CONFIG['transfer_age']);
\r
308 // Language file prefix
\r
309 $EXT_LANG_PREFIX = "transfer";
\r
311 // Extension is always active?
\r
312 $EXT_ALWAYS_ACTIVE = "N";
\r