[Svn] r2982 - trunk/roundcubemail/program/steps/mail

trac at roundcube.net trac at roundcube.net
Wed Sep 23 14:28:17 CEST 2009


Author: alec
Date: 2009-09-23 07:28:17 -0500 (Wed, 23 Sep 2009)
New Revision: 2982

Modified:
   trunk/roundcubemail/program/steps/mail/sendmail.inc
Log:
- fixed Received header format


Modified: trunk/roundcubemail/program/steps/mail/sendmail.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/sendmail.inc	2009-09-23 05:25:27 UTC (rev 2981)
+++ trunk/roundcubemail/program/steps/mail/sendmail.inc	2009-09-23 12:28:17 UTC (rev 2982)
@@ -231,17 +231,40 @@
 if ($CONFIG['http_received_header'])
 {
   $nldlm = $RCMAIL->config->header_delimiter() . "\t";
+  // FROM/VIA
   $http_header = 'from ';
   if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-    $http_header .= rcmail_encrypt_header(gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR'])) .
-      ' [' . rcmail_encrypt_header($_SERVER['HTTP_X_FORWARDED_FOR']) . ']';
+    $host = $_SERVER['HTTP_X_FORWARDED_FOR'];
+    $hostname = gethostbyaddr($host);
+    if ($CONFIG['http_received_header_encrypt']) {
+      $http_header .= rcmail_encrypt_header($hostname);
+      if ($host != $hostname)
+        $http_header .= ' ('. rcmail_encrypt_header($host) . ')';
+    } else {
+      $http_header .= (($host != $hostname) ? $hostname : '[' . $host . ']');
+      $http_header .= ' ('. ($host == $hostname ? '' : $hostname . ' ') .
+        '[' . $host .'])';
+    }
     $http_header .= $nldlm . ' via ';
   }
-  $http_header .= rcmail_encrypt_header(gethostbyaddr($_SERVER['REMOTE_ADDR'])) .
-      ' [' . rcmail_encrypt_header($_SERVER['REMOTE_ADDR']) .']';
+  $host = $_SERVER['REMOTE_ADDR'];
+  $hostname = gethostbyaddr($host);
+  if ($CONFIG['http_received_header_encrypt']) {
+    $http_header .= rcmail_encrypt_header($hostname);
+    if ($host != $hostname)
+      $http_header .= ' ('. rcmail_encrypt_header($host) . ')';
+  } else {
+    $http_header .= (($host != $hostname) ? $hostname : '[' . $host . ']');
+    $http_header .= ' ('. ($host == $hostname ? '' : $hostname . ' ') .
+      '[' . $host .'])';
+  }
+  // BY
+  $http_header .= $nldlm . 'by ' . $_SERVER['HTTP_HOST'];
+  // WITH
   $http_header .= $nldlm . 'with ' . $_SERVER['SERVER_PROTOCOL'] .
       ' ('.$_SERVER['REQUEST_METHOD'] . '); ' . date('r');
   $http_header = wordwrap($http_header, 69, $nldlm);
+
   $headers['Received'] = $http_header;
 }
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list