Browse code

Vorbereitung für Warnungen bei "bösen" Weiterleitungen

Bernd Wurst authored on06/02/2014 17:22:56
Showing1 changed files
... ...
@@ -21,6 +21,32 @@ require_once('hasdomain.php');
21 21
 
22 22
 require_once('common.php');
23 23
 
24
+
25
+$forced_spamfilter_domains = array(
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'
28
+  );
29
+
30
+
31
+function forward_spamfilter_options($target) {
32
+  global $forced_spamfilter_domains;
33
+  list($l, $d) = explode('@', $target, 2);
34
+  DEBUG('Weiterleitung an '.$l.' @ '.$d);
35
+  if (in_array($d, $forced_spamfilter_domains)) {
36
+    // Domain in der Liste => Spam darf nicht weiter geleitet werden
37
+    return array(array('delete'), 'delete');
38
+  }
39
+  $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", array($d));
40
+  if ($result->rowCount() > 0) {
41
+    // Lokale Domain
42
+    return array(array('none', 'tag', 'delete'), 'none');
43
+  }  
44
+  // Auswärtige Domain aber keine aus der Liste
45
+  return array(array('none', 'tag', 'delete'), 'delete');
46
+}
47
+
48
+
49
+
24 50
 function empty_account()
25 51
 {
26 52
 	$account = array(
... ...
@@ -244,11 +270,13 @@ function save_vmail_account($account)
244 270
   {
245 271
     for ($i=0;$i < count($account['forwards']); $i++)
246 272
     {
247
-      if ($account['forwards'][$i]['spamfilter'] != 'tag' && $account['forwards'][$i]['spamfilter'] != 'delete')
273
+      if ($account['forwards'][$i]['spamfilter'] != 'tag' && $account['forwards'][$i]['spamfilter'] != 'delete') {
248 274
         $account['forwards'][$i]['spamfilter'] = NULL;
275
+      }
249 276
       $account['forwards'][$i]['destination'] = filter_input_general($account['forwards'][$i]['destination']);
250
-      if (! check_emailaddr($account['forwards'][$i]['destination']))
277
+      if (! check_emailaddr($account['forwards'][$i]['destination'])) {
251 278
         system_failure('Das Weiterleitungs-Ziel »'.$account['forwards'][$i]['destination'].'« ist keine E-Mail-Adresse!');
279
+      }
252 280
     }
253 281
   }
254 282
 
... ...
@@ -377,7 +405,7 @@ function save_vmail_account($account)
377 405
       db_query($forward_query, array(":account" => $id, ":spamfilter" => $account['forwards'][$i]['spamfilter'], ":destination" => $account['forwards'][$i]['destination']));
378 406
     }
379 407
   }
380
-  if ($newaccount && $password != 'NULL')
408
+  if ($newaccount && $password)
381 409
   {
382 410
     $servername = get_server_by_id($server);
383 411
     $emailaddr = 'vmail-'.$account['local'].'%'.$domainname.'@'.$servername;