2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 06/25/2013 *
4 * =================== Last change: 06/25/2013 *
6 * -------------------------------------------------------------------- *
7 * File : mode-update.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Administrator management *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Admin-Accountsverwaltung *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // @TODO Remove double tabs from all lines
44 switch (getCurrentExtensionVersion()) {
45 case '0.2.0': // SQL queries for v0.2
46 addAdminMenuSql('admins','admins_contact','Admin kontaktieren','Kontaktiert einen Admin per Mail oder Nachricht (nur wenn messaging-Erweiterung installiert ist).',2);
48 // Update notes (these will be set as task text!)
49 setExtensionUpdateNotes("Fügt den Menüpunkt "Admin kontaktieren" hinzu.");
52 case '0.3.0': // SQL queries for v0.3
54 addAdminMenuSql('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);
56 // Which is the default setting when you create a new admin login?
57 addConfigAddSql('admins_default_acl', "ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
59 // Default is deny everything
60 addExtensionAddTableColumnSql('admins', 'default_acl', "ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
62 // But allow current admin everything (THIS SHALL BE YOU!)
63 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `default_acl`='allow' WHERE `id`=".bigintval(getCurrentAdminId())." LIMIT 1");
64 addDropTableSql('admins_acls');
65 addCreateTableSql('admins_acls', "
66 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
67 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
68 `action_menu` VARCHAR(255) NOT NULL DEFAULT '',
69 `what_menu` VARCHAR(255) NOT NULL DEFAULT '',
70 `access_mode` ENUM('deny','allow') NOT NULL DEFAULT 'deny',
73 'Access control lines (ACLs)');
75 // Update notes (these will be set as task text!)
76 setExtensionUpdateNotes("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. <strong>Nur Sie haben momentan Vollzugriff auf den Adminbereich.</strong>");
79 case '0.3.1': // SQL queries for v0.3.1
80 addExtensionChangeTableColumnSql('admins_acls', 'id', 'id', 'BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT');
83 case '0.4.0': // SQL queries for v0.4.0
84 addDropTableSql('admins_mails');
85 addCreateTableSql('admins_mails', "
86 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
87 `admin_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
88 `mail_template` VARCHAR(255) NOT NULL,
91 'Mail template -> admin connection table');
92 addExtensionSql("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)");
94 // Update notes (these will be set as task text!)
95 setExtensionUpdateNotes("Kontrollieren Sie, welche Mails welcher Admin oder alle (admin_id=0) bekommen soll oder im UserLog (admin_id=-1) verzeichnet werden soll. Standardmässig wird weiter an alle versendet.");
98 case '0.4.1': // SQL queries for v0.4.1
99 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE mail_template LIKE '% %'");
101 // Update notes (these will be set as task text!)
102 setExtensionUpdateNotes("Admins-Mails-Tabelle geleert.");
104 case '0.4.4': // SQL queries for v0.4.4
105 // Update notes (these will be set as task text!)
106 setExtensionUpdateNotes("&admin= in &amp;admin= umgewandelt.");
109 case '0.4.5': // SQL queries for v0.4.5
110 // Update notes (these will be set as task text!)
111 setExtensionUpdateNotes("Vorbereitet auf Cache-System");
114 case '0.4.6': // SQL queries for v0.4.6
115 // Update notes (these will be set as task text!)
116 setExtensionUpdateNotes("Problem mit cache-Erweiterung gefixt. Der Admin-Bereich war permanent gesperrt.");
119 case '0.4.7': // SQL queries for v0.4.7
120 // Update notes (these will be set as task text!)
121 setExtensionUpdateNotes("Es wurde die Zeitmarke der Cache-Datei admins.cache mit berücksichtigt.");
124 case '0.4.8': // SQL queries for v0.4.8
125 // Update notes (these will be set as task text!)
126 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
129 case '0.4.9': // SQL queries for v0.4.9
130 // Update notes (these will be set as task text!)
131 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
134 case '0.5.0': // SQL queries for v0.5.0
135 // Update notes (these will be set as task text!)
136 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
139 case '0.5.1': // SQL queries for v0.5.1
140 // Update notes (these will be set as task text!)
141 setExtensionUpdateNotes("Cache wird endlich gelöscht, wenn Admin entfernt wird.");
144 case '0.5.2': // SQL queries for v0.5.2
145 // Update notes (these will be set as task text!)
146 setExtensionUpdateNotes("Löschen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.");
149 case '0.5.3': // SQL queries for v0.5.3
150 // Update notes (these will be set as task text!)
151 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
154 case '0.5.4': // SQL queries for v0.5.4
155 // Update notes (these will be set as task text!)
156 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
159 case '0.5.5': // SQL queries for v0.5.5
160 // Update notes (these will be set as task text!)
161 setExtensionUpdateNotes("Menüpunkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.");
164 case '0.5.6': // SQL queries for v0.5.6
165 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='admins_contct' WHERE `what`='admins_contact' LIMIT 1");
167 // Update notes (these will be set as task text!)
168 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
171 case '0.5.7': // SQL queries for v0.5.7
172 // Update notes (these will be set as task text!)
173 setExtensionUpdateNotes("Links wegen <strong>what=admins_contct</strong> geändert.");
176 case '0.5.8': // SQL queries for v0.5.8
177 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='admins_contct' WHERE `what`='admins_contact' LIMIT 1");
179 // Update notes (these will be set as task text!)
180 setExtensionUpdateNotes("Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.");
183 case '0.5.9': // SQL queries for v0.5.9
184 // Update notes (these will be set as task text!)
185 setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen geschützt.");
188 case '0.6.0': // SQL queries for v0.6.0
189 // Update notes (these will be set as task text!)
190 setExtensionUpdateNotes("Link in "ACL Einstellen" zum Admin-Kontaktformular korregiert.");
193 case '0.6.1': // SQL queries for v0.6.1
194 // Update notes (these will be set as task text!)
195 setExtensionUpdateNotes("Speichern von Admin-Accounts klappt wieder.");
198 case '0.6.2': // SQL queries for v0.6.2
199 // Update notes (these will be set as task text!)
200 setExtensionUpdateNotes("Bitte verschieben Sie die admins-Templates (Ordner: {?PATH?}/templates/de/emails/) in den neuen Order admins!");
203 case '0.6.3': // SQL queries for v0.6.3
204 // Update notes (these will be set as task text!)
205 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
208 case '0.6.4': // SQL queries for v0.6.4
209 // Update notes (these will be set as task text!)
210 setExtensionUpdateNotes("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.");
213 case '0.6.5': // SQL queries for v0.6.5
214 // Update notes (these will be set as task text!)
215 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
218 case '0.6.6': // SQL queries for v0.5.6
219 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='admins_contct' WHERE `what`='admins_contact' LIMIT 1");
221 // Update notes (these will be set as task text!)
222 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
225 case '0.6.7': // SQL queries for v0.6.7
226 addExtensionAddTableColumnSql('admins', 'la_mode', "ENUM('global','OLD','NEW') NOT NULL DEFAULT 'global'");
228 // Update notes (these will be set as task text!)
229 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>. Beseitigung eines Fehlers <strong>HTTP_POSR_VARS</strong> beim Ändern von Administratoren.");
232 case '0.6.8': // SQL queries for v0.6.8
233 // Update notes (these will be set as task text!)
234 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
237 case '0.6.9': // SQL queries for v0.6.9
238 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Admin-Management' WHERE `action`='admins' AND (`what`='' OR `what` IS NULL) LIMIT 1");
240 // Update notes (these will be set as task text!)
241 setExtensionUpdateNotes("Verwaltung nach Management umbenannt.");
244 case '0.7.0': // SQL queries for v0.7.0
245 addExtensionAddTableColumnSql('admins', 'login_failtures', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
246 addExtensionAddTableColumnSql('admins', 'last_failture', "TIMESTAMP NULL DEFAULT NULL");
248 // Update notes (these will be set as task text!)
249 setExtensionUpdateNotes("Veraltetes Update.");
252 case '0.7.1': // SQL queries for v0.7.1
254 registerFilter(__FILE__, __LINE__, 'sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', FALSE, TRUE, isExtensionDryRun());
256 // Update notes (these will be set as task text!)
257 setExtensionUpdateNotes("Filter hinzugefügt und ist von <strong>sql_patches</strong> abhängig.");
260 case '0.7.2': // SQL queries for v0.7.2
261 addExtensionDropTableColumnSql('admins', 'login_failtures');
262 addExtensionDropTableColumnSql('admins', 'last_failture');
263 addExtensionAddTableColumnSql('admins', 'login_failures', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
264 addExtensionAddTableColumnSql('admins', 'last_failure', "TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
266 // Update notes (these will be set as task text!)
267 setExtensionUpdateNotes("Schreibweise korregiert.");
270 case '0.7.3': // SQL queries for v0.7.3
271 addExtensionAddTableColumnSql('admins', 'expert_settings', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
272 addExtensionAddTableColumnSql('admins', 'expert_warning', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
274 // Update notes (these will be set as task text!)
275 setExtensionUpdateNotes("Entwicklereinstellungen sind nun hinzugekommen.");
278 case '0.7.4': // SQL queries for v0.7.4
280 registerFilter(__FILE__, __LINE__, 'do_admin_login_done', 'RESET_ADMINS_LOGIN_FAILURES', FALSE, TRUE, isExtensionDryRun());
281 registerFilter(__FILE__, __LINE__, 'do_admin_login_pass', 'COUNT_ADMINS_LOGIN_FAILURE', FALSE, TRUE, isExtensionDryRun());
283 // Update notes (these will be set as task text!)
284 setExtensionUpdateNotes("Filter hinzugefuegt.");
287 case '0.7.5': // SQL queries for v0.7.5
289 registerFilter(__FILE__, __LINE__, 'do_admin_login_done', 'REHASH_ADMINS_PASSWORD', FALSE, TRUE, isExtensionDryRun());
291 // Update notes (these will be set as task text!)
292 setExtensionUpdateNotes("Filter zum Rehashen des Adminpassworts nach erfolgtem Login hinzugefügt.");
295 case '0.7.6': // SQL queries for v0.7.6
296 addExtensionChangeTableColumnSql('admins', 'last_failure', 'last_failure', 'TIMESTAMP NULL DEFAULT NULL');
298 // Update notes (these will be set as task text!)
299 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
302 case '0.7.7': // SQL queries for v0.7.7
303 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='list_admins_acls' WHERE `what`='config_admins' LIMIT 1");
305 // Update notes (these will be set as task text!)
306 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
309 case '0.7.8': // SQL queries for v0.7.8
310 // Update notes (these will be set as task text!)
311 setExtensionUpdateNotes("Abgekürzte Bezeichnungen können für Missverständnisse am Code sorgen. Daher wurde der Spaltenalias <strong>def_acl</strong> entfernt.");
314 case '0.7.9': // SQL queries for v0.7.9
315 addExtensionChangeTableColumnSql('admins_mails', 'admin_id', 'admin_id', 'BIGINT(20) UNSIGNED NULL DEFAULT NULL');
316 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET `admin_id` = NULL WHERE `admin_id`=0');
317 addExtensionSql("DELETE FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template` IN ('admin-del_links', 'back-admin', 'done-admin', 'order-admin', 'register-admin')");
319 // Update notes (these will be set as task text!)
320 setExtensionUpdateNotes("Spalte <strong>admin_id</strong> ist jetzt Ausgangswert NULL, alte Mail-Templates bereinigt.");