Codingstyle PSR12 + array syntax
Hanno Böck

Hanno Böck commited on 2021-10-30 21:18:17
Zeige 148 geänderte Dateien mit 801 Einfügungen und 801 Löschungen.

... ...
@@ -103,7 +103,7 @@ if ($_SESSION['role'] != ROLE_ANONYMOUS && isset($_REQUEST['record']) && isset($
103 103
             $role = find_role($uid, '', true);
104 104
             setup_session($role, $uid);
105 105
             DEBUG("Set Cookie!");
106
-            setcookie('CLIENTCERT_AUTOLOGIN', '1', array('expires'=>strtotime("+ 1 year"), 'path'=>'/', 'secure'=>true, 'httponly'=>true, 'samesite'=>'Lax'));
106
+            setcookie('CLIENTCERT_AUTOLOGIN', '1', ['expires'=>strtotime("+ 1 year"), 'path'=>'/', 'secure'=>true, 'httponly'=>true, 'samesite'=>'Lax']);
107 107
             $destination = 'go/index/index';
108 108
             if (check_path($ret[0]['startpage'])) {
109 109
                 $destination = $ret[0]['startpage'];
... ...
@@ -32,7 +32,7 @@ class DB extends PDO
32 32
         }
33 33
         $username = config('db_user', true);
34 34
         $password = config('db_pass', true);
35
-        parent::__construct($dsn, $username, $password, array(PDO::ATTR_TIMEOUT => "30"));
35
+        parent::__construct($dsn, $username, $password, [PDO::ATTR_TIMEOUT => "30"]);
36 36
     }
37 37
 
38 38
 
... ...
@@ -20,7 +20,7 @@ require_once('inc/debug.php');
20 20
 
21 21
 class Domain
22 22
 {
23
-    protected $data = array();
23
+    protected $data = [];
24 24
     public function __construct($init = null)
25 25
     {
26 26
         $this->setup();
... ...
@@ -61,7 +61,7 @@ class Domain
61 61
 
62 62
     public function loadByID($id)
63 63
     {
64
-        $res = db_query("SELECT * FROM kundendaten.domains WHERE id=?", array($id));
64
+        $res = db_query("SELECT * FROM kundendaten.domains WHERE id=?", [$id]);
65 65
         if ($res->rowCount() < 1) {
66 66
             return false;
67 67
         }
... ...
@@ -73,7 +73,7 @@ class Domain
73 73
     {
74 74
         $raw = $name;
75 75
         $utf8 = idn_to_utf8($raw, 0, INTL_IDNA_VARIANT_UTS46);
76
-        $res = db_query("SELECT * FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=? OR CONCAT_WS('.', domainname, tld)=?", array($raw, $utf8));
76
+        $res = db_query("SELECT * FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=? OR CONCAT_WS('.', domainname, tld)=?", [$raw, $utf8]);
77 77
         if ($res->rowCount() < 1) {
78 78
             return false;
79 79
         }
... ...
@@ -115,7 +115,7 @@ class Domain
115 115
 
116 116
     public function setup()
117 117
     {
118
-        $fields = array();
118
+        $fields = [];
119 119
         $res = db_query("DESCRIBE kundendaten.domains");
120 120
         while ($f = $res->fetch(PDO::FETCH_OBJ)) {
121 121
             $fields[$f->Field] = $f->Default;
... ...
@@ -163,8 +163,8 @@ function get_domain_list($customerno = null, $uid = null)
163 163
         $query .= " kunde={$customerno}";
164 164
     }
165 165
     $query .= " ORDER BY domainname,tld";
166
-    $result = db_query($query, array()); // FIXME Übergebe leeren array um die Warnung zu unterdrücken
167
-    $domains = array();
166
+    $result = db_query($query, []); // FIXME Übergebe leeren array um die Warnung zu unterdrücken
167
+    $domains = [];
168 168
     DEBUG('Result set is '.$result->rowCount()." rows.<br />\n");
169 169
     if ($result->rowCount() > 0) {
170 170
         while ($domain = $result->fetch(PDO::FETCH_OBJ)) {
... ...
@@ -184,7 +184,7 @@ function get_jabberable_domains()
184 184
 
185 185
     $domains = get_domain_list($customerno);
186 186
     DEBUG($domains);
187
-    $result = array( new Domain() );
187
+    $result = [ new Domain() ];
188 188
     $result[0]->id = 0;
189 189
     $result[0]->fqdn = config('masterdomain');
190 190
     foreach ($domains as $dom) {
... ...
@@ -15,7 +15,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 global $config;
18
-$config = array();
18
+$config = [];
19 19
 
20 20
 // either...
21 21
 $config['db_socket'] = '/var/run/mysqld/mysqld-sys.sock';
... ...
@@ -28,7 +28,7 @@ $config['db_user'] = 'username';
28 28
 $config['db_pass'] = 'password';
29 29
 
30 30
 
31
-$config['modules'] = array("index", "domains", "imap", "mysql", "jabber", "vhosts", "register", "systemuser", "su");
31
+$config['modules'] = ["index", "domains", "imap", "mysql", "jabber", "vhosts", "register", "systemuser", "su"];
32 32
 
33 33
 $config['enable_debug'] = true;
34 34
 $config['logging'] = LOG_ERR;
... ...
@@ -43,7 +43,7 @@ DEBUG($go);
43 43
 if (strstr($go, "..") or strstr($go, "./") or strstr($go, ":") or (! file_exists("modules/$go.php")) or (! is_file("modules/$go.php"))) {
44 44
     die("illegal command");
45 45
 }
46
-list($module, $page) = explode('/', $go, 2);
46
+[$module, $page] = explode('/', $go, 2);
47 47
 $page = str_replace('/', '-', $page);
48 48
 if (! in_array($module, config('modules'))) {
49 49
     die("inactive module");
... ...
@@ -28,7 +28,7 @@ function api_request($method, $input_data)
28 28
     curl_setopt($curl, CURLOPT_POST, 1);
29 29
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
30 30
     curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
31
-    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
31
+    curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
32 32
     $result = curl_exec($curl);
33 33
     if ($result === false) {
34 34
         system_failure("API-Anfrage kaputt");
... ...
@@ -33,7 +33,7 @@ function config($key, $localonly = false)
33 33
     }
34 34
 
35 35
     if ($key == 'modules' && isset($_SESSION['restrict_modules'])) {
36
-        $modules = array();
36
+        $modules = [];
37 37
         foreach ($config['modules'] as $mod) {
38 38
             if (in_array($mod, $_SESSION['restrict_modules'])) {
39 39
                 $modules[] = $mod;
... ...
@@ -84,7 +84,7 @@ function have_role($role)
84 84
 function get_server_by_id($id)
85 85
 {
86 86
     $id = (int) $id;
87
-    $result = db_query("SELECT hostname FROM system.servers WHERE id=?", array($id));
87
+    $result = db_query("SELECT hostname FROM system.servers WHERE id=?", [$id]);
88 88
     $ret = $result->fetch();
89 89
     return $ret['hostname'];
90 90
 }
... ...
@@ -102,7 +102,7 @@ function redirect($target)
102 102
         if (strpos($target, '?') === false) {
103 103
             print 'REDIRECT: '.internal_link($target, $target);
104 104
         } else {
105
-            list($file, $qs) = explode('?', $target, 2);
105
+            [$file, $qs] = explode('?', $target, 2);
106 106
             print 'REDIRECT: '.internal_link($file, $target, $qs);
107 107
         }
108 108
     }
... ...
@@ -113,7 +113,7 @@ function redirect($target)
113 113
 function my_server_id()
114 114
 {
115 115
     $uid = (int) $_SESSION['userinfo']['uid'];
116
-    $result = db_query("SELECT server FROM system.useraccounts WHERE uid=?", array($uid));
116
+    $result = db_query("SELECT server FROM system.useraccounts WHERE uid=?", [$uid]);
117 117
     $r = $result->fetch();
118 118
     DEBUG($r);
119 119
     return $r['server'];
... ...
@@ -123,8 +123,8 @@ function my_server_id()
123 123
 function additional_servers()
124 124
 {
125 125
     $uid = (int) $_SESSION['userinfo']['uid'];
126
-    $result = db_query("SELECT server FROM system.user_server WHERE uid=?", array($uid));
127
-    $servers = array();
126
+    $result = db_query("SELECT server FROM system.user_server WHERE uid=?", [$uid]);
127
+    $servers = [];
128 128
     while ($s = $result->fetch()) {
129 129
         $servers[] = $s['server'];
130 130
     }
... ...
@@ -136,7 +136,7 @@ function additional_servers()
136 136
 function server_names()
137 137
 {
138 138
     $result = db_query("SELECT id, hostname FROM system.servers");
139
-    $servers = array();
139
+    $servers = [];
140 140
     while ($s = $result->fetch()) {
141 141
         $servers[$s['id']] = $s['hostname'];
142 142
     }
... ...
@@ -180,11 +180,11 @@ function logger($severity, $scriptname, $scope, $message)
180 180
         }
181 181
     }
182 182
 
183
-    $args = array(":user" => $user,
183
+    $args = [":user" => $user,
184 184
                 ":remote" => $_SERVER['REMOTE_ADDR'],
185 185
                 ":scriptname" => $scriptname,
186 186
                 ":scope" => $scope,
187
-                ":message" => $message);
187
+                ":message" => $message, ];
188 188
 
189 189
     db_query("INSERT INTO misc.scriptlog (remote, user,scriptname,scope,message) VALUES (:remote, :user, :scriptname, :scope, :message)", $args);
190 190
 }
... ...
@@ -195,7 +195,7 @@ function count_failed_logins()
195 195
         DEBUG("logging is disabled, no brute force check possible");
196 196
         return;
197 197
     }
198
-    $result = db_query("SELECT count(*) AS num FROM misc.scriptlog WHERE user IS NULL AND scriptname='session/start' AND scope='login' AND message LIKE 'wrong user data%' AND remote=:remote AND `timestamp` > NOW() - INTERVAL 10 MINUTE", array(":remote" => $_SERVER['REMOTE_ADDR']));
198
+    $result = db_query("SELECT count(*) AS num FROM misc.scriptlog WHERE user IS NULL AND scriptname='session/start' AND scope='login' AND message LIKE 'wrong user data%' AND remote=:remote AND `timestamp` > NOW() - INTERVAL 10 MINUTE", [":remote" => $_SERVER['REMOTE_ADDR']]);
199 199
     $data = $result->fetch();
200 200
     DEBUG('seen '.$data['num'].' failed logins from this address within 10 minutes');
201 201
     return $data['num'];
... ...
@@ -229,7 +229,7 @@ function footnote($explaination)
229 229
 {
230 230
     global $footnotes;
231 231
     if (!isset($footnotes) || !is_array($footnotes)) {
232
-        $footnotes = array();
232
+        $footnotes = [];
233 233
     }
234 234
     $fnid = array_search($explaination, $footnotes);
235 235
     DEBUG($footnotes);
... ...
@@ -334,7 +334,7 @@ function use_module($modname)
334 334
 {
335 335
     global $prefix, $needed_modules;
336 336
     if (! isset($needed_modules)) {
337
-        $needed_modules = array();
337
+        $needed_modules = [];
338 338
     }
339 339
     if (in_array($modname, $needed_modules)) {
340 340
         return;
... ...
@@ -359,7 +359,7 @@ function encode_querystring($querystring)
359 359
         $querystring = 'debug&'.$querystring;
360 360
     }
361 361
     $query = explode('&', $querystring);
362
-    $new_query = array();
362
+    $new_query = [];
363 363
     foreach ($query as $item) {
364 364
         if ($item != '') {
365 365
             $split = explode('=', $item, 2);
... ...
@@ -433,22 +433,22 @@ function html_select($name, $options, $default='', $free='')
433 433
 
434 434
 function html_datepicker($nameprefix, $timestamp)
435 435
 {
436
-    $valid_days = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
436
+    $valid_days = [ 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
437 437
                        6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
438 438
                       11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15,
439 439
                       16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20,
440 440
                       21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25,
441 441
                       26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30,
442
-                      31 => 31);
443
-    $valid_months = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
442
+                      31 => 31, ];
443
+    $valid_months = [ 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
444 444
                          6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
445
-                        11 => 11, 12 => 12);
445
+                        11 => 11, 12 => 12, ];
446 446
     $current_year = (int) date('Y');
447
-    $valid_years = array($current_year => $current_year,
447
+    $valid_years = [$current_year => $current_year,
448 448
                        $current_year+1 => $current_year+1,
449 449
                        $current_year+2 => $current_year+2,
450 450
                        $current_year+3 => $current_year+3,
451
-                       $current_year+4 => $current_year+4);
451
+                       $current_year+4 => $current_year+4, ];
452 452
 
453 453
     $selected_day = date('d', $timestamp);
454 454
     $selected_month = date('m', $timestamp);
... ...
@@ -463,7 +463,7 @@ function html_datepicker($nameprefix, $timestamp)
463 463
 function get_modules_info()
464 464
 {
465 465
     $modules = config('modules');
466
-    $modconfig = array();
466
+    $modconfig = [];
467 467
     foreach ($modules as $name) {
468 468
         $modconfig[$name] = null;
469 469
         if (file_exists('modules/'.$name.'/module.info')) {
... ...
@@ -31,7 +31,7 @@ function input_error($reason)
31 31
 {
32 32
     global $input_error;
33 33
     if (!isset($input_error)) {
34
-        $input_error = array();
34
+        $input_error = [];
35 35
     }
36 36
     array_push($input_error, $reason);
37 37
 }
... ...
@@ -39,7 +39,7 @@ function input_error($reason)
39 39
 function warning($msg)
40 40
 {
41 41
     if (!isset($_SESSION['warning'])) {
42
-        $_SESSION['warning'] = array();
42
+        $_SESSION['warning'] = [];
43 43
     }
44 44
     array_push($_SESSION['warning'], $msg);
45 45
     $backtrace = debug_backtrace();
... ...
@@ -49,7 +49,7 @@ function warning($msg)
49 49
 function success_msg($msg)
50 50
 {
51 51
     if (!isset($_SESSION['success_msg'])) {
52
-        $_SESSION['success_msg'] = array();
52
+        $_SESSION['success_msg'] = [];
53 53
     }
54 54
     array_push($_SESSION['success_msg'], $msg);
55 55
 }
... ...
@@ -116,7 +116,7 @@ function show_messages()
116 116
 function require_role($roles)
117 117
 {
118 118
     if (! is_array($roles)) {
119
-        $roles = array($roles);
119
+        $roles = [$roles];
120 120
     }
121 121
     $allow = false;
122 122
     foreach ($roles as $role) {
... ...
@@ -29,7 +29,7 @@ if (! defined('__JQUERY_INCLUDED')) {
29 29
 function javascript($file = null, $module = null)
30 30
 {
31 31
     global $go, $prefix;
32
-    list($mod, $page) = explode('/', $go, 2);
32
+    [$mod, $page] = explode('/', $go, 2);
33 33
     if (! $file) {
34 34
         $file = $page.'.js';
35 35
     }
... ...
@@ -18,7 +18,7 @@ require_once('inc/error.php');
18 18
 require_once('vendor/autoload.php');
19 19
 
20 20
 
21
-function strong_password($password, $user = array())
21
+function strong_password($password, $user = [])
22 22
 {
23 23
     $pwcheck = config('pwcheck');
24 24
     $result = null;
... ...
@@ -18,7 +18,7 @@ function show_page($path = null)
18 18
 {
19 19
     global $prefix, $go, $title, $headline, $output, $module, $page, $html_header, $footnotes;
20 20
 
21
-    $styles = array();
21
+    $styles = [];
22 22
     if (file_exists("modules/{$module}/style.css")) {
23 23
         $styles[] = "modules/{$module}/style.css";
24 24
     }
... ...
@@ -33,7 +33,7 @@ function show_page($path = null)
33 33
         $theme = 'default';
34 34
     }
35 35
     $theme_path = "themes/$theme/";
36
-    $candidates = array();
36
+    $candidates = [];
37 37
     if ($page) {
38 38
         $candidates[] = "{$theme_path}page-$module-$page.tpl.php";
39 39
     }
... ...
@@ -21,10 +21,10 @@ if (! defined("TOP_INCLUDED")) {
21 21
     require_once("inc/debug.php");
22 22
     global $prefix, $section;
23 23
 
24
-    $menuitem = array();
25
-    $weighted_menuitem = array();
24
+    $menuitem = [];
25
+    $weighted_menuitem = [];
26 26
 
27
-    $submenu = array();
27
+    $submenu = [];
28 28
 
29 29
     foreach (config('modules') as $module) {
30 30
         $menu = false;
... ...
@@ -44,15 +44,15 @@ if (! defined("TOP_INCLUDED")) {
44 44
             $weight = $menu[$key]["weight"];
45 45
             if (isset($menu[$key]['submenu'])) {
46 46
                 if (isset($submenu[$menu[$key]['submenu']][$weight])) {
47
-                    $submenu[$menu[$key]['submenu']][$weight] = array_merge($submenu[$menu[$key]['submenu']][$weight], array($key => $menu[$key]));
47
+                    $submenu[$menu[$key]['submenu']][$weight] = array_merge($submenu[$menu[$key]['submenu']][$weight], [$key => $menu[$key]]);
48 48
                 } else {
49
-                    $submenu[$menu[$key]['submenu']][$weight] = array($key => $menu[$key]);
49
+                    $submenu[$menu[$key]['submenu']][$weight] = [$key => $menu[$key]];
50 50
                 }
51 51
             } else {
52 52
                 if (array_key_exists($weight, $weighted_menuitem)) {
53
-                    $weighted_menuitem[$weight] = array_merge($weighted_menuitem[$weight], array($key => $menu[$key]));
53
+                    $weighted_menuitem[$weight] = array_merge($weighted_menuitem[$weight], [$key => $menu[$key]]);
54 54
                 } else {
55
-                    $weighted_menuitem[$weight] = array($key => $menu[$key]);
55
+                    $weighted_menuitem[$weight] = [$key => $menu[$key]];
56 56
                 }
57 57
             }
58 58
         }
... ...
@@ -37,7 +37,7 @@ if (! $data) {
37 37
 }
38 38
 
39 39
 $users = list_useraccounts();
40
-$userselect = array();
40
+$userselect = [];
41 41
 foreach ($users as $u) {
42 42
     $userselect[$u['uid']] = $u['username'].' / '.$u['name'];
43 43
 }
... ...
@@ -36,17 +36,17 @@ function get_domain_offer($domainname)
36 36
 
37 37
     $cid = (int) $_SESSION['customerinfo']['customerno'];
38 38
 
39
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE domainname=:domainname AND tld=:tld", array("domainname" => $basename, "tld" => $tld));
39
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE domainname=:domainname AND tld=:tld", ["domainname" => $basename, "tld" => $tld]);
40 40
     if ($result->rowCount() != 0) {
41 41
         warning('Diese Domain ist in unserem System bereits vorhanden und kann daher nicht noch einmal eingetragen werden.');
42 42
         return;
43 43
     }
44 44
 
45
-    $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
45
+    $data = ["domainname" => $domainname, "basename" => $basename, "tld" => $tld];
46 46
 
47
-    $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", array(":cid" => $cid, ":tld" => $tld));
47
+    $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", [":cid" => $cid, ":tld" => $tld]);
48 48
     if ($result->rowCount() != 1) {
49
-        $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", array(":tld" => $tld));
49
+        $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", [":tld" => $tld]);
50 50
     }
51 51
     if ($result->rowCount() != 1) {
52 52
         warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
... ...
@@ -89,10 +89,10 @@ function register_domain($domainname, $uid)
89 89
         system_failure('Kein User gesetzt');
90 90
     }
91 91
 
92
-    $args = array(":cid" => $cid,
92
+    $args = [":cid" => $cid,
93 93
                 ":useraccount" => $useraccount,
94 94
                 ":basename" => $data['basename'],
95
-                ":tld" => $data['tld']);
95
+                ":tld" => $data['tld'], ];
96 96
     db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail) VALUES ".
97 97
            "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto') ", $args);
98 98
     $domid = db_insert_id();
... ...
@@ -107,8 +107,8 @@ function register_domain($domainname, $uid)
107 107
 function list_useraccounts()
108 108
 {
109 109
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
110
-    $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", array($customerno));
111
-    $ret = array();
110
+    $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", [$customerno]);
111
+    $ret = [];
112 112
     while ($item = $result->fetch()) {
113 113
         $ret[] = $item;
114 114
     }
... ...
@@ -20,7 +20,7 @@ require_once('inc/api.php');
20 20
 
21 21
 function api_domain_available($domainname)
22 22
 {
23
-    $args = array("domainNames" => array($domainname));
23
+    $args = ["domainNames" => [$domainname]];
24 24
     $result = api_request('domainStatus', $args);
25 25
     $resp = $result["responses"][0];
26 26
     return ($resp["status"] == "available");
... ...
@@ -18,5 +18,5 @@ $role = $_SESSION['role'];
18 18
 
19 19
 
20 20
 if ($role & ROLE_CUSTOMER) {
21
-    $menu["adddomain_search"] = array("label" => "Domain hinzufügen", "file" => "search", "weight" => 0, "submenu" => "domains_domains");
21
+    $menu["adddomain_search"] = ["label" => "Domain hinzufügen", "file" => "search", "weight" => 0, "submenu" => "domains_domains"];
22 22
 }
... ...
@@ -2,5 +2,5 @@
2 2
 
3 3
 $role = $_SESSION['role'];
4 4
 if ($role & ROLE_SYSADMIN) {
5
-    $menu["buchhaltung_report"] = array("label" => "Report", "file" => "report", "weight" => -10);
5
+    $menu["buchhaltung_report"] = ["label" => "Report", "file" => "report", "weight" => -10];
6 6
 }
... ...
@@ -11,15 +11,15 @@ if (isset($_GET['year'])) {
11 11
 }
12 12
 
13 13
 $typeresult = db_query("SELECT id, description, investment FROM buchhaltung.types");
14
-$dataresult = db_query("SELECT id, date, description, invoice_id, direction, type, amount, tax_rate, gross FROM buchhaltung.transactions WHERE date BETWEEN :from and :to ORDER BY date", array(":from" => $year."-01-01", ":to" => $year."-12-31"));
14
+$dataresult = db_query("SELECT id, date, description, invoice_id, direction, type, amount, tax_rate, gross FROM buchhaltung.transactions WHERE date BETWEEN :from and :to ORDER BY date", [":from" => $year."-01-01", ":to" => $year."-12-31"]);
15 15
 
16
-$types = array();
17
-$data_by_type = array();
18
-$sum_by_type = array();
19
-$investment_types = array();
16
+$types = [];
17
+$data_by_type = [];
18
+$sum_by_type = [];
19
+$investment_types = [];
20 20
 while ($t = $typeresult->fetch()) {
21 21
     $types[$t['id']] = $t['description'];
22
-    $data_by_type[$t['id']] = array();
22
+    $data_by_type[$t['id']] = [];
23 23
     $sum_by_type[$t['id']] = 0.0;
24 24
     if ($t['investment'] == 1) {
25 25
         $investment_types[$t['id']] = $t;
... ...
@@ -35,9 +35,9 @@ output("Journal für $year (01.01.$year-31.12.$year, gruppiert nach Buchungskont
35 35
 
36 36
 DEBUG($types);
37 37
 DEBUG($investment_types);
38
-$net_by_type = array(0 => array(-1 => array(), 0 => array(), 19 => array()));
38
+$net_by_type = [0 => [-1 => [], 0 => [], 19 => []]];
39 39
 $umsatzsteuer = 0.0;
40
-$ustbetraege = array();
40
+$ustbetraege = [];
41 41
 $vorsteuer = 0.0;
42 42
 foreach ($types as $id => $t) {
43 43
     if (count($data_by_type[$id]) == 0 || $t=='Privatentnahme') {
... ...
@@ -8,10 +8,10 @@ $title = 'Report';
8 8
 $year = date("Y")-1;
9 9
 
10 10
 $typeresult = db_query("SELECT id, description FROM buchhaltung.types");
11
-$dataresult = db_query("SELECT id, date, description, invoice_id, direction, type, amount, tax_rate, gross FROM buchhaltung.transactions WHERE date BETWEEN :from and :to ORDER BY date", array(":from" => $year."-01-01", ":to" => $year."-12-31"));
11
+$dataresult = db_query("SELECT id, date, description, invoice_id, direction, type, amount, tax_rate, gross FROM buchhaltung.transactions WHERE date BETWEEN :from and :to ORDER BY date", [":from" => $year."-01-01", ":to" => $year."-12-31"]);
12 12
 
13
-$types = array();
14
-$data = array();
13
+$types = [];
14
+$data = [];
15 15
 while ($t = $typeresult->fetch()) {
16 16
     $types[$t['id']] = $t['description'];
17 17
 }
... ...
@@ -17,8 +17,8 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 require_once('contacts.php');
18 18
 
19 19
 if (isset($_GET['q']) || isset($_GET['id'])) {
20
-    $result = array("status" => "notfound",
21
-                    "id" => null);
20
+    $result = ["status" => "notfound",
21
+                    "id" => null, ];
22 22
     $id = null;
23 23
     if (isset($_GET['q'])) {
24 24
         $id = search_pgp_key($_GET['q']);
... ...
@@ -22,7 +22,7 @@ javascript();
22 22
 require_once('session/start.php');
23 23
 
24 24
 
25
-require_role(array(ROLE_CUSTOMER));
25
+require_role([ROLE_CUSTOMER]);
26 26
 $section = 'contacts_list';
27 27
 
28 28
 $new = false;
... ...
@@ -21,7 +21,7 @@ require_once('inc/api.php');
21 21
 
22 22
 function contact_to_apicontact($c)
23 23
 {
24
-    $ac = array();
24
+    $ac = [];
25 25
     $ac['id'] = $c['nic_id'];
26 26
     $ac['handle'] = $c['nic_handle'];
27 27
     $ac['type'] = 'person';
... ...
@@ -65,13 +65,13 @@ function apicontact_to_contact($ac)
65 65
 
66 66
 function download_contact($nic_id)
67 67
 {
68
-    $data = array("contactId" => $nic_id);
68
+    $data = ["contactId" => $nic_id];
69 69
     $result = api_request('contactInfo', $data);
70 70
     if ($result['status'] != 'success') {
71 71
         system_failure("Abfrage nicht erfolgreich!");
72 72
     }
73 73
     $c = apicontact_to_contact($result['response']);
74
-    $result = db_query("SELECT id FROM kundendaten.contacts WHERE nic_id=?", array($nic_id));
74
+    $result = db_query("SELECT id FROM kundendaten.contacts WHERE nic_id=?", [$nic_id]);
75 75
     if ($result->rowCount() > 0) {
76 76
         $data = $result->fetch();
77 77
         $c['id'] = $data['id'];
... ...
@@ -87,15 +87,15 @@ function upload_contact($c)
87 87
     $ac = contact_to_apicontact($c);
88 88
     if ($ac['id'] || $ac['handle']) {
89 89
         // Update
90
-        $data = array("contact" => $ac,
91
-                "actingAs" => "designatedAgent");
90
+        $data = ["contact" => $ac,
91
+                "actingAs" => "designatedAgent", ];
92 92
         $result = api_request('contactUpdate', $data);
93 93
         if ($result['status'] != 'success') {
94 94
             system_failure("Es gab ein Problem beim Hochladen der Adresse zum Domainregistrar. Das sollte nicht sein!");
95 95
         }
96 96
     } else {
97 97
         // create
98
-        $data = array("contact" => $ac);
98
+        $data = ["contact" => $ac];
99 99
         $result = api_request('contactCreate', $data);
100 100
         if ($result['status'] == 'success') {
101 101
             $c['nic_handle'] = $result['response']['handle'];
... ...
@@ -17,7 +17,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 require_once('inc/debug.php');
18 18
 require_once('inc/icons.php');
19 19
 require_once('inc/security.php');
20
-require_role(array(ROLE_CUSTOMER));
20
+require_role([ROLE_CUSTOMER]);
21 21
 require_once('class/domain.php');
22 22
 
23 23
 require_once('contactapi.php');
... ...
@@ -25,7 +25,7 @@ require_once('contactapi.php');
25 25
 
26 26
 function new_contact()
27 27
 {
28
-    return array("id" => null,
28
+    return ["id" => null,
29 29
         "state" => null,
30 30
         "lastchange" => time(),
31 31
         "nic_handle" => null,
... ...
@@ -43,7 +43,7 @@ function new_contact()
43 43
         "email" => null,
44 44
         "pgp_id" => null,
45 45
         "pgp_key" => null,
46
-        "customer" => $_SESSION['customerinfo']['customerno']);
46
+        "customer" => $_SESSION['customerinfo']['customerno'], ];
47 47
 }
48 48
 
49 49
 
... ...
@@ -53,9 +53,9 @@ function get_contact($id, $customer = null)
53 53
     if ($customer != null && have_role(ROLE_SYSADMIN)) {
54 54
         $c = $customer;
55 55
     }
56
-    $args = array(
56
+    $args = [
57 57
         "cid" => (int) $c,
58
-        "id" => (int) $id);
58
+        "id" => (int) $id, ];
59 59
     $result = db_query("SELECT id, state, lastchange, nic_id, nic_handle, salutation, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id, pgp_key FROM kundendaten.contacts WHERE id=:id AND customer=:cid", $args);
60 60
     if ($result->rowCount() == 0) {
61 61
         DEBUG("Soll Kontakt #".$id." laden, MySQL lieferte aber keine Daten");
... ...
@@ -68,8 +68,8 @@ function get_contact($id, $customer = null)
68 68
 function get_contacts()
69 69
 {
70 70
     $cid = (int) $_SESSION['customerinfo']['customerno'];
71
-    $result = db_query("SELECT id, state, lastchange, nic_id, nic_handle, salutation, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id, pgp_key FROM kundendaten.contacts WHERE (state<>'deleted' OR state IS NULL) AND customer=? ORDER BY COALESCE(company, name)", array($cid));
72
-    $ret = array();
71
+    $result = db_query("SELECT id, state, lastchange, nic_id, nic_handle, salutation, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id, pgp_key FROM kundendaten.contacts WHERE (state<>'deleted' OR state IS NULL) AND customer=? ORDER BY COALESCE(company, name)", [$cid]);
72
+    $ret = [];
73 73
     while ($contact = $result->fetch()) {
74 74
         $ret[$contact['id']] = $contact;
75 75
     }
... ...
@@ -81,7 +81,7 @@ function get_contacts()
81 81
 function is_domainholder($contactid)
82 82
 {
83 83
     $contactid = (int) $contactid;
84
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE owner=? OR admin_c=?", array($contactid, $contactid));
84
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE owner=? OR admin_c=?", [$contactid, $contactid]);
85 85
     if ($result->rowCount() > 0) {
86 86
         return true;
87 87
     }
... ...
@@ -91,7 +91,7 @@ function is_domainholder($contactid)
91 91
 function possible_domainholders()
92 92
 {
93 93
     $allcontacts = get_contacts();
94
-    $ret = array();
94
+    $ret = [];
95 95
     foreach ($allcontacts as $id => $c) {
96 96
         if (possible_domainholder($c)) {
97 97
             $ret[$id] = $c;
... ...
@@ -111,7 +111,7 @@ function possible_domainholder($c)
111 111
 function have_mailaddress($email)
112 112
 {
113 113
     $cid = (int) $_SESSION['customerinfo']['customerno'];
114
-    $result = db_query("SELECT id FROM kundendaten.contacts WHERE customer=? AND email=?", array($cid, $email));
114
+    $result = db_query("SELECT id FROM kundendaten.contacts WHERE customer=? AND email=?", [$cid, $email]);
115 115
     if ($result->rowCount() > 0) {
116 116
         return true;
117 117
     }
... ...
@@ -134,10 +134,10 @@ function set_kundenkontakt($typ, $id)
134 134
     } else {
135 135
         $id = (int) $id;
136 136
     }
137
-    $args = array(
137
+    $args = [
138 138
         "kunde" => (int) $_SESSION['customerinfo']['customerno'],
139
-        "contact" => $id
140
-        );
139
+        "contact" => $id,
140
+        ];
141 141
     $field = null;
142 142
     if ($typ == 'kunde') {
143 143
         $field = 'contact_kunde';
... ...
@@ -166,7 +166,7 @@ function sync_legacy_contactdata()
166 166
         $vorname = explode(' ', $kunde['name'], 2)[0];
167 167
         $nachname = explode(' ', $kunde['name'], 2)[1];
168 168
     }
169
-    $args = array("firma" => $kunde['company'],
169
+    $args = ["firma" => $kunde['company'],
170 170
             "anrede" => $kunde['salutation'],
171 171
             "vorname" => $vorname,
172 172
             "nachname" => $nachname,
... ...
@@ -180,25 +180,25 @@ function sync_legacy_contactdata()
180 180
             "email" => $kunde['email'],
181 181
             "pgp_id" => $kunde['pgp_id'],
182 182
             "pgp_key" => $kunde['pgp_key'],
183
-            "cid" => $cid);
183
+            "cid" => $cid, ];
184 184
     db_query("UPDATE kundendaten.kunden SET anrede=:anrede, firma=:firma, vorname=:vorname, nachname=:nachname, adresse=:adresse,
185 185
             plz=:plz, ort=:ort, land=:land, telefon=:telefon, mobile=:mobile, telefax=:telefax, email=:email, 
186 186
             pgp_id=:pgp_id, pgp_key=:pgp_key WHERE id=:cid", $args);
187 187
     if ($kundenkontakte['extern']) {
188 188
         $extern = get_contact($kundenkontakte['extern'])['email'];
189 189
         if ($extern) {
190
-            db_query("UPDATE kundendaten.kunden SET email_extern=? WHERE id=?", array($extern, $cid));
190
+            db_query("UPDATE kundendaten.kunden SET email_extern=? WHERE id=?", [$extern, $cid]);
191 191
         }
192 192
     }
193 193
     if ($kundenkontakte['rechnung']) {
194 194
         $kunde = get_contact($kundenkontakte['rechnung']);
195
-        $args = array("firma" => $kunde['company'],
195
+        $args = ["firma" => $kunde['company'],
196 196
                 "name" => $kunde['name'],
197 197
                 "adresse" => $kunde['address'],
198 198
                 "plz" => $kunde['zip'],
199 199
                 "ort" => $kunde['city'],
200 200
                 "email" => $kunde['email'],
201
-                "cid" => $cid);
201
+                "cid" => $cid, ];
202 202
         db_query("UPDATE kundendaten.kunden SET re_firma=:firma, re_name=:name, re_adresse=:adresse,
203 203
                 re_plz=:plz, re_ort=:ort, email_rechnung=:email WHERE id=:cid", $args);
204 204
     }
... ...
@@ -211,21 +211,21 @@ function get_kundenkontakte($customer = null)
211 211
     if ($customer and have_role(ROLE_SYSADMIN)) {
212 212
         $cid = (int) $customer;
213 213
     }
214
-    $result = db_query("SELECT contact_kunde, contact_extern, contact_rechnung, contact_dataprotection FROM kundendaten.kunden WHERE id=?", array($cid));
214
+    $result = db_query("SELECT contact_kunde, contact_extern, contact_rechnung, contact_dataprotection FROM kundendaten.kunden WHERE id=?", [$cid]);
215 215
     $res = $result->fetch();
216
-    $ret = array("kunde" => $res['contact_kunde'],
216
+    $ret = ["kunde" => $res['contact_kunde'],
217 217
                  "extern" => $res['contact_extern'],
218 218
                  "rechnung" => $res['contact_rechnung'],
219
-                 "dataprotection" => $res['contact_dataprotection']);
219
+                 "dataprotection" => $res['contact_dataprotection'], ];
220 220
     return $ret;
221 221
 }
222 222
 
223 223
 function save_emailaddress($id, $email)
224 224
 {
225 225
     // Speichert eine E-Mail-Adresse direkt, z.B. wenn diese schonmal geprüft wurde
226
-    $args = array("cid" => (int) $_SESSION['customerinfo']['customerno'],
226
+    $args = ["cid" => (int) $_SESSION['customerinfo']['customerno'],
227 227
         "id" => (int) $id,
228
-        "email" => $email);
228
+        "email" => $email, ];
229 229
     db_query("UPDATE kundendaten.contacts SET email=:email WHERE id=:id AND customer=:cid", $args);
230 230
 }
231 231
 
... ...
@@ -263,9 +263,9 @@ function send_emailchange_token($id, $email)
263 263
     if (! check_emailaddr($email)) {
264 264
         system_falure("Die E-Mail-Adresse scheint nicht gültig zu sein.");
265 265
     }
266
-    $args = array("id" => (int) $id,
266
+    $args = ["id" => (int) $id,
267 267
         "email" => $email,
268
-        "token" => random_string(20));
268
+        "token" => random_string(20), ];
269 269
 
270 270
     db_query("INSERT INTO kundendaten.mailaddress_token (token, expire, contact, email) VALUES (:token, NOW() + INTERVAL 1 DAY, :id, :email)", $args);
271 271
     DEBUG('Token erzeugt: '.print_r($args, true));
... ...
@@ -291,7 +291,7 @@ https://schokokeks.org
291 291
 function update_pending($contactid)
292 292
 {
293 293
     $contactid = (int) $contactid;
294
-    $result = db_query("SELECT email FROM kundendaten.mailaddress_token WHERE contact=?", array($contactid));
294
+    $result = db_query("SELECT email FROM kundendaten.mailaddress_token WHERE contact=?", [$contactid]);
295 295
     if ($result->rowCount() == 0) {
296 296
         return null;
297 297
     }
... ...
@@ -319,7 +319,7 @@ function delete_contact($id)
319 319
         $c['state'] = 'deleted';
320 320
         upload_contact($c);
321 321
     }
322
-    db_query("UPDATE kundendaten.contacts SET state='deleted' WHERE id=?", array($c['id']));
322
+    db_query("UPDATE kundendaten.contacts SET state='deleted' WHERE id=?", [$c['id']]);
323 323
 }
324 324
 
325 325
 
... ...
@@ -329,12 +329,12 @@ function search_pgp_key($search)
329 329
         # Keine Ausgabe weil diese Funktion im AJAX-Call verwendet wird
330 330
         return null;
331 331
     }
332
-    $output = array();
332
+    $output = [];
333 333
     $command = 'LC_ALL=C /usr/bin/timeout 10 /usr/bin/gpg --batch --with-colons --keyserver hkps://hkps.pool.sks-keyservers.net --search-key '.escapeshellarg($search);
334 334
     DEBUG($command);
335 335
     exec($command, $output);
336 336
     DEBUG($output);
337
-    $keys = array();
337
+    $keys = [];
338 338
     foreach ($output as $row) {
339 339
         if (substr($row, 0, 4) === 'pub:') {
340 340
             $parts = explode(':', $row);
... ...
@@ -359,7 +359,7 @@ function search_pgp_key($search)
359 359
 
360 360
 function fetch_pgp_key($pgp_id)
361 361
 {
362
-    $output = array();
362
+    $output = [];
363 363
     $ret = null;
364 364
     $command = '/usr/bin/timeout 10 /usr/bin/gpg --batch --keyserver hkps://hkps.pool.sks-keyservers.net --no-auto-check-trustdb --trust-model=always --recv-key '.escapeshellarg($pgp_id);
365 365
     DEBUG($command);
... ...
@@ -406,8 +406,8 @@ function test_pgp_key($pgp_id)
406 406
 function domainlist_by_contact($c)
407 407
 {
408 408
     $cid = (int) $_SESSION['customerinfo']['customerno'];
409
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE (owner=? OR admin_c=?) AND kunde=?", array($c['id'], $c['id'], $cid));
410
-    $ret = array();
409
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE (owner=? OR admin_c=?) AND kunde=?", [$c['id'], $c['id'], $cid]);
410
+    $ret = [];
411 411
     while ($domain = $result->fetch()) {
412 412
         $ret[] = new Domain((int) $domain['id']);
413 413
     }
... ...
@@ -430,7 +430,7 @@ function contact_as_string($contact)
430 430
     if ($new_email) {
431 431
         $email = "<strike>$email</strike><br/>".filter_output_html($new_email).footnote('Die E-Mail-Adresse wurde noch nicht bestätigt');
432 432
     }
433
-    $email = implode("<br>\n", array_filter(array($email, filter_output_html($contact['phone']), filter_output_html($contact['fax']), filter_output_html($contact['mobile']))));
433
+    $email = implode("<br>\n", array_filter([$email, filter_output_html($contact['phone']), filter_output_html($contact['fax']), filter_output_html($contact['mobile'])]));
434 434
     $pgp = '';
435 435
     if ($contact['pgp_id']) {
436 436
         $pgpid = $contact['pgp_id'];
... ...
@@ -20,7 +20,7 @@ require_once("contacts.php");
20 20
 function verify_mail_token($token)
21 21
 {
22 22
     db_query("DELETE FROM kundendaten.mailaddress_token WHERE expire<NOW()");
23
-    $args = array(":token" => $token);
23
+    $args = [":token" => $token];
24 24
     $result = db_query("SELECT contact, email FROM kundendaten.mailaddress_token WHERE token=:token AND expire>NOW()", $args);
25 25
     if ($result->rowCount() > 0) {
26 26
         $line = $result->fetch();
... ...
@@ -41,8 +41,8 @@ function update_mailaddress($daten)
41 41
         system_failure('Es ist eine ungültige Adresse hinterlegt. So wird das nichts. Bitte die Änderung von vorne machen.');
42 42
     }
43 43
 
44
-    $args = array(':contact' => $contact,
45
-                  ':email' => $email);
44
+    $args = [':contact' => $contact,
45
+                  ':email' => $email, ];
46 46
     db_query("UPDATE kundendaten.contacts SET email=:email WHERE id=:contact", $args);
47 47
     sync_legacy_contactdata();
48 48
 }
... ...
@@ -50,8 +50,8 @@ function update_mailaddress($daten)
50 50
 
51 51
 function upload_changed_contact($id)
52 52
 {
53
-    $args = array(
54
-        "id" => (int) $id);
53
+    $args = [
54
+        "id" => (int) $id, ];
55 55
     $result = db_query("SELECT id, state, lastchange, nic_id, nic_handle, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id, pgp_key FROM kundendaten.contacts WHERE id=:id", $args);
56 56
     if ($result->rowCount() == 0) {
57 57
         return ;
... ...
@@ -60,7 +60,7 @@ function upload_changed_contact($id)
60 60
     if (! ($c['nic_id'] || $c['nic_handle'])) {
61 61
         return ;
62 62
     }
63
-    $ac = array();
63
+    $ac = [];
64 64
     $ac['id'] = $c['nic_id'];
65 65
     $ac['handle'] = $c['nic_handle'];
66 66
     $ac['type'] = 'person';
... ...
@@ -76,8 +76,8 @@ function upload_changed_contact($id)
76 76
     if ($c['state'] == 'deleted') {
77 77
         $ac['hidden'] = true;
78 78
     }
79
-    $data = array("contact" => $ac,
80
-            "actingAs" => "designatedAgent");
79
+    $data = ["contact" => $ac,
80
+            "actingAs" => "designatedAgent", ];
81 81
     $result = api_request('contactUpdate', $data);
82 82
     if ($result['status'] != 'success') {
83 83
         warning("Es gab ein Problem beim Hochladen der geänderten Adresse zum Domainregistrar. Das sollte nicht sein!");
... ...
@@ -21,7 +21,7 @@ require_once('inc/icons.php');
21 21
 require_once('session/start.php');
22 22
 
23 23
 
24
-require_role(array(ROLE_CUSTOMER));
24
+require_role([ROLE_CUSTOMER]);
25 25
 
26 26
 title("Adressen verwalten");
27 27
 
... ...
@@ -32,8 +32,8 @@ $kundenkontakte = get_kundenkontakte();
32 32
 output('<p>Sie haben aktuell diese Adressen gespeichert:</p>
33 33
 <div class="contact-list">');
34 34
 
35
-$liste = array_merge(array_filter(array($kundenkontakte['kunde'], $kundenkontakte['rechnung'], $kundenkontakte['extern'])), array_keys($contacts));
36
-$already_displayed = array();
35
+$liste = array_merge(array_filter([$kundenkontakte['kunde'], $kundenkontakte['rechnung'], $kundenkontakte['extern']]), array_keys($contacts));
36
+$already_displayed = [];
37 37
 foreach ($liste as $id) {
38 38
     if (in_array($id, $already_displayed)) {
39 39
         continue;
... ...
@@ -44,7 +44,7 @@ foreach ($liste as $id) {
44 44
         system_failure('Fehlerhafte Kunden-Zuordnung bei den Kontakten');
45 45
     }
46 46
     $contact = $contacts[$id];
47
-    $usage = array();
47
+    $usage = [];
48 48
     if ($id == $kundenkontakte['kunde']) {
49 49
         $cssclass .= 'mainaddress';
50 50
         $usage[] = 'Stamm-Adresse';
... ...
@@ -18,5 +18,5 @@ $role = $_SESSION['role'];
18 18
 
19 19
 
20 20
 if (($role & ROLE_CUSTOMER)) {
21
-    $menu["contacts_list"] = array("label" => "Adressen verwalten", "file" => "list", "weight" => 1, "submenu" => "index_index");
21
+    $menu["contacts_list"] = ["label" => "Adressen verwalten", "file" => "list", "weight" => 1, "submenu" => "index_index"];
22 22
 }
... ...
@@ -19,7 +19,7 @@ require_once('numbers.php');
19 19
 $number = $_REQUEST['number'];
20 20
 $country = $_REQUEST['country'];
21 21
 
22
-$return = array();
22
+$return = [];
23 23
 $return['field'] = $_REQUEST['field'];
24 24
 
25 25
 if ($number) {
... ...
@@ -21,7 +21,7 @@ require_once('inc/debug.php');
21 21
 require_once('session/start.php');
22 22
 
23 23
 
24
-require_role(array(ROLE_CUSTOMER));
24
+require_role([ROLE_CUSTOMER]);
25 25
 $section = 'contacts_list';
26 26
 
27 27
 $back = 'list';
... ...
@@ -23,7 +23,7 @@ require_once('inc/jquery.php');
23 23
 require_once('session/start.php');
24 24
 
25 25
 
26
-require_role(array(ROLE_CUSTOMER));
26
+require_role([ROLE_CUSTOMER]);
27 27
 $section = 'contacts_list';
28 28
 
29 29
 title("Adresse verwenden als...");
... ...
@@ -111,7 +111,7 @@ if (isset($_REQUEST['useas'])) {
111 111
     if (possible_domainholder($contact)) {
112 112
         $domains = domainlist_by_contact($contact);
113 113
         foreach ($domains as $d) {
114
-            $funktion = array();
114
+            $funktion = [];
115 115
             if ($contact['id'] == $d->owner) {
116 116
                 $funktion[] = 'Inhaber';
117 117
             }
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('contract.php');
18 18
 
19
-require_role(array(ROLE_CUSTOMER));
19
+require_role([ROLE_CUSTOMER]);
20 20
 
21 21
 echo contract_html();
22 22
 die();
... ...
@@ -19,8 +19,8 @@ require_role(ROLE_CUSTOMER);
19 19
 
20 20
 function get_orderprocessing_contract()
21 21
 {
22
-    $args = array(
23
-        "cid" => (int) $_SESSION['customerinfo']['customerno']);
22
+    $args = [
23
+        "cid" => (int) $_SESSION['customerinfo']['customerno'], ];
24 24
     $result = db_query("SELECT id, signed, type, startdate, enddate FROM kundendaten.contract WHERE customer=:cid AND type='orderprocessing' AND (enddate IS NULL OR enddate < CURDATE())", $args);
25 25
     if ($result->rowCount() == 0) {
26 26
         return null;
... ...
@@ -62,8 +62,8 @@ function contract_html()
62 62
 
63 63
 function save_op_contract($pdfdata)
64 64
 {
65
-    $args = array("cid" => $_SESSION['customerinfo']['customerno'],
66
-            "pdfdata" => $pdfdata);
65
+    $args = ["cid" => $_SESSION['customerinfo']['customerno'],
66
+            "pdfdata" => $pdfdata, ];
67 67
     db_query(
68 68
         "INSERT INTO kundendaten.contract (customer, signed, type, startdate, pdfdata) VALUES (:cid, NOW(), 'orderprocessing', CURDATE(), :pdfdata)",
69 69
         $args
... ...
@@ -73,8 +73,8 @@ function save_op_contract($pdfdata)
73 73
 
74 74
 function get_contract_pdf($id)
75 75
 {
76
-    $args = array("id" => $id,
77
-        "cid" => $_SESSION['customerinfo']['customerno']);
76
+    $args = ["id" => $id,
77
+        "cid" => $_SESSION['customerinfo']['customerno'], ];
78 78
     $result = db_query("SELECT pdfdata FROM kundendaten.contract WHERE id=:id AND customer=:cid", $args);
79 79
     $line = $result->fetch();
80 80
     return $line['pdfdata'];
... ...
@@ -18,7 +18,7 @@ require_once('contract.php');
18 18
 require_once('inc/debug.php');
19 19
 require_once('inc/icons.php');
20 20
 
21
-require_role(array(ROLE_CUSTOMER));
21
+require_role([ROLE_CUSTOMER]);
22 22
 
23 23
 title("AV-Vertrag");
24 24
 
... ...
@@ -18,5 +18,5 @@ $role = $_SESSION['role'];
18 18
 
19 19
 
20 20
 if (($role & ROLE_CUSTOMER)) {
21
-    $menu["contract_list"] = array("label" => "AV-Vertrag", "file" => "list", "weight" => 10, "submenu" => "index_index");
21
+    $menu["contract_list"] = ["label" => "AV-Vertrag", "file" => "list", "weight" => 10, "submenu" => "index_index"];
22 22
 }
... ...
@@ -18,7 +18,7 @@ require_once('contract.php');
18 18
 require_once('inc/debug.php');
19 19
 require_once('inc/icons.php');
20 20
 
21
-require_role(array(ROLE_CUSTOMER));
21
+require_role([ROLE_CUSTOMER]);
22 22
 
23 23
 title("Neuen AV-Vertrag abschließen");
24 24
 
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('contract.php');
18 18
 
19
-require_role(array(ROLE_CUSTOMER));
19
+require_role([ROLE_CUSTOMER]);
20 20
 
21 21
 if (isset($_REQUEST['agree']) && $_REQUEST['agree'] == 'yes') {
22 22
     require_once('vendor/autoload.php');
... ...
@@ -23,7 +23,7 @@ require_role(ROLE_SYSTEMUSER);
23 23
 require_once('dnsinclude.php');
24 24
 
25 25
 
26
-$domains = get_domain_list((isset($_SESSION['customerinfo']['customerno']) ? $_SESSION['customerinfo']['customerno'] : null), $_SESSION['userinfo']['uid']);
26
+$domains = get_domain_list(($_SESSION['customerinfo']['customerno'] ?? null), $_SESSION['userinfo']['uid']);
27 27
 
28 28
 title('DNS-Records');
29 29
 output('<p>Hier sehen Sie eine Übersicht über die angelegten DNS-records zu Ihren Domains.</p>');
... ...
@@ -83,7 +83,7 @@ foreach ($records as $rec) {
83 83
     }
84 84
     $ttl = ($rec['ttl'] ? $rec['ttl'] : 3600);
85 85
     $link = $rec['fqdn'];
86
-    if (!in_array($rec['type'], array('a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr', 'sshfp', 'srv', 'caa'))) {
86
+    if (!in_array($rec['type'], ['a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr', 'sshfp', 'srv', 'caa'])) {
87 87
         $editable = false;
88 88
     }
89 89
     $delete = internal_link('dns_record_save', icon_delete('Record löschen'), "id={$rec['id']}&action=delete");
... ...
@@ -25,11 +25,11 @@ require_once('dnsinclude.php');
25 25
 
26 26
 $section = 'dns_dns';
27 27
 
28
-$data = array();
28
+$data = [];
29 29
 $type = null;
30 30
 
31 31
 $dyndns = false;
32
-$dyndns_accounts = array();
32
+$dyndns_accounts = [];
33 33
 foreach (get_dyndns_accounts() as $t) {
34 34
     $dyndns_accounts[$t['id']] = $t['handle'];
35 35
 }
... ...
@@ -123,11 +123,11 @@ if ($type == 'spf' || $type == 'txt') {
123 123
 }
124 124
 
125 125
 if ($type == 'sshfp') {
126
-    $algs = array(
126
+    $algs = [
127 127
     1 => "RSA",
128 128
     2 => "DSA",
129 129
     3 => "ECDSA",
130
-    4 => "ED25519" );
130
+    4 => "ED25519", ];
131 131
 
132 132
     $option="";
133 133
     foreach ($algs as $key => $alg) {
... ...
@@ -61,8 +61,8 @@ if (isset($_GET['action']) && ($_GET['action'] == 'delete')) {
61 61
 
62 62
     $record['hostname'] = $_REQUEST['hostname'];
63 63
     $record['domain'] = (int) $_REQUEST['domain'];
64
-    $record['ip'] = (isset($_REQUEST['ip']) ? $_REQUEST['ip'] : null);
65
-    $record['data'] = (isset($_REQUEST['data']) ? $_REQUEST['data'] : null);
64
+    $record['ip'] = ($_REQUEST['ip'] ?? null);
65
+    $record['data'] = ($_REQUEST['data'] ?? null);
66 66
     $record['dyndns'] = (isset($_REQUEST['dyndns']) ? (int) $_REQUEST['dyndns'] : null);
67 67
     $record['spec'] = (isset($_REQUEST['spec']) ? (int) $_REQUEST['spec'] : null);
68 68
     $record['ttl'] = (int) $_REQUEST['ttl'];
... ...
@@ -25,7 +25,7 @@ $section = 'dns_dyndns';
25 25
 
26 26
 
27 27
 $new = true;
28
-$dyndns = array();
28
+$dyndns = [];
29 29
 if (isset($_REQUEST['id'])) {
30 30
     $dyndns = get_dyndns_account($_REQUEST['id']);
31 31
     $new = false;
... ...
@@ -71,7 +71,7 @@ if (! $new) {
71 71
   </div>';
72 72
 }
73 73
 
74
-$form = '<p><label for="handle">Bezeichnung:</label>&#160;<input type="text" name="handle" id="handle" value="'.(isset($dyndns['handle']) ? $dyndns['handle'] : '').'" onkeyup="updateUsernameHTTP()" /></p>
74
+$form = '<p><label for="handle">Bezeichnung:</label>&#160;<input type="text" name="handle" id="handle" value="'.($dyndns['handle'] ?? '').'" onkeyup="updateUsernameHTTP()" /></p>
75 75
 
76 76
 <h4>Update per HTTPs</h4>
77 77
 <p style="margin-left: 2em;">Geben Sie hier ein Passwort ein um das Update per HTTPs zu aktivieren.'.$http_update_info.'</p>
... ...
@@ -80,7 +80,7 @@ $form = '<p><label for="handle">Bezeichnung:</label>&#160;<input type="text" nam
80 80
 
81 81
 <h4>Update per SSH</h4>
82 82
 <p style="margin-left: 2em;">Kopieren Sie Ihren SSH-public-Key im OpenSSH-Format in dieses Eingabefeld um das Update per SSH zu aktivieren.</p>
83
-<p style="margin-left: 2em; vertical-align: middle;"><label for="sshkey">SSH Public-Key:</label><br /><textarea style="height: 10em; width: 80%;" id="sshkey" name="sshkey">'.(isset($dyndns['sshkey']) ? $dyndns['sshkey'] : '').'</textarea></p>
83
+<p style="margin-left: 2em; vertical-align: middle;"><label for="sshkey">SSH Public-Key:</label><br /><textarea style="height: 10em; width: 80%;" id="sshkey" name="sshkey">'.($dyndns['sshkey'] ?? '').'</textarea></p>
84 84
 
85 85
 <p style="margin-left: 2em;"><input type="submit" value="Speichern" /></p>
86 86
 ';
... ...
@@ -27,7 +27,7 @@ $dyndns = get_dyndns_account($_REQUEST['id']);
27 27
 
28 28
 title("Hostnames für DynDNS-Account ".filter_output_html($dyndns['handle']));
29 29
 
30
-$available_domains = array();
30
+$available_domains = [];
31 31
 
32 32
 $domains = get_domain_list($_SESSION['customerinfo']['customerno'], $_SESSION['userinfo']['uid']);
33 33
 foreach ($domains as $d) {
... ...
@@ -21,13 +21,13 @@ require_once('inc/error.php');
21 21
 
22 22
 require_once('class/domain.php');
23 23
 
24
-$caa_properties= array( 0 => "issue", 1 => "issuewild", 2 => "iodef" );
24
+$caa_properties= [ 0 => "issue", 1 => "issuewild", 2 => "iodef" ];
25 25
 
26 26
 function get_dyndns_accounts()
27 27
 {
28 28
     $uid = (int) $_SESSION['userinfo']['uid'];
29
-    $result = db_query("SELECT * FROM dns.dyndns WHERE uid=?", array($uid));
30
-    $list = array();
29
+    $result = db_query("SELECT * FROM dns.dyndns WHERE uid=?", [$uid]);
30
+    $list = [];
31 31
     while ($item = $result->fetch()) {
32 32
         array_push($list, $item);
33 33
     }
... ...
@@ -38,8 +38,8 @@ function get_dyndns_accounts()
38 38
 
39 39
 function get_dyndns_account($id, $ignore=true)
40 40
 {
41
-    $args = array(":id" => (int) $id,
42
-                ":uid" => (int) $_SESSION['userinfo']['uid']);
41
+    $args = [":id" => (int) $id,
42
+                ":uid" => (int) $_SESSION['userinfo']['uid'], ];
43 43
     $result = db_query("SELECT * FROM dns.dyndns WHERE id=:id AND uid=:uid", $args);
44 44
     if ($result->rowCount() != 1) {
45 45
         if ($ignore) {
... ...
@@ -78,7 +78,7 @@ function create_dyndns_account($handle, $password_http, $sshkey)
78 78
     db_query(
79 79
         "INSERT INTO dns.dyndns (uid, handle, password, sshkey) VALUES ".
80 80
            "(:uid, :handle, :pwhash, :sshkey)",
81
-        array(":uid" => $uid, ":handle" => $handle, ":pwhash" => $pwhash, ":sshkey" => $sshkey)
81
+        [":uid" => $uid, ":handle" => $handle, ":pwhash" => $pwhash, ":sshkey" => $sshkey]
82 82
     );
83 83
     $dyndns_id = db_insert_id();
84 84
     //$masterdomain = new Domain(config('masterdomain'));
... ...
@@ -100,7 +100,7 @@ function edit_dyndns_account($id, $handle, $password_http, $sshkey)
100 100
         $sshkey = null;
101 101
     }
102 102
 
103
-    $args = array(":handle" => $handle, ":sshkey" => $sshkey, ":id" => $id);
103
+    $args = [":handle" => $handle, ":sshkey" => $sshkey, ":id" => $id];
104 104
     $pwhash = null;
105 105
     if ($password_http && $password_http != '************') {
106 106
         $args[":pwhash"] = "{SHA}".base64_encode(sha1($password_http, true));
... ...
@@ -116,7 +116,7 @@ function delete_dyndns_account($id)
116 116
 {
117 117
     $id = (int) $id;
118 118
 
119
-    db_query("DELETE FROM dns.dyndns WHERE id=?", array($id));
119
+    db_query("DELETE FROM dns.dyndns WHERE id=?", [$id]);
120 120
     logger(LOG_INFO, "modules/dns/include/dnsinclude", "dyndns", "deleted account »{$id}«");
121 121
 }
122 122
 
... ...
@@ -124,8 +124,8 @@ function delete_dyndns_account($id)
124 124
 function get_dyndns_records($id)
125 125
 {
126 126
     $id = (int) $id;
127
-    $result = db_query("SELECT hostname, domain, type, ttl, lastchange, id FROM dns.custom_records WHERE dyndns=?", array($id));
128
-    $data = array();
127
+    $result = db_query("SELECT hostname, domain, type, ttl, lastchange, id FROM dns.custom_records WHERE dyndns=?", [$id]);
128
+    $data = [];
129 129
     while ($entry = $result->fetch()) {
130 130
         $dom = new Domain((int) $entry['domain']);
131 131
         if ($dom->fqdn != config('masterdomain') && $dom->fqdn != config('user_vhosts_domain')) {
... ...
@@ -141,7 +141,7 @@ function get_dyndns_records($id)
141 141
     return $data;
142 142
 }
143 143
 
144
-$valid_record_types = array('a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw', 'sshfp', 'caa', 'srv');
144
+$valid_record_types = ['a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw', 'sshfp', 'caa', 'srv'];
145 145
 
146 146
 
147 147
 function blank_dns_record($type)
... ...
@@ -150,14 +150,14 @@ function blank_dns_record($type)
150 150
     if (!in_array(strtolower($type), $valid_record_types)) {
151 151
         system_failure('invalid type: '.$type);
152 152
     }
153
-    $rec = array('hostname' => null,
153
+    $rec = ['hostname' => null,
154 154
                'domain' => 0,
155 155
                'type' => strtolower($type),
156 156
                'ttl' => 3600,
157 157
                'ip' => null,
158 158
                'dyndns' => null,
159 159
                'data' => null,
160
-               'spec' => null);
160
+               'spec' => null, ];
161 161
     if (strtolower($type) == 'mx') {
162 162
         $rec['data'] = config('default_mx');
163 163
         $rec['spec'] = '5';
... ...
@@ -168,7 +168,7 @@ function blank_dns_record($type)
168 168
 function get_dns_record($id)
169 169
 {
170 170
     $id = (int) $id;
171
-    $result = db_query("SELECT hostname, domain, type, ip, dyndns, spec, data, ttl FROM dns.custom_records WHERE id=?", array($id));
171
+    $result = db_query("SELECT hostname, domain, type, ip, dyndns, spec, data, ttl FROM dns.custom_records WHERE id=?", [$id]);
172 172
     if ($result->rowCount() != 1) {
173 173
         system_failure('illegal ID');
174 174
     }
... ...
@@ -183,8 +183,8 @@ function get_dns_record($id)
183 183
 function get_domain_records($dom)
184 184
 {
185 185
     $dom = (int) $dom;
186
-    $result = db_query("SELECT hostname, domain, type, ip, dyndns, spec, data, ttl, id FROM dns.custom_records WHERE domain=?", array($dom));
187
-    $data = array();
186
+    $result = db_query("SELECT hostname, domain, type, ip, dyndns, spec, data, ttl, id FROM dns.custom_records WHERE domain=?", [$dom]);
187
+    $data = [];
188 188
     while ($entry = $result->fetch()) {
189 189
         $dom = new Domain((int) $entry['domain']);
190 190
         $dom->ensure_userdomain();
... ...
@@ -200,8 +200,8 @@ function get_domain_records($dom)
200 200
 
201 201
 function get_domain_auto_records($domainname)
202 202
 {
203
-    $result = db_query("SELECT hostname, domain, CONCAT_WS('.', hostname, domain) AS fqdn, type, ip, spec, data, ttl FROM dns.tmp_autorecords WHERE domain=?", array($domainname));
204
-    $data = array();
203
+    $result = db_query("SELECT hostname, domain, CONCAT_WS('.', hostname, domain) AS fqdn, type, ip, spec, data, ttl FROM dns.tmp_autorecords WHERE domain=?", [$domainname]);
204
+    $data = [];
205 205
     while ($entry = $result->fetch()) {
206 206
         array_push($data, $entry);
207 207
     }
... ...
@@ -222,7 +222,7 @@ function warn_autorecord_collission($hostname, $domain, $type)
222 222
 }
223 223
 
224 224
 
225
-$implemented_record_types = array('a', 'aaaa', 'mx', 'spf', 'txt', 'cname', 'ptr', 'srv', 'ns', 'sshfp', 'caa');
225
+$implemented_record_types = ['a', 'aaaa', 'mx', 'spf', 'txt', 'cname', 'ptr', 'srv', 'ns', 'sshfp', 'caa'];
226 226
 
227 227
 function save_dns_record($id, $record)
228 228
 {
... ...
@@ -339,7 +339,7 @@ function save_dns_record($id, $record)
339 339
       if (count($data) != 2) {
340 340
           system_failure('Das eingegebene Ziel war nicht im Format hostname:port');
341 341
       }
342
-      list($hostname, $port) = $data;
342
+      [$hostname, $port] = $data;
343 343
       verify_input_hostname($hostname);
344 344
       if ($port !== (string)(int) $port || (int)$port < 1 || (int)$port > 65535) {
345 345
           system_failure('Ungültige Portnummer');
... ...
@@ -350,14 +350,14 @@ function save_dns_record($id, $record)
350 350
       system_failure('Not implemented');
351 351
   }
352 352
     $id = (int) $id;
353
-    $args = array(":domain" => $dom->id,
353
+    $args = [":domain" => $dom->id,
354 354
                 ":hostname" => $record['hostname'],
355 355
                 ":type" => $record['type'],
356 356
                 ":ttl" => ($record['ttl'] == 0 ? null : (int) $record['ttl']),
357 357
                 ":ip" => $record['ip'],
358 358
                 ":dyndns" => $record['dyndns'],
359 359
                 ":data" => $record['data'],
360
-                ":spec" => $record['spec']);
360
+                ":spec" => $record['spec'], ];
361 361
     if ($id) {
362 362
         $args[":id"] = $id;
363 363
         db_query("UPDATE dns.custom_records SET hostname=:hostname, domain=:domain, type=:type, ttl=:ttl, ip=:ip, dyndns=:dyndns, data=:data, spec=:spec WHERE id=:id", $args);
... ...
@@ -372,7 +372,7 @@ function delete_dns_record($id)
372 372
     $id = (int) $id;
373 373
     // Diese Funktion prüft, ob der Eintrag einer eigenen Domain gehört
374 374
     $record = get_dns_record($id);
375
-    db_query("DELETE FROM dns.custom_records WHERE id=?", array($id));
375
+    db_query("DELETE FROM dns.custom_records WHERE id=?", [$id]);
376 376
 }
377 377
 
378 378
 
... ...
@@ -382,7 +382,7 @@ function convert_from_autorecords($domainid)
382 382
     $dom->ensure_userdomain();
383 383
     $dom = $dom->id;
384 384
 
385
-    db_query("INSERT IGNORE INTO dns.custom_records SELECT r.id, r.lastchange, type, d.id, hostname, ip, NULL AS dyndns, data, spec, ttl FROM dns.v_tmptable_allrecords AS r INNER JOIN dns.v_domains AS d ON (d.name=r.domain) WHERE d.id=?", array($dom));
385
+    db_query("INSERT IGNORE INTO dns.custom_records SELECT r.id, r.lastchange, type, d.id, hostname, ip, NULL AS dyndns, data, spec, ttl FROM dns.v_tmptable_allrecords AS r INNER JOIN dns.v_domains AS d ON (d.name=r.domain) WHERE d.id=?", [$dom]);
386 386
     disable_autorecords($dom);
387 387
     db_query("UPDATE dns.dnsstatus SET status='outdated'");
388 388
     warning("Die automatischen Einträge werden in Kürze abgeschaltet, bitte haben Sie einen Moment Geduld.");
... ...
@@ -395,8 +395,8 @@ function enable_autorecords($domainid)
395 395
     $dom->ensure_userdomain();
396 396
     $dom = $dom->id;
397 397
 
398
-    db_query("UPDATE kundendaten.domains SET autodns=1 WHERE id=?", array($dom));
399
-    db_query("DELETE FROM dns.custom_records WHERE type='ns' AND domain=? AND hostname IS NULL", array($dom));
398
+    db_query("UPDATE kundendaten.domains SET autodns=1 WHERE id=?", [$dom]);
399
+    db_query("DELETE FROM dns.custom_records WHERE type='ns' AND domain=? AND hostname IS NULL", [$dom]);
400 400
     warning("Die automatischen Einträge werden in Kürze aktiviert, bitte haben Sie einen Moment Geduld.");
401 401
 }
402 402
 
... ...
@@ -406,20 +406,20 @@ function disable_autorecords($domainid)
406 406
     $dom->ensure_userdomain();
407 407
     $dom = $dom->id;
408 408
 
409
-    db_query("UPDATE kundendaten.domains SET autodns=0 WHERE id=?", array($dom));
409
+    db_query("UPDATE kundendaten.domains SET autodns=0 WHERE id=?", [$dom]);
410 410
 }
411 411
 
412 412
 
413 413
 function domain_is_maildomain($domain)
414 414
 {
415 415
     $domain = (int) $domain;
416
-    $result = db_query("SELECT mail FROM kundendaten.domains WHERE id=?", array($domain));
416
+    $result = db_query("SELECT mail FROM kundendaten.domains WHERE id=?", [$domain]);
417 417
     $dom = $result->fetch();
418 418
     return ($dom['mail'] != 'none');
419 419
 }
420 420
 
421 421
 
422
-$own_ns = array();
422
+$own_ns = [];
423 423
 
424 424
 function own_ns()
425 425
 {
... ...
@@ -436,7 +436,7 @@ function own_ns()
436 436
 }
437 437
 
438 438
 
439
-$tld_ns = array();
439
+$tld_ns = [];
440 440
 
441 441
 function check_dns($domainname, $tld)
442 442
 {
... ...
@@ -478,7 +478,7 @@ function remove_from_dns($dom)
478 478
     if (! $current) {
479 479
         system_failure("Domain nicht gefunden!");
480 480
     }
481
-    db_query("UPDATE kundendaten.domains SET dns=0 WHERE id=?", array($current->id));
481
+    db_query("UPDATE kundendaten.domains SET dns=0 WHERE id=?", [$current->id]);
482 482
 }
483 483
 
484 484
 function add_to_dns($dom)
... ...
@@ -494,5 +494,5 @@ function add_to_dns($dom)
494 494
     if (! $current) {
495 495
         system_failure("Domain nicht gefunden!");
496 496
     }
497
-    db_query("UPDATE kundendaten.domains SET dns=1, autodns=1 WHERE id=?", array($current->id));
497
+    db_query("UPDATE kundendaten.domains SET dns=1, autodns=1 WHERE id=?", [$current->id]);
498 498
 }
... ...
@@ -18,6 +18,6 @@ $role = $_SESSION['role'];
18 18
 
19 19
 
20 20
 if ($role & ROLE_SYSTEMUSER) {
21
-    $menu["dns_dns"] = array("label" => "DNS-Einträge", "file" => "dns", "weight" => 10, "submenu" => "domains_domains");
22
-    $menu["dns_dyndns"] = array("label" => "DynDNS", "file" => "dyndns", "weight" => 11, "submenu" => "domains_domains");
21
+    $menu["dns_dns"] = ["label" => "DNS-Einträge", "file" => "dns", "weight" => 10, "submenu" => "domains_domains"];
22
+    $menu["dns_dyndns"] = ["label" => "DynDNS", "file" => "dyndns", "weight" => 11, "submenu" => "domains_domains"];
23 23
 }
... ...
@@ -20,7 +20,7 @@ require_once('inc/icons.php');
20 20
 require_once('class/domain.php');
21 21
 require_once('domains.php');
22 22
 
23
-require_role(array(ROLE_CUSTOMER, ROLE_SYSTEMUSER));
23
+require_role([ROLE_CUSTOMER, ROLE_SYSTEMUSER]);
24 24
 
25 25
 $dom = null;
26 26
 if (isset($_REQUEST['id'])) {
... ...
@@ -55,7 +55,7 @@ if (have_role(ROLE_CUSTOMER) && isset($_SESSION['customerinfo']['customerno']) &
55 55
             $is_current_user = false;
56 56
         }
57 57
         // Mehrere User vorhanden
58
-        $options = array();
58
+        $options = [];
59 59
         foreach ($useraccounts as $u) {
60 60
             $options[$u['uid']] = $u['username'];
61 61
         }
... ...
@@ -21,7 +21,7 @@ require_once('inc/icons.php');
21 21
 require_once('class/domain.php');
22 22
 require_once('domains.php');
23 23
 
24
-require_role(array(ROLE_SYSTEMUSER, ROLE_CUSTOMER));
24
+require_role([ROLE_SYSTEMUSER, ROLE_CUSTOMER]);
25 25
 
26 26
 if (have_role(ROLE_CUSTOMER)) {
27 27
     $user_domains = get_domain_list($_SESSION['customerinfo']['customerno']);
... ...
@@ -88,7 +88,7 @@ foreach ($user_domains as $domain) {
88 88
         $regdate = '<em>Zuständige Kundennummer: '.$domain->kunde.'</em>';
89 89
     }
90 90
 
91
-    $features = array();
91
+    $features = [];
92 92
     if ($domain->dns == 1) {
93 93
         if (dns_in_use($domain->id)) {
94 94
             $features[] = 'DNS';
... ...
@@ -24,13 +24,13 @@ require_once('contactapi.php');
24 24
 
25 25
 function api_download_domain($id)
26 26
 {
27
-    $result = db_query("SELECT id, CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c, registrierungsdatum, kuendigungsdatum FROM kundendaten.domains WHERE id=?", array($id));
27
+    $result = db_query("SELECT id, CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c, registrierungsdatum, kuendigungsdatum FROM kundendaten.domains WHERE id=?", [$id]);
28 28
     if ($result->rowCount() < 1) {
29 29
         system_failure('Domain nicht gefunden');
30 30
     }
31 31
     $dom = $result->fetch();
32 32
 
33
-    $data = array("domainName" => $dom['fqdn']);
33
+    $data = ["domainName" => $dom['fqdn']];
34 34
     $result = api_request('domainInfo', $data);
35 35
     if ($result['status'] != 'success') {
36 36
         system_failure("Abfrage nicht erfolgreich!");
... ...
@@ -56,7 +56,7 @@ function api_download_domain($id)
56 56
         $admin_c = download_contact($apiadmin_c);
57 57
     }
58 58
     if ($owner != $dom['owner'] || $admin_c != $dom['admin_c']) {
59
-        db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE id=?", array($owner, $admin_c, $id));
59
+        db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE id=?", [$owner, $admin_c, $id]);
60 60
     }
61 61
     return $apidomain;
62 62
 }
... ...
@@ -64,7 +64,7 @@ function api_download_domain($id)
64 64
 
65 65
 function api_upload_domain($fqdn)
66 66
 {
67
-    $result = db_query("SELECT id,CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=?", array($fqdn));
67
+    $result = db_query("SELECT id,CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=?", [$fqdn]);
68 68
     if ($result->rowCount() < 1) {
69 69
         system_failure("Unbekannte Domain");
70 70
     }
... ...
@@ -82,7 +82,7 @@ function api_upload_domain($fqdn)
82 82
     $owner = $owner['nic_id'];
83 83
     $admin_c = $admin_c['nic_id'];
84 84
 
85
-    $data = array("domainName" => $dom['fqdn']);
85
+    $data = ["domainName" => $dom['fqdn']];
86 86
     $result = api_request('domainInfo', $data);
87 87
     if ($result['status'] != 'success') {
88 88
         system_failure("Abfrage nicht erfolgreich!");
... ...
@@ -96,7 +96,7 @@ function api_upload_domain($fqdn)
96 96
             $apidomain['contacts'][$key]['contact'] = $admin_c;
97 97
         }
98 98
     }
99
-    $args = array("domain" => $apidomain);
99
+    $args = ["domain" => $apidomain];
100 100
     logger(LOG_INFO, "modules/domains/include/domainapi", "domains", "uploading domain »{$fqdn}«");
101 101
     $result = api_request('domainUpdate', $args);
102 102
     if ($result['status'] == 'error') {
... ...
@@ -110,7 +110,7 @@ function api_upload_domain($fqdn)
110 110
 
111 111
 function api_register_domain($domainname, $authinfo=null)
112 112
 {
113
-    $result = db_query("SELECT id,status,CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=?", array($domainname));
113
+    $result = db_query("SELECT id,status,CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=?", [$domainname]);
114 114
     if ($result->rowCount() < 1) {
115 115
         system_failure("Unbekannte Domain");
116 116
     }
... ...
@@ -129,13 +129,13 @@ function api_register_domain($domainname, $authinfo=null)
129 129
     $admin_c = $admin_c['nic_id'];
130 130
 
131 131
     // Frage die Masterdomain ab, von dort übernehmen wir Nameserver und zone/tech handles
132
-    $data = array("domainName" => config('masterdomain'));
132
+    $data = ["domainName" => config('masterdomain')];
133 133
     $result = api_request('domainInfo', $data);
134 134
     if ($result['status'] != 'success') {
135 135
         system_failure("Abfrage nicht erfolgreich!");
136 136
     }
137 137
     $masterdomain = $result['response'];
138
-    $newdomain = array();
138
+    $newdomain = [];
139 139
     $newdomain['name'] = $domainname;
140 140
     $newdomain['transferLockEnabled'] = true;
141 141
     $newdomain['nameservers'] = $masterdomain['nameservers'];
... ...
@@ -151,11 +151,11 @@ function api_register_domain($domainname, $authinfo=null)
151 151
     }
152 152
     $result = null;
153 153
     if ($dom['status'] == 'prereg') {
154
-        $args = array("domain" => $newdomain);
154
+        $args = ["domain" => $newdomain];
155 155
         logger(LOG_WARNING, "modules/domains/include/domainapi", "domains", "register new domain »{$newdomain['name']}«");
156 156
         $result = api_request('domainCreate', $args);
157 157
     } else {
158
-        $args = array("domain" => $newdomain, "transferData" => array("authInfo" => $authinfo));
158
+        $args = ["domain" => $newdomain, "transferData" => ["authInfo" => $authinfo]];
159 159
         logger(LOG_WARNING, "modules/domains/include/domainapi", "domains", "transfer-in domain »{$newdomain['name']}« with authinfo »{$authinfo}«");
160 160
         $result = api_request('domainTransfer', $args);
161 161
     }
... ...
@@ -169,7 +169,7 @@ function api_register_domain($domainname, $authinfo=null)
169 169
 
170 170
 function api_domain_available($domainname)
171 171
 {
172
-    $args = array("domainNames" => array($domainname));
172
+    $args = ["domainNames" => [$domainname]];
173 173
     $result = api_request('domainStatus', $args);
174 174
     $resp = $result["responses"][0];
175 175
     return $resp;
... ...
@@ -178,7 +178,7 @@ function api_domain_available($domainname)
178 178
 
179 179
 function api_cancel_domain($domainname)
180 180
 {
181
-    $data = array("domainName" => $domainname);
181
+    $data = ["domainName" => $domainname];
182 182
     $result = api_request('domainInfo', $data);
183 183
     if ($result['status'] != 'success') {
184 184
         system_failure("Abfrage nicht erfolgreich!");
... ...
@@ -187,7 +187,7 @@ function api_cancel_domain($domainname)
187 187
     if (! $apidomain['latestDeletionDateWithoutRenew']) {
188 188
         system_failure("Konnte Vertragsende nicht herausfinden.");
189 189
     }
190
-    $args = array("domainName" => $domainname, "execDate" => $apidomain['latestDeletionDateWithoutRenew']);
190
+    $args = ["domainName" => $domainname, "execDate" => $apidomain['latestDeletionDateWithoutRenew']];
191 191
     logger(LOG_WARNING, "modules/domains/include/domainapi", "domains", "cancel domain »{$domainname}« at time {$apidomain['latestDeletionDateWithoutRenew']}");
192 192
     $result = api_request('domainDelete', $args);
193 193
     if ($result['status'] == 'error') {
... ...
@@ -201,14 +201,14 @@ function api_cancel_domain($domainname)
201 201
 
202 202
 function api_unlock_domain($domainname)
203 203
 {
204
-    $data = array("domainName" => $domainname);
204
+    $data = ["domainName" => $domainname];
205 205
     $result = api_request('domainInfo', $data);
206 206
     if ($result['status'] != 'success') {
207 207
         system_failure("Abfrage nicht erfolgreich!");
208 208
     }
209 209
     $apidomain = $result['response'];
210 210
     $apidomain['transferLockEnabled'] = false;
211
-    $args = array("domain" => $apidomain);
211
+    $args = ["domain" => $apidomain];
212 212
     logger(LOG_WARNING, "modules/domains/include/domainapi", "domains", "allow transfer for domain »{$domainname}«");
213 213
     $result = api_request('domainUpdate', $args);
214 214
     if ($result['status'] == 'error') {
... ...
@@ -20,11 +20,11 @@ require_once('inc/debug.php');
20 20
 function mailman_subdomains($domain)
21 21
 {
22 22
     if (! in_array('mailman', config('modules'))) {
23
-        return array();
23
+        return [];
24 24
     }
25 25
     $domain = (int) $domain;
26
-    $result = db_query("SELECT id, hostname FROM mail.mailman_domains WHERE domain=?", array($domain));
27
-    $ret = array();
26
+    $result = db_query("SELECT id, hostname FROM mail.mailman_domains WHERE domain=?", [$domain]);
27
+    $ret = [];
28 28
     while ($line = $result->fetch()) {
29 29
         $ret[] = $line;
30 30
     }
... ...
@@ -37,7 +37,7 @@ function dns_in_use($domain)
37 37
         return false;
38 38
     }
39 39
     $domain = (int) $domain;
40
-    $result = db_query("SELECT id FROM dns.custom_records WHERE domain=?", array($domain));
40
+    $result = db_query("SELECT id FROM dns.custom_records WHERE domain=?", [$domain]);
41 41
     return ($result->rowCount() > 0);
42 42
 }
43 43
 
... ...
@@ -48,7 +48,7 @@ function mail_in_use($domain)
48 48
         return false;
49 49
     }
50 50
     $domain = (int) $domain;
51
-    $result = db_query("SELECT mail FROM kundendaten.domains WHERE id=?", array($domain));
51
+    $result = db_query("SELECT mail FROM kundendaten.domains WHERE id=?", [$domain]);
52 52
     if ($result->rowCount() < 1) {
53 53
         system_failure("Domain not found");
54 54
     }
... ...
@@ -56,18 +56,18 @@ function mail_in_use($domain)
56 56
     if ($d['mail'] == 'none') {
57 57
         return false;
58 58
     } // manually disabled
59
-    $result = db_query("SELECT id FROM mail.virtual_mail_domains WHERE domain=?", array($domain));
59
+    $result = db_query("SELECT id FROM mail.virtual_mail_domains WHERE domain=?", [$domain]);
60 60
     if ($result->rowCount() < 1) {
61 61
         return true;
62 62
     } // .courier
63
-    $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", array($domain));
63
+    $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", [$domain]);
64 64
     return ($result->rowCount() > 0);
65 65
 }
66 66
 
67 67
 function count_vmail($domain)
68 68
 {
69 69
     $domain = (int) $domain;
70
-    $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", array($domain));
70
+    $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", [$domain]);
71 71
     return $result->rowCount();
72 72
 }
73 73
 
... ...
@@ -79,13 +79,13 @@ function web_in_use($domain)
79 79
 
80 80
     $domain = (int) $domain;
81 81
 
82
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE id=? AND webserver=1", array($domain));
82
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE id=? AND webserver=1", [$domain]);
83 83
     if ($result->rowCount() < 1) {
84 84
         return false;
85 85
     }
86 86
 
87
-    $result = db_query("SELECT id FROM vhosts.vhost WHERE domain=?", array($domain));
88
-    $result2 = db_query("SELECT id FROM vhosts.alias WHERE domain=?", array($domain));
87
+    $result = db_query("SELECT id FROM vhosts.vhost WHERE domain=?", [$domain]);
88
+    $result2 = db_query("SELECT id FROM vhosts.alias WHERE domain=?", [$domain]);
89 89
     return ($result->rowCount() > 0 || $result2->rowCount() > 0);
90 90
 }
91 91
 
... ...
@@ -93,7 +93,7 @@ function domain_ownerchange($fqdn, $owner, $admin_c)
93 93
 {
94 94
     $cid = (int) $_SESSION['customerinfo']['customerno'];
95 95
     $dom = new Domain($fqdn);
96
-    db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE id=? AND kunde=?", array($owner, $admin_c, $dom->id, $cid));
96
+    db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE id=? AND kunde=?", [$owner, $admin_c, $dom->id, $cid]);
97 97
     if (update_possible($dom->id)) {
98 98
         require_once('domainapi.php');
99 99
         DEBUG("Rufe Domain-API auf!");
... ...
@@ -110,7 +110,7 @@ function update_possible($domain)
110 110
         DEBUG("Domain nicht über uns verwaltet!");
111 111
         return false;
112 112
     }
113
-    $result = db_query("SELECT aenderung_eigentuemer, ruecksprache FROM misc.domainpreise WHERE tld=?", array($dom->tld));
113
+    $result = db_query("SELECT aenderung_eigentuemer, ruecksprache FROM misc.domainpreise WHERE tld=?", [$dom->tld]);
114 114
     if ($result->rowCount() < 1) {
115 115
         // Endung nicht bei uns in der Liste erfasst
116 116
         DEBUG("Endung nicht in der Preisliste!");
... ...
@@ -129,14 +129,14 @@ function update_possible($domain)
129 129
 function unset_mailserver_lock($dom)
130 130
 {
131 131
     $id = $dom->id;
132
-    db_query("UPDATE kundendaten.domains SET secret=NULL, mailserver_lock=0 WHERE id=?", array($id));
132
+    db_query("UPDATE kundendaten.domains SET secret=NULL, mailserver_lock=0 WHERE id=?", [$id]);
133 133
 }
134 134
 
135 135
 function create_domain_secret($dom)
136 136
 {
137 137
     $id = $dom->id;
138 138
     $secret = md5(random_string(20));
139
-    db_query("UPDATE kundendaten.domains SET secret=? WHERE id=?", array($secret, $id));
139
+    db_query("UPDATE kundendaten.domains SET secret=? WHERE id=?", [$secret, $id]);
140 140
     $dom->secret = $secret;
141 141
     return $secret;
142 142
 }
... ...
@@ -169,14 +169,14 @@ function get_auth_dns($domainname, $tld)
169 169
             $NS_IP = preg_replace("/^.*\\sIN\\s+A\\s+(\\S+)$/", '\1', $l);
170 170
         }
171 171
     }
172
-    return array("$NS" => $NS_IP);
172
+    return ["$NS" => $NS_IP];
173 173
 }
174 174
 
175 175
 
176 176
 function own_ns()
177 177
 {
178 178
     $auth = dns_get_record(config('masterdomain'), DNS_NS);
179
-    $own_ns = array();
179
+    $own_ns = [];
180 180
     foreach ($auth as $ns) {
181 181
         $own_ns[] = $ns['target'];
182 182
     }
... ...
@@ -224,8 +224,8 @@ function get_txt_record($hostname, $domainname, $tld)
224 224
 function list_useraccounts()
225 225
 {
226 226
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
227
-    $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", array($customerno));
228
-    $ret = array();
227
+    $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", [$customerno]);
228
+    $ret = [];
229 229
     while ($item = $result->fetch()) {
230 230
         $ret[] = $item;
231 231
     }
... ...
@@ -249,7 +249,7 @@ function change_user($domain, $uid)
249 249
     if (! $targetuser) {
250 250
         system_failure("Ungültiger Useraccount!");
251 251
     }
252
-    db_query("UPDATE kundendaten.domains SET useraccount=? WHERE id=?", array($targetuser, $domain->id));
252
+    db_query("UPDATE kundendaten.domains SET useraccount=? WHERE id=?", [$targetuser, $domain->id]);
253 253
 }
254 254
 
255 255
 
... ...
@@ -258,11 +258,11 @@ function get_domain_offer($tld)
258 258
     $tld = filter_input_hostname($tld);
259 259
     $cid = (int) $_SESSION['customerinfo']['customerno'];
260 260
 
261
-    $data = array("tld" => $tld);
261
+    $data = ["tld" => $tld];
262 262
 
263
-    $result = db_query("SELECT tld, gebuehr, `interval`, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", array(":cid" => $cid, ":tld" => $tld));
263
+    $result = db_query("SELECT tld, gebuehr, `interval`, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", [":cid" => $cid, ":tld" => $tld]);
264 264
     if ($result->rowCount() != 1) {
265
-        $result = db_query("SELECT tld, gebuehr, `interval`, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", array(":tld" => $tld));
265
+        $result = db_query("SELECT tld, gebuehr, `interval`, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", [":tld" => $tld]);
266 266
     }
267 267
     if ($result->rowCount() != 1) {
268 268
         return false;
... ...
@@ -282,7 +282,7 @@ function set_domain_pretransfer($domain)
282 282
     $domain = (int) $domain;
283 283
     db_query(
284 284
         "UPDATE kundendaten.domains SET status='pretransfer', dns=1 WHERE id=? AND kunde=?",
285
-        array($domain, $cid)
285
+        [$domain, $cid]
286 286
     );
287 287
 }
288 288
 
... ...
@@ -295,7 +295,7 @@ function set_domain_prereg($domain)
295 295
     $domain = (int) $domain;
296 296
     db_query(
297 297
         "UPDATE kundendaten.domains SET status='prereg', dns=1 WHERE id=? AND kunde=?",
298
-        array($domain, $cid)
298
+        [$domain, $cid]
299 299
     );
300 300
 }
301 301
 
... ...
@@ -306,7 +306,7 @@ function insert_domain_external($domain, $dns = false, $mail = true)
306 306
     $uid = (int) $_SESSION['userinfo']['uid'];
307 307
     require_once("domainapi.php");
308 308
     $info = api_domain_available($domain);
309
-    if (in_array($info['status'], array('nameContainsForbiddenCharacter', 'suffixDoesNotExist'))) {
309
+    if (in_array($info['status'], ['nameContainsForbiddenCharacter', 'suffixDoesNotExist'])) {
310 310
         system_failure("Diese Domain scheint ungültig zu sein!");
311 311
     }
312 312
     $tld = $info['domainSuffix'];
... ...
@@ -314,14 +314,14 @@ function insert_domain_external($domain, $dns = false, $mail = true)
314 314
     logger(LOG_WARNING, 'modules/domains/include/domains', 'domains', 'Inserting external domain '.$info['domainNameUnicode']." DNS:{$dns} / Mail:{$mail}");
315 315
 
316 316
     db_query("INSERT INTO kundendaten.domains (status, kunde, useraccount, domainname, tld, billing, provider, dns, mail, mailserver_lock) VALUES 
317
-        ('external', ?, ?, ?, ?, 'external', 'other', 0, ?, 1)", array($cid, $uid, $domainname, $tld, ($mail ? 'auto' : 'none')));
317
+        ('external', ?, ?, ?, ?, 'external', 'other', 0, ?, 1)", [$cid, $uid, $domainname, $tld, ($mail ? 'auto' : 'none')]);
318 318
     $id = db_insert_id();
319 319
     if ($dns) {
320
-        db_query("UPDATE kundendaten.domains SET dns=1 WHERE id=?", array($id));
320
+        db_query("UPDATE kundendaten.domains SET dns=1 WHERE id=?", [$id]);
321 321
     }
322 322
     if ($mail) {
323 323
         $vmailserver = (int) $_SESSION['userinfo']['server'];
324
-        db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", array($id, $vmailserver));
324
+        db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", [$id, $vmailserver]);
325 325
     }
326 326
     return $id;
327 327
 }
... ...
@@ -330,5 +330,5 @@ function delete_domain($id)
330 330
 {
331 331
     $cid = (int) $_SESSION['customerinfo']['customerno'];
332 332
     logger(LOG_WARNING, 'modules/domains/include/domains', 'domains', 'Deleting domain '.$id);
333
-    db_query("DELETE FROM kundendaten.domains WHERE id=? AND kunde=?", array($id, $cid));
333
+    db_query("DELETE FROM kundendaten.domains WHERE id=? AND kunde=?", [$id, $cid]);
334 334
 }
... ...
@@ -18,5 +18,5 @@ $role = $_SESSION['role'];
18 18
 
19 19
 
20 20
 if (($role & ROLE_CUSTOMER) || ($role & ROLE_SYSTEMUSER)) {
21
-    $menu["domains_domains"] = array("label" => "Domains", "file" => "domains", "weight" => 1);
21
+    $menu["domains_domains"] = ["label" => "Domains", "file" => "domains", "weight" => 1];
22 22
 }
... ...
@@ -18,7 +18,7 @@ require_once('session/start.php');
18 18
 require_once('vmail.php');
19 19
 require_once('mailaccounts.php');
20 20
 
21
-require_role(array(ROLE_VMAIL_ACCOUNT, ROLE_MAILACCOUNT));
21
+require_role([ROLE_VMAIL_ACCOUNT, ROLE_MAILACCOUNT]);
22 22
 
23 23
 $role = $_SESSION['role'];
24 24
 
... ...
@@ -48,7 +48,7 @@ if (isset($_POST['password1']) && $_POST['password1'] != '') {
48 48
             success_msg('Ihr Passwort wurde geändert!');
49 49
         } elseif ($role & ROLE_MAILACCOUNT) {
50 50
             DEBUG("Ändere IMAP-Passwort");
51
-            change_mailaccount(get_mailaccount_id($accname), array('password' => $_POST['password1']));
51
+            change_mailaccount(get_mailaccount_id($accname), ['password' => $_POST['password1']]);
52 52
             success_msg('Ihr Passwort wurde geändert!');
53 53
         }
54 54
         redirect('/');
... ...
@@ -24,7 +24,7 @@ require_once('inc/jquery.php');
24 24
 javascript();
25 25
 
26 26
 $section = 'email_vmail';
27
-require_role(array(ROLE_SYSTEMUSER, ROLE_VMAIL_ACCOUNT));
27
+require_role([ROLE_SYSTEMUSER, ROLE_VMAIL_ACCOUNT]);
28 28
 
29 29
 $account = empty_account();
30 30
 $id = (isset($_GET['id']) ? (int) $_GET['id'] : 0);
... ...
@@ -168,9 +168,9 @@ if (! $quote) {
168 168
     $quote = 'none';
169 169
 }
170 170
 $form .= "<p><label for=\"ar_quote\">Originalnachricht des Absenders </label>".
171
-  html_select('ar_quote', array("none" => 'nicht in Antwort einschließen',
171
+  html_select('ar_quote', ["none" => 'nicht in Antwort einschließen',
172 172
                                 "teaser" => 'anreißen (erste 10 Zeilen)',
173
-                                "inline" => 'zitieren (max. 50 Zeilen)'), $quote)."</p>";
173
+                                "inline" => 'zitieren (max. 50 Zeilen)', ], $quote)."</p>";
174 174
                                 //"attach" => 'vollständig als Anhang beifügen'), $quote)."</p>";
175 175
 
176 176
 
... ...
@@ -199,11 +199,11 @@ $form .= "<div style=\"margin-left: 2em;\" id=\"forward_config\" class=\"option_
199 199
 $form .= '<div id="forward_entries">
200 200
 ';
201 201
 if (! isset($account['forwards'][0])) {
202
-    $account['forwards'][0] = array('destination' => '');
202
+    $account['forwards'][0] = ['destination' => ''];
203 203
 }
204 204
 while (count($account['forwards']) < 10) {
205 205
     // Dummy-Einträge für Leute ohne JavaScript
206
-    $account['forwards'][] = array('destination' => '');
206
+    $account['forwards'][] = ['destination' => ''];
207 207
 }
208 208
 for ($i = 0 ; $i < max($numforwards, 10) ; $i++) {
209 209
     $num = $i+1;
... ...
@@ -37,7 +37,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'save') {
37 37
         } else {
38 38
             $enabled = 'N';
39 39
         }
40
-        $acc = array('id' => $_GET['id'], 'account' => $account, 'mailbox' => $_POST['mailbox'], 'enabled' => $enabled);
40
+        $acc = ['id' => $_GET['id'], 'account' => $account, 'mailbox' => $_POST['mailbox'], 'enabled' => $enabled];
41 41
         if ($_POST['password'] != '') {
42 42
             $acc['password'] = $_POST['password'];
43 43
         }
... ...
@@ -61,7 +61,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'save') {
61 61
         } else {
62 62
             $enabled = 'N';
63 63
         }
64
-        $acc = array('account' => $account, 'mailbox' => $_POST['mailbox'], 'enabled' => $enabled);
64
+        $acc = ['account' => $account, 'mailbox' => $_POST['mailbox'], 'enabled' => $enabled];
65 65
         if ($_POST['password'] != '') {
66 66
             $acc['password'] = $_POST['password'];
67 67
         }
... ...
@@ -152,7 +152,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'save') {
152 152
 ');
153 153
     $_GET['edit'] = (int) $_GET['edit'];
154 154
     $account = get_mailaccount($_GET['edit']);
155
-    list($username, $domain) = explode('@', $account['account'], 2);
155
+    [$username, $domain] = explode('@', $account['account'], 2);
156 156
     $enabled = ($account['enabled'] ? ' checked="checked"' : '');
157 157
     $form = '
158 158
   <table style="margin-bottom: 1em;">
... ...
@@ -19,7 +19,7 @@ require_once('inc/base.php');
19 19
 function user_has_accounts()
20 20
 {
21 21
     $uid = (int) $_SESSION['userinfo']['uid'];
22
-    $result = db_query("SELECT id from `mail`.`mailaccounts` WHERE uid=?", array($uid));
22
+    $result = db_query("SELECT id from `mail`.`mailaccounts` WHERE uid=?", [$uid]);
23 23
     DEBUG($result->rowCount()." accounts");
24 24
     return ($result->rowCount() > 0);
25 25
 }
... ...
@@ -32,7 +32,7 @@ if (! function_exists("user_has_vmail_domain")) {
32 32
             return false;
33 33
         }
34 34
         $uid = (int) $_SESSION['userinfo']['uid'];
35
-        $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", array($uid));
35
+        $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", [$uid]);
36 36
         $row = $result->fetch();
37 37
         $count = $row[0];
38 38
         DEBUG("User has {$count} vmail-domains");
... ...
@@ -22,7 +22,7 @@ if (! function_exists("user_has_vmail_domain")) {
22 22
             return false;
23 23
         }
24 24
         $uid = (int) $_SESSION['userinfo']['uid'];
25
-        $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", array($uid));
25
+        $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", [$uid]);
26 26
         $row = $result->fetch();
27 27
         $count = $row[0];
28 28
         DEBUG("User has {$count} vmail-domains");
... ...
@@ -39,7 +39,7 @@ if (! function_exists("user_has_dotcourier_domain")) {
39 39
         }
40 40
         $uid = (int) $_SESSION['userinfo']['uid'];
41 41
         $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid UNION ".
42
-            "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.mail != 'none' AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid));
42
+            "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.mail != 'none' AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", [":uid" => $uid]);
43 43
         $ret = ($result->rowCount() > 0);
44 44
         if ($ret) {
45 45
             DEBUG("User {$uid} has dotcourier-domains");
... ...
@@ -25,12 +25,12 @@ require_once('common.php');
25 25
 function mailaccounts($uid)
26 26
 {
27 27
     $uid = (int) $uid;
28
-    $result = db_query("SELECT m.id,concat_ws('@',`m`.`local`,if(isnull(`m`.`domain`),:masterdomain,`d`.`domainname`)) AS `account`, `m`.`password` AS `cryptpass`,`m`.`maildir` AS `maildir`,aktiv from (`mail`.`mailaccounts` `m` left join `mail`.`v_domains` `d` on((`d`.`id` = `m`.`domain`))) WHERE m.uid=:uid ORDER BY if(isnull(`m`.`domain`),:masterdomain,`d`.`domainname`), local", array(":masterdomain" => config("masterdomain"), ":uid" => $uid));
28
+    $result = db_query("SELECT m.id,concat_ws('@',`m`.`local`,if(isnull(`m`.`domain`),:masterdomain,`d`.`domainname`)) AS `account`, `m`.`password` AS `cryptpass`,`m`.`maildir` AS `maildir`,aktiv from (`mail`.`mailaccounts` `m` left join `mail`.`v_domains` `d` on((`d`.`id` = `m`.`domain`))) WHERE m.uid=:uid ORDER BY if(isnull(`m`.`domain`),:masterdomain,`d`.`domainname`), local", [":masterdomain" => config("masterdomain"), ":uid" => $uid]);
29 29
     DEBUG("Found ".@$result->rowCount()." rows!");
30
-    $accounts = array();
30
+    $accounts = [];
31 31
     if (@$result->rowCount() > 0) {
32 32
         while ($acc = @$result->fetch(PDO::FETCH_OBJ)) {
33
-            array_push($accounts, array('id'=> $acc->id, 'account' => $acc->account, 'mailbox' => $acc->maildir, 'cryptpass' => $acc->cryptpass, 'enabled' => ($acc->aktiv == 1)));
33
+            array_push($accounts, ['id'=> $acc->id, 'account' => $acc->account, 'mailbox' => $acc->maildir, 'cryptpass' => $acc->cryptpass, 'enabled' => ($acc->aktiv == 1)]);
34 34
         }
35 35
     }
36 36
     return $accounts;
... ...
@@ -40,13 +40,13 @@ function get_mailaccount($id)
40 40
 {
41 41
     $id = (int) $id;
42 42
     $uid = (int) $_SESSION['userinfo']['uid'];
43
-    $result = db_query("SELECT concat_ws('@',`m`.`local`,if(isnull(`m`.`domain`),:masterdomain,`d`.`domainname`)) AS `account`, `m`.`password` AS `cryptpass`,`m`.`maildir` AS `maildir`,aktiv from (`mail`.`mailaccounts` `m` left join `mail`.`v_domains` `d` on((`d`.`id` = `m`.`domain`))) WHERE m.id=:mid AND m.uid=:uid", array(":masterdomain" => config("masterdomain"), ":uid" => $uid, ":mid" => $id));
43
+    $result = db_query("SELECT concat_ws('@',`m`.`local`,if(isnull(`m`.`domain`),:masterdomain,`d`.`domainname`)) AS `account`, `m`.`password` AS `cryptpass`,`m`.`maildir` AS `maildir`,aktiv from (`mail`.`mailaccounts` `m` left join `mail`.`v_domains` `d` on((`d`.`id` = `m`.`domain`))) WHERE m.id=:mid AND m.uid=:uid", [":masterdomain" => config("masterdomain"), ":uid" => $uid, ":mid" => $id]);
44 44
     DEBUG("Found ".$result->rowCount()." rows!");
45 45
     if ($result->rowCount() != 1) {
46 46
         system_failure('Dieser Mailaccount existiert nicht oder gehört Ihnen nicht');
47 47
     }
48 48
     $acc = $result->fetch(PDO::FETCH_OBJ);
49
-    $ret = array('account' => $acc->account, 'mailbox' => $acc->maildir,  'enabled' => ($acc->aktiv == 1));
49
+    $ret = ['account' => $acc->account, 'mailbox' => $acc->maildir,  'enabled' => ($acc->aktiv == 1)];
50 50
     DEBUG(print_r($ret, true));
51 51
     return $ret;
52 52
 }
... ...
@@ -55,11 +55,11 @@ function change_mailaccount($id, $arr)
55 55
 {
56 56
     $id = (int) $id;
57 57
     $uid = (int) $_SESSION['userinfo']['uid'];
58
-    $conditions = array();
59
-    $values = array(":id" => $id, ":uid" => $uid);
58
+    $conditions = [];
59
+    $values = [":id" => $id, ":uid" => $uid];
60 60
 
61 61
     if (isset($arr['account'])) {
62
-        list($local, $domain) = explode('@', $arr['account'], 2);
62
+        [$local, $domain] = explode('@', $arr['account'], 2);
63 63
         if ($domain == config('masterdomain')) {
64 64
             $values[':domain'] = null;
65 65
         } else {
... ...
@@ -106,7 +106,7 @@ function change_mailaccount($id, $arr)
106 106
 
107 107
 function create_mailaccount($arr)
108 108
 {
109
-    $values = array();
109
+    $values = [];
110 110
 
111 111
     if (($arr['account']) == '') {
112 112
         system_failure('empty account name!');
... ...
@@ -114,7 +114,7 @@ function create_mailaccount($arr)
114 114
 
115 115
     $values[':uid'] = (int) $_SESSION['userinfo']['uid'];
116 116
 
117
-    list($local, $domain) = explode('@', $arr['account'], 2);
117
+    [$local, $domain] = explode('@', $arr['account'], 2);
118 118
     if ($domain == config('masterdomain')) {
119 119
         $values[':domain'] = null;
120 120
     } else {
... ...
@@ -161,10 +161,10 @@ function create_mailaccount($arr)
161 161
 
162 162
 function get_mailaccount_id($accountname)
163 163
 {
164
-    list($local, $domain) = explode('@', $accountname, 2);
164
+    [$local, $domain] = explode('@', $accountname, 2);
165 165
 
166
-    $args = array(":local" => $local,
167
-                ":domain" => $domain);
166
+    $args = [":local" => $local,
167
+                ":domain" => $domain, ];
168 168
 
169 169
     $result = db_query("SELECT acc.id FROM mail.mailaccounts AS acc LEFT JOIN mail.v_domains AS dom ON (dom.id=acc.domain) WHERE local=:local AND dom.domainname=:domain", $args);
170 170
     if (($result->rowCount() == 0) && ($domain == config('masterdomain'))) {
... ...
@@ -182,7 +182,7 @@ function get_mailaccount_id($accountname)
182 182
 function delete_mailaccount($id)
183 183
 {
184 184
     $id = (int) $id;
185
-    db_query("DELETE FROM mail.mailaccounts WHERE id=?", array($id));
185
+    db_query("DELETE FROM mail.mailaccounts WHERE id=?", [$id]);
186 186
     logger(LOG_INFO, "modules/imap/include/mailaccounts", "imap", "deleted account »{$id}«");
187 187
 }
188 188
 
... ...
@@ -208,10 +208,10 @@ function check_valid($acc)
208 208
         return "Es wurde kein Domain-Teil im Account-Name angegeben. Account-Namen müssen einen Domain-Teil enthalten. Im Zweifel versuchen Sie »@".config('masterdomain')."«.";
209 209
     }
210 210
 
211
-    list($local, $domain) = explode('@', $acc['account'], 2);
211
+    [$local, $domain] = explode('@', $acc['account'], 2);
212 212
     verify_input_username($local);
213 213
     $tmpdomains = get_domain_list($user['customerno'], $user['uid']);
214
-    $domains = array();
214
+    $domains = [];
215 215
     foreach ($tmpdomains as $dom) {
216 216
         $domains[] = $dom->fqdn;
217 217
     }
... ...
@@ -233,7 +233,7 @@ function check_valid($acc)
233 233
 function imap_on_vmail_domain()
234 234
 {
235 235
     $uid = (int) $_SESSION['userinfo']['uid'];
236
-    $result = db_query("SELECT m.id FROM mail.mailaccounts AS m INNER JOIN mail.virtual_mail_domains AS vd USING (domain) WHERE vd.hostname IS NULL AND m.uid=?", array($uid));
236
+    $result = db_query("SELECT m.id FROM mail.mailaccounts AS m INNER JOIN mail.virtual_mail_domains AS vd USING (domain) WHERE vd.hostname IS NULL AND m.uid=?", [$uid]);
237 237
     if ($result->rowCount() > 0) {
238 238
         return true;
239 239
     }
... ...
@@ -243,12 +243,12 @@ function imap_on_vmail_domain()
243 243
 function user_has_only_vmail_domains()
244 244
 {
245 245
     $uid = (int) $_SESSION['userinfo']['uid'];
246
-    $result = db_query("SELECT id FROM mail.v_vmail_domains WHERE useraccount=?", array($uid));
246
+    $result = db_query("SELECT id FROM mail.v_vmail_domains WHERE useraccount=?", [$uid]);
247 247
     // User hat keine VMail-Domains
248 248
     if ($result->rowCount() == 0) {
249 249
         return false;
250 250
     }
251
-    $result = db_query("SELECT d.id FROM mail.v_domains AS d LEFT JOIN mail.v_vmail_domains AS vd USING (domainname) WHERE vd.id IS NULL AND d.user=?", array($uid));
251
+    $result = db_query("SELECT d.id FROM mail.v_domains AS d LEFT JOIN mail.v_vmail_domains AS vd USING (domainname) WHERE vd.id IS NULL AND d.user=?", [$uid]);
252 252
     // User hat keine Domains die nicht vmail-Domains sind
253 253
     if ($result->rowCount() == 0) {
254 254
         return true;
... ...
@@ -24,9 +24,9 @@ require_once('common.php');
24 24
 
25 25
 function forward_type($target)
26 26
 {
27
-    list($l, $d) = explode('@', strtolower($target), 2);
27
+    [$l, $d] = explode('@', strtolower($target), 2);
28 28
     DEBUG('Weiterleitung an '.$l.' @ '.$d);
29
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", array($d));
29
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", [$d]);
30 30
     if ($result->rowCount() > 0) {
31 31
         // Lokale Domain
32 32
         return 'local';
... ...
@@ -39,7 +39,7 @@ function forward_type($target)
39 39
 
40 40
 function empty_account()
41 41
 {
42
-    $account = array(
42
+    $account = [
43 43
         'id' => null,
44 44
         'local' => '',
45 45
         'domain' => null,
... ...
@@ -48,15 +48,15 @@ function empty_account()
48 48
     'smtpreply' => null,
49 49
     'quota' => config('vmail_basequota'),
50 50
     'quota_threshold' => 20,
51
-        'forwards' => array(),
52
-        'autoresponder' => null
53
-        );
51
+        'forwards' => [],
52
+        'autoresponder' => null,
53
+        ];
54 54
     return $account;
55 55
 }
56 56
 
57 57
 function empty_autoresponder_config()
58 58
 {
59
-    $ar = array(
59
+    $ar = [
60 60
     'valid_from' => date('Y-m-d'),
61 61
     'valid_until' => null,
62 62
     'fromname' => null,
... ...
@@ -65,15 +65,15 @@ function empty_autoresponder_config()
65 65
     'message' => 'Danke für Ihre E-Mail.
66 66
 Ich bin aktuell nicht im Büro und werde Ihre Nachricht erst nach meiner Rückkehr beantworten.
67 67
 Ihre E-Mail wird nicht weitergeleitet.',
68
-    'quote' => null
69
-    );
68
+    'quote' => null,
69
+    ];
70 70
     return $ar;
71 71
 }
72 72
 
73 73
 
74 74
 function get_vmail_id_by_emailaddr($emailaddr)
75 75
 {
76
-    $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE CONCAT(local, '@', domainname) = ?", array($emailaddr));
76
+    $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE CONCAT(local, '@', domainname) = ?", [$emailaddr]);
77 77
     $entry = $result->fetch();
78 78
     if ($entry === false) {
79 79
         return false;
... ...
@@ -86,7 +86,7 @@ function get_account_details($id, $checkuid = true)
86 86
     $id = (int) $id;
87 87
     $uid_check = '';
88 88
     DEBUG("checkuid: ".$checkuid);
89
-    $args = array(":id" => $id);
89
+    $args = [":id" => $id];
90 90
     if ($checkuid) {
91 91
         $uid = (int) $_SESSION['userinfo']['uid'];
92 92
         $uid_check = "useraccount=:uid AND ";
... ...
@@ -105,13 +105,13 @@ function get_account_details($id, $checkuid = true)
105 105
         $acc[$key] = $value;
106 106
     }
107 107
     if ($acc['forwards'] > 0) {
108
-        $result = db_query("SELECT id, destination FROM mail.vmail_forward WHERE account=?", array($acc['id']));
108
+        $result = db_query("SELECT id, destination FROM mail.vmail_forward WHERE account=?", [$acc['id']]);
109 109
         while ($item = $result->fetch()) {
110
-            array_push($acc['forwards'], array("id" => $item['id'], 'destination' => $item['destination']));
110
+            array_push($acc['forwards'], ["id" => $item['id'], 'destination' => $item['destination']]);
111 111
         }
112 112
     }
113 113
     if ($acc['autoresponder'] > 0) {
114
-        $result = db_query("SELECT id, IF(valid_from IS NULL OR valid_from > NOW() OR valid_until < NOW(), 0, 1) AS active, DATE(valid_from) AS valid_from, DATE(valid_until) AS valid_until, fromname, fromaddr, subject, message, quote FROM mail.vmail_autoresponder WHERE account=?", array($acc['id']));
114
+        $result = db_query("SELECT id, IF(valid_from IS NULL OR valid_from > NOW() OR valid_until < NOW(), 0, 1) AS active, DATE(valid_from) AS valid_from, DATE(valid_until) AS valid_until, fromname, fromaddr, subject, message, quote FROM mail.vmail_autoresponder WHERE account=?", [$acc['id']]);
115 115
         $item = $result->fetch();
116 116
         DEBUG($item);
117 117
         $acc['autoresponder'] = $item;
... ...
@@ -127,8 +127,8 @@ function get_account_details($id, $checkuid = true)
127 127
 function get_vmail_accounts()
128 128
 {
129 129
     $uid = (int) $_SESSION['userinfo']['uid'];
130
-    $result = db_query("SELECT * from mail.v_vmail_accounts WHERE useraccount=? ORDER BY domainname,local ASC", array($uid));
131
-    $ret = array();
130
+    $result = db_query("SELECT * from mail.v_vmail_accounts WHERE useraccount=? ORDER BY domainname,local ASC", [$uid]);
131
+    $ret = [];
132 132
     while ($line = $result->fetch()) {
133 133
         array_push($ret, $line);
134 134
     }
... ...
@@ -141,11 +141,11 @@ function get_vmail_accounts()
141 141
 function get_vmail_domains()
142 142
 {
143 143
     $uid = (int) $_SESSION['userinfo']['uid'];
144
-    $result = db_query("SELECT id, domainname, server FROM mail.v_vmail_domains WHERE useraccount=? ORDER BY domainname", array($uid));
144
+    $result = db_query("SELECT id, domainname, server FROM mail.v_vmail_domains WHERE useraccount=? ORDER BY domainname", [$uid]);
145 145
     if ($result->rowCount() == 0) {
146 146
         system_failure('Sie haben keine Domains für virtuelle Mail-Verarbeitung');
147 147
     }
148
-    $ret = array();
148
+    $ret = [];
149 149
     while ($tmp = $result->fetch()) {
150 150
         array_push($ret, $tmp);
151 151
     }
... ...
@@ -161,9 +161,9 @@ function find_account_id($accname)
161 161
     if (count($tmp) != 2) {
162 162
         system_failure("Der Account hat nicht die korrekte Syntax");
163 163
     }
164
-    list($local, $domainname) = $tmp;
164
+    [$local, $domainname] = $tmp;
165 165
 
166
-    $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE local=? AND domainname=? LIMIT 1", array($local, $domainname));
166
+    $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE local=? AND domainname=? LIMIT 1", [$local, $domainname]);
167 167
     if ($result->rowCount() == 0) {
168 168
         system_failure("Der Account konnte nicht gefunden werden");
169 169
     }
... ...
@@ -176,7 +176,7 @@ function change_vmail_password($accname, $newpass)
176 176
 {
177 177
     $accid = find_account_id($accname);
178 178
     $encpw = encrypt_mail_password($newpass);
179
-    db_query("UPDATE mail.vmail_accounts SET password=:encpw WHERE id=:accid", array(":encpw" => $encpw, ":accid" => $accid));
179
+    db_query("UPDATE mail.vmail_accounts SET password=:encpw WHERE id=:accid", [":encpw" => $encpw, ":accid" => $accid]);
180 180
 }
181 181
 
182 182
 
... ...
@@ -199,7 +199,7 @@ function get_max_mailboxquota($server, $oldquota)
199 199
 {
200 200
     $uid = (int) $_SESSION['userinfo']['uid'];
201 201
     $server = (int) $server;
202
-    $result = db_query("SELECT systemquota - (COALESCE(systemquota_used,0) + COALESCE(mailquota,0)) AS free FROM system.v_quota WHERE uid=:uid AND server=:server", array(":uid" => $uid, ":server" => $server));
202
+    $result = db_query("SELECT systemquota - (COALESCE(systemquota_used,0) + COALESCE(mailquota,0)) AS free FROM system.v_quota WHERE uid=:uid AND server=:server", [":uid" => $uid, ":server" => $server]);
203 203
     $item = $result->fetch();
204 204
     if (! $item) {
205 205
         return $oldquota - config('vmail_basequota');
... ...
@@ -270,7 +270,7 @@ function save_vmail_account($account)
270 270
         }
271 271
     }
272 272
 
273
-    $forwards = array();
273
+    $forwards = [];
274 274
     if (count($account['forwards']) > 0) {
275 275
         for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
276 276
             if (! check_emailaddr($account['forwards'][$i]['destination'])) {
... ...
@@ -331,15 +331,15 @@ function save_vmail_account($account)
331 331
     # Leerstring wird zu NULL
332 332
     $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : null);
333 333
 
334
-    $args = array(":local" => $account['local'],
334
+    $args = [":local" => $account['local'],
335 335
                 ":domain" => $account['domain'],
336 336
                 ":password" => $password,
337 337
                 ":enableextensions" => $account['enableextensions'],
338 338
                 ":smtpreply" => $account['smtpreply'],
339 339
                 ":quota" => $account['quota'],
340 340
                 ":quota_threshold" => $account['quota_threshold'],
341
-                ":id" => $id
342
-                );
341
+                ":id" => $id,
342
+                ];
343 343
     $query = '';
344 344
     if ($newaccount) {
345 345
         unset($args[":id"]);
... ...
@@ -374,21 +374,21 @@ function save_vmail_account($account)
374 374
         }
375 375
         $query = "REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
376 376
              "VALUES (:id, :valid_from, :valid_until, :fromname, :fromaddr, :subject, :message, :quote)";
377
-        $args = array(":id" => $id,
377
+        $args = [":id" => $id,
378 378
                   ":valid_from" => $ar['valid_from'],
379 379
                   ":valid_until" => $ar['valid_until'],
380 380
                   ":fromname" => $ar['fromname'],
381 381
                   ":fromaddr" => $ar['fromaddr'],
382 382
                   ":subject" => $ar['subject'],
383 383
                   ":message" => $ar['message'],
384
-                  ":quote" => $quote);
384
+                  ":quote" => $quote, ];
385 385
         db_query($query, $args);
386 386
     }
387 387
 
388 388
 
389 389
 
390 390
     if (! $newaccount) {
391
-        db_query("DELETE FROM mail.vmail_forward WHERE account=?", array($id));
391
+        db_query("DELETE FROM mail.vmail_forward WHERE account=?", [$id]);
392 392
     }
393 393
 
394 394
     if (count($account['forwards']) > 0) {
... ...
@@ -397,7 +397,7 @@ function save_vmail_account($account)
397 397
             if (! isset($account['forwards'][$i]['destination'])) {
398 398
                 continue;
399 399
             }
400
-            db_query($forward_query, array(":account" => $id, ":destination" => $account['forwards'][$i]['destination']));
400
+            db_query($forward_query, [":account" => $id, ":destination" => $account['forwards'][$i]['destination']]);
401 401
         }
402 402
     }
403 403
     if ($newaccount && $password) {
... ...
@@ -438,10 +438,10 @@ Wussten Sie schon, dass Sie auf mehrere Arten Ihre E-Mails abrufen können?
438 438
     // Update Mail-Quota-Cache
439 439
     if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
440 440
         $uid = (int) $_SESSION['userinfo']['uid'];
441
-        $result = db_query("SELECT useraccount, server, SUM(quota-(SELECT value FROM misc.config WHERE `key`='vmail_basequota')) AS quota, SUM(GREATEST(quota_used-(SELECT value FROM misc.config WHERE `key`='vmail_basequota'), 0)) AS used FROM mail.v_vmail_accounts WHERE useraccount=? GROUP BY useraccount, server", array($uid));
441
+        $result = db_query("SELECT useraccount, server, SUM(quota-(SELECT value FROM misc.config WHERE `key`='vmail_basequota')) AS quota, SUM(GREATEST(quota_used-(SELECT value FROM misc.config WHERE `key`='vmail_basequota'), 0)) AS used FROM mail.v_vmail_accounts WHERE useraccount=? GROUP BY useraccount, server", [$uid]);
442 442
         while ($line = $result->fetch()) {
443 443
             if ($line['quota'] !== null) {
444
-                db_query("REPLACE INTO mail.vmailquota (uid, server, quota, used) VALUES (:uid, :server, :quota, :used)", array(":uid" => $line['useraccount'], ":server" => $line['server'], ":quota" => $line['quota'], ":used" => $line['used']));
444
+                db_query("REPLACE INTO mail.vmailquota (uid, server, quota, used) VALUES (:uid, :server, :quota, :used)", [":uid" => $line['useraccount'], ":server" => $line['server'], ":quota" => $line['quota'], ":used" => $line['used']]);
445 445
             }
446 446
         }
447 447
     }
... ...
@@ -454,7 +454,7 @@ Wussten Sie schon, dass Sie auf mehrere Arten Ihre E-Mails abrufen können?
454 454
 function delete_account($id)
455 455
 {
456 456
     $account = get_account_details($id);
457
-    db_query("DELETE FROM mail.vmail_accounts WHERE id=?", array($account['id']));
457
+    db_query("DELETE FROM mail.vmail_accounts WHERE id=?", [$account['id']]);
458 458
 }
459 459
 
460 460
 
... ...
@@ -465,22 +465,22 @@ function domainsettings($only_domain=null)
465 465
     if ($only_domain) {
466 466
         $only_domain = (int) $only_domain;
467 467
     }
468
-    $domains = array();
469
-    $subdomains = array();
468
+    $domains = [];
469
+    $subdomains = [];
470 470
 
471 471
     // Domains
472
-    $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, d.mailserver_lock, m.id AS m_id, v.id AS v_id FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NULL) WHERE d.useraccount=:uid OR m.uid=:uid ORDER BY CONCAT_WS('.',d.domainname,d.tld);", array(":uid" => $uid));
472
+    $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, d.mailserver_lock, m.id AS m_id, v.id AS v_id FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NULL) WHERE d.useraccount=:uid OR m.uid=:uid ORDER BY CONCAT_WS('.',d.domainname,d.tld);", [":uid" => $uid]);
473 473
 
474 474
     while ($mydom = $result->fetch()) {
475 475
         if (! array_key_exists($mydom['id'], $domains)) {
476 476
             if ($mydom['v_id']) {
477 477
                 $mydom['mail'] = 'virtual';
478 478
             }
479
-            $domains[$mydom['id']] = array(
479
+            $domains[$mydom['id']] = [
480 480
         "name" => $mydom['name'],
481 481
         "type" => $mydom['mail'],
482
-        "mailserver_lock" => $mydom['mailserver_lock']
483
-        );
482
+        "mailserver_lock" => $mydom['mailserver_lock'],
483
+        ];
484 484
             if ($only_domain && $only_domain == $mydom['id']) {
485 485
                 return $domains[$only_domain];
486 486
             }
... ...
@@ -488,29 +488,29 @@ function domainsettings($only_domain=null)
488 488
     }
489 489
 
490 490
     // Subdomains
491
-    $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, m.id AS m_id, v.id AS v_id, IF(ISNULL(v.hostname),m.subdomain,v.hostname) AS hostname FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NOT NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NOT NULL) WHERE (m.id IS NOT NULL OR v.id IS NOT NULL) AND d.useraccount=:uid OR m.uid=:uid;", array(":uid" => $uid));
491
+    $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, m.id AS m_id, v.id AS v_id, IF(ISNULL(v.hostname),m.subdomain,v.hostname) AS hostname FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NOT NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NOT NULL) WHERE (m.id IS NOT NULL OR v.id IS NOT NULL) AND d.useraccount=:uid OR m.uid=:uid;", [":uid" => $uid]);
492 492
     while ($mydom = $result->fetch()) {
493 493
         if (! array_key_exists($mydom['id'], $subdomains)) {
494
-            $subdomains[$mydom['id']] = array();
494
+            $subdomains[$mydom['id']] = [];
495 495
         }
496 496
 
497 497
         $type = 'auto';
498 498
         if ($mydom['v_id']) {
499 499
             $type = 'virtual';
500 500
         }
501
-        $subdomains[$mydom['id']][] = array(
501
+        $subdomains[$mydom['id']][] = [
502 502
       "name" => $mydom['hostname'],
503
-      "type" => $type
504
-      );
503
+      "type" => $type,
504
+      ];
505 505
     }
506
-    return array("domains" => $domains, "subdomains" => $subdomains);
506
+    return ["domains" => $domains, "subdomains" => $subdomains];
507 507
 }
508 508
 
509 509
 
510 510
 function domain_has_vmail_accounts($domid)
511 511
 {
512 512
     $domid = (int) $domid;
513
-    $result = db_query("SELECT dom.id FROM mail.vmail_accounts AS acc LEFT JOIN mail.virtual_mail_domains AS dom ON (dom.id=acc.domain) WHERE dom.domain=?", array($domid));
513
+    $result = db_query("SELECT dom.id FROM mail.vmail_accounts AS acc LEFT JOIN mail.virtual_mail_domains AS dom ON (dom.id=acc.domain) WHERE dom.domain=?", [$domid]);
514 514
     return ($result->rowCount() > 0);
515 515
 }
516 516
 
... ...
@@ -522,7 +522,7 @@ function change_domain($id, $type)
522 522
         system_failure("Sie müssen zuerst alle E-Mail-Konten mit dieser Domain löschen, bevor Sie die Webinterface-Verwaltung für diese Domain abschalten können.");
523 523
     }
524 524
 
525
-    if (! in_array($type, array('none','auto','virtual'))) {
525
+    if (! in_array($type, ['none','auto','virtual'])) {
526 526
         system_failure("Ungültige Aktion");
527 527
     }
528 528
 
... ...
@@ -532,18 +532,18 @@ function change_domain($id, $type)
532 532
     }
533 533
 
534 534
     if ($type == 'none') {
535
-        db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL", array($id));
536
-        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
537
-        db_query("UPDATE kundendaten.domains SET mail='none', lastchange=NOW() WHERE id=?", array($id));
535
+        db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL", [$id]);
536
+        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", [$id]);
537
+        db_query("UPDATE kundendaten.domains SET mail='none', lastchange=NOW() WHERE id=?", [$id]);
538 538
     } elseif ($type == 'virtual') {
539 539
         $vmailserver = (int) $_SESSION['userinfo']['server'];
540
-        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
541
-        db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=?", array($id));
542
-        db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", array($id, $vmailserver));
540
+        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", [$id]);
541
+        db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=?", [$id]);
542
+        db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", [$id, $vmailserver]);
543 543
     } elseif ($type == 'auto') {
544
-        db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL LIMIT 1;", array($id));
545
-        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL LIMIT 1;", array($id));
546
-        db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=? LIMIT 1;", array($id));
544
+        db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL LIMIT 1;", [$id]);
545
+        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL LIMIT 1;", [$id]);
546
+        db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=? LIMIT 1;", [$id]);
547 547
     }
548 548
 }
549 549
 
... ...
@@ -20,17 +20,17 @@ require_once('include/hasdomain.php');
20 20
 require_once('include/hasaccount.php');
21 21
 
22 22
 if ($role & ROLE_SYSTEMUSER) {
23
-    $menu["email_vmail"] = array("label" => "E-Mail", "file" => "vmail", "weight" => 3);
23
+    $menu["email_vmail"] = ["label" => "E-Mail", "file" => "vmail", "weight" => 3];
24 24
 }
25 25
 if ($role & ROLE_VMAIL_ACCOUNT) {
26
-    $menu['email_edit'] = array("label" => "Einstellungen", "file" => "edit", "weight" => 10);
26
+    $menu['email_edit'] = ["label" => "Einstellungen", "file" => "edit", "weight" => 10];
27 27
 }
28 28
 if ($role & (ROLE_VMAIL_ACCOUNT | ROLE_MAILACCOUNT)) {
29
-    $menu['email_chpass'] = array("label" => "Passwort ändern", "file" => "chpass", "weight" => 15);
29
+    $menu['email_chpass'] = ["label" => "Passwort ändern", "file" => "chpass", "weight" => 15];
30 30
 }
31 31
 if ($role & ROLE_SYSTEMUSER) {
32
-    $menu["email_domains"] = array("label" => "Mail-Verwaltung", "file" => "domains", "weight" => 1, "submenu" => "domains_domains");
32
+    $menu["email_domains"] = ["label" => "Mail-Verwaltung", "file" => "domains", "weight" => 1, "submenu" => "domains_domains"];
33 33
 }
34 34
 if ($role & ROLE_SYSTEMUSER && (user_has_accounts() || ! user_has_vmail_domain() || user_has_dotcourier_domain())) {
35
-    $menu["email_imap"] = array("label" => "IMAP/POP3", "file" => "imap", "weight" => 20, 'submenu' => "email_vmail");
35
+    $menu["email_imap"] = ["label" => "IMAP/POP3", "file" => "imap", "weight" => 20, 'submenu' => "email_vmail"];
36 36
 }
... ...
@@ -18,7 +18,7 @@ require_once('session/start.php');
18 18
 
19 19
 require_once('vmail.php');
20 20
 
21
-require_role(array(ROLE_SYSTEMUSER, ROLE_VMAIL_ACCOUNT));
21
+require_role([ROLE_SYSTEMUSER, ROLE_VMAIL_ACCOUNT]);
22 22
 
23 23
 require_once("inc/debug.php");
24 24
 global $debugmode;
... ...
@@ -35,7 +35,7 @@ if ($_GET['action'] == 'edit') {
35 35
         $id = get_vmail_id_by_emailaddr($_SESSION['mailaccount']);
36 36
         $account = get_account_details($id, false);
37 37
         // Leere das, sonst werden die vervielfacht
38
-        $account['forwards'] = array();
38
+        $account['forwards'] = [];
39 39
     } else {
40 40
         $id = isset($_GET['id']) ? (int) $_GET['id'] : null;
41 41
 
... ...
@@ -162,7 +162,7 @@ if ($_GET['action'] == 'edit') {
162 162
                 break;
163 163
             }
164 164
             if (isset($_POST['forward_to_'.$num]) && chop($_POST['forward_to_'.$num]) != '') {
165
-                $fwd = array("destination" => chop($_POST['forward_to_'.$num]));
165
+                $fwd = ["destination" => chop($_POST['forward_to_'.$num])];
166 166
                 array_push($account['forwards'], $fwd);
167 167
             }
168 168
             $num++;
... ...
@@ -15,26 +15,26 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
18
-    $shortcuts[] = array( 'section' => 'E-Mail',
18
+    $shortcuts[] = [ 'section' => 'E-Mail',
19 19
                         'weight'  => 40,
20 20
                         'file'    => 'vmail',
21 21
                         'icon'    => 'email.png',
22 22
                         'title'   => 'E-Mail-Adressen verwalten',
23
-                        'alert'   => null );
23
+                        'alert'   => null, ];
24 24
 }
25 25
 if ($_SESSION['role'] & ROLE_MAILACCOUNT || $_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
26
-    $shortcuts[] = array( 'section' => 'E-Mail',
26
+    $shortcuts[] = [ 'section' => 'E-Mail',
27 27
                         'weight'  => 50,
28 28
                         'file'    => 'chpass',
29 29
                         'icon'    => 'pwchange.png',
30 30
                         'title'   => 'Passwort ändern',
31
-                        'alert'   => null );
31
+                        'alert'   => null, ];
32 32
 }
33 33
 if ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
34
-    $shortcuts[] = array( 'section' => 'E-Mail',
34
+    $shortcuts[] = [ 'section' => 'E-Mail',
35 35
                         'weight'  => 40,
36 36
                         'file'    => 'edit',
37 37
                         'icon'    => 'cog.png',
38 38
                         'title'   => 'E-Mail-Einstellungen',
39
-                        'alert'   => null );
39
+                        'alert'   => null, ];
40 40
 }
... ...
@@ -21,7 +21,7 @@ require_once('inc/icons.php');
21 21
 require_once('vmail.php');
22 22
 
23 23
 $section = 'email_vmail';
24
-require_role(array(ROLE_SYSTEMUSER));
24
+require_role([ROLE_SYSTEMUSER]);
25 25
 
26 26
 if (! isset($_REQUEST['account'])) {
27 27
     system_failure("Fehler beim Aufruf dieser Seite");
... ...
@@ -53,12 +53,12 @@ Subdomains können grundsätzlich nur durch Administratoren eingerichtet und ver
53 53
     $domains = get_vmail_domains();
54 54
     $all_accounts = get_vmail_accounts();
55 55
 
56
-    $sorted_by_domains = array();
56
+    $sorted_by_domains = [];
57 57
     foreach ($all_accounts as $account) {
58 58
         if (array_key_exists($account['domain'], $sorted_by_domains)) {
59 59
             array_push($sorted_by_domains[$account['domain']], $account);
60 60
         } else {
61
-            $sorted_by_domains[$account['domain']] = array($account);
61
+            $sorted_by_domains[$account['domain']] = [$account];
62 62
         }
63 63
     }
64 64
 
... ...
@@ -107,7 +107,7 @@ Subdomains können grundsätzlich nur durch Administratoren eingerichtet und ver
107 107
                         continue;
108 108
                     }
109 109
                     $acc = get_account_details($this_account['id']);
110
-                    $actions = array();
110
+                    $actions = [];
111 111
                     DEBUG($acc);
112 112
                     if ($acc['password'] != '') {
113 113
                         $percent = round(($acc["quota_used"] / $acc["quota"]) * 100);
... ...
@@ -23,7 +23,7 @@ require_once('include/vmail.php');
23 23
 
24 24
 $id = get_vmail_id_by_emailaddr($_SESSION['mailaccount']);
25 25
 $acc = get_account_details($id, false);
26
-$actions = array();
26
+$actions = [];
27 27
 DEBUG($acc);
28 28
 
29 29
 $content = '<h3>Aktueller Speicherplatzverbrauch</h3>';
... ...
@@ -44,11 +44,11 @@ $active = ($ftpuser['active'] == 1 ? 'checked="checked" ' : '');
44 44
 $forcessl = ($ftpuser['forcessl'] == 1 ? 'checked="checked" ' : '');
45 45
 
46 46
 $servers = server_names();
47
-$available_servers = array_merge(array(my_server_id()), additional_servers());
47
+$available_servers = array_merge([my_server_id()], additional_servers());
48 48
 
49 49
 $whichserver = '<strong>'.$servers[my_server_id()].'</strong>';
50 50
 if (count($available_servers) > 1) {
51
-    $serverselect = array();
51
+    $serverselect = [];
52 52
     foreach ($available_servers as $s) {
53 53
         $serverselect[$s] = $servers[$s];
54 54
     }
... ...
@@ -20,8 +20,8 @@ require_once('inc/security.php');
20 20
 function list_ftpusers()
21 21
 {
22 22
     $uid = (int) $_SESSION['userinfo']['uid'];
23
-    $result = db_query("SELECT id, username, homedir, active, forcessl FROM system.ftpusers WHERE uid=?", array($uid));
24
-    $ftpusers = array();
23
+    $result = db_query("SELECT id, username, homedir, active, forcessl FROM system.ftpusers WHERE uid=?", [$uid]);
24
+    $ftpusers = [];
25 25
     while ($u = $result->fetch()) {
26 26
         $ftpusers[] = $u;
27 27
     }
... ...
@@ -31,7 +31,7 @@ function list_ftpusers()
31 31
 function empty_ftpuser()
32 32
 {
33 33
     $myserver = my_server_id();
34
-    return array("id" => "0", "username" => "", "password" => "", "homedir" => "", "active" => "1", "forcessl" => "1", "server" => $myserver);
34
+    return ["id" => "0", "username" => "", "password" => "", "homedir" => "", "active" => "1", "forcessl" => "1", "server" => $myserver];
35 35
 }
36 36
 
37 37
 function load_ftpuser($id)
... ...
@@ -39,7 +39,7 @@ function load_ftpuser($id)
39 39
     if ($id == 0) {
40 40
         return empty_ftpuser();
41 41
     }
42
-    $args = array(":id" => $id, ":uid" => $_SESSION['userinfo']['uid']);
42
+    $args = [":id" => $id, ":uid" => $_SESSION['userinfo']['uid']];
43 43
     $result = db_query("SELECT id, username, password, homedir, active, forcessl, server FROM system.ftpusers WHERE uid=:uid AND id=:id", $args);
44 44
     if ($result->rowCount() != 1) {
45 45
         system_failure("Fehler beim auslesen des Accounts");
... ...
@@ -85,12 +85,12 @@ function save_ftpuser($data)
85 85
         system_failure('Wenn Sie einen neuen Zugang anlegen, müssen Sie ein Passwort setzen');
86 86
     }
87 87
 
88
-    $args = array(":username" => $_SESSION['userinfo']['username'].'-'.$data['username'],
88
+    $args = [":username" => $_SESSION['userinfo']['username'].'-'.$data['username'],
89 89
                 ":homedir" => $homedir,
90 90
                 ":active" => ($data['active'] == 1 ? 1 : 0),
91 91
                 ":forcessl" => ($data['forcessl'] == 0 ? 0 : 1),
92 92
                 ":server" => $server,
93
-                ":uid" => $_SESSION['userinfo']['uid']);
93
+                ":uid" => $_SESSION['userinfo']['uid'], ];
94 94
 
95 95
     if ($data['id']) {
96 96
         $args[":id"] = $data['id'];
... ...
@@ -109,14 +109,14 @@ function save_ftpuser($data)
109 109
 
110 110
 function delete_ftpuser($id)
111 111
 {
112
-    $args = array(":id" => $id, ":uid" => $_SESSION['userinfo']['uid']);
112
+    $args = [":id" => $id, ":uid" => $_SESSION['userinfo']['uid']];
113 113
     db_query("DELETE FROM system.ftpusers WHERE id=:id AND uid=:uid", $args);
114 114
 }
115 115
 
116 116
 
117 117
 function get_gid($groupname)
118 118
 {
119
-    $result = db_query("SELECT gid FROM system.gruppen WHERE name=?", array($groupname));
119
+    $result = db_query("SELECT gid FROM system.gruppen WHERE name=?", [$groupname]);
120 120
     if ($result->rowCount() != 1) {
121 121
         system_failure('cannot determine gid of ftpusers group');
122 122
     }
... ...
@@ -131,7 +131,7 @@ function get_gid($groupname)
131 131
 
132 132
 function have_regular_ftp()
133 133
 {
134
-    $args = array(":gid" => get_gid('ftpusers'), ":uid" => $_SESSION['userinfo']['uid']);
134
+    $args = [":gid" => get_gid('ftpusers'), ":uid" => $_SESSION['userinfo']['uid']];
135 135
     $result = db_query("SELECT * FROM system.gruppenzugehoerigkeit WHERE gid=:gid AND uid=:uid", $args);
136 136
     return ($result->rowCount() > 0);
137 137
 }
... ...
@@ -140,12 +140,12 @@ function have_regular_ftp()
140 140
 function enable_regular_ftp()
141 141
 {
142 142
     require_role(ROLE_SYSTEMUSER);
143
-    $args = array(":gid" => get_gid('ftpusers'), ":uid" => $_SESSION['userinfo']['uid']);
143
+    $args = [":gid" => get_gid('ftpusers'), ":uid" => $_SESSION['userinfo']['uid']];
144 144
     db_query("REPLACE INTO system.gruppenzugehoerigkeit (gid, uid) VALUES (:gid, :uid)", $args);
145 145
 }
146 146
 
147 147
 function disable_regular_ftp()
148 148
 {
149
-    $args = array(":gid" => get_gid('ftpusers'), ":uid" => $_SESSION['userinfo']['uid']);
149
+    $args = [":gid" => get_gid('ftpusers'), ":uid" => $_SESSION['userinfo']['uid']];
150 150
     db_query("DELETE FROM system.gruppenzugehoerigkeit WHERE gid=:gid AND uid=:uid", $args);
151 151
 }
... ...
@@ -18,8 +18,8 @@ $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20 20
     if (have_module('systemuser')) {
21
-        $menu["ftpusers_accounts"] = array("label" => "FTP-Zugriff", "file" => "accounts", "weight" => 35, 'submenu' => 'systemuser_account');
21
+        $menu["ftpusers_accounts"] = ["label" => "FTP-Zugriff", "file" => "accounts", "weight" => 35, 'submenu' => 'systemuser_account'];
22 22
     } else {
23
-        $menu["ftpusers_accounts"] = array("label" => "FTP-Zugriff", "file" => "accounts", "weight" => 35);
23
+        $menu["ftpusers_accounts"] = ["label" => "FTP-Zugriff", "file" => "accounts", "weight" => 35];
24 24
     }
25 25
 }
... ...
@@ -66,7 +66,7 @@ function git_wrapper($commandline)
66 66
     global $git_wrapper, $data_dir;
67 67
 
68 68
     $command = $git_wrapper.' '.$commandline;
69
-    $output = array();
69
+    $output = [];
70 70
     $retval = 0;
71 71
     DEBUG($command);
72 72
     exec($command, $output, $retval);
... ...
@@ -95,25 +95,25 @@ function list_repos()
95 95
     DEBUG("using config file ".$userconfig);
96 96
     if (! is_file($userconfig)) {
97 97
         DEBUG("user-config does not exist");
98
-        return array();
98
+        return [];
99 99
     }
100 100
 
101
-    $repos = array();
101
+    $repos = [];
102 102
     $lines = file($userconfig);
103 103
     $current_repo = null;
104
-    $current_repo_users = array();
104
+    $current_repo_users = [];
105 105
     foreach ($lines as $line) {
106 106
         DEBUG("LINE: ".$line);
107
-        $m = array();
107
+        $m = [];
108 108
         if (preg_match('/^(\S+) "[^"]+" = "([^"]+)"$/', $line, $m) != 0) {
109 109
             if (!array_key_exists($m[1], $repos)) {
110
-                $repos[$m[1]] = array('users' => null, 'description' => '');
110
+                $repos[$m[1]] = ['users' => null, 'description' => ''];
111 111
             }
112 112
             DEBUG("found description: {$m[1]} = \"{$m[2]}\"");
113 113
             $repos[$m[1]]['description'] = $m[2];
114 114
         } elseif (preg_match('_^\s*repo (\S+)\s*$_', $line, $m) != 0) {
115 115
             if (!array_key_exists($m[1], $repos)) {
116
-                $repos[$m[1]] = array('users' => null, 'description' => '');
116
+                $repos[$m[1]] = ['users' => null, 'description' => ''];
117 117
             }
118 118
             if ($current_repo) {
119 119
                 $repos[$current_repo]['users'] = $current_repo_users;
... ...
@@ -121,7 +121,7 @@ function list_repos()
121 121
             DEBUG("found repo ".$m[1]);
122 122
             $current_repo = chop($m[1]);
123 123
             verify_input_identifier($current_repo);
124
-            $current_repo_users = array();
124
+            $current_repo_users = [];
125 125
         } elseif (preg_match('/^\s*(R|RW|RW\+)\s*=\s*([[:alnum:]][[:alnum:]._-]*)\s*$/', $line, $m) != 0) {
126 126
             DEBUG("found access rule: ".$m[1]." for ".$m[2]);
127 127
             $current_repo_users[chop($m[2])] = chop($m[1]);
... ...
@@ -144,13 +144,13 @@ function list_users()
144 144
     DEBUG("using config file ".$userconfig);
145 145
     if (! is_file($userconfig)) {
146 146
         DEBUG("user-config does not exist");
147
-        return array();
147
+        return [];
148 148
     }
149 149
 
150 150
     $lines = file($userconfig);
151
-    $users = array();
151
+    $users = [];
152 152
     foreach ($lines as $line) {
153
-        $m = array();
153
+        $m = [];
154 154
         if (preg_match('_# user ([^]]+)_', $line, $m) != 0) {
155 155
             $currentuser = trim($m[1]);
156 156
             verify_input_identifier($currentuser);
... ...
@@ -173,13 +173,13 @@ function list_foreign_users()
173 173
     DEBUG("using config file ".$userconfig);
174 174
     if (! is_file($userconfig)) {
175 175
         DEBUG("user-config does not exist");
176
-        return array();
176
+        return [];
177 177
     }
178 178
 
179 179
     $lines = file($userconfig);
180
-    $users = array();
180
+    $users = [];
181 181
     foreach ($lines as $line) {
182
-        $m = array();
182
+        $m = [];
183 183
         if (preg_match('_# foreign user ([^]]+)_', $line, $m) != 0) {
184 184
             $users[] = chop($m[1]);
185 185
         }
... ...
@@ -257,7 +257,7 @@ function delete_foreign_user($handle)
257 257
         $content = file($userconfig);
258 258
         DEBUG("Old file:");
259 259
         DEBUG($content);
260
-        $newcontent = array();
260
+        $newcontent = [];
261 261
         foreach ($content as $line) {
262 262
             if (preg_match('/^# foreign user '.$handle.'$/', $line)) {
263 263
                 DEBUG("delete1: ".$line);
... ...
@@ -290,7 +290,7 @@ function newkey($pubkey, $handle)
290 290
         system_failure("Der eingegebene Name enthält ungültige Zeichen. Bitte nur Buchstaben, Zahlen, Unterstrich und Bindestrich benutzen.");
291 291
     }
292 292
 
293
-    $pubkey = trim(str_replace(array("\r", "\n"), ' ', $pubkey));
293
+    $pubkey = trim(str_replace(["\r", "\n"], ' ', $pubkey));
294 294
 
295 295
     $keyfile = $key_dir.'/'.$handle.'.pub';
296 296
     file_put_contents($keyfile, $pubkey);
... ...
@@ -357,7 +357,7 @@ function delete_key($handle)
357 357
         $content = file($userconfig);
358 358
         DEBUG("Old file:");
359 359
         DEBUG($content);
360
-        $newcontent = array();
360
+        $newcontent = [];
361 361
         foreach ($content as $line) {
362 362
             if (preg_match('/^# user '.$handle.'$/', $line)) {
363 363
                 DEBUG("delete1: ".$line);
... ...
@@ -384,14 +384,14 @@ function remove_repo_from_array($data, $repo)
384 384
 {
385 385
     DEBUG("Request to remove repo »{$repo}«...");
386 386
     $inside = false;
387
-    $outdata = array();
387
+    $outdata = [];
388 388
     $blank = true;
389 389
     foreach ($data as $line) {
390 390
         if ($blank && chop($line) == '') {
391 391
             continue;
392 392
         }
393 393
         $blank = (chop($line) == '');
394
-        $m = array();
394
+        $m = [];
395 395
         if (preg_match('_^\s*repo (\S+)\s*$_', $line, $m) != 0) {
396 396
             $inside = ($m[1] == $repo);
397 397
         }
... ...
@@ -481,7 +481,7 @@ function save_repo($repo, $permissions, $description)
481 481
     $username = $_SESSION['userinfo']['username'];
482 482
     $userconfig = $config_dir . '/' . $username . '.conf';
483 483
     DEBUG("using config file ".$userconfig);
484
-    $data = array();
484
+    $data = [];
485 485
     if (! is_file($userconfig)) {
486 486
         DEBUG("user-config does not exist, creating new one");
487 487
         set_user_include();
... ...
@@ -17,5 +17,5 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20
-    $menu["git_git"] = array("label" => "Git-Zugänge", "file" => "git", "weight" => 1, "submenu" => "systemuser_account");
20
+    $menu["git_git"] = ["label" => "Git-Zugänge", "file" => "git", "weight" => 1, "submenu" => "systemuser_account"];
21 21
 }
... ...
@@ -64,7 +64,7 @@ if ($_GET['action'] == 'newuser') {
64 64
     die();
65 65
 } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
66 66
     check_form_token('git_edit');
67
-    $permissions = array();
67
+    $permissions = [];
68 68
     $users = array_merge(list_users(), list_foreign_users());
69 69
     foreach ($users as $u) {
70 70
         if (isset($_POST[$u])) {
... ...
@@ -17,8 +17,8 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 function whitelist_entries()
18 18
 {
19 19
     $uid = (int) $_SESSION['userinfo']['uid'];
20
-    $res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid=?", array($uid));
21
-    $return = array();
20
+    $res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid=?", [$uid]);
21
+    $return = [];
22 22
     while ($line = $res->fetch()) {
23 23
         array_push($return, $line);
24 24
     }
... ...
@@ -28,8 +28,8 @@ function whitelist_entries()
28 28
 
29 29
 function get_whitelist_details($id)
30 30
 {
31
-    $args = array(":id" => $id,
32
-                ":uid" => $_SESSION['userinfo']['uid']);
31
+    $args = [":id" => $id,
32
+                ":uid" => $_SESSION['userinfo']['uid'], ];
33 33
     $res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid=:uid AND id=:id", $args);
34 34
     if ($res->rowCount() != 1) {
35 35
         system_failure('Kann diesen Eintrag nicht finden');
... ...
@@ -44,7 +44,7 @@ function delete_from_whitelist($id)
44 44
     // Check if the ID is valid: This will die if not.
45 45
     $entry = get_whitelist_details($id);
46 46
 
47
-    db_query("DELETE FROM mail.greylisting_manual_whitelist WHERE id=?", array($id));
47
+    db_query("DELETE FROM mail.greylisting_manual_whitelist WHERE id=?", [$id]);
48 48
 }
49 49
 
50 50
 
... ...
@@ -57,8 +57,8 @@ function valid_entry($local, $domain)
57 57
         }
58 58
         return true;
59 59
     }
60
-    $args = array(":domain" => $domain,
61
-                ":uid" => $_SESSION['userinfo']['uid']);
60
+    $args = [":domain" => $domain,
61
+                ":uid" => $_SESSION['userinfo']['uid'], ];
62 62
     $res = db_query("SELECT id FROM mail.v_domains WHERE domainname=:domain AND user=:uid", $args);
63 63
     if ($res->rowCount() != 1) {
64 64
         system_failure('Diese domain gehört Ihnen nicht!');
... ...
@@ -70,9 +70,9 @@ function valid_entry($local, $domain)
70 70
 function new_whitelist_entry($local, $domain, $minutes)
71 71
 {
72 72
     valid_entry($local, $domain);
73
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
73
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
74 74
                 ":local" => $local,
75
-                ":domain" => $domain);
75
+                ":domain" => $domain, ];
76 76
 
77 77
     $expire = 'NULL';
78 78
     if ($minutes == 'none') {
... ...
@@ -17,5 +17,5 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20
-    $menu['greylisting_whitelist'] = array("label" => "Greylisting", "file" => "whitelist", "weight" => 5, 'submenu' => 'email_vmail');
20
+    $menu['greylisting_whitelist'] = ["label" => "Greylisting", "file" => "whitelist", "weight" => 5, 'submenu' => 'email_vmail'];
21 21
 }
... ...
@@ -56,7 +56,7 @@ foreach ($whitelist as $entry) {
56 56
     $form .= "<tr><td>{$local}@{$entry['domain']}</td><td>{$entry['date']}</td><td>{$end}</td><td>".internal_link("save", "<img src=\"{$prefix}images/delete.png\" alt=\"Eintrag löschen\" title=\"Diesen Eintrag löschen\" style=\"width: 16px; height: 16px;\" />", "action=delete&id={$entry['id']}")."</td></tr>\n";
57 57
 }
58 58
 
59
-$form .= '<tr><td><input type="text" name="address" /></td><td>-</td><td>'.html_select('expire', array('none' => 'Unbegrenzt', '30' => '30 Minuten', '60' => '1 Stunde', '720' => '12 Stunden', '1440' => '1 Tag', '2880' => '2 Tage', '10080' => '1 Woche', '43200' => '30 Tage'), '1440').'</td><td></td></tr>';
59
+$form .= '<tr><td><input type="text" name="address" /></td><td>-</td><td>'.html_select('expire', ['none' => 'Unbegrenzt', '30' => '30 Minuten', '60' => '1 Stunde', '720' => '12 Stunden', '1440' => '1 Tag', '2880' => '2 Tage', '10080' => '1 Woche', '43200' => '30 Tage'], '1440').'</td><td></td></tr>';
60 60
 
61 61
 $form .= '</table>';
62 62
 
... ...
@@ -39,7 +39,7 @@ if ($_POST['password1'] != '') {
39 39
     } elseif (($check = strong_password($_POST['password1'])) !== true) {
40 40
         input_error("Das Passwort ist zu einfach ({$check})!");
41 41
     } else {
42
-        change_mailaccount(get_mailaccount_id($_SESSION['mailaccount']), array('password' => $_POST['password1']));
42
+        change_mailaccount(get_mailaccount_id($_SESSION['mailaccount']), ['password' => $_POST['password1']]);
43 43
         if (! $debugmode) {
44 44
             header('Location: chpass');
45 45
         } else {
... ...
@@ -20,7 +20,7 @@ require_once('include/hasdomain.php');
20 20
 $role = $_SESSION['role'];
21 21
 
22 22
 if ($role & ROLE_SYSTEMUSER && (user_has_accounts() || ! user_has_vmail_domain() || user_has_dotcourier_domain())) {
23
-    $menu["imap_accounts"] = array("label" => "IMAP/POP3", "file" => "accounts", "weight" => 10);
23
+    $menu["imap_accounts"] = ["label" => "IMAP/POP3", "file" => "accounts", "weight" => 10];
24 24
 } elseif ($role & ROLE_MAILACCOUNT) {
25
-    $menu["imap_chpass"] = array("label" => "Passwort ändern", "file" => "chpass", "weight" => 10);
25
+    $menu["imap_chpass"] = ["label" => "Passwort ändern", "file" => "chpass", "weight" => 10];
26 26
 }
... ...
@@ -17,7 +17,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 require_once('inc/base.php');
18 18
 require_once('x509.php');
19 19
 
20
-require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
20
+require_role([ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT]);
21 21
 
22 22
 title('Anmeldung über Client-Zertifikat');
23 23
 output('<p>Sie können Sie an diesem Webinterface wahlweise auch über ein SSL-Client-Zertifikat anmelden. Dazu muss das gewünschte Zertifikat <em>vorher</em> in Ihrem Browser installiert werden und kann dann hier hinzugefügt werden.</p>
... ...
@@ -17,7 +17,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 require_once('session/start.php');
18 18
 require_once('x509.php');
19 19
 
20
-require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
20
+require_role([ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT]);
21 21
 
22 22
 
23 23
 if ($_GET['action'] == 'new') {
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('inc/debug.php');
18 18
 require_once('inc/security.php');
19
-require_role(array(ROLE_SYSTEMUSER, ROLE_CUSTOMER, ROLE_SUBUSER));
19
+require_role([ROLE_SYSTEMUSER, ROLE_CUSTOMER, ROLE_SUBUSER]);
20 20
 
21 21
 title("Passwort ändern");
22 22
 $error = '';
... ...
@@ -18,8 +18,8 @@ require_once('session/checkuser.php');
18 18
 
19 19
 function user_customer_match($cust, $user)
20 20
 {
21
-    $args = array(":cid" => $cust,
22
-                ":user" => $user);
21
+    $args = [":cid" => $cust,
22
+                ":user" => $user, ];
23 23
     $result = db_query("SELECT uid FROM system.useraccounts WHERE kunde=:cid AND username=:user AND kundenaccount=1", $args);
24 24
     if ($result->rowCount() > 0) {
25 25
         return true;
... ...
@@ -29,7 +29,7 @@ function user_customer_match($cust, $user)
29 29
 
30 30
 function find_username($input)
31 31
 {
32
-    $args = array(":user" => $input);
32
+    $args = [":user" => $input];
33 33
     $result = db_query("SELECT username FROM system.useraccounts WHERE username=:user AND kundenaccount=1", $args);
34 34
     if ($result->rowCount() > 0) {
35 35
         $line = $result->fetch();
... ...
@@ -41,8 +41,8 @@ function find_username($input)
41 41
 
42 42
 function customer_has_email($customerno, $email)
43 43
 {
44
-    $args = array(":cid" => $customerno,
45
-                ":email" => $email);
44
+    $args = [":cid" => $customerno,
45
+                ":email" => $email, ];
46 46
     $result = db_query("SELECT NULL FROM kundendaten.kunden WHERE id=:cid AND (email=:email OR email_extern=:email OR email_rechnung=:email)", $args);
47 47
     return ($result->rowCount() > 0);
48 48
 }
... ...
@@ -51,8 +51,8 @@ function customer_has_email($customerno, $email)
51 51
 function validate_token($customerno, $token)
52 52
 {
53 53
     expire_tokens();
54
-    $args = array(":cid" => $customerno,
55
-                ":token" => $token);
54
+    $args = [":cid" => $customerno,
55
+                ":token" => $token, ];
56 56
     $result = db_query("SELECT NULL FROM kundendaten.kunden WHERE id=:cid AND token=:token", $args);
57 57
     return ($result->rowCount() > 0);
58 58
 }
... ...
@@ -61,7 +61,7 @@ function validate_token($customerno, $token)
61 61
 function get_uid_for_token($token)
62 62
 {
63 63
     expire_tokens();
64
-    $result = db_query("SELECT uid FROM system.usertoken WHERE token=?", array($token));
64
+    $result = db_query("SELECT uid FROM system.usertoken WHERE token=?", [$token]);
65 65
     if ($result->rowCount() == 0) {
66 66
         return null;
67 67
     }
... ...
@@ -71,7 +71,7 @@ function get_uid_for_token($token)
71 71
 
72 72
 function get_username_for_uid($uid)
73 73
 {
74
-    $result = db_query("SELECT username FROM system.useraccounts WHERE uid=?", array($uid));
74
+    $result = db_query("SELECT username FROM system.useraccounts WHERE uid=?", [$uid]);
75 75
     if ($result->rowCount() != 1) {
76 76
         system_failure("Unexpected number of users with this uid (!= 1)!");
77 77
     }
... ...
@@ -82,8 +82,8 @@ function get_username_for_uid($uid)
82 82
 function validate_uid_token($uid, $token)
83 83
 {
84 84
     expire_tokens();
85
-    $args = array(":uid" => $uid,
86
-                ":token" => $token);
85
+    $args = [":uid" => $uid,
86
+                ":token" => $token, ];
87 87
     $result = db_query("SELECT NULL FROM system.usertoken WHERE uid=:uid AND token=:token", $args);
88 88
     return ($result->rowCount() > 0);
89 89
 }
... ...
@@ -98,27 +98,27 @@ function expire_tokens()
98 98
 
99 99
 function invalidate_customer_token($customerno)
100 100
 {
101
-    db_query("UPDATE kundendaten.kunden SET token=NULL, token_create=NULL WHERE id=?", array($customerno));
101
+    db_query("UPDATE kundendaten.kunden SET token=NULL, token_create=NULL WHERE id=?", [$customerno]);
102 102
 }
103 103
 
104 104
 function invalidate_systemuser_token($uid)
105 105
 {
106
-    db_query("DELETE FROM system.usertoken WHERE uid=?", array($uid));
106
+    db_query("DELETE FROM system.usertoken WHERE uid=?", [$uid]);
107 107
 }
108 108
 
109 109
 function create_token($username)
110 110
 {
111 111
     expire_tokens();
112
-    $result = db_query("SELECT uid FROM system.useraccounts WHERE username=?", array($username));
112
+    $result = db_query("SELECT uid FROM system.useraccounts WHERE username=?", [$username]);
113 113
     $uid = (int) $result->fetch()['uid'];
114 114
 
115
-    $result = db_query("SELECT created FROM system.usertoken WHERE uid=?", array($uid));
115
+    $result = db_query("SELECT created FROM system.usertoken WHERE uid=?", [$uid]);
116 116
     if ($result->rowCount() > 0) {
117 117
         system_failure("Für Ihr Benutzerkonto ist bereits eine Passwort-Erinnerung versendet worden. Bitte wenden Sie sich an den Support wenn Sie diese nicht erhalten haben.");
118 118
     }
119 119
 
120
-    $args = array(":uid" => $uid,
121
-                ":token" => random_string(16));
120
+    $args = [":uid" => $uid,
121
+                ":token" => random_string(16), ];
122 122
     db_query("INSERT INTO system.usertoken VALUES (:uid, NOW(), NOW() + INTERVAL 1 DAY, :token)", $args);
123 123
     return true;
124 124
 }
... ...
@@ -126,7 +126,7 @@ function create_token($username)
126 126
 
127 127
 function emailaddress_for_user($username)
128 128
 {
129
-    $result = db_query("SELECT k.email FROM kundendaten.kunden AS k INNER JOIN system.useraccounts AS u ON (u.kunde=k.id) WHERE u.username=?", array($username));
129
+    $result = db_query("SELECT k.email FROM kundendaten.kunden AS k INNER JOIN system.useraccounts AS u ON (u.kunde=k.id) WHERE u.username=?", [$username]);
130 130
     $data = $result->fetch();
131 131
     return $data['email'];
132 132
 }
... ...
@@ -135,7 +135,7 @@ function emailaddress_for_user($username)
135 135
 function get_customer_token($customerno)
136 136
 {
137 137
     expire_tokens();
138
-    $result = db_query("SELECT token FROM kundendaten.kunden WHERE id=? AND token IS NOT NULL", array($customerno));
138
+    $result = db_query("SELECT token FROM kundendaten.kunden WHERE id=? AND token IS NOT NULL", [$customerno]);
139 139
     if ($result->rowCount() < 1) {
140 140
         system_failure("Kann das Token nicht auslesen!");
141 141
     }
... ...
@@ -145,7 +145,7 @@ function get_customer_token($customerno)
145 145
 
146 146
 function get_user_token($username)
147 147
 {
148
-    $result = db_query("SELECT token FROM system.usertoken AS t INNER JOIN system.useraccounts AS u USING (uid) WHERE username=?", array($username));
148
+    $result = db_query("SELECT token FROM system.usertoken AS t INNER JOIN system.useraccounts AS u USING (uid) WHERE username=?", [$username]);
149 149
     $tmp = $result->fetch();
150 150
     return $tmp['token'];
151 151
 }
... ...
@@ -25,12 +25,12 @@ function do_ajax_cert_login()
25 25
 
26 26
 function get_logins_by_cert($cert)
27 27
 {
28
-    $result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=? ORDER BY type,username", array($cert));
28
+    $result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=? ORDER BY type,username", [$cert]);
29 29
     if ($result->rowCount() < 1) {
30 30
         DEBUG("No certlogin found for this cert!");
31 31
         return null;
32 32
     } else {
33
-        $ret = array();
33
+        $ret = [];
34 34
         while ($row = $result->fetch()) {
35 35
             $ret[] = $row;
36 36
         }
... ...
@@ -46,7 +46,7 @@ function get_cert_by_id($id)
46 46
     if ($id == 0) {
47 47
         system_failure('no ID');
48 48
     }
49
-    $result = db_query("SELECT id,dn,issuer,serial,valid_from,valid_until,cert,username,startpage FROM system.clientcert WHERE `id`=?", array($id));
49
+    $result = db_query("SELECT id,dn,issuer,serial,valid_from,valid_until,cert,username,startpage FROM system.clientcert WHERE `id`=?", [$id]);
50 50
     if ($result->rowCount() < 1) {
51 51
         return null;
52 52
     }
... ...
@@ -61,7 +61,7 @@ function get_certs_by_username($username)
61 61
     if ($username == '') {
62 62
         system_failure('empty username');
63 63
     }
64
-    $result = db_query("SELECT id,dn,issuer,serial,valid_from,valid_until,cert,startpage FROM system.clientcert WHERE `username`=?", array($username));
64
+    $result = db_query("SELECT id,dn,issuer,serial,valid_from,valid_until,cert,startpage FROM system.clientcert WHERE `username`=?", [$username]);
65 65
     if ($result->rowCount() < 1) {
66 66
         return null;
67 67
     }
... ...
@@ -98,7 +98,7 @@ function add_clientcert($certdata, $dn, $issuer, $serial, $vstart, $vend, $start
98 98
         system_failure('Kein Zertifikat');
99 99
     }
100 100
 
101
-    $args = array(":dn" => $dn,
101
+    $args = [":dn" => $dn,
102 102
                 ":issuer" => $issuer,
103 103
                 ":serial" => $serial,
104 104
                 ":vstart" => $vstart,
... ...
@@ -106,7 +106,7 @@ function add_clientcert($certdata, $dn, $issuer, $serial, $vstart, $vend, $start
106 106
                 ":certdata" => $certdata,
107 107
                 ":type" => $type,
108 108
                 ":username" => $username,
109
-                ":startpage" => $startpage);
109
+                ":startpage" => $startpage, ];
110 110
     DEBUG($args);
111 111
 
112 112
     db_query("INSERT INTO system.clientcert (`dn`, `issuer`, `serial`, `valid_from`, `valid_until`, `cert`, `type`, `username`, `startpage`) 
... ...
@@ -135,6 +135,6 @@ function delete_clientcert($id)
135 135
     }
136 136
     db_query(
137 137
         "DELETE FROM system.clientcert WHERE id=:id AND type=:type AND username=:username",
138
-        array(":id" => $id, ":type" => $type, ":username" => $username)
138
+        [":id" => $id, ":type" => $type, ":username" => $username]
139 139
     );
140 140
 }
... ...
@@ -69,10 +69,10 @@ output("<p>Nachfolgend sehen Sie eine Auswahl typischer Aufgaben.</p>\n");
69 69
 
70 70
 $modules = get_modules_info();
71 71
 
72
-$my_shortcuts = array();
72
+$my_shortcuts = [];
73 73
 foreach ($modules as $modname => $info) {
74 74
     if (file_exists('modules/'.$modname.'/shortcuts.php')) {
75
-        $shortcuts = array();
75
+        $shortcuts = [];
76 76
         include('modules/'.$modname.'/shortcuts.php');
77 77
         foreach ($shortcuts as $shortcut) {
78 78
             $shortcut['module'] = $modname;
... ...
@@ -17,15 +17,15 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role == ROLE_ANONYMOUS) {
20
-    $menu["index_login"] = array("label" => "Login", "file" => "index", "weight" => 0);
20
+    $menu["index_login"] = ["label" => "Login", "file" => "index", "weight" => 0];
21 21
 } else {
22 22
     if ($role & (ROLE_SYSTEMUSER | ROLE_SUBUSER | ROLE_VMAIL_ACCOUNT)) {
23
-        $menu["index_cert"] = array("label" => "Client-Zertifikat", "file" => "cert", "weight" => 10, "submenu" => "index_index");
23
+        $menu["index_cert"] = ["label" => "Client-Zertifikat", "file" => "cert", "weight" => 10, "submenu" => "index_index"];
24 24
     }
25 25
     if ($role & (ROLE_SYSTEMUSER | ROLE_CUSTOMER)) {
26
-        $menu["index_chpass"] = array("label" => "Passwort ändern", "file" => "chpass", "weight" => 98);
26
+        $menu["index_chpass"] = ["label" => "Passwort ändern", "file" => "chpass", "weight" => 98];
27 27
     }
28 28
 
29
-    $menu["index_logout"] = array("label" => "Logout", "file" => "logout", "weight" => 99);
30
-    $menu["index_index"] = array("label" => "Übersicht", "file" => "index", "weight" => 0);
29
+    $menu["index_logout"] = ["label" => "Logout", "file" => "logout", "weight" => 99];
30
+    $menu["index_index"] = ["label" => "Übersicht", "file" => "index", "weight" => 0];
31 31
 }
... ...
@@ -15,10 +15,10 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 if ($_SESSION['role'] & ROLE_CUSTOMER || $_SESSION['role'] & ROLE_SYSTEMUSER) {
18
-    $shortcuts[] = array( 'section' => 'administration',
18
+    $shortcuts[] = [ 'section' => 'administration',
19 19
                         'weight'  => 90,
20 20
                         'file'    => 'chpass',
21 21
                         'icon'    => 'pwchange.png',
22 22
                         'title'   => 'Passwort ändern',
23
-                        'alert'   => null );
23
+                        'alert'   => null, ];
24 24
 }
... ...
@@ -28,7 +28,7 @@ $show_paid = (isset($_GET['paid']) && $_GET['paid'] == '1');
28 28
 $invoices = my_invoices();
29 29
 
30 30
 $first = true;
31
-$invoices_to_show = array();
31
+$invoices_to_show = [];
32 32
 foreach ($invoices as $i) {
33 33
     if ($first || $show_paid || $i['bezahlt'] == 0) {
34 34
         $first = false;
... ...
@@ -23,8 +23,8 @@ require_once('contacts.php');
23 23
 function my_invoices()
24 24
 {
25 25
     $c = (int) $_SESSION['customerinfo']['customerno'];
26
-    $result = db_query("SELECT id,datum,betrag,bezahlt,abbuchung,sepamandat FROM kundendaten.ausgestellte_rechnungen WHERE kunde=? ORDER BY id DESC", array($c));
27
-    $ret = array();
26
+    $result = db_query("SELECT id,datum,betrag,bezahlt,abbuchung,sepamandat FROM kundendaten.ausgestellte_rechnungen WHERE kunde=? ORDER BY id DESC", [$c]);
27
+    $ret = [];
28 28
     while ($line = $result->fetch()) {
29 29
         array_push($ret, $line);
30 30
     }
... ...
@@ -36,7 +36,7 @@ function get_pdf($id)
36 36
 {
37 37
     $c = (int) $_SESSION['customerinfo']['customerno'];
38 38
     $id = (int) $id;
39
-    $result = db_query("SELECT pdfdata FROM kundendaten.ausgestellte_rechnungen WHERE kunde=:c AND id=:id", array(":c" => $c, ":id" => $id));
39
+    $result = db_query("SELECT pdfdata FROM kundendaten.ausgestellte_rechnungen WHERE kunde=:c AND id=:id", [":c" => $c, ":id" => $id]);
40 40
     if ($result->rowCount() == 0) {
41 41
         system_failure('Ungültige Rechnungsnummer oder nicht eingeloggt');
42 42
     }
... ...
@@ -50,12 +50,12 @@ function invoice_address($customer = null)
50 50
     if ($customer != null && have_role(ROLE_SYSADMIN)) {
51 51
         $c = (int) $customer;
52 52
     }
53
-    $result = db_query("SELECT contact_kunde, contact_rechnung FROM kundendaten.kunden WHERE id=?", array($c));
53
+    $result = db_query("SELECT contact_kunde, contact_rechnung FROM kundendaten.kunden WHERE id=?", [$c]);
54 54
     $kontakte = $result->fetch();
55 55
     $kunde = get_contact($kontakte['contact_kunde'], $c);
56 56
     if ($kontakte['contact_rechnung']) {
57 57
         $rechnung = get_contact($kontakte['contact_rechnung'], $c);
58
-        foreach (array('company', 'name', 'address', 'zip', 'city', 'country', 'email') as $field) {
58
+        foreach (['company', 'name', 'address', 'zip', 'city', 'country', 'email'] as $field) {
59 59
             if ($rechnung[$field]) {
60 60
                 $kunde[$field] = $rechnung[$field];
61 61
             }
... ...
@@ -69,7 +69,7 @@ function invoice_address($customer = null)
69 69
 function invoice_details($id)
70 70
 {
71 71
     $id = (int) $id;
72
-    $result = db_query("SELECT kunde,datum,betrag,bezahlt,sepamandat,abbuchung FROM kundendaten.ausgestellte_rechnungen WHERE id=:id", array(":id" => $id));
72
+    $result = db_query("SELECT kunde,datum,betrag,bezahlt,sepamandat,abbuchung FROM kundendaten.ausgestellte_rechnungen WHERE id=:id", [":id" => $id]);
73 73
     if ($result->rowCount() == 0) {
74 74
         system_failure('Ungültige Rechnungsnummer oder nicht eingeloggt');
75 75
     }
... ...
@@ -83,11 +83,11 @@ function invoice_details($id)
83 83
 function invoice_items($id)
84 84
 {
85 85
     $id = (int) $id;
86
-    $result = db_query("SELECT id, beschreibung, datum, enddatum, betrag, einheit, brutto, mwst, anzahl FROM kundendaten.rechnungsposten WHERE rechnungsnummer=:id", array(":id" => $id));
86
+    $result = db_query("SELECT id, beschreibung, datum, enddatum, betrag, einheit, brutto, mwst, anzahl FROM kundendaten.rechnungsposten WHERE rechnungsnummer=:id", [":id" => $id]);
87 87
     if ($result->rowCount() == 0) {
88 88
         system_failure('Ungültige Rechnungsnummer oder nicht eingeloggt');
89 89
     }
90
-    $ret = array();
90
+    $ret = [];
91 91
     while ($line = $result->fetch()) {
92 92
         array_push($ret, $line);
93 93
     }
... ...
@@ -98,8 +98,8 @@ function invoice_items($id)
98 98
 function upcoming_items()
99 99
 {
100 100
     $c = (int) $_SESSION['customerinfo']['customerno'];
101
-    $result = db_query("SELECT quelle, id, anzahl, beschreibung, startdatum, enddatum, betrag, einheit, brutto, mwst FROM kundendaten.upcoming_items WHERE kunde=? ORDER BY startdatum ASC", array($c));
102
-    $ret = array();
101
+    $result = db_query("SELECT quelle, id, anzahl, beschreibung, startdatum, enddatum, betrag, einheit, brutto, mwst FROM kundendaten.upcoming_items WHERE kunde=? ORDER BY startdatum ASC", [$c]);
102
+    $ret = [];
103 103
     while ($line = $result->fetch()) {
104 104
         array_push($ret, $line);
105 105
     }
... ...
@@ -125,11 +125,11 @@ DE91602911200041512006
125 125
 
126 126
 RE '.$id.' KD '.$customerno.' vom '.$datum;
127 127
 
128
-    $descriptorspec = array(
129
-    0 => array("pipe", "r"),  // STDIN ist eine Pipe, von der das Child liest
130
-    1 => array("pipe", "w"),  // STDOUT ist eine Pipe, in die das Child schreibt
131
-    2 => array("pipe", "w")
132
-  );
128
+    $descriptorspec = [
129
+    0 => ["pipe", "r"],  // STDIN ist eine Pipe, von der das Child liest
130
+    1 => ["pipe", "w"],  // STDOUT ist eine Pipe, in die das Child schreibt
131
+    2 => ["pipe", "w"],
132
+  ];
133 133
 
134 134
     $process = proc_open('qrencode -t PNG -o - -l M', $descriptorspec, $pipes);
135 135
 
... ...
@@ -158,7 +158,7 @@ RE '.$id.' KD '.$customerno.' vom '.$datum;
158 158
 function get_lastschrift($rechnungsnummer)
159 159
 {
160 160
     $rechnungsnummer = (int) $rechnungsnummer;
161
-    $result = db_query("SELECT rechnungsnummer, rechnungsdatum, sl.betrag, buchungsdatum, sl.status FROM kundendaten.sepalastschrift sl LEFT JOIN kundendaten.ausgestellte_rechnungen re ON (re.sepamandat=sl.mandatsreferenz) WHERE rechnungsnummer=?", array($rechnungsnummer));
161
+    $result = db_query("SELECT rechnungsnummer, rechnungsdatum, sl.betrag, buchungsdatum, sl.status FROM kundendaten.sepalastschrift sl LEFT JOIN kundendaten.ausgestellte_rechnungen re ON (re.sepamandat=sl.mandatsreferenz) WHERE rechnungsnummer=?", [$rechnungsnummer]);
162 162
     if ($result->rowCount() == 0) {
163 163
         return null;
164 164
     }
... ...
@@ -168,8 +168,8 @@ function get_lastschrift($rechnungsnummer)
168 168
 
169 169
 function get_lastschriften($mandatsreferenz)
170 170
 {
171
-    $result = db_query("SELECT rechnungsnummer, rechnungsdatum, betrag, buchungsdatum, status FROM kundendaten.sepalastschrift WHERE mandatsreferenz=? ORDER BY buchungsdatum DESC", array($mandatsreferenz));
172
-    $ret = array();
171
+    $result = db_query("SELECT rechnungsnummer, rechnungsdatum, betrag, buchungsdatum, status FROM kundendaten.sepalastschrift WHERE mandatsreferenz=? ORDER BY buchungsdatum DESC", [$mandatsreferenz]);
172
+    $ret = [];
173 173
     while ($item = $result->fetch()) {
174 174
         $ret[] = $item;
175 175
     }
... ...
@@ -179,15 +179,15 @@ function get_lastschriften($mandatsreferenz)
179 179
 
180 180
 function get_sepamandat($id)
181 181
 {
182
-    $result = db_query("SELECT id, kunde, mandatsreferenz, glaeubiger_id, erteilt, medium, gueltig_ab, gueltig_bis, erstlastschrift, kontoinhaber, adresse, iban, bic, bankname FROM kundendaten.sepamandat WHERE id=? OR mandatsreferenz=?", array($id, $id));
182
+    $result = db_query("SELECT id, kunde, mandatsreferenz, glaeubiger_id, erteilt, medium, gueltig_ab, gueltig_bis, erstlastschrift, kontoinhaber, adresse, iban, bic, bankname FROM kundendaten.sepamandat WHERE id=? OR mandatsreferenz=?", [$id, $id]);
183 183
     return $result->fetch();
184 184
 }
185 185
 
186 186
 function get_sepamandate()
187 187
 {
188 188
     $cid = (int) $_SESSION['customerinfo']['customerno'];
189
-    $result = db_query("SELECT id, mandatsreferenz, glaeubiger_id, erteilt, medium, gueltig_ab, gueltig_bis, erstlastschrift, kontoinhaber, adresse, iban, bic, bankname FROM kundendaten.sepamandat WHERE kunde=?", array($cid));
190
-    $ret = array();
189
+    $result = db_query("SELECT id, mandatsreferenz, glaeubiger_id, erteilt, medium, gueltig_ab, gueltig_bis, erstlastschrift, kontoinhaber, adresse, iban, bic, bankname FROM kundendaten.sepamandat WHERE kunde=?", [$cid]);
190
+    $ret = [];
191 191
     while ($entry = $result->fetch()) {
192 192
         array_push($ret, $entry);
193 193
     }
... ...
@@ -197,16 +197,16 @@ function get_sepamandate()
197 197
 
198 198
 function yesterday($date)
199 199
 {
200
-    $result = db_query("SELECT ? - INTERVAL 1 DAY", array($date));
200
+    $result = db_query("SELECT ? - INTERVAL 1 DAY", [$date]);
201 201
     return $result->fetch()[0];
202 202
 }
203 203
 
204 204
 
205 205
 function invalidate_sepamandat($id, $date)
206 206
 {
207
-    $args = array(":cid" => (int) $_SESSION['customerinfo']['customerno'],
207
+    $args = [":cid" => (int) $_SESSION['customerinfo']['customerno'],
208 208
                 ":id" => (int) $id,
209
-                ":date" => $date);
209
+                ":date" => $date, ];
210 210
     db_query("UPDATE kundendaten.sepamandat SET gueltig_bis=:date WHERE id=:id AND kunde=:cid", $args);
211 211
 }
212 212
 
... ...
@@ -226,7 +226,7 @@ function sepamandat($name, $adresse, $iban, $bankname, $bic, $gueltig_ab)
226 226
         system_failure('Das Mandat kann nicht rückwirkend erteilt werden. Bitte geben Sie ein Datum in der Zukunft an.');
227 227
     }
228 228
     $alte_mandate = get_sepamandate();
229
-    $referenzen = array();
229
+    $referenzen = [];
230 230
     foreach ($alte_mandate as $mandat) {
231 231
         if ($mandat['gueltig_bis'] == null || $mandat['gueltig_bis'] >= $gueltig_ab) {
232 232
             DEBUG('Altes Mandat wird für ungültig erklärt.');
... ...
@@ -248,13 +248,13 @@ function sepamandat($name, $adresse, $iban, $bankname, $bic, $gueltig_ab)
248 248
     $today = date('Y-m-d');
249 249
     db_query(
250 250
         "INSERT INTO kundendaten.sepamandat (mandatsreferenz, glaeubiger_id, kunde, erteilt, medium, gueltig_ab, kontoinhaber, adresse, iban, bic, bankname) VALUES (:referenz, :glaeubiger_id, :cid, :today, 'online', :gueltig_ab, :name, :adresse, :iban, :bic, :bankname)",
251
-        array(":referenz" => $referenz, ":glaeubiger_id" => $glaeubiger_id, ":cid" => $cid,
251
+        [":referenz" => $referenz, ":glaeubiger_id" => $glaeubiger_id, ":cid" => $cid,
252 252
                 ":today" => $today, ":gueltig_ab" => $gueltig_ab, ":name" => $name, ":adresse" => $adresse,
253
-                ":iban" => $iban, ":bic" => $bic, ":bankname" => $bankname)
253
+                ":iban" => $iban, ":bic" => $bic, ":bankname" => $bankname, ]
254 254
     );
255 255
     db_query(
256 256
         "UPDATE kundendaten.ausgestellte_rechnungen SET abbuchung=1 WHERE kunde = :cid AND datum >= :gueltig_ab and bezahlt=0",
257
-        array(":cid" => $cid, ":gueltig_ab" => $gueltig_ab)
257
+        [":cid" => $cid, ":gueltig_ab" => $gueltig_ab]
258 258
     );
259 259
 }
260 260
 
... ...
@@ -281,7 +281,7 @@ function get_bank_info($iban)
281 281
             break;
282 282
         }
283 283
     }
284
-    $bank = array();
284
+    $bank = [];
285 285
     $bank['name'] = iconv('latin1', 'utf8', chop(substr($match, 9, 58)));
286 286
     $bank['bic'] = chop(substr($match, 139, 11));
287 287
     return $bank;
... ...
@@ -299,7 +299,7 @@ function find_iban($blz, $kto)
299 299
 function get_customerquota()
300 300
 {
301 301
     $cid = (int) $_SESSION['customerinfo']['customerno'];
302
-    $result = db_query("SELECT quota FROM system.customerquota WHERE cid=:cid", array(":cid" => $cid));
302
+    $result = db_query("SELECT quota FROM system.customerquota WHERE cid=:cid", [":cid" => $cid]);
303 303
     $data = $result->fetch();
304 304
     return $data["quota"];
305 305
 }
... ...
@@ -308,7 +308,7 @@ function save_more_storage($items, $storage)
308 308
 {
309 309
     $cid = (int) $_SESSION['customerinfo']['customerno'];
310 310
 
311
-    $queries = array();
311
+    $queries = [];
312 312
 
313 313
     if ($storage < 1024 || $storage > 10240) {
314 314
         input_error('Speicherplatz nicht im erwarteten Bereich');
... ...
@@ -318,12 +318,12 @@ function save_more_storage($items, $storage)
318 318
         # Über 100 GB soll die Automatik nichts machen
319 319
         system_failure("Ihr Speicherplatz kann über diese Funktion nicht weiter erhöht werden. Bitte wenden Sie sich an die Administratoren.");
320 320
     }
321
-    $result = db_query("SELECT quota FROM system.customerquota WHERE cid=:cid AND lastchange > CURDATE()", array(":cid" => $cid));
321
+    $result = db_query("SELECT quota FROM system.customerquota WHERE cid=:cid AND lastchange > CURDATE()", [":cid" => $cid]);
322 322
     if ($result->rowcount() > 0) {
323 323
         system_failure("Ihr Speicherplatz wurde heute bereits verändert. Sie können dies nur einmal am Tag machen.");
324 324
     }
325 325
 
326
-    $queries[] = array("UPDATE system.customerquota SET quota=quota+:storage WHERE cid=:cid", array(":storage" => $storage, ":cid" => $cid));
326
+    $queries[] = ["UPDATE system.customerquota SET quota=quota+:storage WHERE cid=:cid", [":storage" => $storage, ":cid" => $cid]];
327 327
 
328 328
     foreach ($items as $data) {
329 329
         if ($data['anzahl'] == 0) {
... ...
@@ -342,13 +342,13 @@ function save_more_storage($items, $storage)
342 342
             return;
343 343
         }
344 344
 
345
-        $param = array();
345
+        $param = [];
346 346
         foreach ($data as $k => $v) {
347 347
             $param[':'.$k] = $v;
348 348
         }
349 349
 
350
-        $queries[] = array("INSERT INTO kundendaten.leistungen (kunde,periodisch,beschreibung,datum,kuendigungsdatum,betrag,brutto,monate,anzahl,notizen) VALUES ".
351
-                       "(:kunde,1,:beschreibung,:datum,:kuendigungsdatum,:betrag,:brutto,:monate,:anzahl,:notizen)", $param);
350
+        $queries[] = ["INSERT INTO kundendaten.leistungen (kunde,periodisch,beschreibung,datum,kuendigungsdatum,betrag,brutto,monate,anzahl,notizen) VALUES ".
351
+                       "(:kunde,1,:beschreibung,:datum,:kuendigungsdatum,:betrag,:brutto,:monate,:anzahl,:notizen)", $param, ];
352 352
     }
353 353
 
354 354
     if (count($queries) < 2) {
... ...
@@ -17,6 +17,6 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_CUSTOMER) {
20
-    $menu["invoice_current"] = array("label" => "Rechnungen", "file" => "current", "weight" => 2, "submenu" => "index_index");
20
+    $menu["invoice_current"] = ["label" => "Rechnungen", "file" => "current", "weight" => 2, "submenu" => "index_index"];
21 21
     //$menu["invoice_upcoming"] = array("label" => "zukünftige Rechnungen", "file" => "upcoming", "weight" => 2, "submenu" => "invoice_current");
22 22
 }
... ...
@@ -99,7 +99,7 @@ $stub['enddatum'] = date_format($stub_enddate, 'Y-m-d');
99 99
 $stub['anzahl'] = $months;
100 100
 $stub['monate'] = $months;
101 101
 
102
-$items = array();
102
+$items = [];
103 103
 $items[] = $stub;
104 104
 $items[] = $new_item;
105 105
 
... ...
@@ -150,7 +150,7 @@ if (have_module('systemuser')) {
150 150
     if (count($useraccounts) == 1) {
151 151
         $form .= '<input type="hidden" name="more_storage_user" value="'.$useraccounts[0]['uid'].'" />';
152 152
     } else {
153
-        $choices = array('' => 'Nicht zuweisen');
153
+        $choices = ['' => 'Nicht zuweisen'];
154 154
         foreach ($useraccounts as $u) {
155 155
             $choices[$u['uid']] = "Benutzer ${u['username']} vergrößern";
156 156
         }
... ...
@@ -53,10 +53,10 @@ if ($stub['anzahl'] == 0) {
53 53
 }
54 54
 $regular = $items[1];
55 55
 
56
-$clean_items = array();
56
+$clean_items = [];
57 57
 
58 58
 if ($stub) {
59
-    $i = array();
59
+    $i = [];
60 60
     $i['beschreibung'] = $stub['beschreibung'];
61 61
     $i['datum'] = $stub['startdatum'];
62 62
     $i['kuendigungsdatum'] = $stub['enddatum'];
... ...
@@ -67,7 +67,7 @@ if ($stub) {
67 67
     $clean_items[] = $i;
68 68
 }
69 69
 
70
-$i = array();
70
+$i = [];
71 71
 $i['beschreibung'] = $regular['beschreibung'];
72 72
 $i['datum'] = $regular['startdatum'];
73 73
 $i['kuendigungsdatum'] = null;
... ...
@@ -276,7 +276,7 @@ $html .= '<table style="width: 100%;">
276 276
 
277 277
 $vattype = null;
278 278
 // An der ersten Zeile entscheidet sich, ob die gesamte Rechnung als Netto- oder Bruttorechnung erstellt wird
279
-$einzelsummen = array();
279
+$einzelsummen = [];
280 280
 $summe = 0.0;
281 281
 
282 282
 $odd = true;
... ...
@@ -312,9 +312,9 @@ foreach ($items as $item) {
312 312
         $einzelsummen[$item['mwst']]['vat'] += $gesamt / (1 + ($item['mwst'] / 100)) * ($item['mwst'] / 100);
313 313
         $einzelsummen[$item['mwst']]['gross'] += $gesamt;
314 314
     } else {
315
-        $einzelsummen[$item['mwst']] = array('net' => $gesamt / (1 + ($item['mwst'] / 100)),
315
+        $einzelsummen[$item['mwst']] = ['net' => $gesamt / (1 + ($item['mwst'] / 100)),
316 316
                                              'vat' => $gesamt / (1 + ($item['mwst'] / 100)) * ($item['mwst'] / 100),
317
-                                             'gross' => $gesamt);
317
+                                             'gross' => $gesamt, ];
318 318
     }
319 319
     $summe += $gesamt;
320 320
 
... ...
@@ -378,7 +378,7 @@ $dompdf->loadHtml($html);
378 378
 $dompdf->render();
379 379
 
380 380
 if ($outformat == 'pdf') {
381
-    $dompdf->stream("sample.pdf", array("Attachment"=>0));
381
+    $dompdf->stream("sample.pdf", ["Attachment"=>0]);
382 382
 } else {
383 383
     echo $html;
384 384
 }
... ...
@@ -21,7 +21,7 @@ require_once('invoice.php');
21 21
 
22 22
 $kundenname = $_SESSION['customerinfo']['name'];
23 23
 $id = (int) $_SESSION['customerinfo']['customerno'];
24
-$result = db_query("SELECT CONCAT(adresse, '\\\\n', plz, ' ', ort) AS adresse FROM kundendaten.kunden WHERE id=?", array($id));
24
+$result = db_query("SELECT CONCAT(adresse, '\\\\n', plz, ' ', ort) AS adresse FROM kundendaten.kunden WHERE id=?", [$id]);
25 25
 $r = $result->fetch();
26 26
 
27 27
 header("Content-Type: text/javascript");
... ...
@@ -31,10 +31,10 @@ if ($_SESSION['role'] & ROLE_CUSTOMER) {
31 31
         $alert = $unpayed_invoices.' unbezahlt';
32 32
     }
33 33
 
34
-    $shortcuts[] = array( 'section' => 'administration',
34
+    $shortcuts[] = [ 'section' => 'administration',
35 35
                         'weight'  => 50,
36 36
                         'file'    => 'current',
37 37
                         'icon'    => 'invoice.png',
38 38
                         'title'   => 'Ihre Rechnungen',
39
-                        'alert'   => $alert );
39
+                        'alert'   => $alert, ];
40 40
 }
... ...
@@ -23,8 +23,8 @@ function get_jabber_accounts()
23 23
 {
24 24
     require_role(ROLE_CUSTOMER);
25 25
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
26
-    $result = db_query("SELECT id, `create`, created, lastactivity, local, domain FROM jabber.accounts WHERE customerno=? AND `delete`=0", array($customerno));
27
-    $accounts = array();
26
+    $result = db_query("SELECT id, `create`, created, lastactivity, local, domain FROM jabber.accounts WHERE customerno=? AND `delete`=0", [$customerno]);
27
+    $accounts = [];
28 28
     if (@$result->rowCount() > 0) {
29 29
         while ($acc = @$result->fetch()) {
30 30
             array_push($accounts, $acc);
... ...
@@ -38,8 +38,8 @@ function get_jabber_accounts()
38 38
 function get_jabberaccount_details($id)
39 39
 {
40 40
     require_role(ROLE_CUSTOMER);
41
-    $args = array(":customerno" => $_SESSION['customerinfo']['customerno'],
42
-                ":id" => $id);
41
+    $args = [":customerno" => $_SESSION['customerinfo']['customerno'],
42
+                ":id" => $id, ];
43 43
 
44 44
     $result = db_query("SELECT id, local, domain FROM jabber.accounts WHERE customerno=:customerno AND id=:id", $args);
45 45
     if ($result->rowCount() != 1) {
... ...
@@ -71,9 +71,9 @@ function valid_jabber_password($pass)
71 71
 function create_jabber_account($local, $domain, $password)
72 72
 {
73 73
     require_role(ROLE_CUSTOMER);
74
-    $data = array(":customerno" => $_SESSION['customerinfo']['customerno'],
74
+    $data = [":customerno" => $_SESSION['customerinfo']['customerno'],
75 75
                 ":local" => filter_input_username(strtolower($local)),
76
-                ":domain" => $domain);
76
+                ":domain" => $domain, ];
77 77
     if (!valid_jabber_password($password)) {
78 78
         system_failure('Das Passwort enthält Zeichen, die aufgrund technischer Beschränkungen momentan nicht benutzt werden können.');
79 79
     }
... ...
@@ -84,7 +84,7 @@ function create_jabber_account($local, $domain, $password)
84 84
     $data[':password'] = $password;
85 85
 
86 86
     if ($domain > 0) {
87
-        $args = array(":domain" => $data[":domain"], ":customerno" => $data[":customerno"]);
87
+        $args = [":domain" => $data[":domain"], ":customerno" => $data[":customerno"]];
88 88
         $result = db_query("SELECT id FROM kundendaten.domains WHERE kunde=:customerno AND jabber=1 AND id=:domain", $args);
89 89
         if ($result->rowCount() == 0) {
90 90
             logger(LOG_WARNING, "modules/jabber/include/jabberaccounts", "jabber", "attempt to create account for invalid domain »{$domain}«");
... ...
@@ -92,7 +92,7 @@ function create_jabber_account($local, $domain, $password)
92 92
         }
93 93
     }
94 94
 
95
-    $args = array(":domain" => $data[":domain"], ":local" => $data[":local"]);
95
+    $args = [":domain" => $data[":domain"], ":local" => $data[":local"]];
96 96
     $domainquery = "domain=:domain";
97 97
     if ($domain == 0) {
98 98
         unset($args[":domain"]);
... ...
@@ -121,9 +121,9 @@ function change_jabber_password($id, $password)
121 121
     if ($check !== true) {
122 122
         system_failure('Das Passwort ist nicht sicher genug.');
123 123
     }
124
-    $args = array(":customerno" => $_SESSION['customerinfo']['customerno'],
124
+    $args = [":customerno" => $_SESSION['customerinfo']['customerno'],
125 125
                 ":id" => $id,
126
-                ":password" => $password);
126
+                ":password" => $password, ];
127 127
 
128 128
     db_query("UPDATE jabber.accounts SET password=:password WHERE customerno=:customerno AND id=:id", $args);
129 129
     logger(LOG_INFO, "modules/jabber/include/jabberaccounts", "jabber", "changed password for account  »{$id}«");
... ...
@@ -135,8 +135,8 @@ function delete_jabber_account($id)
135 135
 {
136 136
     require_role(ROLE_CUSTOMER);
137 137
 
138
-    $args = array(":customerno" => $_SESSION['customerinfo']['customerno'],
139
-                ":id" => $id);
138
+    $args = [":customerno" => $_SESSION['customerinfo']['customerno'],
139
+                ":id" => $id, ];
140 140
 
141 141
     db_query("UPDATE jabber.accounts SET `delete`=1 WHERE customerno=:customerno AND id=:id", $args);
142 142
     logger(LOG_INFO, "modules/jabber/include/jabberaccounts", "jabber", "deleted account »{$id}«");
... ...
@@ -146,7 +146,7 @@ function domains_without_accounts()
146 146
 {
147 147
     $domains = get_domain_list((int) $_SESSION['customerinfo']['customerno']);
148 148
     $accounts = get_jabber_accounts();
149
-    $obsolete_domains = array();
149
+    $obsolete_domains = [];
150 150
     foreach ($domains as $d) {
151 151
         if ($d->jabber != 1) {
152 152
             continue;
... ...
@@ -179,12 +179,12 @@ function delete_jabber_domain($id)
179 179
     if (! $found) {
180 180
         system_failure('Diese Domain ist nicht unbenutzt.');
181 181
     }
182
-    db_query("UPDATE kundendaten.domains SET jabber=0 WHERE jabber=1 AND id=?", array($d->id));
182
+    db_query("UPDATE kundendaten.domains SET jabber=0 WHERE jabber=1 AND id=?", [$d->id]);
183 183
 }
184 184
 
185 185
 function new_jabber_domain($id)
186 186
 {
187 187
     $d = new Domain((int) $id);
188 188
     $d->ensure_customerdomain();
189
-    db_query("UPDATE kundendaten.domains SET jabber=2 WHERE jabber=0 AND id=?", array($d->id));
189
+    db_query("UPDATE kundendaten.domains SET jabber=2 WHERE jabber=0 AND id=?", [$d->id]);
190 190
 }
... ...
@@ -17,5 +17,5 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_CUSTOMER) {
20
-    $menu["jabber_accounts"] = array("label" => "Jabber", "file" => "accounts", "weight" => 10);
20
+    $menu["jabber_accounts"] = ["label" => "Jabber", "file" => "accounts", "weight" => 10];
21 21
 }
... ...
@@ -33,8 +33,8 @@ if (! count($domains)) {
33 33
     system_failure("Sie haben gar keine eigenen Domains.");
34 34
 }
35 35
 
36
-$pending_domains = array();
37
-$available_domains = array();
36
+$pending_domains = [];
37
+$available_domains = [];
38 38
 
39 39
 foreach ($domains as $d) {
40 40
     if ($d->jabber == 0) {
... ...
@@ -15,10 +15,10 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 if ($_SESSION['role'] & ROLE_CUSTOMER) {
18
-    $shortcuts[] = array( 'section' => 'Jabber',
18
+    $shortcuts[] = [ 'section' => 'Jabber',
19 19
                         'weight'  => 10,
20 20
                         'file'    => 'accounts',
21 21
                         'icon'    => 'jabber.png',
22 22
                         'title'   => 'Jabber-Accounts',
23
-                        'alert'   => null );
23
+                        'alert'   => null, ];
24 24
 }
... ...
@@ -25,11 +25,11 @@ function get_lists($filter)
25 25
     $result = null;
26 26
     if ($filter) {
27 27
         $filter = '%'.$filter.'%';
28
-        $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE status!='deleted' AND owner=:uid AND (listname LIKE :filter OR fqdn LIKE :filter OR admin LIKE :filter) ORDER BY listname", array('uid' => $uid, 'filter' => $filter));
28
+        $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE status!='deleted' AND owner=:uid AND (listname LIKE :filter OR fqdn LIKE :filter OR admin LIKE :filter) ORDER BY listname", ['uid' => $uid, 'filter' => $filter]);
29 29
     } else {
30
-        $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE status!='deleted' AND owner=:uid ORDER BY listname", array('uid' => $uid));
30
+        $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE status!='deleted' AND owner=:uid ORDER BY listname", ['uid' => $uid]);
31 31
     }
32
-    $ret = array();
32
+    $ret = [];
33 33
     while ($list = $result->fetch()) {
34 34
         $ret[] = $list;
35 35
     }
... ...
@@ -40,8 +40,8 @@ function get_lists($filter)
40 40
 
41 41
 function get_list($id)
42 42
 {
43
-    $args = array(":id" => $id,
44
-                ":uid" => $_SESSION['userinfo']['uid']);
43
+    $args = [":id" => $id,
44
+                ":uid" => $_SESSION['userinfo']['uid'], ];
45 45
     $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE owner=:uid AND id=:id", $args);
46 46
     if ($result->rowCount() < 1) {
47 47
         system_failure('Die gewünschte Mailingliste konnte nicht gefunden werden');
... ...
@@ -55,15 +55,15 @@ function get_list($id)
55 55
 
56 56
 function delete_list($id)
57 57
 {
58
-    $args = array(":id" => $id,
59
-                ":uid" => $_SESSION['userinfo']['uid']);
58
+    $args = [":id" => $id,
59
+                ":uid" => $_SESSION['userinfo']['uid'], ];
60 60
     db_query("UPDATE mail.mailman_lists SET status='delete' WHERE owner=:uid AND id=:id", $args);
61 61
 }
62 62
 
63 63
 function request_new_password($id)
64 64
 {
65
-    $args = array(":id" => $id,
66
-                ":uid" => $_SESSION['userinfo']['uid']);
65
+    $args = [":id" => $id,
66
+                ":uid" => $_SESSION['userinfo']['uid'], ];
67 67
     db_query("UPDATE mail.mailman_lists SET status='newpw' WHERE owner=:uid AND id=:id", $args);
68 68
 }
69 69
 
... ...
@@ -71,22 +71,22 @@ function create_list($listname, $maildomain, $admin)
71 71
 {
72 72
     $listname = strtolower($listname);
73 73
     verify_input_username($listname);
74
-    if (in_array($listname, array("admin", "administrator", "webmaster", "hostmaster", "postmaster"))) {
74
+    if (in_array($listname, ["admin", "administrator", "webmaster", "hostmaster", "postmaster"])) {
75 75
         system_failure('Der Mailinglistenname '.$listname.' ist unzulässig.');
76 76
     }
77 77
     if (! check_emailaddr($admin)) {
78 78
         system_failure('Der Verwalter muss eine gültige E-Mail-Adresse sein ('.$admin.').');
79 79
     }
80 80
     # FIXME: Zukünftig soll diese Beschränkung weg fallen!
81
-    $result = db_query("SELECT id FROM mail.mailman_lists WHERE listname LIKE ?", array($listname));
81
+    $result = db_query("SELECT id FROM mail.mailman_lists WHERE listname LIKE ?", [$listname]);
82 82
     if ($result->rowCount() > 0) {
83 83
         system_failure('Eine Liste mit diesem Namen existiert bereits auf unserem Mailinglisten-Server (unter einer Ihrer Domains oder unter einer Domain eines anderen Kunden). Jeder Listenname kann auf dem gesamten Server nur einmal verwendet werden.');
84 84
     }
85 85
 
86
-    $args = array(":listname" => $listname,
86
+    $args = [":listname" => $listname,
87 87
                 ":maildomain" => $maildomain,
88 88
                 ":owner" => $_SESSION['userinfo']['uid'],
89
-                ":admin" => $admin);
89
+                ":admin" => $admin, ];
90 90
 
91 91
     db_query("INSERT INTO mail.mailman_lists (status, listname, maildomain, owner, admin) VALUES ('pending', :listname, :maildomain, :owner, :admin)", $args);
92 92
     DEBUG('Neue ID: '.db_insert_id());
... ...
@@ -96,8 +96,8 @@ function get_possible_mailmandomains()
96 96
 {
97 97
     DEBUG('get_possible_mailmandomains()');
98 98
     $uid = (int) $_SESSION['userinfo']['uid'];
99
-    $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS fqdn, m.backend AS backend FROM kundendaten.domains AS d LEFT JOIN mail.mailman_domains AS m ON (m.domain=d.id) WHERE d.useraccount=:uid AND m.id IS NULL ORDER BY CONCAT_WS('.',d.domainname,d.tld)", array(":uid" => $uid));
100
-    $ret = array();
99
+    $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS fqdn, m.backend AS backend FROM kundendaten.domains AS d LEFT JOIN mail.mailman_domains AS m ON (m.domain=d.id) WHERE d.useraccount=:uid AND m.id IS NULL ORDER BY CONCAT_WS('.',d.domainname,d.tld)", [":uid" => $uid]);
100
+    $ret = [];
101 101
     while ($dom = $result->fetch()) {
102 102
         $ret[] = $dom;
103 103
     }
... ...
@@ -119,7 +119,7 @@ function insert_mailman_domain($subdomain, $domainid, $backend = 'mailman')
119 119
     if (! $found) {
120 120
         system_failue('invalid domain id');
121 121
     }
122
-    db_query("INSERT INTO mail.mailman_domains (hostname, domain, backend) VALUES (:hostname, :domain, :backend)", array(":hostname" => $subdomain, ":domain" => $domainid, ":backend" => $backend));
122
+    db_query("INSERT INTO mail.mailman_domains (hostname, domain, backend) VALUES (:hostname, :domain, :backend)", [":hostname" => $subdomain, ":domain" => $domainid, ":backend" => $backend]);
123 123
     return db_insert_id();
124 124
 }
125 125
 
... ...
@@ -127,8 +127,8 @@ function insert_mailman_domain($subdomain, $domainid, $backend = 'mailman')
127 127
 function lists_on_domain($domainid)
128 128
 {
129 129
     DEBUG("lists_on_domain()");
130
-    $result = db_query("SELECT id, listname FROM mail.mailman_lists WHERE status != 'delete' AND status != 'deleted' AND maildomain=(SELECT id FROM mail.mailman_domains WHERE domain=?)", array($domainid));
131
-    $ret = array();
130
+    $result = db_query("SELECT id, listname FROM mail.mailman_lists WHERE status != 'delete' AND status != 'deleted' AND maildomain=(SELECT id FROM mail.mailman_domains WHERE domain=?)", [$domainid]);
131
+    $ret = [];
132 132
     while ($l = $result->fetch()) {
133 133
         $ret[] = $l;
134 134
     }
... ...
@@ -143,7 +143,7 @@ function delete_mailman_domain($domainid)
143 143
     if (count($lists) > 0) {
144 144
         system_failure("Es gibt noch Mailinglisten unter diesem Domainnamen, er kann daher nicht gelöscht werden");
145 145
     } else {
146
-        db_query("DELETE FROM mail.mailman_domains WHERE domain=? AND (SELECT COUNT(*) FROM mail.mailman_lists WHERE maildomain=mail.mailman_domains.id)=0;", array($domainid));
146
+        db_query("DELETE FROM mail.mailman_domains WHERE domain=? AND (SELECT COUNT(*) FROM mail.mailman_lists WHERE maildomain=mail.mailman_domains.id)=0;", [$domainid]);
147 147
     }
148 148
 }
149 149
 
... ...
@@ -151,8 +151,8 @@ function get_mailman_domains()
151 151
 {
152 152
     DEBUG('get_mailman_domains()');
153 153
     $uid = (int) $_SESSION['userinfo']['uid'];
154
-    $result = db_query("SELECT md.id, md.fqdn, md.is_webhost, md.backend FROM mail.v_mailman_domains AS md left join mail.v_domains AS d on (d.id=md.domain) where d.user=?", array($uid));
155
-    $ret = array();
154
+    $result = db_query("SELECT md.id, md.fqdn, md.is_webhost, md.backend FROM mail.v_mailman_domains AS md left join mail.v_domains AS d on (d.id=md.domain) where d.user=?", [$uid]);
155
+    $ret = [];
156 156
     while ($dom = $result->fetch()) {
157 157
         $ret[] = $dom;
158 158
     }
... ...
@@ -17,5 +17,5 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20
-    $menu['mailman_lists'] = array("label" => "Mailinglisten", "file" => "lists", "weight" => 5, 'submenu' => 'email_vmail');
20
+    $menu['mailman_lists'] = ["label" => "Mailinglisten", "file" => "lists", "weight" => 5, 'submenu' => 'email_vmail'];
21 21
 }
... ...
@@ -21,7 +21,7 @@ title("Neue Mailingliste erstellen");
21 21
 $section = 'mailman_lists';
22 22
 $domains = get_mailman_domains();
23 23
 
24
-$maildomains = array('0' => config('mailman_host'));
24
+$maildomains = ['0' => config('mailman_host')];
25 25
 foreach ($domains as $domain) {
26 26
     $maildomains[$domain['id']] = $domain['fqdn'];
27 27
 }
... ...
@@ -20,7 +20,7 @@ require_role(ROLE_SYSTEMUSER);
20 20
 $title = "Neue Mailingliste erstellen";
21 21
 $domains = get_mailman_domains();
22 22
 
23
-$maildomains = array('0' => config('mailman_host'));
23
+$maildomains = ['0' => config('mailman_host')];
24 24
 foreach ($domains as $domain) {
25 25
     $maildomains[$domain['id']] = $domain['fqdn'];
26 26
 }
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('session/start.php');
18 18
 require_once('inc/icons.php');
19
-require_role(array(ROLE_SYSTEMUSER));
19
+require_role([ROLE_SYSTEMUSER]);
20 20
 
21 21
 global $prefix;
22 22
 
... ...
@@ -16,11 +16,11 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 function get_mysql_accounts($UID)
18 18
 {
19
-    $result = db_query("SELECT id, username, description, created FROM misc.mysql_accounts WHERE useraccount=? ORDER BY username", array($UID));
19
+    $result = db_query("SELECT id, username, description, created FROM misc.mysql_accounts WHERE useraccount=? ORDER BY username", [$UID]);
20 20
     if ($result->rowCount() == 0) {
21
-        return array();
21
+        return [];
22 22
     }
23
-    $list = array();
23
+    $list = [];
24 24
     while ($item = $result->fetch()) {
25 25
         $list[] = $item;
26 26
     }
... ...
@@ -29,11 +29,11 @@ function get_mysql_accounts($UID)
29 29
 
30 30
 function get_mysql_databases($UID)
31 31
 {
32
-    $result = db_query("SELECT id, name, description, created FROM misc.mysql_database WHERE useraccount=? ORDER BY name", array($UID));
32
+    $result = db_query("SELECT id, name, description, created FROM misc.mysql_database WHERE useraccount=? ORDER BY name", [$UID]);
33 33
     if ($result->rowCount() == 0) {
34
-        return array();
34
+        return [];
35 35
     }
36
-    $list = array();
36
+    $list = [];
37 37
     while ($item = $result->fetch()) {
38 38
         $list[] = $item;
39 39
     }
... ...
@@ -52,8 +52,8 @@ function set_database_description($dbname, $description)
52 52
     if ($thisdb == null) {
53 53
         system_failure('Ungültige Datenbank');
54 54
     }
55
-    $args = array(":id" => $thisdb['id'],
56
-                ":desc" => filter_input_oneline($description));
55
+    $args = [":id" => $thisdb['id'],
56
+                ":desc" => filter_input_oneline($description), ];
57 57
     db_query("UPDATE misc.mysql_database SET description=:desc WHERE id=:id", $args);
58 58
 }
59 59
 
... ...
@@ -69,16 +69,16 @@ function set_dbuser_description($username, $description)
69 69
     if ($thisuser == null) {
70 70
         system_failure('Ungültiger Benutzer');
71 71
     }
72
-    $args = array(":id" => $thisuser['id'],
73
-                ":desc" => filter_input_oneline($description));
72
+    $args = [":id" => $thisuser['id'],
73
+                ":desc" => filter_input_oneline($description), ];
74 74
     db_query("UPDATE misc.mysql_accounts SET description=:desc WHERE id=:id", $args);
75 75
 }
76 76
 
77 77
 function servers_for_databases()
78 78
 {
79 79
     $uid = (int) $_SESSION['userinfo']['uid'];
80
-    $result = db_query("SELECT db.name AS db, hostname FROM misc.mysql_database AS db LEFT JOIN system.useraccounts AS u ON (db.useraccount=u.uid) LEFT JOIN system.servers ON (COALESCE(db.server, u.server) = servers.id) WHERE db.useraccount=?", array($uid));
81
-    $ret = array();
80
+    $result = db_query("SELECT db.name AS db, hostname FROM misc.mysql_database AS db LEFT JOIN system.useraccounts AS u ON (db.useraccount=u.uid) LEFT JOIN system.servers ON (COALESCE(db.server, u.server) = servers.id) WHERE db.useraccount=?", [$uid]);
81
+    $ret = [];
82 82
     while ($line = $result->fetch()) {
83 83
         $ret[$line['db']] = $line['hostname'];
84 84
     }
... ...
@@ -92,8 +92,8 @@ function get_mysql_access($db, $account)
92 92
     $uid = $_SESSION['userinfo']['uid'];
93 93
     global $mysql_access;
94 94
     if (!is_array($mysql_access)) {
95
-        $mysql_access = array();
96
-        $result = db_query("SELECT db.name AS db, acc.username AS user FROM misc.mysql_access AS access LEFT JOIN misc.mysql_database AS db ON (db.id=access.database) LEFT JOIN misc.mysql_accounts AS acc ON (acc.id = access.user) WHERE acc.useraccount=:uid OR db.useraccount=:uid", array(":uid" => $uid));
95
+        $mysql_access = [];
96
+        $result = db_query("SELECT db.name AS db, acc.username AS user FROM misc.mysql_access AS access LEFT JOIN misc.mysql_database AS db ON (db.id=access.database) LEFT JOIN misc.mysql_accounts AS acc ON (acc.id = access.user) WHERE acc.useraccount=:uid OR db.useraccount=:uid", [":uid" => $uid]);
97 97
         if ($result->rowCount() == 0) {
98 98
             return false;
99 99
         }
... ...
@@ -114,26 +114,26 @@ function set_mysql_access($db, $account, $status)
114 114
         if (get_mysql_access($db, $account)) {
115 115
             return null;
116 116
         }
117
-        $args = array(":db" => $db, ":uid" => $uid);
117
+        $args = [":db" => $db, ":uid" => $uid];
118 118
         $result = db_query("SELECT id FROM misc.mysql_database WHERE name=:db AND useraccount=:uid", $args);
119 119
         if ($result->rowCount() != 1) {
120 120
             logger(LOG_ERR, "modules/mysql/include/mysql", "mysql", "cannot find database {$db}");
121 121
             system_failure("cannot find database »{$db}«");
122 122
         }
123
-        $args = array(":account" => $account, ":uid" => $uid);
123
+        $args = [":account" => $account, ":uid" => $uid];
124 124
         $result = db_query("SELECT id FROM misc.mysql_accounts WHERE username=:account AND useraccount=:uid", $args);
125 125
         if ($result->rowCount() != 1) {
126 126
             logger(LOG_ERR, "modules/mysql/include/mysql", "mysql", "cannot find user {$account}");
127 127
             system_failure("cannot find database user »{$account}«");
128 128
         }
129
-        $args = array(":db" => $db, ":uid" => $uid, ":account" => $account);
129
+        $args = [":db" => $db, ":uid" => $uid, ":account" => $account];
130 130
         db_query("INSERT INTO misc.mysql_access (`database`,user) VALUES ((SELECT id FROM misc.mysql_database WHERE name=:db AND useraccount=:uid LIMIT 1), (SELECT id FROM misc.mysql_accounts WHERE username=:account AND useraccount=:uid))", $args);
131 131
         logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "granting access on »{$db}« to »{$account}«");
132 132
     } else {
133 133
         if (! get_mysql_access($db, $account)) {
134 134
             return null;
135 135
         }
136
-        $args = array(":db" => $db, ":account" => $account, ":uid" => $uid);
136
+        $args = [":db" => $db, ":account" => $account, ":uid" => $uid];
137 137
         db_query("DELETE FROM misc.mysql_access WHERE `database`=(SELECT id FROM misc.mysql_database WHERE name=:db AND useraccount=:uid LIMIT 1) AND user=(SELECT id FROM misc.mysql_accounts WHERE username=:account AND useraccount=:uid)", $args);
138 138
         logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "revoking access on »{$db}« from »{$account}«");
139 139
     }
... ...
@@ -147,9 +147,9 @@ function create_mysql_account($username, $description = '')
147 147
         system_failure("Der eingegebene Benutzername entspricht leider nicht der Konvention. Bitte tragen Sie einen passenden Namen ein.");
148 148
         return null;
149 149
     }
150
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
150
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
151 151
                 ":username" => $username,
152
-                ":desc" => $description);
152
+                ":desc" => $description, ];
153 153
     logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "creating user »{$username}«");
154 154
     db_query("INSERT INTO misc.mysql_accounts (username, password, useraccount, description) VALUES (:username, '!', :uid, :desc)", $args);
155 155
 }
... ...
@@ -157,8 +157,8 @@ function create_mysql_account($username, $description = '')
157 157
 
158 158
 function delete_mysql_account($username)
159 159
 {
160
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
161
-                ":username" => $username);
160
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
161
+                ":username" => $username, ];
162 162
     logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "deleting user »{$username}«");
163 163
     db_query("DELETE FROM misc.mysql_accounts WHERE username=:username AND useraccount=:uid", $args);
164 164
 }
... ...
@@ -174,10 +174,10 @@ function create_mysql_database($dbname, $description = null, $server = null)
174 174
     if (! in_array($server, additional_servers()) || ($server == my_server_id())) {
175 175
         $server = null;
176 176
     }
177
-    $args = array(":dbname" => $dbname,
177
+    $args = [":dbname" => $dbname,
178 178
                 ":uid" => $_SESSION['userinfo']['uid'],
179 179
                 ":desc" => $description,
180
-                ":server" => $server);
180
+                ":server" => $server, ];
181 181
     logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "creating database »{$dbname}«");
182 182
     db_query("INSERT INTO misc.mysql_database (name, useraccount, server, description) VALUES (:dbname, :uid, :server, :desc)", $args);
183 183
 }
... ...
@@ -185,8 +185,8 @@ function create_mysql_database($dbname, $description = null, $server = null)
185 185
 
186 186
 function delete_mysql_database($dbname)
187 187
 {
188
-    $args = array(":dbname" => $dbname,
189
-                ":uid" => $_SESSION['userinfo']['uid']);
188
+    $args = [":dbname" => $dbname,
189
+                ":uid" => $_SESSION['userinfo']['uid'], ];
190 190
     logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "removing database »{$dbname}«");
191 191
     db_query("DELETE FROM misc.mysql_database WHERE name=:dbname AND useraccount=:uid", $args);
192 192
 }
... ...
@@ -208,9 +208,9 @@ function validate_mysql_username($username)
208 208
 
209 209
 function set_mysql_password($username, $password)
210 210
 {
211
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
211
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
212 212
                 ":username" => $username,
213
-                ":password" => $password);
213
+                ":password" => $password, ];
214 214
     logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "updating password for »{$username}«");
215 215
     db_query("UPDATE misc.mysql_accounts SET password=PASSWORD(:password) WHERE username=:username AND useraccount=:uid", $args);
216 216
 }
... ...
@@ -218,8 +218,8 @@ function set_mysql_password($username, $password)
218 218
 
219 219
 function has_mysql_database($dbname)
220 220
 {
221
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
222
-                ":dbname" => $dbname);
221
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
222
+                ":dbname" => $dbname, ];
223 223
     $result = db_query("SELECT NULL FROM misc.mysql_database WHERE name=:dbname AND useraccount=:uid", $args);
224 224
     return ($result->rowCount() == 1);
225 225
 }
... ...
@@ -227,8 +227,8 @@ function has_mysql_database($dbname)
227 227
 
228 228
 function has_mysql_user($username)
229 229
 {
230
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
231
-                ":username" => $username);
230
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
231
+                ":username" => $username, ];
232 232
     $result = db_query("SELECT NULL FROM misc.mysql_accounts WHERE username=:username AND useraccount=:uid", $args);
233 233
     return ($result->rowCount() == 1);
234 234
 }
... ...
@@ -17,5 +17,5 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20
-    $menu["mysql_overview"] = array("label" => "MySQL-Datenbank", "file" => "overview", "weight" => 20);
20
+    $menu["mysql_overview"] = ["label" => "MySQL-Datenbank", "file" => "overview", "weight" => 20];
21 21
 }
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('session/start.php');
18 18
 require_once('inc/icons.php');
19
-require_role(array(ROLE_SYSTEMUSER));
19
+require_role([ROLE_SYSTEMUSER]);
20 20
 
21 21
 global $prefix;
22 22
 
... ...
@@ -29,7 +29,7 @@ $username = $_SESSION['userinfo']['username'];
29 29
 $section = 'mysql_overview';
30 30
 title('Neue MySQL-Datenbank');
31 31
 
32
-$dbnames = array();
32
+$dbnames = [];
33 33
 foreach ($dbs as $db) {
34 34
     $dbnames[] = $db['name'];
35 35
 }
... ...
@@ -55,7 +55,7 @@ if (count(additional_servers()) > 0) {
55 55
     $available_servers[] = my_server_id();
56 56
     $available_servers = array_unique($available_servers);
57 57
 
58
-    $selectable_servers = array();
58
+    $selectable_servers = [];
59 59
     $all_servers = server_names();
60 60
     foreach ($all_servers as $id => $fqdn) {
61 61
         if (in_array($id, $available_servers)) {
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('session/start.php');
18 18
 require_once('inc/icons.php');
19
-require_role(array(ROLE_SYSTEMUSER));
19
+require_role([ROLE_SYSTEMUSER]);
20 20
 
21 21
 global $prefix;
22 22
 
... ...
@@ -53,7 +53,7 @@ html_header('
53 53
 </script>');
54 54
 
55 55
 
56
-$usernames = array();
56
+$usernames = [];
57 57
 foreach ($users as $user) {
58 58
     $usernames[] = $user['username'];
59 59
 }
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('session/start.php');
18 18
 require_once('inc/icons.php');
19
-require_role(array(ROLE_SYSTEMUSER));
19
+require_role([ROLE_SYSTEMUSER]);
20 20
 
21 21
 global $prefix;
22 22
 
... ...
@@ -105,7 +105,7 @@ addnew('newdb', 'Neue Datenbank');
105 105
 addnew('newuser', 'Neuer DB-Benutzer');
106 106
 
107 107
 if (count($dbs) > 0) {
108
-    $myservers = array();
108
+    $myservers = [];
109 109
     foreach ($servers as $s) {
110 110
         if (! in_array($s, $myservers)) {
111 111
             $myservers[] = $s;
... ...
@@ -125,7 +125,7 @@ if (count($users) > 0) {
125 125
 
126 126
 
127 127
 
128
-    $my_users = array();
128
+    $my_users = [];
129 129
     foreach ($users as $u) {
130 130
         $my_users[$u['username']] = $u['username'];
131 131
     }
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('session/start.php');
18 18
 require_once('inc/icons.php');
19
-require_role(array(ROLE_SYSTEMUSER));
19
+require_role([ROLE_SYSTEMUSER]);
20 20
 
21 21
 global $prefix;
22 22
 
... ...
@@ -15,10 +15,10 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
18
-    $shortcuts[] = array( 'section' => 'Datenbank',
18
+    $shortcuts[] = [ 'section' => 'Datenbank',
19 19
                         'weight'  => 20,
20 20
                         'file'    => 'overview',
21 21
                         'icon'    => 'mysql.png',
22 22
                         'title'   => 'MySQL-Datenbanken',
23
-                        'alert'   => null );
23
+                        'alert'   => null, ];
24 24
 }
... ...
@@ -17,13 +17,13 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 function set_newsletter_address($address)
18 18
 {
19 19
     $cid = $_SESSION['customerinfo']['customerno'];
20
-    db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", array(":address" => $address, ":cid" => $cid));
20
+    db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", [":address" => $address, ":cid" => $cid]);
21 21
 }
22 22
 
23 23
 function get_newsletter_address()
24 24
 {
25 25
     $cid = $_SESSION['customerinfo']['customerno'];
26
-    $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", array($cid));
26
+    $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", [$cid]);
27 27
     $r = $result->fetch();
28 28
     return $r['email_newsletter'];
29 29
 }
... ...
@@ -32,7 +32,7 @@ function get_newsletter_address()
32 32
 function get_latest_news()
33 33
 {
34 34
     $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 2 YEAR ORDER BY date DESC");
35
-    $ret = array();
35
+    $ret = [];
36 36
     while ($item = $result->fetch()) {
37 37
         $ret[] = $item;
38 38
     }
... ...
@@ -44,7 +44,7 @@ function get_latest_news()
44 44
 function get_news_item($id)
45 45
 {
46 46
     $id = (int) $id;
47
-    $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", array($id));
47
+    $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", [$id]);
48 48
     $ret = $result->fetch();
49 49
     DEBUG($ret);
50 50
     return $ret;
... ...
@@ -17,5 +17,5 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_CUSTOMER) {
20
-    $menu["newsletter_newsletter"] = array("label" => "Newsletter", "file" => "newsletter", "weight" => 5, "submenu" => "index_index");
20
+    $menu["newsletter_newsletter"] = ["label" => "Newsletter", "file" => "newsletter", "weight" => 5, "submenu" => "index_index"];
21 21
 }
... ...
@@ -22,7 +22,7 @@ require_once('newpass.php');
22 22
 require_once('inc/form.php');
23 23
 require_once('inc/base.php');
24 24
 
25
-$fail = array();
25
+$fail = [];
26 26
 $success = false;
27 27
 $customerno = 0;
28 28
 
... ...
@@ -18,7 +18,7 @@ $role = $_SESSION['role'];
18 18
 
19 19
 switch ($role) {
20 20
   case ROLE_ANONYMOUS:
21
-    $menu["register_index"] = array("label" => "Kunde werden", "file" => "index", "weight" => 0);
21
+    $menu["register_index"] = ["label" => "Kunde werden", "file" => "index", "weight" => 0];
22 22
     break;
23 23
 
24 24
 }
... ...
@@ -20,7 +20,7 @@ function list_system_users()
20 20
 
21 21
     $result = db_query("SELECT uid,username FROM system.v_useraccounts ORDER BY username");
22 22
 
23
-    $ret = array();
23
+    $ret = [];
24 24
     while ($item = $result->fetch(PDO::FETCH_OBJ)) {
25 25
         array_push($ret, $item);
26 26
     }
... ...
@@ -34,7 +34,7 @@ function list_customers()
34 34
 
35 35
     $result = db_query("SELECT id, IF(firma IS NULL, CONCAT_WS(' ', vorname, nachname), CONCAT(firma, ' (', CONCAT_WS(' ', vorname, nachname), ')')) AS name FROM kundendaten.kunden");
36 36
 
37
-    $ret = array();
37
+    $ret = [];
38 38
     while ($item = $result->fetch(PDO::FETCH_OBJ)) {
39 39
         array_push($ret, $item);
40 40
     }
... ...
@@ -44,7 +44,7 @@ function list_customers()
44 44
 function customer_details($id)
45 45
 {
46 46
     $id = (int) $id;
47
-    $result = db_query("SELECT id, IF(firma IS NULL, CONCAT_WS(' ', vorname, nachname), CONCAT(firma, ' (', CONCAT_WS(' ', vorname, nachname), ')')) AS name FROM kundendaten.kunden WHERE id=?", array($id));
47
+    $result = db_query("SELECT id, IF(firma IS NULL, CONCAT_WS(' ', vorname, nachname), CONCAT(firma, ' (', CONCAT_WS(' ', vorname, nachname), ')')) AS name FROM kundendaten.kunden WHERE id=?", [$id]);
48 48
     if ($result->rowCount() < 1) {
49 49
         return null;
50 50
     }
... ...
@@ -55,8 +55,8 @@ function customer_details($id)
55 55
 
56 56
 function find_customers($string)
57 57
 {
58
-    $args = array(":string" => '%'.chop($string).'%', ":number" => $string);
59
-    $return = array();
58
+    $args = [":string" => '%'.chop($string).'%', ":number" => $string];
59
+    $return = [];
60 60
     $result = db_query("SELECT k.id FROM kundendaten.kunden AS k LEFT JOIN system.useraccounts AS u ON (k.id=u.kunde) WHERE ".
61 61
                      "firma LIKE :string OR firma2 LIKE :string OR ".
62 62
                      "nachname LIKE :string OR vorname LIKE :string OR ".
... ...
@@ -85,9 +85,9 @@ function find_customers($string)
85 85
 function find_users_for_customer($id)
86 86
 {
87 87
     $id = (int) $id;
88
-    $return = array();
88
+    $return = [];
89 89
     $result = db_query("SELECT uid, username, name FROM system.useraccounts WHERE ".
90
-                     "kunde=?", array($id));
90
+                     "kunde=?", [$id]);
91 91
     while ($entry = $result->fetch()) {
92 92
         $return[] = $entry;
93 93
     }
... ...
@@ -101,14 +101,14 @@ function find_users_for_customer($id)
101 101
 function build_results($term)
102 102
 {
103 103
     global $ret;
104
-    $ret = array();
104
+    $ret = [];
105 105
 
106 106
     $add = function ($val, $id, $value) {
107 107
         global $ret;
108 108
         if (isset($ret[$val]) && is_array($ret[$val])) {
109
-            array_push($ret[$val], array("id" => $id, "value" => $value));
109
+            array_push($ret[$val], ["id" => $id, "value" => $value]);
110 110
         } else {
111
-            $ret[$val] = array( array("id" => $id, "value" => $value) );
111
+            $ret[$val] = [ ["id" => $id, "value" => $value] ];
112 112
         }
113 113
     };
114 114
 
... ...
@@ -142,7 +142,7 @@ function build_results($term)
142 142
 
143 143
     ksort($ret);
144 144
 
145
-    $allentries = array();
145
+    $allentries = [];
146 146
     foreach ($ret as $group) {
147 147
         usort($group, function ($a, $b) {
148 148
             return strnatcmp($a['value'], $b['value']);
... ...
@@ -18,11 +18,11 @@ $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_CUSTOMER) {
20 20
     if (have_module('systemuser')) {
21
-        $menu["su_su_customer"] = array("label" => "Benutzer wechseln", "file" => "su_customer", "weight" => -10, "submenu" => "systemuser_account");
21
+        $menu["su_su_customer"] = ["label" => "Benutzer wechseln", "file" => "su_customer", "weight" => -10, "submenu" => "systemuser_account"];
22 22
     } else {
23
-        $menu["su_su_customer"] = array("label" => "Benutzer wechseln", "file" => "su_customer", "weight" => 90);
23
+        $menu["su_su_customer"] = ["label" => "Benutzer wechseln", "file" => "su_customer", "weight" => 90];
24 24
     }
25 25
 }
26 26
 if ($role & ROLE_SYSADMIN) {
27
-    $menu["su_su"] = array("label" => "Su-Login", "file" => "su", "weight" => -10);
27
+    $menu["su_su"] = ["label" => "Su-Login", "file" => "su", "weight" => -10];
28 28
 }
... ...
@@ -31,10 +31,10 @@ $term = $_GET['term'];
31 31
 
32 32
 $allentries = build_results($term);
33 33
 
34
-$out = array();
34
+$out = [];
35 35
 
36 36
 foreach ($allentries as $entry) {
37
-    $out[] = array('id' => $entry['id'], 'value' => $entry['value']);
37
+    $out[] = ['id' => $entry['id'], 'value' => $entry['value']];
38 38
 }
39 39
 
40 40
 
... ...
@@ -23,8 +23,8 @@ require_once("inc/debug.php");
23 23
 function list_subusers()
24 24
 {
25 25
     $uid = (int) $_SESSION['userinfo']['uid'];
26
-    $result = db_query("SELECT id, username, modules FROM system.subusers WHERE uid=?", array($uid));
27
-    $subusers = array();
26
+    $result = db_query("SELECT id, username, modules FROM system.subusers WHERE uid=?", [$uid]);
27
+    $subusers = [];
28 28
     while ($item = $result->fetch()) {
29 29
         $item['modules'] = explode(',', $item['modules']);
30 30
         $subusers[] = $item;
... ...
@@ -36,7 +36,7 @@ function list_subusers()
36 36
 
37 37
 function load_subuser($id)
38 38
 {
39
-    $args = array(":id" => $id, ":uid" => $_SESSION['userinfo']['uid']);
39
+    $args = [":id" => $id, ":uid" => $_SESSION['userinfo']['uid']];
40 40
 
41 41
     $result = db_query("SELECT id, username, modules FROM system.subusers WHERE uid=:uid AND id=:id", $args);
42 42
     $item = $result->fetch();
... ...
@@ -47,7 +47,7 @@ function load_subuser($id)
47 47
 
48 48
 function available_modules()
49 49
 {
50
-    $modules = array();
50
+    $modules = [];
51 51
     $allmodules = get_modules_info();
52 52
 
53 53
     // Das su-Modul ist hierfuer unwichtig
... ...
@@ -63,16 +63,16 @@ function available_modules()
63 63
 
64 64
 function delete_subuser($id)
65 65
 {
66
-    $args = array(":id" => $id, ":uid" => $_SESSION['userinfo']['uid']);
66
+    $args = [":id" => $id, ":uid" => $_SESSION['userinfo']['uid']];
67 67
 
68 68
     db_query("DELETE FROM system.subusers WHERE id=:id AND uid=:uid", $args);
69 69
 }
70 70
 
71 71
 function empty_subuser()
72 72
 {
73
-    $subuser = array("id" => null,
73
+    $subuser = ["id" => null,
74 74
                    "username" => $_SESSION['userinfo']['username'].'_',
75
-                   "modules" => array('index'));
75
+                   "modules" => ['index'], ];
76 76
     return $subuser;
77 77
 }
78 78
 
... ...
@@ -89,7 +89,7 @@ function new_subuser($username, $requested_modules, $password)
89 89
     }
90 90
     DEBUG($requested_modules);
91 91
     $allmods = available_modules();
92
-    $modules = array();
92
+    $modules = [];
93 93
     foreach ($requested_modules as $mod) {
94 94
         if (isset($allmods[$mod])) {
95 95
             $modules[] = $mod;
... ...
@@ -105,10 +105,10 @@ function new_subuser($username, $requested_modules, $password)
105 105
         system_failure("Unsicheres Passwort: ".$result);
106 106
     }
107 107
 
108
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
108
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
109 109
                 ":username" => $username,
110 110
                 ":password" => hash("sha256", $password),
111
-                ":modules" => implode(',', $modules));
111
+                ":modules" => implode(',', $modules), ];
112 112
 
113 113
     db_query("INSERT INTO system.subusers (uid, username, password, modules) VALUES (:uid, :username, :password, :modules)", $args);
114 114
 }
... ...
@@ -141,7 +141,7 @@ function edit_subuser($id, $username, $requested_modules, $password)
141 141
         system_failure("Module nicht als array erhalten!");
142 142
     }
143 143
     $allmods = available_modules();
144
-    $modules = array();
144
+    $modules = [];
145 145
     foreach ($requested_modules as $mod) {
146 146
         if (isset($allmods[$mod])) {
147 147
             $modules[] = $mod;
... ...
@@ -151,10 +151,10 @@ function edit_subuser($id, $username, $requested_modules, $password)
151 151
         system_failure("Es sind (nach der Filterung) keine Module mehr übrig!");
152 152
     }
153 153
 
154
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
154
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
155 155
                 ":id" => $id,
156 156
                 ":username" => $username,
157
-                ":modules" => implode(',', $modules));
157
+                ":modules" => implode(',', $modules), ];
158 158
 
159 159
     $pwchange = '';
160 160
     if ($password) {
... ...
@@ -17,6 +17,6 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20
-    $menu["subusers_subusers"] = array("label" => "Zusätzliche Admins", "file" => "subusers", "weight" => 1, "submenu" => "systemuser_account");
20
+    $menu["subusers_subusers"] = ["label" => "Zusätzliche Admins", "file" => "subusers", "weight" => 1, "submenu" => "systemuser_account"];
21 21
     //$menu["subusers_subusers"] = array("label" => "Zusätzliche Admins", "file" => "subusers", "weight" => 1);
22 22
 }
... ...
@@ -35,7 +35,7 @@ if (! customer_may_have_useraccounts()) {
35 35
     foreach ($accounts as $acc) {
36 36
         $shell = $shells[$acc['shell']];
37 37
         $usedquota = get_used_quota($acc['uid']);
38
-        $quota = array();
38
+        $quota = [];
39 39
         foreach ($usedquota as $q) {
40 40
             $mailbar = '';
41 41
             $mailstring = '';
... ...
@@ -18,7 +18,7 @@ require_once('inc/base.php');
18 18
 
19 19
 require_once('useraccounts.php');
20 20
 
21
-require_role(array(ROLE_CUSTOMER, ROLE_SYSTEMUSER));
21
+require_role([ROLE_CUSTOMER, ROLE_SYSTEMUSER]);
22 22
 
23 23
 
24 24
 title("System-Benutzeraccounts");
... ...
@@ -21,13 +21,13 @@ require_once("inc/debug.php");
21 21
 function customer_may_have_useraccounts()
22 22
 {
23 23
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
24
-    $result = db_query("SELECT COUNT(*) FROM system.useraccounts WHERE kunde=?", array($customerno));
24
+    $result = db_query("SELECT COUNT(*) FROM system.useraccounts WHERE kunde=?", [$customerno]);
25 25
     return ($result->rowCount() > 0);
26 26
 }
27 27
 
28 28
 function customer_useraccount($uid)
29 29
 {
30
-    $args = array(":uid" => $uid, ":customerno" => $_SESSION['customerinfo']['customerno']);
30
+    $args = [":uid" => $uid, ":customerno" => $_SESSION['customerinfo']['customerno']];
31 31
     $result = db_query("SELECT 1 FROM system.useraccounts WHERE kunde=:customerno AND uid=:uid AND kundenaccount=1", $args);
32 32
     return $result->rowCount() > 0;
33 33
 }
... ...
@@ -38,7 +38,7 @@ function primary_useraccount()
38 38
         return null;
39 39
     }
40 40
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
41
-    $result = db_query("SELECT MIN(uid) AS uid FROM system.useraccounts WHERE kunde=?", array($customerno));
41
+    $result = db_query("SELECT MIN(uid) AS uid FROM system.useraccounts WHERE kunde=?", [$customerno]);
42 42
     $uid = $result->fetch(PDO::FETCH_OBJ)->uid;
43 43
     DEBUG("primary useraccount: {$uid}");
44 44
     return $uid;
... ...
@@ -47,8 +47,8 @@ function primary_useraccount()
47 47
 
48 48
 function available_shells()
49 49
 {
50
-    $result = db_query("SELECT path, name FROM system.shells WHERE usable=?", array(1));
51
-    $ret = array();
50
+    $result = db_query("SELECT path, name FROM system.shells WHERE usable=?", [1]);
51
+    $ret = [];
52 52
     while ($s = $result->fetch()) {
53 53
         $ret[$s['path']] = $s['name'];
54 54
     }
... ...
@@ -60,8 +60,8 @@ function available_shells()
60 60
 function list_useraccounts()
61 61
 {
62 62
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
63
-    $result = db_query("SELECT uid,username,name,erstellungsdatum,quota,shell FROM system.useraccounts WHERE kunde=?", array($customerno));
64
-    $ret = array();
63
+    $result = db_query("SELECT uid,username,name,erstellungsdatum,quota,shell FROM system.useraccounts WHERE kunde=?", [$customerno]);
64
+    $ret = [];
65 65
     while ($item = $result->fetch()) {
66 66
         array_push($ret, $item);
67 67
     }
... ...
@@ -77,7 +77,7 @@ function get_account_details($uid, $customerno=0)
77 77
     if ($customerno == 0) {
78 78
         $customerno = $_SESSION['customerinfo']['customerno'];
79 79
     }
80
-    $args = array(":uid" => $uid, ":customerno" => $customerno);
80
+    $args = [":uid" => $uid, ":customerno" => $customerno];
81 81
     $result = db_query("SELECT uid,username,name,shell,server,quota,erstellungsdatum,passwordlogin FROM system.useraccounts WHERE kunde=:customerno AND uid=:uid", $args);
82 82
     if ($result->rowCount() == 0) {
83 83
         system_failure("Cannot find the requestes useraccount (for this customer).");
... ...
@@ -88,8 +88,8 @@ function get_account_details($uid, $customerno=0)
88 88
 function get_used_quota($uid)
89 89
 {
90 90
     $uid = (int) $uid;
91
-    $result = db_query("SELECT s.hostname AS server, systemquota, systemquota_used, mailquota, mailquota_used FROM system.v_quota AS q LEFT JOIN system.servers AS s ON (s.id=q.server) WHERE uid=?", array($uid));
92
-    $ret = array();
91
+    $result = db_query("SELECT s.hostname AS server, systemquota, systemquota_used, mailquota, mailquota_used FROM system.v_quota AS q LEFT JOIN system.servers AS s ON (s.id=q.server) WHERE uid=?", [$uid]);
92
+    $ret = [];
93 93
     while ($line = $result->fetch()) {
94 94
         $ret[] = $line;
95 95
     }
... ...
@@ -110,12 +110,12 @@ function set_account_details($account)
110 110
     if ($account['name'] == '') {
111 111
         $account['name'] = null;
112 112
     }
113
-    $args = array(":fullname" => filter_input_oneline($account['name']),
113
+    $args = [":fullname" => filter_input_oneline($account['name']),
114 114
                 ":shell" => filter_input_oneline($account['shell']),
115 115
                 ":quota" => $account['quota'],
116 116
                 ":uid" => $account['uid'],
117 117
                 ":customerno" => $customerno,
118
-                ":passwordlogin" => $account['passwordlogin']);
118
+                ":passwordlogin" => $account['passwordlogin'], ];
119 119
 
120 120
     db_query("UPDATE system.useraccounts SET name=:fullname, quota=:quota, shell=:shell, passwordlogin=:passwordlogin WHERE kunde=:customerno AND uid=:uid", $args);
121 121
     logger(LOG_INFO, "modules/systemuser/include/useraccounts", "systemuser", "updated details for uid {$args[":uid"]}");
... ...
@@ -124,7 +124,7 @@ function set_account_details($account)
124 124
 function get_customer_quota()
125 125
 {
126 126
     $cid = (int) $_SESSION['customerinfo']['customerno'];
127
-    $result = db_query("SELECT SUM(u.quota) AS assigned, cq.quota AS max FROM system.customerquota AS cq INNER JOIN system.useraccounts AS u ON (u.kunde=cq.cid) WHERE cq.cid=?", array($cid));
127
+    $result = db_query("SELECT SUM(u.quota) AS assigned, cq.quota AS max FROM system.customerquota AS cq INNER JOIN system.useraccounts AS u ON (u.kunde=cq.cid) WHERE cq.cid=?", [$cid]);
128 128
     $ret = $result->fetch();
129 129
     DEBUG($ret);
130 130
     return $ret;
... ...
@@ -17,7 +17,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_CUSTOMER) {
20
-    $menu["systemuser_account"] = array("label" => "Benutzeraccounts", "file" => "account", "weight" => 30);
20
+    $menu["systemuser_account"] = ["label" => "Benutzeraccounts", "file" => "account", "weight" => 30];
21 21
 } elseif ($role & ROLE_SYSTEMUSER) {
22
-    $menu["systemuser_account"] = array("label" => "Benutzeraccount", "file" => "myaccount", "weight" => 30);
22
+    $menu["systemuser_account"] = ["label" => "Benutzeraccount", "file" => "myaccount", "weight" => 30];
23 23
 }
... ...
@@ -30,7 +30,7 @@ output("<p>Daten zu Ihrem Benutzeraccount:</p>");
30 30
 $acc = get_account_details($_SESSION['userinfo']['uid'], $_SESSION['userinfo']['customerno']);
31 31
 $shell = $shells[$acc['shell']];
32 32
 $usedquota = get_used_quota($acc['uid']);
33
-$quota = array();
33
+$quota = [];
34 34
 foreach ($usedquota as $q) {
35 35
     $mailbar = '';
36 36
     $mailstring = '';
... ...
@@ -25,7 +25,7 @@ require_role(ROLE_SYSTEMUSER);
25 25
 
26 26
 $acc = get_account_details($_SESSION['userinfo']['uid'], $_SESSION['userinfo']['customerno']);
27 27
 $usedquota = get_used_quota($acc['uid']);
28
-$quota = array();
28
+$quota = [];
29 29
 $multiserver = count($usedquota) > 1;
30 30
 $need_more_storage = false;
31 31
 foreach ($usedquota as $q) {
... ...
@@ -21,7 +21,7 @@ require_once('useraccounts.php');
21 21
 require_once('inc/security.php');
22 22
 
23 23
 
24
-require_role(array(ROLE_CUSTOMER, ROLE_SYSTEMUSER));
24
+require_role([ROLE_CUSTOMER, ROLE_SYSTEMUSER]);
25 25
 
26 26
 $role = $_SESSION['role'];
27 27
 
... ...
@@ -28,7 +28,7 @@ if (isset($_GET['aliaswww'])) {
28 28
     $alias = get_alias_details($_GET['alias']);
29 29
     DEBUG($alias);
30 30
     $old_options = explode(',', $alias['options']);
31
-    $new_options = array();
31
+    $new_options = [];
32 32
     foreach ($old_options as $op) {
33 33
         if ($op !== '' && $op != 'aliaswww') {
34 34
             array_push($new_options, $op);
... ...
@@ -56,7 +56,7 @@ if (isset($_GET['forward'])) {
56 56
     $alias = get_alias_details($_GET['alias']);
57 57
     DEBUG($alias);
58 58
     $old_options = explode(',', $alias['options']);
59
-    $new_options = array();
59
+    $new_options = [];
60 60
     foreach ($old_options as $op) {
61 61
         if ($op !== '' && $op != 'forward') {
62 62
             array_push($new_options, $op);
... ...
@@ -34,7 +34,7 @@ if ($id != 0) {
34 34
 }
35 35
 
36 36
 $have_v6 = false;
37
-$server = (isset($vhost['server']) ? $vhost['server'] : $_SESSION['userinfo']['server']);
37
+$server = ($vhost['server'] ?? $_SESSION['userinfo']['server']);
38 38
 if (ipv6_possible($server)) {
39 39
     $have_v6 = true;
40 40
 }
... ...
@@ -91,7 +91,7 @@ foreach ($applist as $app) {
91 91
     $webapp_options .= "<option value=\"{$app['id']}\">{$app['displayname']}</option>\n";
92 92
 }
93 93
 
94
-$aliaswww_options = array("forwardwww" => "Umleiten auf www-Subdomain", "forwardnowww" => "Umleiten auf Stammdomain (ohne www)", "noforward" => "Keine Umleitung");
94
+$aliaswww_options = ["forwardwww" => "Umleiten auf www-Subdomain", "forwardnowww" => "Umleiten auf Stammdomain (ohne www)", "noforward" => "Keine Umleitung"];
95 95
 $aliaswww_option = 'forwardwww';
96 96
 if (strstr($vhost['options'], 'aliaswww')) {
97 97
     // Wenn aliaswww gar nicht gesetzt war, dann soll die select-Option für forwardwww trotzdem auf dem default stehen.
... ...
@@ -126,7 +126,7 @@ $form .= "<br />
126 126
 /*
127 127
  * Choose what PHP version to use
128 128
  */
129
-$options = array("none" => 'ausgeschaltet', "default" => "Eingeschaltet (empfohlene Version)");
129
+$options = ["none" => 'ausgeschaltet', "default" => "Eingeschaltet (empfohlene Version)"];
130 130
 $phpinfo = valid_php_versions();
131 131
 $php_default_version = null;
132 132
     foreach ($phpinfo as $v) {
... ...
@@ -188,7 +188,7 @@ if ($vhost_type=='webapp') {
188 188
 ";
189 189
 }
190 190
 $hsts_value = $vhost['hsts'];
191
-$hsts_preset_values = array("-1" => "aus", "86400" => "1 Tag", "2592000" => "30 Tage", "31536000" => "1 Jahr", "63072000" => "2 Jahre", "custom" => "Individuell");
191
+$hsts_preset_values = ["-1" => "aus", "86400" => "1 Tag", "2592000" => "30 Tage", "31536000" => "1 Jahr", "63072000" => "2 Jahre", "custom" => "Individuell"];
192 192
 $hsts_preset_value = 'custom';
193 193
 if (isset($hsts_preset_values[$hsts_value])) {
194 194
     $hsts_preset_value = $hsts_value;
... ...
@@ -218,7 +218,7 @@ $form .= "
218 218
     </div>";
219 219
 
220 220
 $certs = user_certs();
221
-$certselect = array();
221
+$certselect = [];
222 222
 $certselect[0] = 'kein Zertifikat / System-Standard benutzen';
223 223
 if ($vhost_type != 'dav' && $vhost_type != 'svn') {
224 224
     $certselect[-1] = 'Automatische Zertifikatsverwaltung mit Let\'s Encrypt';
... ...
@@ -266,7 +266,7 @@ $available_servers = additional_servers();
266 266
 $available_servers[] = my_server_id();
267 267
 $available_servers = array_unique($available_servers);
268 268
 
269
-$selectable_servers = array();
269
+$selectable_servers = [];
270 270
 $all_servers = server_names();
271 271
 foreach ($all_servers as $id => $fqdn) {
272 272
     if (in_array($id, $available_servers)) {
... ...
@@ -278,7 +278,7 @@ if (!$vhost['server']) {
278 278
 }
279 279
 
280 280
   if (count($ipaddrs)) {
281
-      $ipselect = array(0 => 'System-Standard');
281
+      $ipselect = [0 => 'System-Standard'];
282 282
       foreach ($ipaddrs as $i) {
283 283
           $ipselect[$i] = $i;
284 284
       }
... ...
@@ -289,7 +289,7 @@ if (!$vhost['server']) {
289 289
       </div>";
290 290
   }
291 291
   if (count($available_users)) {
292
-      $userselect = array(0 => 'Eigener Benutzeraccount');
292
+      $userselect = [0 => 'Eigener Benutzeraccount'];
293 293
       foreach ($available_users as $u) {
294 294
           $userselect[$u['uid']] = $u['username'];
295 295
       }
... ...
@@ -24,8 +24,8 @@ define("CERT_NOCHAIN", 2);
24 24
 function user_certs()
25 25
 {
26 26
     $uid = (int) $_SESSION['userinfo']['uid'];
27
-    $result = db_query("SELECT id, valid_from, valid_until, subject, cn FROM vhosts.certs WHERE uid=? ORDER BY cn", array($uid));
28
-    $ret = array();
27
+    $result = db_query("SELECT id, valid_from, valid_until, subject, cn FROM vhosts.certs WHERE uid=? ORDER BY cn", [$uid]);
28
+    $ret = [];
29 29
     while ($i = $result->fetch()) {
30 30
         $ret[] = $i;
31 31
     }
... ...
@@ -36,8 +36,8 @@ function user_certs()
36 36
 function user_csr()
37 37
 {
38 38
     $uid = (int) $_SESSION['userinfo']['uid'];
39
-    $result = db_query("SELECT id, created, hostname, bits FROM vhosts.csr WHERE uid=? ORDER BY hostname", array($uid));
40
-    $ret = array();
39
+    $result = db_query("SELECT id, created, hostname, bits FROM vhosts.csr WHERE uid=? ORDER BY hostname", [$uid]);
40
+    $ret = [];
41 41
     while ($i = $result->fetch()) {
42 42
         $ret[] = $i;
43 43
     }
... ...
@@ -63,7 +63,7 @@ function cert_details($id)
63 63
     $id = (int) $id;
64 64
     $uid = (int) $_SESSION['userinfo']['uid'];
65 65
 
66
-    $result = db_query("SELECT id, lastchange, valid_from, valid_until, subject, cn, chain, cert, `key` FROM vhosts.certs WHERE uid=:uid AND id=:id", array(":uid" => $uid, ":id" => $id));
66
+    $result = db_query("SELECT id, lastchange, valid_from, valid_until, subject, cn, chain, cert, `key` FROM vhosts.certs WHERE uid=:uid AND id=:id", [":uid" => $uid, ":id" => $id]);
67 67
     if ($result->rowCount() != 1) {
68 68
         system_failure("Ungültiges Zertifikat #{$id}");
69 69
     }
... ...
@@ -86,7 +86,7 @@ function csr_details($id)
86 86
     $id = (int) $id;
87 87
     $uid = (int) $_SESSION['userinfo']['uid'];
88 88
 
89
-    $result = db_query("SELECT id, created, hostname, bits, `replace`, csr, `key` FROM vhosts.csr WHERE uid=:uid AND id=:id", array(":uid" => $uid, ":id" => $id));
89
+    $result = db_query("SELECT id, created, hostname, bits, `replace`, csr, `key` FROM vhosts.csr WHERE uid=:uid AND id=:id", [":uid" => $uid, ":id" => $id]);
90 90
     if ($result->rowCount() != 1) {
91 91
         system_failure("Ungültiger CSR");
92 92
     }
... ...
@@ -115,7 +115,7 @@ function get_chain($cert)
115 115
     if (! isset($certdata['issuer']['CN'])) {
116 116
         return null;
117 117
     }
118
-    $result = db_query("SELECT id FROM vhosts.certchain WHERE cn=?", array($certdata['issuer']['CN']));
118
+    $result = db_query("SELECT id FROM vhosts.certchain WHERE cn=?", [$certdata['issuer']['CN']]);
119 119
     if ($result->rowCount() > 0) {
120 120
         $c = $result->fetch();
121 121
         //$chainfile = '/etc/apache2/certs/chains/'.$c['id'].'.pem';
... ...
@@ -162,7 +162,7 @@ function validate_certificate($cert, $key)
162 162
     if ($x509info === false) {
163 163
         system_failure("Zertifikat konnte nicht verarbeitet werden");
164 164
     }
165
-    if (!in_array($x509info['signatureTypeSN'], array("RSA-SHA256", "RSA-SHA385", "RSA-SHA512"))) {
165
+    if (!in_array($x509info['signatureTypeSN'], ["RSA-SHA256", "RSA-SHA385", "RSA-SHA512"])) {
166 166
         system_failure("Nicht unterstützer Signatur-Hashalgorithmus!");
167 167
     }
168 168
 
... ...
@@ -181,10 +181,10 @@ function validate_certificate($cert, $key)
181 181
         system_failure("Testsignatur ungültig, Key vermutlich fehlerhaft!");
182 182
     }
183 183
 
184
-    $cacerts = array('/etc/ssl/certs');
184
+    $cacerts = ['/etc/ssl/certs'];
185 185
     $chain = (int) get_chain($cert);
186 186
     if ($chain) {
187
-        $result = db_query("SELECT content FROM vhosts.certchain WHERE id=?", array($chain));
187
+        $result = db_query("SELECT content FROM vhosts.certchain WHERE id=?", [$chain]);
188 188
         $tmp = $result->fetch();
189 189
         $chaincert = $tmp['content'];
190 190
         $chainfile = tempnam(sys_get_temp_dir(), 'webinterface');
... ...
@@ -224,7 +224,7 @@ validTo_time_t => 1267190790
224 224
     if (isset($certdata['issuer']['O'])) {
225 225
         $issuer = $certdata['issuer']['O'];
226 226
     }
227
-    $san = array();
227
+    $san = [];
228 228
     $raw_san = explode(', ', $certdata['extensions']['subjectAltName']);
229 229
     foreach ($raw_san as $name) {
230 230
         if (! substr($name, 0, 4) == 'DNS:') {
... ...
@@ -235,7 +235,7 @@ validTo_time_t => 1267190790
235 235
     }
236 236
     $san = implode("\n", $san);
237 237
     DEBUG("SAN: <pre>".$san."</pre>");
238
-    return array('subject' => $certdata['subject']['CN'].' / '.$issuer, 'cn' => $certdata['subject']['CN'], 'valid_from' => date('Y-m-d', $certdata['validFrom_time_t']), 'valid_until' => date('Y-m-d', $certdata['validTo_time_t']), 'issuer' => $certdata['issuer']['CN'], 'san' => $san);
238
+    return ['subject' => $certdata['subject']['CN'].' / '.$issuer, 'cn' => $certdata['subject']['CN'], 'valid_from' => date('Y-m-d', $certdata['validFrom_time_t']), 'valid_until' => date('Y-m-d', $certdata['validTo_time_t']), 'issuer' => $certdata['issuer']['CN'], 'san' => $san];
239 239
 }
240 240
 
241 241
 
... ...
@@ -247,8 +247,8 @@ function save_cert($info, $cert, $key)
247 247
 
248 248
     db_query(
249 249
         "INSERT INTO vhosts.certs (uid, subject, cn, san, valid_from, valid_until, chain, cert, `key`) VALUES (:uid, :subject, :cn, :san, :valid_from, :valid_until, :chain, :cert, :key)",
250
-        array(":uid" => $uid, ":subject" => filter_input_oneline($info['subject']), ":cn" => filter_input_oneline($info['cn']), ":san" => $info['san'], ":valid_from" => $info['valid_from'],
251
-              ":valid_until" => $info['valid_until'], ":chain" => get_chain($cert), ":cert" => $cert, ":key" => $key)
250
+        [":uid" => $uid, ":subject" => filter_input_oneline($info['subject']), ":cn" => filter_input_oneline($info['cn']), ":san" => $info['san'], ":valid_from" => $info['valid_from'],
251
+              ":valid_until" => $info['valid_until'], ":chain" => get_chain($cert), ":cert" => $cert, ":key" => $key, ]
252 252
     );
253 253
 }
254 254
 
... ...
@@ -260,14 +260,14 @@ function refresh_cert($id, $info, $cert, $key = null)
260 260
 
261 261
     $id = (int) $id;
262 262
     $oldcert = cert_details($id);
263
-    $args = array(":subject" => filter_input_oneline($info['subject']),
263
+    $args = [":subject" => filter_input_oneline($info['subject']),
264 264
                 ":cn" => filter_input_oneline($info['cn']),
265 265
                 ":san" => $info['san'],
266 266
                 ":cert" => $cert,
267 267
                 ":valid_from" => $info['valid_from'],
268 268
                 ":valid_until" => $info['valid_until'],
269 269
                 ":chain" => get_chain($cert),
270
-                ":id" => $id);
270
+                ":id" => $id, ];
271 271
 
272 272
     $keyop = '';
273 273
     if ($key) {
... ...
@@ -284,7 +284,7 @@ function delete_cert($id)
284 284
     $uid = (int) $_SESSION['userinfo']['uid'];
285 285
     $id = (int) $id;
286 286
 
287
-    db_query("DELETE FROM vhosts.certs WHERE uid=? AND id=?", array($uid, $id));
287
+    db_query("DELETE FROM vhosts.certs WHERE uid=? AND id=?", [$uid, $id]);
288 288
 }
289 289
 
290 290
 function delete_csr($id)
... ...
@@ -292,13 +292,13 @@ function delete_csr($id)
292 292
     $uid = (int) $_SESSION['userinfo']['uid'];
293 293
     $id = (int) $id;
294 294
 
295
-    db_query("DELETE FROM vhosts.csr WHERE uid=? AND id=?", array($uid, $id));
295
+    db_query("DELETE FROM vhosts.csr WHERE uid=? AND id=?", [$uid, $id]);
296 296
 }
297 297
 
298 298
 
299 299
 function split_cn($cn)
300 300
 {
301
-    $domains = array();
301
+    $domains = [];
302 302
     if (strstr($cn, ',') or strstr($cn, "\n")) {
303 303
         $domains = preg_split("/[, \n]+/", $cn);
304 304
         DEBUG("Domains:");
... ...
@@ -315,7 +315,7 @@ function split_cn($cn)
315 315
 function create_csr($cn, $bits)
316 316
 {
317 317
     $domains = split_cn($cn);
318
-    $tmp = array();
318
+    $tmp = [];
319 319
     foreach ($domains as $dom) {
320 320
         $tmp[] = 'DNS:'.$dom;
321 321
     }
... ...
@@ -374,7 +374,7 @@ commonName_default = {$cn}
374 374
     unlink($keyfile);
375 375
     unlink($config);
376 376
 
377
-    return array($csr, $key);
377
+    return [$csr, $key];
378 378
 }
379 379
 
380 380
 
... ...
@@ -389,13 +389,13 @@ function save_csr($cn, $bits, $replace=null)
389 389
     $san = implode("\n", $domains);
390 390
     $csr = null;
391 391
     $key = null;
392
-    list($csr, $key) = create_csr(implode(',', $domains), $bits);
392
+    [$csr, $key] = create_csr(implode(',', $domains), $bits);
393 393
 
394 394
     $uid = (int) $_SESSION['userinfo']['uid'];
395 395
     db_query(
396 396
         "INSERT INTO vhosts.csr (uid, hostname, san, bits, `replace`, csr, `key`) VALUES (:uid, :cn, :san, :bits, :replace, :csr, :key)",
397
-        array(":uid" => $uid, ":cn" => $cn, ":san" => $san, ":bits" => $bits,
398
-                 ":replace" => $replace, ":csr" => $csr, ":key" => $key)
397
+        [":uid" => $uid, ":cn" => $cn, ":san" => $san, ":bits" => $bits,
398
+                 ":replace" => $replace, ":csr" => $csr, ":key" => $key, ]
399 399
     );
400 400
     $id = db_insert_id();
401 401
     return $id;
... ...
@@ -32,10 +32,10 @@ function valid_php_versions()
32 32
             +: Beta-Version
33 33
     */
34 34
     $tags = explode(',', config('php_versions'));
35
-    $ret = array();
35
+    $ret = [];
36 36
     foreach ($tags as $t) {
37 37
         $key = $t;
38
-        $ver = array('major' => null, 'minor' => null, 'status' => 'regular', 'default' => false);
38
+        $ver = ['major' => null, 'minor' => null, 'status' => 'regular', 'default' => false];
39 39
         if (substr($t, -1, 1) == '+') {
40 40
             $ver['status'] = 'beta';
41 41
             $key = substr($t, 0, -1);
... ...
@@ -61,7 +61,7 @@ function valid_php_versions()
61 61
     foreach ($list as $vhost) {
62 62
         if ($vhost['php'] && $vhost['php'] != 'default' && !array_key_exists($vhost['php'], $ret)) {
63 63
             $key = $vhost['php'];
64
-            $ret = array($key => array('major' => null, 'minor' => null, 'status' => 'used', 'default' => false)) + $ret;
64
+            $ret = [$key => ['major' => null, 'minor' => null, 'status' => 'used', 'default' => false]] + $ret;
65 65
             /* Wir nehmen an, dass unsere Tags immer an zweitletzter Stelle die Major-Version und
66 66
             an letzter Stelle die Minor-Version enthalten */
67 67
             $ret[$key]['major'] = substr($key, -2, 1);
... ...
@@ -75,20 +75,20 @@ function valid_php_versions()
75 75
 function traffic_month($vhost_id)
76 76
 {
77 77
     $vhost_id = (int) $vhost_id;
78
-    $result = db_query("SELECT sum(mb_in+mb_out) as mb FROM vhosts.traffic where date > CURDATE() - INTERVAL 1 MONTH AND vhost_id = ?", array($vhost_id));
78
+    $result = db_query("SELECT sum(mb_in+mb_out) as mb FROM vhosts.traffic where date > CURDATE() - INTERVAL 1 MONTH AND vhost_id = ?", [$vhost_id]);
79 79
     $data = $result->fetch();
80 80
     return $data['mb'];
81 81
 }
82 82
 
83 83
 function autoipv6_address($vhost_id, $mode = 1)
84 84
 {
85
-    $result = db_query("SELECT uid, v6_prefix FROM vhosts.v_vhost LEFT JOIN system.servers ON (servers.hostname = server) WHERE v_vhost.id=?", array($vhost_id));
85
+    $result = db_query("SELECT uid, v6_prefix FROM vhosts.v_vhost LEFT JOIN system.servers ON (servers.hostname = server) WHERE v_vhost.id=?", [$vhost_id]);
86 86
     $data = $result->fetch();
87 87
     if (!$data['v6_prefix']) {
88 88
         warning("IPv6-Adresse nicht verfügbar, Server unterstützt kein IPv6");
89 89
         return "";
90 90
     }
91
-    list($prefix, $null) = explode('/', $data['v6_prefix']);
91
+    [$prefix, $null] = explode('/', $data['v6_prefix']);
92 92
     $vh = ':1';
93 93
     if ($mode == 2) {
94 94
         $vh = implode(':', str_split(sprintf("%08x", $vhost_id), 4));
... ...
@@ -102,13 +102,13 @@ function list_vhosts($filter=null)
102 102
 {
103 103
     $uid = (int) $_SESSION['userinfo']['uid'];
104 104
     $query = "SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid=:uid ORDER BY domain,hostname";
105
-    $params = array(":uid" => $uid);
105
+    $params = [":uid" => $uid];
106 106
     if ($filter) {
107 107
         $query = "SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE (vh.fqdn LIKE :filter OR vh.id IN (SELECT vhost FROM vhosts.v_alias WHERE fqdn LIKE :filter)) AND uid=:uid ORDER BY hostname";
108 108
         $params[":filter"] = "%$filter%";
109 109
     }
110 110
     $result = db_query($query, $params);
111
-    $ret = array();
111
+    $ret = [];
112 112
     while ($item = $result->fetch()) {
113 113
         array_push($ret, $item);
114 114
     }
... ...
@@ -117,7 +117,7 @@ function list_vhosts($filter=null)
117 117
 
118 118
 function ipv6_possible($server)
119 119
 {
120
-    $args = array(":server" => $server);
120
+    $args = [":server" => $server];
121 121
     $result = db_query("SELECT v6_prefix FROM system.servers WHERE id=:server OR hostname=:server", $args);
122 122
     $line = $result->fetch();
123 123
     DEBUG("Server {$server} is v6-capable: ". ($line['v6_prefix'] != null));
... ...
@@ -175,7 +175,7 @@ function userdomain()
175 175
     if (config('user_vhosts_domain') === null) {
176 176
         return null;
177 177
     }
178
-    $result = db_query("SELECT id,name FROM vhosts.v_domains WHERE name=:dom", array(":dom" => config('user_vhosts_domain')));
178
+    $result = db_query("SELECT id,name FROM vhosts.v_domains WHERE name=:dom", [":dom" => config('user_vhosts_domain')]);
179 179
     $res = $result->fetch();
180 180
     return $res;
181 181
 }
... ...
@@ -226,7 +226,7 @@ function get_vhost_details($id)
226 226
     DEBUG("Lese #{$id}...");
227 227
     $id = (int) $id;
228 228
     $uid = (int) $_SESSION['userinfo']['uid'];
229
-    $result = db_query("SELECT vh.*,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid=:uid AND vh.id=:id", array(":uid" => $uid, ":id" => $id));
229
+    $result = db_query("SELECT vh.*,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid=:uid AND vh.id=:id", [":uid" => $uid, ":id" => $id]);
230 230
     if ($result->rowCount() != 1) {
231 231
         system_failure('Interner Fehler beim Auslesen der Daten');
232 232
     }
... ...
@@ -261,8 +261,8 @@ function get_vhost_details($id)
261 261
 
262 262
 function get_aliases($vhost)
263 263
 {
264
-    $result = db_query("SELECT id,fqdn,options FROM vhosts.v_alias WHERE vhost=?", array($vhost));
265
-    $ret = array();
264
+    $result = db_query("SELECT id,fqdn,options FROM vhosts.v_alias WHERE vhost=?", [$vhost]);
265
+    $ret = [];
266 266
     while ($item = $result->fetch()) {
267 267
         array_push($ret, $item);
268 268
     }
... ...
@@ -275,14 +275,14 @@ function get_all_aliases($vhost)
275 275
 {
276 276
     //$vhost = get_vhost_details( (int) $vhost );
277 277
     $aliases = get_aliases($vhost['id']);
278
-    $ret = array();
278
+    $ret = [];
279 279
     if (strstr($vhost['options'], 'aliaswww')) {
280
-        array_push($ret, array('id' => 'www', 'fqdn' => 'www.'.$vhost['fqdn'], 'options' => (strstr($vhost['options'], 'forwardwww') ? 'forward' : null)));
280
+        array_push($ret, ['id' => 'www', 'fqdn' => 'www.'.$vhost['fqdn'], 'options' => (strstr($vhost['options'], 'forwardwww') ? 'forward' : null)]);
281 281
     }
282 282
     foreach ($aliases as $item) {
283 283
         array_push($ret, $item);
284 284
         if (strstr($item['options'], 'aliaswww')) {
285
-            array_push($ret, array('id' => 'www_'.$item['id'], 'fqdn' => 'www.'.$item['fqdn'], 'options' => (strstr($item['options'], 'forward') ? 'forward' : null)));
285
+            array_push($ret, ['id' => 'www_'.$item['id'], 'fqdn' => 'www.'.$item['fqdn'], 'options' => (strstr($item['options'], 'forward') ? 'forward' : null)]);
286 286
         }
287 287
     }
288 288
     return $ret;
... ...
@@ -292,7 +292,7 @@ function get_all_aliases($vhost)
292 292
 function list_available_webapps()
293 293
 {
294 294
     $result = db_query("SELECT id,displayname FROM vhosts.global_webapps");
295
-    $ret = array();
295
+    $ret = [];
296 296
     while ($item = $result->fetch()) {
297 297
         array_push($ret, $item);
298 298
     }
... ...
@@ -308,7 +308,7 @@ function delete_vhost($id)
308 308
     }
309 309
     $vhost = get_vhost_details($id);
310 310
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Removing vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
311
-    db_query("DELETE FROM vhosts.vhost WHERE id=?", array($vhost['id']));
311
+    db_query("DELETE FROM vhosts.vhost WHERE id=?", [$vhost['id']]);
312 312
 }
313 313
 
314 314
 
... ...
@@ -320,8 +320,8 @@ function make_svn_vhost($id)
320 320
         system_failure("id == 0");
321 321
     }
322 322
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to SVN');
323
-    db_query("REPLACE INTO vhosts.dav (vhost, type) VALUES (?, 'svn')", array($id));
324
-    db_query("DELETE FROM vhosts.webapps WHERE vhost=?", array($id));
323
+    db_query("REPLACE INTO vhosts.dav (vhost, type) VALUES (?, 'svn')", [$id]);
324
+    db_query("DELETE FROM vhosts.webapps WHERE vhost=?", [$id]);
325 325
 }
326 326
 
327 327
 function make_dav_vhost($id)
... ...
@@ -331,8 +331,8 @@ function make_dav_vhost($id)
331 331
         system_failure("id == 0");
332 332
     }
333 333
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to WebDAV');
334
-    db_query("REPLACE INTO vhosts.dav (vhost, type, options) VALUES (?, 'dav', 'nouserfile')", array($id));
335
-    db_query("DELETE FROM vhosts.webapps WHERE vhost=?", array($id));
334
+    db_query("REPLACE INTO vhosts.dav (vhost, type, options) VALUES (?, 'dav', 'nouserfile')", [$id]);
335
+    db_query("DELETE FROM vhosts.webapps WHERE vhost=?", [$id]);
336 336
 }
337 337
 
338 338
 function make_regular_vhost($id)
... ...
@@ -342,8 +342,8 @@ function make_regular_vhost($id)
342 342
         system_failure("id == 0");
343 343
     }
344 344
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to regular');
345
-    db_query("DELETE FROM vhosts.dav WHERE vhost=?", array($id));
346
-    db_query("DELETE FROM vhosts.webapps WHERE vhost=?", array($id));
345
+    db_query("DELETE FROM vhosts.dav WHERE vhost=?", [$id]);
346
+    db_query("DELETE FROM vhosts.webapps WHERE vhost=?", [$id]);
347 347
 }
348 348
 
349 349
 
... ...
@@ -354,13 +354,13 @@ function make_webapp_vhost($id, $webapp)
354 354
     if ($id == 0) {
355 355
         system_failure("id == 0");
356 356
     }
357
-    $result = db_query("SELECT displayname FROM vhosts.global_webapps WHERE id=?", array($webapp));
357
+    $result = db_query("SELECT displayname FROM vhosts.global_webapps WHERE id=?", [$webapp]);
358 358
     if ($result->rowCount() == 0) {
359 359
         system_failure("webapp-id invalid");
360 360
     }
361 361
     $webapp_name = $result->fetch(PDO::FETCH_OBJ)->displayname;
362 362
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Setting up webapp '.$webapp_name.' on vhost #'.$id);
363
-    db_query("REPLACE INTO vhosts.webapps (vhost, webapp) VALUES (?, ?)", array($id, $webapp));
363
+    db_query("REPLACE INTO vhosts.webapps (vhost, webapp) VALUES (?, ?)", [$id, $webapp]);
364 364
     mail('webapps-setup@schokokeks.org', 'setup', 'setup');
365 365
 }
366 366
 
... ...
@@ -369,7 +369,7 @@ function check_hostname_collision($hostname, $domain)
369 369
 {
370 370
     $uid = (int) $_SESSION['userinfo']['uid'];
371 371
     # Neuer vhost => Prüfe Duplikat
372
-    $args = array(":hostname" => $hostname, ":domain" => $domain, ":uid" => $uid);
372
+    $args = [":hostname" => $hostname, ":domain" => $domain, ":uid" => $uid];
373 373
     $domaincheck = "domain=:domain";
374 374
     if ($domain == -1) {
375 375
         $userdomain = userdomain();
... ...
@@ -474,7 +474,7 @@ function save_vhost($vhost)
474 474
         $vhost['ssl'] = null;
475 475
     }
476 476
 
477
-    $args = array(":hostname" => ($hostname ? $hostname : null),
477
+    $args = [":hostname" => ($hostname ? $hostname : null),
478 478
                 ":domain" => $domain,
479 479
                 ":docroot" => ($vhost['docroot'] ? $vhost['docroot'] : null),
480 480
                 ":php" => $vhost['php'],
... ...
@@ -489,7 +489,7 @@ function save_vhost($vhost)
489 489
                 ":ipv4" => $ipv4,
490 490
                 ":autoipv6" => $autoipv6,
491 491
                 ":options" => $vhost['options'],
492
-                ":id" => $id);
492
+                ":id" => $id, ];
493 493
     if ($id != 0) {
494 494
         logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
495 495
         db_query("UPDATE vhosts.vhost SET hostname=:hostname, domain=:domain, docroot=:docroot, php=:php, cgi=:cgi, `ssl`=:ssl, hsts=:hsts, `suexec_user`=:suexec_user, `server`=:server, logtype=:logtype, errorlog=:errorlog, certid=:cert, ipv4=:ipv4, autoipv6=:autoipv6, options=:options WHERE id=:id", $args);
... ...
@@ -522,7 +522,7 @@ function get_alias_details($id)
522 522
 {
523 523
     $id = (int) $id;
524 524
     $uid = (int) $_SESSION['userinfo']['uid'];
525
-    $result = db_query("SELECT * FROM vhosts.v_alias WHERE id=?", array($id));
525
+    $result = db_query("SELECT * FROM vhosts.v_alias WHERE id=?", [$id]);
526 526
 
527 527
     if ($result->rowCount() != 1) {
528 528
         system_failure('Interner Fehler beim Auslesen der Alias-Daten');
... ...
@@ -547,7 +547,7 @@ function delete_alias($id)
547 547
     $alias = get_alias_details($id);
548 548
 
549 549
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'aliases', 'Removing alias #'.$id.' ('.$alias['hostname'].'.'.$alias['domain'].')');
550
-    db_query("DELETE FROM vhosts.alias WHERE id=?", array($id));
550
+    db_query("DELETE FROM vhosts.alias WHERE id=?", [$id]);
551 551
 }
552 552
 
553 553
 function save_alias($alias)
... ...
@@ -567,11 +567,11 @@ function save_alias($alias)
567 567
     if (! $alias['hostname']) {
568 568
         $alias['hostname'] = null;
569 569
     }
570
-    $args = array(":hostname" => $alias['hostname'],
570
+    $args = [":hostname" => $alias['hostname'],
571 571
                 ":domain" => $domain,
572 572
                 ":vhost" => $vhost['id'],
573 573
                 ":options" => $alias['options'],
574
-                ":id" => $id);
574
+                ":id" => $id, ];
575 575
     if ($id == 0) {
576 576
         unset($args[":id"]);
577 577
         logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'aliases', 'Creating alias '.$alias['hostname'].'.'.$alias['domain'].' for VHost '.$vhost['id']);
... ...
@@ -587,8 +587,8 @@ function save_alias($alias)
587 587
 function available_suexec_users()
588 588
 {
589 589
     $uid = (int) $_SESSION['userinfo']['uid'];
590
-    $result = db_query("SELECT uid, username FROM vhosts.available_users LEFT JOIN vhosts.v_useraccounts ON (uid = suexec_user) WHERE mainuser=?", array($uid));
591
-    $ret = array();
590
+    $result = db_query("SELECT uid, username FROM vhosts.available_users LEFT JOIN vhosts.v_useraccounts ON (uid = suexec_user) WHERE mainuser=?", [$uid]);
591
+    $ret = [];
592 592
     while ($i = $result->fetch()) {
593 593
         $ret[] = $i;
594 594
     }
... ...
@@ -601,8 +601,8 @@ function available_suexec_users()
601 601
 function user_ipaddrs()
602 602
 {
603 603
     $uid = (int) $_SESSION['userinfo']['uid'];
604
-    $result = db_query("SELECT ipaddr FROM vhosts.ipaddr_available WHERE uid=?", array($uid));
605
-    $ret = array();
604
+    $result = db_query("SELECT ipaddr FROM vhosts.ipaddr_available WHERE uid=?", [$uid]);
605
+    $ret = [];
606 606
     while ($i = $result->fetch()) {
607 607
         $ret[] = $i['ipaddr'];
608 608
     }
... ...
@@ -19,9 +19,9 @@ require_once('include/certs.php');
19 19
 $role = $_SESSION['role'];
20 20
 
21 21
 if ($role & ROLE_SYSTEMUSER) {
22
-    $menu["vhosts_vhosts"] = array("label" => "Websites", "file" => "vhosts", "weight" => 2);
22
+    $menu["vhosts_vhosts"] = ["label" => "Websites", "file" => "vhosts", "weight" => 2];
23 23
 
24 24
     if (user_has_manual_certs() or ($section == 'vhosts_certs')) {
25
-        $menu["vhosts_certs"] = array("label" => "TLS-Zertifikate", "file" => "certs", "weight" => 10, "submenu" => "vhosts_vhosts");
25
+        $menu["vhosts_certs"] = ["label" => "TLS-Zertifikate", "file" => "certs", "weight" => 10, "submenu" => "vhosts_vhosts"];
26 26
     }
27 27
 }
... ...
@@ -33,7 +33,7 @@ günstige CAs) würde diese Zusatzinformationen sowieso aus dem Zertifikat entfe
33 33
 Einstellungen stehen Ihnen die OpenSSL-Programme in Ihrem Benutzeraccount zur Verfügung.</p>
34 34
 ");
35 35
 
36
-$bitselect = array(2048 => 2048, 4096 => 4096);
36
+$bitselect = [2048 => 2048, 4096 => 4096];
37 37
 
38 38
 $form = '<p><label for="commonname">Domain-/Hostname:</label> <input type="text" name="commonname" id="commonname" /> (Mehrere Hostnames ggf. mit Komma trennen.)</p>
39 39
 <p><label for="bitlength">Bitlänge:</label> '.html_select('bitlength', $bitselect, 2048).'</p>
... ...
@@ -167,7 +167,7 @@ if ($_GET['action'] == 'edit') {
167 167
 
168 168
     $cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : null);
169 169
 
170
-    $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : null);
170
+    $ipv4 = ($_POST['ipv4'] ?? null);
171 171
 
172 172
     if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes') {
173 173
         $vhost['autoipv6'] = 1;
... ...
@@ -200,11 +200,11 @@ if ($_GET['action'] == 'edit') {
200 200
 
201 201
     $old_options = explode(',', $vhost['options']);
202 202
     if ($vhost['options'] == '') {
203
-        $old_options = array();
203
+        $old_options = [];
204 204
     }
205
-    $new_options = array();
205
+    $new_options = [];
206 206
     foreach ($old_options as $op) {
207
-        if (! in_array($op, array('aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'))) {
207
+        if (! in_array($op, ['aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'])) {
208 208
             array_push($new_options, $op);
209 209
         }
210 210
     }
... ...
@@ -302,7 +302,7 @@ if ($_GET['action'] == 'edit') {
302 302
     }
303 303
 
304 304
     if (! is_array($_POST['options'])) {
305
-        $_POST['options'] = array();
305
+        $_POST['options'] = [];
306 306
     }
307 307
     $aliaswww = in_array('aliaswww', $_POST['options']);
308 308
     $forward = in_array('forward', $_POST['options']);
... ...
@@ -313,7 +313,7 @@ if ($_GET['action'] == 'edit') {
313 313
         verify_input_hostname_utf8("www.".$fqdn);
314 314
     }
315 315
 
316
-    $new_options = array();
316
+    $new_options = [];
317 317
     if ($aliaswww) {
318 318
         array_push($new_options, 'aliaswww');
319 319
     }
... ...
@@ -15,12 +15,12 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
18
-    $shortcuts[] = array( 'section' => 'Webserver',
18
+    $shortcuts[] = [ 'section' => 'Webserver',
19 19
                         'weight'  => 30,
20 20
                         'file'    => 'vhosts',
21 21
                         'icon'    => 'webserver.png',
22 22
                         'title'   => 'Websites verwalten',
23
-                        'alert'   => null );
23
+                        'alert'   => null, ];
24 24
 }
25 25
 if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
26 26
     $alert = '';
... ...
@@ -47,11 +47,11 @@ if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
47 47
     }
48 48
 
49 49
     if ($alert) {
50
-        $shortcuts[] = array( 'section' => 'Webserver',
50
+        $shortcuts[] = [ 'section' => 'Webserver',
51 51
                           'weight'  => 80,
52 52
                           'file'    => 'certs',
53 53
                           'icon'    => 'key.png',
54 54
                           'title'   => 'HTTPS-Zertifikate',
55
-                          'alert'   => $alert );
55
+                          'alert'   => $alert, ];
56 56
     }
57 57
 }
... ...
@@ -19,21 +19,21 @@ require_once('session/start.php');
19 19
 require_once('freewvs.php');
20 20
 require_once('webapp-installer.php');
21 21
 
22
-require_role(array(ROLE_SYSTEMUSER));
22
+require_role([ROLE_SYSTEMUSER]);
23 23
 
24 24
 title("Prüfung Ihrer Web-Anwendungen");
25 25
 
26 26
 $uid = (int) $_SESSION['userinfo']['uid'];
27 27
 
28
-if (isset($_POST['freq']) && in_array($_POST['freq'], array("day","week","month"))) {
28
+if (isset($_POST['freq']) && in_array($_POST['freq'], ["day","week","month"])) {
29 29
     check_form_token('freewvs_freq');
30
-    $args = array(":uid" => $uid, ":freq" => $_POST['freq']);
30
+    $args = [":uid" => $uid, ":freq" => $_POST['freq']];
31 31
     db_query("REPLACE INTO qatools.freewvs (user,freq) VALUES (:uid,:freq)", $args);
32 32
     header("Location: freewvs");
33 33
     die();
34 34
 }
35 35
 
36
-$result = db_query("SELECT freq FROM qatools.v_freewvs WHERE uid=?", array($uid));
36
+$result = db_query("SELECT freq FROM qatools.v_freewvs WHERE uid=?", [$uid]);
37 37
 $result=$result->fetch();
38 38
 $freq=$result['freq'];
39 39
 
... ...
@@ -41,7 +41,7 @@ headline('Überprüfung Ihrer Web-Anwendungen auf Sicherheitslücken');
41 41
 
42 42
 output('<p>Bei '.config('company_name').' werden die von Ihnen installierten Web-Anwendungen (z.B. Blog-Software, Content-Management-Systeme, ...) regelmäßig automatisch auf bekannte Sicherheitsprobleme untersucht. Sie erhalten jeweils umgehend eine Nachricht, wenn wir gefährdete Anwendungen finden. Zudem werden wir Sie regelmäßig an bestehende Sicherheitslücken erinnern.</p>
43 43
 <p><strong>Wie häufig möchten Sie an bestehende Sicherheitsprobleme erinnert werden?</strong></p>
44
-'.html_form('freewvs_freq', 'freewvs', '', '<p>'.html_select('freq', array('day' => 'täglich', 'week' => 'einmal pro Woche', 'month' => 'einmal pro Monat'), $freq).' &#160; <input type="submit" value="speichern" /></p>'));
44
+'.html_form('freewvs_freq', 'freewvs', '', '<p>'.html_select('freq', ['day' => 'täglich', 'week' => 'einmal pro Woche', 'month' => 'einmal pro Monat'], $freq).' &#160; <input type="submit" value="speichern" /></p>'));
45 45
 
46 46
 $results = load_results();
47 47
 
... ...
@@ -20,8 +20,8 @@ require_once('inc/base.php');
20 20
 function load_results()
21 21
 {
22 22
     $uid = (int) $_SESSION['userinfo']['uid'];
23
-    $result = db_query("SELECT directory, docroot, first_seen, last_seen, first_warned, last_warned, appname, version, state, safeversion, vulninfo FROM qatools.detected_webapps WHERE uid=?", array($uid));
24
-    $ret = array();
23
+    $result = db_query("SELECT directory, docroot, first_seen, last_seen, first_warned, last_warned, appname, version, state, safeversion, vulninfo FROM qatools.detected_webapps WHERE uid=?", [$uid]);
24
+    $ret = [];
25 25
     while ($line = $result->fetch()) {
26 26
         array_push($ret, $line);
27 27
     }
... ...
@@ -30,7 +30,7 @@ function load_results()
30 30
 
31 31
 function get_upgradeinstructions($appname)
32 32
 {
33
-    $result = db_query("SELECT url FROM qatools.freewvs_upgradeinstructions WHERE appname=?", array($appname));
33
+    $result = db_query("SELECT url FROM qatools.freewvs_upgradeinstructions WHERE appname=?", [$appname]);
34 34
     if ($result->rowCount() > 0) {
35 35
         $tmp = $result->fetch();
36 36
         return $tmp[0];
... ...
@@ -23,7 +23,7 @@ function validate_data($post)
23 23
 {
24 24
     DEBUG('Validating Data:');
25 25
     DEBUG($post);
26
-    $fields = array('adminuser', 'adminpassword', 'adminemail', 'sitename', 'siteemail');
26
+    $fields = ['adminuser', 'adminpassword', 'adminemail', 'sitename', 'siteemail'];
27 27
     foreach ($fields as $field) {
28 28
         if ((! isset($post[$field])) || $post[$field] == '') {
29 29
             system_failure('Nicht alle Werte angegeben ('.$field.')');
... ...
@@ -23,7 +23,7 @@ function validate_data($post)
23 23
 {
24 24
     DEBUG('Validating Data:');
25 25
     DEBUG($post);
26
-    $fields = array('adminuser', 'adminpassword', 'adminemail', 'sitename', 'siteemail');
26
+    $fields = ['adminuser', 'adminpassword', 'adminemail', 'sitename', 'siteemail'];
27 27
     foreach ($fields as $field) {
28 28
         if ((! isset($post[$field])) || $post[$field] == '') {
29 29
             system_failure('Nicht alle Werte angegeben ('.$field.')');
... ...
@@ -23,7 +23,7 @@ function validate_data($post)
23 23
 {
24 24
     DEBUG('Validating Data:');
25 25
     DEBUG($post);
26
-    $fields = array('adminuser', 'adminpassword', 'adminemail', 'wikiname');
26
+    $fields = ['adminuser', 'adminpassword', 'adminemail', 'wikiname'];
27 27
     foreach ($fields as $field) {
28 28
         if ((! isset($post[$field])) || $post[$field] == '') {
29 29
             system_failure('Nicht alle Werte angegeben ('.$field.')');
... ...
@@ -21,11 +21,11 @@ function create_new_webapp($appname, $directory, $url, $data)
21 21
     if (directory_in_use($directory)) {
22 22
         system_failure('Sie haben erst kürzlich eine Anwendung in diesem Verzeichnis installieren lassen. Aus Sicherheitsgründen können Sie in diesem Verzeichnis am selben Tag nicht schon wieder eine Anwendung installieren.');
23 23
     }
24
-    $args = array(":username" => $_SESSION['userinfo']['username'],
24
+    $args = [":username" => $_SESSION['userinfo']['username'],
25 25
                 ":appname" => $appname,
26 26
                 ":dir" => $directory,
27 27
                 ":url" => $url,
28
-                ":data" => $data);
28
+                ":data" => $data, ];
29 29
     db_query("INSERT INTO vhosts.webapp_installer (appname, directory, url, state, username, data) VALUES (:appname, :dir, :url, 'new', :username, :data)", $args);
30 30
 }
31 31
 
... ...
@@ -35,16 +35,16 @@ function request_update($appname, $directory, $url)
35 35
     if (directory_in_use($directory)) {
36 36
         system_failure('Sie haben erst kürzlich eine Anwendung in diesem Verzeichnis installieren lassen oder ein Update in diesem Verzeichnis angefordert. Bitte warten Sie bis diese Aktion durchgeführt wurde.');
37 37
     }
38
-    $args = array(":username" => $_SESSION['userinfo']['username'],
38
+    $args = [":username" => $_SESSION['userinfo']['username'],
39 39
                 ":appname" => $appname,
40 40
                 ":dir" => $directory,
41
-                ":url" => $url);
41
+                ":url" => $url, ];
42 42
     db_query("INSERT INTO vhosts.webapp_installer (appname, directory, url, state, username) VALUES (:appname, :dir, :url, 'old', :username)", $args);
43 43
 }
44 44
 
45 45
 function directory_in_use($directory)
46 46
 {
47
-    $result = db_query("SELECT id FROM vhosts.webapp_installer WHERE (state IN ('new','old') OR DATE(lastchange)=CURDATE()) AND directory=?", array($directory));
47
+    $result = db_query("SELECT id FROM vhosts.webapp_installer WHERE (state IN ('new','old') OR DATE(lastchange)=CURDATE()) AND directory=?", [$directory]);
48 48
     if ($result->rowCount() > 0) {
49 49
         return true;
50 50
     }
... ...
@@ -85,7 +85,7 @@ function get_url_for_dir($docroot, $cutoff = '')
85 85
     if (substr($docroot, -1) == '/') {
86 86
         $docroot = substr($docroot, 0, -1);
87 87
     }
88
-    $result = db_query("SELECT `ssl`, IF(FIND_IN_SET('aliaswww', options), CONCAT('www.',fqdn), fqdn) AS fqdn FROM vhosts.v_vhost WHERE docroot IN (?, ?)", array($docroot, $docroot.'/'));
88
+    $result = db_query("SELECT `ssl`, IF(FIND_IN_SET('aliaswww', options), CONCAT('www.',fqdn), fqdn) AS fqdn FROM vhosts.v_vhost WHERE docroot IN (?, ?)", [$docroot, $docroot.'/']);
89 89
     if ($result->rowCount() < 1) {
90 90
         if (!strstr($docroot, '/')) {
91 91
             return null;
... ...
@@ -119,7 +119,7 @@ function create_webapp_mysqldb($application, $sitename)
119 119
         set_mysql_access($handle, $handle, true);
120 120
         $password = random_string(10);
121 121
         set_mysql_password($handle, $password);
122
-        return array('dbuser' => $handle, 'dbname' => $handle, 'dbpass' => $password);
122
+        return ['dbuser' => $handle, 'dbname' => $handle, 'dbpass' => $password];
123 123
     }
124 124
 
125 125
     for ($i = 0; $i < 100 ; $i++) {
... ...
@@ -131,7 +131,7 @@ function create_webapp_mysqldb($application, $sitename)
131 131
             set_mysql_access($handle, $handle, true);
132 132
             $password = random_string(10);
133 133
             set_mysql_password($handle, $password);
134
-            return array('dbuser' => $handle, 'dbname' => $handle, 'dbpass' => $password);
134
+            return ['dbuser' => $handle, 'dbname' => $handle, 'dbpass' => $password];
135 135
         }
136 136
     }
137 137
     system_failure('Konnte keine Datenbank erzeugen. Bitte melden Sie diesen Umstand den Administratoren!');
... ...
@@ -70,7 +70,7 @@ $form .= "
70 70
 
71 71
 $vhosts = list_vhosts();
72 72
 
73
-$options = array();
73
+$options = [];
74 74
 foreach ($vhosts as $vhost) {
75 75
     $options[$vhost['docroot']] = $vhost['fqdn'];
76 76
 }
... ...
@@ -17,6 +17,6 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & ROLE_SYSTEMUSER) {
20
-    $menu["webapps_freewvs"] = array("label" => "Anwendungen", "file" => "freewvs", "weight" => 1, "submenu" => "vhosts_vhosts");
20
+    $menu["webapps_freewvs"] = ["label" => "Anwendungen", "file" => "freewvs", "weight" => 1, "submenu" => "vhosts_vhosts"];
21 21
     #$menu["webapps_install"] = array("label" => "Anwendung installieren", "file" => "install", "weight" => 1, "submenu" => "vhosts_vhosts");
22 22
 }
... ...
@@ -39,7 +39,7 @@ if ($_POST['target'] == 'new') {
39 39
     DEBUG('Domain: '.$domainid.' / '.$domainname);
40 40
 
41 41
     if (! isset($_POST['options']) || ! is_array($_POST['options'])) {
42
-        $_POST['options'] = array();
42
+        $_POST['options'] = [];
43 43
     }
44 44
     $aliaswww = in_array('aliaswww', $_POST['options']);
45 45
 
... ...
@@ -80,7 +80,7 @@ if ($_POST['target'] == 'new') {
80 80
     DEBUG("Logging: {$logtype}");
81 81
 
82 82
     $old_options = explode(',', $vhost['options']);
83
-    $new_options = array();
83
+    $new_options = [];
84 84
     foreach ($old_options as $op) {
85 85
         if ($op != 'aliaswww') {
86 86
             array_push($new_options, $op);
... ...
@@ -26,11 +26,11 @@ if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
26 26
         }
27 27
     }
28 28
     if ($found > 0) {
29
-        $shortcuts[] = array( 'section' => 'Webserver',
29
+        $shortcuts[] = [ 'section' => 'Webserver',
30 30
                           'weight'  => 40,
31 31
                           'file'    => 'freewvs',
32 32
                           'icon'    => 'warning.png',
33 33
                           'title'   => 'Web-Anwendungen',
34
-                          'alert'   => "{$found} unsicher" );
34
+                          'alert'   => "{$found} unsicher", ];
35 35
     }
36 36
 }
... ...
@@ -15,7 +15,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('totp.php');
18
-require_role(array(ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT));
18
+require_role([ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT]);
19 19
 
20 20
 title("Zwei-Faktor-Anmeldung am Webmailer");
21 21
 
... ...
@@ -15,7 +15,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('inc/base.php');
18
-require_role(array(ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT));
18
+require_role([ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT]);
19 19
 
20 20
 require_once('totp.php');
21 21
 
... ...
@@ -15,7 +15,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('inc/base.php');
18
-require_role(array(ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT));
18
+require_role([ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT]);
19 19
 
20 20
 require_once('totp.php');
21 21
 
... ...
@@ -18,7 +18,7 @@ require_once('vendor/autoload.php');
18 18
 
19 19
 function account_has_totp($username)
20 20
 {
21
-    $result = db_query("SELECT id FROM mail.webmail_totp WHERE email=?", array($username));
21
+    $result = db_query("SELECT id FROM mail.webmail_totp WHERE email=?", [$username]);
22 22
     if ($result->rowCount() > 0) {
23 23
         $tmp = $result->fetch();
24 24
         $id = $tmp['id'];
... ...
@@ -63,10 +63,10 @@ function store_webmail_password($username, $oldpw, $newpw)
63 63
     for ($i = 0 ; $i != strlen($oldpw) ; $i++) {
64 64
         $code .= chr(ord($oldpw[$i]) ^ ord($secret[$i]));
65 65
     }
66
-    DEBUG(array($oldpw, $newpw));
67
-    $args = array(":uid" => $_SESSION['userinfo']['uid'],
66
+    DEBUG([$oldpw, $newpw]);
67
+    $args = [":uid" => $_SESSION['userinfo']['uid'],
68 68
                 ":username" => $username,
69
-                ":code" => base64_encode($code));
69
+                ":code" => base64_encode($code), ];
70 70
 
71 71
     db_query("REPLACE INTO mail.webmail_totp (useraccount, email, webmailpass) VALUES (:uid, :username, :code)", $args);
72 72
 }
... ...
@@ -93,7 +93,7 @@ function decode_webmail_password($crypted, $webmailpw)
93 93
 
94 94
 function get_imap_password($username, $webmailpass)
95 95
 {
96
-    $result = db_query("SELECT webmailpass FROM mail.webmail_totp WHERE email=?", array($username));
96
+    $result = db_query("SELECT webmailpass FROM mail.webmail_totp WHERE email=?", [$username]);
97 97
     $tmp = $result->fetch();
98 98
 
99 99
     $crypted = $tmp['webmailpass'];
... ...
@@ -117,14 +117,14 @@ function generate_secret($username)
117 117
     $secret = $ga->createSecret();
118 118
     DEBUG('GA-Secret: '.$secret);
119 119
     DEBUG('QrCode: '.$ga->getQRCodeGoogleUrl('Blog', $secret));
120
-    $args = array(":secret" => $secret, ":username" => $username);
120
+    $args = [":secret" => $secret, ":username" => $username];
121 121
     db_query("UPDATE mail.webmail_totp SET totp_secret=:secret WHERE email=:username", $args);
122 122
     return $secret;
123 123
 }
124 124
 
125 125
 function check_locked($username)
126 126
 {
127
-    $result = db_query("SELECT 1 FROM mail.webmail_totp WHERE unlock_timestamp IS NOT NULL and unlock_timestamp > NOW() AND email=?", array($username));
127
+    $result = db_query("SELECT 1 FROM mail.webmail_totp WHERE unlock_timestamp IS NOT NULL and unlock_timestamp > NOW() AND email=?", [$username]);
128 128
     return ($result->rowCount() > 0);
129 129
 }
130 130
 
... ...
@@ -135,7 +135,7 @@ function check_totp($username, $code)
135 135
         return false;
136 136
     }
137 137
 
138
-    $result = db_query("SELECT totp_secret, failures FROM mail.webmail_totp WHERE email=? AND (unlock_timestamp IS NULL OR unlock_timestamp <= NOW())", array($username));
138
+    $result = db_query("SELECT totp_secret, failures FROM mail.webmail_totp WHERE email=? AND (unlock_timestamp IS NULL OR unlock_timestamp <= NOW())", [$username]);
139 139
     $tmp = $result->fetch();
140 140
     $secret = $tmp['totp_secret'];
141 141
 
... ...
@@ -143,14 +143,14 @@ function check_totp($username, $code)
143 143
 
144 144
     $checkResult = $ga->verifyCode($secret, $code, 2);    // 2 = 2*30sec clock tolerance
145 145
     if ($checkResult) {
146
-        db_query("UPDATE mail.webmail_totp SET failures = 0, unlock_timestamp=NULL WHERE email=?", array($username));
146
+        db_query("UPDATE mail.webmail_totp SET failures = 0, unlock_timestamp=NULL WHERE email=?", [$username]);
147 147
         blacklist_token($username, $code);
148 148
         DEBUG('OK');
149 149
     } else {
150 150
         if ($tmp['failures'] > 0 && $tmp['failures'] % 5 == 0) {
151
-            db_query("UPDATE mail.webmail_totp SET failures = failures+1, unlock_timestamp = NOW() + INTERVAL 5 MINUTE WHERE email=?", array($username));
151
+            db_query("UPDATE mail.webmail_totp SET failures = failures+1, unlock_timestamp = NOW() + INTERVAL 5 MINUTE WHERE email=?", [$username]);
152 152
         } else {
153
-            db_query("UPDATE mail.webmail_totp SET failures = failures+1 WHERE email=?", array($username));
153
+            db_query("UPDATE mail.webmail_totp SET failures = failures+1 WHERE email=?", [$username]);
154 154
         }
155 155
 
156 156
         DEBUG('FAILED');
... ...
@@ -162,11 +162,11 @@ function generate_qrcode_image($secret)
162 162
 {
163 163
     $url = 'otpauth://totp/Webmail?secret='.$secret;
164 164
 
165
-    $descriptorspec = array(
166
-    0 => array("pipe", "r"),  // STDIN ist eine Pipe, von der das Child liest
167
-    1 => array("pipe", "w"),  // STDOUT ist eine Pipe, in die das Child schreibt
168
-    2 => array("pipe", "w")
169
-  );
165
+    $descriptorspec = [
166
+    0 => ["pipe", "r"],  // STDIN ist eine Pipe, von der das Child liest
167
+    1 => ["pipe", "w"],  // STDOUT ist eine Pipe, in die das Child schreibt
168
+    2 => ["pipe", "w"],
169
+  ];
170 170
 
171 171
     $process = proc_open('qrencode -t PNG -s 5 -o -', $descriptorspec, $pipes);
172 172
 
... ...
@@ -193,8 +193,8 @@ function generate_qrcode_image($secret)
193 193
 
194 194
 function accountname($id)
195 195
 {
196
-    $args = array(":id" => $id,
197
-                ":uid" => $_SESSION['userinfo']['uid']);
196
+    $args = [":id" => $id,
197
+                ":uid" => $_SESSION['userinfo']['uid'], ];
198 198
     $result = db_query("SELECT email FROM mail.webmail_totp WHERE id=:id AND useraccount=:uid", $args);
199 199
     if ($tmp = $result->fetch()) {
200 200
         return $tmp['email'];
... ...
@@ -204,8 +204,8 @@ function accountname($id)
204 204
 
205 205
 function delete_totp($id)
206 206
 {
207
-    $args = array(":id" => $id,
208
-                ":uid" => $_SESSION['userinfo']['uid']);
207
+    $args = [":id" => $id,
208
+                ":uid" => $_SESSION['userinfo']['uid'], ];
209 209
 
210 210
     db_query("DELETE FROM mail.webmail_totp WHERE id=:id AND useraccount=:uid", $args);
211 211
 }
... ...
@@ -213,13 +213,13 @@ function delete_totp($id)
213 213
 
214 214
 function blacklist_token($email, $token)
215 215
 {
216
-    $args = array(":email" => $email, ":token" => $token);
216
+    $args = [":email" => $email, ":token" => $token];
217 217
     db_query("INSERT INTO mail.webmail_totp_blacklist (timestamp, email, token) VALUES (NOW(), :email, :token)", $args);
218 218
 }
219 219
 
220 220
 function check_blacklist($email, $token)
221 221
 {
222
-    $args = array(":email" => $email, ":token" => $token);
222
+    $args = [":email" => $email, ":token" => $token];
223 223
     db_query("DELETE FROM mail.webmail_totp_blacklist WHERE timestamp < NOW() - INTERVAL 10 MINUTE");
224 224
     $result = db_query("SELECT id FROM mail.webmail_totp_blacklist WHERE email=:email AND token=:token", $args);
225 225
     return ($result->rowCount() > 0);
... ...
@@ -17,7 +17,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 $role = $_SESSION['role'];
18 18
 
19 19
 if ($role & (ROLE_MAILACCOUNT | ROLE_VMAIL_ACCOUNT)) {
20
-    $menu["webmailtotp_account"] = array("label" => "Zwei-Faktor-Anmeldung", "file" => "account", "weight" => 5);
20
+    $menu["webmailtotp_account"] = ["label" => "Zwei-Faktor-Anmeldung", "file" => "account", "weight" => 5];
21 21
 } elseif ($role & ROLE_SYSTEMUSER) {
22
-    $menu["webmailtotp_overview"] = array("label" => "Zwei-Faktor-Anmeldung", "file" => "overview", "weight" => 5, "submenu" => "email_vmail" );
22
+    $menu["webmailtotp_overview"] = ["label" => "Zwei-Faktor-Anmeldung", "file" => "overview", "weight" => 5, "submenu" => "email_vmail" ];
23 23
 }
... ...
@@ -39,7 +39,7 @@ if (! (user_has_accounts() || count(get_vmail_accounts())>0)) {
39 39
     $domains = get_vmail_domains();
40 40
     $vmail_accounts = get_vmail_accounts();
41 41
 
42
-    $sorted_by_domains = array();
42
+    $sorted_by_domains = [];
43 43
     foreach ($vmail_accounts as $account) {
44 44
         if ($account['password'] == '') {
45 45
             continue;
... ...
@@ -47,7 +47,7 @@ if (! (user_has_accounts() || count(get_vmail_accounts())>0)) {
47 47
         if (array_key_exists($account['domain'], $sorted_by_domains)) {
48 48
             array_push($sorted_by_domains[$account['domain']], $account);
49 49
         } else {
50
-            $sorted_by_domains[$account['domain']] = array($account);
50
+            $sorted_by_domains[$account['domain']] = [$account];
51 51
         }
52 52
     }
53 53
 
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('inc/base.php');
18 18
 require_once('inc/security.php');
19
-require_role(array(ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT));
19
+require_role([ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT]);
20 20
 
21 21
 $username = urldecode($_REQUEST['username']);
22 22
 
... ...
@@ -16,7 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('inc/base.php');
18 18
 require_once('inc/icons.php');
19
-require_role(array(ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT));
19
+require_role([ROLE_SYSTEMUSER, ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT]);
20 20
 
21 21
 require_once('totp.php');
22 22
 
... ...
@@ -46,7 +46,7 @@ function find_role($login, $password, $i_am_admin = false)
46 46
     if ($uid == 0) {
47 47
         $uid = null;
48 48
     }
49
-    $result = db_query("SELECT username, passwort AS password, kundenaccount AS `primary`, status, ((SELECT acc.uid FROM system.v_useraccounts AS acc LEFT JOIN system.gruppenzugehoerigkeit USING (uid) LEFT JOIN system.gruppen AS g ON (g.gid=gruppenzugehoerigkeit.gid) WHERE g.name='admin' AND acc.uid=u.uid) IS NOT NULL) AS admin FROM system.v_useraccounts AS u LEFT JOIN system.passwoerter USING(uid) WHERE u.uid=:uid OR username=:login LIMIT 1;", array(":uid" => $uid, ":login" => $login));
49
+    $result = db_query("SELECT username, passwort AS password, kundenaccount AS `primary`, status, ((SELECT acc.uid FROM system.v_useraccounts AS acc LEFT JOIN system.gruppenzugehoerigkeit USING (uid) LEFT JOIN system.gruppen AS g ON (g.gid=gruppenzugehoerigkeit.gid) WHERE g.name='admin' AND acc.uid=u.uid) IS NOT NULL) AS admin FROM system.v_useraccounts AS u LEFT JOIN system.passwoerter USING(uid) WHERE u.uid=:uid OR username=:login LIMIT 1;", [":uid" => $uid, ":login" => $login]);
50 50
     if (@$result->rowCount() > 0) {
51 51
         $entry = $result->fetch(PDO::FETCH_OBJ);
52 52
         if (strcasecmp($entry->username, $login) == 0 && $entry->username != $login) {
... ...
@@ -76,9 +76,9 @@ function find_role($login, $password, $i_am_admin = false)
76 76
     // Customer?
77 77
     $customerno = (int) $login;
78 78
     $pass = sha1($password);
79
-    $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=:customerno AND passwort=:pass", array(":customerno" => $customerno, ":pass" => $pass));
79
+    $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=:customerno AND passwort=:pass", [":customerno" => $customerno, ":pass" => $pass]);
80 80
     if ($i_am_admin) {
81
-        $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=?", array($customerno));
81
+        $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=?", [$customerno]);
82 82
     }
83 83
     if (@$result->rowCount() > 0) {
84 84
         return ROLE_CUSTOMER;
... ...
@@ -86,7 +86,7 @@ function find_role($login, $password, $i_am_admin = false)
86 86
 
87 87
     // Sub-User
88 88
 
89
-    $result = db_query("SELECT password FROM system.subusers WHERE username=?", array($login));
89
+    $result = db_query("SELECT password FROM system.subusers WHERE username=?", [$login]);
90 90
     if (@$result->rowCount() > 0) {
91 91
         $entry = $result->fetch(PDO::FETCH_OBJ);
92 92
         $db_password = $entry->password;
... ...
@@ -117,7 +117,7 @@ function find_role($login, $password, $i_am_admin = false)
117 117
             }
118 118
         }
119 119
     }
120
-    $result = db_query("SELECT cryptpass FROM mail.courier_mailaccounts WHERE account=?", array($account));
120
+    $result = db_query("SELECT cryptpass FROM mail.courier_mailaccounts WHERE account=?", [$account]);
121 121
     if (@$result->rowCount() > 0) {
122 122
         $entry = $result->fetch(PDO::FETCH_OBJ);
123 123
         $db_password = $entry->cryptpass;
... ...
@@ -131,7 +131,7 @@ function find_role($login, $password, $i_am_admin = false)
131 131
 
132 132
     // virtueller Mail-Account
133 133
     $account = $login;
134
-    $result = db_query("SELECT cryptpass FROM mail.courier_virtual_accounts WHERE account=?", array($account));
134
+    $result = db_query("SELECT cryptpass FROM mail.courier_virtual_accounts WHERE account=?", [$account]);
135 135
     if (@$result->rowCount() > 0) {
136 136
         $entry = $result->fetch(PDO::FETCH_OBJ);
137 137
         $db_password = $entry->cryptpass;
... ...
@@ -153,9 +153,9 @@ function is_locked()
153 153
 {
154 154
     $result = null;
155 155
     if (isset($_SESSION['customerinfo']['customerno'])) {
156
-        $result = db_query("SELECT gesperrt FROM kundendaten.kunden WHERE id=?", array($_SESSION['customerinfo']['customerno']));
156
+        $result = db_query("SELECT gesperrt FROM kundendaten.kunden WHERE id=?", [$_SESSION['customerinfo']['customerno']]);
157 157
     } elseif (isset($_SESSION['userinfo']['uid'])) {
158
-        $result = db_query("SELECT (SELECT gesperrt FROM kundendaten.kunden WHERE id=useraccounts.kunde) AS gesperrt FROM system.useraccounts WHERE uid=?", array($_SESSION['userinfo']['uid']));
158
+        $result = db_query("SELECT (SELECT gesperrt FROM kundendaten.kunden WHERE id=useraccounts.kunde) AS gesperrt FROM system.useraccounts WHERE uid=?", [$_SESSION['userinfo']['uid']]);
159 159
     }
160 160
     if ($result) {
161 161
         $line = $result->fetch();
... ...
@@ -170,17 +170,17 @@ function is_locked()
170 170
 function get_customer_info($customer)
171 171
 {
172 172
     if (! $_SESSION['role'] & ROLE_CUSTOMER) {
173
-        return array();
173
+        return [];
174 174
     }
175
-    $ret = array();
175
+    $ret = [];
176 176
     $customerno = (int) $customer;
177 177
     if ($customerno != 0) {
178 178
         DEBUG('Looking up customerinfo for customer no. '.$customerno);
179
-        $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden WHERE id=?", array($customerno));
179
+        $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden WHERE id=?", [$customerno]);
180 180
     } else {
181 181
         $username = $customer;
182 182
         DEBUG('looking up customer info for username '.$username);
183
-        $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden AS k JOIN system.v_useraccounts AS u ON (u.kunde=k.id) WHERE u.username=?", array($username));
183
+        $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden AS k JOIN system.v_useraccounts AS u ON (u.kunde=k.id) WHERE u.username=?", [$username]);
184 184
     }
185 185
     if (@$result->rowCount() == 0) {
186 186
         system_failure("Konnte Kundendaten nicht auslesen!");
... ...
@@ -199,7 +199,7 @@ function get_customer_info($customer)
199 199
 
200 200
 function get_subuser_info($username)
201 201
 {
202
-    $result = db_query("SELECT uid, modules FROM system.subusers WHERE username=?", array($username));
202
+    $result = db_query("SELECT uid, modules FROM system.subusers WHERE username=?", [$username]);
203 203
     if ($result->rowCount() < 1) {
204 204
         logger(LOG_ERR, "session/checkuser", "login", "error reading subuser's data: »{$username}«");
205 205
         system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
... ...
@@ -214,48 +214,48 @@ function get_subuser_info($username)
214 214
 function get_user_info($username)
215 215
 {
216 216
     $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name, server
217
-                      FROM system.v_useraccounts WHERE username=:username OR uid=:username", array(":username" => $username));
217
+                      FROM system.v_useraccounts WHERE username=:username OR uid=:username", [":username" => $username]);
218 218
     if ($result->rowCount() < 1) {
219 219
         logger(LOG_ERR, "session/checkuser", "login", "error reading user's data: »{$username}«");
220 220
         system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
221 221
     }
222 222
     $val = @$result->fetch(PDO::FETCH_OBJ);
223
-    return array(
223
+    return [
224 224
           'username'      => $val->username,
225 225
           'customerno'    => $val->customerno,
226 226
           'uid'           => $val->uid,
227 227
           'homedir'       => $val->homedir,
228 228
           'server'        => $val->server,
229 229
           'name'          => $val->name,
230
-          );
230
+          ];
231 231
 }
232 232
 
233 233
 function set_customer_verified($customerno)
234 234
 {
235 235
     $customerno = (int) $customerno;
236
-    db_query("UPDATE kundendaten.kunden SET status=0 WHERE id=?", array($customerno));
236
+    db_query("UPDATE kundendaten.kunden SET status=0 WHERE id=?", [$customerno]);
237 237
     logger(LOG_INFO, "session/checkuser", "register", "set customer's status to 0.");
238 238
 }
239 239
 
240 240
 function set_customer_lastlogin($customerno)
241 241
 {
242 242
     $customerno = (int) $customerno;
243
-    db_query("UPDATE kundendaten.kunden SET lastlogin=NOW() WHERE id=?", array($customerno));
243
+    db_query("UPDATE kundendaten.kunden SET lastlogin=NOW() WHERE id=?", [$customerno]);
244 244
 }
245 245
 
246 246
 function set_customer_password($customerno, $newpass)
247 247
 {
248 248
     $customerno = (int) $customerno;
249 249
     $newpass = sha1($newpass);
250
-    db_query("UPDATE kundendaten.kunden SET passwort=:newpass WHERE id=:customerno", array(":newpass" => $newpass, ":customerno" => $customerno));
250
+    db_query("UPDATE kundendaten.kunden SET passwort=:newpass WHERE id=:customerno", [":newpass" => $newpass, ":customerno" => $customerno]);
251 251
     logger(LOG_INFO, "session/checkuser", "pwchange", "changed customer's password.");
252 252
 }
253 253
 
254 254
 function set_subuser_password($subuser, $newpass)
255 255
 {
256
-    $args = array(":subuser" => $subuser,
256
+    $args = [":subuser" => $subuser,
257 257
                 ":uid" => (int) $_SESSION['userinfo']['uid'],
258
-                ":newpass" => sha1($newpass));
258
+                ":newpass" => sha1($newpass), ];
259 259
     db_query("UPDATE system.subusers SET password=:newpass WHERE username=:subuser AND uid=:uid", $args);
260 260
     logger(LOG_INFO, "session/checkuser", "pwchange", "changed subuser's password.");
261 261
 }
... ...
@@ -265,14 +265,14 @@ function set_systemuser_password($uid, $newpass)
265 265
     $uid = (int) $uid;
266 266
     require_once('inc/base.php');
267 267
     $newpass = crypt($newpass, '$6$'.random_string(8).'$');
268
-    db_query("UPDATE system.passwoerter SET passwort=:newpass WHERE uid=:uid", array(":newpass" => $newpass, ":uid" => $uid));
268
+    db_query("UPDATE system.passwoerter SET passwort=:newpass WHERE uid=:uid", [":newpass" => $newpass, ":uid" => $uid]);
269 269
     logger(LOG_INFO, "session/checkuser", "pwchange", "changed user's password.");
270 270
 }
271 271
 
272 272
 
273 273
 function user_for_mailaccount($account)
274 274
 {
275
-    $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account=?", array($account));
275
+    $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account=?", [$account]);
276 276
     if ($result->rowCount() != 1) {
277 277
         system_failure('Diese Adresse ist herrenlos?!');
278 278
     }
... ...
@@ -282,7 +282,7 @@ function user_for_mailaccount($account)
282 282
 
283 283
 function user_for_vmail_account($account)
284 284
 {
285
-    $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)=?", array($account));
285
+    $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)=?", [$account]);
286 286
     if ($result->rowCount() != 1) {
287 287
         system_failure('Diese Adresse ist herrenlos?!');
288 288
     }
... ...
@@ -302,7 +302,7 @@ function setup_session($role, $useridentity)
302 302
         $_SESSION['restrict_modules'] = explode(',', $info['modules']);
303 303
         $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_SUBUSER;
304 304
         $_SESSION['subuser'] = $useridentity;
305
-        $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username=?", array($info['username']));
305
+        $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username=?", [$info['username']]);
306 306
         if ($entry = $data->fetch()) {
307 307
             if ($entry['kundenaccount'] == 1) {
308 308
                 $customer = get_customer_info($_SESSION['userinfo']['username']);
... ...
@@ -345,6 +345,6 @@ function setup_session($role, $useridentity)
345 345
         DEBUG("We are virtual mailaccount: {$_SESSION['mailaccount']}");
346 346
     }
347 347
     if (! ($role & ROLE_CUSTOMER)) {
348
-        $_SESSION['customerinfo'] = array();
348
+        $_SESSION['customerinfo'] = [];
349 349
     }
350 350
 }
... ...
@@ -13,8 +13,8 @@ require_once('inc/base.php');
13 13
 
14 14
 session_name(config('session_name'));
15 15
 
16
-session_set_cookie_params(array('path' => '/', 'secure' => true,
17
-                                'httponly' => true, 'samesite' => 'Lax'));
16
+session_set_cookie_params(['path' => '/', 'secure' => true,
17
+                                'httponly' => true, 'samesite' => 'Lax', ]);
18 18
 
19 19
 if (!session_start()) {
20 20
     logger(LOG_ERR, "session/start", "session", "Die session konnte nicht gestartet werden!");
... ...
@@ -44,7 +44,7 @@ if (have_module('webmailtotp') && isset($_POST['webinterface_totpcode']) && isse
44 44
 }
45 45
 
46 46
 if (isset($_POST['webinterface_username']) && isset($_POST['webinterface_password'])) {
47
-    check_input_types($_POST, array('webinterface_username' => 'string', 'webinterface_password' => 'string'));
47
+    check_input_types($_POST, ['webinterface_username' => 'string', 'webinterface_password' => 'string']);
48 48
     $role = find_role($_POST['webinterface_username'], $_POST['webinterface_password']);
49 49
     if ($role === null) {
50 50
         $_SESSION['role'] = ROLE_ANONYMOUS;
51 51