2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 setThisExtensionVersion('0.5.3');
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.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', '0.5.1', '0.5.2', '0.5.3'));
49 switch (getExtensionMode()) {
50 case 'register': // Do stuff when installation is running
51 // SQL commands to run
52 addMemberMenuSql('order', 'order', 'Mailbuchung', 'N', 'Y', 1);
55 case 'remove': // Do stuff when removing extension
56 // SQL commands to run
57 addDropTableSql('url_blacklist');
58 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
59 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='order'");
62 case 'activate': // Do stuff when admin activates this extension
63 // SQL commands to run
64 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `action`='order'");
65 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `hidden`='N', `locked`='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 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `action`='order'");
71 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `hidden`='Y', `locked`='Y' WHERE `module`='order' LIMIT 1");
74 case 'update': // Update an extension
75 switch (getCurrentExtensionVersion()) {
76 case '0.1.0': // SQL queries for v0.1
77 addConfigAddSql('order_max_full', "ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'");
78 addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
80 // Update notes (these will be set as task text!)
81 setExtensionUpdateNotes("Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.");
84 case '0.1.1': // SQL queries for v0.1.1
85 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
87 // Update notes (these will be set as task text!)
88 setExtensionUpdateNotes("Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).");
91 case '0.1.3': // SQL queries for v0.1.3
92 // Update notes (these will be set as task text!)
93 setExtensionUpdateNotes("Maximale Mailbuchungen repariert (werden nun hochgezählt und bei täglichem Reset auf 0 gesetzt).");
96 case '0.1.4': // SQL queries for v0.1.4
97 // Update notes (these will be set as task text!)
98 setExtensionUpdateNotes("Dummy-Datenfeld wird wieder gelöscht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.");
101 case '0.1.5': // SQL queries for v0.1.5
102 // Update notes (these will be set as task text!)
103 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
106 case '0.1.6': // SQL queries for v0.1.6
107 // Update notes (these will be set as task text!)
108 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
111 case '0.1.7': // SQL queries for v0.1.7
112 // Update notes (these will be set as task text!)
113 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
116 case '0.1.8': // SQL queries for v0.1.8
117 // Update notes (these will be set as task text!)
118 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
121 case '0.1.9': // SQL queries for v0.1.9
122 // Update notes (these will be set as task text!)
123 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
126 case '0.2.0': // SQL queries for v0.2.0
127 // Update notes (these will be set as task text!)
128 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
131 case '0.2.1': // SQL queries for v0.2.1
132 // Update notes (these will be set as task text!)
133 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.");
136 case '0.2.2': // SQL queries for v0.2.2
137 // Update notes (these will be set as task text!)
138 setExtensionUpdateNotes("Es wird nun überprüft ob auch genügend Empfänger eingegeben worden sind und ob auch genügend empfangsbereit sind.");
141 case '0.2.3': // SQL queries for v0.2.3
142 addConfigAddSql('order_min', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 10');
144 // Update notes (these will be set as task text!)
145 setExtensionUpdateNotes("Minimum an Empfänger pro Mailbuchung einstellbar. Standard: 10 Empfänger");
148 case '0.2.4': // SQL queries for v0.2.4
149 // Update notes (these will be set as task text!)
150 setExtensionUpdateNotes("Anzahl mindestens einszustellende Empfänger wird nun auch angezeigt.");
153 case '0.2.5': // SQL queries for v0.2.5
154 // Update notes (these will be set as task text!)
155 setExtensionUpdateNotes("Speicherung der Einstellungen klappt.");
158 case '0.2.6': // SQL queries for v0.2.6
159 // Update notes (these will be set as task text!)
160 setExtensionUpdateNotes("Fehler in Mailbuchung behoben: Es wurde beim Ermitteln der nötigen {?POINTS?} die maximale Anzahl von Usern in der Kategorie gewählt und
161 nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User hätte nicht genügend {?POINTS?} auf dem Konto. Ein Rechenbeispiel:
163 <li>Das Mitglied wählt eine Kategorie XYZ mit maximal 15 Empfängern aus.</li>
164 <li>Es stellt die Mailart <u>"3 {?POINTS?} Kosten / Mail"</u> ein.</li>
165 <li>Es hat aber nur {?POINTS?} für 10 Empfänger und gibt 10 ein.</li>
166 <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
168 <li>Hatte es aber, wie hier im Beispiel 31 {?POINTS?}, konnte es nicht mehr buchen.</li>
169 <li>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</li>
173 case '0.2.7': // SQL queries for v0.2.7
174 // Update notes (these will be set as task text!)
175 setExtensionUpdateNotes("Fehler mit <u>__MIN_VALUE</u> behoben.");
178 case '0.2.8': // SQL queries for v0.2.8
179 // Update notes (these will be set as task text!)
180 setExtensionUpdateNotes("Konstantenproblem beseitigt.");
183 case '0.2.9': // SQL queries for v0.2.9
184 // Update notes (these will be set as task text!)
185 setExtensionUpdateNotes("Problem mit nicht funktionierenden Mailbuchungen beseitigt.");
188 case '0.3.0': // SQL queries for v0.3.0
189 // Update notes (these will be set as task text!)
190 setExtensionUpdateNotes("Basis-Modul <strong>order.php</strong> abgesichert, wenn Erweiterung nicht aktiviert ist.");
193 case '0.3.1': // SQL queries for v0.3.1
194 addConfigAddSql('order_select', "VARCHAR(255) NOT NULL DEFAULT 'userid'");
195 addConfigAddSql('order_mode', "ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'");
197 // Update notes (these will be set as task text!)
198 setExtensionUpdateNotes("Beworbene URL wird nun getestet.");
201 case '0.3.2': // SQL queries for v0.3.2
202 // Update notes (these will be set as task text!)
203 setExtensionUpdateNotes("Datumsformat festgelegt auf ausführlich.");
206 case '0.3.3': // SQL queries for v0.3.3
207 // Update notes (these will be set as task text!)
208 setExtensionUpdateNotes("Unter <strong>Einstellungen - Mailbuchungsseite</strong> war immer die Tabellenspalte <strong>Mitgliedsnummer</strong> ausgewählt.");
211 case '0.3.4': // SQL queries for v0.3.4
212 // Update notes (these will be set as task text!)
213 setExtensionUpdateNotes("Dateiamenskonflikt zwischen den Erweiterungen <strong>support</strong> und <strong>order</strong> behoben.");
216 case '0.3.5': // SQL queries for v0.3.5
217 // Update notes (these will be set as task text!)
218 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.");
221 case '0.3.6': // SQL queries for v0.3.6
222 // Update notes (these will be set as task text!)
223 setExtensionUpdateNotes("Im Modul order (<strong>inc/modules/order.php</strong>) wurde fehlerhafterweise die Erweiterung <strong>beg</strong> getestet.");
226 case '0.3.7': // SQL queries for v0.3.7
227 // Update notes (these will be set as task text!)
228 setExtensionUpdateNotes("SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.");
231 case '0.3.8': // SQL queries for v0.3.8
232 // Update notes (these will be set as task text!)
233 setExtensionUpdateNotes("Mailbuchungsseite korregiert.");
236 case '0.3.9': // SQL queries for v0.3.9
237 // Update notes (these will be set as task text!)
238 setExtensionUpdateNotes("Erneuten Fehler in Mailbuchungsseite behoben.");
241 case '0.4.0': // SQL queries for v0.4.0
242 // Update notes (these will be set as task text!)
243 setExtensionUpdateNotes("{?POINTS?}-Abzug klappt wieder. Danke an Andreman!");
246 case '0.4.1': // SQL queries for v0.4.1
247 // Update notes (these will be set as task text!)
248 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
251 case '0.4.2': // SQL queries for v0.4.2
252 // Update notes (these will be set as task text!)
253 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
256 case '0.4.3': // SQL queries for v0.4.3
257 // Update notes (these will be set as task text!)
258 setExtensionUpdateNotes("Neue Urlaubsschaltung mit integriert.");
261 case '0.4.4': // SQL queries for v0.4.4
262 // Update notes (these will be set as task text!)
263 setExtensionUpdateNotes("Ein <strong>WHERE `ext_active`='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
266 case '0.4.5': // SQL queries for v0.4.5
267 // Update notes (these will be set as task text!)
268 setExtensionUpdateNotes("De-/Aktivieren des mit dieser Erweiterung verknüpften Modules eingebunden.");
271 case '0.4.6': // SQL queries for v0.4.6
272 addMemberMenuSql('order', NULL, 'Mailbuchungen', 'N', 'Y', 3);
273 addMemberMenuSql('order', 'order2', 'Framekiller-Mails', 'N', 'Y', 2);
274 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='order', `sort`=1, `title`='Klick-Mails' WHERE `what`='order' LIMIT 1");
276 // Update notes (these will be set as task text!)
277 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
280 case '0.4.7': // SQL queries for v0.4.7
281 // Update notes (these will be set as task text!)
282 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
285 case '0.4.8': // SQL queries for v0.4.8
286 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Mailbuchung' WHERE `what`='config_order' LIMIT 1");
288 // Update notes (these will be set as task text!)
289 setExtensionUpdateNotes("Menüpunkt "Mailbuchungsseite" nach "Mailbuchung" umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.");
292 case '0.4.9': // SQL queries for v0.4.9
293 addConfigAddSql('repay_deleted_mails', "ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'");
295 // Update notes (these will be set as task text!)
296 setExtensionUpdateNotes("Bei Löschung von Mailbuchungen kann nun scripteweit entschieden werden (Einstellungen also), ob die verbliebenen {?POINTS?} wieder gutgeschrieben werden sollen oder in den Jackpot landen.");
299 case '0.5.0': // SQL queries for v0.5.0
300 addDropTableSql('url_blacklist');
301 addCreateTableSql('url_blacklist', "(
302 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
303 `url` VARCHAR(255) NOT NULL DEFAULT '',
304 `pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
305 `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
308 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'URL blacklist'");
310 // Update notes (these will be set as task text!)
311 setExtensionUpdateNotes("Tabelle für URL-Sperrliste angelegt.");
314 case '0.5.1': // SQL queries for v0.5.1
315 // Update notes (these will be set as task text!)
316 setExtensionUpdateNotes("Nicht mehr gültiges Update.");
319 case '0.5.2': // SQL queries for v0.5.2
320 addConfigDropSql('test_text');
321 addConfigDropSql('test_subj');
322 addConfigAddSql('allow_url_in_text', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
323 addConfigAddSql('allow_url_in_subject', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
325 // Update notes (these will be set as task text!)
326 setExtensionUpdateNotes("Inkonsistenz in Konfigurationsnamen korregiert.");
329 case '0.5.3': // SQL queries for v0.5.3
330 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
331 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `locked_order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
333 // This update depends on ext-user
334 addExtensionDependency('user');
336 // Register filters for gathering points
337 registerFilter(__FUNCTION__, __LINE__, 'get_total_points', 'ORDER_POINTS', true, isExtensionDryRun());
338 registerFilter(__FUNCTION__, __LINE__, 'get_own_points', 'ORDER_POINTS', true, isExtensionDryRun());
340 // Update notes (these will be set as task text!)
341 setExtensionUpdateNotes("Weiteres {?POINTS?}-Guthabenkonto "Werbeguthaben" hinzugefügt (verschoben von ext-user) und neue Filter zum Zurückliefern des Werbeguthabens hinzugefügt.");
346 case 'modify': // When the extension got modified
349 case 'test': // For testing purposes
352 case 'init': // Do stuff when extension is initialized
353 // Do daily reset only when installed and extension version is at least 0.1.1
354 // @TODO This should be moved out to inc/daily/
355 if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (isExtensionInstalledAndNewer('order', '0.1.1'))) {
356 // Reset mail order values
357 $result_ext = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__);
361 case 'init': // Do stuff when extension is initialized
364 default: // Unknown extension mode
365 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));