2 /************************************************************************
3 * MXChange v0.2.1 Start: 03/22/2004 *
4 * =============== Last change: 06/28/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-sponsor.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Sponsor area *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Sponsorenbereich *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software. You can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
35 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
42 // Auto-set extension version
43 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
45 // Version history array (add more with , "0.1" and so on)
46 $EXT_VER_HISTORY = array("0.0");
48 switch ($EXT_LOAD_MODE)
50 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
52 // SQL commands to run
54 // Try to make it depend on repair
55 $EXT_UPDATE_DEPENDS = "repair";
60 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_data`";
61 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_data` (
62 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
63 company VARCHAR(255) NOT NULL DEFAULT '',
64 position VARCHAR(255) NOT NULL DEFAULT '',
65 tax_ident VARCHAR(255) NOT NULL DEFAULT '',
66 gender ENUM('M','F','C') NOT NULL DEFAULT 'M',
67 surname VARCHAR(255) NOT NULL DEFAULT '',
68 family VARCHAR(255) NOT NULL DEFAULT '',
69 street_nr1 VARCHAR(255) NOT NULL DEFAULT '',
70 street_nr2 VARCHAR(255) NOT NULL DEFAULT '',
71 zip VARCHAR(6) NOT NULL DEFAULT '',
72 city VARCHAR(255) NOT NULL DEFAULT '',
73 country CHAR(2) NOT NULL DEFAULT 'DE',
74 phone VARCHAR(255) NOT NULL DEFAULT '',
75 fax VARCHAR(255) NOT NULL DEFAULT '',
76 cell VARCHAR(255) NOT NULL DEFAULT '',
77 email VARCHAR(255) NOT NULL DEFAULT '',
78 url VARCHAR(255) NOT NULL DEFAULT '',
79 password VARCHAR(255) NOT NULL DEFAULT '',
80 remote_addr VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
81 sponsor_created VARCHAR(10) NOT NULL DEFAULT 0,
82 last_online VARCHAR(10) NOT NULL DEFAULT 0,
83 last_change VARCHAR(10) NOT NULL DEFAULT 0,
84 status ENUM('UNCONFIRMED','PENDING','CONFIRMED','LOCKED') NOT NULL DEFAULT 'UNCONFIRMED',
85 receive_warnings ENUM('Y','N') NOT NULL DEFAULT 'Y',
86 warning_interval BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('one_day')*7)."',
87 points_amount FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
88 points_used FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
89 refid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
90 ref_count BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
91 hash VARCHAR(32) NOT NULL DEFAULT '',
92 last_pay FLOAT(7,2) UNSIGNED NOT NULL DEFAULT '0.00',
93 last_curr VARCHAR(255) NOT NULL DEFAULT '€',
101 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_orders`";
102 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_orders` (
103 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
104 sponsorid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
105 aid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
106 regid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
107 payid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
108 pay_count BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
109 pay_status ENUM('PENDING','PAYED','UNPAYED','DELETED') NOT NULL DEFAULT 'PENDING',
110 pay_ordered VARCHAR(10) NOT NULL DEFAULT 0,
111 pay_done VARCHAR(10) NOT NULL DEFAULT 0,
121 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_paytypes`";
122 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_paytypes` (
123 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
124 pay_name VARCHAR(255) NOT NULL DEFAULT '',
125 pay_rate FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
126 pay_min_count BIGINT(20) UNSIGNED NOT NULL DEFAULT 1,
127 pay_currency VARCHAR(255) NOT NULL DEFAULT '€',
131 // Points-to-action converting
133 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_action_convert`";
134 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_action_convert` (
135 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
136 ext_name VARCHAR(255) NOT NULL DEFAULT 'sponsor',
137 conv_rate BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
138 conv_name VARCHAR(255) NOT NULL DEFAULT 'Mails',
143 // Sponsor menu system (default)
145 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_menu`";
146 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_menu` (
147 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
148 action VARCHAR(255) NOT NULL DEFAULT '',
149 what VARCHAR(255) NULL DEFAULT NULL,
150 title VARCHAR(255) NOT NULL DEFAULT '',
151 active ENUM('Y','N') NOT NULL DEFAULT 'N',
152 sort BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
158 // Registry for performable actions by your sponsors
160 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_registry`";
161 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_registry` (
162 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
163 aid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
164 ext_name VARCHAR(255) NOT NULL DEFAULT 'sponsor',
165 is_active ENUM('Y','N') NOT NULL DEFAULT 'N',
166 stamp_added VARCHAR(10) NOT NULL DEFAULT 0,
172 // URLs from the sponsors
174 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_urls`";
175 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_urls` (
176 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
177 sponsorid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
178 url VARCHAR(255) NOT NULL DEFAULT 'http://',
179 title VARCHAR(255) NOT NULL DEFAULT '',
180 clicks BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
181 status ENUM('PENDING','ACTIVE','LOCKED') NOT NULL DEFAULT 'PENDING',
186 // Banners of any size from the sponsors
188 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_banner`";
189 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_banner` (
190 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
191 sponsorid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
192 url VARCHAR(255) NOT NULL DEFAULT 'http://',
193 alternate VARCHAR(255) NOT NULL DEFAULT '',
194 width INT(7) UNSIGNED NOT NULL DEFAULT 468,
195 height INT(7) UNSIGNED NOT NULL DEFAULT 60,
196 views BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
197 status ENUM('PENDING','ACTIVE','LOCKED') NOT NULL DEFAULT 'PENDING',
204 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_campaigns`";
205 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_campaigns` (
206 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
207 sponsorid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
208 aid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
209 campaign_name VARCHAR(255) NOT NULL DEFAULT '',
210 campaign_start VARCHAR(10) NOT NULL DEFAULT 0,
211 campaign_end VARCHAR(10) NOT NULL DEFAULT 0,
212 campaign_amount FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
213 campaign_expired ENUM('Y','N') NOT NULL DEFAULT 'N',
214 campaign_locked ENUM('Y','N') NOT NULL DEFAULT 'Y',
215 campaign_ended VARCHAR(10) NOT NULL DEFAULT 0,
216 locked_reason TINYBLOB,
217 locked_timestamp VARCHAR(10) NOT NULL DEFAULT 0,
218 status ENUM('PENDING','ACTIVE','LOCKED') NOT NULL DEFAULT 'PENDING',
224 // Campaigns + URLs + Banner
226 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_campaign_assigns`";
227 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_campaign_assigns` (
228 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
229 campaignid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
230 urlid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
231 bannerid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
232 clicks BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
233 views BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
240 // Allowed data to display (administrative)
242 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_admin_data`";
243 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_admin_data` (
244 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
245 data_row VARCHAR(255) NOT NULL DEFAULT '',
246 display ENUM('Y','N') NOT NULL DEFAULT 'N',
250 // Allowed data to display (sponsor-side)
252 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_display_data`";
253 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_sponsor_display_data` (
254 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
255 sponsorid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
256 data_row VARCHAR(255) NOT NULL DEFAULT '',
257 display ENUM('Y','N') NOT NULL DEFAULT 'N',
262 // Default allowed data to display
264 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('id','N')";
265 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('company','Y')";
266 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('position','N')";
267 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('tax_ident','N')";
268 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('gender','N')";
269 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('surname','N')";
270 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('family','N')";
271 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('street_nr1','Y')";
272 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('street_nr2','Y')";
273 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('zip','Y')";
274 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('city','Y')";
275 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('country','Y')";
276 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('phone','Y')";
277 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('fax','Y')";
278 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('email','Y')";
279 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('url','N')";
280 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('password','N')";
281 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('remote_addr','N')";
282 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('sponsor_created','N')";
283 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('last_online','N')";
284 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('last_change','N')";
285 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('status','N')";
286 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('receive_warnings','N')";
287 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('warning_interval','N')";
288 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('points_amount','N')";
289 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('points_used','N')";
290 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('refid','N')";
291 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('ref_count','N')";
292 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('hash','N')";
293 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('last_pay','N')";
294 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_admin_data` (data_row, display) VALUES ('last_curr','N')";
296 // Add default entries
298 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_registry` (ext_name, is_active, aid, stamp_added) VALUES ('sponsor','N',".GET_CURRENT_ADMIN_ID().",UNIX_TIMESTAMP())";
299 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_action_convert` (ext_name, conv_rate, conv_name) VALUES ('sponsor','10','Mails')";
300 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Standart-Paket', 5, 1000.00000, '€')";
301 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Spar-Paket', 1, 200.00000, '€')";
302 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Power-Paket', 10, 2000.00000, '€')";
303 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Sponsor-Paket', 20, 4000.00000, '€')";
307 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor', NULL, 'Sponsorenbereich','Den Sponsorenbereich verwalten. Hier können Sie auch Sonderaktionen seperat deakvieren oder wieder aktivieren, Sponsorenaccounts verwalten usw.', 7)";
308 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','add_sponsor','Neuer Sponsor','Neues Sponsorenaccount hinzufügen.', 1)";
309 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','unlock_sponsor','Sponsor freischalten','Sponsorenaccounts freigeben / sperren.', 2)";
310 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor','Sponsoren auflisten','Listet alle verfügbaren Sponsorenaccounts auf.', 3)";
311 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','edit_sponsor','Sponsor ändern','Sponsorenaccount ändern (Grundaten, nicht Freigabe!).', 4)";
312 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','lock_sponsor','Sponsor ent-/sperren','Sponsorenaccount sperren und entsperren.', 5)";
313 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','del_sponsor','Sponsor löschen','Sponsorenaccount löschen.', 6)";
314 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','allow_sponsor_data','Datenverwaltung','Stellen Sie hier ein, welche Daten der Sponsor im Mitgliedsbereich über sicht anzeigen darf und welche nicht.', 7)";
315 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_pays','Bestellungen...','Bestellungen der Sponsoren auflisten / bearbeiten.', 8)";
316 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_menu','Sponsorenmenü','Das Sponsorenmenü kann hier geändert werden.', 9)";
317 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_campaigns','Kampagnen...','Verwaltung aller von Ihren Sponsoren eingerichteten Kampagnen.', 10)";
318 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_urls','URL-Verwaltung','Verwaltung (freischalten, sperren, löschen, testen, bearbeiten usw.) von gebuchten URLs.', 11)";
319 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_banner','Banner-Verwaltung','Verwaltung (freischalten, sperren, löschen, testen, bearbeiten usw.) von gebuchten Bannern.', 12)";
320 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_reg','Sponsor-Aktionen','Alle Sponsor-Aktionen auflisten und verwalten.', 13)";
321 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_pay','Buchungspakete','Die Sponsoren können sich {!POINTS!}-Pakete kaufen. Hier können Sie diese verwalten.', 14)";
322 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','list_sponsor_conv','{!POINTS!} umwandeln...','Mit den vom Sponsor gekauften {!POINTS!} kann er Aktionen buchen. Hier stellen Sie die Umrechnungsrate von {!POINTS!} nach Sponsoraktionen um. Beispiel: 1 {!POINTS!} = 10 Mails.', 15)";
323 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('sponsor','config_sponsor','Einstellungen','Allgemeine Einstellungen am Sponsoring-System.', 16)";
324 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('repair','repr_sponsor','Sponsormenü','Gewichtung des Sponsormenüs reparieren.', 5)";
326 // Menu system (still admin menu)
328 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('menu','sponsor_medit','Sponsor-Menü editieren','Hier können Sie das Sponsorenmenü verändern: Positionen verändern, Menütitel ändern usw.', 7)";
329 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('menu','sponsor_madd','Sponsor-Menü hinzufügen','Hier können Sie einen neuen Menüpunkt hinzufügen (falls Sie z.B. eigene Sponsoraktionen entwickelt haben oder welche versehendlich gelöscht haben.', 8)";
333 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`, `what`, `title`, `sort`) VALUES ('sponsor', NULL, 'Sponsoren', 2)";
334 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`, `what`, `title`, `sort`) VALUES ('sponsor','sponsor_reg','Anmeldung', 1)";
335 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`, `what`, `title`, `sort`) VALUES ('sponsor','sponsor_login','Einloggen', 2)";
336 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`, `what`, `title`, `sort`) VALUES ('sponsor','sponsor_infos','Infos/Preise', 3)";
337 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`, `what`, `title`, `sort`) VALUES ('sponsor','sponsor_agb','AGBs', 4)";
341 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`, `what`, `title`, `sort`) VALUES ('main','sponsor','Unsere Sponsoren', 8)";
343 // Add default menus to sponsor menu
345 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main', NULL, 'Hauptauswahl','N', 1)";
346 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','welcome','Willkommen','N', 1)";
347 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','account','Ihr Account','N', 2)";
348 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','campaigns','Kampagnen','N', 3)";
349 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','list_urls','URL-Verwaltung','N', 4)";
350 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','list_banner','Banner-Verwaltung','N', 5)";
351 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','settings','Einstellungen','N', 6)";
352 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','fillup','Konto auffüllen','N', 7)";
353 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','stats','Statistiken','N', 8)";
354 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','inquiry','Kontaktanfrage','N', 9)";
355 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('main','refid','Referal-Link','N', 10)";
356 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('actions', NULL, 'Sponsorenaktionen','N', 2)";
357 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('actions','mail','Sponsor-Mail','N', 1)";
358 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('actions','banner','Banner buchen','N', 2)";
359 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('actions','text','Textlink buchen','N', 3)";
360 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('logout', NULL, 'Ausloggen','N', 3)";
361 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('logout','logout','Ausloggen','N', 1)";
362 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_menu` (`action`, `what`, `title`, `active`, `sort`) VALUES ('logout','guest','Zum Gastbereich','N', 2)";
364 // General configuration stuff
366 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD sponsor_ref_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 100.00000";
367 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD sponsor_min_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1000.00000";
373 case "remove": // Do stuff when removing extension
374 // SQL commands to run
375 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_data`";
376 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_orders`";
377 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_action_convert`";
378 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_paytypes`";
379 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_menu`";
380 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_registry`";
381 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_urls`";
382 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_banner`";
383 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_campaigns`";
384 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_campaign_assigns`";
385 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_admin_data`";
386 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_sponsor_display_data`";
387 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='sponsor' OR what IN('repr_sponsor','sponsor_medit','sponsor_madd') LIMIT 20";
388 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='sponsor' LIMIT 5";
389 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='sponsor' LIMIT 1";
392 case "activate": // Do stuff when admin activates this extension
393 // SQL commands to run
394 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `action`='sponsor' LIMIT 4";
395 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='sponsor' LIMIT 1";
396 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_sponsor_menu` SET active='Y' WHERE active='N'";
397 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_sponsor_registry` SET is_active='Y' WHERE is_active='N'";
400 case "deactivate": // Do stuff when admin deactivates this extension
401 // SQL commands to run
402 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `action`='sponsor' LIMIT 4";
403 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='sponsor' LIMIT 1";
404 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_sponsor_menu` SET active='N' WHERE active='Y'";
405 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_sponsor_registry` SET is_active='N' WHERE is_active='Y'";
408 case "update": // Update an extension
411 case "0.0.1": // SQL queries for v0.0.1
414 // Update notes (these will be set as task text!)
420 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
423 default: // Do stuff when extension is loaded