8e6b2b83216249826a2297e0c3ce7c98a9e821ad
[mailer.git] / inc / extensions / ext-order.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 04/29/2004 *
4  * ===================                          Last change: 11/14/2004 *
5  *                                                                      *
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  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 } // END - if
43
44 // Version number
45 setThisExtensionVersion('0.5.2');
46
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', '0.5.1', '0.5.2'));
49
50 switch (getExtensionMode()) {
51         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52                 // SQL commands to run
53                 addExtensionSql('');
54                 break;
55
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' LIMIT 1");
59                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='order'");
60                 break;
61
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");
66                 break;
67
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");
72                 break;
73
74         case 'update': // Update an extension
75                 switch (getCurrentExtensionVersion()) {
76                         case '0.1.0': // SQL queries for v0.1
77                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'");
78                                 addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
79
80                                 // Update notes (these will be set as task text!)
81                                 setExtensionUpdateNotes("Maximale Mailbuchungen sind nun vom maximalen Empfang abh&auml;gig.");
82                                 break;
83
84                         case '0.1.1': // SQL queries for v0.1.1
85                                 // OLD QUERIES: addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
86                                 // OLD QUERIES: addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
87                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
88
89                                 // Update notes (these will be set as task text!)
90                                 setExtensionUpdateNotes("Maximale Mailbuchung vervollst&auml;ndigt (Admin-Bereich und im Buchungsformular selber).");
91                                 break;
92
93                         case '0.1.3': // SQL queries for v0.1.3
94                                 // Update notes (these will be set as task text!)
95                                 setExtensionUpdateNotes("Maximale Mailbuchungen repariert (werden nun hochgez&auml;hlt und bei t&auml;glichem Reset auf 0 gesetzt).");
96                                 break;
97
98                         case '0.1.4': // SQL queries for v0.1.4
99                                 // Update notes (these will be set as task text!)
100                                 setExtensionUpdateNotes("Dummy-Datenfeld wird wieder gel&ouml;scht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.");
101                                 break;
102
103                         case '0.1.5': // SQL queries for v0.1.5
104                                 // Update notes (these will be set as task text!)
105                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
106                                 break;
107
108                         case '0.1.6': // SQL queries for v0.1.6
109                                 // Update notes (these will be set as task text!)
110                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
111                                 break;
112
113                         case '0.1.7': // SQL queries for v0.1.7
114                                 // Update notes (these will be set as task text!)
115                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
116                                 break;
117
118                         case '0.1.8': // SQL queries for v0.1.8
119                                 // Update notes (these will be set as task text!)
120                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
121                                 break;
122
123                         case '0.1.9': // SQL queries for v0.1.9
124                                 // Update notes (these will be set as task text!)
125                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
126                                 break;
127
128                         case '0.2.0': // SQL queries for v0.2.0
129                                 // Update notes (these will be set as task text!)
130                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
131                                 break;
132
133                         case '0.2.1': // SQL queries for v0.2.1
134                                 // Update notes (these will be set as task text!)
135                                 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                                 break;
137
138                         case '0.2.2': // SQL queries for v0.2.2
139                                 // Update notes (these will be set as task text!)
140                                 setExtensionUpdateNotes("Es wird nun &uuml;berpr&uuml;ft ob auch gen&uuml;gend Empf&auml;nger eingegeben worden sind und ob auch gen&uuml;gend empfangsbereit sind.");
141                                 break;
142
143                         case '0.2.3': // SQL queries for v0.2.3
144                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10");
145
146                                 // Update notes (these will be set as task text!)
147                                 setExtensionUpdateNotes("Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger");
148                                 break;
149
150                         case '0.2.4': // SQL queries for v0.2.4
151                                 // Update notes (these will be set as task text!)
152                                 setExtensionUpdateNotes("Anzahl mindestens einszustellende Empf&auml;nger wird nun auch angezeigt.");
153                                 break;
154
155                         case '0.2.5': // SQL queries for v0.2.5
156                                 // Update notes (these will be set as task text!)
157                                 setExtensionUpdateNotes("Speicherung der Einstellungen klappt.");
158                                 break;
159
160                         case '0.2.6': // SQL queries for v0.2.6
161                                 // Update notes (these will be set as task text!)
162                                 setExtensionUpdateNotes("Fehler in Mailbuchung behoben: Es wurde beim Ermitteln der n&ouml;tigen {?POINTS?} die maximale Anzahl von Usern in der Kategorie gew&auml;hlt und
163 nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der User h&auml;tte nicht gen&uuml;gend {?POINTS?} auf dem Konto. Ein Rechenbeispiel:
164 <ol>
165   <li>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</li>
166   <li>Es stellt die Mailart <u>&quot;3 {?POINTS?} Kosten / Mail&quot;</u> ein.</li>
167   <li>Es hat aber nur {?POINTS?} f&uuml;r 10 Empf&auml;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
169   auf.</li>
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>
172 </ol>");
173                                 break;
174
175                         case '0.2.7': // SQL queries for v0.2.7
176                                 // Update notes (these will be set as task text!)
177                                 setExtensionUpdateNotes("Fehler mit <u>__MIN_VALUE</u> behoben.");
178                                 break;
179
180                         case '0.2.8': // SQL queries for v0.2.8
181                                 // Update notes (these will be set as task text!)
182                                 setExtensionUpdateNotes("Konstantenproblem beseitigt.");
183                                 break;
184
185                         case '0.2.9': // SQL queries for v0.2.9
186                                 // Update notes (these will be set as task text!)
187                                 setExtensionUpdateNotes("Problem mit nicht funktionierenden Mailbuchungen beseitigt.");
188                                 break;
189
190                         case '0.3.0': // SQL queries for v0.3.0
191                                 // Update notes (these will be set as task text!)
192                                 setExtensionUpdateNotes("Basis-Modul <strong>order.php</strong> abgesichert, wenn Erweiterung nicht aktiviert ist.");
193                                 break;
194
195                         case '0.3.1': // SQL queries for v0.3.1
196                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'");
197                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'");
198
199                                 // Update notes (these will be set as task text!)
200                                 setExtensionUpdateNotes("Beworbene URL wird nun getestet.");
201                                 break;
202
203                         case '0.3.2': // SQL queries for v0.3.2
204                                 // Update notes (these will be set as task text!)
205                                 setExtensionUpdateNotes("Datumsformat festgelegt auf ausf&uuml;hrlich.");
206                                 break;
207
208                         case '0.3.3': // SQL queries for v0.3.3
209                                 // Update notes (these will be set as task text!)
210                                 setExtensionUpdateNotes("Unter <strong>Einstellungen - Mailbuchungsseite</strong> war immer die Tabellenspalte <strong>Mitgliedsnummer</strong> ausgew&auml;hlt.");
211                                 break;
212
213                         case '0.3.4': // SQL queries for v0.3.4
214                                 // Update notes (these will be set as task text!)
215                                 setExtensionUpdateNotes("Dateiamenskonflikt zwischen den Erweiterungen <strong>support</strong> und <strong>order</strong> behoben.");
216                                 break;
217
218                         case '0.3.5': // SQL queries for v0.3.5
219                                 // Update notes (these will be set as task text!)
220                                 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&auml;nderbar ist und zur Festellung der Maximalen Mailbuchungen herangezogen wurde.");
221                                 break;
222
223                         case '0.3.6': // SQL queries for v0.3.6
224                                 // Update notes (these will be set as task text!)
225                                 setExtensionUpdateNotes("Im Modul order (<strong>inc/modules/order.php</strong>) wurde fehlerhafterweise die Erweiterung <strong>beg</strong> getestet.");
226                                 break;
227
228                         case '0.3.7': // SQL queries for v0.3.7
229                                 // Update notes (these will be set as task text!)
230                                 setExtensionUpdateNotes("SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.");
231                                 break;
232
233                         case '0.3.8': // SQL queries for v0.3.8
234                                 // Update notes (these will be set as task text!)
235                                 setExtensionUpdateNotes("Mailbuchungsseite korregiert.");
236                                 break;
237
238                         case '0.3.9': // SQL queries for v0.3.9
239                                 // Update notes (these will be set as task text!)
240                                 setExtensionUpdateNotes("Erneuten Fehler in Mailbuchungsseite behoben.");
241                                 break;
242
243                         case '0.4.0': // SQL queries for v0.4.0
244                                 // Update notes (these will be set as task text!)
245                                 setExtensionUpdateNotes("{?POINTS?}-Abzug klappt wieder. Danke an Andreman!");
246                                 break;
247
248                         case '0.4.1': // SQL queries for v0.4.1
249                                 // Update notes (these will be set as task text!)
250                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
251                                 break;
252
253                         case '0.4.2': // SQL queries for v0.4.2
254                                 // Update notes (these will be set as task text!)
255                                 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
256                                 break;
257
258                         case '0.4.3': // SQL queries for v0.4.3
259                                 // Update notes (these will be set as task text!)
260                                 setExtensionUpdateNotes("Neue Urlaubsschaltung mit integriert.");
261                                 break;
262
263                         case '0.4.4': // SQL queries for v0.4.4
264                                 // Update notes (these will be set as task text!)
265                                 setExtensionUpdateNotes("Ein <strong>WHERE &#96;ext_active&#96;='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
266                                 break;
267
268                         case '0.4.5': // SQL queries for v0.4.5
269                                 // Update notes (these will be set as task text!)
270                                 setExtensionUpdateNotes("De-/Aktivieren des mit dieser Erweiterung verkn&uuml;pften Modules eingebunden.");
271                                 break;
272
273                         case '0.4.6': // SQL queries for v0.4.6
274                                 addMemberMenuSql('order',NULL,'Mailbuchungen','N','Y',3);
275                                 addMemberMenuSql('order','order2','Framekiller-Mails','N','Y',2);
276                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='order', `sort`=1, `title`='Klick-Mails' WHERE `what`='order' LIMIT 1");
277
278                                 // Update notes (these will be set as task text!)
279                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
280                                 break;
281
282                         case '0.4.7': // SQL queries for v0.4.7
283                                 // Update notes (these will be set as task text!)
284                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
285                                 break;
286
287                         case '0.4.8': // SQL queries for v0.4.8
288                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Mailbuchung' WHERE `what`='config_order' LIMIT 1");
289
290                                 // Update notes (these will be set as task text!)
291                                 setExtensionUpdateNotes("Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.");
292                                 break;
293
294                         case '0.4.9': // SQL queries for v0.4.9
295                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'");
296
297                                 // Update notes (these will be set as task text!)
298                                 setExtensionUpdateNotes("Bei L&ouml;schung von Mailbuchungen kann nun global entschieden werden (Einstellungen also), ob die verbliebenen {?POINTS?} wieder gutgeschrieben werden sollen oder in den Jackpot landen.");
299                                 break;
300
301                         case '0.5.0': // SQL queries for v0.5.0
302                                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_url_blacklist`");
303                                 addExtensionSql("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,
308 PRIMARY KEY (`id`),
309 INDEX (`pool_id`)
310 ) TYPE={?_TABLE_TYPE?} COMMENT='URL blacklist'");
311
312                                 // Update notes (these will be set as task text!)
313                                 setExtensionUpdateNotes("Tabelle f&uuml;r URL-Sperrliste angelegt.");
314                                 break;
315
316                         case '0.5.1': // SQL queries for v0.5.1
317                                 addMemberMenuSql('main','order','Mailbuchung','N','Y',8);
318
319                                 // Update notes (these will be set as task text!)
320                                 setExtensionUpdateNotes("Weiteren Men&uuml;-Query in Erweiterung verlagert.");
321                                 break;
322
323                         case '0.5.2': // SQL queries for v0.5.2
324                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_text`");
325                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_subj`");
326                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_text` ENUM('Y','N') NOT NULL DEFAULT 'N'");
327                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_subject` ENUM('Y','N') NOT NULL DEFAULT 'N'");
328
329                                 // Update notes (these will be set as task text!)
330                                 setExtensionUpdateNotes("Inkonsistenz in Konfigurationsnamen korregiert.");
331                                 break;
332                 }
333                 break;
334
335         case 'modify': // When the extension got modified
336                 break;
337
338         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
339                 break;
340
341         case 'init': // Do stuff when extension is initialized
342                 // Do daily reset only when installed and extension version is at least 0.1.1
343                 if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (getExtensionVersion('order') >= '0.1.1')) {
344                         // Reset mail order values
345                         $result_ext = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
346                 } // END - if
347                 break;
348
349         case 'init': // Do stuff when extension is initialized
350                 break;
351
352         default: // Unknown extension mode
353                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
354                 break;
355 }
356
357 // [EOF]
358 ?>