2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
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. *
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. *
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, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 setThisExtensionVersion('0.3.0');
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.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', '0.3.0'));
49 switch (getExtensionMode()) {
50 case 'register': // Do stuff when installation is running
51 // Transfer from a member
52 addDropTableSql('user_transfers_in');
53 addCreateTableSql('user_transfers_in', "
54 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
55 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
56 `from_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
57 `points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
58 `reason` VARCHAR(255) NOT NULL DEFAULT '',
59 `time_trans` VARCHAR(14) NOT NULL DEFAULT 0,
60 `trans_id` VARCHAR(12) NOT NULL DEFAULT '',
63 INDEX (`from_userid`)",
64 'Ingoing points transfers');
66 // Transfers to a member
67 addDropTableSql('user_transfers_out');
68 addCreateTableSql('user_transfers_out', "
69 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
70 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
71 `to_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
72 `points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
73 `reason` VARCHAR(255) NOT NULL DEFAULT '',
74 `time_trans` VARCHAR(14) NOT NULL DEFAULT 0,
75 `trans_id` VARCHAR(12) NOT NULL DEFAULT '',
79 'Outgoing points transfers');
82 addAdminMenuSql('transfer', NULL, '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transfer','Verwalten Sie hier die {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transaktionen zwischen Ihren Mitgliedern.', 7);
83 addAdminMenuSql('transfer','list_transfer','Auflisten','Hier bekommen Sie alle ein- und ausgehende Transaktionen aufgelistet.', 1);
84 addAdminMenuSql('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);
85 addAdminMenuSql('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);
88 addMemberMenuSql('extras', 'transfer', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transfer', 5);
91 addConfigAddSql('transfer_max', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 50');
92 addConfigAddSql('transfer_age', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 28));
93 addConfigAddSql('transfer_timeout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}');
94 addConfigAddSql('transfer_balance', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 100');
95 addConfigAddSql('transfer_code', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 5');
97 // Add row(s) to user's data
98 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD opt_in ENUM('Y','N') NOT NULL DEFAULT 'N'");
101 case 'remove': // Do stuff when removing extension
102 // SQL commands to run
103 addDropTableSql('user_transfers_in');
104 addDropTableSql('user_transfers_out');
105 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='transfer'");
106 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='transfer' LIMIT 1");
107 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `opt_in`");
110 case 'activate': // Do stuff when admin activates this extension
111 // SQL commands to run
112 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='transfer' LIMIT 1");
115 case 'deactivate': // Do stuff when admin deactivates this extension
116 // SQL commands to run
117 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='transfer' LIMIT 1");
120 case 'update': // Update an extension
121 switch (getCurrentExtensionVersion()) {
122 case '0.0.2': // SQL queries for v0.0.2
123 // Update notes (these will be set as task text!)
124 setExtensionUpdateNotes("Fehler <div class=\"notice\">Warning: Missing argument 2 for create_timestamp_from_selections() in {?PATH?}inc/libs/pro_functions.php on line 227</div> behoben.");
127 case '0.0.3': // SQL queries for v0.0.3
128 // Update notes (these will be set as task text!)
129 setExtensionUpdateNotes("Überflüssige unset()-Anweisungen aus der what-config_transfer.php entfernt. Dies wird bereits von der eigenen Funktion adminSaveSettings() erledigt.");
132 case '0.0.3': // SQL queries for v0.0.3
133 // Update notes (these will be set as task text!)
134 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
137 case '0.0.5': // SQL queries for v0.0.5
138 addConfigAddSql('ap_transfer', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
140 // Update notes (these will be set as task text!)
141 setExtensionUpdateNotes("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!");
144 case '0.0.6': // SQL queries for v0.0.6
145 // Update notes (these will be set as task text!)
146 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei geändert.");
149 case '0.0.7': // SQL queries for v0.0.7
150 // Update notes (these will be set as task text!)
151 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
154 case '0.0.8': // SQL queries for v0.0.8
155 // Update notes (these will be set as task text!)
156 setExtensionUpdateNotes("Problem mit E in Transaktionsnummer beseitigt.");
159 case '0.0.9': // SQL queries for v0.0.9
160 // Update notes (these will be set as task text!)
161 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
164 case '0.1.0': // SQL queries for v0.2.1
165 // Update notes (these will be set as task text!)
166 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
169 case '0.1.1': // SQL queries for v0.1.1
170 // Update notes (these will be set as task text!)
171 setExtensionUpdateNotes("Design "Solid-Business" eingebaut.");
174 case '0.1.2': // SQL queries for v0.1.2
175 // Update notes (these will be set as task text!)
176 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
179 case '0.1.3': // SQL queries for v0.1.3
180 // Update notes (these will be set as task text!)
181 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
184 case '0.1.4': // SQL queries for v0.1.4
185 // Update notes (these will be set as task text!)
186 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
189 case '0.1.5': // SQL queries for v0.1.5
190 // Update notes (these will be set as task text!)
191 setExtensionUpdateNotes("Template <u>admin_config_transfer_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!");
194 case '0.1.6': // SQL queries for v0.1.6
195 // Update notes (these will be set as task text!)
196 setExtensionUpdateNotes("Wörter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
199 case '0.1.7': // SQL queries for v0.1.7
200 // Update notes (these will be set as task text!)
201 setExtensionUpdateNotes("Wort <strong>Punkte</strong> dynamisiert.");
204 case '0.1.8': // SQL queries for v0.1.8
205 // Update notes (these will be set as task text!)
206 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
209 case '0.1.9': // SQL queries for v0.1.9
210 // Update notes (these will be set as task text!)
211 setExtensionUpdateNotes("Parser-Error im Mitgliedsbereich beseitigt.");
214 case '0.2.0': // SQL queries for v0.2.0
215 // Update notes (these will be set as task text!)
216 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
219 case '0.2.1': // SQL queries for v0.2.1
220 // Update notes (these will be set as task text!)
221 setExtensionUpdateNotes("Durchführung des Transfers korregiert.");
224 case '0.2.2': // SQL queries for v0.2.2
225 // Update notes (these will be set as task text!)
226 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
229 case '0.2.3': // SQL queries for v0.2.3
230 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`,`la_action`,`la_what`) VALUES ('member', '', 'list_transfer')");
231 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`,`la_action`,`la_what`) VALUES ('member', '', 'del_transfer')");
232 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`,`la_action`,`la_what`) VALUES ('config', '', 'config_transfer')");
234 // Depends on ext-sql_patches (or you have to execute these both SQL statements by phpMyAdmin
235 addExtensionDependency('sql_patches');
237 // Update notes (these will be set as task text!)
238 setExtensionUpdateNotes("Erweiterung in's neue Menüsystem integriert.");
241 case '0.2.4': // SQL queries for v0.2.4
242 // Update notes (these will be set as task text!)
243 setExtensionUpdateNotes("<strong>Touring-Code wiederholen</strong> nach <strong>Touring-Code eingeben</strong> hin geändert.");
246 case '0.2.5': // SQL queries for v0.2.5
247 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='extras', `sort`=5 WHERE `what`='transfer' LIMIT 1");
249 // Update notes (these will be set as task text!)
250 setExtensionUpdateNotes("Eintrag im Mitgliedsmenü verschoben.");
253 case '0.2.6': // SQL queries for v0.2.6
254 // Update notes (these will be set as task text!)
255 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
258 case '0.2.7': // SQL queries for v0.2.7
259 // Update notes (these will be set as task text!)
260 setExtensionUpdateNotes("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... :-/");
263 case '0.2.8': // SQL queries for v0.2.8
264 // Update notes (these will be set as task text!)
265 setExtensionUpdateNotes("Fehlermeldung <em>Notice: Undefined index: to_userid 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>.");
268 case '0.2.9': // SQL queries for v0.2.9
269 // Update notes (these will be set as task text!)
270 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
273 case '0.3.0': // SQL queries for v0.3.0
274 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('transfer','points','LOCKED','DIRECT')");
276 // This depends on ext-sql_patches
277 addExtensionDependency('sql_patches');
280 setExtensionUpdateNotes("Ünerweisungen anderer Mitglieder werden nun über die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
285 case 'modify': // When the extension got modified
288 case 'test': // For testing purposes
291 case 'init': // When extension is initialized
292 if ((isResetModeEnabled()) && (getConfig('ap_transfer') == 'Y')) {
293 // Automatically remove outdated or not displayed transactions
294 autoPurgeTransfers(getConfig('transfer_max'), getConfig('transfer_age'));
298 default: // Unknown extension mode
299 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));