More queries and language constants rewritten
[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  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Version number
41 $EXT_VERSION = "0.3.5";
42
43 // Version history array (add more with , "0.1" and so on)
44 $EXT_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");
45
46 switch ($EXT_LOAD_MODE)
47 {
48 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
49         // SQL commands to run
50         $SQLs[] = "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)";
51         $SQLs[] = "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)";
52         $SQLs[] = "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)";
53         $SQLs[] = "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)";
54         $SQLs[] = "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)";
55         $SQLs[] = "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)";
56         $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes &auml;ndern.',6)";
57         $SQLs[] = "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)";
58         $SQLs[] = "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)";
59         $SQLs[] = "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)";
60
61         // Load CSS-File?
62         $EXT_CSS = "Y";
63         break;
64
65 case "remove": // Do stuff when removing extension
66         // SQL commands to run
67         $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') LIMIT 3";
68         $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`";
69         break;
70
71 case "activate": // Do stuff when admin activates this extension
72         // SQL commands to run
73         $SQLs[] = "";
74         break;
75
76 case "deactivate": // Do stuff when admin deactivates this extension
77         // SQL commands to run
78         $SQLs[] = "";
79         break;
80
81 case "update": // Update an extension
82         switch ($EXT_VER)
83         {
84         case "0.1": // SQL queries for v0.1
85                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_limit` INT(7) UNSIGNED NOT NULL DEFAULT 20";
86
87                 // Update notes (these will be set as task text!)
88                 $UPDATE_NOTES = "Seitenweises Anzeigen der User-Liste ist nun m&ouml;glich.";
89                 break;
90
91         case "0.1.1": // SQL queries for v0.1.1
92                 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='user' AND `ext_has_css`='N' LIMIT 1";
93
94                 // This update depends on sql_patches update!
95                 $EXT_UPDATE_DEPENDS = "sql_patches";
96
97                 // Update notes (these will be set as task text!)
98                 $UPDATE_NOTES = "CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.";
99
100         case "0.1.2": // SQL queries for v0.1.2
101                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `mails_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
102
103                 // Update notes (these will be set as task text!)
104                 $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.";
105                 break;
106
107         case "0.1.3": // SQL queries for v0.1.3
108                 // Update notes (these will be set as task text!)
109                 $UPDATE_NOTES = "Den Pfad <em>Sie sind hier</em> im Men&uuml;punkt <u>Online-Liste</u> erweitert.";
110                 break;
111
112         case "0.1.4": // SQL queries for v0.1.4
113                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `emails_received` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
114
115                 // Update notes (these will be set as task text!)
116                 $UPDATE_NOTES = "Anzahl empfangener Mails wird angezeigt. <big>Diese Anzeige kann fehlerhaft sein, wenn Sie bereits Mitglieder in Ihrem {!MT_WORD!} haben sollen!</big>";
117                 break;
118
119         case "0.1.5": // SQL queries for v0.1.5
120                 // Update notes (these will be set as task text!)
121                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
122                 break;
123
124         case "0.1.6": // SQL queries for v0.1.6
125                 // Update notes (these will be set as task text!)
126                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
127                 break;
128
129         case "0.1.7": // SQL queries for v0.1.7
130                 // Update notes (these will be set as task text!)
131                 $UPDATE_NOTES = "Erweiterung bleibt wegen integrierten Schalters immer aktiv.";
132                 break;
133
134         case "0.1.8": // SQL queries for v0.1.8
135                 // Update notes (these will be set as task text!)
136                 $UPDATE_NOTES = "Seit <a href=\"#\">Patch 340</a> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
137                 break;
138
139         case "0.1.9": // SQL queries for v0.1.9
140                 // Update notes (these will be set as task text!)
141                 $UPDATE_NOTES = "Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.";
142                 break;
143
144         case "0.2.0": // SQL queries for v0.2.0
145                 // Update notes (these will be set as task text!)
146                 $UPDATE_NOTES = "User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.";
147                 break;
148
149         case "0.2.1": // SQL queries for v0.2.1
150                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_alpha` TINYINT(3) UNSIGNED NOT NULL DEFAULT 10";
151                 $SQLs[] = "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)";
152
153                 // Update notes (these will be set as task text!)
154                 $UPDATE_NOTES = "User-Liste ist konfigurierbar: Anzahl Mitglieder pro Seite und Anzahl Buchstaben pro Zeile; Template-Fehler beseitigt.";
155                 break;
156
157         case "0.2.2": // SQL queries for v0.2.2
158                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE `gender` `gender` ENUM('M','F','C') NOT NULL DEFAULT 'M'";
159
160                 // Update notes (these will be set as task text!)
161                 $UPDATE_NOTES = "Anrede &quot;Firma&quot; hinzugef&uuml;gt.";
162                 break;
163
164         case "0.2.3": // SQL queries for v0.2.3
165                 // Update notes (these will be set as task text!)
166                 $UPDATE_NOTES = "Datumsformat festgelegt auf ausf&uuml;hrlich.";
167                 break;
168
169         case "0.2.4": // SQL queries for v0.2.4
170                 // Update notes (these will be set as task text!)
171                 $UPDATE_NOTES = "W&ouml;rter <strong>Mailtausch</strong>, <strong>Mailtausches</strong> und <strong>Mailtauscher</strong> sind austauschbar.";
172                 break;
173
174         case "0.2.5": // SQL queries for v0.2.5
175                 // Update notes (these will be set as task text!)
176                 $UPDATE_NOTES = "SQL-Anweisungen abgesichert.";
177                 break;
178
179         case "0.2.6": // SQL queries for v0.2.6
180                 // Update notes (these will be set as task text!)
181                 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
182                 break;
183
184         case "0.2.7": // SQL queries for v0.2.7
185                 // Update notes (these will be set as task text!)
186                 $UPDATE_NOTES = "Sicherheitsupdate f&uuml;r die Include-Befehle.";
187                 break;
188
189         case "0.2.8": // SQL queries for v0.2.8
190                 // Update notes (these will be set as task text!)
191                 $UPDATE_NOTES = "if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.";
192                 break;
193
194         case "0.2.9": // SQL queries for v0.2.9
195                 $SQLs[] = "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)";
196
197                 // Update notes (these will be set as task text!)
198                 $UPDATE_NOTES = "Admin-Kontaktformular hinzugef&uuml;gt.";
199                 break;
200
201         case "0.3.0": // SQL queries for v0.3.0
202                 // Update notes (these will be set as task text!)
203                 $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.";
204                 break;
205
206         case "0.3.1": // SQL queries for v0.3.1
207                 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `title` = 'Mitglieder-Management' WHERE `action`='user' AND (`what`='' OR `what` IS NULL) LIMIT 1";
208
209                 // Update notes (these will be set as task text!)
210                 $UPDATE_NOTES = "Verwaltung auf Management umgestellt";
211                 break;
212
213         case "0.3.2": // SQL queries for v0.3.2
214                 // Update notes (these will be set as task text!)
215                 $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.";
216                 break;
217
218         case "0.3.3": // SQL queries for v0.3.3
219                 // Update notes (these will be set as task text!)
220                 $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>!)";
221                 break;
222
223         case "0.3.4": // SQL queries for v0.3.4
224                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'";
225                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10";
226                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `rand_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
227
228                 // Update notes (these will be set as task text!)
229                 $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.";
230                 break;
231
232         case "0.3.5": // SQL queries for v0.3.5
233                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_reason` TINYTEXT";
234                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'";
235                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_delete_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day') * 30)."";
236                 $SQLs[] = "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)";
237                 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`";
238                 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_user_del` (
239 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
240 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
241 `email` VARCHAR(255) NOT NULL DEFAULT '',
242 `surname` VARCHAR(255) NOT NULL DEFAULT '',
243 `family` VARCHAR(255) NOT NULL DEFAULT '',
244 `joined` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
245 `last_online` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
246 `del_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
247 `del_reason` TINYTEXT,
248 INDEX (`userid`),
249 PRIMARY KEY(`id`)
250 ) TYPE=MyISAM COMMENT='List of deleted users'";
251
252                 // Update notes (these will be set as task text!)
253                 $UPDATE_NOTES = "Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.";
254                 break;
255         }
256         break;
257
258 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
259         break;
260
261 default: // Do stuff when extension is loaded
262         break;
263 }
264
265 // Keep this extension always active!
266 $EXT_ALWAYS_ACTIVE = "Y";
267
268 // [EOF]
269 ?>