b7ac3ca38d69297ffdbc73a217f73ebb184ef926
[mailer.git] / inc / extensions / ext-nickname.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    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  * 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 }
43
44 // Version number
45 setThisExtensionVersion('0.1.9');
46
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(array('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'));
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("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nickname VARCHAR(255) NOT NULL DEFAULT ''");
54                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nick_userid ENUM ('nick','userid') NOT NULL DEFAULT 'userid'");
55                 addMemberMenuSql('main','nickname','Nicknamen','Y','Y',5);
56                 break;
57
58         case 'remove': // Do stuff when removing extension
59                 // SQL commands to run
60                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname'");
61                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE what IN ('config_nickname','list_nickname')");
62                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`");
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                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET ext_has_css='Y' WHERE `ext_name`='nickname' AND ext_has_css='N' LIMIT 1");
79
80                                 // This update depends on sql_patches update!
81                                 addExtensionUpdateDependency('sql_patches');
82
83                                 // Update notes (these will be set as task text!)
84                                 setExtensionUpdateNotes("CSS-Datei kann per Adminbereich ein- und ausgeschaltet werden.");
85                                 break;
86
87                         case '0.0.3': // SQL queries for v0.0.3
88                                 // Update notes (these will be set as task text!)
89                                 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
90                                 break;
91
92                         case '0.0.4': // SQL queries for v0.0.4
93                                 // Update notes (these will be set as task text!)
94                                 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei ge&auml;ndert.");
95                                 break;
96
97                         case '0.0.5': // SQL queries for v0.0.5
98                                 // Update notes (these will be set as task text!)
99                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
100                                 break;
101
102                         case '0.0.6': // SQL queries for v0.0.6
103                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `nickname_len` TINYINT(3) UNSIGNED NOT NULL DEFAULT '5'");
104                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `nickname_pattern` VARCHAR(255) NOT NULL DEFAULT 'a-zA-Z0-9_'");
105                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `nickname_chars` VARCHAR(255) NOT NULL DEFAULT 'a-z, A-Z, 0-9, _'");
106                                 addAdminMenuSql('setup','config_nickname','Nicknamen','Stellen Sie minimale Nicknamenl&auml;nge, sowie erlaubte Zeichen hier ein.', 12);
107
108                                 // Update notes (these will be set as task text!)
109                                 setExtensionUpdateNotes("Minimale L&auml;nge, sowie erlaubte Zeichen sind per Adminbereich &auml;nderbar. Setzen Sie als erlaubte Zeichen nur URL-konforme Zeichen ein!");
110                                 break;
111
112                         case '0.0.7': // SQL queries for v0.0.7
113                                 // Update notes (these will be set as task text!)
114                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
115                                 break;
116
117                         case '0.0.8': // SQL queries for v0.0.8
118                                 // Update notes (these will be set as task text!)
119                                 setExtensionUpdateNotes("Men&uuml;punkte im Gast-/Mitgliedsbereich k&ouml;nnen nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
120                                 break;
121
122                         case '0.0.9': // SQL queries for v0.0.9
123                                 // Update notes (these will be set as task text!)
124                                 setExtensionUpdateNotes("Design &quot;Solid-Business&quot; eingebaut.");
125                                 break;
126
127                         case '0.1.0': // SQL queries for v0.2.1
128                                 // Update notes (these will be set as task text!)
129                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
130                                 break;
131
132                         case '0.1.1': // SQL queries for v0.1.1
133                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP nick_userid");
134
135                                 // Update notes (these will be set as task text!)
136                                 setExtensionUpdateNotes("Auswahlf&uuml;r Mitglied ob mit Nickname oder User-ID einloggen entfernt.");
137                                 break;
138
139                         case '0.1.2': // SQL queries for v0.1.2
140                                 // Update notes (these will be set as task text!)
141                                 setExtensionUpdateNotes("Zum Zusenden eines neuen Passwortes kann jetzt entweder der Nickname / User-ID <u>ODER</u> die angemeldete EMail-Adresse eingegeben werden.");
142                                 break;
143
144                         case '0.1.3': // SQL queries for v0.1.3
145                                 // Update notes (these will be set as task text!)
146                                 setExtensionUpdateNotes("CSS-Datei in general.css verschmolzen (Patch 435!)");
147                                 break;
148
149                         case '0.1.4': // SQL queries for v0.1.4
150                                 // Update notes (these will be set as task text!)
151                                 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
152                                 break;
153
154                         case '0.1.5': // SQL queries for v0.1.5
155                                 // Update notes (these will be set as task text!)
156                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
157                                 break;
158
159                         case '0.1.6': // SQL queries for v0.1.6
160                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='extras', `sort`='2' WHERE `what`='nickname' LIMIT 1");
161
162                                 // Update notes (these will be set as task text!)
163                                 setExtensionUpdateNotes("Mitgliedsmen&uuml; komplett umgebaut.");
164                                 break;
165
166                         case '0.1.7': // SQL queries for v0.1.7
167                                 // Update notes (these will be set as task text!)
168                                 setExtensionUpdateNotes("Mitglieder ohne Nickname sollten kein <strong>*failed*</strong> mehr sehen.");
169                                 break;
170
171                         case '0.1.8': // SQL queries for v0.1.8
172                                 // Update notes (these will be set as task text!)
173                                 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
174                                 break;
175
176                         case '0.1.9': // SQL queries for v0.1.9
177                                 addAdminMenuSql('user','list_nickname','Nickname-Historie','Listet alle verwendeten Nicknames der Mitglieder auf.', 12);
178                                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`");
179                                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_nickname_history` (
180 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
181 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
182 nickname VARCHAR(255) NOT NULL DEFAULT '',
183 added TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
184 last_used TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
185 INDEX userid (userid),
186 INDEX (last_used DESC),
187 PRIMARY KEY (id)
188 ) TYPE={?_TABLE_TYPE?} COMMENT='History of used nicknames'");
189
190                                 // Update notes (these will be set as task text!)
191                                 setExtensionUpdateNotes("Historie eingegebener Nicknames hinzugef&uuml;gt. Mitglied kann auf bereits verwendeter zur&uuml;ckgreifen und Liste selbst l&ouml;schen.");
192                                 break;
193                 }
194                 break;
195
196         case 'modify': // When the extension got modified
197                 break;
198
199         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
200                 break;
201
202         case 'init': // Do stuff when extension is initialized
203                 break;
204
205         default: // Unknown extension mode
206                 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
207                 break;
208 }
209
210 //
211 ?>