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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
45 setThisExtensionVersion('0.5.0');
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(array('0.0', '0.1.0', '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'));
50 switch (getExtensionMode()) {
51 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52 // SQL commands to run
56 case 'remove': // Do stuff when removing extension
57 // SQL commands to run
58 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order'");
61 case 'activate': // Do stuff when admin activates this extension
62 // SQL commands to run
63 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' LIMIT 1");
64 addExtensionSql("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 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='order' LIMIT 1");
70 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `visible`='N', `locked`='Y' WHERE `module`='order' LIMIT 1");
73 case 'update': // Update an extension
74 switch (getCurrentExtensionVersion()) {
75 case '0.1.0': // SQL queries for v0.1
76 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'");
77 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`sort`,`descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')");
79 // Update notes (these will be set as task text!)
80 setExtensionUpdateNotes("Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.");
83 case '0.1.1': // SQL queries for v0.1.1
84 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
85 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`sort`,`descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')");
86 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD mail_orders BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
88 // Update notes (these will be set as task text!)
89 setExtensionUpdateNotes("Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).");
92 case '0.1.3': // SQL queries for v0.1.3
93 // Update notes (these will be set as task text!)
94 setExtensionUpdateNotes("Maximale Mailbuchungen repariert (werden nun hochgezählt und bei täglichem Reset auf 0 gesetzt).");
97 case '0.1.4': // SQL queries for v0.1.4
98 // Update notes (these will be set as task text!)
99 setExtensionUpdateNotes("Dummy-Datenfeld wird wieder gelöscht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.");
102 case '0.1.5': // SQL queries for v0.1.5
103 // Update notes (these will be set as task text!)
104 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
107 case '0.1.6': // SQL queries for v0.1.6
108 // Update notes (these will be set as task text!)
109 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
112 case '0.1.7': // SQL queries for v0.1.7
113 // Update notes (these will be set as task text!)
114 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
117 case '0.1.8': // SQL queries for v0.1.8
118 // Update notes (these will be set as task text!)
119 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
122 case '0.1.9': // SQL queries for v0.1.9
123 // Update notes (these will be set as task text!)
124 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
127 case '0.2.0': // SQL queries for v0.2.0
128 // Update notes (these will be set as task text!)
129 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
132 case '0.2.1': // SQL queries for v0.2.1
133 // Update notes (these will be set as task text!)
134 setExtensionUpdateNotes("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.");
137 case '0.2.2': // SQL queries for v0.2.2
138 // Update notes (these will be set as task text!)
139 setExtensionUpdateNotes("Es wird nun überprüft ob auch genügend Empfänger eingegeben worden sind und ob auch genügend empfangsbereit sind.");
142 case '0.2.3': // SQL queries for v0.2.3
143 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10");
145 // Update notes (these will be set as task text!)
146 setExtensionUpdateNotes("Minimum an Empfänger pro Mailbuchung einstellbar. Standart: 10 Empfänger");
149 case '0.2.4': // SQL queries for v0.2.4
150 // Update notes (these will be set as task text!)
151 setExtensionUpdateNotes("Anzahl mindestens einszustellende Empfänger wird nun auch angezeigt.");
154 case '0.2.5': // SQL queries for v0.2.5
155 // Update notes (these will be set as task text!)
156 setExtensionUpdateNotes("Speicherung der Einstellungen klappt.");
159 case '0.2.6': // SQL queries for v0.2.6
160 // Update notes (these will be set as task text!)
161 setExtensionUpdateNotes("Fehler in Mailbuchung behoben: Es wurde beim Ermitteln der nötigen {?POINTS?} die maximale Anzahl von Usern in der Kategorie gewählt und
162 nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User hätte nicht genügend {?POINTS?} auf dem Konto. Ein Rechenbeispiel:
164 <li>Das Mitglied wählt eine Kategorie XYZ mit maximal 15 Empfängern aus.</li>
165 <li>Es stellt die Mailart <u>"3 {?POINTS?} Kosten / Mail"</u> ein.</li>
166 <li>Es hat aber nur {?POINTS?} für 10 Empfänger und gibt 10 ein.</li>
167 <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
169 <li>Hatte es aber, wie hier im Beispiel 31 {?POINTS?}, konnte es nicht mehr buchen.</li>
170 <li>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</li>
174 case '0.2.7': // SQL queries for v0.2.7
175 // Update notes (these will be set as task text!)
176 setExtensionUpdateNotes("Fehler mit <u>__MIN_VALUE</u> behoben.");
179 case '0.2.8': // SQL queries for v0.2.8
180 // Update notes (these will be set as task text!)
181 setExtensionUpdateNotes("Konstantenproblem beseitigt.");
184 case '0.2.9': // SQL queries for v0.2.9
185 // Update notes (these will be set as task text!)
186 setExtensionUpdateNotes("Problem mit nicht funktionierenden Mailbuchungen beseitigt.");
189 case '0.3.0': // SQL queries for v0.3.0
190 // Update notes (these will be set as task text!)
191 setExtensionUpdateNotes("Basis-Modul <strong>order.php</strong> abgesichert, wenn Erweiterung nicht aktiviert ist.");
194 case '0.3.1': // SQL queries for v0.3.1
195 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'");
196 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'");
198 // Update notes (these will be set as task text!)
199 setExtensionUpdateNotes("Beworbene URL wird nun getestet.");
202 case '0.3.2': // SQL queries for v0.3.2
203 // Update notes (these will be set as task text!)
204 setExtensionUpdateNotes("Datumsformat festgelegt auf ausführlich.");
207 case '0.3.3': // SQL queries for v0.3.3
208 // Update notes (these will be set as task text!)
209 setExtensionUpdateNotes("Unter <strong>Einstellungen - Mailbuchungsseite</strong> war immer die Tabellenspalte <strong>Mitgliedsnummer</strong> ausgewählt.");
212 case '0.3.4': // SQL queries for v0.3.4
213 // Update notes (these will be set as task text!)
214 setExtensionUpdateNotes("Dateiamenskonflikt zwischen den Erweiterungen <strong>support</strong> und <strong>order</strong> behoben.");
217 case '0.3.5': // SQL queries for v0.3.5
218 // Update notes (these will be set as task text!)
219 setExtensionUpdateNotes("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.");
222 case '0.3.6': // SQL queries for v0.3.6
223 // Update notes (these will be set as task text!)
224 setExtensionUpdateNotes("Im Modul order (<strong>inc/modules/order.php</strong>) wurde fehlerhafterweise die Erweiterung <strong>beg</strong> getestet.");
227 case '0.3.7': // SQL queries for v0.3.7
228 // Update notes (these will be set as task text!)
229 setExtensionUpdateNotes("SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.");
232 case '0.3.8': // SQL queries for v0.3.8
233 // Update notes (these will be set as task text!)
234 setExtensionUpdateNotes("Mailbuchungsseite korregiert.");
237 case '0.3.9': // SQL queries for v0.3.9
238 // Update notes (these will be set as task text!)
239 setExtensionUpdateNotes("Erneuten Fehler in Mailbuchungsseite behoben.");
242 case '0.4.0': // SQL queries for v0.4.0
243 // Update notes (these will be set as task text!)
244 setExtensionUpdateNotes("{?POINTS?}-Abzug klappt wieder. Danke an Andreman!");
247 case '0.4.1': // SQL queries for v0.4.1
248 // Update notes (these will be set as task text!)
249 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
252 case '0.4.2': // SQL queries for v0.4.2
253 // Update notes (these will be set as task text!)
254 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
257 case '0.4.3': // SQL queries for v0.4.3
258 // Update notes (these will be set as task text!)
259 setExtensionUpdateNotes("Neue Urlaubsschaltung mit integriert.");
262 case '0.4.4': // SQL queries for v0.4.4
263 // Update notes (these will be set as task text!)
264 setExtensionUpdateNotes("Ein <strong>WHERE `ext_active`='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
267 case '0.4.5': // SQL queries for v0.4.5
268 // Update notes (these will be set as task text!)
269 setExtensionUpdateNotes("De-/Aktivieren des mit dieser Erweiterung verknüpften Modules eingebunden.");
272 case '0.4.6': // SQL queries for v0.4.6
273 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order',NULL,'Mailbuchungen',3,'Y','N')");
274 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order','order2','Framekiller-Mails',2,'Y','N')");
275 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='order', `sort`='1', `title`='Klick-Mails' WHERE `what`='order' LIMIT 1");
277 // Update notes (these will be set as task text!)
278 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
281 case '0.4.7': // SQL queries for v0.4.7
282 // Update notes (these will be set as task text!)
283 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
286 case '0.4.8': // SQL queries for v0.4.8
287 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Mailbuchung' WHERE `what`='config_order' LIMIT 1");
289 // Update notes (these will be set as task text!)
290 setExtensionUpdateNotes("Menüpunkt "Mailbuchungsseite" nach "Mailbuchung" umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.");
293 case '0.4.9': // SQL queries for v0.4.9
294 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'");
296 // Update notes (these will be set as task text!)
297 setExtensionUpdateNotes("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.");
300 case '0.5.0': // SQL queries for v0.5.0
301 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_url_blacklist`");
302 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_url_blacklist` (
303 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
304 `url` VARCHAR(255) NOT NULL DEFAULT '',
305 `pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
306 `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
309 ) TYPE=MYISAM COMMENT='URL blacklist'");
311 // Update notes (these will be set as task text!)
312 setExtensionUpdateNotes("Tabelle für URL-Sperrliste angelegt.");
317 case 'modify': // When the extension got modified
320 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
323 case 'init': // Do stuff when extension is initialized
324 // Do daily reset only when installed and extension version is at least 0.1.1
325 if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (getExtensionVersion('order') >= '0.1.1')) {
326 // Reset mail order values
327 $result_ext = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
331 case 'init': // Do stuff when extension is initialized
334 default: // Unknown extension mode
335 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));