Invalid responses from check-updates3.php call should be traced back and fixed. This...
[mailer.git] / inc / extensions / ext-network.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 12/18/2008 *
4  * ===================                          Last change: 11/01/2009 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-network.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Generic (sponsor) network connection extension   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Allgemeine Werbenetzwerk-Erweiterung             *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * @TODO AbisZED: Which charset?                                        *
21  * @TODO Ad-Magnet: Layer(klick?). Layerviews.Skybannerklick/-view,     *
22  * @TODO Ad-Magnet: Banner-View, Textlink-Klick/-View. Page-Peel        *
23  * @TODO ADCocktail: Traffic, BIDausKAS???                              *
24  * @TODO Ads4.de: Traffic                                               *
25  * @TODO Ads4Webbis: Traffic                                            *
26  * @TODO Ads4World: Traffic                                             *
27  * @TODO Affiliblatt: All except banner                                 *
28  * @TODO doubleads: Which charset?                                      *
29  * @TODO Fusion-Ads: Has click/banner URL in API response               *
30  * @TODO GolloX: Which charset?                                         *
31  * @TODO homeADS: Which charset?                                        *
32  * @TODO paid4ad: Waiting for approval                                  *
33  * @TODO secash: Traffic                                                *
34  * @TODO ultraPROMO: Traffic                                            *
35  * -------------------------------------------------------------------- *
36  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
37  * For more information visit: http://www.mxchange.org                  *
38  *                                                                      *
39  * This program is free software; you can redistribute it and/or modify *
40  * it under the terms of the GNU General Public License as published by *
41  * the Free Software Foundation; either version 2 of the License, or    *
42  * (at your option) any later version.                                  *
43  *                                                                      *
44  * This program is distributed in the hope that it will be useful,      *
45  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
46  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
47  * GNU General Public License for more details.                         *
48  *                                                                      *
49  * You should have received a copy of the GNU General Public License    *
50  * along with this program; if not, write to the Free Software          *
51  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
52  * MA  02110-1301  USA                                                  *
53  ************************************************************************/
54
55 // Some security stuff...
56 if (!defined('__SECURITY')) {
57         die();
58 } // END - if
59
60 // Version number
61 setThisExtensionVersion('0.0');
62
63 // Version history array (add more with , '0.1.0' and so on)
64 setExtensionVersionHistory(array('0.0'));
65
66 // This extension is in development (non-productive)
67 enableExtensionProductive(false);
68
69 switch (getExtensionMode()) {
70         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
71                 // Main table which hold
72                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`');
73                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_data` (
74 `network_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
75 `network_short_name` VARCHAR(50) NOT NULL DEFAULT '',
76 `network_title` VARCHAR(255) NOT NULL DEFAULT '',
77 `network_reflink` VARCHAR(255) NOT NULL DEFAULT '',
78 `network_data_seperator` CHAR(4) NOT NULL DEFAULT '|',
79 `network_row_seperator` CHAR(4) NOT NULL DEFAULT '|',
80 `network_request_type` ENUM('GET','POST') NOT NULL DEFAULT 'GET',
81 `network_charset` VARCHAR(20) NOT NULL DEFAULT 'UTF-8',
82 UNIQUE (`network_short_name`),
83 PRIMARY KEY (`network_id`)
84 ) TYPE={?_TABLE_TYPE?} COMMENT='Network data'");
85
86                 // Types the network provider is supporting (e.g. Forced-Banner and so on)
87                 // @TODO network_type_handle is an internal name and needs documentation
88                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`');
89                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types` (
90 `network_type_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
91 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
92 `network_type_handle` VARCHAR(255) NOT NULL DEFAULT '',
93 `network_type_api_url` VARCHAR(255) NOT NULL DEFAULT '',
94 `network_type_click_url` VARCHAR(255) NOT NULL DEFAULT '',
95 `network_type_banner_url` VARCHAR(255) NULL DEFAULT NULL,
96 UNIQUE `provider_type` (`network_id`,`network_type_handle`),
97 PRIMARY KEY (`network_type_id`)
98 ) TYPE={?_TABLE_TYPE?} COMMENT='Types provideable by networks'");
99
100                 // HTTP parameters (names) for URLs
101                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_request_params`');
102                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_request_params` (
103 `network_param_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
104 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
105 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
106 `request_param_key` VARCHAR(10) NOT NULL DEFAULT 'invalid',
107 `request_param_value` VARCHAR(10) NOT NULL DEFAULT 'invalid',
108 `request_param_default` VARCHAR(10) NULL DEFAULT NULL,
109 UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`request_param_key`),
110 UNIQUE `provider_type_value` (`network_id`,`network_type_id`,`request_param_value`),
111 PRIMARY KEY (`network_param_id`)
112 ) TYPE={?_TABLE_TYPE?} COMMENT='Request parameters for GET/POST request'");
113
114                 // Error status codes
115                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_type_codes`');
116                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_type_codes` (
117 `network_type_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
118 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
119 `network_type_code_value` VARCHAR(50) NOT NULL DEFAULT '',
120 `network_type_code_type` VARCHAR(100) NOT NULL DEFAULT 'INVALID_TYPE',
121 UNIQUE `code_type` (`network_type_code_value`,`network_type_id`),
122 INDEX (`network_type_id`),
123 PRIMARY KEY (`network_type_code_id`)
124 ) TYPE={?_TABLE_TYPE?} COMMENT='Error codes for all types'");
125
126                 // Code types (internal table)
127                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_codes`');
128                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_codes` (
129 `network_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
130 `network_code` VARCHAR(100) NOT NULL DEFAULT 'INVALID_CODE',
131 UNIQUE (`network_code`),
132 PRIMARY KEY (`network_code_id`)
133 ) TYPE={?_TABLE_TYPE?} COMMENT='Error types, generic data, DO NOT ALTER!'");
134
135                 // Valid translation keys (we hate hard-coded arrays, you see?)
136                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_translations`');
137                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_translations` (
138 `network_translate_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
139 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
140 `network_translation` VARCHAR(100) NOT NULL DEFAULT '',
141 UNIQUE `type_trans` (`network_type_id`,`network_translation`),
142 PRIMARY KEY (`network_translate_id`)
143 ) TYPE={?_TABLE_TYPE?} COMMENT='Translations for array keys, generic data, DO NOT ALTER!'");
144
145                 // Array-Element translation tables per type/provider
146                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_array_translation`');
147                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_array_translation` (
148 `network_translate_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
149 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
150 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
151 `network_array_key` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,
152 `network_translation` VARCHAR(100) NOT NULL DEFAULT '',
153 UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`network_array_key`),
154 UNIQUE `provider_type_trans` (`network_id`,`network_type_id`,`network_translation`),
155 PRIMARY KEY (`network_translate_id`)
156 ) TYPE={?_TABLE_TYPE?} COMMENT='Cache for all queried APIs'");
157
158                 // Data from the webmaster (you!)
159                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`');
160                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config` (
161 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
162 `network_affiliate_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
163 `network_api_password` VARCHAR(255) NOT NULL DEFAULT '',
164 `network_site_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
165 `network_query_amount` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
166 UNIQUE `network_affiliate` (`network_id`,`network_affiliate_id`),
167 UNIQUE `affiliate_site` (`network_affiliate_id`,`network_site_id`),
168 PRIMARY KEY (`network_id`)
169 ) TYPE={?_TABLE_TYPE?} COMMENT='Configuration data from the webmaster (you!)'");
170
171                 // Configuration data for e.g. reload-time
172                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`');
173                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types_config` (
174 `network_data_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
175 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
176 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
177 `max_reload_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
178 `min_waiting_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
179 `min_remain_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
180 `min_payment` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
181 `allow_erotic` VARCHAR(10) NOT NULL DEFAULT '',
182 UNIQUE `provider_type` (`network_id`,`network_type_id`),
183 PRIMARY KEY (`network_data_id`)
184 ) TYPE={?_TABLE_TYPE?} COMMENT='Configuration data for every type (e.g. reload-time)'");
185
186                 // Cache for queried APIs. Re-check depends on config
187                 // `network_cache_refresh` in seconds or if set to zero, full day
188                 // divided by query amount.
189                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`');
190                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_cache` (
191 `network_cache_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
192 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
193 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
194 `network_cache_data` MEDIUMBLOB,
195 `network_cache_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00',
196 UNIQUE `provider_type` (`network_id`,`network_type_id`),
197 PRIMARY KEY (`network_cache_id`)
198 ) TYPE={?_TABLE_TYPE?} COMMENT='Cache for all queried APIs'");
199
200                 // Reload locks for several types
201                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_reloads`');
202                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_reloads` (
203 `network_reload_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
204 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
205 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
206 `network_reload_lock` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,
207 `network_inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
208 UNIQUE `provider_type` (`network_id`,`network_type_id`),
209 PRIMARY KEY (`network_reload_id`)
210 ) TYPE={?_TABLE_TYPE?} COMMENT='Reload locks'");
211
212                 // Insert error code types
213                 // - Affiliate id or interface password wrong
214                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('AFF_ID_PASS_WRONG')");
215                 // - Webmaster's site id is not assigned (invalid, different affiliate id)
216                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('SITE_ID_NOT_ASSIGNED')");
217                 // - Webmaster's site id is locked
218                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('SITE_ID_LOCKED')");
219                 // - General error in interface data
220                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('INTERFACE_DATA_ERROR')");
221                 // - Request amount depleted
222                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('REQUESTS_DEPLETED')");
223                 // - No campaigns found for given criteria (but maybe there are with more widen criteria)
224                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('NO_CAMPAIGNS_FOUND')");
225                 // - No campaigns found with allowed interface output (but there are maybe non-interface campaigns)
226                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('NO_CAMPAIGNS_FOUND_INTERFACE')");
227                 // - Webmaster's site id is not unlocked for choosen type
228                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('SITE_ID_NOT_ALLOWED_TYPE')");
229                 // - Request parameters incomplete
230                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('REQUEST_PARAMS_INCOMPLETE')");
231
232                 // Sponsor networks
233                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_data` (`network_short_name`, `network_title`, `network_reflink`, `network_data_seperator`, `network_row_seperator`, `network_request_type`, `network_charset`) VALUES
234 ('a3h', 'A3H', 'http://www.a3h.de?ref=1447', '|', '|', 'GET', 'WINDOWS-1252'),
235 ('abiszed','AbisZED-Netz','http://abiszed-netz.de/index.php?ref=557', '|', '|', 'GET', 'WINDOWS-1252'),
236 ('ad-magnet', 'AD-Magnet', 'http://www.ad-magnet.de/index.php?ref=495', '|', '|', 'GET', 'ISO-8859-1'),
237 ('adcocktail', 'ADCocktail', 'http://www.adcocktail.com/?rid=2596', '|', '|', 'GET', 'WINDOWS-1252'),
238 ('ads4', 'Ads4.de', 'http://www.ads4.de/?werber=Quix0r', '|', '|', 'GET', 'WINDOWS-1252'),
239 ('ads4webbis', 'Ads4Webbis', 'http://www.ads4webbis.de?ref=835', '|', '|', 'GET', 'UTF-8'),
240 ('ads4world', 'Ads4World', 'http://www.ads4world.de?ref=252', '|', '|', 'GET', 'UTF-8'),
241 ('affiliblatt', 'Affiliblatt', 'http://www.Affiliblatt.de/?sid=MTAzNQ==&site=home', '|', '|', 'GET', 'UTF-8'),
242 ('alster', 'Alster-Marketing', 'http://www.alstermarketing.de?ref=1851', '|', '|', 'GET', 'ISO-8859-16'),
243 ('bonus', 'BonusSponsor', 'http://www.bonussponsor.de?ref=1286', '|', '|', 'GET', 'WINDOWS-1252'),
244 ('fusion', 'Fusion-Ads', 'http://www.fusion-ads.de/?ref=84', '|', '|', 'GET', 'UTF-8'),
245 ('make-euros', 'Make-Euros.de', 'http://www.make-euros.de?ref=1184', '|', '|', 'GET', 'ISO-8859-1'),
246 ('power-promo', 'Power-Promo', 'http://www.power-promo.de?ref=1231', '|', '|', 'GET', 'WINDOWS-1252'),
247 ('yoomedia', 'Yoo!Media Solutions', 'http://www.yoomedia.de?ref=1715', '|', '|', 'GET', 'WINDOWS-1252')");
248
249                 // Network type handlers - A3H
250                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`, `network_id`,`network_type_handle`,`network_type_api_url`,`network_type_click_url`,`network_type_banner_url`) VALUES
251 (1, 1, 'banner', 'http://www.a3h.de/interface/out_banner.php', 'http://www.a3h.de/bannerklf.php?id=%CID%', 'http://www.a3h.de/banner.php?id=%CID%'),
252 (2, 1, 'textlink', 'http://www.a3h.de/interface/ out_textlink.php', 'http://www.a3h.de/textlinkklick.php?id=%CID%', NULL),
253 (3, 1, 'surfbar', 'http://www.a3h.de/interface/out_sbanner.php', 'http://www.a3h.de/bannerklf.php?id=%CID%', 'http://www.a3h.de/banner.php?id=%CID%'),
254 (4, 1, 'focredbanner', 'http://www.a3h.de/interface/out_fbanner.php', 'http://www.a3h.de/bannerklf.php?id=%CID%', 'http://www.a3h.de/banner.php?id=%CID%'),
255 (5, 1, 'textmail', 'http://www.a3h.de/interface/out_paidmail.php', 'http://www.a3h.de/emailf.php?id=%CID%', NULL),
256 (6, 1, 'layer', 'http://www.a3h.de/interface/out_layer.php', 'http://www.a3h.de/layer.php?id=%CID%', NULL),
257 (7, 1, 'popup', 'http://www.a3h.de/interface/out_popup.php', 'http://www.a3h.de/popup.php?id=%CID%', NULL),
258 (8, 1, 'popdown', 'http://www.a3h.de/interface/out_popdown.php', 'http://www.a3h.de/popdown.php?id=%CID%', NULL),
259 (9, 1, 'lead', 'http://www.a3h.de/interface/out_lead.php', 'http://www.a3h.de/lead.php?id=%CID%', NULL),
260 (10, 1, 'sale', 'http://www.a3h.de/interface/out_sale.php', 'http://www.a3h.de/sale.php?id=%CID%', NULL),
261 (11, 1, 'htmlmail', 'http://www.a3h.de/interface/out_paidmail.php', 'http://www.a3h.de/emailf.php?id=%CID%', NULL)");
262
263                 // Network type handlers - AbisZED-Netz
264
265                 // Network type handlers - Ad-Magnet
266
267                 // Network type handlers - AdCocktail
268                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`, `network_id`, `network_type_handle`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`) VALUES
269 (13, 4, 'focredbanner', 'http://www.adcocktail.com/sc/kas/kas_fk.php', 'http://fk.adcocktail.com/fk_k.php?uid=%ID%&wid=%CID%&wsid=%SID%', 'http://fk.adcocktail.com/fk_v.php?uid=%ID%&wid=%CID%&wsid=%SID%'),
270 (12, 4, 'textmail', 'http://www.adcocktail.com/sc/kas/kas_pm.php', 'http://pm.adcocktail.com/pm.php?uid=%ID%&wid=%CID%&wsid=%SID%', NULL)");
271
272                 // Network type handlers - Ads4
273                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`, `network_id`, `network_type_handle`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`) VALUES
274 (14, 5, 'focredbanner', 'http://www.ads4.de/interface/interface.php', 'http://www.ads4.de/forced_click.php?fb_id=%CID%&sid=%SID%', 'http://www.ads4.de/forced_view.php?fb_id=%CID%&sid=%SID%'),
275 (16, 5, 'htmlmail', 'http://www.ads4.de/interface/interface.php', 'http://www.ads4.de/paidmail_click.php?pm=%CID%&%sid=%SID%', NULL),
276 (15, 5, 'textmail', 'http://www.ads4.de/interface/interface.php', 'http://www.ads4.de/paidmail_click.php?pm=%CID%&%sid=%SID%', NULL)");
277
278                 // Network type handlers - Ads4Webbis
279                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`, `network_id`, `network_type_handle`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`) VALUES
280 (20, 6, 'banner_click', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/klickbanner.php?id=%ID%&bid=%CID%&aid=%SID%', 'http://www.ads4webbis.de/codes/viewbanner.php?id=%ID%&bid=%CID%&aid=%SID%'),
281 (19, 6, 'banner_view', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/bannerklick.php?id=%ID%&bid=%CID%&aid=%SID%', 'http://www.ads4webbis.de/codes/bannerview.php?id=%ID%&bid=%CID%&aid=%SID%'),
282 (22, 6, 'button_view', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/buttonklick.php?id=%ID%&bid=%CID%&aid=%SID%', 'http://www.ads4webbis.de/codes/buttonview.php?id=%ID%&bid=%CID%&aid=%SID%'),
283 (17, 6, 'focredbanner', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/forcedbannerklick.php?id=%ID%&bid=%CID%&aid=%SID%', 'http://www.ads4webbis.de/codes/forcedbannerview.php?id=%ID%&bid=%CID%&aid=%SID%'),
284 (18, 6, 'forcedtextlink', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/forcedtextlinkklick.php?id=%ID%&bid=%CID%&aid=%SID%', NULL),
285 (24, 6, 'popup', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/popup.php?id=%ID%&bid=%CID%&aid=%SID%', NULL),
286 (21, 6, 'skybanner_view', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/skybannerklick.php?id=%ID%&bid=%CID%&aid=%SID%', 'http://www.ads4webbis.de/codes/skybannerview.php?id=%ID%&bid=%CID%&aid=%SID%'),
287 (23, 6, 'textlink_view', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/textlinkview.php?id=%ID%&bid=%CID%&aid=%SID%', NULL),
288 (25, 6, 'textmail', 'http://www.ads4webbis.de/interface/', 'http://www.ads4webbis.de/codes/paidmail.php?id=%ID%&bid=%CID%&aid=%SID%', NULL)");
289
290                 // Network type handlers - Ads4World
291
292                 // Network type handlers - Affiliblatt
293
294                 // Network type handlers - Alster-Marketing
295
296                 // Network type handlers - BonusSponsor
297
298                 // Network type handlers - Fusion-Ads
299
300                 // Network type handlers - Make-Euros
301
302                 // Network type handlers - Power-Promo
303
304                 // Network type handlers - Yoo!Media
305
306                 // Request parameters per type handler - A3H
307                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_param_id`, `network_id`, `network_type_id`, `request_param_key`, `request_param_value`, `request_param_default`) VALUES
308 (1, 1, 1, 'id', 'id', NULL),
309 (2, 1, 1, 'sid', 'sid', NULL),
310 (3, 1, 1, 'password', 'pw', NULL),
311 (4, 1, 1, 'reload', 'reload', NULL),
312 (5, 1, 1, 'reward', 'verguetung', NULL),
313 (6, 1, 1, 'min_stay', 'ma', NULL),
314 (7, 1, 1, 'type', 'typ', NULL),
315 (8, 1, 1, 'remain', 'uebrig', NULL),
316 (9, 1, 1, 'size', 'size', NULL),
317 (10, 1, 2, 'id', 'id', NULL),
318 (11, 1, 2, 'sid', 'sid', NULL),
319 (12, 1, 2, 'password', 'pw', NULL),
320 (13, 1, 2, 'reload', 'reload', NULL),
321 (14, 1, 2, 'reward', 'verguetung', NULL),
322 (15, 1, 2, 'remain', 'uebrig', NULL),
323 (16, 1, 3, 'id', 'id', NULL),
324 (17, 1, 3, 'sid', 'sid', NULL),
325 (18, 1, 3, 'password', 'pw', NULL),
326 (19, 1, 3, 'reload', 'reload', NULL),
327 (20, 1, 3, 'reward', 'verguetung', NULL),
328 (21, 1, 3, 'type', 'typ', NULL),
329 (22, 1, 3, 'remain', 'uebrig', NULL),
330 (23, 1, 3, 'size', 'size', NULL),
331 (24, 1, 4, 'id', 'id', NULL),
332 (25, 1, 4, 'sid', 'sid', NULL),
333 (26, 1, 4, 'password', 'pw', NULL),
334 (27, 1, 4, 'reload', 'reload', NULL),
335 (28, 1, 4, 'reward', 'verguetung', NULL),
336 (29, 1, 4, 'min_stay', 'ma', NULL),
337 (30, 1, 4, 'remain', 'uebrig', NULL),
338 (31, 1, 4, 'size', 'size', NULL),
339 (32, 1, 5, 'id', 'id', NULL),
340 (33, 1, 5, 'sid', 'sid', NULL),
341 (34, 1, 5, 'password', 'pw', NULL),
342 (35, 1, 5, 'reload', 'reload', NULL),
343 (36, 1, 5, 'reward', 'verguetung', NULL),
344 (37, 1, 5, 'min_stay', 'ma', NULL),
345 (38, 1, 5, 'type', 'typ', 'text'),
346 (39, 1, 5, 'remain', 'uebrig', NULL),
347 (40, 1, 11, 'id', 'id', NULL),
348 (41, 1, 11, 'sid', 'sid', NULL),
349 (42, 1, 11, 'password', 'pw', NULL),
350 (43, 1, 11, 'reload', 'reload', NULL),
351 (44, 1, 11, 'reward', 'verguetung', NULL),
352 (45, 1, 11, 'min_stay', 'ma', NULL),
353 (46, 1, 11, 'type', 'typ', 'html'),
354 (47, 1, 11, 'remain', 'uebrig', NULL),
355 (48, 1, 6, 'id', 'id', NULL),
356 (49, 1, 6, 'sid', 'sid', NULL),
357 (50, 1, 6, 'password', 'pw', NULL),
358 (51, 1, 6, 'reload', 'reload', NULL),
359 (52, 1, 6, 'reward', 'verguetung', NULL),
360 (53, 1, 6, 'type', 'typ', NULL),
361 (54, 1, 6, 'remain', 'uebrig', NULL),
362 (55, 1, 7, 'id', 'id', NULL),
363 (56, 1, 7, 'sid', 'sid', NULL),
364 (57, 1, 7, 'password', 'pw', NULL),
365 (58, 1, 7, 'reload', 'reload', NULL),
366 (59, 1, 7, 'reward', 'verguetung', NULL),
367 (60, 1, 7, 'min_stay', 'ma', NULL),
368 (61, 1, 7, 'remain', 'uebrig', NULL),
369 (62, 1, 8, 'id', 'id', NULL),
370 (63, 1, 8, 'sid', 'sid', NULL),
371 (64, 1, 8, 'password', 'pw', NULL),
372 (65, 1, 8, 'reload', 'reload', NULL),
373 (66, 1, 8, 'reward', 'verguetung', NULL),
374 (67, 1, 8, 'min_stay', 'ma', NULL),
375 (68, 1, 8, 'remain', 'uebrig', NULL),
376 (69, 1, 9, 'id', 'id', NULL),
377 (70, 1, 9, 'sid', 'sid', NULL),
378 (71, 1, 9, 'password', 'pw', NULL),
379 (72, 1, 9, 'reward', 'verguetung', NULL),
380 (73, 1, 9, 'remain', 'uebrig', NULL),
381 (74, 1, 10, 'id', 'id', NULL),
382 (75, 1, 10, 'sid', 'sid', NULL),
383 (76, 1, 10, 'password', 'pw', NULL),
384 (77, 1, 10, 'reward', 'verguetung', NULL),
385 (78, 1, 10, 'remain', 'uebrig', NULL)");
386
387                 // Request parameters per type handler - AbisZED-Netz
388
389                 // Request parameters per type handler - Ad-Magnet
390
391                 // Request parameters per type handler - AdCocktail
392
393                 // Request parameters per type handler - Ads4
394                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_param_id`, `network_id`, `network_type_id`, `request_param_key`, `request_param_value`, `request_param_default`) VALUES
395 (81, 5, 14, 'currency', 'waehrung', NULL),
396 (82, 5, 14, 'extra', 'mediatype', 'forced_banner'),
397 (79, 5, 14, 'id', 'id', NULL),
398 (86, 5, 14, 'min_stay', 'ma', NULL),
399 (80, 5, 14, 'password', 'pwd', NULL),
400 (84, 5, 14, 'reload', 'reload', NULL),
401 (85, 5, 14, 'remain', 'uebrig', NULL),
402 (83, 5, 14, 'reward', 'verg', NULL),
403 (89, 5, 15, 'currency', 'waehrung', NULL),
404 (90, 5, 15, 'extra', 'mediatype', 'textmails'),
405 (87, 5, 15, 'id', 'id', NULL),
406 (94, 5, 15, 'min_stay', 'ma', NULL),
407 (88, 5, 15, 'password', 'pwd', NULL),
408 (92, 5, 15, 'reload', 'reload', NULL),
409 (93, 5, 15, 'remain', 'uebrig', NULL),
410 (91, 5, 15, 'reward', 'verg', NULL),
411 (97, 5, 16, 'currency', 'waehrung', NULL),
412 (98, 5, 16, 'extra', 'mediatype', 'htmlmails'),
413 (95, 5, 16, 'id', 'id', NULL),
414 (102, 5, 16, 'min_stay', 'ma', NULL),
415 (96, 5, 16, 'password', 'pw', NULL),
416 (100, 5, 16, 'reload', 'reload', NULL),
417 (101, 5, 16, 'remain', 'uebrig', NULL),
418 (99, 5, 16, 'reward', 'verg', NULL)");
419
420                 // Request parameters per type handler - Ads4Webbis
421                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_param_id`, `network_id`, `network_type_id`, `request_param_key`, `request_param_value`, `request_param_default`) VALUES
422 (109, 6, 17, 'extra', 'typ', 'forcedbanner'),
423 (110, 6, 17, 'id', 'id', NULL),
424 (111, 6, 17, 'password', 'pw', NULL),
425 (113, 6, 17, 'reload', 'reload', NULL),
426 (112, 6, 17, 'remain', 'uebrig', NULL),
427 (114, 6, 17, 'reward', 'verguetung', NULL),
428 (115, 6, 18, 'extra', 'typ', 'forcedtextlink'),
429 (116, 6, 18, 'id', 'id', NULL),
430 (117, 6, 18, 'password', 'pw', NULL),
431 (119, 6, 18, 'reload', 'reload', NULL),
432 (118, 6, 18, 'remain', 'uebrig', NULL),
433 (120, 6, 18, 'reward', 'verguetung', NULL),
434 (121, 6, 19, 'extra', 'typ', 'bannerview'),
435 (122, 6, 19, 'id', 'id', NULL),
436 (123, 6, 19, 'password', 'pw', NULL),
437 (125, 6, 19, 'reload', 'reload', NULL),
438 (124, 6, 19, 'remain', 'uebrig', NULL),
439 (126, 6, 19, 'reward', 'verguetung', NULL),
440 (103, 6, 20, 'extra', 'typ', 'bannerklick'),
441 (104, 6, 20, 'id', 'id', NULL),
442 (105, 6, 20, 'password', 'pw', NULL),
443 (107, 6, 20, 'reload', 'reload', NULL),
444 (106, 6, 20, 'remain', 'uebrig', NULL),
445 (108, 6, 20, 'reward', 'verguetung', NULL),
446 (127, 6, 21, 'extra', 'typ', 'skybannerview'),
447 (128, 6, 21, 'id', 'id', NULL),
448 (129, 6, 21, 'password', 'pw', NULL),
449 (131, 6, 21, 'reload', 'reload', NULL),
450 (130, 6, 21, 'remain', 'uebrig', NULL),
451 (132, 6, 21, 'reward', 'verguetung', NULL),
452 (133, 6, 22, 'extra', 'typ', 'buttonview'),
453 (134, 6, 22, 'id', 'id', NULL),
454 (135, 6, 22, 'password', 'pw', NULL),
455 (137, 6, 22, 'reload', 'reload', NULL),
456 (136, 6, 22, 'remain', 'uebrig', NULL),
457 (138, 6, 22, 'reward', 'verguetung', NULL),
458 (139, 6, 23, 'extra', 'typ', 'textview'),
459 (140, 6, 23, 'id', 'id', NULL),
460 (141, 6, 23, 'password', 'pw', NULL),
461 (143, 6, 23, 'reload', 'reload', NULL),
462 (142, 6, 23, 'remain', 'uebrig', NULL),
463 (144, 6, 23, 'reward', 'verguetung', NULL),
464 (145, 6, 24, 'extra', 'typ', 'popup'),
465 (146, 6, 24, 'id', 'id', NULL),
466 (151, 6, 24, 'min_stay', 'ma', NULL),
467 (147, 6, 24, 'password', 'pw', NULL),
468 (149, 6, 24, 'reload', 'reload', NULL),
469 (148, 6, 24, 'remain', 'uebrig', NULL),
470 (150, 6, 24, 'reward', 'verguetung', NULL),
471 (152, 6, 25, 'extra', 'typ', 'paidmail'),
472 (153, 6, 25, 'id', 'id', NULL),
473 (158, 6, 25, 'min_stay', 'ma', NULL),
474 (154, 6, 25, 'password', 'pw', NULL),
475 (156, 6, 25, 'reload', 'reload', NULL),
476 (155, 6, 25, 'remain', 'uebrig', NULL),
477 (157, 6, 25, 'reward', 'verguetung', NULL)");
478                 // Request parameters per type handler - Ads4World
479
480                 // Request parameters per type handler - Affiliblatt
481
482                 // Request parameters per type handler - Alster-Marketing
483
484                 // Request parameters per type handler - BonusSponsor
485
486                 // Request parameters per type handler - Fusion-Ads
487
488                 // Request parameters per type handler - Make-Euros
489
490                 // Request parameters per type handler - Power-Promo
491
492                 // Request parameters per type handler - Yoo!Media
493
494                 // Fix empty defaults to NULL
495                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_network_request_params` SET `request_param_default`=NULL WHERE `request_param_default`=''");
496
497                 // Admin menu entries
498                 addAdminMenuSql('network',NULL,'Werbenetzwerke','Verwalten Sie hier Werbenetzwerke (API-Anbindung), versenden Sie deren Mails, oder &uuml;bernehmen Sie deren Textlinks und vieles mehr. <strong>VORSICHT:</strong> Das Einrichten von weiteren Werbenetzwerken ist nicht leicht, daf&uuml;r aber sehr flexibel! Sollte ein Netzwerk fehlen, so melden Sie dies bitte <a href="http://forum.mxchange.org/topic-462.html" target="_blank" title="Direktlink zum Forum">im Forum</a>!',4);
499                 addAdminMenuSql('network','config_networks','API-Daten','Stellen Sie Ihre Affiliate- Webseiten-Id und API-Passwort ein. Diese erhalten Sie zu &uuml;ber 99% aus dem jeweiligen Zugangsbereich des Anbieters. Sollten Sie bei einem Netzwerk noch nicht angemeldet sein, verwenden Sie bitte meinen Referal-Link.',1);
500                 addAdminMenuSql('network','config_network_types','Werbearten','Stellen Sie hier Reload-Zeiten, Mindestauffenthalt und so weiter pro Werbeart und Werbenetzwerk ein. Es werden sonst Standart-Werte (Mimimumwerte: 0, Maximumwerte: sehr gross, Erotik: aus) angenommen, die Sie meistens nicht wollen.',2);
501                 addAdminMenuSql('network','query_networks','APIs abfragen','Fragt alle eingestellten APIs ab. Die Ergebnisse werden dann f&uuml;r einen einstellbaren Zeitraum gecacht und nicht erneut angefordert.',3);
502                 addAdminMenuSql('network','config_network','Einstellungen','Stellen Sie generelle Einstellungen ein, die f&uuml;r alle Werbenetzwerke gelten, wie z.B. Cache-Erneuerungsinterval. Generell sind aber die Einstellungen in Ordnung, da z.B. sonst Ihre freien Abfragen beim Werbenetzwerk sich zu schnell abbauen.',4);
503                 addAdminMenuSql('network','list_network_reloads','Reload-Sperren','Listen oder l&ouml;schen Sie hier Reload-Sperren. <strong>Vorsicht:</strong> Die hier gespeicherten Reload-Sperren sind vom jeweiligen Werbenetzwerk &uuml;bernommen. Eventuell verdienen Sie nichts, wenn Sie z.B. eine Mail innerhalb der Reload-Sperre erneut versenden.',5);
504                 addAdminMenuSql('network','list_networks','Auflisten/Verwalten','<strong>Experten-Einstellungen!</strong> Hier &auml;ndern Sie die Einstellungen an den Grunddaten (Stammdaten) des jeweiligen Werbenetzwerks ab. Sie sollten hier generell nichts einstellen und <a href="http://forum.mxchange.org/forum-43.html" target="_blank" title="Direktlink zum Forum">im Forum</a> um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten m&ouml;chten.',6);
505                 addAdminMenuSql('network','list_network_types','Werbearten','<strong>Experten-Einstellungen!</strong> Hier &auml;ndern Sie die Einstellungen zu den Werbearten pro Werbenetzwerken. Sie sollten hier generell nichts einstellen und <a href="http://forum.mxchange.org/forum-43.html" target="_blank" title="Direktlink zum Forum">im Forum</a> um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten m&ouml;chten.',7);
506                 addAdminMenuSql('network','list_network_params','Abfrageparameter','<strong>Experten-Einstellungen!</strong> Hier stellen Sie die Abfrageparameter (wie sie genannt werden m&uuml;ssen, um das API-Script korrekt aufrufen zu k&ouml;nnen) ein, pro Werbenetzwerk. Sie sollten hier generell nichts einstellen und <a href="http://forum.mxchange.org/forum-43.html" target="_blank" title="Direktlink zum Forum">im Forum</a> um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten m&ouml;chten.',8);
507                 addAdminMenuSql('network','list_network_code_types','R&uuml;ckgabewerte','<strong>Experten-Einstellungen!</strong> Hier stellen Sie die R&uuml;ckgabewerte ein, die im Falle eines Fehlers pro API-Script kommen k&ouml;nnen. Sie sollten hier generell nichts einstellen und <a href="http://forum.mxchange.org/forum-43.html" target="_blank" title="Direktlink zum Forum">im Forum</a> um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten m&ouml;chten.',9);
508                 addAdminMenuSql('network','list_network_codes','Fehlercodes','<strong>Experten-Einstellungen!</strong> Hier stellen Sie die Namen von Fehlercodes ein, die Scripte zur&uuml;ckliefern k&ouml;nnen. <strong>Dies sind INTERNE Daten und sollten nur vom Entwicklerteam angepasst werden.</strong> Stellen Sie an diesen Einstellungen bitte nichts um. Sie sollten hier generell nichts einstellen und <a href="http://forum.mxchange.org/forum-43.html" target="_blank" title="Direktlink zum Forum">im Forum</a> um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten m&ouml;chten.',10);
509
510                 // Configuration entries
511                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `network_cache_refresh` BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (60 * 15) . '');
512                 break;
513
514         case 'remove': // Do stuff when removing extension
515                 // SQL commands to run
516                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`');
517                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`');
518                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_request_params`');
519                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_type_codes`');
520                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_codes`');
521                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_translations`');
522                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_array_translation`');
523                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`');
524                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`');
525                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`');
526                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_reloads`');
527
528                 // Admin menu
529                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='network'");
530                 break;
531
532         case 'activate': // Do stuff when admin activates this extension
533                 // SQL commands to run
534                 break;
535
536         case 'deactivate': // Do stuff when admin deactivates this extension
537                 // SQL commands to run
538                 break;
539
540         case 'update': // Update an extension
541                 switch (getCurrentExtensionVersion()) {
542                         case '0.0.1': // SQL queries for v0.0.1
543                                 addExtensionSql('');
544
545                                 // Update notes (these will be set as task text!)
546                                 setExtensionUpdateNotes('');
547                                 break;
548                 } // END - switch
549                 break;
550
551         case 'modify': // When the extension got modified
552                 break;
553
554         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
555                 break;
556
557         case 'init': // Do stuff when extension is initialized
558                 break;
559
560         default: // Unknown extension mode
561                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
562                 break;
563 } // END - switch
564
565 // [EOF]
566 ?>