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

Bernd Wurst commited on 2017-03-21 07:20:25
Zeige 7 geänderte Dateien mit 20 Einfügungen und 170 Löschungen.

... ...
@@ -1,26 +0,0 @@
1
-<?php
2
-/*
3
-This file belongs to the Webinterface of schokokeks.org Hosting
4
-
5
-Written 2008-2014 by schokokeks.org Hosting, namely
6
-  Bernd Wurst <bernd@schokokeks.org>
7
-  Hanno Böck <hanno@schokokeks.org>
8
-
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
-
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12
-http://creativecommons.org/publicdomain/zero/1.0/
13
-
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.
15
-*/
16
-
17
-require_once('vmail.php');
18
-
19
-$email = filter_var($_REQUEST['target'], FILTER_VALIDATE_EMAIL);
20
-$type = forward_type($email);
21
-
22
-header("Content-Type: application/json");
23
-echo ' { "target": "'.$email.'", "type": "'.$type.'" } ';
24
-die();
25
-
26
-
... ...
@@ -115,42 +115,6 @@ function hideUnchecked() {
115 115
 }
116 116
 
117 117
 
118
-function checkForwardCallback( result ) {
119
-  target = result.target;
120
-  type = result.type;
121
-  element = null;
122
-  $('div.vmail-forward input').each(function () {
123
-    if ($(this).val() == target) {
124
-      element = $(this).closest('div.vmail-forward');
125
-    }
126
-  });
127
-  if (! element) {
128
-    // Der User hat noch weiter getippt
129
-    return;
130
-  }
131
-  if (type == 'critical') {
132
-    element.find('select option[value="delete"]').prop('selected', true);
133
-    element.find('select option[value="none"]').prop('disabled', true);
134
-    element.find('select option[value="tag"]').prop('disabled', true);
135
-    element.find('select option[value="delete"]').prop('disabled', false);
136
-    element.find('.warning').text('Weiterleitungen zu einigen großen E-Mail-Providern dürfen nur mit aktiviertem Spamfilter eingerichtet werden.');
137
-    element.find('.warning').show()
138
-  } else if (type == 'local') {
139
-    //element.find('select option[value="none"]').prop('selected', true);
140
-    element.find('select option[value="none"]').prop('disabled', false);
141
-    element.find('select option[value="tag"]').prop('disabled', false);
142
-    element.find('select option[value="delete"]').prop('disabled', false);
143
-    element.find('.warning').hide()
144
-  } else {
145
-    //element.find('select option[value="delete"]').prop('selected', true);
146
-    element.find('select option[value="none"]').prop('disabled', false);
147
-    element.find('select option[value="tag"]').prop('disabled', false);
148
-    element.find('select option[value="delete"]').prop('disabled', false);
149
-    element.find('.warning').hide()
150
-  }
151
-  $('#submit').prop('disabled', false);
152
-}
153
-
154 118
 function checkForward( ) {
155 119
   input = $(this);
156 120
   val = input.val();
... ...
@@ -160,11 +124,6 @@ function checkForward( ) {
160 124
     return;
161 125
   }
162 126
   div = input.closest('div.vmail-forward');
163
-  $('#submit').prop('disabled', true);
164
-  $.getJSON("checkforward?target="+val, checkForwardCallback)
165
-    .fail( function () {
166
-      $('#submit').prop('disabled', false);
167
-      });
168 127
 }
169 128
 
170 129
 
... ...
@@ -62,9 +62,7 @@ $numforwards = max(count($account['forwards']), 1);
62 62
 
63 63
 $form = '';
64 64
 
65
-if ($accountlogin) {
66
-  $form.= "<p class=\"spamfilter_options\">Unerwünschte E-Mails (Spam, Viren) in diesem Postfach ".html_select('spamfilter_action', array("none" => 'nicht filtern', "folder" => 'in Unterordner »Spam« ablegen', "tag" => 'markieren und zustellen', "delete" => 'nicht zustellen (löschen)'), $account['spamfilter'])."</p>";
67
-} else {
65
+if (! $accountlogin) {
68 66
   if ($id != 0) {
69 67
     $domainlist = get_vmail_domains();
70 68
     $domain = NULL;
... ...
@@ -96,8 +94,6 @@ if ($accountlogin) {
96 94
     <div style=\"margin-left: 2em;\" id=\"mailbox_config\" class=\"option_group\">
97 95
     <p>Passwort für Abruf:&#160;<input style=\"color: #aaa;\" type=\"password\" id=\"password\" name=\"password\" value=\"{$password_value}\" />{$password_message}</p>";
98 96
 
99
-  $form.= "<p class=\"spamfilter_options\">Unerwünschte E-Mails (Spam, Viren) in diesem Postfach ".html_select('spamfilter_action', array("none" => 'nicht filtern', "folder" => 'in Unterordner »Spam« ablegen', "tag" => 'markieren und zustellen', "delete" => 'nicht zustellen (löschen)'), $account['spamfilter'])."</p>";
100
-
101 97
   $quota = config('vmail_basequota');
102 98
   if ($is_mailbox and $account['quota']) {
103 99
     $quota = $account['quota'];
... ...
@@ -204,11 +200,11 @@ $form .= "<div style=\"margin-left: 2em;\" id=\"forward_config\" class=\"option_
204 200
 $form .= '<div id="forward_entries">
205 201
 ';
206 202
 if (! isset($account['forwards'][0])) {
207
-  $account['forwards'][0] = array('destination' => '', 'spamfilter' => 'delete');
203
+  $account['forwards'][0] = array('destination' => '');
208 204
 }
209 205
 while (count($account['forwards']) < 10) {
210 206
   // Dummy-Einträge für Leute ohne JavaScript
211
-  $account['forwards'][] = array('destination' => '', 'spamfilter' => 'delete');
207
+  $account['forwards'][] = array('destination' => '');
212 208
 }
213 209
 for ($i = 0 ; $i < max($numforwards,10) ; $i++)
214 210
 {
... ...
@@ -216,9 +212,6 @@ for ($i = 0 ; $i < max($numforwards,10) ; $i++)
216 212
   $form .= "<div class=\"vmail-forward\" id=\"vmail_forward_{$num}\">
217 213
   <div style=\"float: right;\" class=\"delete_forward\">".icon_delete("Diese Weiterleitung entfernen")."</div>
218 214
   <p>Weiterleiten an <input type=\"text\" id=\"forward_to_{$num}\" name=\"forward_to_{$num}\" value=\"{$account['forwards'][$i]['destination']}\" /></p>
219
-  <p>Spam-Mails an diese Adresse ".html_select('spamfilter_action_'.$num, array("none" => 'nicht filtern', "tag" => 'markieren und zustellen', "delete" => 'nicht zustellen'), $account['forwards'][$i]['spamfilter'])."</p>
220
-  <p class=\"warning\" style=\"display: none;\"></p>
221
-  <p>Bitte beachten Sie unsere Hinweise zu <a href=\"https://wiki.schokokeks.org/E-Mail/Weiterleitungen\">Weiterleitungen und Spamfiltern</a>.</p>
222 215
   </div>\n";
223 216
 }
224 217
 $form .= '</div>';
... ...
@@ -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,17 +263,11 @@ 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 270
   }
290
-  }
291 271
 
292 272
   if ($accountlogin) {
293 273
     $password = NULL; 
... ...
@@ -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;
... ...
@@ -60,7 +60,6 @@ if ($_GET['action'] == 'edit')
60 60
     if ($_POST['mailbox'] != 'yes')
61 61
     {
62 62
       $account['password'] = NULL;
63
-      $account['spamfilter'] = 'none';
64 63
     }
65 64
     if (isset($_POST['quota'])) {
66 65
       $account['quota'] = $_POST['quota'];
... ...
@@ -72,7 +71,6 @@ if ($_GET['action'] == 'edit')
72 71
     }
73 72
 
74 73
   }
75
-  $account['spamfilter'] = $_POST['spamfilter_action'];
76 74
 
77 75
   $ar = empty_autoresponder_config();
78 76
   $valid_from_date = time();
... ...
@@ -158,10 +156,10 @@ if ($_GET['action'] == 'edit')
158 156
     while (true)
159 157
     {
160 158
       // Die ersten 50 Einträge in jedem Fall prüfen, danach nur so lange zusätzliche Einträge vorhanden
161
-      if (! isset($_POST['forward_to_'.$num]) && ! isset($_POST['spamfilter_action_'.$num]) && $num > 50)
159
+      if (! isset($_POST['forward_to_'.$num])) && $num > 50)
162 160
         break;
163 161
       if (isset($_POST['forward_to_'.$num]) && chop($_POST['forward_to_'.$num]) != '') {
164
-        $fwd = array("spamfilter" => $_POST['spamfilter_action_'.$num], "destination" => chop($_POST['forward_to_'.$num]));
162
+        $fwd = array("destination" => chop($_POST['forward_to_'.$num]));
165 163
         array_push($account['forwards'], $fwd);
166 164
       }
167 165
       $num++;
... ...
@@ -89,17 +89,7 @@ if (count($domains) > 0)
89 89
                 $color = ( $percent > 95 ? 'red' : ($percent > 75 ? "yellow" : "green" ));
90 90
                 $width = 2 * min($percent, 100);
91 91
                 $quotachart = "<div style=\"margin: 2px 0; padding: 0; width: 200px; border: 1px solid black;\"><div style=\"font-size: 1px; background-color: {$color}; height: 10px; width: {$width}px; margin: 0; padding: 0;\">&#160;</div></div> {$acc['quota_used']} MB von {$acc['quota']} MB belegt";
92
-	      	$spam = 'ohne Spamfilter';
93
-	        switch ($acc['spamfilter'])
94
-	  	{
95
-		        case 'folder':  $spam = 'Spam in Unterordner';
96
-					break;
97
-			case 'tag':	$spam = 'Spam markieren';
98
-					break;
99
-			case 'delete':	$spam = 'Spam nicht zustellen';
100
-					break;
101
-	        }
102
-	        array_push($actions, "Ablegen in Mailbox ({$spam})<br />".$quotachart);
92
+	        array_push($actions, "Ablegen in Mailbox<br />".$quotachart);
103 93
 	      }
104 94
         if ($acc['autoresponder']) {
105 95
             $now = date( 'Y-m-d' );
... ...
@@ -122,16 +112,8 @@ if (count($domains) > 0)
122 112
         }
123 113
 	      foreach ($acc['forwards'] AS $fwd)
124 114
 	      {
125
-	      	$spam = 'ohne Spamfilter';
126
-	        switch ($fwd['spamfilter'])
127
-	  	{
128
-			case 'tag':	$spam = 'Spam markieren';
129
-					break;
130
-			case 'delete':	$spam = 'Spam nicht zustellen';
131
-					break;
132
-	        }
133 115
 		$fwd['destination'] = filter_input_general($fwd['destination']);
134
-	        array_push($actions, "Weiterleitung an <strong>{$fwd['destination']}</strong> ({$spam})");
116
+	        array_push($actions, "Weiterleitung an <strong>{$fwd['destination']}</strong>");
135 117
 	      }
136 118
 	      $dest = '';
137 119
 	      if (count($actions) > 0)
... ...
@@ -36,17 +36,7 @@ $content .= "<div><div style=\"margin: 2px 0; padding: 0; width: 200px; border:
36 36
 $content .= '<h3>Einstellungen</h3>
37 37
 <p>Eingehende E-Mails für Ihre Adresse werden wie folgt verarbeitet:</p>';
38 38
 
39
-$spam = 'ohne Spamfilter';
40
-switch ($acc['spamfilter'])
41
-{
42
-  case 'folder':  $spam = 'Spam in Unterordner';
43
-    break;
44
-	case 'tag':	$spam = 'Spam markieren';
45
-		break;
46
-	case 'delete':	$spam = 'Spam nicht zustellen';
47
-  	break;
48
-}
49
-$content .= '<p>'.other_icon('go.png')." Ablegen in Ihrer Mailbox ({$spam})</p>";
39
+$content .= '<p>'.other_icon('go.png')." Ablegen in Ihrer Mailbox</p>";
50 40
 
51 41
 
52 42
 if ($acc['autoresponder']) {
... ...
@@ -71,16 +61,8 @@ if ($acc['autoresponder']) {
71 61
 
72 62
 foreach ($acc['forwards'] AS $fwd)
73 63
 {
74
- 	$spam = 'ohne Spamfilter';
75
-  switch ($fwd['spamfilter'])
76
-	{
77
-	  case 'tag':	$spam = 'Spam markieren';
78
-			break;
79
-		case 'delete':	$spam = 'Spam nicht zustellen';
80
-			break;
81
-	}
82 64
 	$fwd['destination'] = filter_input_general($fwd['destination']);
83
-  $content .= '<p>'.other_icon('go.png')." Weiterleitung an <strong>{$fwd['destination']}</strong> ({$spam})</p>"; 
65
+  $content .= '<p>'.other_icon('go.png')." Weiterleitung an <strong>{$fwd['destination']}</strong></p>"; 
84 66
 }
85 67
 
86 68
 
87 69