From 94a5a24fc2a8040b22d4012773ebb6879957cfdf Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 05 Sep 2011 04:05:40 -0400
Subject: [PATCH] Fallback to mail_domain in LDAP variable replacements; add 'host' to 'user_create' hook arguments (#1488024)

---
 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