From 52f1b0f588b492a7668204a74da47d5732791331 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 31 Oct 2009 23:12:42 +0000 Subject: [PATCH] ext-network continued (unfinished), weekly and monthly reset scripts fixed --- inc/extensions/ext-network.php | 98 ++++++++++++++++++++++++++++++++-- inc/filters.php | 4 +- 2 files changed, 96 insertions(+), 6 deletions(-) diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 5bb4e739c9..da69641ec6 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -49,21 +49,111 @@ setExtensionVersionHistory(array('0.0')); 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?}_network_config`"); - addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config` ( + // Main table which hold + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_data` ( `network_id` BIGINT(20) NOT NULL AUTO_INCREMENT, `network_name` VARCHAR(255) NOT NULL DEFAULT '', `network_title` VARCHAR(255) NOT NULL DEFAULT '', `network_reflink` VARCHAR(255) NOT NULL DEFAULT '', +`network_data_seperator CHAR(4) NOT NULL DEFAULT '|', +`network_row_seperator CHAR(4) NOT NULL DEFAULT '|', +`network_request_type` ENUM('GET','POST') NOT NULL DEFAULT 'GET', UNIQUE (`network_name`), PRIMARY KEY (`network_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Network data'"); + + // Types the network provider is supporting (e.g. Forced-Banner and so on) + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types` ( +`network_type_id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`network_type_name` VARCHAR(255) NOT NULL DEFAULT '', +`network_type_title` VARCHAR(255) NOT NULL DEFAULT '', +`network_type_request_url` VARCHAR(255) NOT NULL DEFAULT '', +`network_type_click_url` VARCHAR(255) NOT NULL DEFAULT '', +`network_type_banner_url` VARCHAR(255) NOT NULL DEFAULT '', +UNIQUE (`network_type_name`), +PRIMARY KEY (`network_type_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Types provideable by networks'"); + + // Error status codes + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_type_errors`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_type_codes` ( +`network_type_code_id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`network_type_code_value` VARCHAR(50) NOT NULL DEFAULT '', +`network_type_code_type` VARCHAR(100) NOT NULL DEFAULT 'INVALID_TYPE', +`network_type_id` BIGINT(20) NOT NULL DEFAULT 0, +UNIQUE `code_type` (`network_type_code_value`,`network_type_id`), +INDEX (`network_type_id`), +PRIMARY KEY (`network_type_code_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Error codes for all types'"); + + // Code types (internal table) + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_codes`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_codes` ( +`network_code_id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`network_code_type` VARCHAR(100) NOT NULL DEFAULT 'INVALID_TYPE', +UNIQUE (`network_code_type`), +PRIMARY KEY (`network_code_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Error types, generic data, DO NOT ALTER!'"); + + // Which network provider is serving which types + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_provider_types`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_provider_types` ( +`network_prodider_type_id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`network_id` BIGINT(20) NOT NULL DEFAULT 0, +`network_type_id` BIGINT(20) NOT NULL DEFAULT 0, +UNIQUE `provider_type` (`network_id`, `network_type_id`), +PRIMARY KEY (`network_provider_type_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Connection table between provider and types'"); + + // Data from the webmaster (you!) + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config_data`"); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config_data` ( +`network_id` BIGINT(20) NOT NULL DEFAULT 0, +`network_affiliate_id` BIGINT(20) NOT NULL DEFAULT 0, +`network_api_password` VARCHAR(255) NOT NULL DEFAULT '', +`network_site_id` BIGINT(20) NOT NULL DEFAULT 0, +UNIQUE `network_affiliate` (`network_id`,`network_affiliate_id`), +UNIQUE `affiliate_site` (`network_affiliate_id`,`network_site_id`), +PRIMARY KEY (`network_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Configuration data from the webmaster (you!)'"); + + // Insert error code types + // - Affiliate id or interface password wrong + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('AFF_ID_PASS_WRONG')"); + // - Webmaster's site id is not assigned (invalid, different affiliate id) + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('SITE_ID_NOT_ASSIGNED')"); + // - Webmaster's site id is locked + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('SITE_ID_LOCKED')"); + // - General error in interface data + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('INTERFACE_DATA_ERROR')"); + // - Request amount depleted + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('REQUESTS_DEPLETED')"); + // - No campaigns found for given criteria (but maybe there are with more widen criteria) + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('NO_CAMPAIGNS_FOUND')"); + // - No campaigns found with allowed interface output (but there are maybe non-interface campaigns) + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('NO_CAMPAIGNS_FOUND_INTERFACE')"); + // - Webmaster's site id is not unlocked for choosen type + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('SITE_ID_NOT_ALLOWED_TYPE')"); + // - Request parameters incomplete + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code_type`) VALUES ('REQUEST_PARAMS_INCOMPLETE')"); + + // Admin menu entries + addAdminMenuSql('network',NULL,'Sponsorennetzwerke','Verwalten Sie hier Sponsornetzwerke (API-Anbindung), versenden Sie deren Mails, oder übernehmen Sie deren Textlinks und vieles mehr. VORSICHT: Das Einrichten von weiteren Sponsornetzwerken ist nicht leicht, dafür aber sehr flexibel! Sollte ein Netzwerk fehlen, so melden Sie dies bitte im Forum!',4); + addAdminMenuSql('network','config_network','API-Daten','Stellen Sie Ihre Affiliate- Webseiten-Id und API-Passwort ein. Diese erhalten Sie zu über 99% aus dem jeweiligen Zugangsbereich des Anbieters. Sollten Sie bei einem Netzwerk noch nicht angemeldet sein, verwenden Sie bitte meinen Referal-Link.',1); break; case 'remove': // Do stuff when removing extension // SQL commands to run - addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_type_errors`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_provider_types`"); + addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config_data`"); + + // Admin menu + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='network'"); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/filters.php b/inc/filters.php index 99dfa919cc..5cda96ebf2 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -510,7 +510,7 @@ function FILTER_RUN_RESET_INCLUDES () { mergeIncludePool('reset', getArrayFromDirectory('inc/weekly/', 'weekly_')); // Update config - if ((!isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') != 'Y')) updateConfiguration('last_week', $currWeek); + if ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') != 'Y')) updateConfiguration('last_week', $currWeek); } // END - if // Create current month mark @@ -522,7 +522,7 @@ function FILTER_RUN_RESET_INCLUDES () { mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_')); // Update config - if ((!isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') != 'Y')) updateConfiguration('last_month', $currMonth); + if ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') != 'Y')) updateConfiguration('last_month', $currMonth); } // END - if } // END - if -- 2.39.5