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 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
38 // @TODO Remove double tabs from all lines
39 switch (getCurrentExtensionVersion()) {
40 case '0.2.0': // SQL queries for v0.2
41 addAdminMenuSql('admins','admins_contact','Admin kontaktieren','Kontaktiert einen Admin per Mail oder Nachricht (nur wenn messaging-Erweiterung installiert ist).',2);
43 // Update notes (these will be set as task text!)
44 setExtensionUpdateNotes("Fügt den Menüpunkt "Admin kontaktieren" hinzu.");
47 case '0.3.0': // SQL queries for v0.3
49 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);
51 // Which is the default setting when you create a new admin login?
52 addConfigAddSql('admins_default_acl', "ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
54 // Default is deny everything
55 addExtensionAddTableColumnSql('admins', 'default_acl', "ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
57 // But allow current admin everything (THIS SHALL BE YOU!)
58 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `default_acl`='allow' WHERE `id`=".bigintval(getCurrentAdminId())." LIMIT 1");
59 addDropTableSql('admins_acls');
60 addCreateTableSql('admins_acls', "
61 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
62 `admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
63 `action_menu` VARCHAR(255) NOT NULL DEFAULT '',
64 `what_menu` VARCHAR(255) NOT NULL DEFAULT '',
65 `access_mode` ENUM('deny','allow') NOT NULL DEFAULT 'deny',
68 'Access control lines (ACLs)');
70 // Update notes (these will be set as task text!)
71 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>");
74 case '0.3.1': // SQL queries for v0.3.1
75 addExtensionChangeTableColumnSql('admins_acls', 'id', 'id', 'BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT');
78 case '0.4.0': // SQL queries for v0.4.0
79 addDropTableSql('admins_mails');
80 addCreateTableSql('admins_mails', "
81 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
82 `admin_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
83 `mail_template` VARCHAR(255) NOT NULL,
86 'Mail template -> admin connection table');
87 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)");
89 // Update notes (these will be set as task text!)
90 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.");
93 case '0.4.1': // SQL queries for v0.4.1
94 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE mail_template LIKE '% %'");
96 // Update notes (these will be set as task text!)
97 setExtensionUpdateNotes("Admins-Mails-Tabelle geleert.");
99 case '0.4.4': // SQL queries for v0.4.4
100 // Update notes (these will be set as task text!)
101 setExtensionUpdateNotes("&admin= in &amp;admin= umgewandelt.");
104 case '0.4.5': // SQL queries for v0.4.5
105 // Update notes (these will be set as task text!)
106 setExtensionUpdateNotes("Vorbereitet auf Cache-System");
109 case '0.4.6': // SQL queries for v0.4.6
110 // Update notes (these will be set as task text!)
111 setExtensionUpdateNotes("Problem mit cache-Erweiterung gefixt. Der Admin-Bereich war permanent gesperrt.");
114 case '0.4.7': // SQL queries for v0.4.7
115 // Update notes (these will be set as task text!)
116 setExtensionUpdateNotes("Es wurde die Zeitmarke der Cache-Datei admins.cache mit berücksichtigt.");
119 case '0.4.8': // SQL queries for v0.4.8
120 // Update notes (these will be set as task text!)
121 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
124 case '0.4.9': // SQL queries for v0.4.9
125 // Update notes (these will be set as task text!)
126 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
129 case '0.5.0': // SQL queries for v0.5.0
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.1': // SQL queries for v0.5.1
135 // Update notes (these will be set as task text!)
136 setExtensionUpdateNotes("Cache wird endlich gelöscht, wenn Admin entfernt wird.");
139 case '0.5.2': // SQL queries for v0.5.2
140 // Update notes (these will be set as task text!)
141 setExtensionUpdateNotes("Löschen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.");
144 case '0.5.3': // SQL queries for v0.5.3
145 // Update notes (these will be set as task text!)
146 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
149 case '0.5.4': // SQL queries for v0.5.4
150 // Update notes (these will be set as task text!)
151 setExtensionUpdateNotes("IP-Nummer und Browserbezeichnung wird in Admin-Mails eingesetzt.");
154 case '0.5.5': // SQL queries for v0.5.5
155 // Update notes (these will be set as task text!)
156 setExtensionUpdateNotes("Menüpunkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.");
159 case '0.5.6': // SQL queries for v0.5.6
160 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='admins_contct' WHERE `what`='admins_contact' LIMIT 1");
162 // Update notes (these will be set as task text!)
163 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
166 case '0.5.7': // SQL queries for v0.5.7
167 // Update notes (these will be set as task text!)
168 setExtensionUpdateNotes("Links wegen <strong>what=admins_contct</strong> geändert.");
171 case '0.5.8': // SQL queries for v0.5.8
172 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='admins_contct' WHERE `what`='admins_contact' LIMIT 1");
174 // Update notes (these will be set as task text!)
175 setExtensionUpdateNotes("Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.");
178 case '0.5.9': // SQL queries for v0.5.9
179 // Update notes (these will be set as task text!)
180 setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen geschützt.");
183 case '0.6.0': // SQL queries for v0.6.0
184 // Update notes (these will be set as task text!)
185 setExtensionUpdateNotes("Link in "ACL Einstellen" zum Admin-Kontaktformular korregiert.");
188 case '0.6.1': // SQL queries for v0.6.1
189 // Update notes (these will be set as task text!)
190 setExtensionUpdateNotes("Speichern von Admin-Accounts klappt wieder.");
193 case '0.6.2': // SQL queries for v0.6.2
194 // Update notes (these will be set as task text!)
195 setExtensionUpdateNotes("Bitte verschieben Sie die admins-Templates (Ordner: {?PATH?}/templates/de/emails/) in den neuen Order admins!");
198 case '0.6.3': // SQL queries for v0.6.3
199 // Update notes (these will be set as task text!)
200 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
203 case '0.6.4': // SQL queries for v0.6.4
204 // Update notes (these will be set as task text!)
205 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.");
208 case '0.6.5': // SQL queries for v0.6.5
209 // Update notes (these will be set as task text!)
210 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
213 case '0.6.6': // SQL queries for v0.5.6
214 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='admins_contct' WHERE `what`='admins_contact' LIMIT 1");
216 // Update notes (these will be set as task text!)
217 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
220 case '0.6.7': // SQL queries for v0.6.7
221 addExtensionAddTableColumnSql('admins', 'la_mode', "ENUM('global','OLD','NEW') NOT NULL DEFAULT 'global'");
223 // Update notes (these will be set as task text!)
224 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.");
227 case '0.6.8': // SQL queries for v0.6.8
228 // Update notes (these will be set as task text!)
229 setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
232 case '0.6.9': // SQL queries for v0.6.9
233 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='Admin-Management' WHERE `action`='admins' AND (`what`='' OR `what` IS NULL) LIMIT 1");
235 // Update notes (these will be set as task text!)
236 setExtensionUpdateNotes("Verwaltung nach Management umbenannt.");
239 case '0.7.0': // SQL queries for v0.7.0
240 addExtensionAddTableColumnSql('admins', 'login_failtures', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
241 addExtensionAddTableColumnSql('admins', 'last_failture', "TIMESTAMP NULL DEFAULT NULL");
243 // Update notes (these will be set as task text!)
244 setExtensionUpdateNotes("Veraltetes Update.");
247 case '0.7.1': // SQL queries for v0.7.1
249 registerFilter(__FILE__, __LINE__, 'sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', FALSE, TRUE, isExtensionDryRun());
251 // Update notes (these will be set as task text!)
252 setExtensionUpdateNotes("Filter hinzugefügt und ist von <strong>sql_patches</strong> abhängig.");
255 case '0.7.2': // SQL queries for v0.7.2
256 addExtensionDropTableColumnSql('admins', 'login_failtures');
257 addExtensionDropTableColumnSql('admins', 'last_failture');
258 addExtensionAddTableColumnSql('admins', 'login_failures', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
259 addExtensionAddTableColumnSql('admins', 'last_failure', "TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
261 // Update notes (these will be set as task text!)
262 setExtensionUpdateNotes("Schreibweise korregiert.");
265 case '0.7.3': // SQL queries for v0.7.3
266 addExtensionAddTableColumnSql('admins', 'expert_settings', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
267 addExtensionAddTableColumnSql('admins', 'expert_warning', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
269 // Update notes (these will be set as task text!)
270 setExtensionUpdateNotes("Entwicklereinstellungen sind nun hinzugekommen.");
273 case '0.7.4': // SQL queries for v0.7.4
275 registerFilter(__FILE__, __LINE__, 'do_admin_login_done', 'RESET_ADMINS_LOGIN_FAILURES', FALSE, TRUE, isExtensionDryRun());
276 registerFilter(__FILE__, __LINE__, 'do_admin_login_pass', 'COUNT_ADMINS_LOGIN_FAILURE', FALSE, TRUE, isExtensionDryRun());
278 // Update notes (these will be set as task text!)
279 setExtensionUpdateNotes("Filter hinzugefuegt.");
282 case '0.7.5': // SQL queries for v0.7.5
284 registerFilter(__FILE__, __LINE__, 'do_admin_login_done', 'REHASH_ADMINS_PASSWORD', FALSE, TRUE, isExtensionDryRun());
286 // Update notes (these will be set as task text!)
287 setExtensionUpdateNotes("Filter zum Rehashen des Adminpassworts nach erfolgtem Login hinzugefügt.");
290 case '0.7.6': // SQL queries for v0.7.6
291 addExtensionChangeTableColumnSql('admins', 'last_failure', 'last_failure', 'TIMESTAMP NULL DEFAULT NULL');
293 // Update notes (these will be set as task text!)
294 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
297 case '0.7.7': // SQL queries for v0.7.7
298 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`='list_admins_acls' WHERE `what`='config_admins' LIMIT 1");
300 // Update notes (these will be set as task text!)
301 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
304 case '0.7.8': // SQL queries for v0.7.8
305 // Update notes (these will be set as task text!)
306 setExtensionUpdateNotes("Abgekürzte Bezeichnungen können für Missverständnisse am Code sorgen. Daher wurde der Spaltenalias <strong>def_acl</strong> entfernt.");
309 case '0.7.9': // SQL queries for v0.7.9
310 addExtensionChangeTableColumnSql('admins_mails', 'admin_id', 'admin_id', 'BIGINT(20) UNSIGNED NULL DEFAULT NULL');
311 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET `admin_id` = NULL WHERE `admin_id`=0');
312 addExtensionSql("DELETE FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template` IN ('admin-del_links', 'back-admin', 'done-admin', 'order-admin', 'register-admin')");
314 // Update notes (these will be set as task text!)
315 setExtensionUpdateNotes("Spalte <strong>admin_id</strong> ist jetzt Ausgangswert NULL, alte Mail-Templates bereinigt.");