]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Fix for fatal error and naming convention applied
[mailer.git] / inc / functions.php
index 637412fc66ae8626244eebb5df5c42150225fc59..66614abbb7ad6e4637240e26f250ed785d8e29be 100644 (file)
@@ -1715,7 +1715,7 @@ function extractHostnameFromUrl (&$script) {
        $url = constant('SERVER_URL');
 
        // Is this URL valid?
-       if (substr($script, 0, 7) == "http://") {
+       if (substr($script, 0, 7) == 'http://') {
                // Use the hostname from script URL as new hostname
                $url = substr($script, 7);
                $extract = explode('/', $url);
@@ -1724,12 +1724,12 @@ function extractHostnameFromUrl (&$script) {
        } // END - if
 
        // Extract host name
-       $host = str_replace("http://", '', $url);
+       $host = str_replace('http://', '', $url);
        if (ereg('/', $host)) $host = substr($host, 0, strpos($host, '/'));
 
        // Generate relative URL
        //* DEBUG: */ print("SCRIPT=".$script."<br />\n");
-       if (substr(strtolower($script), 0, 7) == "http://") {
+       if (substr(strtolower($script), 0, 7) == 'http://') {
                // But only if http:// is in front!
                $script = substr($script, (strlen($url) + 7));
        } elseif (substr(strtolower($script), 0, 8) == "https://") {
@@ -1827,9 +1827,11 @@ function sendRawRequest ($host, $request) {
 
        // Open connection
        //* DEBUG: */ die("SCRIPT=".$script."<br />\n");
-       if ($useProxy) {
-               $fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), getConfig('proxy_port'), $errno, $errdesc, 30);
+       if ($useProxy === true) {
+               // Connect to host through proxy connection
+               $fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
        } else {
+               // Connect to host directly
                $fp = @fsockopen($host, 80, $errno, $errdesc, 30);
        }
 
@@ -1840,7 +1842,7 @@ function sendRawRequest ($host, $request) {
        } // END - if
 
        // Do we use proxy?
-       if ($useProxy) {
+       if ($useProxy === true) {
                // Generate CONNECT request header
                $proxyTunnel  = "CONNECT " . $host . ":80 HTTP/1.1" . getConfig('HTTP_EOL');
                $proxyTunnel .= "Host: " . $host . getConfig('HTTP_EOL');
@@ -1848,7 +1850,7 @@ function sendRawRequest ($host, $request) {
                // Use login data to proxy? (username at least!)
                if (getConfig('proxy_username') != '') {
                        // Add it as well
-                       $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).getConfig('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password')));
+                       $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')) . getConfig('ENCRYPT_SEPERATOR') . COMPILE_CODE(getConfig('proxy_password')));
                        $proxyTunnel .= "Proxy-Authorization: Basic " . $encodedAuth . getConfig('HTTP_EOL');
                } // END - if
 
@@ -1904,7 +1906,7 @@ function sendRawRequest ($host, $request) {
        //* DEBUG: */ print("<strong>Response:</strong><pre>".print_r($response, true)."</pre>");
 
        // Proxy agent found?
-       if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy)) {
+       if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy === true)) {
                // Proxy header detected, so remove two lines
                array_shift($response);
                array_shift($response);