Browse code

fix warning

Bernd Wurst authored on01/05/2020 11:40:08
Showing1 changed files
... ...
@@ -200,6 +200,9 @@ function get_max_mailboxquota($server, $oldquota)
200 200
     $server = (int) $server;
201 201
     $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 202
     $item = $result->fetch();
203
+    if (! $item) {
204
+        return $oldquota - config('vmail_basequota');
205
+    }
203 206
     DEBUG("Free space: ".$item['free']." / Really: ".($item['free'] + ($oldquota - config('vmail_basequota'))));
204 207
     return max(0, $item['free'] + ($oldquota - config('vmail_basequota')));
205 208
 }
Browse code

fix runtime warning when creating new mail address

Bernd Wurst authored on19/11/2019 11:50:56
Showing1 changed files
... ...
@@ -74,6 +74,9 @@ function get_vmail_id_by_emailaddr($emailaddr)
74 74
 {
75 75
     $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE CONCAT(local, '@', domainname) = ?", array($emailaddr));
76 76
     $entry = $result->fetch();
77
+    if ($entry === false) {
78
+        return false;
79
+    }
77 80
     return (int) $entry['id'];
78 81
 }
79 82
 
Browse code

Umstellung von filter_input_general() auf filter_output_html()

Bernd Wurst authored on21/09/2019 17:07:48
Showing1 changed files
... ...
@@ -265,9 +265,8 @@ function save_vmail_account($account)
265 265
     $forwards = array();
266 266
     if (count($account['forwards']) > 0) {
267 267
         for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
268
-            $account['forwards'][$i]['destination'] = filter_input_general($account['forwards'][$i]['destination']);
269 268
             if (! check_emailaddr($account['forwards'][$i]['destination'])) {
270
-                system_failure('Das Weiterleitungs-Ziel »'.$account['forwards'][$i]['destination'].'« ist keine E-Mail-Adresse!');
269
+                system_failure('Das Weiterleitungs-Ziel »'.filter_output_html($account['forwards'][$i]['destination']).'« ist keine E-Mail-Adresse!');
271 270
             }
272 271
         }
273 272
     }
Browse code

remove whitespace in empty lines

Hanno authored on26/06/2018 23:36:40
Showing1 changed files
... ...
@@ -261,7 +261,7 @@ function save_vmail_account($account)
261 261
             return false;
262 262
         }
263 263
     }
264
-  
264
+
265 265
     $forwards = array();
266 266
     if (count($account['forwards']) > 0) {
267 267
         for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
... ...
@@ -300,7 +300,7 @@ function save_vmail_account($account)
300 300
         } else {
301 301
             $free = get_max_mailboxquota($oldaccount['server'], $oldaccount['quota']);
302 302
         }
303
-  
303
+
304 304
         $newquota = max((int) config('vmail_basequota'), (int) $account['quota']);
305 305
         if ($newquota > config('vmail_basequota') && $newquota > ($free+config('vmail_basequota'))) {
306 306
             $newquota = $free + config('vmail_basequota');
... ...
@@ -310,7 +310,7 @@ function save_vmail_account($account)
310 310
             }
311 311
             warning("Ihr Speicherplatz reicht für diese Postfach-Größe nicht mehr aus. Ihr Postfach wurde auf {$newquota} MB reduziert. Bitte beachten Sie, dass damit Ihr Benutzerkonto keinen freien Speicherplatz mehr aufweist!");
312 312
         }
313
-  
313
+
314 314
         $account['quota'] = $newquota;
315 315
     }
316 316
 
... ...
@@ -319,7 +319,7 @@ function save_vmail_account($account)
319 319
     } else {
320 320
         $account['quota_threshold'] = min((int) $account['quota_threshold'], (int) $account['quota']);
321 321
     }
322
-  
322
+
323 323
     $account['local'] = strtolower($account['local']);
324 324
     # Leerstring wird zu NULL
325 325
     $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : null);
... ...
@@ -376,7 +376,7 @@ function save_vmail_account($account)
376 376
                   ":quote" => $quote);
377 377
         db_query($query, $args);
378 378
     }
379
-    
379
+
380 380
 
381 381
 
382 382
     if (! $newaccount) {
... ...
@@ -485,7 +485,7 @@ function domainsettings($only_domain=null)
485 485
         if (! array_key_exists($mydom['id'], $subdomains)) {
486 486
             $subdomains[$mydom['id']] = array();
487 487
         }
488
-        
488
+
489 489
         $type = 'auto';
490 490
         if ($mydom['v_id']) {
491 491
             $type = 'virtual';
... ...
@@ -513,11 +513,11 @@ function change_domain($id, $type)
513 513
     if (domain_has_vmail_accounts($id)) {
514 514
         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.");
515 515
     }
516
-  
516
+
517 517
     if (! in_array($type, array('none','auto','virtual'))) {
518 518
         system_failure("Ungültige Aktion");
519 519
     }
520
-  
520
+
521 521
     $old = domainsettings($id);
522 522
     if ($old['type'] == $type) {
523 523
         system_failure('Domain ist bereits so konfiguriert');
Browse code

Fix coding style with php-cs-checker, see https://cs.sensiolabs.org/

Hanno authored on26/06/2018 13:58:19
Showing1 changed files
... ...
@@ -8,7 +8,7 @@ Written 2008-2018 by schokokeks.org Hosting, namely
8 8
 
9 9
 To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10 10
 
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12 12
 http://creativecommons.org/publicdomain/zero/1.0/
13 13
 
14 14
 Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
... ...
@@ -22,178 +22,183 @@ require_once('hasdomain.php');
22 22
 require_once('common.php');
23 23
 
24 24
 
25
-function forward_type($target) {
26
-  list($l, $d) = explode('@', strtolower($target), 2);
27
-  DEBUG('Weiterleitung an '.$l.' @ '.$d);
28
-  $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", array($d));
29
-  if ($result->rowCount() > 0) {
30
-    // Lokale Domain
31
-    return 'local';
32
-  }  
33
-  // Auswärtige Domain aber keine aus der Liste
34
-  return 'external';
25
+function forward_type($target)
26
+{
27
+    list($l, $d) = explode('@', strtolower($target), 2);
28
+    DEBUG('Weiterleitung an '.$l.' @ '.$d);
29
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", array($d));
30
+    if ($result->rowCount() > 0) {
31
+        // Lokale Domain
32
+        return 'local';
33
+    }
34
+    // Auswärtige Domain aber keine aus der Liste
35
+    return 'external';
35 36
 }
36 37
 
37 38
 
38 39
 
39 40
 function empty_account()
40 41
 {
41
-	$account = array(
42
-		'id' => NULL,
43
-		'local' => '',
44
-		'domain' => NULL,
45
-		'password' => NULL,
46
-    'smtpreply' => NULL,
42
+    $account = array(
43
+        'id' => null,
44
+        'local' => '',
45
+        'domain' => null,
46
+        'password' => null,
47
+    'smtpreply' => null,
47 48
     'quota' => config('vmail_basequota'),
48 49
     'quota_threshold' => 20,
49
-		'forwards' => array(),
50
-		'autoresponder' => NULL
51
-		);
52
-	return $account;
53
-
50
+        'forwards' => array(),
51
+        'autoresponder' => null
52
+        );
53
+    return $account;
54 54
 }
55 55
 
56 56
 function empty_autoresponder_config()
57 57
 {
58
-  $ar = array(
59
-    'valid_from' => date( 'Y-m-d' ),
60
-    'valid_until' => NULL,
61
-    'fromname' => NULL,
62
-    'fromaddr' => NULL,
63
-    'subject' => NULL,
58
+    $ar = array(
59
+    'valid_from' => date('Y-m-d'),
60
+    'valid_until' => null,
61
+    'fromname' => null,
62
+    'fromaddr' => null,
63
+    'subject' => null,
64 64
     'message' => 'Danke für Ihre E-Mail.
65 65
 Ich bin aktuell nicht im Büro und werde Ihre Nachricht erst nach meiner Rückkehr beantworten.
66 66
 Ihre E-Mail wird nicht weitergeleitet.',
67
-    'quote' => NULL
67
+    'quote' => null
68 68
     );
69
-  return $ar;
69
+    return $ar;
70 70
 }
71 71
 
72 72
 
73
-function get_vmail_id_by_emailaddr($emailaddr) 
73
+function get_vmail_id_by_emailaddr($emailaddr)
74 74
 {
75
-  $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE CONCAT(local, '@', domainname) = ?", array($emailaddr));
76
-  $entry = $result->fetch();
77
-  return (int) $entry['id'];
75
+    $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE CONCAT(local, '@', domainname) = ?", array($emailaddr));
76
+    $entry = $result->fetch();
77
+    return (int) $entry['id'];
78 78
 }
79 79
 
80 80
 function get_account_details($id, $checkuid = true)
81 81
 {
82
-	$id = (int) $id;
83
-  $uid_check = '';
84
-  DEBUG("checkuid: ".$checkuid);
85
-  $args = array(":id" => $id);
86
-  if ($checkuid) {
87
-    $uid = (int) $_SESSION['userinfo']['uid'];
88
-    $uid_check = "useraccount=:uid AND ";
89
-    $args[":uid"] = $uid;
90
-  }
91
-  $result = db_query("SELECT id, local, domain, password, smtpreply, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
92
-	if ($result->rowCount() == 0)
93
-		system_failure('Ungültige ID oder kein eigener Account');
94
-	$acc = empty_account();
95
-	$res = $result->fetch();
96
-	foreach ($res AS $key => $value) {
97
-	  if ($key == 'forwards')
98
-	    continue;
99
-	  $acc[$key] = $value;
100
-	}
101
-	if ($acc['forwards'] > 0) {
102
-	  $result = db_query("SELECT id, destination FROM mail.vmail_forward WHERE account=?", array($acc['id']));
103
-	  while ($item = $result->fetch()){
104
-	    array_push($acc['forwards'], array("id" => $item['id'], 'destination' => $item['destination']));
105
-	  }
106
-	}
107
-  if ($acc['autoresponder'] > 0) {
108
-    $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']));
109
-    $item = $result->fetch();
110
-    DEBUG($item);
111
-    $acc['autoresponder'] = $item;
112
-  } else {
113
-    $acc['autoresponder'] = NULL;
114
-  }
115
-  if ($acc['quota_threshold'] === NULL) {
116
-    $acc['quota_threshold'] = -1;
117
-  }
118
-	return $acc;
82
+    $id = (int) $id;
83
+    $uid_check = '';
84
+    DEBUG("checkuid: ".$checkuid);
85
+    $args = array(":id" => $id);
86
+    if ($checkuid) {
87
+        $uid = (int) $_SESSION['userinfo']['uid'];
88
+        $uid_check = "useraccount=:uid AND ";
89
+        $args[":uid"] = $uid;
90
+    }
91
+    $result = db_query("SELECT id, local, domain, password, smtpreply, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
92
+    if ($result->rowCount() == 0) {
93
+        system_failure('Ungültige ID oder kein eigener Account');
94
+    }
95
+    $acc = empty_account();
96
+    $res = $result->fetch();
97
+    foreach ($res as $key => $value) {
98
+        if ($key == 'forwards') {
99
+            continue;
100
+        }
101
+        $acc[$key] = $value;
102
+    }
103
+    if ($acc['forwards'] > 0) {
104
+        $result = db_query("SELECT id, destination FROM mail.vmail_forward WHERE account=?", array($acc['id']));
105
+        while ($item = $result->fetch()) {
106
+            array_push($acc['forwards'], array("id" => $item['id'], 'destination' => $item['destination']));
107
+        }
108
+    }
109
+    if ($acc['autoresponder'] > 0) {
110
+        $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']));
111
+        $item = $result->fetch();
112
+        DEBUG($item);
113
+        $acc['autoresponder'] = $item;
114
+    } else {
115
+        $acc['autoresponder'] = null;
116
+    }
117
+    if ($acc['quota_threshold'] === null) {
118
+        $acc['quota_threshold'] = -1;
119
+    }
120
+    return $acc;
119 121
 }
120 122
 
121 123
 function get_vmail_accounts()
122 124
 {
123
-	$uid = (int) $_SESSION['userinfo']['uid'];
124
-	$result = db_query("SELECT * from mail.v_vmail_accounts WHERE useraccount=? ORDER BY domainname,local ASC", array($uid));
125
-	$ret = array();
126
-	while ($line = $result->fetch())
127
-	{
128
-		array_push($ret, $line);
129
-	}
130
-	DEBUG($ret);
131
-	return $ret;
125
+    $uid = (int) $_SESSION['userinfo']['uid'];
126
+    $result = db_query("SELECT * from mail.v_vmail_accounts WHERE useraccount=? ORDER BY domainname,local ASC", array($uid));
127
+    $ret = array();
128
+    while ($line = $result->fetch()) {
129
+        array_push($ret, $line);
130
+    }
131
+    DEBUG($ret);
132
+    return $ret;
132 133
 }
133 134
 
134 135
 
135 136
 
136 137
 function get_vmail_domains()
137 138
 {
138
-	$uid = (int) $_SESSION['userinfo']['uid'];
139
-	$result = db_query("SELECT id, domainname, server FROM mail.v_vmail_domains WHERE useraccount=? ORDER BY domainname", array($uid));
140
-	if ($result->rowCount() == 0)
141
-		system_failure('Sie haben keine Domains für virtuelle Mail-Verarbeitung');
142
-	$ret = array();
143
-	while ($tmp = $result->fetch())
144
-		array_push($ret, $tmp);
145
-	return $ret;
139
+    $uid = (int) $_SESSION['userinfo']['uid'];
140
+    $result = db_query("SELECT id, domainname, server FROM mail.v_vmail_domains WHERE useraccount=? ORDER BY domainname", array($uid));
141
+    if ($result->rowCount() == 0) {
142
+        system_failure('Sie haben keine Domains für virtuelle Mail-Verarbeitung');
143
+    }
144
+    $ret = array();
145
+    while ($tmp = $result->fetch()) {
146
+        array_push($ret, $tmp);
147
+    }
148
+    return $ret;
146 149
 }
147 150
 
148 151
 
149 152
 function find_account_id($accname)
150 153
 {
151
-  DEBUG($accname);
152
-  $tmp = explode('@', $accname, 2);
153
-  DEBUG($tmp);
154
-  if (count($tmp) != 2)
155
-    system_failure("Der Account hat nicht die korrekte Syntax");
156
-  list( $local, $domainname) = $tmp;
157
-
158
-  $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE local=? AND domainname=? LIMIT 1", array($local, $domainname));
159
-  if ($result->rowCount() == 0)
160
-    system_failure("Der Account konnte nicht gefunden werden");
161
-  $tmp = $result->fetch();
162
-  return $tmp[0];
154
+    DEBUG($accname);
155
+    $tmp = explode('@', $accname, 2);
156
+    DEBUG($tmp);
157
+    if (count($tmp) != 2) {
158
+        system_failure("Der Account hat nicht die korrekte Syntax");
159
+    }
160
+    list($local, $domainname) = $tmp;
161
+
162
+    $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE local=? AND domainname=? LIMIT 1", array($local, $domainname));
163
+    if ($result->rowCount() == 0) {
164
+        system_failure("Der Account konnte nicht gefunden werden");
165
+    }
166
+    $tmp = $result->fetch();
167
+    return $tmp[0];
163 168
 }
164 169
 
165 170
 
166 171
 function change_vmail_password($accname, $newpass)
167 172
 {
168
-  $accid = find_account_id($accname);
169
-  $encpw = encrypt_mail_password($newpass);
170
-  db_query("UPDATE mail.vmail_accounts SET password=:encpw WHERE id=:accid", array(":encpw" => $encpw, ":accid" => $accid));
173
+    $accid = find_account_id($accname);
174
+    $encpw = encrypt_mail_password($newpass);
175
+    db_query("UPDATE mail.vmail_accounts SET password=:encpw WHERE id=:accid", array(":encpw" => $encpw, ":accid" => $accid));
171 176
 }
172 177
 
173 178
 
174
-function domainselect($selected = NULL, $selectattribute = '')
179
+function domainselect($selected = null, $selectattribute = '')
175 180
 {
176
-  $domainlist = get_vmail_domains();
177
-  $selected = (int) $selected;
178
-
179
-  $ret = '<select id="domain" name="domain" size="1" '.$selectattribute.' >';
180
-  foreach ($domainlist as $dom)
181
-  {
182
-    $s = ($selected == $dom['id']) ? ' selected="selected" ': '';
183
-    $ret .= "<option value=\"{$dom['id']}\"{$s}>{$dom['domainname']}</option>\n";
184
-  }
185
-  $ret .= '</select>';
186
-  return $ret;
181
+    $domainlist = get_vmail_domains();
182
+    $selected = (int) $selected;
183
+
184
+    $ret = '<select id="domain" name="domain" size="1" '.$selectattribute.' >';
185
+    foreach ($domainlist as $dom) {
186
+        $s = ($selected == $dom['id']) ? ' selected="selected" ': '';
187
+        $ret .= "<option value=\"{$dom['id']}\"{$s}>{$dom['domainname']}</option>\n";
188
+    }
189
+    $ret .= '</select>';
190
+    return $ret;
187 191
 }
188 192
 
189 193
 
190
-function get_max_mailboxquota($server, $oldquota) {
191
-  $uid = (int) $_SESSION['userinfo']['uid'];
192
-  $server = (int) $server;
193
-  $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));
194
-  $item = $result->fetch();
195
-  DEBUG("Free space: ".$item['free']." / Really: ".($item['free'] + ($oldquota - config('vmail_basequota'))));
196
-  return max(0, $item['free'] + ($oldquota - config('vmail_basequota')));
194
+function get_max_mailboxquota($server, $oldquota)
195
+{
196
+    $uid = (int) $_SESSION['userinfo']['uid'];
197
+    $server = (int) $server;
198
+    $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));
199
+    $item = $result->fetch();
200
+    DEBUG("Free space: ".$item['free']." / Really: ".($item['free'] + ($oldquota - config('vmail_basequota'))));
201
+    return max(0, $item['free'] + ($oldquota - config('vmail_basequota')));
197 202
 }
198 203
 
199 204
 
... ...
@@ -201,174 +206,167 @@ function get_max_mailboxquota($server, $oldquota) {
201 206
 
202 207
 function save_vmail_account($account)
203 208
 {
204
-  $accountlogin = ($_SESSION['role'] == ROLE_VMAIL_ACCOUNT);
205
-  $id = $account['id'];
206
-  if ($id != NULL)
207
-  {
208
-    $id = (int) $id;
209
-    $oldaccount = get_account_details($id, !$accountlogin);
210
-    // Erzeugt einen system_error() wenn ID ungültig
211
-  }
212
-  // Ab hier ist $id sicher, entweder NULL oder eine gültige ID des aktuellen users
213
-
214
-  $newaccount = false;
215
-  if ($id === NULL) {
216
-    $newaccount = true;
217
-  }
209
+    $accountlogin = ($_SESSION['role'] == ROLE_VMAIL_ACCOUNT);
210
+    $id = $account['id'];
211
+    if ($id != null) {
212
+        $id = (int) $id;
213
+        $oldaccount = get_account_details($id, !$accountlogin);
214
+        // Erzeugt einen system_error() wenn ID ungültig
215
+    }
216
+    // Ab hier ist $id sicher, entweder NULL oder eine gültige ID des aktuellen users
218 217
 
219
-  if ($accountlogin) {
220
-    if ($account['domain'] != $oldaccount['domain'])
221
-      system_failure('Sie können die E-Mail-Adresse nicht ändern!');
222
-    if ($account['local'] != $oldaccount['local'])
223
-      system_failure('Sie können die E-Mail-Adresse nicht ändern!');
224
-    if ($account['quota'] != $oldaccount['quota'])
225
-      system_failure('Sie können Ihren eigenen Speicherplatz nicht verändern.');
226
-    if ($account['smtpreply'] != NULL) {
227
-      system_failure("Sie können nicht den Account stilllegen mit dem Sie grade angemeldet sind.");
228
-    }
229
-  } else {
230
-  
231
-    $account['local'] = filter_input_username($account['local']);
232
-    if ($account['local'] == '')
233
-    {
234
-      system_failure('Die E-Mail-Adresse braucht eine Angabe vor dem »@«!');
235
-      return false;
218
+    $newaccount = false;
219
+    if ($id === null) {
220
+        $newaccount = true;
236 221
     }
237
-    $account['domain'] = (int) $account['domain'];
238
-    $domainlist = get_vmail_domains();
239
-    $valid_domain = false;
240
-    $domainname = NULL;
241
-    $server = NULL;
242
-    foreach ($domainlist as $dom)
243
-    {
244
-      if ($dom['id'] == $account['domain'])
245
-      {
246
-        $domainname = $dom['domainname'];
247
-        $server = $dom['server'];
248
-        $valid_domain = true;
249
-        break;
250
-      }
251
-    }
252
-    if (($account['domain'] == 0) || (! $valid_domain))
253
-    {
254
-      system_failure('Bitte wählen Sie eine Ihrer Domains aus!');
255
-      return false;
256
-    }
257
-    if ($id == NULL && get_vmail_id_by_emailaddr($account['local'].'@'.$domainname)) {
258
-      system_failure('Diese E-Mail-Adresse gibt es bereits.');
259
-      return false;
222
+
223
+    if ($accountlogin) {
224
+        if ($account['domain'] != $oldaccount['domain']) {
225
+            system_failure('Sie können die E-Mail-Adresse nicht ändern!');
226
+        }
227
+        if ($account['local'] != $oldaccount['local']) {
228
+            system_failure('Sie können die E-Mail-Adresse nicht ändern!');
229
+        }
230
+        if ($account['quota'] != $oldaccount['quota']) {
231
+            system_failure('Sie können Ihren eigenen Speicherplatz nicht verändern.');
232
+        }
233
+        if ($account['smtpreply'] != null) {
234
+            system_failure("Sie können nicht den Account stilllegen mit dem Sie grade angemeldet sind.");
235
+        }
236
+    } else {
237
+        $account['local'] = filter_input_username($account['local']);
238
+        if ($account['local'] == '') {
239
+            system_failure('Die E-Mail-Adresse braucht eine Angabe vor dem »@«!');
240
+            return false;
241
+        }
242
+        $account['domain'] = (int) $account['domain'];
243
+        $domainlist = get_vmail_domains();
244
+        $valid_domain = false;
245
+        $domainname = null;
246
+        $server = null;
247
+        foreach ($domainlist as $dom) {
248
+            if ($dom['id'] == $account['domain']) {
249
+                $domainname = $dom['domainname'];
250
+                $server = $dom['server'];
251
+                $valid_domain = true;
252
+                break;
253
+            }
254
+        }
255
+        if (($account['domain'] == 0) || (! $valid_domain)) {
256
+            system_failure('Bitte wählen Sie eine Ihrer Domains aus!');
257
+            return false;
258
+        }
259
+        if ($id == null && get_vmail_id_by_emailaddr($account['local'].'@'.$domainname)) {
260
+            system_failure('Diese E-Mail-Adresse gibt es bereits.');
261
+            return false;
262
+        }
260 263
     }
261
-  }
262 264
   
263
-  $forwards = array();
264
-  if (count($account['forwards']) > 0) 
265
-  {
266
-    for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
267
-      $account['forwards'][$i]['destination'] = filter_input_general($account['forwards'][$i]['destination']);
268
-      if (! check_emailaddr($account['forwards'][$i]['destination'])) {
269
-        system_failure('Das Weiterleitungs-Ziel »'.$account['forwards'][$i]['destination'].'« ist keine E-Mail-Adresse!');
270
-      }
265
+    $forwards = array();
266
+    if (count($account['forwards']) > 0) {
267
+        for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
268
+            $account['forwards'][$i]['destination'] = filter_input_general($account['forwards'][$i]['destination']);
269
+            if (! check_emailaddr($account['forwards'][$i]['destination'])) {
270
+                system_failure('Das Weiterleitungs-Ziel »'.$account['forwards'][$i]['destination'].'« ist keine E-Mail-Adresse!');
271
+            }
272
+        }
271 273
     }
272
-  }
273 274
 
274
-  if ($accountlogin) {
275
-    $password = NULL; 
276
-    $set_password = false;
277
-  } else {
278
-    $password= NULL;
279
-    if ($account['password'] != '')
280
-    {
281
-      $account['password'] = stripslashes($account['password']);
282
-      $crack = strong_password($account['password']);
283
-      if ($crack !== true)
284
-      {
285
-        system_failure('Ihr Passwort ist zu einfach. bitte wählen Sie ein sicheres Passwort!'."\nDie Fehlermeldung lautet: »{$crack}«");
286
-        return false;
287
-      }
288
-      $password = encrypt_mail_password($account['password']);
289
-    }
290
-    $set_password = ($id == NULL || $password != NULL);
291
-    if ($account['password'] === NULL) {
292
-      $set_password=true;
293
-    }
294
-  }  
295
-
296
-  if (!$accountlogin) {
297
-    $free = config('vmail_basequota');
298
-    if ($newaccount) {
299
-      // Neues Postfach
300
-      $free = get_max_mailboxquota($server, config('vmail_basequota'));
275
+    if ($accountlogin) {
276
+        $password = null;
277
+        $set_password = false;
301 278
     } else {
302
-      $free = get_max_mailboxquota($oldaccount['server'], $oldaccount['quota']);
279
+        $password= null;
280
+        if ($account['password'] != '') {
281
+            $account['password'] = stripslashes($account['password']);
282
+            $crack = strong_password($account['password']);
283
+            if ($crack !== true) {
284
+                system_failure('Ihr Passwort ist zu einfach. bitte wählen Sie ein sicheres Passwort!'."\nDie Fehlermeldung lautet: »{$crack}«");
285
+                return false;
286
+            }
287
+            $password = encrypt_mail_password($account['password']);
288
+        }
289
+        $set_password = ($id == null || $password != null);
290
+        if ($account['password'] === null) {
291
+            $set_password=true;
292
+        }
303 293
     }
294
+
295
+    if (!$accountlogin) {
296
+        $free = config('vmail_basequota');
297
+        if ($newaccount) {
298
+            // Neues Postfach
299
+            $free = get_max_mailboxquota($server, config('vmail_basequota'));
300
+        } else {
301
+            $free = get_max_mailboxquota($oldaccount['server'], $oldaccount['quota']);
302
+        }
304 303
   
305
-    $newquota = max((int) config('vmail_basequota'), (int) $account['quota']);
306
-    if ($newquota > config('vmail_basequota') && $newquota > ($free+config('vmail_basequota'))) {
307
-      $newquota = $free + config('vmail_basequota');
308
-      if (isset($oldaccount) && $account['quota'] >= $oldaccount['quota'] && $newquota < $oldaccount['quota']) {
309
-        # Wenn das Limit künstlich reduziert wurde, dann maximal auf den alten Wert.
310
-        $newquota = $oldaccount['quota'];
311
-      }
312
-      warning("Ihr Speicherplatz reicht für diese Postfach-Größe nicht mehr aus. Ihr Postfach wurde auf {$newquota} MB reduziert. Bitte beachten Sie, dass damit Ihr Benutzerkonto keinen freien Speicherplatz mehr aufweist!");
313
-    }
304
+        $newquota = max((int) config('vmail_basequota'), (int) $account['quota']);
305
+        if ($newquota > config('vmail_basequota') && $newquota > ($free+config('vmail_basequota'))) {
306
+            $newquota = $free + config('vmail_basequota');
307
+            if (isset($oldaccount) && $account['quota'] >= $oldaccount['quota'] && $newquota < $oldaccount['quota']) {
308
+                # Wenn das Limit künstlich reduziert wurde, dann maximal auf den alten Wert.
309
+                $newquota = $oldaccount['quota'];
310
+            }
311
+            warning("Ihr Speicherplatz reicht für diese Postfach-Größe nicht mehr aus. Ihr Postfach wurde auf {$newquota} MB reduziert. Bitte beachten Sie, dass damit Ihr Benutzerkonto keinen freien Speicherplatz mehr aufweist!");
312
+        }
314 313
   
315
-    $account['quota'] = $newquota;
316
-  }  
314
+        $account['quota'] = $newquota;
315
+    }
317 316
 
318
-  if ($account['quota_threshold'] == -1) {
319
-    $account['quota_threshold'] = NULL;
320
-  }
321
-  else {
322
-    $account['quota_threshold'] = min( (int) $account['quota_threshold'], (int) $account['quota'] );
323
-  }
317
+    if ($account['quota_threshold'] == -1) {
318
+        $account['quota_threshold'] = null;
319
+    } else {
320
+        $account['quota_threshold'] = min((int) $account['quota_threshold'], (int) $account['quota']);
321
+    }
324 322
   
325
-  $account['local'] = strtolower($account['local']);
326
-  # Leerstring wird zu NULL
327
-  $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : NULL);
323
+    $account['local'] = strtolower($account['local']);
324
+    # Leerstring wird zu NULL
325
+    $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : null);
328 326
 
329
-  $args = array(":local" => $account['local'],
327
+    $args = array(":local" => $account['local'],
330 328
                 ":domain" => $account['domain'],
331 329
                 ":password" => $password,
332 330
                 ":smtpreply" => $account['smtpreply'],
333
-                ":quota" => $account['quota'], 
331
+                ":quota" => $account['quota'],
334 332
                 ":quota_threshold" => $account['quota_threshold'],
335 333
                 ":id" => $id
336 334
                 );
337
-  $query = '';
338
-  if ($newaccount)
339
-  {
340
-    unset($args[":id"]);
341
-    $query = "INSERT INTO mail.vmail_accounts (local, domain, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :password, :smtpreply, :quota, :quota_threshold)";
342
-  } else {
343
-    if ($set_password)
344
-      $pw=", password=:password";
345
-    else {
346
-      unset($args[":password"]);
347
-      $pw='';
348
-    }
349
-    $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
350
-  }
351
-  db_query($query, $args); 
352
-  if ($newaccount) {
353
-    $id = db_insert_id();
354
-  }
335
+    $query = '';
336
+    if ($newaccount) {
337
+        unset($args[":id"]);
338
+        $query = "INSERT INTO mail.vmail_accounts (local, domain, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :password, :smtpreply, :quota, :quota_threshold)";
339
+    } else {
340
+        if ($set_password) {
341
+            $pw=", password=:password";
342
+        } else {
343
+            unset($args[":password"]);
344
+            $pw='';
345
+        }
346
+        $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
347
+    }
348
+    db_query($query, $args);
349
+    if ($newaccount) {
350
+        $id = db_insert_id();
351
+    }
355 352
 
356
-  if (is_array($account['autoresponder'])) {
357
-    $ar = $account['autoresponder'];
358
-    $quote = NULL;
359
-    if ($ar['quote'] == 'attach')
360
-      $quote = "attach";
361
-    elseif ($ar['quote'] == 'inline')
362
-      $quote = 'inline';
363
-    elseif ($ar['quote'] == 'teaser')
364
-      $quote = 'teaser';
365
-    if (! check_emailaddr($ar['fromaddr'])) {
366
-      input_error("Die Absenderadresse sieht ungültig aus. Es wird Ihre E-Mail-Adresse benutzt!");
367
-      $ar['fromaddr'] = NULL;
368
-    }
369
-    $query = "REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
353
+    if (is_array($account['autoresponder'])) {
354
+        $ar = $account['autoresponder'];
355
+        $quote = null;
356
+        if ($ar['quote'] == 'attach') {
357
+            $quote = "attach";
358
+        } elseif ($ar['quote'] == 'inline') {
359
+            $quote = 'inline';
360
+        } elseif ($ar['quote'] == 'teaser') {
361
+            $quote = 'teaser';
362
+        }
363
+        if (! check_emailaddr($ar['fromaddr'])) {
364
+            input_error("Die Absenderadresse sieht ungültig aus. Es wird Ihre E-Mail-Adresse benutzt!");
365
+            $ar['fromaddr'] = null;
366
+        }
367
+        $query = "REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
370 368
              "VALUES (:id, :valid_from, :valid_until, :fromname, :fromaddr, :subject, :message, :quote)";
371
-    $args = array(":id" => $id,
369
+        $args = array(":id" => $id,
372 370
                   ":valid_from" => $ar['valid_from'],
373 371
                   ":valid_until" => $ar['valid_until'],
374 372
                   ":fromname" => $ar['fromname'],
... ...
@@ -376,32 +374,31 @@ function save_vmail_account($account)
376 374
                   ":subject" => $ar['subject'],
377 375
                   ":message" => $ar['message'],
378 376
                   ":quote" => $quote);
379
-    db_query($query, $args);
380
-  }
377
+        db_query($query, $args);
378
+    }
381 379
     
382 380
 
383 381
 
384
-  if (! $newaccount) {
385
-    db_query("DELETE FROM mail.vmail_forward WHERE account=?", array($id));
386
-   }
382
+    if (! $newaccount) {
383
+        db_query("DELETE FROM mail.vmail_forward WHERE account=?", array($id));
384
+    }
387 385
 
388
-  if (count($account['forwards']) > 0)
389
-  {
390
-    $forward_query = "INSERT INTO mail.vmail_forward (account,destination) VALUES (:account, :destination)";
391
-    for ($i=0;$i < count($account['forwards']); $i++) { 
392
-      if (! isset($account['forwards'][$i]['destination'])) {
393
-        continue;
394
-      }
395
-      db_query($forward_query, array(":account" => $id, ":destination" => $account['forwards'][$i]['destination']));
386
+    if (count($account['forwards']) > 0) {
387
+        $forward_query = "INSERT INTO mail.vmail_forward (account,destination) VALUES (:account, :destination)";
388
+        for ($i=0;$i < count($account['forwards']); $i++) {
389
+            if (! isset($account['forwards'][$i]['destination'])) {
390
+                continue;
391
+            }
392
+            db_query($forward_query, array(":account" => $id, ":destination" => $account['forwards'][$i]['destination']));
393
+        }
396 394
     }
397
-  }
398
-  if ($newaccount && $password) {
399
-    $servername = get_server_by_id($server);
400
-    $emailaddr = 'vmail-'.$account['local'].'%'.$domainname.'@'.$servername;
401
-    $username = $account['local'].'@'.$domainname;
402
-    $webmailurl = config('webmail_url');
403
-    $servername = get_server_by_id($server);
404
-    $message = 'Ihr neues E-Mail-Postfach '.$username.' ist einsatzbereit!
395
+    if ($newaccount && $password) {
396
+        $servername = get_server_by_id($server);
397
+        $emailaddr = 'vmail-'.$account['local'].'%'.$domainname.'@'.$servername;
398
+        $username = $account['local'].'@'.$domainname;
399
+        $webmailurl = config('webmail_url');
400
+        $servername = get_server_by_id($server);
401
+        $message = 'Ihr neues E-Mail-Postfach '.$username.' ist einsatzbereit!
405 402
 
406 403
 Wenn Sie diese Nachricht sehen, haben Sie das Postfach erfolgreich 
407 404
 abgerufen. Sie können diese Nachricht nach Kenntnisnahme löschen.
... ...
@@ -419,120 +416,127 @@ Wussten Sie schon, dass Sie auf mehrere Arten Ihre E-Mails abrufen können?
419 416
   (Achten Sie bitte darauf, dass die Verschlüsselung mit SSL oder TLS 
420 417
   aktiviert ist.)
421 418
 ';
422
-    # send welcome message
423
-    mail($emailaddr, 'Ihr neues Postfach ist bereit', $message, "X-schokokeks-org-message: welcome\nFrom: ".config('company_name').' <'.config('adminmail').">\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\n");
424
-    # notify the vmail subsystem of this new account
419
+        # send welcome message
420
+        mail($emailaddr, 'Ihr neues Postfach ist bereit', $message, "X-schokokeks-org-message: welcome\nFrom: ".config('company_name').' <'.config('adminmail').">\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\n");
421
+        # notify the vmail subsystem of this new account
425 422
     #mail('vmail@'.config('vmail_server'), 'command', "user={$account['local']}\nhost={$domainname}", "X-schokokeks-org-message: command");
426
-  }
423
+    }
427 424
 
428
-  // Clean up obsolete quota
429
-  if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
430
-    db_query("UPDATE mail.vmail_accounts SET quota_used=NULL, quota=NULL WHERE password IS NULL");
431
-  }
425
+    // Clean up obsolete quota
426
+    if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
427
+        db_query("UPDATE mail.vmail_accounts SET quota_used=NULL, quota=NULL WHERE password IS NULL");
428
+    }
432 429
 
433
-  // Update Mail-Quota-Cache
434
-  if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
435
-    $uid = (int) $_SESSION['userinfo']['uid'];
436
-    $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));
437
-    while ($line = $result->fetch()) {
438
-      if ($line['quota'] !== NULL) {
439
-        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']));
440
-      }
430
+    // Update Mail-Quota-Cache
431
+    if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
432
+        $uid = (int) $_SESSION['userinfo']['uid'];
433
+        $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));
434
+        while ($line = $result->fetch()) {
435
+            if ($line['quota'] !== null) {
436
+                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']));
437
+            }
438
+        }
441 439
     }
442
-  }
443 440
 
444
-  return true;
441
+    return true;
445 442
 }
446 443
 
447 444
 
448 445
 
449 446
 function delete_account($id)
450 447
 {
451
-  $account = get_account_details($id);
452
-  db_query("DELETE FROM mail.vmail_accounts WHERE id=?", array($account['id']));
448
+    $account = get_account_details($id);
449
+    db_query("DELETE FROM mail.vmail_accounts WHERE id=?", array($account['id']));
453 450
 }
454 451
 
455 452
 
456 453
 
457
-function domainsettings($only_domain=NULL) {
458
-  $uid = (int) $_SESSION['userinfo']['uid'];
459
-  if ($only_domain)
460
-    $only_domain = (int) $only_domain;
461
-  $domains = array();
462
-  $subdomains = array();
463
-
464
-  // Domains
465
-  $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));
466
-
467
-  while ($mydom = $result->fetch()) {
468
-    if (! array_key_exists($mydom['id'], $domains)) {
469
-      if ($mydom['v_id'])
470
-        $mydom['mail'] = 'virtual';
471
-      $domains[$mydom['id']] = array(
454
+function domainsettings($only_domain=null)
455
+{
456
+    $uid = (int) $_SESSION['userinfo']['uid'];
457
+    if ($only_domain) {
458
+        $only_domain = (int) $only_domain;
459
+    }
460
+    $domains = array();
461
+    $subdomains = array();
462
+
463
+    // Domains
464
+    $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));
465
+
466
+    while ($mydom = $result->fetch()) {
467
+        if (! array_key_exists($mydom['id'], $domains)) {
468
+            if ($mydom['v_id']) {
469
+                $mydom['mail'] = 'virtual';
470
+            }
471
+            $domains[$mydom['id']] = array(
472 472
         "name" => $mydom['name'],
473 473
         "type" => $mydom['mail'],
474 474
         "mailserver_lock" => $mydom['mailserver_lock']
475 475
         );
476
-      if ($only_domain && $only_domain == $mydom['id'])
477
-        return $domains[$only_domain];
476
+            if ($only_domain && $only_domain == $mydom['id']) {
477
+                return $domains[$only_domain];
478
+            }
479
+        }
478 480
     }
479
-  }      
480 481
 
481
-  // Subdomains
482
-  $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));
483
-  while ($mydom = $result->fetch()) {
484
-    if (! array_key_exists($mydom['id'], $subdomains))
485
-      $subdomains[$mydom['id']] = array();
482
+    // Subdomains
483
+    $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));
484
+    while ($mydom = $result->fetch()) {
485
+        if (! array_key_exists($mydom['id'], $subdomains)) {
486
+            $subdomains[$mydom['id']] = array();
487
+        }
486 488
         
487
-    $type = 'auto';
488
-    if ($mydom['v_id'])
489
-      $type = 'virtual';
490
-    $subdomains[$mydom['id']][] = array(
489
+        $type = 'auto';
490
+        if ($mydom['v_id']) {
491
+            $type = 'virtual';
492
+        }
493
+        $subdomains[$mydom['id']][] = array(
491 494
       "name" => $mydom['hostname'],
492 495
       "type" => $type
493 496
       );
494
-  }
495
-  return array("domains" => $domains, "subdomains" => $subdomains);
497
+    }
498
+    return array("domains" => $domains, "subdomains" => $subdomains);
496 499
 }
497 500
 
498 501
 
499 502
 function domain_has_vmail_accounts($domid)
500 503
 {
501
-  $domid = (int) $domid;
502
-  $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));
503
-  return ($result->rowCount() > 0);
504
+    $domid = (int) $domid;
505
+    $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));
506
+    return ($result->rowCount() > 0);
504 507
 }
505 508
 
506 509
 
507 510
 function change_domain($id, $type)
508 511
 {
509
-  $id = (int) $id;
510
-  if (domain_has_vmail_accounts($id))
511
-    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.");
512
+    $id = (int) $id;
513
+    if (domain_has_vmail_accounts($id)) {
514
+        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.");
515
+    }
512 516
   
513
-  if (! in_array($type, array('none','auto','virtual')))
514
-    system_failure("Ungültige Aktion");
517
+    if (! in_array($type, array('none','auto','virtual'))) {
518
+        system_failure("Ungültige Aktion");
519
+    }
515 520
   
516
-  $old = domainsettings($id);
517
-  if ($old['type'] == $type)
518
-    system_failure('Domain ist bereits so konfiguriert');
519
-
520
-  if ($type == 'none') {
521
-    db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL", array($id));
522
-    db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
523
-    db_query("UPDATE kundendaten.domains SET mail='none', lastchange=NOW() WHERE id=?", array($id));
524
-  }
525
-  elseif ($type == 'virtual') {
526
-    $vmailserver = (int) $_SESSION['userinfo']['server'];
527
-    db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
528
-    db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=?", array($id));
529
-    db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", array($id, $vmailserver));
530
-  }
531
-  elseif ($type == 'auto') {
532
-    db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL LIMIT 1;", array($id));
533
-    db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL LIMIT 1;", array($id));
534
-    db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=? LIMIT 1;", array($id));
535
-  }
521
+    $old = domainsettings($id);
522
+    if ($old['type'] == $type) {
523
+        system_failure('Domain ist bereits so konfiguriert');
524
+    }
525
+
526
+    if ($type == 'none') {
527
+        db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL", array($id));
528
+        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
529
+        db_query("UPDATE kundendaten.domains SET mail='none', lastchange=NOW() WHERE id=?", array($id));
530
+    } elseif ($type == 'virtual') {
531
+        $vmailserver = (int) $_SESSION['userinfo']['server'];
532
+        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
533
+        db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=?", array($id));
534
+        db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", array($id, $vmailserver));
535
+    } elseif ($type == 'auto') {
536
+        db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL LIMIT 1;", array($id));
537
+        db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL LIMIT 1;", array($id));
538
+        db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=? LIMIT 1;", array($id));
539
+    }
536 540
 }
537 541
 
538 542
 
... ...
@@ -556,8 +560,9 @@ function maildomain_type($type) {
556 560
 }
557 561
 */
558 562
 
559
-function maildomain_type($type) {
560
-  switch ($type) {
563
+function maildomain_type($type)
564
+{
565
+    switch ($type) {
561 566
     case 'none':
562 567
       $type = 'Deaktiviert';
563 568
       break;
... ...
@@ -571,7 +576,5 @@ function maildomain_type($type) {
571 576
       $type = 'Manuell';
572 577
       break;
573 578
   }
574
-  return $type;
579
+    return $type;
575 580
 }
576
-
577
-
Browse code

avoid warning about unset variable

Hanno authored on25/06/2018 10:48:34
Showing1 changed files
... ...
@@ -305,7 +305,7 @@ function save_vmail_account($account)
305 305
     $newquota = max((int) config('vmail_basequota'), (int) $account['quota']);
306 306
     if ($newquota > config('vmail_basequota') && $newquota > ($free+config('vmail_basequota'))) {
307 307
       $newquota = $free + config('vmail_basequota');
308
-      if ($account['quota'] >= $oldaccount['quota'] && $newquota < $oldaccount['quota']) {
308
+      if (isset($oldaccount) && $account['quota'] >= $oldaccount['quota'] && $newquota < $oldaccount['quota']) {
309 309
         # Wenn das Limit künstlich reduziert wurde, dann maximal auf den alten Wert.
310 310
         $newquota = $oldaccount['quota'];
311 311
       }
Browse code

Copyright year update

Bernd Wurst authored on13/01/2018 06:07:05
Showing1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2014 by schokokeks.org Hosting, namely
5
+Written 2008-2018 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Hotfix: Never lower mailbox quotas to ridiculous small/negative values. Never silently drop space below previous quota

Bernd Wurst authored on05/01/2018 14:52:18
Showing1 changed files
... ...
@@ -193,7 +193,7 @@ function get_max_mailboxquota($server, $oldquota) {
193 193
   $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));
194 194
   $item = $result->fetch();
195 195
   DEBUG("Free space: ".$item['free']." / Really: ".($item['free'] + ($oldquota - config('vmail_basequota'))));
196
-  return $item['free'] + ($oldquota - config('vmail_basequota'));
196
+  return max(0, $item['free'] + ($oldquota - config('vmail_basequota')));
197 197
 }
198 198
 
199 199
 
... ...
@@ -305,6 +305,10 @@ function save_vmail_account($account)
305 305
     $newquota = max((int) config('vmail_basequota'), (int) $account['quota']);
306 306
     if ($newquota > config('vmail_basequota') && $newquota > ($free+config('vmail_basequota'))) {
307 307
       $newquota = $free + config('vmail_basequota');
308
+      if ($account['quota'] >= $oldaccount['quota'] && $newquota < $oldaccount['quota']) {
309
+        # Wenn das Limit künstlich reduziert wurde, dann maximal auf den alten Wert.
310
+        $newquota = $oldaccount['quota'];
311
+      }
308 312
       warning("Ihr Speicherplatz reicht für diese Postfach-Größe nicht mehr aus. Ihr Postfach wurde auf {$newquota} MB reduziert. Bitte beachten Sie, dass damit Ihr Benutzerkonto keinen freien Speicherplatz mehr aufweist!");
309 313
     }
310 314
   
Browse code

fehlende for-Schleife eingebaut

Bernd Wurst authored on23/10/2017 10:17:50
Showing1 changed files
... ...
@@ -263,10 +263,12 @@ function save_vmail_account($account)
263 263
   $forwards = array();
264 264
   if (count($account['forwards']) > 0) 
265 265
   {
266
+    for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
266 267
       $account['forwards'][$i]['destination'] = filter_input_general($account['forwards'][$i]['destination']);
267 268
       if (! check_emailaddr($account['forwards'][$i]['destination'])) {
268 269
         system_failure('Das Weiterleitungs-Ziel »'.$account['forwards'][$i]['destination'].'« ist keine E-Mail-Adresse!');
269 270
       }
271
+    }
270 272
   }
271 273
 
272 274
   if ($accountlogin) {
Bernd Wurst authored on22/03/2017 09:03:56
Showing1 changed files
... ...
@@ -383,6 +383,9 @@ function save_vmail_account($account)
383 383
   {
384 384
     $forward_query = "INSERT INTO mail.vmail_forward (account,destination) VALUES (:account, :destination)";
385 385
     for ($i=0;$i < count($account['forwards']); $i++) { 
386
+      if (! isset($account['forwards'][$i]['destination'])) {
387
+        continue;
388
+      }
386 389
       db_query($forward_query, array(":account" => $id, ":destination" => $account['forwards'][$i]['destination']));
387 390
     }
388 391
   }
Browse code

Alle Optionen bzgl. Spamfilter entfernt, der ist jetzt obligatorisch und lehnt auf SMTP-Ebene ab

Bernd Wurst authored on02/03/2017 15:52:13
Showing1 changed files
... ...
@@ -22,21 +22,9 @@ require_once('hasdomain.php');
22 22
 require_once('common.php');
23 23
 
24 24
 
25
-$forced_spamfilter_domains = array(
26
-  't-online.de', 'gmx.de', 'gmx.net', 'web.de', 'gmail.com', 'googlemail.com',
27
-  'googlemail.de', 'freenet.de', 'aol.com', 'yahoo.com', 'gmx.at', 'ymail.com', 
28
-  'hotmail.com', 'mail.de', 'email.de', 'online.de', 'outlook.com', 'me.com', 'yahoo.de'
29
-  );
30
-
31
-
32 25
 function forward_type($target) {
33
-  global $forced_spamfilter_domains;
34 26
   list($l, $d) = explode('@', strtolower($target), 2);
35 27
   DEBUG('Weiterleitung an '.$l.' @ '.$d);
36
-  if (in_array($d, $forced_spamfilter_domains)) {
37
-    // Domain in der Liste => Spam darf nicht weiter geleitet werden
38
-    return 'critical';
39
-  }
40 28
   $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", array($d));
41 29
   if ($result->rowCount() > 0) {
42 30
     // Lokale Domain
... ...
@@ -56,8 +44,6 @@ function empty_account()
56 44
 		'domain' => NULL,
57 45
 		'password' => NULL,
58 46
     'smtpreply' => NULL,
59
-		'spamfilter' => 'folder',
60
-		'spamexpire' => 7,
61 47
     'quota' => config('vmail_basequota'),
62 48
     'quota_threshold' => 20,
63 49
 		'forwards' => array(),
... ...
@@ -102,7 +88,7 @@ function get_account_details($id, $checkuid = true)
102 88
     $uid_check = "useraccount=:uid AND ";
103 89
     $args[":uid"] = $uid;
104 90
   }
105
-  $result = db_query("SELECT id, local, domain, password, smtpreply, spamfilter, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
91
+  $result = db_query("SELECT id, local, domain, password, smtpreply, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
106 92
 	if ($result->rowCount() == 0)
107 93
 		system_failure('Ungültige ID oder kein eigener Account');
108 94
 	$acc = empty_account();
... ...
@@ -113,9 +99,9 @@ function get_account_details($id, $checkuid = true)
113 99
 	  $acc[$key] = $value;
114 100
 	}
115 101
 	if ($acc['forwards'] > 0) {
116
-	  $result = db_query("SELECT id, spamfilter, destination FROM mail.vmail_forward WHERE account=?", array($acc['id']));
102
+	  $result = db_query("SELECT id, destination FROM mail.vmail_forward WHERE account=?", array($acc['id']));
117 103
 	  while ($item = $result->fetch()){
118
-	    array_push($acc['forwards'], array("id" => $item['id'], 'spamfilter' => $item['spamfilter'], 'destination' => $item['destination']));
104
+	    array_push($acc['forwards'], array("id" => $item['id'], 'destination' => $item['destination']));
119 105
 	  }
120 106
 	}
121 107
   if ($acc['autoresponder'] > 0) {
... ...
@@ -277,16 +263,10 @@ function save_vmail_account($account)
277 263
   $forwards = array();
278 264
   if (count($account['forwards']) > 0) 
279 265
   {
280
-    for ($i=0;$i < count($account['forwards']); $i++)
281
-    {
282
-      if ($account['forwards'][$i]['spamfilter'] != 'tag' && $account['forwards'][$i]['spamfilter'] != 'delete') {
283
-        $account['forwards'][$i]['spamfilter'] = NULL;
284
-      }
285 266
       $account['forwards'][$i]['destination'] = filter_input_general($account['forwards'][$i]['destination']);
286 267
       if (! check_emailaddr($account['forwards'][$i]['destination'])) {
287 268
         system_failure('Das Weiterleitungs-Ziel »'.$account['forwards'][$i]['destination'].'« ist keine E-Mail-Adresse!');
288 269
       }
289
-    }
290 270
   }
291 271
 
292 272
   if ($accountlogin) {
... ...
@@ -311,20 +291,6 @@ function save_vmail_account($account)
311 291
     }
312 292
   }  
313 293
 
314
-  $spam = NULL;
315
-  switch ($account['spamfilter'])
316
-  {
317
-    case 'folder':
318
-      $spam = "folder";
319
-      break;
320
-    case 'tag':
321
-      $spam = "tag";
322
-      break;
323
-    case 'delete':
324
-      $spam = "delete";
325
-      break;
326
-  }
327
-  
328 294
   if (!$accountlogin) {
329 295
     $free = config('vmail_basequota');
330 296
     if ($newaccount) {
... ...
@@ -351,7 +317,6 @@ function save_vmail_account($account)
351 317
   }
352 318
   
353 319
   $account['local'] = strtolower($account['local']);
354
-  $account['spamexpire'] = (int) $account['spamexpire'];
355 320
   # Leerstring wird zu NULL
356 321
   $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : NULL);
357 322
 
... ...
@@ -359,8 +324,6 @@ function save_vmail_account($account)
359 324
                 ":domain" => $account['domain'],
360 325
                 ":password" => $password,
361 326
                 ":smtpreply" => $account['smtpreply'],
362
-                ":spamfilter" => $spam,
363
-                ":spamexpire" => $account['spamexpire'],
364 327
                 ":quota" => $account['quota'], 
365 328
                 ":quota_threshold" => $account['quota_threshold'],
366 329
                 ":id" => $id
... ...
@@ -369,7 +332,7 @@ function save_vmail_account($account)
369 332
   if ($newaccount)
370 333
   {
371 334
     unset($args[":id"]);
372
-    $query = "INSERT INTO mail.vmail_accounts (local, domain, spamfilter, spamexpire, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :spamfilter, :spamexpire, :password, :smtpreply, :quota, :quota_threshold)";
335
+    $query = "INSERT INTO mail.vmail_accounts (local, domain, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :password, :smtpreply, :quota, :quota_threshold)";
373 336
   } else {
374 337
     if ($set_password)
375 338
       $pw=", password=:password";
... ...
@@ -377,7 +340,7 @@ function save_vmail_account($account)
377 340
       unset($args[":password"]);
378 341
       $pw='';
379 342
     }
380
-    $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, spamfilter=:spamfilter, spamexpire=:spamexpire, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
343
+    $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
381 344
   }
382 345
   db_query($query, $args); 
383 346
   if ($newaccount) {
... ...
@@ -412,19 +375,18 @@ function save_vmail_account($account)
412 375
     
413 376
 
414 377
 
415
-  if (! $newaccount)
378
+  if (! $newaccount) {
416 379
     db_query("DELETE FROM mail.vmail_forward WHERE account=?", array($id));
380
+   }
417 381
 
418 382
   if (count($account['forwards']) > 0)
419 383
   {
420
-    $forward_query = "INSERT INTO mail.vmail_forward (account,spamfilter,destination) VALUES (:account, :spamfilter, :destination)";
421
-    for ($i=0;$i < count($account['forwards']); $i++)
422
-    { 
423
-      db_query($forward_query, array(":account" => $id, ":spamfilter" => $account['forwards'][$i]['spamfilter'], ":destination" => $account['forwards'][$i]['destination']));
384
+    $forward_query = "INSERT INTO mail.vmail_forward (account,destination) VALUES (:account, :destination)";
385
+    for ($i=0;$i < count($account['forwards']); $i++) { 
386
+      db_query($forward_query, array(":account" => $id, ":destination" => $account['forwards'][$i]['destination']));
424 387
     }
425 388
   }
426
-  if ($newaccount && $password)
427
-  {
389
+  if ($newaccount && $password) {
428 390
     $servername = get_server_by_id($server);
429 391
     $emailaddr = 'vmail-'.$account['local'].'%'.$domainname.'@'.$servername;
430 392
     $username = $account['local'].'@'.$domainname;
Browse code

Verständliche Fehlermeldung, wenn man eine bereits existierende E-Mail-Adresse nochmals anlegen möchte

Bernd Wurst authored on07/07/2016 04:20:19
Showing1 changed files
... ...
@@ -268,6 +268,10 @@ function save_vmail_account($account)
268 268
       system_failure('Bitte wählen Sie eine Ihrer Domains aus!');
269 269
       return false;
270 270
     }
271
+    if ($id == NULL && get_vmail_id_by_emailaddr($account['local'].'@'.$domainname)) {
272
+      system_failure('Diese E-Mail-Adresse gibt es bereits.');
273
+      return false;
274
+    }
271 275
   }
272 276
   
273 277
   $forwards = array();
Browse code

Auch yahoo.de soll nicht ohne Spamfilter funktionieren

Bernd Wurst authored on22/07/2014 14:52:43
Showing1 changed files
... ...
@@ -25,7 +25,7 @@ require_once('common.php');
25 25
 $forced_spamfilter_domains = array(
26 26
   't-online.de', 'gmx.de', 'gmx.net', 'web.de', 'gmail.com', 'googlemail.com',
27 27
   'googlemail.de', 'freenet.de', 'aol.com', 'yahoo.com', 'gmx.at', 'ymail.com', 
28
-  'hotmail.com', 'mail.de', 'email.de', 'online.de', 'outlook.com', 'me.com'
28
+  'hotmail.com', 'mail.de', 'email.de', 'online.de', 'outlook.com', 'me.com', 'yahoo.de'
29 29
   );
30 30
 
31 31
 
Browse code

Update auf nicht mehr so neue Rechtschreibung

Bernd Wurst authored on22/07/2014 12:23:59
Showing1 changed files
... ...
@@ -238,7 +238,7 @@ function save_vmail_account($account)
238 238
     if ($account['quota'] != $oldaccount['quota'])
239 239
       system_failure('Sie können Ihren eigenen Speicherplatz nicht verändern.');
240 240
     if ($account['smtpreply'] != NULL) {
241
-      system_failure("Sie können nicht den Account stillegen mit dem Sie grade angemeldet sind.");
241
+      system_failure("Sie können nicht den Account stilllegen mit dem Sie grade angemeldet sind.");
242 242
     }
243 243
   } else {
244 244
   
Browse code

SMTP-seitige Autoresponder als "Stillegung" implementiert

Bernd Wurst authored on22/07/2014 11:47:11
Showing1 changed files
... ...
@@ -55,6 +55,7 @@ function empty_account()
55 55
 		'local' => '',
56 56
 		'domain' => NULL,
57 57
 		'password' => NULL,
58
+    'smtpreply' => NULL,
58 59
 		'spamfilter' => 'folder',
59 60
 		'spamexpire' => 7,
60 61
     'quota' => config('vmail_basequota'),
... ...
@@ -101,7 +102,7 @@ function get_account_details($id, $checkuid = true)
101 102
     $uid_check = "useraccount=:uid AND ";
102 103
     $args[":uid"] = $uid;
103 104
   }
104
-  $result = db_query("SELECT id, local, domain, password, spamfilter, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
105
+  $result = db_query("SELECT id, local, domain, password, smtpreply, spamfilter, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
105 106
 	if ($result->rowCount() == 0)
106 107
 		system_failure('Ungültige ID oder kein eigener Account');
107 108
 	$acc = empty_account();
... ...
@@ -236,6 +237,9 @@ function save_vmail_account($account)
236 237
       system_failure('Sie können die E-Mail-Adresse nicht ändern!');
237 238
     if ($account['quota'] != $oldaccount['quota'])
238 239
       system_failure('Sie können Ihren eigenen Speicherplatz nicht verändern.');
240
+    if ($account['smtpreply'] != NULL) {
241
+      system_failure("Sie können nicht den Account stillegen mit dem Sie grade angemeldet sind.");
242
+    }
239 243
   } else {
240 244
   
241 245
     $account['local'] = filter_input_username($account['local']);
... ...
@@ -344,10 +348,13 @@ function save_vmail_account($account)
344 348
   
345 349
   $account['local'] = strtolower($account['local']);
346 350
   $account['spamexpire'] = (int) $account['spamexpire'];
351
+  # Leerstring wird zu NULL
352
+  $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : NULL);
347 353
 
348 354
   $args = array(":local" => $account['local'],
349 355
                 ":domain" => $account['domain'],
350 356
                 ":password" => $password,
357
+                ":smtpreply" => $account['smtpreply'],
351 358
                 ":spamfilter" => $spam,
352 359
                 ":spamexpire" => $account['spamexpire'],
353 360
                 ":quota" => $account['quota'], 
... ...
@@ -358,7 +365,7 @@ function save_vmail_account($account)
358 365
   if ($newaccount)
359 366
   {
360 367
     unset($args[":id"]);
361
-    $query = "INSERT INTO mail.vmail_accounts (local, domain, spamfilter, spamexpire, password, quota, quota_threshold) VALUES (:local, :domain, :spamfilter, :spamexpire, :password, :quota, :quota_threshold)";
368
+    $query = "INSERT INTO mail.vmail_accounts (local, domain, spamfilter, spamexpire, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :spamfilter, :spamexpire, :password, :smtpreply, :quota, :quota_threshold)";
362 369
   } else {
363 370
     if ($set_password)
364 371
       $pw=", password=:password";
... ...
@@ -366,7 +373,7 @@ function save_vmail_account($account)
366 373
       unset($args[":password"]);
367 374
       $pw='';
368 375
     }
369
-    $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, spamfilter=:spamfilter, spamexpire=:spamexpire, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
376
+    $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, spamfilter=:spamfilter, spamexpire=:spamexpire, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
370 377
   }
371 378
   db_query($query, $args); 
372 379
   if ($newaccount) {
Browse code

Autoresponder nur noch befristet auf 60 Tage möglich

Bernd Wurst authored on15/05/2014 07:34:16
Showing1 changed files
... ...
@@ -375,11 +375,13 @@ function save_vmail_account($account)
375 375
 
376 376
   if (is_array($account['autoresponder'])) {
377 377
     $ar = $account['autoresponder'];
378
-    $quote = "inline";
378
+    $quote = NULL;
379 379
     if ($ar['quote'] == 'attach')
380 380
       $quote = "attach";
381
-    elseif ($ar['quote'] == NULL)
382
-      $quote = NULL;
381
+    elseif ($ar['quote'] == 'inline')
382
+      $quote = 'inline';
383
+    elseif ($ar['quote'] == 'teaser')
384
+      $quote = 'teaser';
383 385
     if (! check_emailaddr($ar['fromaddr'])) {
384 386
       input_error("Die Absenderadresse sieht ungültig aus. Es wird Ihre E-Mail-Adresse benutzt!");
385 387
       $ar['fromaddr'] = NULL;
Browse code

Bugfix: Autoresponder-From-Adresse wurde auf "1" gesetzt. (next try)

Bernd Wurst authored on13/02/2014 07:38:42
Showing1 changed files
... ...
@@ -390,7 +390,7 @@ function save_vmail_account($account)
390 390
                   ":valid_from" => $ar['valid_from'],
391 391
                   ":valid_until" => $ar['valid_until'],
392 392
                   ":fromname" => $ar['fromname'],
393
-                  ":fromaddr" => check_emailaddr($ar['fromaddr']),
393
+                  ":fromaddr" => $ar['fromaddr'],
394 394
                   ":subject" => $ar['subject'],
395 395
                   ":message" => $ar['message'],
396 396
                   ":quote" => $quote);
Browse code

Bugfix: Autoresponder-From-Adresse wurde auf "1" gesetzt.

Bernd Wurst authored on12/02/2014 18:12:07
Showing1 changed files
... ...
@@ -380,6 +380,10 @@ function save_vmail_account($account)
380 380
       $quote = "attach";
381 381
     elseif ($ar['quote'] == NULL)
382 382
       $quote = NULL;
383
+    if (! check_emailaddr($ar['fromaddr'])) {
384
+      input_error("Die Absenderadresse sieht ungültig aus. Es wird Ihre E-Mail-Adresse benutzt!");
385
+      $ar['fromaddr'] = NULL;
386
+    }
383 387
     $query = "REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
384 388
              "VALUES (:id, :valid_from, :valid_until, :fromname, :fromaddr, :subject, :message, :quote)";
385 389
     $args = array(":id" => $id,
Browse code

gmail war dopelt in der blacklist

Bernd Wurst authored on09/02/2014 20:33:10
Showing1 changed files
... ...
@@ -24,9 +24,8 @@ require_once('common.php');
24 24
 
25 25
 $forced_spamfilter_domains = array(
26 26
   't-online.de', 'gmx.de', 'gmx.net', 'web.de', 'gmail.com', 'googlemail.com',
27
-  'gmail.com', 'googlemail.de', 'freenet.de', 'aol.com', 'yahoo.com', 'gmx.at', 
28
-  'ymail.com', 'hotmail.com', 'mail.de', 'email.de', 'online.de', 'outlook.com',
29
-  'me.com'
27
+  'googlemail.de', 'freenet.de', 'aol.com', 'yahoo.com', 'gmx.at', 'ymail.com', 
28
+  'hotmail.com', 'mail.de', 'email.de', 'online.de', 'outlook.com', 'me.com'
30 29
   );
31 30
 
32 31
 
Browse code

Zeige Benutzeraccount-Stammdaten auf der Startseite

Bernd Wurst authored on08/02/2014 14:24:06
Showing1 changed files
... ...
@@ -24,13 +24,15 @@ require_once('common.php');
24 24
 
25 25
 $forced_spamfilter_domains = array(
26 26
   't-online.de', 'gmx.de', 'gmx.net', 'web.de', 'gmail.com', 'googlemail.com',