]> git.mxchange.org Git - mailer.git/blob - 0.2.1/inc/extensions/ext-admins.php
Code rewritings, load base config improved and many minor fixes...
[mailer.git] / 0.2.1 / inc / extensions / ext-admins.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 04/11/2004 *\r
4  * ================                             Last change: 10/29/2004 *\r
5  *                                                                      *\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
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\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
22  *                                                                      *\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
27  *                                                                      *\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
33 \r
34 // Some security stuff...\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
38         require($INC);\r
39 }\r
40 \r
41 // Version of this extension\r
42 $EXT_VERSION = "0.6.9";\r
43 \r
44 // Auto-set extension version\r
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;\r
46 \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
49 \r
50 switch ($EXT_LOAD_MODE)\r
51 {\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&ouml;schen oder Passwort/E-Mail Adresse &auml;ndern.', '1')";\r
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')";\r
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')";\r
58         break;\r
59 \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
66         break;\r
67 \r
68 case "activate": // Do stuff when admin activates this extension\r
69         // SQL commands to run\r
70         $SQLs[] = "";\r
71         break;\r
72 \r
73 case "deactivate": // Do stuff when admin deactivates this extension\r
74         // SQL commands to run\r
75         $SQLs[] = "";\r
76         break;\r
77 \r
78 case "update": // Update an extension\r
79         switch ($EXT_VER)\r
80         {\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
83 \r
84                 // Update notes (these will be set as task text!)\r
85                 $UPDATE_NOTES = "F&uuml;gt den Men&uuml;punkt &quot;Admin kontaktieren&quot; hinzu.";\r
86                 break;\r
87 \r
88         case "0.3": // SQL queries for v0.3\r
89                 // Add admin menu\r
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')";\r
91 \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
94 \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
97 \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
107 KEY (admin_id),\r
108 PRIMARY KEY (id)\r
109 ) TYPE=MyISAM";\r
110 \r
111                 // Update notes (these will be set as task text!)\r
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.";\r
113                 break;\r
114 \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
117                 break;\r
118 \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
125 KEY (admin_id),\r
126 PRIMARY KEY (id)\r
127 ) TYPE=MyISAM";\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&ouml;nnen dies (derzeit) jedoch erst, wenn einmal die Mail versendet wurde!', '5')";\r
129 \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&auml;ssig wird weiter an alle versendet.";\r
132                 break;\r
133 \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
136 \r
137                 // Update notes (these will be set as task text!)\r
138                 $UPDATE_NOTES = "Admins-Mails-Tabelle geleert.";\r
139 \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 = "&amp;admin= in &amp;amp;admin= umgewandelt.";\r
143                 break;\r
144 \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
148                 break;\r
149 \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
153                 break;\r
154 \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&uuml;cksichtigt.";\r
158                 break;\r
159 \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
163                 break;\r
164 \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
168                 break;\r
169 \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
173                 break;\r
174 \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&oumlscht, wenn Admin entfernt wird.";\r
178                 break;\r
179 \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&ouml;schen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.";\r
183                 break;\r
184 \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> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";\r
188                 break;\r
189 \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
193                 break;\r
194 \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&uuml;punkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.";\r
198                 break;\r
199 \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
202 \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
205                 break;\r
206 \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&auml;ndert.";\r
210                 break;\r
211 \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
214 \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
217                 break;\r
218 \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&uuml;tzt.";\r
222                 break;\r
223 \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 &quot;ACL Einstellen&quot; zum Admin-Kontaktformular korregiert.";\r
227                 break;\r
228 \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
232                 break;\r
233 \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
237                 break;\r
238 \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
242                 break;\r
243 \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&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.";\r
247                 break;\r
248 \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&uuml;r die Include-Befehle.";\r
252                 break;\r
253 \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
256 \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
259                 break;\r
260 \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
263 \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 &Auml;ndern von Administratoren.";\r
266                 break;\r
267 \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
271                 break;\r
272 \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
275 \r
276                 // Update notes (these will be set as task text!)\r
277                 $UPDATE_NOTES = "Verwaltung nach Management umbenannt.";\r
278                 break;\r
279         }\r
280         break;\r
281 \r
282 default: // Do stuff when extension is loaded\r
283         break;\r
284 }\r
285 \r
286 // Language file prefix\r
287 $EXT_LANG_PREFIX = "admins";\r
288 \r
289 // Extension is always active?\r
290 $EXT_ALWAYS_ACTIVE = "N";\r
291 \r
292 //\r
293 ?>\r