]> git.mxchange.org Git - mailer.git/commitdiff
Detect https and double-dot (port number)
authorquix0r <quix0r@mxchange.org>
Thu, 14 Mar 2013 01:13:36 +0000 (01:13 +0000)
committerquix0r <quix0r@mxchange.org>
Thu, 14 Mar 2013 01:13:36 +0000 (01:13 +0000)
inc/http-functions.php
inc/wrapper-functions.php

index 8ae5daa78323c9e8a7512fa57d550a51b938b1d5..8932af62882342f0f92a76a06851f3444404b592 100644 (file)
@@ -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://') {
index 683fc0d955cde726b5df2cf26774512b631de5df..32ab18e167a96d05d2579c18defc13ba5049175d 100644 (file)
@@ -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) {