2 /************************************************************************
3 * MXChange v0.2.1 Start: 04/29/2004 *
4 * ================ Last change: 11/14/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-order.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Swapped out order system for PRO version *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Ausgelagertes Buchungssytem fuer PRO-Version *
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, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 $EXT_VERSION = "0.4.9";
43 // Auto-set extension version
44 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
46 // Version history array (add more with , "0.1" and so on)
47 $EXT_VER_HISTORY = array("0.0", "0.1", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9");
49 switch ($EXT_LOAD_MODE)
51 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
52 // SQL commands to run
56 case "remove": // Do stuff when removing extension
57 // SQL commands to run
58 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP order_max_full";
59 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
62 case "activate": // Do stuff when admin activates this extension
63 // SQL commands to run
64 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='order' LIMIT 1";
65 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='order' LIMIT 1";
68 case "deactivate": // Do stuff when admin deactivates this extension
69 // SQL commands to run
70 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
71 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='order' LIMIT 1";
74 case "update": // Update an extension
77 case "0.1": // SQL queries for v0.1
78 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_max_full ENUM('ORDER', 'MAX') NOT NULL DEFAULT 'MAX'";
79 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
81 // Update notes (these will be set as task text!)
82 $UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.";
85 case "0.1.1": // SQL queries for v0.1.1
86 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
87 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
88 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD mail_orders BIGINT(20) NOT NULL DEFAULT '0'";
90 // Update notes (these will be set as task text!)
91 $UPDATE_NOTES = "Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).";
94 case "0.1.3": // SQL queries for v0.1.3
95 // Update notes (these will be set as task text!)
96 $UPDATE_NOTES = "Maximale Mailbuchungen repariert (werden nun hochgezählt und bei täglichem Reset auf 0 gesetzt).";
99 case "0.1.4": // SQL queries for v0.1.4
100 // Update notes (these will be set as task text!)
101 $UPDATE_NOTES = "Dummy-Datenfeld wird wieder gelöscht, um Probleme zu vermeiden. Fehlende Spalte <I>mail_order</I> korregiert auf <I>mail_orders</I>.";
104 case "0.1.5": // SQL queries for v0.1.5
105 // Update notes (these will be set as task text!)
106 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
109 case "0.1.6": // SQL queries for v0.1.6
110 // Update notes (these will be set as task text!)
111 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
114 case "0.1.7": // SQL queries for v0.1.7
115 // Update notes (these will be set as task text!)
116 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
119 case "0.1.8": // SQL queries for v0.1.8
120 // Update notes (these will be set as task text!)
121 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
124 case "0.1.9": // SQL queries for v0.1.9
125 // Update notes (these will be set as task text!)
126 $UPDATE_NOTES = "Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
129 case "0.2.0": // SQL queries for v0.2.0
130 // Update notes (these will be set as task text!)
131 $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> überflüssige HTML-Tags entfernt.";
134 case "0.2.1": // SQL queries for v0.2.1
135 // Update notes (these will be set as task text!)
136 $UPDATE_NOTES = "Templates <U>member_frameset-back.tpl</U> und <U>member_frameset-send.tpl</U> nach <U>member_order_back.tpl</U> und <U>member_order_send.tpl</U> umbenannt.";
139 case "0.2.2": // SQL queries for v0.2.2
140 // Update notes (these will be set as task text!)
141 $UPDATE_NOTES = "Es wird nun überprüft ob auch genügend Empfänger eingegeben worden sind und ob auch genügend empfangsbereit sind.";
144 case "0.2.3": // SQL queries for v0.2.3
145 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_min BIGINT(20) NOT NULL DEFAULT '10'";
147 // Update notes (these will be set as task text!)
148 $UPDATE_NOTES = "Minimum an Empfänger pro Mailbuchung einstellbar. Standart: 10 Empfänger";
151 case "0.2.4": // SQL queries for v0.2.4
152 // Update notes (these will be set as task text!)
153 $UPDATE_NOTES = "Anzahl mindestens einszustellende Empfänger wird nun auch angezeigt.";
156 case "0.2.5": // SQL queries for v0.2.5
157 // Update notes (these will be set as task text!)
158 $UPDATE_NOTES = "Speicherung der Einstellungen klappt.";
161 case "0.2.6": // SQL queries for v0.2.6
162 // Update notes (these will be set as task text!)
163 $UPDATE_NOTES = "Fehler in Mailbuchung behoben: Es wurde beim Ermitteln der nötigen {!POINTS!} die maximale Anzahl von Usern in der Kategorie gewählt und
164 nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User hätte nicht genügend {!POINTS!} auf dem Konto. Ein Rechenbeispiel:
166 <LI>Das Mitglied wählt eine Kategorie XYZ mit maximal 15 Empfängern aus.</LI>
167 <LI>Es stellt die Mailart <U>"3 {!POINTS!} Kosten / Mail"</U> ein.</LI>
168 <LI>Es hat aber nur {!POINTS!} für 10 Empfänger und gibt 10 ein.</LI>
169 <LI>Das Script hatte bis zu dieser Version 3 {!POINTS!} * <U>15</U> = 45 {!POINTS!} gerechnet, hat das Mitglied mehr oder gleich 45 {!POINTS!}, fiehl dieser Fehler nicht
171 <LI>Hatte es aber, wie hier im Beispiel 31 {!POINTS!}, konnte es nicht mehr buchen.</LI>
172 <LI>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</LI>
176 case "0.2.7": // SQL queries for v0.2.7
177 // Update notes (these will be set as task text!)
178 $UPDATE_NOTES = "Fehler mit <U>__MIN_VALUE</U> behoben.";
181 case "0.2.8": // SQL queries for v0.2.8
182 // Update notes (these will be set as task text!)
183 $UPDATE_NOTES = "Konstantenproblem beseitigt.";
186 case "0.2.9": // SQL queries for v0.2.9
187 // Update notes (these will be set as task text!)
188 $UPDATE_NOTES = "Problem mit nicht funktionierenden Mailbuchungen beseitigt.";
191 case "0.3.0": // SQL queries for v0.3.0
192 // Update notes (these will be set as task text!)
193 $UPDATE_NOTES = "Basis-Modul <STRONG>order.php</STRONG> abgesichert, wenn Erweiterung nicht aktiviert ist.";
196 case "0.3.1": // SQL queries for v0.3.1
197 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'";
198 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_mode ENUM('ASC', 'DESC') NOT NULL DEFAULT 'DESC'";
200 // Update notes (these will be set as task text!)
201 $UPDATE_NOTES = "Beworbene URL wird nun getestet.";
204 case "0.3.2": // SQL queries for v0.3.2
205 // Update notes (these will be set as task text!)
206 $UPDATE_NOTES = "Datumsformat festgelegt auf ausführlich.";
209 case "0.3.3": // SQL queries for v0.3.3
210 // Update notes (these will be set as task text!)
211 $UPDATE_NOTES = "Unter <STRONG>Einstellungen - Mailbuchungsseite</STRONG> war immer die Tabellenspalte <STRONG>Mitgliedsnummer</STRONG> ausgewählt.";
214 case "0.3.4": // SQL queries for v0.3.4
215 // Update notes (these will be set as task text!)
216 $UPDATE_NOTES = "Dateiamenskonflikt zwischen den Erweiterungen <STRONG>support</STRONG> und <STRONG>order</STRONG> behoben.";
219 case "0.3.5": // SQL queries for v0.3.5
220 // Update notes (these will be set as task text!)
221 $UPDATE_NOTES = "Das Mitglied konnte geziehlt die Anzahl Mailbuchungen durch Abspeichern seines Profiles beeinflussen. Der Fehler war eine falsche Tabellenspalte. Dies war <STRONG>max_mails</STRONG>, die durch das Mitglieder veränderbar ist und zur Festellung der Maximalen Mailbuchungen herangezogen wurde.";
224 case "0.3.6": // SQL queries for v0.3.6
225 // Update notes (these will be set as task text!)
226 $UPDATE_NOTES = "Im Modul order (<STRONG>inc/modules/order.php</STRONG>) wurde fehlerhafterweise die Erweiterung <STRONG>beg</STRONG> getestet.";
229 case "0.3.7": // SQL queries for v0.3.7
230 // Update notes (these will be set as task text!)
231 $UPDATE_NOTES = "SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.";
234 case "0.3.8": // SQL queries for v0.3.8
235 // Update notes (these will be set as task text!)
236 $UPDATE_NOTES = "Mailbuchungsseite korregiert.";
239 case "0.3.9": // SQL queries for v0.3.9
240 // Update notes (these will be set as task text!)
241 $UPDATE_NOTES = "Erneuten Fehler in Mailbuchungsseite behoben.";
244 case "0.4.0": // SQL queries for v0.4.0
245 // Update notes (these will be set as task text!)
246 $UPDATE_NOTES = POINTS."-Abzug klappt wieder. Danke an Andreman!";
249 case "0.4.1": // SQL queries for v0.4.1
250 // Update notes (these will be set as task text!)
251 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
254 case "0.4.2": // SQL queries for v0.4.2
255 // Update notes (these will be set as task text!)
256 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
259 case "0.4.3": // SQL queries for v0.4.3
260 // Update notes (these will be set as task text!)
261 $UPDATE_NOTES = "Neue Urlaubsschaltung mit integriert.";
264 case "0.4.4": // SQL queries for v0.4.4
265 // Update notes (these will be set as task text!)
266 $UPDATE_NOTES = "Ein <STRONG>WHERE ext_active='Y'</STRONG> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.";
269 case "0.4.5": // SQL queries for v0.4.5
270 // Update notes (these will be set as task text!)
271 $UPDATE_NOTES = "De-/Aktivieren des mit dieser Erweiterung verknüpften Modules eingebunden.";
274 case "0.4.6": // SQL queries for v0.4.6
275 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', NULL, 'Mailbuchungen', 3, 'Y', 'N')";
276 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', 'order2', 'Framekiller-Mails', 2, 'Y', 'N')";
277 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='order', sort='1', title='Klick-Mails' WHERE what='order' LIMIT 1";
279 // Update notes (these will be set as task text!)
280 $UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
283 case "0.4.7": // SQL queries for v0.4.7
284 // Update notes (these will be set as task text!)
285 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
288 case "0.4.8": // SQL queries for v0.4.8
289 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='Mailbuchung' WHERE action='setup' AND what='config_order' LIMIT 1";
291 // Update notes (these will be set as task text!)
292 $UPDATE_NOTES = "Menüpunkt "Mailbuchungsseite" nach "Mailbuchung" umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.";
295 case "0.4.9": // SQL queries for v0.4.9
296 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD repay_deleted_mails ENUM('REPAY', 'JACKPOT', 'SHRED') NOT NULL DEFAULT 'REPAY'";
298 // Update notes (these will be set as task text!)
299 $UPDATE_NOTES = "Bei Löschung von Mailbuchungen kann nun global entschieden werden (Einstellungen also), ob die verbliebenen ".POINTS." wieder gutgeschrieben werden sollen oder in den Jackpot landen.";
305 default: // Do stuff when extension is loaded
306 $dummy = LOAD_CONFIG();
307 $_CONFIG = merge_array($_CONFIG, $dummy);
310 // Do daily reset only when installed and extension version is at least 0.1.1
311 if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1"))
313 // Reset mail order values
314 $result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
318 // Language file prefix
319 $EXT_LANG_PREFIX = "order";
321 // Extension is always active?
322 $EXT_ALWAYS_ACTIVE = "N";