Obsolete direct links to my server removed, patch support deactivated in what-updates.php
[mailer.git] / inc / extensions / ext-order.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    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  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Version number
41 $EXT_VERSION = "0.4.9";
42
43 // Auto-set extension version
44 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
45
46 // Version history array (add more with , "0.1" and so on)
47 $EXT_VER_HISTORY = array("0.0", "0.1", "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");
48
49 switch ($EXT_LOAD_MODE)
50 {
51 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
52         // SQL commands to run
53         $SQLs[] = "";
54         break;
55
56 case "remove": // Do stuff when removing extension
57         // SQL commands to run
58         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP order_max_full";
59         $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
60         break;
61
62 case "activate": // Do stuff when admin activates this extension
63         // SQL commands to run
64         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='order' LIMIT 1";
65         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='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         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
71         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='order' LIMIT 1";
72         break;
73
74 case "update": // Update an extension
75         switch ($EXT_VER)
76         {
77         case "0.1": // SQL queries for v0.1
78                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_max_full ENUM('ORDER', 'MAX') NOT NULL DEFAULT 'MAX'";
79                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
80
81                 // Update notes (these will be set as task text!)
82                 $UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abh&auml;gig.";
83                 break;
84
85         case "0.1.1": // SQL queries for v0.1.1
86                 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
87                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
88                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD mail_orders BIGINT(20) NOT NULL DEFAULT '0'";
89
90                 // Update notes (these will be set as task text!)
91                 $UPDATE_NOTES = "Maximale Mailbuchung vervollst&auml;ndigt (Admin-Bereich und im Buchungsformular selber).";
92                 break;
93
94         case "0.1.3": // SQL queries for v0.1.3
95                 // Update notes (these will be set as task text!)
96                 $UPDATE_NOTES = "Maximale Mailbuchungen repariert (werden nun hochgez&auml;hlt und bei t&auml;glichem Reset auf 0 gesetzt).";
97                 break;
98
99         case "0.1.4": // SQL queries for v0.1.4
100                 // Update notes (these will be set as task text!)
101                 $UPDATE_NOTES = "Dummy-Datenfeld wird wieder gel&ouml;scht, um Probleme zu vermeiden. Fehlende Spalte <I>mail_order</I> korregiert auf <I>mail_orders</I>.";
102                 break;
103
104         case "0.1.5": // SQL queries for v0.1.5
105                 // Update notes (these will be set as task text!)
106                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
107                 break;
108
109         case "0.1.6": // SQL queries for v0.1.6
110                 // Update notes (these will be set as task text!)
111                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
112                 break;
113
114         case "0.1.7": // SQL queries for v0.1.7
115                 // Update notes (these will be set as task text!)
116                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
117                 break;
118
119         case "0.1.8": // SQL queries for v0.1.8
120                 // Update notes (these will be set as task text!)
121                 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
122                 break;
123
124         case "0.1.9": // SQL queries for v0.1.9
125                 // Update notes (these will be set as task text!)
126                 $UPDATE_NOTES = "Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
127                 break;
128
129         case "0.2.0": // SQL queries for v0.2.0
130                 // Update notes (these will be set as task text!)
131                 $UPDATE_NOTES = "Seit <A href=\"#\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
132                 break;
133
134         case "0.2.1": // SQL queries for v0.2.1
135                 // Update notes (these will be set as task text!)
136                 $UPDATE_NOTES = "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                 break;
138
139         case "0.2.2": // SQL queries for v0.2.2
140                 // Update notes (these will be set as task text!)
141                 $UPDATE_NOTES = "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.";
142                 break;
143
144         case "0.2.3": // SQL queries for v0.2.3
145                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_min BIGINT(20) NOT NULL DEFAULT '10'";
146
147                 // Update notes (these will be set as task text!)
148                 $UPDATE_NOTES = "Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger";
149                 break;
150
151         case "0.2.4": // SQL queries for v0.2.4
152                 // Update notes (these will be set as task text!)
153                 $UPDATE_NOTES = "Anzahl mindestens einszustellende Empf&auml;nger wird nun auch angezeigt.";
154                 break;
155
156         case "0.2.5": // SQL queries for v0.2.5
157                 // Update notes (these will be set as task text!)
158                 $UPDATE_NOTES = "Speicherung der Einstellungen klappt.";
159                 break;
160
161         case "0.2.6": // SQL queries for v0.2.6
162                 // Update notes (these will be set as task text!)
163                 $UPDATE_NOTES = "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
164 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:
165 <OL>
166   <LI>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</LI>
167   <LI>Es stellt die Mailart <U>&quot;3 {!POINTS!} Kosten / Mail&quot;</U> ein.</LI>
168   <LI>Es hat aber nur {!POINTS!} f&uuml;r 10 Empf&auml;nger und gibt 10 ein.</LI>
169   <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
170   auf.</LI>
171   <LI>Hatte es aber, wie hier im Beispiel 31 {!POINTS!}, konnte es nicht mehr buchen.</LI>
172   <LI>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</LI>
173 </OL>";
174                 break;
175
176         case "0.2.7": // SQL queries for v0.2.7
177                 // Update notes (these will be set as task text!)
178                 $UPDATE_NOTES = "Fehler mit <U>__MIN_VALUE</U> behoben.";
179                 break;
180
181         case "0.2.8": // SQL queries for v0.2.8
182                 // Update notes (these will be set as task text!)
183                 $UPDATE_NOTES = "Konstantenproblem beseitigt.";
184                 break;
185
186         case "0.2.9": // SQL queries for v0.2.9
187                 // Update notes (these will be set as task text!)
188                 $UPDATE_NOTES = "Problem mit nicht funktionierenden Mailbuchungen beseitigt.";
189                 break;
190
191         case "0.3.0": // SQL queries for v0.3.0
192                 // Update notes (these will be set as task text!)
193                 $UPDATE_NOTES = "Basis-Modul <STRONG>order.php</STRONG> abgesichert, wenn Erweiterung nicht aktiviert ist.";
194                 break;
195
196         case "0.3.1": // SQL queries for v0.3.1
197                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'";
198                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_mode ENUM('ASC', 'DESC') NOT NULL DEFAULT 'DESC'";
199
200                 // Update notes (these will be set as task text!)
201                 $UPDATE_NOTES = "Beworbene URL wird nun getestet.";
202                 break;
203
204         case "0.3.2": // SQL queries for v0.3.2
205                 // Update notes (these will be set as task text!)
206                 $UPDATE_NOTES = "Datumsformat festgelegt auf ausf&uuml;hrlich.";
207                 break;
208
209         case "0.3.3": // SQL queries for v0.3.3
210                 // Update notes (these will be set as task text!)
211                 $UPDATE_NOTES = "Unter <STRONG>Einstellungen - Mailbuchungsseite</STRONG> war immer die Tabellenspalte <STRONG>Mitgliedsnummer</STRONG> ausgew&auml;hlt.";
212                 break;
213
214         case "0.3.4": // SQL queries for v0.3.4
215                 // Update notes (these will be set as task text!)
216                 $UPDATE_NOTES = "Dateiamenskonflikt zwischen den Erweiterungen <STRONG>support</STRONG> und <STRONG>order</STRONG> behoben.";
217                 break;
218
219         case "0.3.5": // SQL queries for v0.3.5
220                 // Update notes (these will be set as task text!)
221                 $UPDATE_NOTES = "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.";
222                 break;
223
224         case "0.3.6": // SQL queries for v0.3.6
225                 // Update notes (these will be set as task text!)
226                 $UPDATE_NOTES = "Im Modul order (<STRONG>inc/modules/order.php</STRONG>) wurde fehlerhafterweise die Erweiterung <STRONG>beg</STRONG> getestet.";
227                 break;
228
229         case "0.3.7": // SQL queries for v0.3.7
230                 // Update notes (these will be set as task text!)
231                 $UPDATE_NOTES = "SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.";
232                 break;
233
234         case "0.3.8": // SQL queries for v0.3.8
235                 // Update notes (these will be set as task text!)
236                 $UPDATE_NOTES = "Mailbuchungsseite korregiert.";
237                 break;
238
239         case "0.3.9": // SQL queries for v0.3.9
240                 // Update notes (these will be set as task text!)
241                 $UPDATE_NOTES = "Erneuten Fehler in Mailbuchungsseite behoben.";
242                 break;
243
244         case "0.4.0": // SQL queries for v0.4.0
245                 // Update notes (these will be set as task text!)
246                 $UPDATE_NOTES = POINTS."-Abzug klappt wieder. Danke an Andreman!";
247                 break;
248
249         case "0.4.1": // SQL queries for v0.4.1
250                 // Update notes (these will be set as task text!)
251                 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
252                 break;
253
254         case "0.4.2": // SQL queries for v0.4.2
255                 // Update notes (these will be set as task text!)
256                 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
257                 break;
258
259         case "0.4.3": // SQL queries for v0.4.3
260                 // Update notes (these will be set as task text!)
261                 $UPDATE_NOTES = "Neue Urlaubsschaltung mit integriert.";
262                 break;
263
264         case "0.4.4": // SQL queries for v0.4.4
265                 // Update notes (these will be set as task text!)
266                 $UPDATE_NOTES = "Ein <STRONG>WHERE ext_active='Y'</STRONG> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.";
267                 break;
268
269         case "0.4.5": // SQL queries for v0.4.5
270                 // Update notes (these will be set as task text!)
271                 $UPDATE_NOTES = "De-/Aktivieren des mit dieser Erweiterung verkn&uuml;pften Modules eingebunden.";
272                 break;
273
274         case "0.4.6": // SQL queries for v0.4.6
275                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', NULL, 'Mailbuchungen', 3, 'Y', 'N')";
276                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', 'order2', 'Framekiller-Mails', 2, 'Y', 'N')";
277                 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='order', sort='1', title='Klick-Mails' WHERE what='order' LIMIT 1";
278
279                 // Update notes (these will be set as task text!)
280                 $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
281                 break;
282
283         case "0.4.7": // SQL queries for v0.4.7
284                 // Update notes (these will be set as task text!)
285                 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
286                 break;
287
288         case "0.4.8": // SQL queries for v0.4.8
289                 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='Mailbuchung' WHERE action='setup' AND what='config_order' LIMIT 1";
290
291                 // Update notes (these will be set as task text!)
292                 $UPDATE_NOTES = "Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.";
293                 break;
294
295         case "0.4.9": // SQL queries for v0.4.9
296                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD repay_deleted_mails ENUM('REPAY', 'JACKPOT', 'SHRED') NOT NULL DEFAULT 'REPAY'";
297
298                 // Update notes (these will be set as task text!)
299                 $UPDATE_NOTES = "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.";
300                 break;
301
302         }
303         break;
304
305 default: // Do stuff when extension is loaded
306         $dummy = LOAD_CONFIG();
307         $_CONFIG = merge_array($_CONFIG, $dummy);
308         unset($dummy);
309
310         // Do daily reset only when installed and extension version is at least 0.1.1
311         if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1"))
312         {
313                 // Reset mail order values
314                 $result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
315         }
316         break;
317 }
318 // Language file prefix
319 $EXT_LANG_PREFIX = "order";
320
321 // Extension is always active?
322 $EXT_ALWAYS_ACTIVE = "N";
323
324 //
325 ?>