Some language strings fixed, renamed. Copyright notice updated
[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  * -------------------------------------------------------------------- *
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                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Version number
44 setThisExtensionVersion('0.5.2');
45
46 // Version history array (add more with , '0.1.0' and so on)
47 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'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
51                 // SQL commands to run
52                 addMemberMenuSql('order','order','Mailbuchung','N','Y',1);
53                 break;
54
55         case 'remove': // Do stuff when removing extension
56                 // SQL commands to run
57                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
58                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='order'");
59                 break;
60
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 `action`='order'");
64                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `hidden`='N', `locked`='N', `admin_only`='N', `mem_only`='Y' WHERE `module`='order' LIMIT 1");
65                 break;
66
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 `action`='order'");
70                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `hidden`='Y', `locked`='Y' WHERE `module`='order' LIMIT 1");
71                 break;
72
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                                 addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
78
79                                 // Update notes (these will be set as task text!)
80                                 setExtensionUpdateNotes("Maximale Mailbuchungen sind nun vom maximalen Empfang abh&auml;gig.");
81                                 break;
82
83                         case '0.1.1': // SQL queries for v0.1.1
84                                 // OLD QUERIES: addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_order' LIMIT 1");
85                                 // OLD QUERIES: addAdminMenuSql('setup','config_order','Mailbuchungsseite','Einstellungen am Mailbuchungsformular.',7);
86                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
87
88                                 // Update notes (these will be set as task text!)
89                                 setExtensionUpdateNotes("Maximale Mailbuchung vervollst&auml;ndigt (Admin-Bereich und im Buchungsformular selber).");
90                                 break;
91
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&auml;hlt und bei t&auml;glichem Reset auf 0 gesetzt).");
95                                 break;
96
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&ouml;scht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.");
100                                 break;
101
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.");
105                                 break;
106
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.");
110                                 break;
111
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.");
115                                 break;
116
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.");
120                                 break;
121
122                         case '0.1.9': // SQL queries for v0.1.9
123                                 // Update notes (these will be set as task text!)
124                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
125                                 break;
126
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> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
130                                 break;
131
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.");
135                                 break;
136
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 &uuml;berpr&uuml;ft ob auch gen&uuml;gend Empf&auml;nger eingegeben worden sind und ob auch gen&uuml;gend empfangsbereit sind.");
140                                 break;
141
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");
144
145                                 // Update notes (these will be set as task text!)
146                                 setExtensionUpdateNotes("Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger");
147                                 break;
148
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&auml;nger wird nun auch angezeigt.");
152                                 break;
153
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.");
157                                 break;
158
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&ouml;tigen {?POINTS?} die maximale Anzahl von Usern in der Kategorie gew&auml;hlt und
162 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:
163 <ol>
164   <li>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</li>
165   <li>Es stellt die Mailart <u>&quot;3 {?POINTS?} Kosten / Mail&quot;</u> ein.</li>
166   <li>Es hat aber nur {?POINTS?} f&uuml;r 10 Empf&auml;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
168   auf.</li>
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>
171 </ol>");
172                                 break;
173
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.");
177                                 break;
178
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.");
182                                 break;
183
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.");
187                                 break;
188
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.");
192                                 break;
193
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'");
197
198                                 // Update notes (these will be set as task text!)
199                                 setExtensionUpdateNotes("Beworbene URL wird nun getestet.");
200                                 break;
201
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&uuml;hrlich.");
205                                 break;
206
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&auml;hlt.");
210                                 break;
211
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.");
215                                 break;
216
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&auml;nderbar ist und zur Festellung der Maximalen Mailbuchungen herangezogen wurde.");
220                                 break;
221
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.");
225                                 break;
226
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.");
230                                 break;
231
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.");
235                                 break;
236
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.");
240                                 break;
241
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!");
245                                 break;
246
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.");
250                                 break;
251
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.");
255                                 break;
256
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.");
260                                 break;
261
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 &#96;ext_active&#96;='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
265                                 break;
266
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&uuml;pften Modules eingebunden.");
270                                 break;
271
272                         case '0.4.6': // SQL queries for v0.4.6
273                                 addMemberMenuSql('order',NULL,'Mailbuchungen','N','Y',3);
274                                 addMemberMenuSql('order','order2','Framekiller-Mails','N','Y',2);
275                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='order', `sort`=1, `title`='Klick-Mails' WHERE `what`='order' LIMIT 1");
276
277                                 // Update notes (these will be set as task text!)
278                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
279                                 break;
280
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.");
284                                 break;
285
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");
288
289                                 // Update notes (these will be set as task text!)
290                                 setExtensionUpdateNotes("Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.");
291                                 break;
292
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'");
295
296                                 // Update notes (these will be set as task text!)
297                                 setExtensionUpdateNotes("Bei L&ouml;schung von Mailbuchungen kann nun scripteweit entschieden werden (Einstellungen also), ob die verbliebenen {?POINTS?} wieder gutgeschrieben werden sollen oder in den Jackpot landen.");
298                                 break;
299
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,
307 PRIMARY KEY (`id`),
308 INDEX (`pool_id`)
309 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'URL blacklist'");
310
311                                 // Update notes (these will be set as task text!)
312                                 setExtensionUpdateNotes("Tabelle f&uuml;r URL-Sperrliste angelegt.");
313                                 break;
314
315                         case '0.5.2': // SQL queries for v0.5.2
316                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_text`");
317                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_subj`");
318                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_text` ENUM('Y','N') NOT NULL DEFAULT 'N'");
319                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_subject` ENUM('Y','N') NOT NULL DEFAULT 'N'");
320
321                                 // Update notes (these will be set as task text!)
322                                 setExtensionUpdateNotes("Inkonsistenz in Konfigurationsnamen korregiert.");
323                                 break;
324                 } // END - switch
325                 break;
326
327         case 'modify': // When the extension got modified
328                 break;
329
330         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
331                 break;
332
333         case 'init': // Do stuff when extension is initialized
334                 // Do daily reset only when installed and extension version is at least 0.1.1
335                 // @TODO This should be moved out to inc/daily/
336                 if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (isExtensionInstalledAndNewer('order', '0.1.1'))) {
337                         // Reset mail order values
338                         $result_ext = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__);
339                 } // END - if
340                 break;
341
342         case 'init': // Do stuff when extension is initialized
343                 break;
344
345         default: // Unknown extension mode
346                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
347                 break;
348 } // END - switch
349
350 // [EOF]
351 ?>