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 (!defined('__SECURITY')) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 $EXT_VERSION = "0.5.0";
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", "0.5.0");
49 switch ($EXT_LOAD_MODE)
51 case "register": // Do stuff when installation 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[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what`='config_order' LIMIT 1";
61 case "activate": // Do stuff when admin activates this extension
62 // SQL commands to run
63 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' LIMIT 1";
64 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='order' LIMIT 1";
67 case "deactivate": // Do stuff when admin deactivates this extension
68 // SQL commands to run
69 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='order' LIMIT 1";
70 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `visible`='N', `locked`='Y' WHERE module='order' LIMIT 1";
73 case "update": // Update an extension
76 case "0.1": // SQL queries for v0.1
77 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'";
78 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
80 // Update notes (these will be set as task text!)
81 $UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.";
84 case "0.1.1": // SQL queries for v0.1.1
85 $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what`='config_order' LIMIT 1";
86 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
87 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD mail_orders BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
89 // Update notes (these will be set as task text!)
90 $UPDATE_NOTES = "Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).";
93 case "0.1.3": // SQL queries for v0.1.3
94 // Update notes (these will be set as task text!)
95 $UPDATE_NOTES = "Maximale Mailbuchungen repariert (werden nun hochgezählt und bei täglichem Reset auf 0 gesetzt).";
98 case "0.1.4": // SQL queries for v0.1.4
99 // Update notes (these will be set as task text!)
100 $UPDATE_NOTES = "Dummy-Datenfeld wird wieder gelöscht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.";
103 case "0.1.5": // SQL queries for v0.1.5
104 // Update notes (these will be set as task text!)
105 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
108 case "0.1.6": // SQL queries for v0.1.6
109 // Update notes (these will be set as task text!)
110 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
113 case "0.1.7": // SQL queries for v0.1.7
114 // Update notes (these will be set as task text!)
115 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
118 case "0.1.8": // SQL queries for v0.1.8
119 // Update notes (these will be set as task text!)
120 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
123 case "0.1.9": // SQL queries for v0.1.9
124 // Update notes (these will be set as task text!)
125 $UPDATE_NOTES = "Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
128 case "0.2.0": // SQL queries for v0.2.0
129 // Update notes (these will be set as task text!)
130 $UPDATE_NOTES = "Seit <a href=\"#\">Patch 340</a> überflüssige HTML-Tags entfernt.";
133 case "0.2.1": // SQL queries for v0.2.1
134 // Update notes (these will be set as task text!)
135 $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.";
138 case "0.2.2": // SQL queries for v0.2.2
139 // Update notes (these will be set as task text!)
140 $UPDATE_NOTES = "Es wird nun überprüft ob auch genügend Empfänger eingegeben worden sind und ob auch genügend empfangsbereit sind.";
143 case "0.2.3": // SQL queries for v0.2.3
144 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
146 // Update notes (these will be set as task text!)
147 $UPDATE_NOTES = "Minimum an Empfänger pro Mailbuchung einstellbar. Standart: 10 Empfänger";
150 case "0.2.4": // SQL queries for v0.2.4
151 // Update notes (these will be set as task text!)
152 $UPDATE_NOTES = "Anzahl mindestens einszustellende Empfänger wird nun auch angezeigt.";
155 case "0.2.5": // SQL queries for v0.2.5
156 // Update notes (these will be set as task text!)
157 $UPDATE_NOTES = "Speicherung der Einstellungen klappt.";
160 case "0.2.6": // SQL queries for v0.2.6
161 // Update notes (these will be set as task text!)
162 $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
163 nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User hätte nicht genügend {!POINTS!} auf dem Konto. Ein Rechenbeispiel:
165 <li>Das Mitglied wählt eine Kategorie XYZ mit maximal 15 Empfängern aus.</li>
166 <li>Es stellt die Mailart <u>"3 {!POINTS!} Kosten / Mail"</u> ein.</li>
167 <li>Es hat aber nur {!POINTS!} für 10 Empfänger und gibt 10 ein.</li>
168 <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
170 <li>Hatte es aber, wie hier im Beispiel 31 {!POINTS!}, konnte es nicht mehr buchen.</li>
171 <li>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</li>
175 case "0.2.7": // SQL queries for v0.2.7
176 // Update notes (these will be set as task text!)
177 $UPDATE_NOTES = "Fehler mit <u>__MIN_VALUE</u> behoben.";
180 case "0.2.8": // SQL queries for v0.2.8
181 // Update notes (these will be set as task text!)
182 $UPDATE_NOTES = "Konstantenproblem beseitigt.";
185 case "0.2.9": // SQL queries for v0.2.9
186 // Update notes (these will be set as task text!)
187 $UPDATE_NOTES = "Problem mit nicht funktionierenden Mailbuchungen beseitigt.";
190 case "0.3.0": // SQL queries for v0.3.0
191 // Update notes (these will be set as task text!)
192 $UPDATE_NOTES = "Basis-Modul <strong>order.php</strong> abgesichert, wenn Erweiterung nicht aktiviert ist.";
195 case "0.3.1": // SQL queries for v0.3.1
196 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'";
197 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'";
199 // Update notes (these will be set as task text!)
200 $UPDATE_NOTES = "Beworbene URL wird nun getestet.";
203 case "0.3.2": // SQL queries for v0.3.2
204 // Update notes (these will be set as task text!)
205 $UPDATE_NOTES = "Datumsformat festgelegt auf ausführlich.";
208 case "0.3.3": // SQL queries for v0.3.3
209 // Update notes (these will be set as task text!)
210 $UPDATE_NOTES = "Unter <strong>Einstellungen - Mailbuchungsseite</strong> war immer die Tabellenspalte <strong>Mitgliedsnummer</strong> ausgewählt.";
213 case "0.3.4": // SQL queries for v0.3.4
214 // Update notes (these will be set as task text!)
215 $UPDATE_NOTES = "Dateiamenskonflikt zwischen den Erweiterungen <strong>support</strong> und <strong>order</strong> behoben.";
218 case "0.3.5": // SQL queries for v0.3.5
219 // Update notes (these will be set as task text!)
220 $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.";
223 case "0.3.6": // SQL queries for v0.3.6
224 // Update notes (these will be set as task text!)
225 $UPDATE_NOTES = "Im Modul order (<strong>inc/modules/order.php</strong>) wurde fehlerhafterweise die Erweiterung <strong>beg</strong> getestet.";
228 case "0.3.7": // SQL queries for v0.3.7
229 // Update notes (these will be set as task text!)
230 $UPDATE_NOTES = "SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.";
233 case "0.3.8": // SQL queries for v0.3.8
234 // Update notes (these will be set as task text!)
235 $UPDATE_NOTES = "Mailbuchungsseite korregiert.";
238 case "0.3.9": // SQL queries for v0.3.9
239 // Update notes (these will be set as task text!)
240 $UPDATE_NOTES = "Erneuten Fehler in Mailbuchungsseite behoben.";
243 case "0.4.0": // SQL queries for v0.4.0
244 // Update notes (these will be set as task text!)
245 $UPDATE_NOTES = POINTS."-Abzug klappt wieder. Danke an Andreman!";
248 case "0.4.1": // SQL queries for v0.4.1
249 // Update notes (these will be set as task text!)
250 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
253 case "0.4.2": // SQL queries for v0.4.2
254 // Update notes (these will be set as task text!)
255 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
258 case "0.4.3": // SQL queries for v0.4.3
259 // Update notes (these will be set as task text!)
260 $UPDATE_NOTES = "Neue Urlaubsschaltung mit integriert.";
263 case "0.4.4": // SQL queries for v0.4.4
264 // Update notes (these will be set as task text!)
265 $UPDATE_NOTES = "Ein <strong>WHERE ext_active='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.";
268 case "0.4.5": // SQL queries for v0.4.5
269 // Update notes (these will be set as task text!)
270 $UPDATE_NOTES = "De-/Aktivieren des mit dieser Erweiterung verknüpften Modules eingebunden.";
273 case "0.4.6": // SQL queries for v0.4.6
274 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order',NULL,'Mailbuchungen',3,'Y','N')";
275 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order','order2','Framekiller-Mails',2,'Y','N')";
276 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='order', `sort`='1', `title`='Klick-Mails' WHERE `what`='order' LIMIT 1";
278 // Update notes (these will be set as task text!)
279 $UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
282 case "0.4.7": // SQL queries for v0.4.7
283 // Update notes (these will be set as task text!)
284 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
287 case "0.4.8": // SQL queries for v0.4.8
288 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `title`='Mailbuchung' WHERE `what`='config_order' LIMIT 1";
290 // Update notes (these will be set as task text!)
291 $UPDATE_NOTES = "Menüpunkt "Mailbuchungsseite" nach "Mailbuchung" umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.";
294 case "0.4.9": // SQL queries for v0.4.9
295 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'";
297 // Update notes (these will be set as task text!)
298 $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.";
301 case "0.5.0": // SQL queries for v0.5.0
302 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_url_blacklist`";
303 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_url_blacklist` (
304 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
305 `url` VARCHAR(255) NOT NULL DEFAULT '',
306 `pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
307 `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
310 ) TYPE=MYISAM COMMENT='URL blacklist'";
312 // Update notes (these will be set as task text!)
313 $UPDATE_NOTES = "Tabelle für URL-Sperrliste angelegt.";
318 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
321 default: // Do stuff when extension is loaded
322 // Do daily reset only when installed and extension version is at least 0.1.1
323 if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1")) {
324 // Reset mail order values
325 $result_ext = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);