IPv6.patch   [plain text]


--- roundcubemail-0.5.3/program/include/main.inc	2011-06-02 05:36:32.000000000 -0700
+++ roundcubemail/program/include/main.inc	2011-06-08 16:20:41.000000000 -0700
@@ -1800,7 +1800,12 @@
 function rcube_parse_host($name, $host='')
 {
   // %n - host
-  $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
+  $n = $_SERVER['SERVER_NAME'];
+  if (preg_match('/:.*:/', $n)) {
+    // IPv6 address
+    $n = "[$n]";
+  } else
+    $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
   // %d - domain name without first part, e.g. %d=mail.domain.tld, %m=domain.tld
   $d = preg_replace('/^[^\.]+\./', '', $n);
   // %h - IMAP host