2 /************************************************************************
3 * MXChange v0.2.1 Start: 10/07/2004 *
4 * ================ Last change: 07/08/2007 *
6 * -------------------------------------------------------------------- *
7 * File : ext-transfer.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Point transfers between members *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Punktetransfers zwischen Mitgliedern *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 *
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. *
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. *
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, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
46 EXT_SET_VERSION('0.2.9');
48 // Version history array (add more with , '0.1.0' and so on)
49 EXT_SET_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'));
51 switch ($EXT_LOAD_MODE)
53 case 'register': // Do stuff when installation is running
54 // SQL commands to run
55 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_transfers_in`");
56 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_transfers_out`");
58 // Transfer from a member
59 ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_transfers_in` (
60 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
61 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
62 from_uid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
63 points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
64 reason VARCHAR(255) NOT NULL DEFAULT '',
65 time_trans VARCHAR(14) NOT NULL DEFAULT 0,
66 trans_id VARCHAR(12) NOT NULL DEFAULT '',
70 ) Type={!_TABLE_TYPE!}");
72 // Transfers to a member
73 ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_transfers_out` (
74 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
75 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
76 to_uid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
77 points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
78 reason VARCHAR(255) NOT NULL DEFAULT '',
79 time_trans VARCHAR(14) NOT NULL DEFAULT 0,
80 trans_id VARCHAR(12) NOT NULL DEFAULT '',
84 ) Type={!_TABLE_TYPE!}");
87 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('transfer', NULL, '{!POINTS!}-Transfer','Verwalten Sie hier die {!POINTS!}-Transaktionen zwischen Ihren Mitgliedern.', 7)");
88 ADD_EXT_SQL("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)");
89 ADD_EXT_SQL("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)");
90 ADD_EXT_SQL("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)");
93 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','transfer','{!POINTS!}-Transfer','Y','Y', 5)");
96 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD transfer_max BIGINT(20) UNSIGNED NOT NULL DEFAULT '50'");
97 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD transfer_age BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*28)."'");
98 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD transfer_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT '".getConfig('one_day')."'");
99 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD transfer_balance BIGINT(20) UNSIGNED NOT NULL DEFAULT 100");
100 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD transfer_code BIGINT(20) UNSIGNED NOT NULL DEFAULT 5");
102 // Add row(s) to user's data
103 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD opt_in ENUM('Y','N') NOT NULL DEFAULT 'N'");
106 case 'remove': // Do stuff when removing extension
107 // SQL commands to run
108 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_transfers_in`");
109 ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_transfers_out`");
110 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='transfer'");
111 ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='transfer'");
112 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP `opt_in`");
115 case 'activate': // Do stuff when admin activates this extension
116 // SQL commands to run
117 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='transfer' LIMIT 1");
120 case 'deactivate': // Do stuff when admin deactivates this extension
121 // SQL commands to run
122 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='transfer' LIMIT 1");
125 case 'update': // Update an extension
128 case '0.0.2': // SQL queries for v0.0.2
129 // Update notes (these will be set as task text!)
130 EXT_SET_UPDATE_NOTES("Fehler <div class=\"admin_failed\">Warning: Missing argument 2 for create_timestamp_from_selections() in {!PATH!}inc/libs/pro_functions.php on line 227</div> behoben.");
133 case '0.0.3': // SQL queries for v0.0.3
134 // Update notes (these will be set as task text!)
135 EXT_SET_UPDATE_NOTES("Überflüssige unset()-Anweisungen aus der what-config_transfer.php entfernt. Dies wird bereits von der eigenen Funktion ADMIN_SAVE_SETTINGS() erledigt.");
138 case '0.0.3': // SQL queries for v0.0.3
139 // Update notes (these will be set as task text!)
140 EXT_SET_UPDATE_NOTES("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
143 case '0.0.5': // SQL queries for v0.0.5
144 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD ap_transfer ENUM('Y','N') NOT NULL DEFAULT 'Y'");
146 // Update notes (these will be set as task text!)
147 EXT_SET_UPDATE_NOTES("Link <em>Auflisten</em> 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!");
150 case '0.0.6': // SQL queries for v0.0.6
151 // Update notes (these will be set as task text!)
152 EXT_SET_UPDATE_NOTES("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei geändert.");
155 case '0.0.7': // SQL queries for v0.0.7
156 // Update notes (these will be set as task text!)
157 EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
160 case '0.0.8': // SQL queries for v0.0.8
161 // Update notes (these will be set as task text!)
162 EXT_SET_UPDATE_NOTES("Problem mit E in Transaktionsnummer beseitigt.");
165 case '0.0.9': // SQL queries for v0.0.9
166 // Update notes (these will be set as task text!)
167 EXT_SET_UPDATE_NOTES("Problem mit Speicherung der Einstellungen beseitigt.");
170 case '0.1.0': // SQL queries for v0.2.1
171 // Update notes (these will be set as task text!)
172 EXT_SET_UPDATE_NOTES("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
175 case '0.1.1': // SQL queries for v0.1.1
176 // Update notes (these will be set as task text!)
177 EXT_SET_UPDATE_NOTES("Design "Solid-Business" eingebaut.");
180 case '0.1.2': // SQL queries for v0.1.2
181 // Update notes (these will be set as task text!)
182 EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> überflüssige HTML-Tags entfernt.");
185 case '0.1.3': // SQL queries for v0.1.3
186 // Update notes (these will be set as task text!)
187 EXT_SET_UPDATE_NOTES("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
190 case '0.1.4': // SQL queries for v0.1.4
191 // Update notes (these will be set as task text!)
192 EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
195 case '0.1.5': // SQL queries for v0.1.5
196 // Update notes (these will be set as task text!)
197 EXT_SET_UPDATE_NOTES("Template <u>admin_config_transfer_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!");
200 case '0.1.6': // SQL queries for v0.1.6
201 // Update notes (these will be set as task text!)
202 EXT_SET_UPDATE_NOTES("Wörter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
205 case '0.1.7': // SQL queries for v0.1.7
206 // Update notes (these will be set as task text!)
207 EXT_SET_UPDATE_NOTES("Wort <strong>Punkte</strong> dynamisiert.");
210 case '0.1.8': // SQL queries for v0.1.8
211 // Update notes (these will be set as task text!)
212 EXT_SET_UPDATE_NOTES("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
215 case '0.1.9': // SQL queries for v0.1.9
216 // Update notes (these will be set as task text!)
217 EXT_SET_UPDATE_NOTES("Parser-Error im Mitgliedsbereich beseitigt.");
220 case '0.2.0': // SQL queries for v0.2.0
221 // Update notes (these will be set as task text!)
222 EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
225 case '0.2.1': // SQL queries for v0.2.1
226 // Update notes (these will be set as task text!)
227 EXT_SET_UPDATE_NOTES("Durchführung des Transfers korregiert.");
230 case '0.2.2': // SQL queries for v0.2.2
231 // Update notes (these will be set as task text!)
232 EXT_SET_UPDATE_NOTES("Sicherheitsupdate für die Include-Befehle.");
235 case '0.2.3': // SQL queries for v0.2.3
236 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_transfer')");
237 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_transfer')");
238 ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_transfer')");
240 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
241 EXT_ADD_UPDATE_DEPENDS('sql_patches');
243 // Update notes (these will be set as task text!)
244 EXT_SET_UPDATE_NOTES("Erweiterung in's neue Menüsystem integriert.");
247 case '0.2.4': // SQL queries for v0.2.4
248 // Update notes (these will be set as task text!)
249 EXT_SET_UPDATE_NOTES("<strong>Touring-Code wiederholen</strong> nach <strong>Touring-Code eingeben</strong> hin geändert.");
252 case '0.2.5': // SQL queries for v0.2.5
253 ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='extras', `sort`='5' WHERE `what`='transfer' LIMIT 1");
255 // Update notes (these will be set as task text!)
256 EXT_SET_UPDATE_NOTES("Mitgliedsmenü komplett geändert.");
259 case '0.2.6': // SQL queries for v0.2.6
260 // Update notes (these will be set as task text!)
261 EXT_SET_UPDATE_NOTES("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
264 case '0.2.7': // SQL queries for v0.2.7
265 // Update notes (these will be set as task text!)
266 EXT_SET_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... :-/");
269 case '0.2.8': // SQL queries for v0.2.8
270 // Update notes (these will be set as task text!)
271 EXT_SET_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>.");
274 case '0.2.9': // SQL queries for v0.2.9
275 // Update notes (these will be set as task text!)
276 EXT_SET_UPDATE_NOTES("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
281 case 'modify': // When the extension got modified
284 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
287 default: // Do stuff when extension is loaded
288 if ((isResetModeEnabled()) && (getConfig('ap_transfer') == 'Y')) {
289 // Automatically remove outdated or not displayed transactions
290 TRANSFER_AUTPPURGE(getConfig('transfer_max'), getConfig('transfer_age'));