<?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 *
* -------------------------------------------------------------------- *
- * Short description : Payout extension *
+ * Short description : Wernis extension *
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Auszahlung-Erweiterung *
* -------------------------------------------------------------------- *
- * Modified payout extension! See: http://www.mxchange.org for details *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2013 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 *
************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
+if (!defined('__SECURITY')) {
+ die();
+} // END - if
// Version of this extension
-$EXT_VERSION = "0.0";
-
-// 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");
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installtion 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',
-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_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=MyISAM";
-
- // Confiuration
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_min_payout BIGINT(20) NOT NULL DEFAULT '40000'";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_min_withdraw BIGINT(20) NOT NULL DEFAULT '5000'";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD wernis_api_id BIGINT(20) 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 ''";
-
- // User data
- $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)";
-
- // Member menu
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, visible, locked, sort) VALUES('main', 'wernis', 'Wernis-Ein-/Auszahlungen', 'N', 'N', '11')";
- 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 action='main' AND what='wernis' 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 action='main' AND 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 action='main' AND what='wernis' LIMIT 1";
- break;
-
-case "update": // Update an extension
- switch ($EXT_VER)
- {
- case "0.0.1": // SQL queries for v0.0.1
- // Update notes (these will be set as task text!)
- $UPDATE_NOTES = "";
+setThisExtensionVersion('0.0.9');
+
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.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'));
+
+switch (getExtensionMode()) {
+ case 'setup': // Do stuff when installation is running
+ // SQL commands to run
+ 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('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED',
+`wernis_api_message` TINYTEXT NOT NULL,
+`wernis_api_status` VARCHAR(255) NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+INDEX (`userid`)",
+ 'Transfered Wernis per user');
+
+ // Confiuration
+ 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
+ addExtensionAddTableColumnSql('user_data', 'wernis_userid', "VARCHAR(6) NULL DEFAULT NULL");
+ addExtensionAddTableColumnSql('user_data', 'wernis_refid', "VARCHAR(6) NULL DEFAULT NULL");
+
+ // Admin menu
+ 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', 'Anfragen auflisten', 'Listet alle Wernis-Ein- und -auszahlungsanfragen Ihrer Mitglieder und Sponsoren auf.', 2);
+
+ // Member menu
+ addMemberMenuSql('main', 'wernis', 'Wernis-Ein-/Auszahlungen', 11);
+
+ // Guest menu
+ addGuestMenuSql('main', 'wernis_portal', 'WDS66-News', 7);
break;
- }
- break;
-
-default: // Do stuff when extension is loaded
- $dummy = LOAD_CONFIG();
- $_CONFIG = merge_array($_CONFIG, $dummy);
- unset($dummy);
- break;
-}
-// Language file prefix
-$EXT_LANG_PREFIX = "wernis";
-
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
-
-// Init array
-global $WERNIS;
-$WERNIS = array();
-
-//
+
+ case 'remove': // Do stuff when removing extension
+ // SQL commands to run
+ addDropTableSql('user_wernis');
+ addDropTableSql('wernis_regs');
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='wernis'");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='wernis' LIMIT 1");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='wernis_portal' LIMIT 1");
+
+ // Unregister points data
+ unregisterExtensionPointsData('wernis_withdraw');
+
+ // Unregister all filters
+ unregisterFilter(__FILE__, __LINE__, 'user_registration', 'WERNIS_USER_REGISTRATION', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'user_registration_done', 'WERNIS_USER_REGISTRATION_DONE', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'user_registration_failed', 'WERNIS_USER_REGISTRATION_FAILED', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'user_registration_form', 'WERNIS_USER_REGISTRATION_FORM', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'user_login', 'WERNIS_USER_LOGIN', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'PRE_USER_REGISTRATION_WERNIS', TRUE, isExtensionDryRun());
+ 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`='wernis_portal' LIMIT 1");
+ addExtensionSql("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
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `what`='wernis_portal' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='wernis' LIMIT 1");
+ break;
+
+ case 'update': // Update an extension
+ break;
+
+ case 'modify': // When the extension got modified
+ break;
+
+ case 'test': // For testing purposes
+ break;
+
+ case 'init': // Do stuff when extension is initialized
+ // Init array
+ $GLOBALS['wernis_data'] = array();
+ break;
+
+ default: // Unknown extension mode
+ reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));
+ break;
+} // END - switch
+
+// [EOF]
?>