Mailer used in many places, we still need a good 'selling' title
[mailer.git] / inc / extensions / ext-register.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 04/29/2004 *
4  * ================                             Last change: 11/23/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-register.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : Swapped out registration system for new members  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ausgelagertes Anmeldesystem fuer Mitglieder      *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 } // END - if
43
44 // Version number
45 setThisExtensionVersion('0.5.4');
46
47 // Version history array (add more with , '0.1.0' and so on)
48 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', '0.5.3', '0.5.4'));
49
50 switch (getExtensionMode()) {
51         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52                 // SQL commands to run
53                 addExtensionSql('');
54                 break;
55
56         case 'remove': // Do stuff when removing extension
57                 // SQL commands to run
58                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_register'");
59                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`");
60
61                 // Unregister a filter
62                 unregisterFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', false, true, getExtensionDryRun());
63                 break;
64
65         case 'activate': // Do stuff when admin activates this extension
66                 // SQL commands to run
67                 addExtensionSql('');
68                 break;
69
70         case 'deactivate': // Do stuff when admin deactivates this extension
71                 // SQL commands to run
72                 addExtensionSql('');
73                 break;
74
75         case 'update': // Update an extension
76                 switch (getCurrentExtensionVersion())
77                 {
78                         case '0.1.0': // SQL queries for v0.1
79                                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`");
80                                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_must_register` (
81 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
82 field_name VARCHAR(255) NOT NULL DEFAULT '',
83 field_required ENUM('Y','N') NOT NULL DEFAULT 'Y',
84 PRIMARY KEY (id)
85 ) TYPE={?_TABLE_TYPE?}");
86
87                                 // Add all entries as required (DO NOT DELETE THEM FROM DATABASE!)
88                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('surname','Y')");
89                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('family','Y')");
90                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('street_nr','Y')");
91                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('cntry','Y')");
92                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('zip','Y')");
93                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('city','Y')");
94
95                                 // Add admin menu
96                                 addAdminMenuSql('setup','config_register','Pflichtfelder','Stellen Sie hier die Pflichtfelder sowohl im Anmeldeformular, als auch im Mitgliedsbereich unter <strong>Profildaten &auml;ndern</strong> ein.', 12);
97
98                                 // Update notes (these will be set as task text!)
99                                 setExtensionUpdateNotes("Einstellbare Pflichtfelder hinzugef&uuml;gt.");
100                                 break;
101
102                         case '0.1.1': // SQL queries for v0.1.1
103                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET ext_has_css='Y' WHERE `ext_name`='register' AND ext_has_css='N' LIMIT 1");
104
105                                 // This update depends on sql_patches update!
106                                 addExtensionUpdateDependency('sql_patches');
107
108                                 // Update notes (these will be set as task text!)
109                                 setExtensionUpdateNotes("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.");
110                                 break;
111
112                         case '0.1.3': // SQL queries for v0.1.3
113                                 // This update depends on sql_patches update!
114                                 addExtensionUpdateDependency('sql_patches');
115
116                                 // Update notes (these will be set as task text!)
117                                 setExtensionUpdateNotes("Standart Referal-Id kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)");
118                                 break;
119
120                         case '0.1.4': // SQL queries for v0.1.4
121                                 // Update notes (these will be set as task text!)
122                                 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei ge&auml;ndert.");
123                                 break;
124
125                         case '0.1.5': // SQL queries for v0.1.5
126                                 // Update notes (these will be set as task text!)
127                                 setExtensionUpdateNotes("Konfiguration der Pflichtangaben ausgelagert in Template");
128                                 break;
129
130                         case '0.1.6': // SQL queries for v0.1.6
131                                 // Update notes (these will be set as task text!)
132                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
133                                 break;
134
135                         case '0.1.7': // SQL queries for v0.1.7
136                                 // Update notes (these will be set as task text!)
137                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
138                                 break;
139
140                         case '0.1.8': // SQL queries for v0.1.8
141                                 // Update notes (these will be set as task text!)
142                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
143                                 break;
144
145                         case '0.1.9': // SQL queries for v0.1.9
146                                 // Update notes (these will be set as task text!)
147                                 setExtensionUpdateNotes("Pflichtfelder wieder eingebaut (waren irgentwie ausgebaut???)");
148                                 break;
149
150                         case '0.2.0': // SQL queries for v0.2.0
151                                 // Update notes (these will be set as task text!)
152                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
153                                 break;
154
155                         case '0.2.1': // SQL queries for v0.2.1
156                                 // Update notes (these will be set as task text!)
157                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
158                                 break;
159
160                         case '0.2.2': // SQL queries for v0.2.2
161                                 // Update notes (these will be set as task text!)
162                                 setExtensionUpdateNotes("S&auml;mtliche Sperren bei eingeloggten Admin deaktiviert.");
163                                 break;
164
165                         case '0.2.3': // SQL queries for v0.2.3
166                                 // Update notes (these will be set as task text!)
167                                 setExtensionUpdateNotes("Cookie <u>refid</u> aus Anmeldeformular entfernt.");
168                                 break;
169
170                         case '0.2.4': // SQL queries for v0.2.4
171                                 // Update notes (these will be set as task text!)
172                                 setExtensionUpdateNotes("Design &quot;Solid-Business&quot; eingebaut.");
173                                 break;
174
175                         case '0.2.5': // SQL queries for v0.2.5
176                                 // Update notes (these will be set as task text!)
177                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
178                                 break;
179
180                         case '0.2.6': // SQL queries for v0.2.6
181                                 // Update notes (these will be set as task text!)
182                                 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
183                                 break;
184
185                         case '0.2.7': // SQL queries for v0.2.7
186                                 // Update notes (these will be set as task text!)
187                                 setExtensionUpdateNotes("Referal-Id wird endlich korrekt gesetzt.");
188                                 break;
189
190                         case '0.2.8': // SQL queries for v0.2.8
191                                 // Update notes (these will be set as task text!)
192                                 setExtensionUpdateNotes("Parse error in <u>what-register.php</u> beseitigt.");
193                                 break;
194
195                         case '0.2.9': // SQL queries for v0.2.9
196                                 // Update notes (these will be set as task text!)
197                                 setExtensionUpdateNotes("Anrede &quot;Firma&quot; hinzugef&uuml;gt.");
198                                 break;
199
200                         case '0.3.0': // SQL queries for v0.3.0
201                                 // Update notes (these will be set as task text!)
202                                 setExtensionUpdateNotes("W&ouml;rter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
203                                 break;
204
205                         case '0.3.1': // SQL queries for v0.3.1
206                                 // Update notes (these will be set as task text!)
207                                 setExtensionUpdateNotes("Email-Adresse wird vor dem Speichern auf G&uml;tigkeit hin getestet.");
208                                 break;
209
210                         case '0.3.2': // SQL queries for v0.3.2
211                                 // Update notes (these will be set as task text!)
212                                 setExtensionUpdateNotes("Einbindung der Erweiterung <strong>country</strong>, die Sie sich noch optional von <a href=\"{?URL?}/modules.php?module=admin&amp;what=extensions&amp;do=search\">meiner Seite herunterladen</a> m&uuml;ssen.<br />
213 <br />
214 <strong>Wichtig: Laden Sie noch das Template <strong>guest_register.tpl</strong> mit hoch, welches unter templates/".getLanguage()."/html/guest/ zu finden ist!</strong>");
215
216                                 // Depends on 'country'
217                                 addExtensionUpdateDependency('country');
218                                 break;
219
220                         case '0.3.3': // SQL queries for v0.3.3
221                                 // Update notes (these will be set as task text!)
222                                 setExtensionUpdateNotes("Es werden dem Mitglied nur aktivierte L&auml;ndercodes zur Auswahl angeboten.");
223                                 break;
224
225                         case '0.3.4': // SQL queries for v0.3.4
226                                 // Update notes (these will be set as task text!)
227                                 setExtensionUpdateNotes("Auf Grund der Integration der neue Erweiterung <strong>country</strong> in die Anmeldephase klappte die Anmeldung nicht. Die dazu n&uuml;tige Verkn&uuml;pfung ist nun eingebaut und die Anmeldung klappt wieder. Vielen Dank nochmals an den Bug-Reporter (Fehlermelder)!");
228                                 break;
229
230                         case '0.3.5': // SQL queries for v0.3.5
231                                 // Update notes (these will be set as task text!)
232                                 setExtensionUpdateNotes("Design wird nach Anmeldung auch endlich im Mitgliedsmen&uuml; &uuml;bernommen.");
233                                 break;
234
235                         case '0.3.6': // SQL queries for v0.3.6
236                                 // Update notes (these will be set as task text!)
237                                 setExtensionUpdateNotes("Fehlermeldung <strong>Fatal error: Call to undefined function: get_theme() in /../../guest/what-register.php on line 190</strong> beseitigt.");
238                                 break;
239
240                         case '0.3.7': // SQL queries for v0.3.7
241                                 // Update notes (these will be set as task text!)
242                                 setExtensionUpdateNotes("Fehlermeldung <strong>Fatal error: Call to undefined function: get_curr_theme<u>e</u>() in /../../guest/what-register.php on line 190</strong> beseitigt.");
243                                 break;
244
245                         case '0.3.8': // SQL queries for v0.3.8
246                                 // Update notes (these will be set as task text!)
247                                 setExtensionUpdateNotes("Weitere SQL-Befehle abgesichert.");
248                                 break;
249
250                         case '0.3.9': // SQL queries for v0.3.9
251                                 // Update notes (these will be set as task text!)
252                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
253                                 break;
254
255                         case '0.4.0': // SQL queries for v0.4.0
256                                 // Update notes (these will be set as task text!)
257                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
258                                 break;
259
260                         case '0.4.1': // SQL queries for v0.4.1
261                                 // Update notes (these will be set as task text!)
262                                 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
263                                 break;
264
265                         case '0.4.2': // SQL queries for v0.4.2
266                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD register_default ENUM('Y','N') NOT NULL DEFAULT 'N'");
267
268                                 // Update notes (these will be set as task text!)
269                                 setExtensionUpdateNotes("Bei der Anmeldung kann die Standart-Auswahl zwischen Ja/Nein umgeschaltet werden. Das &Auml;ndern des Templates <strong>templates/".getLanguage()."/html/guest/guest_register.tpl</strong> ist nicht mehr n&ouml;tig.");
270                                 break;
271
272                         case '0.4.3': // SQL queries for v0.4.3
273                                 // Update notes (these will be set as task text!)
274                                 setExtensionUpdateNotes("Parser-Error in <strong>inc/modules/guest/what-register.php</strong> beseitigt.");
275                                 break;
276
277                         case '0.4.4': // SQL queries for v0.4.4
278                                 // Update notes (these will be set as task text!)
279                                 setExtensionUpdateNotes("Anmeldefehler (EMail-Adresse war immer ein Ausrufezeichen) beseitigt.");
280                                 break;
281
282                         case '0.4.5': // SQL queries for v0.4.5
283                                 // Update notes (these will be set as task text!)
284                                 setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
285                                 break;
286
287                         case '0.4.6': // SQL queries for v0.4.6
288                                 // Update notes (these will be set as task text!)
289                                 setExtensionUpdateNotes("Einstellung nach {?POINTS?}-Einstellungen verlagert.");
290                                 break;
291
292                         case '0.4.7': // SQL queries for v0.4.7
293                                 // Update notes (these will be set as task text!)
294                                 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
295                                 break;
296
297                         case '0.4.8': // SQL queries for v0.4.8
298                                 // Update notes (these will be set as task text!)
299                                 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
300                                 break;
301
302                         case '0.4.9': // SQL queries for v0.4.9
303                                 // Update notes (these will be set as task text!)
304                                 setExtensionUpdateNotes("Problem mit nicht anzeigbaren Kategorien in der Anmeldung beseitigt.");
305                                 break;
306
307                         case '0.5.0': // SQL queries for v0.5.0
308                                 // Update notes (these will be set as task text!)
309                                 setExtensionUpdateNotes("Fehlermeldung <em><strong>Fatal error:</strong> Call to undefined function registerGenerateCategoryTable() in <strong>{?PATH?}/inc/modules/guest/what-register.php</strong> on line <strong>434</strong></em> beseitigt.");
310                                 break;
311
312                         case '0.5.1': // SQL queries for v0.5.1
313                                 // Update notes (these will be set as task text!)
314                                 setExtensionUpdateNotes("Mail-Template <strong>register-member.tpl</strong> gefixt. Danke an <a href=\"http://forum.mxchange.org/profile-59.html\" target=\"_blank\" title=\"Mitgliedsprofil aufrufen\">wliepe</a> f&uuml;r die Fehlerfindung!");
315                                 break;
316
317                         case '0.5.2': // SQL queries for v0.5.2
318                                 // Update notes (these will be set as task text!)
319                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
320                                 break;
321
322                         case '0.5.3': // SQL queries for v0.5.3
323                                 // Register a filter
324                                 registerFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', false, true, getExtensionDryRun());
325
326                                 // Run these SQLs
327                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('gender','Y')");
328                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('email','Y')");
329                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('birthday','Y')");
330                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('marker','Y')");
331
332                                 // Update notes (these will be set as task text!)
333                                 setExtensionUpdateNotes("Filter <strong>register_must_fillout</strong> hinzugef&uuml;gt, weitere Felder in <em>{?_MYSQL_PREFIX?}_must_register</em> eingef&uuml;gt.");
334                                 break;
335
336                         case '0.5.4': // SQL queries for v0.5.4
337                                 addAdminMenuSql('setup','config_register2','Anmeldeformular','Stellen Sie ein, wie viel Kategorien der Gast bei der Anmeldung mindestens einstellen muss. Diese Einstellung gilt nachher auch im Mitgliedsbereich!',8);
338
339                                 // Update notes (these will be set as task text!)
340                                 setExtensionUpdateNotes("Weiteren Men&uuml;punkt aus <strong>menu-{?DEFAULT_LANG?} heraus geholt.");
341                                 break;
342
343                 } // END - switch
344                 break;
345
346         case 'modify': // When the extension got modified
347                 break;
348
349         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
350                 break;
351
352         case 'init': // Do stuff when extension is initialized
353                 break;
354
355         default: // Unknown extension mode
356                 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
357                 break;
358 } // END - switch
359
360 // [EOF]
361 ?>