2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 03/09/2010 *
4 * =================== Last change: 03/09/2010 *
6 * -------------------------------------------------------------------- *
7 * File : ext-forced.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Clickable forced banner or text links *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Klickbare Forced-Banner oder -Textlinks *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009, 2010 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 setThisExtensionVersion('0.0');
46 // Version history array (add more with , '0.1.0' and so on)
47 setExtensionVersionHistory(array('0.0'));
49 // This extension is in development (non-productive)
50 enableExtensionProductive(false);
52 switch (getExtensionMode()) {
53 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
54 // This depends on 'sponsor' now
55 addExtensionDependency('sponsor');
58 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`');
59 addExtensionSql("CREATE TABLE IF NOT EXIST `{?_MYSQL_PREFIX?}_forced_ads` (
60 `forced_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
61 `forced_ads_ad_url` VARCHAR( 255 ) NULL DEFAULT NULL ,
62 `forced_ads_click_url` VARCHAR( 255 ) NOT NULL ,
63 `forced_ads_width` SMALLINT( 3 ) NULL DEFAULT NULL ,
64 `forced_ads_height` SMALLINT( 3 ) NULL DEFAULT NULL ,
65 `forced_ads_alt_text` VARCHAR( 255 ) NULL DEFAULT NULL ,
66 `forced_ads_framebreaker` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'Y',
67 `forced_ads_counter_views` BIGINT( 20 ) NOT NULL DEFAULT 0,
68 `forced_ads_counter_clicks` BIGINT( 20 ) NOT NULL DEFAULT 0,
69 `forced_ads_reload_lock` BIGINT( 20 ) NOT NULL DEFAULT 0,
70 `forced_ads_min_stay` BIGINT( 20 ) NOT NULL DEFAULT 0,
71 PRIMARY KEY ( `forced_ads_id` )
72 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Ads Data'");
75 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`');
76 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns` (
77 `forced_campaign_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
78 `forced_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL ,
79 `forced_campaign_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
80 `forced_campaign_status` ENUM( 'ACTIVE', 'PENDING', 'EXPIRED', 'LOCKED' ) NOT NULL DEFAULT 'PENDING',
81 `forced_campaign_lock_reason` VARCHAR( 255 ) NULL DEFAULT NULL ,
82 `forced_campaign_lock_timetstamp` TIMESTAMP NULL DEFAULT NULL ,
83 `forced_campaign_expired` TIMESTAMP NULL DEFAULT NULL ,
84 `forced_campaign_ordered_clicks` BIGINT( 20 ) NOT NULL DEFAULT 0,
85 `forced_campaign_costs_api` FLOAT( 20 , 5 ) UNSIGNED NULL DEFAULT NULL,
86 `forced_campaign_price_api` FLOAT( 20 , 5 ) UNSIGNED NULL DEFAULT NULL,
87 `forced_costs_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL,
88 INDEX ( `forced_ads_id` ),
89 INDEX ( `forced_costs_id` ),
90 PRIMARY KEY ( `forced_campaign_id` )
91 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Data'");
94 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`');
95 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_user` (
96 `forced_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
97 `forced_campaign_id` BIGINT( 20 ) UNSIGNED NOT NULL ,
98 `forced_user_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
99 `forced_user_type` ENUM( 'MEMBER', 'SPONSOR', 'ADMIN', 'API' ) NULL DEFAULT NULL ,
100 UNIQUE `forced_campaign_user` ( `forced_campaign_id` , `forced_user_id` , `forced_user_type` ),
101 INDEX ( `forced_user_id` ),
102 PRIMARY KEY ( `forced_id` )
103 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaigns<->User'");
106 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`');
107 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_costs` (
108 `forced_costs_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
109 `forced_costs_price_click` FLOAT( 20, 5 ) UNSIGNED NULL DEFAULT NULL ,
110 `forced_costs_payment_click` FLOAT( 20, 5 ) UNSIGNED NULL DEFAULT NULL ,
111 `forced_costs_visibility` ENUM( 'MEMBER', 'SPONSOR', 'ALL', 'NONE' ) NOT NULL DEFAULT 'NONE',
112 PRIMARY KEY ( `forced_costs_id` )
113 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Costs'");
116 case 'remove': // Do stuff when removing extension
117 // SQL commands to run
118 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`');
119 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`');
120 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`');
121 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`');
124 case 'activate': // Do stuff when admin activates this extension
125 // SQL commands to run
128 case 'deactivate': // Do stuff when admin deactivates this extension
129 // SQL commands to run
132 case 'update': // Update an extension
133 switch (getCurrentExtensionVersion()) {
134 case '0.0.1': // SQL queries for v0.0.1
137 // Update notes (these will be set as task text!)
138 setExtensionUpdateNotes('');
143 case 'modify': // When the extension got modified
146 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
149 case 'init': // Do stuff when extension is initialized
152 default: // Unknown extension mode
153 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));