85fc69ec9e06e0c4ccf52a822eac7bbbf70e4cbc
[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 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 // Version number
42 $EXT_VERSION = "0.4.7";
43
44 // Auto-set extension version
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
46
47 // Version history array (add more with , "0.1" and so on)
48 $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");
49
50 switch ($EXT_LOAD_MODE)
51 {
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
53         // SQL commands to run
54         $SQLs[] = "";
55         break;
56
57 case "remove": // Do stuff when removing extension
58         // SQL commands to run
59         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP order_max_full";
60         $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
61         break;
62
63 case "activate": // Do stuff when admin activates this extension
64         // SQL commands to run
65         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='order' LIMIT 1";
66         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='order' LIMIT 1";
67         break;
68
69 case "deactivate": // Do stuff when admin deactivates this extension
70         // SQL commands to run
71         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
72         $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='order' LIMIT 1";
73         break;
74
75 case "update": // Update an extension
76         switch ($EXT_VER)
77         {
78         case "0.1": // SQL queries for v0.1
79                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_max_full enum('ORDER', 'MAX') not null default 'MAX'";
80                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
81
82                 // Update notes (these will be set as task text!)
83                 $UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abh&auml;gig.";
84                 break;
85
86         case "0.1.1": // SQL queries for v0.1.1
87                 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
88                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
89                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD mail_orders bigint(20) not null default '0'";
90
91                 // Update notes (these will be set as task text!)
92                 $UPDATE_NOTES = "Maximale Mailbuchung vervollst&auml;ndigt (Admin-Bereich und im Buchungsformular selber).";
93                 break;
94
95         case "0.1.3": // SQL queries for v0.1.3
96                 // Update notes (these will be set as task text!)
97                 $UPDATE_NOTES = "Maximale Mailbuchungen repariert (werden nun hochgez&auml;hlt und bei t&auml;glichem Reset auf 0 gesetzt).";
98                 break;
99
100         case "0.1.4": // SQL queries for v0.1.4
101                 // Update notes (these will be set as task text!)
102                 $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>.";
103                 break;
104
105         case "0.1.5": // SQL queries for v0.1.5
106                 // Update notes (these will be set as task text!)
107                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
108                 break;
109
110         case "0.1.6": // SQL queries for v0.1.6
111                 // Update notes (these will be set as task text!)
112                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
113                 break;
114
115         case "0.1.7": // SQL queries for v0.1.7
116                 // Update notes (these will be set as task text!)
117                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
118                 break;
119
120         case "0.1.8": // SQL queries for v0.1.8
121                 // Update notes (these will be set as task text!)
122                 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
123                 break;
124
125         case "0.1.9": // SQL queries for v0.1.9
126                 // Update notes (these will be set as task text!)
127                 $UPDATE_NOTES = "Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.";
128                 break;
129
130         case "0.2.0": // SQL queries for v0.2.0
131                 // Update notes (these will be set as task text!)
132                 $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
133                 break;
134
135         case "0.2.1": // SQL queries for v0.2.1
136                 // Update notes (these will be set as task text!)
137                 $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.";
138                 break;
139
140         case "0.2.2": // SQL queries for v0.2.2
141                 // Update notes (these will be set as task text!)
142                 $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.";
143                 break;
144
145         case "0.2.3": // SQL queries for v0.2.3
146                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_min bigint(20) not null default '10'";
147
148                 // Update notes (these will be set as task text!)
149                 $UPDATE_NOTES = "Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger";
150                 break;
151
152         case "0.2.4": // SQL queries for v0.2.4
153                 // Update notes (these will be set as task text!)
154                 $UPDATE_NOTES = "Anzahl mindestens einszustellende Empf&auml;nger wird nun auch angezeigt.";
155                 break;
156
157         case "0.2.5": // SQL queries for v0.2.5
158                 // Update notes (these will be set as task text!)
159                 $UPDATE_NOTES = "Speicherung der Einstellungen klappt.";
160                 break;
161
162         case "0.2.6": // SQL queries for v0.2.6
163                 // Update notes (these will be set as task text!)
164                 $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
165 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:
166 <OL>
167   <LI>Das Mitglied w&auml;hlt eine Kategorie XYZ mit maximal 15 Empf&auml;ngern aus.</LI>
168   <LI>Es stellt die Mailart <U>&quot;3 {!POINTS!} Kosten / Mail&quot;</U> ein.</LI>
169   <LI>Es hat aber nur {!POINTS!} f&uuml;r 10 Empf&auml;nger und gibt 10 ein.</LI>
170   <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
171   auf.</LI>
172   <LI>Hatte es aber, wie hier im Beispiel 31 {!POINTS!}, konnte es nicht mehr buchen.</LI>
173   <LI>Jetzt ist der Fehler endlich weg! Machen Sie dies bitte Ihren Mitgliedern bekannt.</LI>
174 </OL>";
175                 break;
176
177         case "0.2.7": // SQL queries for v0.2.7
178                 // Update notes (these will be set as task text!)
179                 $UPDATE_NOTES = "Fehler mit <U>__MIN_VALUE</U> behoben.";
180                 break;
181
182         case "0.2.8": // SQL queries for v0.2.8
183                 // Update notes (these will be set as task text!)
184                 $UPDATE_NOTES = "Konstantenproblem beseitigt.";
185                 break;
186
187         case "0.2.9": // SQL queries for v0.2.9
188                 // Update notes (these will be set as task text!)
189                 $UPDATE_NOTES = "Problem mit nicht funktionierenden Mailbuchungen beseitigt.";
190                 break;
191
192         case "0.3.0": // SQL queries for v0.3.0
193                 // Update notes (these will be set as task text!)
194                 $UPDATE_NOTES = "Basis-Modul <STRONG>order.php</STRONG> abgesichert, wenn Erweiterung nicht aktiviert ist.";
195                 break;
196
197         case "0.3.1": // SQL queries for v0.3.1
198                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_select varchar(255) not null default 'userid'";
199                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_mode enum('ASC', 'DESC') not null default 'DESC'";
200
201                 // Update notes (these will be set as task text!)
202                 $UPDATE_NOTES = "Beworbene URL wird nun getestet.";
203                 break;
204
205         case "0.3.2": // SQL queries for v0.3.2
206                 // Update notes (these will be set as task text!)
207                 $UPDATE_NOTES = "Datumsformat festgelegt auf ausf&uuml;hrlich.";
208                 break;
209
210         case "0.3.3": // SQL queries for v0.3.3
211                 // Update notes (these will be set as task text!)
212                 $UPDATE_NOTES = "Unter <STRONG>Einstellungen - Mailbuchungsseite</STRONG> war immer die Tabellenspalte <STRONG>Mitgliedsnummer</STRONG> ausgew&auml;hlt.";
213                 break;
214
215         case "0.3.4": // SQL queries for v0.3.4
216                 // Update notes (these will be set as task text!)
217                 $UPDATE_NOTES = "Dateiamenskonflikt zwischen den Erweiterungen <STRONG>support</STRONG> und <STRONG>order</STRONG> behoben.";
218                 break;
219
220         case "0.3.5": // SQL queries for v0.3.5
221                 // Update notes (these will be set as task text!)
222                 $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.";
223                 break;
224
225         case "0.3.6": // SQL queries for v0.3.6
226                 // Update notes (these will be set as task text!)
227                 $UPDATE_NOTES = "Im Modul order (<STRONG>inc/modules/order.php</STRONG>) wurde fehlerhafterweise die Erweiterung <STRONG>beg</STRONG> getestet.";
228                 break;
229
230         case "0.3.7": // SQL queries for v0.3.7
231                 // Update notes (these will be set as task text!)
232                 $UPDATE_NOTES = "SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert.";
233                 break;
234
235         case "0.3.8": // SQL queries for v0.3.8
236                 // Update notes (these will be set as task text!)
237                 $UPDATE_NOTES = "Mailbuchungsseite korregiert.";
238                 break;
239
240         case "0.3.9": // SQL queries for v0.3.9
241                 // Update notes (these will be set as task text!)
242                 $UPDATE_NOTES = "Erneuten Fehler in Mailbuchungsseite behoben.";
243                 break;
244
245         case "0.4.0": // SQL queries for v0.4.0
246                 // Update notes (these will be set as task text!)
247                 $UPDATE_NOTES = POINTS."-Abzug klappt wieder. Danke an Andreman!";
248                 break;
249
250         case "0.4.1": // SQL queries for v0.4.1
251                 // Update notes (these will be set as task text!)
252                 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
253                 break;
254
255         case "0.4.2": // SQL queries for v0.4.2
256                 // Update notes (these will be set as task text!)
257                 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
258                 break;
259
260         case "0.4.3": // SQL queries for v0.4.3
261                 // Update notes (these will be set as task text!)
262                 $UPDATE_NOTES = "Neue Urlaubsschaltung mit integriert.";
263                 break;
264
265         case "0.4.4": // SQL queries for v0.4.4
266                 // Update notes (these will be set as task text!)
267                 $UPDATE_NOTES = "Ein <STRONG>WHERE ext_active='Y'</STRONG> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.";
268                 break;
269
270         case "0.4.5": // SQL queries for v0.4.5
271                 // Update notes (these will be set as task text!)
272                 $UPDATE_NOTES = "De-/Aktivieren des mit dieser Erweiterung verkn&uuml;pften Modules eingebunden.";
273                 break;
274
275         case "0.4.6": // SQL queries for v0.4.6
276                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', '', 'Mailbuchungen', 3, 'Y', 'N')";
277                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', 'order2', 'Framekiller-Mails', 2, 'Y', 'N')";
278                 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='order', sort='1', title='Klick-Mails' WHERE what='order' LIMIT 1";
279
280                 // Update notes (these will be set as task text!)
281                 $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
282                 break;
283
284         case "0.4.7": // SQL queries for v0.4.7
285                 // Update notes (these will be set as task text!)
286                 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
287                 break;
288         }
289         break;
290
291 default: // Do stuff when extension is loaded
292         $DUMMY = LOAD_CONFIG("0");
293         $CONFIG['order_min']    = $DUMMY['order_min'];      // Order at least X mails
294         $CONFIG['order_max']    = $DUMMY['order_max_full']; // Ordering mode: as much as possible or as much as the user want's to receive
295         $CONFIG['order_select'] = $DUMMY['order_select'];   // Sorting mode for selecting users while looking some up for mail delivery
296         $CONFIG['order_mode']   = $DUMMY['order_mode'];     // Ascending or descending sort order for above
297         unset($DUMMY);
298
299         // Do daily reset only when installed and extension version is at least 0.1.1
300         if ((defined('__DAILY_RESET')) && (!mxchange_installing) && (mxchange_installed) && (admin_registered) && (GET_EXT_VERSION("order") >= "0.1.1"))
301         {
302                 // Reset mail order values
303                 $result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders='0' WHERE mail_orders > 0", __FILE__, __LINE__);
304         }
305         break;
306 }
307 // Language file prefix
308 $EXT_LANG_PREFIX = "order";
309
310 // Extension is always active?
311 $EXT_ALWAYS_ACTIVE = 'N';
312
313 //
314 ?>