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