--- /dev/null
+<?php
+/************************************************************************
+ * Mailer-Project 0.2.1-FINAL Start: 09/25/2004 *
+ * ========================== Last change: 09/25/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : ext-engine.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Game engine system *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Game-Engine System *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ exit();
+} // END - if
+
+// Version number
+setThisExtensionVersion('0.0.0');
+
+// Version history array (add more with , '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 installtion is running
+ // SQL commands to run
+ addConfigAddSql('engine_free_transfers', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+ addConfigAddSql('engine_start_transfers', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 10000');
+ addConfigAddSql('engine_daily_transfers', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 100');
+ addConfigAddSql('engine_start_costs', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 5.00000');
+ addConfigAddSql('engine_mode', "ENUM('SERVER','CLIENT') NOT NULL DEFAULT 'SERVER'");
+ addConfigAddSql('engine_always_free', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
+ addConfigAddSql('engine_rates', 'LONGTEXT');
+ addConfigAddSql('engine_rate_multiOA', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 10000');
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_config` SET `engine_rates`='1:2:3:4:5:10:20:30:40:50:100:200:300:400:500:1000' WHERE `config`=0 LIMIT 1");
+
+ // Engine accounts
+ addDropTableSql('engine_accounts');
+ addCreateTableSql('engine_accounts', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`password` VARCHAR(255) NOT NULL DEFAULT '',
+`status` ENUM('ACTIVE','LOCKED','UNCONFIRMED') NOT NULL DEFAULT 'UNCONFIRMED',
+`query_amount` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`query_free` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`query_used` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`created` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`last_changed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+INDEX (`userid`),
+PRIMARY KEY (`id`)",
+ 'Accounts for the game engine');
+
+ // Tresors
+ addDropTableSql('engine_safe');
+ addCreateTableSql('engine_safe', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`engine_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`password` VARCHAR(255) NOT NULL DEFAULT '',
+`points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+INDEX (`engine_userid`),
+PRIMARY KEY (`id`)",
+ 'Safes for engine account');
+
+ // Access logbook
+ addDropTableSql('engine_log');
+ addCreateTableSql('engine_log', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`engine_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`cmd_type` VARCHAR(255) NOT NULL DEFAULT 'status',
+`cmd_code` VARCHAR(255) NOT NULL DEFAULT 'status',
+`log_level` TINYINT(4) UNSIGNED NOT NULL DEFAULT 0,
+`points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`reason` LONGTEXT NOT NULL,
+`remote_addr` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+`timemark` VARCHAR(10) NOT NULL DEFAULT '',
+KEY (`engine_userid`),
+PRIMARY KEY (`id`)",
+ 'Logged engine account accesses');
+
+ // Export URLs
+ addDropTableSql('engine_urls');
+ addCreateTableSql('engine_urls',"
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`title` VARCHAR(255) NOT NULL DEFAULT '',
+`base_url` LONGTEXT,
+`var1` VARCHAR(20) NOT NULL DEFAULT 'userid',
+`val1` VARCHAR(10) NOT NULL DEFAULT '%userid%',
+`var2` VARCHAR(20) NOT NULL DEFAULT 'pass',
+`val2` VARCHAR(10) NOT NULL DEFAULT '%pass%',
+`var3` VARCHAR(20) NOT NULL DEFAULT 'cmd',
+`val3` VARCHAR(10) NOT NULL DEFAULT '%cmd%',
+`var4` VARCHAR(20) NOT NULL DEFAULT 'points',
+`val4` VARCHAR(10) NOT NULL DEFAULT '%points%',
+`var5` VARCHAR(20) NOT NULL DEFAULT 'reason',
+`val5` VARCHAR(10) NOT NULL DEFAULT '%reason%',
+PRIMARY KEY (`id`)",
+ '');
+
+ // Admin menu
+ addAdminMenuSql('engine', NULL, 'Game-Engine', 'Einstellungen an der Game-Engine (Export-Account) vornehmen, Export-URLs einstellen.', 8);
+ addAdminMenuSql('engine', 'config_engine', 'Einstellungen', 'Einstellungen an der Game-Engine (Export-Account) vornehmen.', 1);
+ addAdminMenuSql('engine', 'engine_urls', 'Export-URLs', 'Export-URLs hinzufügen, bearbeiten oder löschen.', 2);
+ addAdminMenuSql('engine', 'unlock_engine', 'Accounts freigeben', 'Geben Sie hier neu angemeldete Export-Account für die Game-Engine frei. Erst dann werden die von Ihnen eingestellten "Anfragen bei Freischaltung" aufgebucht.', 3);
+ addAdminMenuSql('engine', 'edit_engine', 'Accounts editieren', 'Editieren Sie hier bestehende Export-Accounts (derzeit nur das Engine-Passwort).', 4);
+ addAdminMenuSql('engine', 'lock_engine', 'Accounts ent-/sperren', 'Sperren Sie freigegebene Export-Accounts bei Regelverstoss, etc. oder entsperren Sie diese wieder.', 5);
+ addAdminMenuSql('engine', 'del_engine', 'Accounts löschen', 'Löschen Sie bestehende Export-Accounts, egal welcher Status sie haben.', 6);
+ addAdminMenuSql('engine', 'add_engine', 'Anfragen aufbuchen', 'Buchen Sie dem Export-Account weitere Anfragen auf (query_amount).', 7);
+ addAdminMenuSql('engine', 'sub_engine', 'Anfragen abziehen', 'Ziehen Sie dem Export-Account Anfragen ab (query_used).', 8);
+
+ // Guest menu
+ addGuestMenuSql('main', 'engine', 'Export-Account', 'Y', 'Y', 10);
+
+ // Member menu
+ addMemberMenuSql('main', 'engine', 'Export-Account', 'Y', 'Y', 4);
+ break;
+
+ case 'remove': // Do stuff when removing extension
+ // SQL commands to run
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='engine'");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='engine' LIMIT 1");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='engine' LIMIT 1");
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module` LIKE 'engine%'");
+
+ // Remove tables as well
+ addDropTableSql('engine_accounts');
+ addDropTableSql('engine_safe');
+ addDropTableSql('engine_log');
+ addDropTableSql('engine_urls');
+ 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`='engine' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='engine' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N', `hidden`='N', `admin_only`='N', `mem_only`='N' WHERE `module` LIKE 'engine%'");
+ break;
+
+ case 'deactivate': // Do stuff when admin deactivates this extension
+ // SQL commands to run
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y', `locked`='Y' WHERE `what`='engine' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='Y' WHERE `what`='engine' LIMIT 1");
+ addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module` LIKE 'engine%'");
+ break;
+
+ case 'update': // Update an extension
+ switch (getCurrentExtensionVersion()) {
+ case '0.0.1': // SQL queries for v0.0.1
+ addExtensionSql('');
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes('');
+ break;
+ } // END - switch
+ break;
+
+ case 'modify': // When the extension got modified
+ break;
+
+ case 'test': // For testing purposes
+ break;
+
+ case 'init': // Do stuff when extension is initialized
+ break;
+
+ default: // Unknown extension mode
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+ break;
+} // END - switch
+
+// [EOF]
+?>