1bd73ad41088c05e533afbbfe32b7d762da88ef5
[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  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
14  * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
15  * For more information visit: http://mxchange.org                      *
16  *                                                                      *
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.                                  *
21  *                                                                      *
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.                         *
26  *                                                                      *
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,               *
30  * MA  02110-1301  USA                                                  *
31  ************************************************************************/
32
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
35         die();
36 } // END - if
37
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);
42
43                                 // Update notes (these will be set as task text!)
44                                 setExtensionUpdateNotes("F&uuml;gt den Men&uuml;punkt &quot;Admin kontaktieren&quot; hinzu.");
45                                 break;
46
47                         case '0.3.0': // SQL queries for v0.3
48                                 // Add admin menu
49                                 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);
50
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'");
53
54                                 // Default is deny everything
55                                 addExtensionAddTableColumnSql('admins', 'default_acl', "ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
56
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',
66 PRIMARY KEY (`id`),
67 INDEX (`admin_id`)",
68                                         'Access control lines (ACLs)');
69
70                                 // Update notes (these will be set as task text!)
71                                 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>");
72                                 break;
73
74                         case '0.3.1': // SQL queries for v0.3.1
75                                 addExtensionChangeTableColumnSql('admins_acls', 'id', 'id', 'BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT');
76                                 break;
77
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,
84 PRIMARY KEY (`id`),
85 INDEX (`admin_id`)",
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&ouml;nnen dies (derzeit) jedoch erst, wenn einmal die Mail versendet wurde!',5)");
88
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&auml;ssig wird weiter an alle versendet.");
91                                 break;
92
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 '% %'");
95
96                                 // Update notes (these will be set as task text!)
97                                 setExtensionUpdateNotes("Admins-Mails-Tabelle geleert.");
98
99                         case '0.4.4': // SQL queries for v0.4.4
100                                 // Update notes (these will be set as task text!)
101                                 setExtensionUpdateNotes("&amp;admin= in &amp;amp;admin= umgewandelt.");
102                                 break;
103
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");
107                                 break;
108
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.");
112                                 break;
113
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&uuml;cksichtigt.");
117                                 break;
118
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.");
122                                 break;
123
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.");
127                                 break;
128
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.");
132                                 break;
133
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&oumlscht, wenn Admin entfernt wird.");
137                                 break;
138
139                         case '0.5.2': // SQL queries for v0.5.2
140                                 // Update notes (these will be set as task text!)
141                                 setExtensionUpdateNotes("L&ouml;schen von Admin-Accounts repariert und HTML-Code ausgelagert in Templates.");
142                                 break;
143
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> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
147                                 break;
148
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.");
152                                 break;
153
154                         case '0.5.5': // SQL queries for v0.5.5
155                                 // Update notes (these will be set as task text!)
156                                 setExtensionUpdateNotes("Men&uuml;punkt Admin-Mails korregiert: SQL-Anweisung war fehlerhaft; und HTML-Code in Templates ausgelagert.");
157                                 break;
158
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");
161
162                                 // Update notes (these will be set as task text!)
163                                 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
164                                 break;
165
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&auml;ndert.");
169                                 break;
170
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");
173
174                                 // Update notes (these will be set as task text!)
175                                 setExtensionUpdateNotes("Ein Punkt in der Versionsnummernliste verhinderte das 0.5.6-Update.");
176                                 break;
177
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&uuml;tzt.");
181                                 break;
182
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 &quot;ACL Einstellen&quot; zum Admin-Kontaktformular korregiert.");
186                                 break;
187
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.");
191                                 break;
192
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!");
196                                 break;
197
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.");
201                                 break;
202
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&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.");
206                                 break;
207
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&uuml;r die Include-Befehle.");
211                                 break;
212
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");
215
216                                 // Update notes (these will be set as task text!)
217                                 setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>.");
218                                 break;
219
220                         case '0.6.7': // SQL queries for v0.6.7
221                                 addExtensionAddTableColumnSql('admins', 'la_mode', "ENUM('global','OLD','NEW') NOT NULL DEFAULT 'global'");
222
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 &Auml;ndern von Administratoren.");
225                                 break;
226
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.");
230                                 break;
231
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");
234
235                                 // Update notes (these will be set as task text!)
236                                 setExtensionUpdateNotes("Verwaltung nach Management umbenannt.");
237                                 break;
238
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");
242
243                                 // Update notes (these will be set as task text!)
244                                 setExtensionUpdateNotes("Veraltetes Update.");
245                                 break;
246
247                         case '0.7.1': // SQL queries for v0.7.1
248                                 // Add filters
249                                 registerFilter(__FILE__, __LINE__, 'sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', FALSE, TRUE, isExtensionDryRun());
250
251                                 // Update notes (these will be set as task text!)
252                                 setExtensionUpdateNotes("Filter hinzugef&uuml;gt und ist von <strong>sql_patches</strong> abh&auml;ngig.");
253                                 break;
254
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'");
260
261                                 // Update notes (these will be set as task text!)
262                                 setExtensionUpdateNotes("Schreibweise korregiert.");
263                                 break;
264
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'");
268
269                                 // Update notes (these will be set as task text!)
270                                 setExtensionUpdateNotes("Entwicklereinstellungen sind nun hinzugekommen.");
271                                 break;
272
273                         case '0.7.4': // SQL queries for v0.7.4
274                                 // Add filter
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());
277
278                                 // Update notes (these will be set as task text!)
279                                 setExtensionUpdateNotes("Filter hinzugefuegt.");
280                                 break;
281
282                         case '0.7.5': // SQL queries for v0.7.5
283                                 // Add filter
284                                 registerFilter(__FILE__, __LINE__, 'do_admin_login_done', 'REHASH_ADMINS_PASSWORD', FALSE, TRUE, isExtensionDryRun());
285
286                                 // Update notes (these will be set as task text!)
287                                 setExtensionUpdateNotes("Filter zum Rehashen des Adminpassworts nach erfolgtem Login hinzugef&uuml;gt.");
288                                 break;
289
290                         case '0.7.6': // SQL queries for v0.7.6
291                                 addExtensionChangeTableColumnSql('admins', 'last_failure', 'last_failure', 'TIMESTAMP NULL DEFAULT NULL');
292
293                                 // Update notes (these will be set as task text!)
294                                 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
295                                 break;
296
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");
299
300                                 // Update notes (these will be set as task text!)
301                                 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
302                                 break;
303
304                         case '0.7.8': // SQL queries for v0.7.8
305                                 // Update notes (these will be set as task text!)
306                                 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.");
307                                 break;
308
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')");
313
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.");
316                                 break;
317                 } // END - switch
318
319 // [EOF]
320 ?>