From: Roland Häder Date: Thu, 14 Mar 2013 01:13:36 +0000 (+0000) Subject: Detect https and double-dot (port number) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ec3907de5b6c1ca85da82232707c85d22e197c11;p=mailer.git Detect https and double-dot (port number) --- diff --git a/inc/http-functions.php b/inc/http-functions.php index 8ae5daa783..8932af6288 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -650,11 +650,20 @@ function extractHostnameFromUrl (&$script) { } // END - if // Extract host name - $host = str_replace('http://', '', $url); + $host = str_replace(array('http://', 'https://'), array('', ''), $url); + + // Is there a slash at the end? if (isInString('/', $host)) { $host = substr($host, 0, strpos($host, '/')); } // END - if + // Is there a double-dot in? (Means port number) + if (strpos($host, ':') !== FALSE) { + // Detected a double-dot + $hostArray = explode(':', $host); + $host = $hostArray[0]; + } // END - if + // Generate relative URL //* DEBUG: */ debugOutput('SCRIPT=' . $script); if (substr(strtolower($script), 0, 7) == 'http://') { diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 683fc0d955..32ab18e167 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -88,8 +88,7 @@ function writeToFile ($FQFN, $content, $aquireLock = FALSE) { } } else { // Write it with fopen - $fp = fopen($FQFN, 'w') - or reportBug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($FQFN) . '!'); + $fp = fopen($FQFN, 'w') or reportBug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($FQFN) . '!'); // Aquire a lock? if ($aquireLock === TRUE) {