<?php
/************************************************************************
- * Mailer v0.2.1-FINAL Start: 19/08/2010 *
- * =================== Last change: 19/08/2010 *
+ * Mailer v0.2.1-FINAL Start: 08/19/2010 *
+ * =================== Last change: 08/19/2010 *
* *
* -------------------------------------------------------------------- *
* File : ext-funcoins.php *
* Short description : Extension for the FunCoins API integration *
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Erweiterung fuer die Integration der *
- * FunCoins-API ( *
+ * FunCoins-API (FoCo-Ex²) *
* -------------------------------------------------------------------- *
* $Revision:: $ *
* $Date:: $ *
* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009, 2010 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
} // END - if
// Version number
-setThisExtensionVersion('0.0');
+setThisExtensionVersion('0.0.0');
-// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0'));
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0'));
// This extension is in development (non-productive)
enableExtensionProductive(false);
switch (getExtensionMode()) {
- case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+ case 'register': // Do stuff when installation is running
+ // This depends on ext-sql_patches
+ addExtensionDependency('sql_patches');
+
// SQL commands to run
+ addDropTableSql('user_funcoins');
+ addCreateTableSql('user_funcoins', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Record identification',
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Local userid',
+`funcoins_account` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'FunCoins account',
+`funcoins_amount` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000 COMMENT 'Transfered amount',
+`funcoins_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Booking timestamp',
+`funcoins_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED' COMMENT 'Transaction type',
+`funcoins_tan` VARCHAR(255) NULL DEFAULT NULL COMMENT 'TAN from API',
+`funcoins_api_response` TINYTEXT COMMENT 'Clear text API response (only for debugging)',
+`funcoins_api_status` INT(4) NULL DEFAULT NULL COMMENT 'Status code from API',
+PRIMARY KEY (`id`),
+UNIQUE (`funcoins_tan`),
+INDEX (`userid`)",
+ 'Transfered FunCoins per user');
+
+ // Confiuration
+ addConfigAddSql('funcoins_min_payout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 40000');
+ addConfigAddSql('funcoins_min_withdraw', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 5000');
+ addConfigAddSql('funcoins_api_id', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+ addConfigAddSql('funcoins_api_password', "VARCHAR(255) NOT NULL DEFAULT ''");
+ addConfigAddSql('funcoins_refid', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+ addConfigAddSql('funcoins_payout_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('funcoins_withdraw_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('funcoins_payout_factor', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000');
+ addConfigAddSql('funcoins_withdraw_factor', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000');
+ addConfigAddSql('funcoins_payout_fee_percent', 'FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000');
+ addConfigAddSql('funcoins_withdraw_fee_percent', 'FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000');
+ addConfigAddSql('funcoins_payout_fee_fix', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+ addConfigAddSql('funcoins_withdraw_fee_fix', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+
+ // Points data
+ addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('funcoins_withdraw','order_points','LOCKED','DIRECT')");
+
+ // User data
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `funcoins_userid` BIGINT(20) NULL DEFAULT NULL");
+
+ // Admin menu
+ addAdminMenuSql('funcoins', NULL, 'FunCoins-Management', 'Konfiguration zur FuCo-Ex² einstellen, Auszahlungen auflisten usw..', 15);
+ addAdminMenuSql('funcoins', 'config_funcoins', 'FuCo-Ex²-Einstellungen', 'Konfiguration zur FuCo-Ex² einstellen.', 1);
+ addAdminMenuSql('funcoins', 'list_funcoins', 'Anfragen auflisten', 'Listet alle FunCoins-Ein- und -Auszahlungsanfragen Ihrer Mitglieder und Sponsoren auf.', 2);
+
+ // Member menu
+ addMemberMenuSql('main', 'funcoins', 'FunCoins-Ein-/Auszahlungen', 11);
break;
case 'remove': // Do stuff when removing extension
// SQL commands to run
+ addDropTableSql('user_funcoins');
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='funcoins'");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='funcoins' LIMIT 1");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='funcoins_portal' LIMIT 1");
break;
case 'activate': // Do stuff when admin activates this extension
// SQL commands to run
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y',`locked`='N' WHERE `what`='funcoins_portal' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='funcoins' LIMIT 1");
break;
case 'deactivate': // Do stuff when admin deactivates this extension
// SQL commands to run
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `what`='funcoins_portal' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='funcoins' LIMIT 1");
break;
case 'update': // Update an extension
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
+ // Init array
+ $GLOBALS['funcoins_data'] = array();
break;
default: // Unknown extension mode