From: quix0r 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=57cb7cb4893a6878bd9830738007d1bce547131b;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) {