2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 04/11/2004 *
\r
4 * ================ Last change: 10/29/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : ext-admins.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Administrator management *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Admin-Accountsverwaltung *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
41 // Version of this extension
\r
42 $EXT_VERSION = "0.6.9";
\r
44 // Auto-set extension version
\r
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
\r
47 // Version history array (add more with , "0.1" and so on)
\r
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");
\r
50 switch ($EXT_LOAD_MODE)
\r
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
\r
53 // SQL commands to run
\r
54 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='admins' LIMIT 1";
\r
55 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', '', 'Admin-Management', 'Administratoren anlegen, löschen oder Passwort/E-Mail Adresse ändern.', '1')";
\r
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')";
\r
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')";
\r
60 case "remove": // Do stuff when removing extension
\r
61 // SQL commands to run
\r
62 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='admins' LIMIT 5";
\r
63 $SQLs[] = "DROP TABLE "._MYSQL_PREFIX."_admins_acls";
\r
64 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP admins_default_acl";
\r
65 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP default_acl";
\r
68 case "activate": // Do stuff when admin activates this extension
\r
69 // SQL commands to run
\r
73 case "deactivate": // Do stuff when admin deactivates this extension
\r
74 // SQL commands to run
\r
78 case "update": // Update an extension
\r
81 case "0.2": // SQL queries for v0.2
\r
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')";
\r
84 // Update notes (these will be set as task text!)
\r
85 $UPDATE_NOTES = "Fügt den Menüpunkt "Admin kontaktieren" hinzu.";
\r
88 case "0.3": // SQL queries for v0.3
\r
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')";
\r
92 // Which is the default setting when you create a new admin login?
\r
93 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD admins_default_acl enum('deny', 'allow') not null default 'deny'";
\r
95 // Default is deny everything
\r
96 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD default_acl enum('deny', 'allow') not null default 'deny'";
\r
98 // But allow current admin everything (THIS SHALL BE YOU!)
\r
99 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admins SET default_acl='allow' WHERE login='".$_COOKIE['admin_login']."' LIMIT 1";
\r
100 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admins_acls";
\r
101 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admins_acls (
\r
102 id bigint(20) not null auto_increment,
\r
103 admin_id bigint(20) not null default '0',
\r
104 action_menu varchar(255) not null default '',
\r
105 what_menu varchar(255) not null default '',
\r
106 access_mode enum('deny', 'allow') not null default 'deny',
\r
111 // Update notes (these will be set as task text!)
\r
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.";
\r
115 case "0.3.1": // SQL queries for v0.3.1
\r
116 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins_acls MODIFY id bigint(20) not null auto_increment";
\r
119 case "0.4.0": // SQL queries for v0.4.0
\r
120 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admins_mails";
\r
121 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_admins_mails (
\r
122 id bigint(20) not null auto_increment,
\r
123 admin_id bigint(20) not null default '0',
\r
124 mail_template varchar(255) not null,
\r
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')";
\r
130 // Update notes (these will be set as task text!)
\r
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.";
\r
134 case "0.4.1": // SQL queries for v0.4.1
\r
135 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admins_mails WHERE mail_template LIKE '% %'";
\r
137 // Update notes (these will be set as task text!)
\r
138 $UPDATE_NOTES = "Admins-Mails-Tabelle geleert.";
\r
140 case "0.4.4": // SQL queries for v0.4.4
\r
141 // Update notes (these will be set as task text!)
\r
142 $UPDATE_NOTES = "&admin= in &amp;admin= umgewandelt.";
\r
145 case "0.4.5": // SQL queries for v0.4.5
\r
146 // Update notes (these will be set as task text!)
\r
147 $UPDATE_NOTES = "Vorbereitet auf Cache-System";
\r
150 case "0.4.6": // SQL queries for v0.4.6
\r
151 // Update notes (these will be set as task text!)
\r
152 $UPDATE_NOTES = "Problem mit cache-Erweiterung gefixt. Der Admin-Bereich war permanent gesperrt.";
\r
155 case "0.4.7": // SQL queries for v0.4.7
\r
156 // Update notes (these will be set as task text!)
\r
157 $UPDATE_NOTES = "Es wurde die Zeitmarke der Cache-Datei admins.cache mit berücksichtigt.";
\r
160 case "0.4.8": // SQL queries for v0.4.8
\r
161 // Update notes (these will be set as task text!)
\r
162 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
\r
165 case "0.4.9": // SQL queries for v0.4.9
\r
166 // Update notes (these will be set as task text!)
\r
167 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
\r
170 case "0.5.0": // SQL queries for v0.5.0
\r
171 // Update notes (these will be set as task text!)
\r
172 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
\r
175 case "0.5.1": // SQL queries for v0.5.1
\r
176 // Update notes (these will be set as task text!)
\r
177 $UPDATE_NOTES = "Cache wird endlich gelöscht, wenn Admin entfernt wird.";
\r
180 case "0.5.2": // SQL queries for v0.5.2
\r
181 // Update notes (these will be set as task text!)
\r
182 $UPDATE_NOTES = "Löschen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.";
\r
185 case "0.5.3": // SQL queries for v0.5.3
\r
186 // Update notes (these will be set as task text!)
\r
187 $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> überflüssige HTML-Tags entfernt.";
\r
190 case "0.5.4": // SQL queries for v0.5.4
\r
191 // Update notes (these will be set as task text!)
\r
192 $UPDATE_NOTES = "IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.";
\r
195 case "0.5.5": // SQL queries for v0.5.5
\r
196 // Update notes (these will be set as task text!)
\r
197 $UPDATE_NOTES = "Menüpunkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.";
\r
200 case "0.5.6": // SQL queries for v0.5.6
\r
201 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='admins_contct' WHERE what='admins_contact' LIMIT 1";
\r
203 // Update notes (these will be set as task text!)
\r
204 $UPDATE_NOTES = "Namenskonflikt zwischen den Erweiterungen <STRONG>admins</STRONG> und (kommender) <STRONG>contact</STRONG>.";
\r
207 case "0.5.7": // SQL queries for v0.5.7
\r
208 // Update notes (these will be set as task text!)
\r
209 $UPDATE_NOTES = "Links wegen <STRONG>what=admins_contct</STRONG> geändert.";
\r
212 case "0.5.8": // SQL queries for v0.5.8
\r
213 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='admins_contct' WHERE what='admins_contact' LIMIT 1";
\r
215 // Update notes (these will be set as task text!)
\r
216 $UPDATE_NOTES = "Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.";
\r
219 case "0.5.9": // SQL queries for v0.5.9
\r
220 // Update notes (these will be set as task text!)
\r
221 $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen geschützt.";
\r
224 case "0.6.0": // SQL queries for v0.6.0
\r
225 // Update notes (these will be set as task text!)
\r
226 $UPDATE_NOTES = "Link in "ACL Einstellen" zum Admin-Kontaktformular korregiert.";
\r
229 case "0.6.1": // SQL queries for v0.6.1
\r
230 // Update notes (these will be set as task text!)
\r
231 $UPDATE_NOTES = "Speichern von Admin-Accounts klappt wieder.";
\r
234 case "0.6.2": // SQL queries for v0.6.2
\r
235 // Update notes (these will be set as task text!)
\r
236 $UPDATE_NOTES = "Bitte verschieben Sie die admins-Templates (Ordner: ".PATH."/templates/de/emails/) in den neuen Order admins!";
\r
239 case "0.6.3": // SQL queries for v0.6.3
\r
240 // Update notes (these will be set as task text!)
\r
241 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
\r
244 case "0.6.4": // SQL queries for v0.6.4
\r
245 // Update notes (these will be set as task text!)
\r
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.";
\r
249 case "0.6.5": // SQL queries for v0.6.5
\r
250 // Update notes (these will be set as task text!)
\r
251 $UPDATE_NOTES = "Sicherheitsupdate für die Include-Befehle.";
\r
254 case "0.6.6": // SQL queries for v0.5.6
\r
255 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what='admins_contct' WHERE what='admins_contact' LIMIT 1";
\r
257 // Update notes (these will be set as task text!)
\r
258 $UPDATE_NOTES = "Namenskonflikt zwischen den Erweiterungen <STRONG>admins</STRONG> und (kommender) <STRONG>contact</STRONG>.";
\r
261 case "0.6.7": // SQL queries for v0.6.7
\r
262 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD la_mode enum('global', 'OLD', 'NEW') not null default 'global'";
\r
264 // Update notes (these will be set as task text!)
\r
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.";
\r
268 case "0.6.8": // SQL queries for v0.6.8
\r
269 // Update notes (these will be set as task text!)
\r
270 $UPDATE_NOTES = "<STRONG>setcookie()</STRONG> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.";
\r
273 case "0.6.9": // SQL queries for v0.6.9
\r
274 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Admin-Management' WHERE action = 'admins' AND what='' LIMIT 1";
\r
276 // Update notes (these will be set as task text!)
\r
277 $UPDATE_NOTES = "Verwaltung nach Management umbenannt.";
\r
282 default: // Do stuff when extension is loaded
\r
286 // Language file prefix
\r
287 $EXT_LANG_PREFIX = "admins";
\r
289 // Extension is always active?
\r
290 $EXT_ALWAYS_ACTIVE = "N";
\r