]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-forced.php
New wrapper functions introduced, some one-line parameter monsters killed:
[mailer.git] / inc / extensions / ext-forced.php
index 6ccd9aff71d2d14bd7fe57fe051ca407d52c30bf..53c89cea1a0db384a56387e766a87255a6ace026 100644 (file)
@@ -8,17 +8,15 @@
  * -------------------------------------------------------------------- *
  * Short description : Clickable forced banner or text links            *
  * -------------------------------------------------------------------- *
- * Kurzbeschreibung  :                                                  *
+ * Kurzbeschreibung  : Klickbare Forced-Banner oder -Textlinks          *
  * -------------------------------------------------------------------- *
- * $Revision:: 856                                                    $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. March 2009)             $ *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: stelzi                                                   $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
+ * $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 *
@@ -53,11 +51,102 @@ enableExtensionProductive(false);
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
-               // SQL commands to run
+               // This depends on 'sponsor' now
+               addExtensionDependency('sponsor');
+
+               // - Ads
+               addDropTableSql('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
+               addDropTableSql('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
+               addDropTableSql('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
+               addDropTableSql('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
+               addDropTableSql('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
+               addDropTableSql('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
+               addDropTableSql('forced_ads');
+               addDropTableSql('forced_campaigns');
+               addDropTableSql('forced_campaigns_ads');
+               addDropTableSql('forced_campaigns_user');
+               addDropTableSql('forced_costs');
+               addDropTableSql('forced_stats');
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -82,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