From 853696b15a11708e04412001f68a516f2332363c Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 05 Sep 2011 04:49:04 -0400
Subject: [PATCH] Backport changes from trunk up to r5164

---
 program/include/rcube_ldap.php |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index bf978a7..699691d 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -181,8 +181,11 @@
                 }
 
                 // Get the pieces needed for variable replacement.
-                $fu = $RCMAIL->user->get_username();
-                list($u, $d) = explode('@', $fu);
+                if ($fu = $RCMAIL->user->get_username())
+                  list($u, $d) = explode('@', $fu);
+                else
+                  $d = $this->mail_domain;
+                
                 $dc = 'dc='.strtr($d, array('.' => ',dc=')); // hierarchal domain string
 
                 $replaces = array('%dc' => $dc, '%d' => $d, '%fu' => $fu, '%u' => $u);

--
Gitblit v1.9.1