LAS (logical area system) table renamed, table comments added:
[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  * -------------------------------------------------------------------- *
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.5');
45
46 // Version history array (add more with , '0.1.0' and so on)
47 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', '0.5.5'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
51                 // SQL commands to run
52                 addGuestMenuSql('register', 'members', 'Anmeldung', 'Y', 'N', 2);
53                 break;
54
55         case 'remove': // Do stuff when removing extension
56                 // SQL commands to run
57                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_register' LIMIT 1");
58                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='register' LIMIT 1");
59                 addDropTableSql('must_register');
60
61                 // Unregister a filter
62                 unregisterFilter(__FUNCTION__, __LINE__, 'register_must_fillout', 'REGISTER_MUST_FILLOUT', true, isExtensionDryRun());
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                         case '0.1.0': // SQL queries for v0.1
78                                 addDropTableSql('must_register');
79                                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_must_register` (
80 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
81 `field_name` VARCHAR(255) NOT NULL DEFAULT '',
82 `field_required` ENUM('Y','N') NOT NULL DEFAULT 'Y',
83 PRIMARY KEY (`id`)
84 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Data which fields the user must fill out'");
85
86                                 // Add all entries as required (DO NOT DELETE THEM FROM DATABASE!)
87                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('surname','Y')");
88                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('family','Y')");
89                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('street_nr','Y')");
90                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('cntry','Y')");
91                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('zip','Y')");
92                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('city','Y')");
93
94                                 // Add admin menu
95                                 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);
96
97                                 // Update notes (these will be set as task text!)
98                                 setExtensionUpdateNotes("Einstellbare Pflichtfelder hinzugef&uuml;gt.");
99                                 break;
100
101                         case '0.1.1': // SQL queries for v0.1.1
102                                 // This update depends on sql_patches update!
103                                 addExtensionDependency('sql_patches');
104
105                                 // Update notes (these will be set as task text!)
106                                 setExtensionUpdateNotes("Veraltetes Update entfernt.");
107                                 break;
108
109                         case '0.1.3': // SQL queries for v0.1.3
110                                 // This update depends on sql_patches update!
111                                 addExtensionDependency('sql_patches');
112
113                                 // Update notes (these will be set as task text!)
114                                 setExtensionUpdateNotes("Standard Referal-Id kann per Admin-Bereich eingestellt werden (war vorher nur in modules.php und index.php direkt eingebbar.)");
115                                 break;
116
117                         case '0.1.4': // SQL queries for v0.1.4
118                                 // Update notes (these will be set as task text!)
119                                 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei ge&auml;ndert.");
120                                 break;
121
122                         case '0.1.5': // SQL queries for v0.1.5
123                                 // Update notes (these will be set as task text!)
124                                 setExtensionUpdateNotes("Konfiguration der Pflichtangaben ausgelagert in Template");
125                                 break;
126
127                         case '0.1.6': // SQL queries for v0.1.6
128                                 // Update notes (these will be set as task text!)
129                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
130                                 break;
131
132                         case '0.1.7': // SQL queries for v0.1.7
133                                 // Update notes (these will be set as task text!)
134                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
135                                 break;
136
137                         case '0.1.8': // SQL queries for v0.1.8
138                                 // Update notes (these will be set as task text!)
139                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
140                                 break;
141
142                         case '0.1.9': // SQL queries for v0.1.9
143                                 // Update notes (these will be set as task text!)
144                                 setExtensionUpdateNotes("Pflichtfelder wieder eingebaut (waren irgentwie ausgebaut???)");
145                                 break;
146
147                         case '0.2.0': // SQL queries for v0.2.0
148                                 // Update notes (these will be set as task text!)
149                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
150                                 break;
151
152                         case '0.2.1': // SQL queries for v0.2.1
153                                 // Update notes (these will be set as task text!)
154                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
155                                 break;
156
157                         case '0.2.2': // SQL queries for v0.2.2
158                                 // Update notes (these will be set as task text!)
159                                 setExtensionUpdateNotes("S&auml;mtliche Sperren bei eingeloggten Admin deaktiviert.");
160                                 break;
161
162                         case '0.2.3': // SQL queries for v0.2.3
163                                 // Update notes (these will be set as task text!)
164                                 setExtensionUpdateNotes("Cookie <u>refid</u> aus Anmeldeformular entfernt.");
165                                 break;
166
167                         case '0.2.4': // SQL queries for v0.2.4
168                                 // Update notes (these will be set as task text!)
169                                 setExtensionUpdateNotes("Design &quot;Solid-Business&quot; eingebaut.");
170                                 break;
171
172                         case '0.2.5': // SQL queries for v0.2.5
173                                 // Update notes (these will be set as task text!)
174                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
175                                 break;
176
177                         case '0.2.6': // SQL queries for v0.2.6
178                                 // Update notes (these will be set as task text!)
179                                 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
180                                 break;
181
182                         case '0.2.7': // SQL queries for v0.2.7
183                                 // Update notes (these will be set as task text!)
184                                 setExtensionUpdateNotes("Referal-Id wird endlich korrekt gesetzt.");
185                                 break;
186
187                         case '0.2.8': // SQL queries for v0.2.8
188                                 // Update notes (these will be set as task text!)
189                                 setExtensionUpdateNotes("Parse error in <u>what-register.php</u> beseitigt.");
190                                 break;
191
192                         case '0.2.9': // SQL queries for v0.2.9
193                                 // Update notes (these will be set as task text!)
194                                 setExtensionUpdateNotes("Anrede &quot;Firma&quot; hinzugef&uuml;gt.");
195                                 break;
196
197                         case '0.3.0': // SQL queries for v0.3.0
198                                 // Update notes (these will be set as task text!)
199                                 setExtensionUpdateNotes("W&ouml;rter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
200                                 break;
201
202                         case '0.3.1': // SQL queries for v0.3.1
203                                 // Update notes (these will be set as task text!)
204                                 setExtensionUpdateNotes("Email-Adresse wird vor dem Speichern auf G&uml;tigkeit hin getestet.");
205                                 break;
206
207                         case '0.3.2': // SQL queries for v0.3.2
208                                 // Update notes (these will be set as task text!)
209                                 setExtensionUpdateNotes("Einbindung der Erweiterung <strong>country</strong>, die Sie sich noch optional von <strike>meiner Seite herunterladen</strike> m&uuml;ssen.<br />
210 <br />
211 <strong>Wichtig: Laden Sie noch das Template <strong>guest_register.tpl</strong> mit hoch, welches unter templates/".getLanguage()."/html/guest/ zu finden ist!</strong>");
212
213                                 // Depends on 'country'
214                                 addExtensionDependency('country');
215                                 break;
216
217                         case '0.3.3': // SQL queries for v0.3.3
218                                 // Update notes (these will be set as task text!)
219                                 setExtensionUpdateNotes("Es werden dem Mitglied nur aktivierte L&auml;ndercodes zur Auswahl angeboten.");
220                                 break;
221
222                         case '0.3.4': // SQL queries for v0.3.4
223                                 // Update notes (these will be set as task text!)
224                                 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)!");
225                                 break;
226
227                         case '0.3.5': // SQL queries for v0.3.5
228                                 // Update notes (these will be set as task text!)
229                                 setExtensionUpdateNotes("Design wird nach Anmeldung auch endlich im Mitgliedsmen&uuml; &uuml;bernommen.");
230                                 break;
231
232                         case '0.3.6': // SQL queries for v0.3.6
233                                 // Update notes (these will be set as task text!)
234                                 setExtensionUpdateNotes("Fehlermeldung <strong>Fatal error: Call to undefined function: get_theme() in /../../guest/what-register.php on line 190</strong> beseitigt.");
235                                 break;
236
237                         case '0.3.7': // SQL queries for v0.3.7
238                                 // Update notes (these will be set as task text!)
239                                 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.");
240                                 break;
241
242                         case '0.3.8': // SQL queries for v0.3.8
243                                 // Update notes (these will be set as task text!)
244                                 setExtensionUpdateNotes("Weitere SQL-Befehle abgesichert.");
245                                 break;
246
247                         case '0.3.9': // SQL queries for v0.3.9
248                                 // Update notes (these will be set as task text!)
249                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
250                                 break;
251
252                         case '0.4.0': // SQL queries for v0.4.0
253                                 // Update notes (these will be set as task text!)
254                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
255                                 break;
256
257                         case '0.4.1': // SQL queries for v0.4.1
258                                 // Update notes (these will be set as task text!)
259                                 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
260                                 break;
261
262                         case '0.4.2': // SQL queries for v0.4.2
263                                 addConfigAddSql('register_default', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
264
265                                 // Update notes (these will be set as task text!)
266                                 setExtensionUpdateNotes("Bei der Anmeldung kann die Standard-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.");
267                                 break;
268
269                         case '0.4.3': // SQL queries for v0.4.3
270                                 // Update notes (these will be set as task text!)
271                                 setExtensionUpdateNotes("Parser-Error in <strong>inc/modules/guest/what-register.php</strong> beseitigt.");
272                                 break;
273
274                         case '0.4.4': // SQL queries for v0.4.4
275                                 // Update notes (these will be set as task text!)
276                                 setExtensionUpdateNotes("Anmeldefehler (EMail-Adresse war immer ein Ausrufezeichen) beseitigt.");
277                                 break;
278
279                         case '0.4.5': // SQL queries for v0.4.5
280                                 // Update notes (these will be set as task text!)
281                                 setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
282                                 break;
283
284                         case '0.4.6': // SQL queries for v0.4.6
285                                 // Update notes (these will be set as task text!)
286                                 setExtensionUpdateNotes("Einstellung nach {?POINTS?}-Einstellungen verlagert.");
287                                 break;
288
289                         case '0.4.7': // SQL queries for v0.4.7
290                                 // Update notes (these will be set as task text!)
291                                 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
292                                 break;
293
294                         case '0.4.8': // SQL queries for v0.4.8
295                                 // Update notes (these will be set as task text!)
296                                 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
297                                 break;
298
299                         case '0.4.9': // SQL queries for v0.4.9
300                                 // Update notes (these will be set as task text!)
301                                 setExtensionUpdateNotes("Problem mit nicht anzeigbaren Kategorien in der Anmeldung beseitigt.");
302                                 break;
303
304                         case '0.5.0': // SQL queries for v0.5.0
305                                 // Update notes (these will be set as task text!)
306                                 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.");
307                                 break;
308
309                         case '0.5.1': // SQL queries for v0.5.1
310                                 // Update notes (these will be set as task text!)
311                                 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!");
312                                 break;
313
314                         case '0.5.2': // SQL queries for v0.5.2
315                                 // Update notes (these will be set as task text!)
316                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
317                                 break;
318
319                         case '0.5.3': // SQL queries for v0.5.3
320                                 // Register a filter
321                                 registerFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', false, true, isExtensionDryRun());
322
323                                 // Run these SQLs
324                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('gender','Y')");
325                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('email','Y')");
326                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('birthday','Y')");
327                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_must_register` (`field_name`, `field_required`) VALUES ('marker','Y')");
328
329                                 // Update notes (these will be set as task text!)
330                                 setExtensionUpdateNotes("Filter <strong>register_must_fillout</strong> hinzugef&uuml;gt, weitere Felder in <em>{?_MYSQL_PREFIX?}_must_register</em> eingef&uuml;gt.");
331                                 break;
332
333                         case '0.5.4': // SQL queries for v0.5.4
334                                 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);
335
336                                 // Update notes (these will be set as task text!)
337                                 setExtensionUpdateNotes("Weiteren Men&uuml;punkt aus <strong>menu-{?DEFAULT_LANG?} heraus geholt.");
338                                 break;
339
340                         case '0.5.5': // SQL queries for v0.5.5
341                                 addConfigAddSql('register_generate_password_empty', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
342
343                                 // Update notes (these will be set as task text!)
344                                 setExtensionUpdateNotes("Weiteren Men&uuml;punkt aus <strong>menu-{?DEFAULT_LANG?} heraus geholt.");
345                                 break;
346                 } // END - switch
347                 break;
348
349         case 'modify': // When the extension got modified
350                 break;
351
352         case 'test': // For testing purposes
353                 break;
354
355         case 'init': // Do stuff when extension is initialized
356                 break;
357
358         default: // Unknown extension mode
359                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
360                 break;
361 } // END - switch
362
363 // [EOF]
364 ?>