]> git.mxchange.org Git - mailer.git/blob - inc/extensions/ext-sponsor.php
37d3c071937aa0f67e6a13017bb9a9d11f2b2eb8
[mailer.git] / inc / extensions / ext-sponsor.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 03/22/2004 *
4  * ===============                              Last change: 06/28/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-sponsor.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Sponsor area                                     *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Sponsorenbereich                                 *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
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.       *
21  *                                                                      *
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.                         *
26  *                                                                      *
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,               *
30  * MA  02110-1301  USA                                                  *
31  ************************************************************************/
32
33 // Some security stuff...
34 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
35 {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
37         require($INC);
38 }
39
40 // Version number
41 $EXT_VERSION = "0.0";
42
43 // Auto-set extension version
44 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
45
46 // Version history array (add more with , "0.1" and so on)
47 $EXT_VER_HISTORY = array("0.0");
48
49 switch ($EXT_LOAD_MODE)
50 {
51 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
52         //
53         // SQL commands to run
54         //
55         if (EXT_IS_ACTIVE("repair"))
56         {
57                 //
58                 // Sponsor data
59                 //
60                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_data";
61                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_data (
62 id bigint(20) 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 salut 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) not null default '".(ONE_DAY*7)."',
87 points_amount double(20,5) not null default '0.00000',
88 points_used double(20,5) not null default '0.00000',
89 refid bigint(20) not null default '0',
90 ref_count bigint(20) not null default '0',
91 hash varchar(32) not null default '',
92 last_pay float(7,2) not null default '0.00',
93 last_curr varchar(255) not null default '&euro;',
94 KEY(refid),
95 KEY(email),
96 PRIMARY KEY(id)
97 )TYPE=MyISAM";
98                 //
99                 // Sponsor orders
100                 //
101                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_orders";
102                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_orders (
103 id bigint(20) not null auto_increment,
104 sponsorid bigint(20) not null default '0',
105 aid bigint(20) not null default '0',
106 regid bigint(20) not null default '0',
107 payid bigint(20) not null default '0',
108 pay_count bigint(20) 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',
112 KEY (payid),
113 KEY (regid),
114 KEY (aid),
115 KEY (sponsorid),
116 PRIMARY KEY(id)
117 )TYPE=MyISAM";
118                 //
119                 // Pay-types
120                 //
121                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_paytypes";
122                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_paytypes (
123 id bigint(20) not null auto_increment,
124 pay_name varchar(255) not null default '',
125 pay_rate double(20,5) not null default '0.00000',
126 pay_min_count bigint(20) not null default '1',
127 pay_currency varchar(255) not null default '&euro;',
128 PRIMARY KEY(id)
129 )TYPE=MyISAM";
130                 //
131                 // Points-to-action converting
132                 //
133                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_action_convert";
134                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_action_convert (
135 id bigint(20) not null auto_increment,
136 ext_name varchar(255) not null default 'sponsor',
137 conv_rate bigint(20) not null default '0',
138 conv_name varchar(255) not null default 'Mails',
139 KEY (ext_name),
140 PRIMARY KEY(id)
141 )TYPE=MyISAM";
142                 //
143                 // Sponsor menu system (default)
144                 //
145                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_menu";
146                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_menu (
147 id bigint(20) not null auto_increment,
148 action varchar(255) not null default '',
149 what  varchar(255) not null default '',
150 title varchar(255) not null default '',
151 active enum('Y', 'N') not null default 'N',
152 sort bigint(20) not null default '0',
153 KEY(what),
154 KEY(action),
155 PRIMARY KEY(id)
156 )TYPE=MyISAM";
157                 //
158                 // Registry for performable actions by your sponsors
159                 //
160                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_registry";
161                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_registry (
162 id bigint(20) not null auto_increment,
163 aid bigint(20) 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',
167 KEY(ext_name),
168 KEY(aid),
169 PRIMARY KEY(id)
170 )TYPE=MyISAM";
171                 //
172                 // URLs from the sponsors
173                 //
174                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_urls";
175                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_urls (
176 id bigint(20) not null auto_increment,
177 sponsorid bigint(20) not null default '0',
178 url varchar(255) not null default 'http://',
179 title varchar(255) not null default '',
180 clicks bigint(20) not null default '0',
181 status enum('PENDING', 'ACTIVE', 'LOCKED') not null default 'PENDING',
182 KEY(sponsorid),
183 PRIMARY KEY(id)
184 )TYPE=MyISAM";
185                 //
186                 // Banners of any size from the sponsors
187                 //
188                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_banner";
189                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_banner (
190 id bigint(20) not null auto_increment,
191 sponsorid bigint(20) not null default '0',
192 url varchar(255) not null default 'http://',
193 alternate varchar(255) not null default '',
194 width int(7) not null default '468',
195 height int(7) not null default '60',
196 views bigint(20) not null default '0',
197 status enum('PENDING', 'ACTIVE', 'LOCKED') not null default 'PENDING',
198 KEY(sponsorid),
199 PRIMARY KEY(id)
200 )TYPE=MyISAM";
201                 //
202                 // Campaigns
203                 //
204                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_campaigns";
205                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_campaigns (
206 id bigint(20) not null auto_increment,
207 sponsorid bigint(20) not null default '0',
208 aid bigint(20) 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 double(20,5) 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',
219 KEY(aid),
220 KEY(sponsorid),
221 PRIMARY KEY(id)
222 )TYPE=MyISAM";
223                 //
224                 // Campaigns + URLs + Banner
225                 //
226                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_campaign_assigns";
227                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_campaign_assigns (
228 id bigint(20) not null auto_increment,
229 campaignid bigint(20) not null default '0',
230 urlid bigint(20) not null default '0',
231 bannerid bigint(20) not null default '0',
232 clicks bigint(20) not null default '0',
233 views bigint(20) not null default '0',
234 KEY(bannerid),
235 KEY(urlid),
236 KEY(campaignid),
237 PRIMARY KEY(id)
238 )TYPE=MyISAM";
239                 //
240                 // Allowed data to display (administrative)
241                 //
242                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_admin_data";
243                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_admin_data (
244 id bigint(20) not null auto_increment,
245 data_row varchar(255) not null default '',
246 display enum('Y', 'N') not null default 'N',
247 PRIMARY KEY(id)
248 )TYPE=MyISAM";
249                 //
250                 // Allowed data to display (sponsor-side)
251                 //
252                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_display_data";
253                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_sponsor_display_data (
254 id bigint(20) not null auto_increment,
255 sponsorid bigint(20) not null default '0',
256 data_row varchar(255) not null default '',
257 display enum('Y', 'N') not null default 'N',
258 KEY(sponsorid),
259 PRIMARY KEY(id)
260 )TYPE=MyISAM";
261                 //
262                 // Default allowed data to display
263                 //
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 ('salut', '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')";
295                 //
296                 // Add default entries
297                 //
298                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_registry (ext_name, is_active, aid, stamp_added) VALUES ('sponsor', 'N', '".GET_ADMIN_ID($_COOKIE['admin_login'])."', '".time()."')";
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, '&euro;')";
301                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_paytypes (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Spar-Paket', 1, 200.00000, '&euro;')";
302                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_paytypes (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Power-Paket', 10, 2000.00000, '&euro;')";
303                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_paytypes (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Sponsor-Paket', 20, 4000.00000, '&euro;')";
304                 //
305                 // Admin menu
306                 //
307                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('sponsor', '', 'Sponsorenbereich', 'Den Sponsorenbereich verwalten. Hier k&ouml;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&uuml;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&uuml;gbaren Sponsorenaccounts auf.', 3)";
311                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('sponsor', 'edit_sponsor', 'Sponsor &auml;ndern', 'Sponsorenaccount &auml;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&ouml;schen', 'Sponsorenaccount l&ouml;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 &uuml;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&uuml;', 'Das Sponsorenmen&uuml; kann hier ge&auml;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&ouml;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&ouml;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&ouml;nnen sich {--POINTS--}-Pakete kaufen. Hier k&ouml;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&uuml;', 'Gewichtung des Sponsormen&uuml;s reparieren.', 5)";
325                 //
326                 // Menu system (still admin menu)
327                 //
328                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('menu', 'sponsor_medit', 'Sponsor-Men&uuml; editieren', 'Hier k&ouml;nnen Sie das Sponsorenmen&uuml; ver&auml;ndern: Positionen ver&auml;ndern, Men&uuml;titel &auml;ndern usw.', 7)";
329                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('menu', 'sponsor_madd', 'Sponsor-Men&uuml; hinzuf&uuml;gen', 'Hier k&ouml;nnen Sie einen neuen Men&uuml;punkt hinzuf&uuml;gen (falls Sie z.B. eigene Sponsoraktionen entwickelt haben oder welche versehendlich gel&ouml;scht haben.', 8)";
330                 //
331                 // Guest menu
332                 //
333                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (action, what, title, sort) VALUES ('sponsor', '', '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)";
338                 //
339                 // Member menu
340                 //
341                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort) VALUES ('main', 'sponsor', 'Unsere Sponsoren', 8)";
342                 //
343                 // Add default menus to sponsor menu
344                 //
345                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_menu (action, what, title, active, sort) VALUES('main', '', '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', 'urls', 'URL-Verwaltung', 'N', 4)";
350                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_menu (action, what, title, active, sort) VALUES('main', '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&uuml;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', 'Referral-Link', 'N', 10)";
356                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_sponsor_menu (action, what, title, active, sort) VALUES('actions', '', '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', '', '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)";
363                 //
364                 // General configuration stuff
365                 //
366                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD sponsor_ref_points double(20,5) not null default '100.00000'";
367                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD sponsor_min_points double(20,5) not null default '1000.00000'";
368
369                 // Load CSS file
370                 $EXT_CSS = "Y";
371         }
372          else
373         {
374                 // Sponsor extension depends now on repair extension!
375                 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='sponsor' LIMIT 1";
376         }
377         break;
378
379 case "remove": // Do stuff when removing extension
380         // SQL commands to run
381         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_data";
382         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_orders";
383         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_action_convert";
384         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_paytypes";
385         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_menu";
386         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_registry";
387         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_urls";
388         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_banner";
389         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_campaigns";
390         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_campaign_assigns";
391         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_admin_data";
392         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_sponsor_display_data";
393         $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='sponsor' OR what IN('repr_sponsor', 'sponsor_medit', 'sponsor_madd') LIMIT 20";
394         $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE action='sponsor' LIMIT 5";
395         $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='sponsor' LIMIT 1";
396         break;
397
398 case "activate": // Do stuff when admin activates this extension
399         // SQL commands to run
400         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='N' WHERE action='sponsor' LIMIT 4";
401         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='sponsor' LIMIT 1";
402         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_sponsor_menu SET active='Y' WHERE active='N'";
403         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_sponsor_registry SET is_active='Y' WHERE is_active='N'";
404         break;
405
406 case "deactivate": // Do stuff when admin deactivates this extension
407         // SQL commands to run
408         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE action='sponsor' LIMIT 4";
409         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='sponsor' LIMIT 1";
410         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_sponsor_menu SET active='N' WHERE active='Y'";
411         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_sponsor_registry SET is_active='N' WHERE is_active='Y'";
412         break;
413
414 case "update": // Update an extension
415         switch ($EXT_VER)
416         {
417         case "0.0.1": // SQL queries for v0.0.1
418                 $SQLs[] = "";
419
420                 // Update notes (these will be set as task text!)
421                 $UPDATE_NOTES = "";
422                 break;
423         }
424         break;
425
426 default: // Do stuff when extension is loaded
427         $result_user = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX."_config WHERE config='0' LIMIT 1", __FILE__, __LINE__);
428         $DUMMY = SQL_FETCHARRAY($result_user);
429         $CONFIG['sponsor_min_points'] = $DUMMY['sponsor_min_points']; // Minimum points to order
430         $CONFIG['sponsor_ref_points'] = $DUMMY['sponsor_ref_points']; // Additional points when a sponsor brings you another sponsor
431         unset($DUMMY);
432         break;
433 }
434
435 // Language file prefix
436 $EXT_LANG_PREFIX = "sponsor";
437
438 // Extension is always active?
439 $EXT_ALWAYS_ACTIVE = "N";
440
441 //
442 ?>