2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
46 setThisExtensionVersion('0.1.9');
48 // Version history array (add more with , '0.1.0' and so on)
49 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'));
51 switch (getExtensionMode()) {
52 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
53 // SQL commands to run
54 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nickname VARCHAR(255) NOT NULL DEFAULT ''");
55 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nick_userid ENUM ('nick','userid') NOT NULL DEFAULT 'userid'");
56 addMemberMenuSql('main','nickname','Nicknamen','Y','Y',5);
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'");
62 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname')");
63 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`');
66 case 'activate': // Do stuff when admin activates this extension
67 // SQL commands to run
68 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='nickname' LIMIT 1");
71 case 'deactivate': // Do stuff when admin deactivates this extension
72 // SQL commands to run
73 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='nickname' LIMIT 1");
76 case 'update': // Update an extension
77 switch (getCurrentExtensionVersion()) {
78 case '0.0.1': // SQL queries for v0.0.1
79 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET ext_has_css='Y' WHERE `ext_name`='nickname' AND ext_has_css='N' LIMIT 1");
81 // This update depends on sql_patches update!
82 addExtensionUpdateDependency('sql_patches');
84 // Update notes (these will be set as task text!)
85 setExtensionUpdateNotes("CSS-Datei kann per Adminbereich ein- und ausgeschaltet werden.");
88 case '0.0.3': // SQL queries for v0.0.3
89 // Update notes (these will be set as task text!)
90 setExtensionUpdateNotes("Fehlende Abfrage im Mitlieder-Modul, on Erweiterung auch aktiviert ist.");
93 case '0.0.4': // SQL queries for v0.0.4
94 // Update notes (these will be set as task text!)
95 setExtensionUpdateNotes("Wegen des Theme-Supportes hat sich die URL zur CSS-Datei geändert.");
98 case '0.0.5': // SQL queries for v0.0.5
99 // Update notes (these will be set as task text!)
100 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
103 case '0.0.6': // SQL queries for v0.0.6
104 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `nickname_len` TINYINT(3) UNSIGNED NOT NULL DEFAULT 5");
105 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `nickname_pattern` VARCHAR(255) NOT NULL DEFAULT 'a-zA-Z0-9_'");
106 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `nickname_chars` VARCHAR(255) NOT NULL DEFAULT 'a-z, A-Z, 0-9, _'");
107 addAdminMenuSql('setup','config_nickname','Nicknamen','Stellen Sie minimale Nicknamenlänge, sowie erlaubte Zeichen hier ein.', 12);
109 // Update notes (these will be set as task text!)
110 setExtensionUpdateNotes("Minimale Länge, sowie erlaubte Zeichen sind per Adminbereich änderbar. Setzen Sie als erlaubte Zeichen nur URL-konforme Zeichen ein!");
113 case '0.0.7': // SQL queries for v0.0.7
114 // Update notes (these will be set as task text!)
115 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
118 case '0.0.8': // SQL queries for v0.0.8
119 // Update notes (these will be set as task text!)
120 setExtensionUpdateNotes("Menüpunkte im Gast-/Mitgliedsbereich können nicht mehr aufgerufen werden, wenn die Erweiterung deaktiviert ist.");
123 case '0.0.9': // SQL queries for v0.0.9
124 // Update notes (these will be set as task text!)
125 setExtensionUpdateNotes("Design "Solid-Business" eingebaut.");
128 case '0.1.0': // SQL queries for v0.2.1
129 // Update notes (these will be set as task text!)
130 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
133 case '0.1.1': // SQL queries for v0.1.1
134 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP nick_userid");
136 // Update notes (these will be set as task text!)
137 setExtensionUpdateNotes("Auswahlfür Mitglied ob mit Nickname oder Mitglieder-Id einloggen entfernt.");
140 case '0.1.2': // SQL queries for v0.1.2
141 // Update notes (these will be set as task text!)
142 setExtensionUpdateNotes("Zum Zusenden eines neuen Passwortes kann jetzt entweder der Nickname / Mitglieder-Id <u>ODER</u> die angemeldete EMail-Adresse eingegeben werden.");
145 case '0.1.3': // SQL queries for v0.1.3
146 // Update notes (these will be set as task text!)
147 setExtensionUpdateNotes("CSS-Datei in general.css verschmolzen (Patch 435!)");
150 case '0.1.4': // SQL queries for v0.1.4
151 // Update notes (these will be set as task text!)
152 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
155 case '0.1.5': // SQL queries for v0.1.5
156 // Update notes (these will be set as task text!)
157 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
160 case '0.1.6': // SQL queries for v0.1.6
161 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='extras', `sort`=2 WHERE `what`='nickname' LIMIT 1");
163 // Update notes (these will be set as task text!)
164 setExtensionUpdateNotes("Mitgliedsmenü komplett umgebaut.");
167 case '0.1.7': // SQL queries for v0.1.7
168 // Update notes (these will be set as task text!)
169 setExtensionUpdateNotes("Mitglieder ohne Nickname sollten kein <strong>*failed*</strong> mehr sehen.");
172 case '0.1.8': // SQL queries for v0.1.8
173 // Update notes (these will be set as task text!)
174 setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
177 case '0.1.9': // SQL queries for v0.1.9
178 addAdminMenuSql('user','list_nickname','Nickname-Historie','Listet alle verwendeten Nicknames der Mitglieder auf.', 12);
179 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_nickname_history`');
180 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_nickname_history` (
181 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
182 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
183 `nickname` VARCHAR(255) NOT NULL DEFAULT '',
184 `added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
185 `last_used` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
186 INDEX `userid` (`userid`),
187 INDEX (`last_used` DESC),
189 ) TYPE={?_TABLE_TYPE?} COMMENT='History of used nicknames'");
191 // Update notes (these will be set as task text!)
192 setExtensionUpdateNotes("Historie eingegebener Nicknames hinzugefügt. Mitglied kann auf bereits verwendeter zurückgreifen und Liste selbst löschen.");
197 case 'modify': // When the extension got modified
200 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
203 case 'init': // Do stuff when extension is initialized
206 default: // Unknown extension mode
207 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));