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