2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 07/31/2013 *
4 * =================== Last change: 07/31/2013 *
6 * -------------------------------------------------------------------- *
7 * File : mode-update.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Wernis extension *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Auszahlung-Erweiterung *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 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 switch (getCurrentExtensionVersion()) {
45 case '0.0.1': // SQL queries for v0.0.1
46 addConfigAddSql('wernis_payout_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
47 addConfigAddSql('wernis_withdraw_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
48 addConfigAddSql('wernis_payout_factor', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000');
49 addConfigAddSql('wernis_withdraw_factor', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000');
50 addConfigAddSql('wernis_payout_fee_percent', 'FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000');
51 addConfigAddSql('wernis_withdraw_fee_percent', 'FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000');
52 addConfigAddSql('wernis_payout_fee_fix', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
53 addConfigAddSql('wernis_withdraw_fee_fix', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
55 // Update notes (these will be set as task text!)
56 setExtensionUpdateNotes("Ein-/Auszahlungsfunktion getrennt ein- und ausschaltbar, sowie mit Umrechungsfaktoren {?POINTS?}->Wernis versehen. Prozentualer Abzug als "Betreibergebühr hinzugefügt, was z.B. für Wechselstuben interessant ist.");
59 case '0.0.2': // SQL queries for v0.0.2
60 addConfigAddSql('wernis_pass_md5', "VARCHAR(32) NOT NULL DEFAULT ''");
62 // Update notes (these will be set as task text!)
63 setExtensionUpdateNotes("Auszahlungsfunktion an die neue API 0.2-BETA angepasst. Demnach muss Ihr Wernis-Passwort beim Auszahlen benutzt werden und in Ihrem {?mt_word?} als MD5-Hash gespeichert werden.");
66 case '0.0.3': // SQL queries for v0.0.3
67 addConfigAddSql('wernis_refid', 'INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT 00000');
69 // Update notes (these will be set as task text!)
70 setExtensionUpdateNotes("WDS66-Username muss nun eintragen werden (API-Anpassung).");
73 case '0.0.4': // SQL queries for v0.0.4
74 // Register points data
75 registerExtensionPointsData('wernis_withdraw', 'order_points', 'LOCKED', 'DIRECT');
78 setExtensionUpdateNotes("Überweisungen vom Portal werden nun über die Tabelle <strong>{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data</strong> verwaltet.");
81 case '0.0.5': // SQL queries for v0.0.5
82 addExtensionChangeTableColumnSql('user_wernis', 'wernis_type', 'wernis_type', "ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED'");
85 setExtensionUpdateNotes("IN/OUT ersetzt mit WITHDRAW/PAYOUT.");
88 case '0.0.6': // SQL queries for v0.0.6
89 addExtensionChangeTableColumnSql('config', 'wernis_pass_md5', 'wernis_pass_md5', " VARCHAR(255) NOT NULL DEFAULT ''");
92 setExtensionUpdateNotes("Es wird seit API-Version 0.6-BETA SHA256 (hexadezimal kodiert) verwendet.");
95 case '0.0.7': // SQL queries for v0.0.7
96 // This update depends on ext-register and ext-user
97 addExtensionDependency('register');
98 addExtensionDependency('user');
100 // Add data to both tables
101 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_user_register_provider` (`provider_name`, `provider_extension`) VALUES ('wernis_user_registration', 'wernis')");
102 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_user_login_provider` (`provider_name`, `provider_extension`) VALUES ('wernis_user_login', 'wernis')");
104 // Register all filters
105 registerFilter(__FILE__, __LINE__, 'user_registration', 'WERNIS_USER_REGISTRATION', FALSE, TRUE, isExtensionDryRun());
106 registerFilter(__FILE__, __LINE__, 'user_registration_done', 'WERNIS_USER_REGISTRATION_DONE', FALSE, TRUE, isExtensionDryRun());
107 registerFilter(__FILE__, __LINE__, 'user_registration_failed', 'WERNIS_USER_REGISTRATION_FAILED', FALSE, TRUE, isExtensionDryRun());
108 registerFilter(__FILE__, __LINE__, 'user_registration_form', 'WERNIS_USER_REGISTRATION_FORM', FALSE, TRUE, isExtensionDryRun());
109 registerFilter(__FILE__, __LINE__, 'user_login', 'WERNIS_USER_LOGIN', FALSE, TRUE, isExtensionDryRun());
110 registerFilter(__FILE__, __LINE__, 'check_user_registration', 'WERNIS_USER_REGISTRATION_CHECK', FALSE, TRUE, isExtensionDryRun());
111 registerFilter(__FILE__, __LINE__, 'check_user_login', 'WERNIS_USER_LOGIN_CHECK', FALSE, TRUE, isExtensionDryRun());
114 setExtensionUpdateNotes("Anmeldung ürber WDS66 API angefangen: Filter registriert.");
117 case '0.0.8': // SQL queries for v0.0.8
118 addConfigAddSql('wernis_base_url', "VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com'");
120 // SQL commands to run
121 addDropTableSql('wernis_regs');
122 addCreateTableSql('wernis_regs', "
123 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
124 `local_userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
125 `wernis_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
126 `api_auth_status` VARCHAR(255) NOT NULL DEFAULT 'UNKNOWN',
127 `api_auth_key` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
128 `api_redirect_challenge` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
129 `record_inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
131 INDEX (`wernis_userid`)",
132 'Registrations (also pending) over WDS66 API');
134 // Update notes (these will be set as task text!)
135 setExtensionUpdateNotes("Basis-URL für alle Scripte (Referral-Link, auth.php-Umleitung usw. nicht aber API) und Tabelle für API-Aufrufe von auth.php hinzugefügt.");