2 /************************************************************************
3 * MXChange v0.2.1 Start: 04/11/2004 *
4 * ================ Last change: 10/29/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-admins.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Administrator management *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Admin-Accountsverwaltung *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
32 ************************************************************************/
34 // Some security stuff...
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 // Version of this extension
42 $EXT_VERSION = "0.6.9";
44 // Auto-set extension version
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
47 // Version history array (add more with , "0.1" and so on)
48 $EXT_VER_HISTORY = array("0.0", "0.1", "0.2", "0.3", "0.3.1", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9");
50 switch ($EXT_LOAD_MODE)
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
53 // SQL commands to run
54 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='admins' LIMIT 1";
55 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', NULL, 'Admin-Management', 'Administratoren anlegen, löschen oder Passwort/E-Mail Adresse ändern.', '1')";
56 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'admins_add', 'Admin hinzufügen', 'Neuen Admin-Account anlegen', '0')";
57 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'admins_edit', 'Admin-Account ändern', 'Bestehende Admin-Accounts bearbeiten: E-Mail-Adresse, Passwort und/oder Login-Name ändern.', '1')";
60 case "remove": // Do stuff when removing extension
61 // SQL commands to run
62 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='admins' LIMIT 5";
63 $SQLs[] = "DROP TABLE "._MYSQL_PREFIX."_admins_acls";
64 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP admins_default_acl";
65 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP default_acl";
68 case "activate": // Do stuff when admin activates this extension
69 // SQL commands to run
73 case "deactivate": // Do stuff when admin deactivates this extension
74 // SQL commands to run
78 case "update": // Update an extension
81 case "0.2": // SQL queries for v0.2
82 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'admins_contact', 'Admin kontaktieren', 'Kontaktiert einen Admin per Mail oder Nachricht (nur wenn messaging-Erweiterung installiert ist).', '2')";
84 // Update notes (these will be set as task text!)
85 $UPDATE_NOTES = "Fügt den Menüpunkt "Admin kontaktieren" hinzu.";
88 case "0.3": // SQL queries for v0.3
90 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'config_admins', 'ACL einstellen', 'Richten Sie Zugriffskontrollzeilen für jeden Admin individuell ein, um ihm nur bestimmte Bereiche des Admin-Bereiches zugänglich zu machen oder zu sperren.', '4')";
92 // Which is the default setting when you create a new admin login?
93 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD admins_default_acl ENUM('deny', 'allow') NOT NULL DEFAULT 'deny'";
95 // Default is deny everything
96 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD default_acl ENUM('deny', 'allow') NOT NULL DEFAULT 'deny'";
98 // But allow current admin everything (THIS SHALL BE YOU!)
99 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admins SET default_acl='allow' WHERE login='".get_session('admin_login')."' LIMIT 1";
100 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admins_acls";
101 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admins_acls (
102 id BIGINT(20) NOT NULL AUTO_INCREMENT,
103 admin_id BIGINT(20) NOT NULL DEFAULT '0',
104 action_menu VARCHAR(255) NOT NULL DEFAULT '',
105 what_menu VARCHAR(255) NOT NULL DEFAULT '',
106 access_mode ENUM('deny', 'allow') NOT NULL DEFAULT 'deny',
111 // Update notes (these will be set as task text!)
112 $UPDATE_NOTES = "Sogn. ACLs werden hinzugefügt: <STRONG>A</STRONG>ccess <STRONG>C</STRONG>ontrol <STRONG>L</STRONG>ines sind zu deutsch Zugriffkontrollzeilen, mit denen Sie einstellen können, was welcher Admin machen darf oder nicht.";
115 case "0.3.1": // SQL queries for v0.3.1
116 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins_acls MODIFY id BIGINT(20) NOT NULL AUTO_INCREMENT";
119 case "0.4.0": // SQL queries for v0.4.0
120 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admins_mails";
121 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admins_mails (
122 id BIGINT(20) NOT NULL AUTO_INCREMENT,
123 admin_id BIGINT(20) NOT NULL DEFAULT '0',
124 mail_template VARCHAR(255) NOT NULL,
128 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'admins_mails', 'Admin-Mails', 'Stellen Sie hier ein, welcher Admin welche Mail erhalten soll. Sie können dies (derzeit) jedoch erst, wenn einmal die Mail versendet wurde!', '5')";
130 // Update notes (these will be set as task text!)
131 $UPDATE_NOTES = "Kontrollieren Sie, welche Mails welcher Admin oder alle (admin_id=0) bekommen soll oder im UserLog (admin_id=-1) verzeichnet werden soll. Standartmässig wird weiter an alle versendet.";
134 case "0.4.1": // SQL queries for v0.4.1
135 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admins_mails WHERE mail_template LIKE '% %'";
137 // Update notes (these will be set as task text!)
138 $UPDATE_NOTES = "Admins-Mails-Tabelle geleert.";
140 case "0.4.4": // SQL queries for v0.4.4
141 // Update notes (these will be set as task text!)
142 $UPDATE_NOTES = "&admin= in &amp;admin= umgewandelt.";
145 case "0.4.5": // SQL queries for v0.4.5
146 // Update notes (these will be set as task text!)
147 $UPDATE_NOTES = "Vorbereitet auf Cache-System";
150 case "0.4.6": // SQL queries for v0.4.6
151 // Update notes (these will be set as task text!)
152 $UPDATE_NOTES = "Problem mit cache-Erweiterung gefixt. Der Admin-Bereich war permanent gesperrt.";
155 case "0.4.7": // SQL queries for v0.4.7
156 // Update notes (these will be set as task text!)
157 $UPDATE_NOTES = "Es wurde die Zeitmarke der Cache-Datei admins.cache mit berücksichtigt.";
160 case "0.4.8": // SQL queries for v0.4.8
161 // Update notes (these will be set as task text!)
162 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
165 case "0.4.9": // SQL queries for v0.4.9
166 // Update notes (these will be set as task text!)
167 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
170 case "0.5.0": // SQL queries for v0.5.0
171 // Update notes (these will be set as task text!)
172 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
175 case "0.5.1": // SQL queries for v0.5.1
176 // Update notes (these will be set as task text!)
177 $UPDATE_NOTES = "Cache wird endlich gelöscht, wenn Admin entfernt wird.";
180 case "0.5.2": // SQL queries for v0.5.2
181 // Update notes (these will be set as task text!)
182 $UPDATE_NOTES = "Löschen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.";
185 case "0.5.3": // SQL queries for v0.5.3
186 // Update notes (these will be set as task text!)
187 $UPDATE_NOTES = "Seit <A href=\"#\">Patch 340</A> überflüssige HTML-Tags entfernt.";
190 case "0.5.4": // SQL queries for v0.5.4
191 // Update notes (these will be set as task text!)
192 $UPDATE_NOTES = "IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.";
195 case "0.5.5": // SQL queries for v0.5.5
196 // Update notes (these will be set as task text!)
197 $UPDATE_NOTES = "Menüpunkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.";
200 case "0.5.6": // SQL queries for v0.5.6
201 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='admins_contct' WHERE what='admins_contact' LIMIT 1";
203 // Update notes (these will be set as task text!)
204 $UPDATE_NOTES = "Namenskonflikt zwischen den Erweiterungen <STRONG>admins</STRONG> und (kommender) <STRONG>contact</STRONG>.";
207 case "0.5.7": // SQL queries for v0.5.7
208 // Update notes (these will be set as task text!)
209 $UPDATE_NOTES = "Links wegen <STRONG>what=admins_contct</STRONG> geändert.";
212 case "0.5.8": // SQL queries for v0.5.8
213 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='admins_contct' WHERE what='admins_contact' LIMIT 1";
215 // Update notes (these will be set as task text!)
216 $UPDATE_NOTES = "Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.";
219 case "0.5.9": // SQL queries for v0.5.9
220 // Update notes (these will be set as task text!)
221 $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen geschützt.";
224 case "0.6.0": // SQL queries for v0.6.0
225 // Update notes (these will be set as task text!)
226 $UPDATE_NOTES = "Link in "ACL Einstellen" zum Admin-Kontaktformular korregiert.";
229 case "0.6.1": // SQL queries for v0.6.1
230 // Update notes (these will be set as task text!)
231 $UPDATE_NOTES = "Speichern von Admin-Accounts klappt wieder.";
234 case "0.6.2": // SQL queries for v0.6.2
235 // Update notes (these will be set as task text!)
236 $UPDATE_NOTES = "Bitte verschieben Sie die admins-Templates (Ordner: ".PATH."/templates/de/emails/) in den neuen Order admins!";
239 case "0.6.3": // SQL queries for v0.6.3
240 // Update notes (these will be set as task text!)
241 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
244 case "0.6.4": // SQL queries for v0.6.4
245 // Update notes (these will be set as task text!)
246 $UPDATE_NOTES = "Problem mit der Rechtevererbung beseitigt: Geben Sie nun ein Hauptmenü frei (Allow), dann kann der Admin auch die Untermenüs erreichen. Zudem können Sie gezielte Untermenüs im freigegeben Hauptmenü dennoch sperren.";
249 case "0.6.5": // SQL queries for v0.6.5
250 // Update notes (these will be set as task text!)
251 $UPDATE_NOTES = "Sicherheitsupdate für die Include-Befehle.";
254 case "0.6.6": // SQL queries for v0.5.6
255 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='admins_contct' WHERE what='admins_contact' LIMIT 1";
257 // Update notes (these will be set as task text!)
258 $UPDATE_NOTES = "Namenskonflikt zwischen den Erweiterungen <STRONG>admins</STRONG> und (kommender) <STRONG>contact</STRONG>.";
261 case "0.6.7": // SQL queries for v0.6.7
262 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD la_mode ENUM('global', 'OLD', 'NEW') NOT NULL DEFAULT 'global'";
264 // Update notes (these will be set as task text!)
265 $UPDATE_NOTES = "Namenskonflikt zwischen den Erweiterungen <STRONG>admins</STRONG> und (kommender) <STRONG>contact</STRONG>. Beseitigung eines Fehlers <STRONG>HTTP_POSR_VARS</STRONG> beim Ändern von Administratoren.";
268 case "0.6.8": // SQL queries for v0.6.8
269 // Update notes (these will be set as task text!)
270 $UPDATE_NOTES = "<STRONG>set_session()</STRONG> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.";
273 case "0.6.9": // SQL queries for v0.6.9
274 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Admin-Management' WHERE action = 'admins' AND (what='' OR what IS NULL) LIMIT 1";
276 // Update notes (these will be set as task text!)
277 $UPDATE_NOTES = "Verwaltung nach Management umbenannt.";
282 default: // Do stuff when extension is loaded
286 // Language file prefix
287 $EXT_LANG_PREFIX = "admins";
289 // Extension is always active?
290 $EXT_ALWAYS_ACTIVE = "N";