2 /************************************************************************
3 * MXChange v0.2.1 Start: 06/17/2004 *
4 * ================ Last change: 06/17/2004 *
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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 *
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. *
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. *
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, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
45 setThisExtensionVersion('0.1.9');
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'));
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);
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`");
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");
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");
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");
80 // This update depends on sql_patches update!
81 addExtensionUpdateDependency('sql_patches');
83 // Update notes (these will be set as task text!)
84 setExtensionUpdateNotes("CSS-Datei kann per Adminbereich ein- und ausgeschaltet werden.");
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.");
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ändert.");
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.");
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änge, sowie erlaubte Zeichen hier ein.', 12);
108 // Update notes (these will be set as task text!)
109 setExtensionUpdateNotes("Minimale Länge, sowie erlaubte Zeichen sind per Adminbereich änderbar. Setzen Sie als erlaubte Zeichen nur URL-konforme Zeichen ein!");
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.");
117 case '0.0.8': // SQL queries for v0.0.8
118 // Update notes (these will be set as task text!)
119 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
122 case '0.0.9': // SQL queries for v0.0.9
123 // Update notes (these will be set as task text!)
124 setExtensionUpdateNotes("Design "Solid-Business" eingebaut.");
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> überflüssige HTML-Tags entfernt.");
132 case '0.1.1': // SQL queries for v0.1.1
133 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP nick_userid");
135 // Update notes (these will be set as task text!)
136 setExtensionUpdateNotes("Auswahlfür Mitglied ob mit Nickname oder User-ID einloggen entfernt.");
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.");
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!)");
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.");
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.");
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");
162 // Update notes (these will be set as task text!)
163 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
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.");
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.");
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),
188 ) TYPE={?_TABLE_TYPE?} COMMENT='History of used nicknames'");
190 // Update notes (these will be set as task text!)
191 setExtensionUpdateNotes("Historie eingegebener Nicknames hinzugefügt. Mitglied kann auf bereits verwendeter zurückgreifen und Liste selbst löschen.");
196 case 'modify': // When the extension got modified
199 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
202 case 'init': // Do stuff when extension is initialized
205 default: // Unknown extension mode
206 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));