]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-wernis.php
Several bugfixes/improvements: (again)
[mailer.git] / inc / extensions / ext-wernis.php
index 5518a3feca20499ad1e4126de0f0d4b3c6e07982..3d8855fdf2b466f0df7c287c9ef6fb62a2b07626 100644 (file)
@@ -38,25 +38,25 @@ if (!defined('__SECURITY')) {
 }
 
 // Version of this extension
-$EXT_VERSION = "0.0.1";
+$EXT_VERSION = "0.0.3";
 
 // Auto-set extension version
 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3");
 
 switch ($EXT_LOAD_MODE)
 {
-case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
+case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
        // SQL commands to run
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_wernis";
        $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_wernis (
 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-userid BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 wernis_account VARCHAR(255) NOT NULL DEFAULT '',
-wernis_amount DOUBLE(22,5) UNSIGNED NOT NULL DEFAULT '0.00000',
-wernis_timestamp VARCHAR(10) NOT NULL DEFAULT '0',
+wernis_amount FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+wernis_timestamp VARCHAR(10) NOT NULL DEFAULT 0,
 wernis_type ENUM('IN','OUT','FAILED') NOT NULL DEFAULT 'FAILED',
 wernis_api_message TINYTEXT,
 wernis_api_status VARCHAR(255) NULL DEFAULT NULL,
@@ -65,78 +65,89 @@ PRIMARY KEY(id)
 ) TYPE=MyISAM";
 
        // Confiuration
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_min_payout BIGINT(20) UNSIGNED NOT NULL DEFAULT '40000'";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_min_withdraw BIGINT(20) UNSIGNED NOT NULL DEFAULT '5000'";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_api_id BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_api_md5 VARCHAR(32) NOT NULL DEFAULT ''";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_api_url VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com/api/'";
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_refid VARCHAR(6) NOT NULL DEFAULT ''";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_min_payout BIGINT(20) UNSIGNED NOT NULL DEFAULT '40000'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_min_withdraw BIGINT(20) UNSIGNED NOT NULL DEFAULT '5000'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_api_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_api_md5 VARCHAR(32) NOT NULL DEFAULT ''";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_api_url VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com/api/'";
 
        // User data
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD wernis_userid VARCHAR(6) NOT NULL DEFAULT ''";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD wernis_userid VARCHAR(6) NOT NULL DEFAULT ''";
 
        // Admin menu
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES('wernis', NULL, 'Wernis-Management','Konfiguration zur WDS66-API einstellen, Auszahlungen auflisten usw..', 15)";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES('wernis','config_wernis','WDS66-API-Einstellungen','Konfiguration zur WDS66-API einstellen.', 1)";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES('wernis','list_wernis','Wernis-Anfragen auflisten','Listet alle Wernis-Auszahlungsanfragen Ihrer Mitglieder auf.', 2)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis', NULL, 'Wernis-Management','Konfiguration zur WDS66-API einstellen, Auszahlungen auflisten usw..', 15)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis','config_wernis','WDS66-API-Einstellungen','Konfiguration zur WDS66-API einstellen.', 1)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis','list_wernis','Wernis-Anfragen auflisten','Listet alle Wernis-Auszahlungsanfragen Ihrer Mitglieder auf.', 2)";
 
        // Member menu
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('main','wernis','Wernis-Ein-/Auszahlungen','N','N', 11)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','wernis','Wernis-Ein-/Auszahlungen','N','N', 11)";
 
        // Guest menu
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('main','wernis_portal','WDS66-News','N','N', 7)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','wernis_portal','WDS66-News','N','N', 7)";
        break;
 
 case "remove": // Do stuff when removing extension
        // SQL commands to run
        $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_wernis";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='wernis'";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='wernis' LIMIT 1";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE what='wernis_portal' LIMIT 1";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='wernis'";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE what='wernis' LIMIT 1";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE what='wernis_portal' LIMIT 1";
        break;
 
 case "activate": // Do stuff when admin activates this extension
        // SQL commands to run
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='wernis' LIMIT 1";
+       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET visible='Y', locked='N' WHERE what='wernis_portal' LIMIT 1";
+       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y', locked='N' WHERE what='wernis' LIMIT 1";
        break;
 
 case "deactivate": // Do stuff when admin deactivates this extension
        // SQL commands to run
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='wernis' LIMIT 1";
+       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET visible='N', locked='Y' WHERE what='wernis_portal' LIMIT 1";
+       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='wernis' LIMIT 1";
        break;
 
 case "update": // Update an extension
        switch ($EXT_VER)
        {
        case "0.0.1": // SQL queries for v0.0.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_payout_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_withdraw_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_payout_factor DOUBLE(20,5) UNSIGNED NOT NULL DEFAULT 1.00000";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_withdraw_factor DOUBLE(20,5) UNSIGNED NOT NULL DEFAULT 1.00000";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_payout_fee_percent FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_withdraw_fee_percent FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_payout_fee_fix BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_withdraw_fee_fix BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_payout_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_withdraw_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_payout_factor FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_withdraw_factor FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_payout_fee_percent FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_withdraw_fee_percent FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_payout_fee_fix BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_withdraw_fee_fix BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "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.";
                break;
+
+       case "0.0.2": // SQL queries for v0.0.2
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD wernis_pass_md5 VARCHAR(32) NOT NULL DEFAULT ''";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Auszahlunsfunktion 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.";
+               break;
+
+       case "0.0.3": // SQL queries for v0.0.3
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` CHANGE `wernis_refid` `wernis_refid` INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Spaltentyp von VARCHAR(6) auf BIGINT(5) geändert.";
+               break;
        }
        break;
 
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+       break;
+
 default: // Do stuff when extension is loaded
+       // Init array
+       global $WERNIS;
+       $WERNIS = array();
        break;
 }
 
-// Language file prefix
-$EXT_LANG_PREFIX = "wernis";
-
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
-// Init array
-global $WERNIS;
-$WERNIS = array();
-
 //
 ?>