Heacy rewrite/cleanup:
[mailer.git] / inc / extensions / admins / mode-update.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 06/25/2013 *
4  * ===================                          Last change: 06/25/2013 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : mode-update.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Administrator management                         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Admin-Accountsverwaltung                         *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                      *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
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);
47
48                                 // Update notes (these will be set as task text!)
49                                 setExtensionUpdateNotes("F&uuml;gt den Men&uuml;punkt &quot;Admin kontaktieren&quot; hinzu.");
50                                 break;
51
52                         case '0.3.0': // SQL queries for v0.3
53                                 // Add admin menu
54                                 addAdminMenuSql('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);
55
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'");
58
59                                 // Default is deny everything
60                                 addExtensionAddTableColumnSql('admins', 'default_acl', "ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
61
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',
71 PRIMARY KEY (`id`),
72 INDEX (`admin_id`)",
73                                         'Access control lines (ACLs)');
74
75                                 // Update notes (these will be set as task text!)
76                                 setExtensionUpdateNotes("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. <strong>Nur Sie haben momentan Vollzugriff auf den Adminbereich.</strong>");
77                                 break;
78
79                         case '0.3.1': // SQL queries for v0.3.1
80                                 addExtensionChangeTableColumnSql('admins_acls', 'id', 'id', 'BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT');
81                                 break;
82
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,
89 PRIMARY KEY (`id`),
90 INDEX (`admin_id`)",
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&ouml;nnen dies (derzeit) jedoch erst, wenn einmal die Mail versendet wurde!',5)");
93
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&auml;ssig wird weiter an alle versendet.");
96                                 break;
97
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 '% %'");
100
101                                 // Update notes (these will be set as task text!)
102                                 setExtensionUpdateNotes("Admins-Mails-Tabelle geleert.");
103
104                         case '0.4.4': // SQL queries for v0.4.4
105                                 // Update notes (these will be set as task text!)
106                                 setExtensionUpdateNotes("&amp;admin= in &amp;amp;admin= umgewandelt.");
107                                 break;
108
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");
112                                 break;
113
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.");
117                                 break;
118
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&uuml;cksichtigt.");
122                                 break;
123
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.");
127                                 break;
128
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.");
132                                 break;
133
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.");
137                                 break;
138
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&oumlscht, wenn Admin entfernt wird.");
142                                 break;
143
144                         case '0.5.2': // SQL queries for v0.5.2
145                                 // Update notes (these will be set as task text!)
146                                 setExtensionUpdateNotes("L&ouml;schen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.");
147                                 break;
148
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> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
152                                 break;
153
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.");
157                                 break;
158
159                         case '0.5.5': // SQL queries for v0.5.5
160                                 // Update notes (these will be set as task text!)
161                                 setExtensionUpdateNotes("Men&uuml;punkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.");
162                                 break;
163
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");
166
167                                 // Update notes (these will be set as task text!)
168                                 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
169                                 break;
170
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&auml;ndert.");
174                                 break;
175
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");
178
179                                 // Update notes (these will be set as task text!)
180                                 setExtensionUpdateNotes("Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.");
181                                 break;
182
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&uuml;tzt.");
186                                 break;
187
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 &quot;ACL Einstellen&quot; zum Admin-Kontaktformular korregiert.");
191                                 break;
192
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.");
196                                 break;
197
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!");
201                                 break;
202
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.");
206                                 break;
207
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&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.");
211                                 break;
212
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&uuml;r die Include-Befehle.");
216                                 break;
217
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");
220
221                                 // Update notes (these will be set as task text!)
222                                 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
223                                 break;
224
225                         case '0.6.7': // SQL queries for v0.6.7
226                                 addExtensionAddTableColumnSql('admins', 'la_mode', "ENUM('global','OLD','NEW') NOT NULL DEFAULT 'global'");
227
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 &Auml;ndern von Administratoren.");
230                                 break;
231
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.");
235                                 break;
236
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");
239
240                                 // Update notes (these will be set as task text!)
241                                 setExtensionUpdateNotes("Verwaltung nach Management umbenannt.");
242                                 break;
243
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");
247
248                                 // Update notes (these will be set as task text!)
249                                 setExtensionUpdateNotes("Veraltetes Update.");
250                                 break;
251
252                         case '0.7.1': // SQL queries for v0.7.1
253                                 // Add filters
254                                 registerFilter(__FILE__, __LINE__, 'sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', FALSE, TRUE, isExtensionDryRun());
255
256                                 // Update notes (these will be set as task text!)
257                                 setExtensionUpdateNotes("Filter hinzugef&uuml;gt und ist von <strong>sql_patches</strong> abh&auml;ngig.");
258                                 break;
259
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'");
265
266                                 // Update notes (these will be set as task text!)
267                                 setExtensionUpdateNotes("Schreibweise korregiert.");
268                                 break;
269
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'");
273
274                                 // Update notes (these will be set as task text!)
275                                 setExtensionUpdateNotes("Entwicklereinstellungen sind nun hinzugekommen.");
276                                 break;
277
278                         case '0.7.4': // SQL queries for v0.7.4
279                                 // Add filter
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());
282
283                                 // Update notes (these will be set as task text!)
284                                 setExtensionUpdateNotes("Filter hinzugefuegt.");
285                                 break;
286
287                         case '0.7.5': // SQL queries for v0.7.5
288                                 // Add filter
289                                 registerFilter(__FILE__, __LINE__, 'do_admin_login_done', 'REHASH_ADMINS_PASSWORD', FALSE, TRUE, isExtensionDryRun());
290
291                                 // Update notes (these will be set as task text!)
292                                 setExtensionUpdateNotes("Filter zum Rehashen des Adminpassworts nach erfolgtem Login hinzugef&uuml;gt.");
293                                 break;
294
295                         case '0.7.6': // SQL queries for v0.7.6
296                                 addExtensionChangeTableColumnSql('admins', 'last_failure', 'last_failure', 'TIMESTAMP NULL DEFAULT NULL');
297
298                                 // Update notes (these will be set as task text!)
299                                 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
300                                 break;
301
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");
304
305                                 // Update notes (these will be set as task text!)
306                                 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
307                                 break;
308
309                         case '0.7.8': // SQL queries for v0.7.8
310                                 // Update notes (these will be set as task text!)
311                                 setExtensionUpdateNotes("Abgek&uuml;rzte Bezeichnungen k&ouml;nnen f&uuml;r Missverst&auml;ndnisse am Code sorgen. Daher wurde der Spaltenalias <strong>def_acl</strong> entfernt.");
312                                 break;
313
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')");
318
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.");
321                                 break;
322                 } // END - switch
323
324 // [EOF]
325 ?>