make-euros has replied me, now when you add request parameters only those from select...
[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 Ad-Magnet: Layer(klick?). Layerviews.Skybannerklick/-view,     *
21  * @TODO Ad-Magnet: Banner-View, Textlink-Klick/-View. Page-Peel        *
22  * @TODO ADCocktail: Traffic, BIDausKAS???                              *
23  * @TODO Ads4.de: Traffic                                               *
24  * @TODO Ads4Webbis: Traffic                                            *
25  * @TODO Ads4World: Traffic                                             *
26  * @TODO Affiliblatt: All except banner                                 *
27  * @TODO doubleads: Which charset?                                      *
28  * @TODO Fusion-Ads: Has click/banner URL in API response               *
29  * @TODO GolloX: Which charset?                                         *
30  * @TODO homeADS: Which charset?                                        *
31  * @TODO paid4ad: Waiting for approval                                  *
32  * -------------------------------------------------------------------- *
33  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
34  * For more information visit: http://www.mxchange.org                  *
35  *                                                                      *
36  * This program is free software; you can redistribute it and/or modify *
37  * it under the terms of the GNU General Public License as published by *
38  * the Free Software Foundation; either version 2 of the License, or    *
39  * (at your option) any later version.                                  *
40  *                                                                      *
41  * This program is distributed in the hope that it will be useful,      *
42  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
44  * GNU General Public License for more details.                         *
45  *                                                                      *
46  * You should have received a copy of the GNU General Public License    *
47  * along with this program; if not, write to the Free Software          *
48  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
49  * MA  02110-1301  USA                                                  *
50  ************************************************************************/
51
52 // Some security stuff...
53 if (!defined('__SECURITY')) {
54         die();
55 } // END - if
56
57 // Version number
58 setThisExtensionVersion('0.0');
59
60 // Version history array (add more with , '0.1.0' and so on)
61 setExtensionVersionHistory(array('0.0'));
62
63 // This extension is in development (non-productive)
64 enableExtensionProductive(false);
65
66 switch (getExtensionMode()) {
67         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
68                 // Main table which hold
69                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`');
70                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_data` (
71 `network_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
72 `network_short_name` VARCHAR(50) NOT NULL DEFAULT '',
73 `network_title` VARCHAR(255) NOT NULL DEFAULT '',
74 `network_reflink` VARCHAR(255) NOT NULL DEFAULT '',
75 `network_data_seperator` CHAR(4) NOT NULL DEFAULT '|',
76 `network_row_seperator` CHAR(4) NOT NULL DEFAULT '|',
77 `network_request_type` ENUM('GET','POST') NOT NULL DEFAULT 'GET',
78 `network_charset` VARCHAR(20) NOT NULL DEFAULT 'UTF-8',
79 UNIQUE (`network_short_name`),
80 PRIMARY KEY (`network_id`)
81 ) TYPE={?_TABLE_TYPE?} COMMENT='Network data'");
82
83                 // Types the network provider is supporting (e.g. Forced-Banner and so on)
84                 // @TODO network_type_handle is an internal name and needs documentation
85                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`');
86                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types` (
87 `network_type_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
88 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
89 `network_type_handle` VARCHAR(255) NOT NULL DEFAULT '',
90 `network_type_api_url` VARCHAR(255) NOT NULL DEFAULT '',
91 `network_type_click_url` VARCHAR(255) NOT NULL DEFAULT '',
92 `network_type_banner_url` VARCHAR(255) NOT NULL DEFAULT '',
93 `network_param_default` VARCHAR(255) NULL DEFAULT NULL,
94 UNIQUE `provider_type` (`network_id`,`network_type_handle`),
95 PRIMARY KEY (`network_type_id`)
96 ) TYPE={?_TABLE_TYPE?} COMMENT='Types provideable by networks'");
97
98                 // HTTP parameters (names) for URLs
99                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_request_params`');
100                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_request_params` (
101 `network_param_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
102 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
103 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
104 `request_param_key` VARCHAR(10) NOT NULL DEFAULT 'invalid',
105 `request_param_value` VARCHAR(10) NOT NULL DEFAULT 'invalid',
106 `request_param_default` VARCHAR(10) NULL DEFAULT NULL,
107 UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`request_param_key`),
108 UNIQUE `provider_type_value` (`network_id`,`network_type_id`,`request_param_value`),
109 PRIMARY KEY (`network_param_id`)
110 ) TYPE={?_TABLE_TYPE?} COMMENT='Request parameters for GET/POST request'");
111
112                 // Error status codes
113                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_type_codes`');
114                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_type_codes` (
115 `network_type_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
116 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
117 `network_type_code_value` VARCHAR(50) NOT NULL DEFAULT '',
118 `network_type_code_type` VARCHAR(100) NOT NULL DEFAULT 'INVALID_TYPE',
119 UNIQUE `code_type` (`network_type_code_value`,`network_type_id`),
120 INDEX (`network_type_id`),
121 PRIMARY KEY (`network_type_code_id`)
122 ) TYPE={?_TABLE_TYPE?} COMMENT='Error codes for all types'");
123
124                 // Code types (internal table)
125                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_codes`');
126                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_codes` (
127 `network_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
128 `network_code` VARCHAR(100) NOT NULL DEFAULT 'INVALID_CODE',
129 UNIQUE (`network_code`),
130 PRIMARY KEY (`network_code_id`)
131 ) TYPE={?_TABLE_TYPE?} COMMENT='Error types, generic data, DO NOT ALTER!'");
132
133                 // Valid translation keys (we hate hard-coded arrays, you see?)
134                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_translations`');
135                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_translations` (
136 `network_translate_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
137 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
138 `network_translation` VARCHAR(100) NOT NULL DEFAULT '',
139 UNIQUE `type_trans` (`network_type_id`,`network_translation`),
140 PRIMARY KEY (`network_translate_id`)
141 ) TYPE={?_TABLE_TYPE?} COMMENT='Translations for array keys, generic data, DO NOT ALTER!'");
142
143                 // Array-Element translation tables per type/provider
144                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_array_translation`');
145                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_array_translation` (
146 `network_translate_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
147 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
148 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
149 `network_array_key` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,
150 `network_translation` VARCHAR(100) NOT NULL DEFAULT '',
151 UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`network_array_key`),
152 UNIQUE `provider_type_trans` (`network_id`,`network_type_id`,`network_translation`),
153 PRIMARY KEY (`network_translate_id`)
154 ) TYPE={?_TABLE_TYPE?} COMMENT='Cache for all queried APIs'");
155
156                 // Data from the webmaster (you!)
157                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`');
158                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_config` (
159 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
160 `network_affiliate_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
161 `network_api_password` VARCHAR(255) NOT NULL DEFAULT '',
162 `network_site_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
163 `network_query_amount` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
164 UNIQUE `network_affiliate` (`network_id`,`network_affiliate_id`),
165 UNIQUE `affiliate_site` (`network_affiliate_id`,`network_site_id`),
166 PRIMARY KEY (`network_id`)
167 ) TYPE={?_TABLE_TYPE?} COMMENT='Configuration data from the webmaster (you!)'");
168
169                 // Configuration data for e.g. reload-time
170                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`');
171                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types_config` (
172 `network_data_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
173 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
174 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
175 `max_reload_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
176 `min_waiting_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
177 `min_remain_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
178 `min_payment` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
179 `allow_erotic` VARCHAR(10) NOT NULL DEFAULT '',
180 UNIQUE `provider_type` (`network_id`,`network_type_id`),
181 PRIMARY KEY (`network_data_id`)
182 ) TYPE={?_TABLE_TYPE?} COMMENT='Configuration data for every type (e.g. reload-time)'");
183
184                 // Cache for queried APIs. Re-check depends on config
185                 // `network_cache_refresh` in seconds or if set to zero, full day
186                 // divided by query amount.
187                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`');
188                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_cache` (
189 `network_cache_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
190 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
191 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
192 `network_cache_data` MEDIUMBLOB,
193 `network_cache_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00',
194 UNIQUE `provider_type` (`network_id`,`network_type_id`),
195 PRIMARY KEY (`network_cache_id`)
196 ) TYPE={?_TABLE_TYPE?} COMMENT='Cache for all queried APIs'");
197
198                 // Reload locks for several types
199                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_reloads`');
200                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_reloads` (
201 `network_reload_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
202 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
203 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
204 `network_reload_lock` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,
205 `network_inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
206 UNIQUE `provider_type` (`network_id`,`network_type_id`),
207 PRIMARY KEY (`network_reload_id`)
208 ) TYPE={?_TABLE_TYPE?} COMMENT='Reload locks'");
209
210                 // Insert error code types
211                 // - Affiliate id or interface password wrong
212                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('AFF_ID_PASS_WRONG')");
213                 // - Webmaster's site id is not assigned (invalid, different affiliate id)
214                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('SITE_ID_NOT_ASSIGNED')");
215                 // - Webmaster's site id is locked
216                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('SITE_ID_LOCKED')");
217                 // - General error in interface data
218                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('INTERFACE_DATA_ERROR')");
219                 // - Request amount depleted
220                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('REQUESTS_DEPLETED')");
221                 // - No campaigns found for given criteria (but maybe there are with more widen criteria)
222                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('NO_CAMPAIGNS_FOUND')");
223                 // - No campaigns found with allowed interface output (but there are maybe non-interface campaigns)
224                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('NO_CAMPAIGNS_FOUND_INTERFACE')");
225                 // - Webmaster's site id is not unlocked for choosen type
226                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('SITE_ID_NOT_ALLOWED_TYPE')");
227                 // - Request parameters incomplete
228                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_codes` (`network_code`) VALUES ('REQUEST_PARAMS_INCOMPLETE')");
229
230                 // Sponsor networks
231                 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 ('yoomedia', 'Yoo!Media Solutions', 'http://www.yoomedia.de?ref=1715', '|', '|', 'GET', 'WINDOWS-1252')");
232
233                 // Network type handlers - Yoo!Media (Please use http://www.yoomedia.de?ref=1715 for signing up)
234                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_id`,`network_type_handle`,`network_type_api_url`,`network_type_click_url`,`network_type_banner_url`) VALUES (1, 'banner', 'http://www.yoomedia.de/interface_2.0/out_banner.php', 'http://www.yoomedia.de/code/z-bannerklf.php?id=%ID%&sid=%SID%', 'http://www.yoomedia.de/code/z-banner.php?id=%ID%&sid=%SID%&bid=%BID%'),
235 (1, 'surfbar', 'http://www.yoomedia.de/interface_2.0/out_sbanner.php', 'http://www.yoomedia.de/code/s-bannerklf.php?id=%ID%&sid=%SID%', 'http://www.yoomedia.de/code/s-banner.php?id=%ID%&sid=%SID%&bid=%BID%'),
236 (1, 'focredbanner', 'http://www.yoomedia.de/interface_2.0/out_fbanner.php', 'http://www.yoomedia.de/code/f-bannerklf.php?id=%ID%&sid=%SID%', 'http://www.yoomedia.de/code/f-banner.php?id=%ID%&sid=%SID%&bid=%BID%'),
237 (1, 'textlink', 'http://www.yoomedia.de/interface_2.0/out_textlink.php', 'http://www.yoomedia.de/code/t-textlink.php?id=%ID%&sid=%SID%', ''),
238 (1, 'layer', 'http://www.yoomedia.de/interface_2.0/out_layer.php', 'http://www.yoomedia.de/code/l-layer.php?id=%ID%&sid=%SID%', ''),
239 (1, 'popup', 'http://www.yoomedia.de/interface_2.0/out_popup.php', 'http://www.yoomedia.de/code/p-popup.php?id=%ID%&sid=%SID%', ''),
240 (1, 'popdown', 'http://www.yoomedia.de/interface_2.0/out_popdown.php', 'http://www.yoomedia.de/code/p-popdown.php?id=%ID%&sid=%SID%', ''),
241 (1, 'textmail', 'http://www.yoomedia.de/interface_2.0/out_textmail.php', 'http://www.yoomedia.de/code/t-mail.php?id=%ID%&sid=%SID%', ''),
242 (1, 'htmlmail', 'http://www.yoomedia.de/interface_2.0/out_htmlmail.php', 'http://www.yoomedia.de/code/h-mail.php?id=%ID%&sid=%SID%', ''),
243 (1, 'lead', 'http://www.yoomedia.de/interface_2.0/out_lead.php', 'http://www.yoomedia.de/code/lead.php?id=%ID%&sid=%SID%', ''),
244 (1, 'pagepeel', 'http://www.yoomedia.de/interface_2.0/out_pagepeel.php', 'http://www.yoomedia.de/code/p-peel.php?id=%ID%&sid=%SID%', '')");
245
246                 // Request parameters per type handler - Yoo!Media
247                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 1, 'id', 'id'),
248 (1, 1, 'sid', 'sid'),
249 (1, 1, 'password', 'pw'),
250 (1, 1, 'reload', 'reload'),
251 (1, 1, 'remain', 'uebrig'),
252 (1, 1, 'reward', 'verguetung'),
253 (1, 1, 'size', 'size'),
254 (1, 1, 'erotic', 'erotik')");
255                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 3, 'id', 'id'),
256 (1, 3, 'sid', 'sid'),
257 (1, 3, 'password', 'pw'),
258 (1, 3, 'reload', 'reload'),
259 (1, 3, 'min_stay', 'ma'),
260 (1, 3, 'remain', 'uebrig'),
261 (1, 3, 'reward', 'verguetung'),
262 (1, 3, 'size', 'size'),
263 (1, 3, 'erotic', 'erotik')");
264                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 9, 'id', 'id'),
265 (1, 9, 'sid', 'sid'),
266 (1, 9, 'password', 'pw'),
267 (1, 9, 'reload', 'reload'),
268 (1, 9, 'min_stay', 'ma'),
269 (1, 9, 'remain', 'uebrig'),
270 (1, 9, 'reward', 'verguetung'),
271 (1, 9, 'erotic', 'erotik')");
272                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 5, 'id', 'id'),
273 (1, 5, 'sid', 'sid'),
274 (1, 5, 'password', 'pw'),
275 (1, 5, 'reload', 'reload'),
276 (1, 5, 'remain', 'uebrig'),
277 (1, 5, 'reward', 'verguetung'),
278 (1, 5, 'erotic', 'erotik')");
279                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 10, 'id', 'id'),
280 (1, 10, 'sid', 'sid'),
281 (1, 10, 'password', 'pw'),
282 (1, 10, 'reload', 'reload'),
283 (1, 10, 'remain', 'uebrig'),
284 (1, 10, 'reward', 'verguetung'),
285 (1, 10, 'erotic', 'erotik')");
286                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 11, 'id', 'id'),
287 (1, 11, 'sid', 'sid'),
288 (1, 11, 'password', 'pw'),
289 (1, 11, 'reload', 'reload'),
290 (1, 11, 'remain', 'uebrig'),
291 (1, 11, 'reward', 'verguetung'),
292 (1, 11, 'erotic', 'erotik')");
293                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 7, 'id', 'id'),
294 (1, 7, 'sid', 'sid'),
295 (1, 7, 'password', 'pw'),
296 (1, 7, 'reload', 'reload'),
297 (1, 7, 'min_stay', 'ma'),
298 (1, 7, 'remain', 'uebrig'),
299 (1, 7, 'reward', 'verguetung'),
300 (1, 7, 'erotic', 'erotik')");
301                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 6, 'id', 'id'),
302 (1, 6, 'sid', 'sid'),
303 (1, 6, 'password', 'pw'),
304 (1, 6, 'reload', 'reload'),
305 (1, 6, 'min_stay', 'ma'),
306 (1, 6, 'remain', 'uebrig'),
307 (1, 6, 'reward', 'verguetung'),
308 (1, 6, 'erotic', 'erotik')");
309                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 2, 'id', 'id'),
310 (1, 2, 'sid', 'sid'),
311 (1, 2, 'password', 'pw'),
312 (1, 2, 'reload', 'reload'),
313 (1, 2, 'remain', 'uebrig'),
314 (1, 2, 'reward', 'verguetung'),
315 (1, 2, 'size', 'size'),
316 (1, 2, 'erotic', 'erotik')");
317                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 4, 'id', 'id'),
318 (1, 4, 'sid', 'sid'),
319 (1, 4, 'password', 'pw'),
320 (1, 4, 'reload', 'reload'),
321 (1, 4, 'remain', 'uebrig'),
322 (1, 4, 'reward', 'verguetung'),
323 (1, 4, 'erotic', 'erotik')");
324                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`request_param_key`,`request_param_value`) VALUES (1, 8, 'id', 'id'),
325 (1, 8, 'sid', 'sid'),
326 (1, 8, 'password', 'pw'),
327 (1, 8, 'reload', 'reload'),
328 (1, 8, 'min_stay', 'ma'),
329 (1, 8, 'remain', 'uebrig'),
330 (1, 8, 'reward', 'verguetung'),
331 (1, 8, 'erotic', 'erotik')");
332
333                 // Fix empty defaults to NULL
334                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_network_request_params` SET `request_param_default`=NULL WHERE `request_param_default`=''");
335
336                 // Admin menu entries
337                 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);
338                 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);
339                 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);
340                 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);
341                 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);
342                 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);
343                 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);
344                 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);
345                 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);
346                 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);
347                 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);
348
349                 // Configuration entries
350                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `network_cache_refresh` BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (60 * 15) . '');
351                 break;
352
353         case 'remove': // Do stuff when removing extension
354                 // SQL commands to run
355                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_data`');
356                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`');
357                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_request_params`');
358                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_type_codes`');
359                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_translations`');
360                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_array_translation`');
361                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`');
362                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`');
363                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`');
364                 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_reloads`');
365
366                 // Admin menu
367                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='network'");
368                 break;
369
370         case 'activate': // Do stuff when admin activates this extension
371                 // SQL commands to run
372                 break;
373
374         case 'deactivate': // Do stuff when admin deactivates this extension
375                 // SQL commands to run
376                 break;
377
378         case 'update': // Update an extension
379                 switch (getCurrentExtensionVersion()) {
380                         case '0.0.1': // SQL queries for v0.0.1
381                                 addExtensionSql('');
382
383                                 // Update notes (these will be set as task text!)
384                                 setExtensionUpdateNotes('');
385                                 break;
386                 } // END - switch
387                 break;
388
389         case 'modify': // When the extension got modified
390                 break;
391
392         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
393                 break;
394
395         case 'init': // Do stuff when extension is initialized
396                 break;
397
398         default: // Unknown extension mode
399                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
400                 break;
401 } // END - switch
402
403 // [EOF]
404 ?>