Referal levels for surfbar added (unfinished)
[mailer.git] / inc / extensions / ext-admins.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 04/11/2004 *
4  * ================                             Last change: 10/29/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-admins.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Administrator management                         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Admin-Accountsverwaltung                         *
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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 // Version of this extension
42 $EXT_VERSION = "0.6.9";
43
44 // Auto-set extension version
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
46
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");
49
50 switch ($EXT_LOAD_MODE)
51 {
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&ouml;schen oder Passwort/E-Mail Adresse &auml;ndern.', '1')";
56         $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'admins_add', 'Admin hinzuf&uuml;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 &auml;ndern', 'Bestehende Admin-Accounts bearbeiten: E-Mail-Adresse, Passwort und/oder Login-Name &auml;ndern.', '1')";
58         break;
59
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";
66         break;
67
68 case "activate": // Do stuff when admin activates this extension
69         // SQL commands to run
70         $SQLs[] = "";
71         break;
72
73 case "deactivate": // Do stuff when admin deactivates this extension
74         // SQL commands to run
75         $SQLs[] = "";
76         break;
77
78 case "update": // Update an extension
79         switch ($EXT_VER)
80         {
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')";
83
84                 // Update notes (these will be set as task text!)
85                 $UPDATE_NOTES = "F&uuml;gt den Men&uuml;punkt &quot;Admin kontaktieren&quot; hinzu.";
86                 break;
87
88         case "0.3": // SQL queries for v0.3
89                 // Add admin menu
90                 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('admins', 'config_admins', 'ACL einstellen', 'Richten Sie Zugriffskontrollzeilen f&uuml;r jeden Admin individuell ein, um ihm nur bestimmte Bereiche des Admin-Bereiches zug&auml;nglich zu machen oder zu sperren.', '4')";
91
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'";
94
95                 // Default is deny everything
96                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD default_acl enum('deny', 'allow') not null default 'deny'";
97
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',
107 KEY (admin_id),
108 PRIMARY KEY (id)
109 ) TYPE=MyISAM";
110
111                 // Update notes (these will be set as task text!)
112                 $UPDATE_NOTES = "Sogn. ACLs werden hinzugef&uuml;gt: <STRONG>A</STRONG>ccess <STRONG>C</STRONG>ontrol <STRONG>L</STRONG>ines sind zu deutsch Zugriffkontrollzeilen, mit denen Sie einstellen k&ouml;nnen, was welcher Admin machen darf oder nicht.";
113                 break;
114
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";
117                 break;
118
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,
125 KEY (admin_id),
126 PRIMARY KEY (id)
127 ) TYPE=MyISAM";
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&ouml;nnen dies (derzeit) jedoch erst, wenn einmal die Mail versendet wurde!', '5')";
129
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&auml;ssig wird weiter an alle versendet.";
132                 break;
133
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 '% %'";
136
137                 // Update notes (these will be set as task text!)
138                 $UPDATE_NOTES = "Admins-Mails-Tabelle geleert.";
139
140         case "0.4.4": // SQL queries for v0.4.4
141                 // Update notes (these will be set as task text!)
142                 $UPDATE_NOTES = "&amp;admin= in &amp;amp;admin= umgewandelt.";
143                 break;
144
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";
148                 break;
149
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.";
153                 break;
154
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&uuml;cksichtigt.";
158                 break;
159
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.";
163                 break;
164
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.";
168                 break;
169
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.";
173                 break;
174
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&oumlscht, wenn Admin entfernt wird.";
178                 break;
179
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&ouml;schen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.";
183                 break;
184
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=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
188                 break;
189
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.";
193                 break;
194
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&uuml;punkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.";
198                 break;
199
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";
202
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>.";
205                 break;
206
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&auml;ndert.";
210                 break;
211
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";
214
215                 // Update notes (these will be set as task text!)
216                 $UPDATE_NOTES = "Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.";
217                 break;
218
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&uuml;tzt.";
222                 break;
223
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 &quot;ACL Einstellen&quot; zum Admin-Kontaktformular korregiert.";
227                 break;
228
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.";
232                 break;
233
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!";
237                 break;
238
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.";
242                 break;
243
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&uuml; frei (Allow), dann kann der Admin auch die Untermen&uuml;s erreichen. Zudem k&ouml;nnen Sie gezielte Untermen&uuml;s im freigegeben Hauptmen&uuml; dennoch sperren.";
247                 break;
248
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&uuml;r die Include-Befehle.";
252                 break;
253
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";
256
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>.";
259                 break;
260
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'";
263
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 &Auml;ndern von Administratoren.";
266                 break;
267
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.";
271                 break;
272
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";
275
276                 // Update notes (these will be set as task text!)
277                 $UPDATE_NOTES = "Verwaltung nach Management umbenannt.";
278                 break;
279         }
280         break;
281
282 default: // Do stuff when extension is loaded
283         break;
284 }
285
286 // Language file prefix
287 $EXT_LANG_PREFIX = "admins";
288
289 // Extension is always active?
290 $EXT_ALWAYS_ACTIVE = "N";
291
292 //
293 ?>