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