]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-wernis.php
Spaces added because we don't use spaces in SQL queries but in PHP code
[mailer.git] / inc / extensions / ext-wernis.php
index 41ef42b345b4742fb79832e83eebf4ae6029fe7d..7b495e69c6f9f3b2d1768f769dea82926376f68e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 04/11/2004 *
- * ================                             Last change: 11/15/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 04/11/2004 *
+ * ===================                          Last change: 11/15/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-wernis.php                                   *
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -50,45 +49,45 @@ setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3'));
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // SQL commands to run
-               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_wernis`");
-               addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_wernis` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-wernis_account VARCHAR(255) NOT NULL DEFAULT '',
-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,
-KEY (userid),
-PRIMARY KEY (id)
-) TYPE={?_TABLE_TYPE?}");
+               addDropTableSql('user_wernis');
+               addCreateTableSql('user_wernis', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`wernis_account` VARCHAR(255) NOT NULL DEFAULT '',
+`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,
+INDEX (`userid`),
+PRIMARY KEY (`id`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Transfered Wernis per user'");
 
                // Confiuration
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD wernis_min_payout BIGINT(20) UNSIGNED NOT NULL DEFAULT '40000'");
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD wernis_min_withdraw BIGINT(20) UNSIGNED NOT NULL DEFAULT '5000'");
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD wernis_api_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD wernis_api_md5 VARCHAR(32) NOT NULL DEFAULT ''");
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD wernis_api_url VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com/api/'");
+               addConfigAddSql('wernis_min_payout', "BIGINT(20) UNSIGNED NOT NULL DEFAULT '40000'");
+               addConfigAddSql('wernis_min_withdraw', "BIGINT(20) UNSIGNED NOT NULL DEFAULT '5000'");
+               addConfigAddSql('wernis_api_id', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+               addConfigAddSql('wernis_api_md5', "VARCHAR(32) NOT NULL DEFAULT ''");
+               addConfigAddSql('wernis_api_url', "VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com/api/'");
 
                // User data
                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD wernis_userid VARCHAR(6) NOT NULL DEFAULT ''");
 
                // Admin menu
-               addExtensionSql("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)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis','config_wernis','WDS66-API-Einstellungen','Konfiguration zur WDS66-API einstellen.', 1)");
-               addExtensionSql("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)");
+               addAdminMenuSql('wernis', NULL, 'Wernis-Management', 'Konfiguration zur WDS66-API einstellen, Auszahlungen auflisten usw..', 15);
+               addAdminMenuSql('wernis', 'config_wernis', 'WDS66-API-Einstellungen', 'Konfiguration zur WDS66-API einstellen.', 1);
+               addAdminMenuSql('wernis', 'list_wernis', 'Wernis-Anfragen auflisten', 'Listet alle Wernis-Auszahlungsanfragen Ihrer Mitglieder auf.', 2);
 
                // Member menu
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','wernis','Wernis-Ein-/Auszahlungen','N','N', 11)");
+               addMemberMenuSql('main', 'wernis', 'Wernis-Ein-/Auszahlungen', 'N', 'Y', 11);
 
                // Guest menu
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','wernis_portal','WDS66-News','N','N', 7)");
+               addGuestMenuSql('main', 'wernis_portal', 'WDS66-News', 'N', 'Y', 7);
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_wernis`");
+               addDropTableSql('user_wernis');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='wernis'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='wernis'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='wernis_portal'");
@@ -109,39 +108,39 @@ PRIMARY KEY (id)
        case 'update': // Update an extension
                switch (getCurrentExtensionVersion()) {
                        case '0.0.1': // SQL queries for v0.0.1
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_payout_active` ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_withdraw_active` ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_payout_factor` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_withdraw_factor` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_payout_fee_percent` FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_withdraw_fee_percent` FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_payout_fee_fix` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_withdraw_fee_fix` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+                               addConfigAddSql('wernis_payout_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
+                               addConfigAddSql('wernis_withdraw_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
+                               addConfigAddSql('wernis_payout_factor', "FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
+                               addConfigAddSql('wernis_withdraw_factor', "FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
+                               addConfigAddSql('wernis_payout_fee_percent', "FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000");
+                               addConfigAddSql('wernis_withdraw_fee_percent', "FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000");
+                               addConfigAddSql('wernis_payout_fee_fix', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+                               addConfigAddSql('wernis_withdraw_fee_fix', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Ein-/Auszahlungsfunktion getrennt ein- und ausschaltbar, sowie mit Umrechungsfaktoren {?POINTS?}-&gt;Wernis versehen. Prozentualer Abzug als &quot;Betreibergeb&uuml;hr hinzugef&uuml;gt, was z.B. f&uuml;r Wechselstuben interessant ist.");
                                break;
 
                        case '0.0.2': // SQL queries for v0.0.2
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_pass_md5` VARCHAR(32) NOT NULL DEFAULT ''");
+                               addConfigAddSql('wernis_pass_md5', "VARCHAR(32) NOT NULL DEFAULT ''");
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("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
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `wernis_refid` INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000'");
+                               addConfigAddSql('wernis_refid', "INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT 00000");
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("WDS66-Username muss nun eintragen werden (API-Anpassung).");
                                break;
-               }
+               } // END - switch
                break;
 
        case 'modify': // When the extension got modified
                break;
 
-       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+       case 'test': // For testing purposes
                break;
 
        case 'init': // Do stuff when extension is initialized
@@ -150,9 +149,9 @@ PRIMARY KEY (id)
                break;
 
        default: // Unknown extension mode
-               DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
-}
+} // END - switch
 
 // [EOF]
 ?>