7cfa1fd4865ec68f43304c0cb117c6b24775a323
[mailer.git] / inc / extensions / ext-user.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 04/29/2004 *
4  * ================                             Last change: 10/29/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-user.php                                     *
8  * -------------------------------------------------------------------- *
9  * Short description : Swapped out user management                      *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ausgelagertes Mitglieder-Management              *
12  * -------------------------------------------------------------------- *
13  * $Revision:: 856                                                    $ *
14  * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author:: stelzi                                                   $ *
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.3.5");
47
48 // Version history array (add more with , "0.1" and so on)
49 EXT_SET_VER_HISTORY(array("0.0", "0.1", "0.1.1", "0.1.2", "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", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5"));
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("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user',NULL,'Mitglieder-Management','Mitglieder freischalten, sperren, Accounts editieren, Neuanmeldungen verwalten, {!POINTS!} gutschreiben und abziehen und und und...',3)");
56         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','del_user','Mitglied l&ouml;schen','L&ouml;schen Sie hier Mitglied, die gegen die AGBs mehrmals verstossen haben. Bitte seien Sie nett zu Ihren Mitgliedern und l&ouml;schen Sie nicht gleich.',1)");
57         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','chk_regs','Anmeldungen pr&uuml;fen','Pr&uuml;fen Sie hier neue Anmeldungen zu Ihrem System. Hier k&ouml;nnen Sie im Falle einer Fehler-Mail den Mitglied gleich wieder l&ouml;schen!',2)");
58         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','lock_user','Mitglied sperren / entsperren','Sperren Sie Mitglied, die zu viele unbest&auml;tigte Mails haben oder gegen Ihre AGBs verstossen haben &uuml;ber diesen Men&uuml;punkt.',3)");
59         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_user','Mitglied auflisten','Listen Sie alle Mitglied oder eingeschr&auml;nkt nach Suchkritieren Ihre Userdatenbank auf. Sie k&ouml;nen per Klick auf die Usernummer sich Details zum Mitglied ansehen.',4)");
60         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','add_points','{!POINTS!} gutschreiben','Buchen Sie einem Mitglied direkt {!POINTS!} auf. Sie k&ouml;nnen dazu auch einen Kommentar mitsenden.',5)");
61         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes &auml;ndern.',6)");
62         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_refs','Referals anzeigen','Mit diesem Men&uuml;punkt k&ouml;nnen Sie die generierten Referals eines Mitgliedes auflisten.',7)");
63         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_links','Unbest&auml;tigte Mails','Mit diesem Men&uuml;punkt k&ouml;nnen Sie die vom Mitglied nicht best&auml;tigten Mails anzeigen.',8)");
64         ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_cats','Kategorien anzeigen','Listet die ausgew&auml;hlten Kategorien eines Mitgliedes auf.',9)");
65         break;
66
67 case "remove": // Do stuff when removing extension
68         // SQL commands to run
69         ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') LIMIT 3");
70         ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`");
71         break;
72
73 case "activate": // Do stuff when admin activates this extension
74         // SQL commands to run
75         ADD_SQL("");
76         break;
77
78 case "deactivate": // Do stuff when admin deactivates this extension
79         // SQL commands to run
80         ADD_SQL("");
81         break;
82
83 case "update": // Update an extension
84         switch ($EXT_VER)
85         {
86         case "0.1": // SQL queries for v0.1
87                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_limit` INT(7) UNSIGNED NOT NULL DEFAULT 20");
88
89                 // Update notes (these will be set as task text!)
90                 EXT_SET_UPDATE_NOTES("Seitenweises Anzeigen der User-Liste ist nun m&ouml;glich.");
91                 break;
92
93         case "0.1.1": // SQL queries for v0.1.1
94                 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='user' AND `ext_has_css`='N' LIMIT 1");
95
96                 // This update depends on sql_patches update!
97                 EXT_SET_UPDATE_DEPENDS("sql_patches");
98
99                 // Update notes (these will be set as task text!)
100                 EXT_SET_UPDATE_NOTES("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.");
101
102         case "0.1.2": // SQL queries for v0.1.2
103                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `mails_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
104
105                 // Update notes (these will be set as task text!)
106                 EXT_SET_UPDATE_NOTES("Dem Mitglied wird nun angezeigt, wie viele Mails er best&auml;tigt hat. Alle vor dieser Version best. Mails werden leider nicht mehr ber&uuml;cksichtigt! Bitte teilen Sie dies Ihren Mitgliedern mit.");
107                 break;
108
109         case "0.1.3": // SQL queries for v0.1.3
110                 // Update notes (these will be set as task text!)
111                 EXT_SET_UPDATE_NOTES("Den Pfad <em>Sie sind hier</em> im Men&uuml;punkt <u>Online-Liste</u> erweitert.");
112                 break;
113
114         case "0.1.4": // SQL queries for v0.1.4
115                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `emails_received` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
116
117                 // Update notes (these will be set as task text!)
118                 EXT_SET_UPDATE_NOTES("Anzahl empfangener Mails wird angezeigt. <big>Diese Anzeige kann fehlerhaft sein, wenn Sie bereits Mitglieder in Ihrem {!MT_WORD!} haben sollen!</big>");
119                 break;
120
121         case "0.1.5": // SQL queries for v0.1.5
122                 // Update notes (these will be set as task text!)
123                 EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
124                 break;
125
126         case "0.1.6": // SQL queries for v0.1.6
127                 // Update notes (these will be set as task text!)
128                 EXT_SET_UPDATE_NOTES("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
129                 break;
130
131         case "0.1.7": // SQL queries for v0.1.7
132                 // Update notes (these will be set as task text!)
133                 EXT_SET_UPDATE_NOTES("Erweiterung bleibt wegen integrierten Schalters immer aktiv.");
134                 break;
135
136         case "0.1.8": // SQL queries for v0.1.8
137                 // Update notes (these will be set as task text!)
138                 EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
139                 break;
140
141         case "0.1.9": // SQL queries for v0.1.9
142                 // Update notes (these will be set as task text!)
143                 EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
144                 break;
145
146         case "0.2.0": // SQL queries for v0.2.0
147                 // Update notes (these will be set as task text!)
148                 EXT_SET_UPDATE_NOTES("User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.");
149                 break;
150
151         case "0.2.1": // SQL queries for v0.2.1
152                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_alpha` TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
153                 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_user','Mitgliederliste','Anzahl Mitglieder pro Seite, Anzahl Buchstaben pro Zeile usw.', 8)");
154
155                 // Update notes (these will be set as task text!)
156                 EXT_SET_UPDATE_NOTES("User-Liste ist konfigurierbar: Anzahl Mitglieder pro Seite und Anzahl Buchstaben pro Zeile; Template-Fehler beseitigt.");
157                 break;
158
159         case "0.2.2": // SQL queries for v0.2.2
160                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE `gender` `gender` ENUM('M','F','C') NOT NULL DEFAULT 'M'");
161
162                 // Update notes (these will be set as task text!)
163                 EXT_SET_UPDATE_NOTES("Anrede &quot;Firma&quot; hinzugef&uuml;gt.");
164                 break;
165
166         case "0.2.3": // SQL queries for v0.2.3
167                 // Update notes (these will be set as task text!)
168                 EXT_SET_UPDATE_NOTES("Datumsformat festgelegt auf ausf&uuml;hrlich.");
169                 break;
170
171         case "0.2.4": // SQL queries for v0.2.4
172                 // Update notes (these will be set as task text!)
173                 EXT_SET_UPDATE_NOTES("W&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.");
174                 break;
175
176         case "0.2.5": // SQL queries for v0.2.5
177                 // Update notes (these will be set as task text!)
178                 EXT_SET_UPDATE_NOTES("SQL-Anweisungen abgesichert.");
179                 break;
180
181         case "0.2.6": // SQL queries for v0.2.6
182                 // Update notes (these will be set as task text!)
183                 EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
184                 break;
185
186         case "0.2.7": // SQL queries for v0.2.7
187                 // Update notes (these will be set as task text!)
188                 EXT_SET_UPDATE_NOTES("Sicherheitsupdate f&uuml;r die Include-Befehle.");
189                 break;
190
191         case "0.2.8": // SQL queries for v0.2.8
192                 // Update notes (these will be set as task text!)
193                 EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
194                 break;
195
196         case "0.2.9": // SQL queries for v0.2.9
197                 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','user_contct','Mitglied kontaktieren','Kontaktieren Sie hier Ihre Mitglieder ganz direkt &uuml;ber ein Webformular. Sie brauchen somit kein EMail-Programm mehr starten!', 8)");
198
199                 // Update notes (these will be set as task text!)
200                 EXT_SET_UPDATE_NOTES("Admin-Kontaktformular hinzugef&uuml;gt.");
201                 break;
202
203         case "0.3.0": // SQL queries for v0.3.0
204                 // Update notes (these will be set as task text!)
205                 EXT_SET_UPDATE_NOTES("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.<br />Diverse Fixes f&uuml;r <em>0.2.1-Beta1</em> Release.");
206                 break;
207
208         case "0.3.1": // SQL queries for v0.3.1
209                 ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `title` = 'Mitglieder-Management' WHERE `action`='user' AND (`what`='' OR `what` IS NULL) LIMIT 1");
210
211                 // Update notes (these will be set as task text!)
212                 EXT_SET_UPDATE_NOTES("Verwaltung auf Management umgestellt");
213                 break;
214
215         case "0.3.2": // SQL queries for v0.3.2
216                 // Update notes (these will be set as task text!)
217                 EXT_SET_UPDATE_NOTES("PHP-Hinweis in Userauflistung gefixt (trat bei fehlender nickname-Erweiterung auf) und Darstellungsfehler von <strong>0.00000</strong> unbest&auml;tigten Mails gefixt.");
218                 break;
219
220         case "0.3.3": // SQL queries for v0.3.3
221                 // Update notes (these will be set as task text!)
222                 EXT_SET_UPDATE_NOTES("Mitglieder sind nun per Formular kontaktierbar (es wird eine EMail versendet), gesperrte und best&auml;tigte Mitglieder-Accounts sind seperat oder gemeinsam auflistbar (seperat nur mit der Erweiterung <em>task</em>!)");
223                 break;
224
225         case "0.3.4": // SQL queries for v0.3.4
226                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
227                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10");
228                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `rand_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
229
230                 // Update notes (these will be set as task text!)
231                 EXT_SET_UPDATE_NOTES("Mitglieder werden per Zufall als Referal-ID ausgew&auml;hlt, die eine Mindestanzahl an best&auml;tigten Mails haben, wenn die Ref-Id 0 ist.");
232                 break;
233
234         case "0.3.5": // SQL queries for v0.3.5
235                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_reason` TINYTEXT");
236                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'");
237                 ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_delete_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day') * 30)."");
238                 ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_user_del','L&ouml;schungen auflisten','Listet die L&ouml;schungen von Usern auf.', 9)");
239                 ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`");
240                 ADD_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_del` (
241 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
242 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
243 `email` VARCHAR(255) NOT NULL DEFAULT '',
244 `surname` VARCHAR(255) NOT NULL DEFAULT '',
245 `family` VARCHAR(255) NOT NULL DEFAULT '',
246 `joined` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
247 `last_online` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
248 `del_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
249 `del_reason` TINYTEXT,
250 INDEX (`userid`),
251 PRIMARY KEY(`id`)
252 ) TYPE={!_TABLE_TYPE!} COMMENT='List of deleted users'");
253
254                 // Update notes (these will be set as task text!)
255                 EXT_SET_UPDATE_NOTES("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
256                 break;
257         }
258         break;
259
260 case "modify": // When the extension got modified
261         break;
262
263 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
264         break;
265
266 default: // Do stuff when extension is loaded
267         break;
268 }
269
270 // Keep this extension always active!
271 EXT_SET_ALWAYS_ACTIVE("Y");
272
273 // [EOF]
274 ?>