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, 2010 by Mailer Developer Team *
20 * For more information visit: http://www.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.2.9');
46 // Version history array (add more with , '0.1.0' and so on)
47 setExtensionVersionHistory(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'));
49 switch (getExtensionMode()) {
50 case 'register': // Do stuff when installation is running
51 // SQL commands to run
52 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_in`');
53 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_out`');
55 // Transfer from a member
56 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_transfers_in` (
57 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
58 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
59 `from_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
60 `points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
61 `reason` VARCHAR(255) NOT NULL DEFAULT '',
62 `time_trans` VARCHAR(14) NOT NULL DEFAULT 0,
63 `trans_id` VARCHAR(12) NOT NULL DEFAULT '',
67 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
69 // Transfers to a member
70 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_transfers_out` (
71 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
72 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
73 `to_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
74 `points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
75 `reason` VARCHAR(255) NOT NULL DEFAULT '',
76 `time_trans` VARCHAR(14) NOT NULL DEFAULT 0,
77 `trans_id` VARCHAR(12) NOT NULL DEFAULT '',
81 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
84 addAdminMenuSql('transfer', NULL, '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transfer','Verwalten Sie hier die {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transaktionen zwischen Ihren Mitgliedern.', 7);
85 addAdminMenuSql('transfer','list_transfer','Auflisten','Hier bekommen Sie alle ein- und ausgehende Transaktionen aufgelistet.', 1);
86 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);
87 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);
90 addMemberMenuSql('main','transfer','{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Transfer','N','Y', 5);
93 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `transfer_max` BIGINT(20) UNSIGNED NOT NULL DEFAULT 50");
94 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `transfer_age` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*28));
95 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `transfer_timeout` BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}");
96 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `transfer_balance` BIGINT(20) UNSIGNED NOT NULL DEFAULT 100");
97 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `transfer_code` BIGINT(20) UNSIGNED NOT NULL DEFAULT 5");
99 // Add row(s) to user's data
100 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD opt_in ENUM('Y','N') NOT NULL DEFAULT 'N'");
103 case 'remove': // Do stuff when removing extension
104 // SQL commands to run
105 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_in`');
106 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_transfers_out`');
107 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='transfer'");
108 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='transfer'");
109 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `opt_in`");
112 case 'activate': // Do stuff when admin activates this extension
113 // SQL commands to run
114 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='transfer' LIMIT 1");
117 case 'deactivate': // Do stuff when admin deactivates this extension
118 // SQL commands to run
119 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='transfer' LIMIT 1");
122 case 'update': // Update an extension
123 switch (getCurrentExtensionVersion()) {
124 case '0.0.2': // SQL queries for v0.0.2
125 // Update notes (these will be set as task text!)
126 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.");
129 case '0.0.3': // SQL queries for v0.0.3
130 // Update notes (these will be set as task text!)
131 setExtensionUpdateNotes("Überflüssige unset()-Anweisungen aus der what-config_transfer.php entfernt. Dies wird bereits von der eigenen Funktion adminSaveSettings() erledigt.");
134 case '0.0.3': // SQL queries for v0.0.3
135 // Update notes (these will be set as task text!)
136 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
139 case '0.0.5': // SQL queries for v0.0.5
140 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_transfer ENUM('Y','N') NOT NULL DEFAULT 'Y'");
142 // Update notes (these will be set as task text!)
143 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!");
146 case '0.0.6': // SQL queries for v0.0.6
147 // Update notes (these will be set as task text!)
148 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei geändert.");
151 case '0.0.7': // SQL queries for v0.0.7
152 // Update notes (these will be set as task text!)
153 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
156 case '0.0.8': // SQL queries for v0.0.8
157 // Update notes (these will be set as task text!)
158 setExtensionUpdateNotes("Problem mit E in Transaktionsnummer beseitigt.");
161 case '0.0.9': // SQL queries for v0.0.9
162 // Update notes (these will be set as task text!)
163 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
166 case '0.1.0': // SQL queries for v0.2.1
167 // Update notes (these will be set as task text!)
168 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
171 case '0.1.1': // SQL queries for v0.1.1
172 // Update notes (these will be set as task text!)
173 setExtensionUpdateNotes("Design "Solid-Business" eingebaut.");
176 case '0.1.2': // SQL queries for v0.1.2
177 // Update notes (these will be set as task text!)
178 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
181 case '0.1.3': // SQL queries for v0.1.3
182 // Update notes (these will be set as task text!)
183 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
186 case '0.1.4': // SQL queries for v0.1.4
187 // Update notes (these will be set as task text!)
188 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
191 case '0.1.5': // SQL queries for v0.1.5
192 // Update notes (these will be set as task text!)
193 setExtensionUpdateNotes("Template <u>admin_config_transfer_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!");
196 case '0.1.6': // SQL queries for v0.1.6
197 // Update notes (these will be set as task text!)
198 setExtensionUpdateNotes("Wörter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
201 case '0.1.7': // SQL queries for v0.1.7
202 // Update notes (these will be set as task text!)
203 setExtensionUpdateNotes("Wort <strong>Punkte</strong> dynamisiert.");
206 case '0.1.8': // SQL queries for v0.1.8
207 // Update notes (these will be set as task text!)
208 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
211 case '0.1.9': // SQL queries for v0.1.9
212 // Update notes (these will be set as task text!)
213 setExtensionUpdateNotes("Parser-Error im Mitgliedsbereich beseitigt.");
216 case '0.2.0': // SQL queries for v0.2.0
217 // Update notes (these will be set as task text!)
218 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
221 case '0.2.1': // SQL queries for v0.2.1
222 // Update notes (these will be set as task text!)
223 setExtensionUpdateNotes("Durchführung des Transfers korregiert.");
226 case '0.2.2': // SQL queries for v0.2.2
227 // Update notes (these will be set as task text!)
228 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
231 case '0.2.3': // SQL queries for v0.2.3
232 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`, `la_action`, `la_what`) VALUES ('member', '', 'list_transfer')");
233 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`, `la_action`, `la_what`) VALUES ('member', '', 'del_transfer')");
234 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`, `la_action`, `la_what`) VALUES ('config', '', 'config_transfer')");
236 // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
237 addExtensionDependency('sql_patches');
239 // Update notes (these will be set as task text!)
240 setExtensionUpdateNotes("Erweiterung in's neue Menüsystem integriert.");
243 case '0.2.4': // SQL queries for v0.2.4
244 // Update notes (these will be set as task text!)
245 setExtensionUpdateNotes("<strong>Touring-Code wiederholen</strong> nach <strong>Touring-Code eingeben</strong> hin geändert.");
248 case '0.2.5': // SQL queries for v0.2.5
249 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='extras', `sort`=5 WHERE `what`='transfer' LIMIT 1");
251 // Update notes (these will be set as task text!)
252 setExtensionUpdateNotes("Mitgliedsmenü komplett geändert.");
255 case '0.2.6': // SQL queries for v0.2.6
256 // Update notes (these will be set as task text!)
257 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
260 case '0.2.7': // SQL queries for v0.2.7
261 // Update notes (these will be set as task text!)
262 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... :-/");
265 case '0.2.8': // SQL queries for v0.2.8
266 // Update notes (these will be set as task text!)
267 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>.");
270 case '0.2.9': // SQL queries for v0.2.9
271 // Update notes (these will be set as task text!)
272 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
277 case 'modify': // When the extension got modified
280 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
283 case 'init': // When extension is initialized
284 if ((isResetModeEnabled()) && (getConfig('ap_transfer') == 'Y')) {
285 // Automatically remove outdated or not displayed transactions
286 autoPurgeTransfers(getConfig('transfer_max'), getConfig('transfer_age'));
290 default: // Unknown extension mode
291 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));