If SERVER_NAME not set, use $domain as the domain in message-id.
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 27 Feb 2003 07:59:28 +0000 (07:59 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 27 Feb 2003 07:59:28 +0000 (07:59 +0000)
Convert the things to the sqGetGlobalVar function.
Remove someone's debug code.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4560 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/deliver/Deliver.class.php

index 8b9ae88ee4e646bf7c19845c836b99945d951227..4f98c7808c4713d9c89352071114fe0a4e1eebb1 100644 (file)
@@ -226,19 +226,20 @@ class Deliver {
     }    
 
     function prepareRFC822_Header($rfc822_header, $reply_rfc822_header, &$raw_length) {
-        $REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
-        $SERVER_NAME = $_SERVER['SERVER_NAME'];
-        $REMOTE_PORT = $_SERVER['REMOTE_PORT'];
-        if(isset($_SERVER['REMOTE_HOST'])) {
-            $REMOTE_HOST = $_SERVER['REMOTE_HOST'];
-        }
-        if(isset($_SERVER['HTTP_VIA'])) {
-            $HTTP_VIA = $_SERVER['HTTP_VIA'];
-        }
-        if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-            $HTTP_X_FORWARDED_FOR = $_SERVER['HTTP_X_FORWARDED_FOR'];
-        }
-       global $version, $username;
+
+       global $domain, $version, $username;
+
+       /* if server var SERVER_NAME not available, use $domain */
+        if(!sqGetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER)) {
+            $SERVER_NAME = $domain;
+       }
+
+       sqGetGlobalVar('REMOTE_ADDR', $REMOTE_ADDR, SQ_SERVER);
+       sqGetGlobalVar('REMOTE_PORT', $REMOTE_PORT, SQ_SERVER);
+       sqGetGlobalVar('REMOTE_HOST', $REMOTE_HOST, SQ_SERVER);
+       sqGetGlobalVar('HTTP_VIA',    $HTTP_VIA,    SQ_SERVER);
+       sqGetGlobalVar('HTTP_X_FORWARDED_FOR', $HTTP_X_FORWARDED_FOR, SQ_SERVER);
+
        $rn = "\r\n";
        /* This creates an RFC 822 date */
        $date = date('D, j M Y H:i:s ', mktime()) . $this->timezone();
@@ -341,8 +342,6 @@ class Deliver {
        for ($i = 0 ; $i < $cnt ; $i++) {
            $hdr_s .= $this->foldLine($header[$i], 78, str_pad('',4));
        }
-//     $debug = "Debug: <123456789012345678901234567890123456789012345678901234567890123456789>\r\n";
-//     $this->foldLine($debug, 78, str_pad('',4));
        $header = $hdr_s;
        $header .= $rn; /* One blank line to separate header and body */
        $raw_length += strlen($header);