From 2079caea145198b101497bbb2803666a448f177a Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sun, 26 Aug 2018 19:49:39 +0000
Subject: [PATCH] Issue 3501: Mail contacts can be added again

---
 src/Module/Proxy.php  | 2 +-
 src/Network/Probe.php | 3 ++-
 src/Util/Network.php  | 6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/Module/Proxy.php b/src/Module/Proxy.php
index bf6d6b6d03..ccd00c6040 100644
--- a/src/Module/Proxy.php
+++ b/src/Module/Proxy.php
@@ -45,7 +45,7 @@ class Proxy extends BaseModule
 		 *
 		 * Question: Do we really need these three methods?
 		 */
-		if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
+		if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
 			header('HTTP/1.1 304 Not Modified');
 			header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
 			header('Etag: ' . $_SERVER['HTTP_IF_NONE_MATCH']);
diff --git a/src/Network/Probe.php b/src/Network/Probe.php
index 258bb6c628..408fd01dcb 100644
--- a/src/Network/Probe.php
+++ b/src/Network/Probe.php
@@ -1604,7 +1604,8 @@ class Probe
 		$user = DBA::selectFirst('user', ['prvkey'], ['uid' => $uid]);
 
 		$condition = ["`uid` = ? AND `server` != ''", $uid];
-		$mailacct = DBA::selectFirst('mailacct', ['pass', 'user'], $condition);
+		$fields = ['pass', 'user', 'server', 'port', 'ssltype', 'mailbox'];
+		$mailacct = DBA::selectFirst('mailacct', $fields, $condition);
 
 		if (!DBA::isResult($user) || !DBA::isResult($mailacct)) {
 			return false;
diff --git a/src/Util/Network.php b/src/Util/Network.php
index 49ed03dc3e..0de9661859 100644
--- a/src/Util/Network.php
+++ b/src/Util/Network.php
@@ -561,12 +561,12 @@ class Network
 	public static function isUrlBlocked($url)
 	{
 		$host = @parse_url($url, PHP_URL_HOST);
-		if (! $host) {
-			return true;
+		if (!$host) {
+			return false;
 		}
 
 		$domain_blocklist = Config::get('system', 'blocklist', []);
-		if (! $domain_blocklist) {
+		if (!$domain_blocklist) {
 			return false;
 		}