]> git.mxchange.org Git - mailer.git/blob - inc/extensions/ext-order.php
Fixes
[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.3');
45
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'));
48
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);
53                 break;
54
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'");
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                                 addConfigAddSql('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                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
86
87                                 // Update notes (these will be set as task text!)
88                                 setExtensionUpdateNotes("Maximale Mailbuchung vervollst&auml;ndigt (Admin-Bereich und im Buchungsformular selber).");
89                                 break;
90
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&auml;hlt und bei t&auml;glichem Reset auf 0 gesetzt).");
94                                 break;
95
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&ouml;scht, um Probleme zu vermeiden. Fehlende Spalte <em>mail_order</em> korregiert auf <em>mail_orders</em>.");
99                                 break;
100
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.");
104                                 break;
105
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.");
109                                 break;
110
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.");
114                                 break;
115
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.");
119                                 break;
120
121                         case '0.1.9': // SQL queries for v0.1.9
122                                 // Update notes (these will be set as task text!)
123                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
124                                 break;
125
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> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
129                                 break;
130
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.");
134                                 break;
135
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 &uuml;berpr&uuml;ft ob auch gen&uuml;gend Empf&auml;nger eingegeben worden sind und ob auch gen&uuml;gend empfangsbereit sind.");
139                                 break;
140
141                         case '0.2.3': // SQL queries for v0.2.3
142                                 addConfigAddSql('order_min', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 10');
143
144                                 // Update notes (these will be set as task text!)
145                                 setExtensionUpdateNotes("Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standard: 10 Empf&auml;nger");
146                                 break;
147
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&auml;nger wird nun auch angezeigt.");
151                                 break;
152
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.");
156                                 break;
157
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&ouml;tigen {?POINTS?} die maximale Anzahl von Usern in der Kategorie gew&auml;hlt und
161 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:
162 <ol>
163   <li>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</li>
164   <li>Es stellt die Mailart <u>&quot;3 {?POINTS?} Kosten / Mail&quot;</u> ein.</li>
165   <li>Es hat aber nur {?POINTS?} f&uuml;r 10 Empf&auml;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
167   auf.</li>
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>
170 </ol>");
171                                 break;
172
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.");
176                                 break;
177
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.");
181                                 break;
182
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.");
186                                 break;
187
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.");
191                                 break;
192
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'");
196
197                                 // Update notes (these will be set as task text!)
198                                 setExtensionUpdateNotes("Beworbene URL wird nun getestet.");
199                                 break;
200
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&uuml;hrlich.");
204                                 break;
205
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&auml;hlt.");
209                                 break;
210
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.");
214                                 break;
215
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&auml;nderbar ist und zur Festellung der Maximalen Mailbuchungen herangezogen wurde.");
219                                 break;
220
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.");
224                                 break;
225
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.");
229                                 break;
230
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.");
234                                 break;
235
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.");
239                                 break;
240
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!");
244                                 break;
245
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.");
249                                 break;
250
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.");
254                                 break;
255
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.");
259                                 break;
260
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 &#96;ext_active&#96;='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
264                                 break;
265
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&uuml;pften Modules eingebunden.");
269                                 break;
270
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");
275
276                                 // Update notes (these will be set as task text!)
277                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
278                                 break;
279
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.");
283                                 break;
284
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");
287
288                                 // Update notes (these will be set as task text!)
289                                 setExtensionUpdateNotes("Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.");
290                                 break;
291
292                         case '0.4.9': // SQL queries for v0.4.9
293                                 addConfigAddSql('repay_deleted_mails', "ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'");
294
295                                 // Update notes (these will be set as task text!)
296                                 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.");
297                                 break;
298
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,
306 PRIMARY KEY (`id`),
307 INDEX (`pool_id`)
308 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'URL blacklist'");
309
310                                 // Update notes (these will be set as task text!)
311                                 setExtensionUpdateNotes("Tabelle f&uuml;r URL-Sperrliste angelegt.");
312                                 break;
313
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&uuml;ltiges Update.");
317                                 break;
318
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'");
324
325                                 // Update notes (these will be set as task text!)
326                                 setExtensionUpdateNotes("Inkonsistenz in Konfigurationsnamen korregiert.");
327                                 break;
328
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');
332
333                                 // This update depends on ext-user
334                                 addExtensionDependency('user');
335
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());
339
340                                 // Update notes (these will be set as task text!)
341                                 setExtensionUpdateNotes("Weiteres {?POINTS?}-Guthabenkonto &quot;Werbeguthaben&quot; hinzugef&uuml;gt (verschoben von ext-user) und neue Filter zum Zur&uuml;ckliefern des Werbeguthabens hinzugef&uuml;gt.");
342                                 break;
343                 } // END - switch
344                 break;
345
346         case 'modify': // When the extension got modified
347                 break;
348
349         case 'test': // For testing purposes
350                 break;
351
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__);
358                 } // END - if
359                 break;
360
361         case 'init': // Do stuff when extension is initialized
362                 break;
363
364         default: // Unknown extension mode
365                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
366                 break;
367 } // END - switch
368
369 // [EOF]
370 ?>