Fixes and cleanups
[mailer.git] / inc / extensions / ext-nickname.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 06/17/2004 *
4  * ===================                          Last change: 06/17/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-nickname.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : Nickname login and display in register form      *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Nickname-Login und Anzeige im Anmeldeformular    *
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://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.2.1');
45
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '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'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running
51                 // SQL commands to run
52                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nickname` VARCHAR(255) NOT NULL DEFAULT ''");
53                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nick_userid` ENUM ('nick','userid') NOT NULL DEFAULT 'userid'");
54
55                 // Add member menu
56                 addMemberMenuSql('extras', 'nickname', 'Nicknamen', 2);
57                 break;
58
59         case 'remove': // Do stuff when removing extension
60                 // SQL commands to run
61                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname' LIMIT 1");
62                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname') LIMIT 2");
63                 break;
64
65         case 'activate': // Do stuff when admin activates this extension
66                 // SQL commands to run
67                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='nickname' LIMIT 1");
68                 break;
69
70         case 'deactivate': // Do stuff when admin deactivates this extension
71                 // SQL commands to run
72                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='nickname' LIMIT 1");
73                 break;
74
75         case 'update': // Update an extension
76                 switch (getCurrentExtensionVersion()) {
77                         case '0.0.1': // SQL queries for v0.0.1
78                                 // This update depends on ext-sql_patches update!
79                                 addExtensionDependency('sql_patches');
80
81                                 // Update notes (these will be set as task text!)
82                                 setExtensionUpdateNotes("Veraltetes Update entfernt.");
83                                 break;
84
85                         case '0.0.3': // SQL queries for v0.0.3
86                                 // Update notes (these will be set as task text!)
87                                 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
88                                 break;
89
90                         case '0.0.4': // SQL queries for v0.0.4
91                                 // Update notes (these will be set as task text!)
92                                 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei ge&auml;ndert.");
93                                 break;
94
95                         case '0.0.5': // SQL queries for v0.0.5
96                                 // Update notes (these will be set as task text!)
97                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
98                                 break;
99
100                         case '0.0.6': // SQL queries for v0.0.6
101                                 addConfigAddSql('nickname_len', 'TINYINT(3) UNSIGNED NOT NULL DEFAULT 5');
102                                 addConfigAddSql('nickname_pattern', "VARCHAR(255) NOT NULL DEFAULT 'a-zA-Z0-9_'");
103                                 addConfigAddSql('nickname_chars', "VARCHAR(255) NOT NULL DEFAULT 'a-z, A-Z, 0-9, _'");
104                                 addAdminMenuSql('setup', 'config_nickname', 'Nicknamen', 'Stellen Sie minimale Nicknamenl&auml;nge, sowie erlaubte Zeichen hier ein.', 12);
105
106                                 // Update notes (these will be set as task text!)
107                                 setExtensionUpdateNotes("Minimale L&auml;nge, sowie erlaubte Zeichen sind per Adminbereich &auml;nderbar. Setzen Sie als erlaubte Zeichen nur URL-konforme Zeichen ein!");
108                                 break;
109
110                         case '0.0.7': // SQL queries for v0.0.7
111                                 // Update notes (these will be set as task text!)
112                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
113                                 break;
114
115                         case '0.0.8': // SQL queries for v0.0.8
116                                 // Update notes (these will be set as task text!)
117                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
118                                 break;
119
120                         case '0.0.9': // SQL queries for v0.0.9
121                                 // Update notes (these will be set as task text!)
122                                 setExtensionUpdateNotes("Design &quot;Solid-Business&quot; eingebaut.");
123                                 break;
124
125                         case '0.1.0': // SQL queries for v0.2.1
126                                 // Update notes (these will be set as task text!)
127                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
128                                 break;
129
130                         case '0.1.1': // SQL queries for v0.1.1
131                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `nick_userid`');
132
133                                 // Update notes (these will be set as task text!)
134                                 setExtensionUpdateNotes("Auswahlf&uuml;r Mitglied ob mit Nickname oder Mitglied-Id einloggen entfernt.");
135                                 break;
136
137                         case '0.1.2': // SQL queries for v0.1.2
138                                 // Update notes (these will be set as task text!)
139                                 setExtensionUpdateNotes("Zum Zusenden eines neuen Passwortes kann jetzt entweder der Nickname / Mitglied-Id <u>ODER</u> die angemeldete EMail-Adresse eingegeben werden.");
140                                 break;
141
142                         case '0.1.3': // SQL queries for v0.1.3
143                                 // Update notes (these will be set as task text!)
144                                 setExtensionUpdateNotes("CSS-Datei in general.css verschmolzen (Patch 435!)");
145                                 break;
146
147                         case '0.1.4': // SQL queries for v0.1.4
148                                 // Update notes (these will be set as task text!)
149                                 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
150                                 break;
151
152                         case '0.1.5': // SQL queries for v0.1.5
153                                 // Update notes (these will be set as task text!)
154                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
155                                 break;
156
157                         case '0.1.6': // SQL queries for v0.1.6
158                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='extras',`sort`=2 WHERE `what`='nickname' LIMIT 1");
159
160                                 // Update notes (these will be set as task text!)
161                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
162                                 break;
163
164                         case '0.1.7': // SQL queries for v0.1.7
165                                 // Update notes (these will be set as task text!)
166                                 setExtensionUpdateNotes("Mitglieder ohne Nickname sollten kein <strong>*failed*</strong> mehr sehen.");
167                                 break;
168
169                         case '0.1.8': // SQL queries for v0.1.8
170                                 // Update notes (these will be set as task text!)
171                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
172                                 break;
173
174                         case '0.1.9': // SQL queries for v0.1.9
175                                 addAdminMenuSql('user', 'list_nickname', 'Nickname-Historie', 'Listet alle verwendeten Nicknames der Mitglieder auf.', 12);
176
177                                 // Update notes (these will be set as task text!)
178                                 setExtensionUpdateNotes("Menu&uuml;punkt f&uuml;r Nickname-History hinzugef&uuml;gt.");
179                                 break;
180
181                         case '0.2.0': // SQL queries for v0.2.0
182                                 // Update notes (these will be set as task text!)
183                                 setExtensionUpdateNotes("Ung&uuml;tiges Update (wegen Verallgemeinerung der <strong>nickname_history</strong>-Tabelle.");
184                                 break;
185
186                         case '0.2.1': // SQL queries for v0.2.1
187                                 // Remove this deprecated table
188                                 addDropTableSql('nickname_history');
189
190                                 // This update depends on ext-sql_patches update!
191                                 addExtensionDependency('sql_patches');
192
193                                 // Update notes (these will be set as task text!)
194                                 setExtensionUpdateNotes("Diese Tabelle kann in <strong>ext-sql_patches</strong> allgemeiner formuliert werden.");
195                                 break;
196                 } // END - switch
197                 break;
198
199         case 'modify': // When the extension got modified
200                 break;
201
202         case 'test': // For testing purposes
203                 break;
204
205         case 'init': // Do stuff when extension is initialized
206                 break;
207
208         default: // Unknown extension mode
209                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
210                 break;
211 } // END - switch
212
213 // [EOF]
214 ?>