X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-forced.php;h=8d4af26ab78b6d8ab608f006626e6b8d95e7677f;hb=506be1a75d826f083ae6133aa8236eb5eeecab0a;hp=58b505eb281cfd8985771a10c0a5f1cccdb0213a;hpb=fb915364b24bf13cbac98a68d20b501dce907f24;p=mailer.git diff --git a/inc/extensions/ext-forced.php b/inc/extensions/ext-forced.php index 58b505eb28..8d4af26ab7 100644 --- a/inc/extensions/ext-forced.php +++ b/inc/extensions/ext-forced.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * 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 * @@ -54,11 +54,99 @@ switch (getExtensionMode()) { // This depends on 'sponsor' now addExtensionDependency('sponsor'); - // SQL commands to run + // - Ads + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`'); + addExtensionSql("CREATE TABLE IF NOT EXIST `{?_MYSQL_PREFIX?}_forced_ads` ( +`forced_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , +`forced_ads_ad_url` VARCHAR( 255 ) NULL DEFAULT NULL , +`forced_ads_click_url` VARCHAR( 255 ) NOT NULL , +`forced_ads_width` SMALLINT( 3 ) UNSIGNED NULL DEFAULT NULL , +`forced_ads_height` SMALLINT( 3 ) UNSIGNED NULL DEFAULT NULL , +`forced_ads_alt_text` VARCHAR( 255 ) NULL DEFAULT NULL , +`forced_ads_framebreaker` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'Y', +`forced_ads_views_counter` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0, +`forced_ads_clicks_counter` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0, +`forced_ads_reload_lock` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0, +`forced_ads_min_stay` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0, +PRIMARY KEY ( `forced_ads_id` ) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Ads Data'"); + + // - Campaigns + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns` ( +`forced_campaign_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , +`forced_campaign_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , +`forced_campaign_status` ENUM( 'ACTIVE', 'PENDING', 'EXPIRED', 'LOCKED' ) NOT NULL DEFAULT 'PENDING', +`forced_campaign_lock_reason` VARCHAR( 255 ) NULL DEFAULT NULL , +`forced_campaign_lock_timetstamp` TIMESTAMP NULL DEFAULT NULL , +`forced_campaign_expired` TIMESTAMP NULL DEFAULT NULL , +`forced_campaign_ordered_clicks` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0, +`forced_campaign_costs_api` FLOAT( 20 , 5 ) UNSIGNED NULL DEFAULT NULL, +`forced_campaign_price_api` FLOAT( 20 , 5 ) UNSIGNED NULL DEFAULT NULL, +`forced_costs_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL, +INDEX ( `forced_costs_id` ) , +PRIMARY KEY ( `forced_campaign_id` ) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Data'"); + + // - Campaigns <-> Ads + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_ads`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_ads` ( +`forced_campaign_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , +`forced_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL , +`forced_ads_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL , +UNIQUE `ads_campaign` ( `forced_campaign_id` , `forced_ads_id` ) , +PRIMARY KEY ( `forced_campaign_ads_id` ) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaigns<->Ads'"); + + // - Campaigns <-> User + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_user` ( +`forced_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , +`forced_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL , +`forced_user_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL , +`forced_user_type` ENUM( 'MEMBER', 'SPONSOR', 'ADMIN', 'API' ) NULL DEFAULT NULL , +UNIQUE `forced_campaign_user` ( `forced_campaign_id` , `forced_user_id` , `forced_user_type` ) , +INDEX ( `forced_user_id` ) , +PRIMARY KEY ( `forced_id` ) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaigns<->User'"); + + // - Campaign costs + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_costs` ( +`forced_costs_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , +`forced_costs_price_click` FLOAT( 20, 5 ) UNSIGNED NULL DEFAULT NULL , +`forced_costs_payment_click` FLOAT( 20, 5 ) UNSIGNED NULL DEFAULT NULL , +`forced_costs_visibility` ENUM( 'MEMBER', 'SPONSOR', 'ALL', 'NONE' ) NOT NULL DEFAULT 'NONE', +PRIMARY KEY ( `forced_costs_id` ) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Costs'"); + + // - Campaign Statistics + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_stats`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_stats` ( +`forced_stats_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT , +`forced_stats_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL , +`forced_stats_user_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL , +`forced_stats_viewed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , +`forced_stats_clicked` TIMESTAMP NULL DEFAULT NULL , +`forced_stats_real_ip` VARCHAR ( 15 ) NOT NULL DEFAULT '0.0.0.0' , +`forced_stats_remote_addr` VARCHAR ( 15 ) NOT NULL DEFAULT '0.0.0.0' , +`forced_stats_ua` VARCHAR ( 255 ) NULL DEFAULT NULL , +`forced_stats_is_proxy` ENUM ( 'Y', 'N' ) NOT NULL DEFAULT 'N' , +`forced_stats_session_id` VARCHAR ( 100 ) NULL DEFAULT NULL , +INDEX ( `forced_stats_campaign_id` ) , +INDEX ( `forced_stats_user_id` ) , +PRIMARY KEY ( `forced_stats_id` ) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Statistics'"); break; case 'remove': // Do stuff when removing extension // SQL commands to run + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`'); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`'); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_ads`'); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`'); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`'); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_stats`'); break; case 'activate': // Do stuff when admin activates this extension @@ -83,7 +171,7 @@ switch (getExtensionMode()) { 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