diff options
Diffstat (limited to 'program/lib')
-rw-r--r-- | program/lib/Roundcube/rcube.php | 16 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_ldap.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_user.php | 7 |
3 files changed, 22 insertions, 3 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 0eed6cf67..27e10a918 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1203,8 +1203,22 @@ class rcube if (is_object($this->user)) { return $this->user->get_username(); } + else if (isset($_SESSION['username'])) { + return $_SESSION['username']; + } + } - return null; + + /** + * Getter for logged user email (derived from user name not identity). + * + * @return string User email address + */ + public function get_user_email() + { + if (is_object($this->user)) { + return $this->user->get_username('mail'); + } } } diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 34e37e3b9..e3ba8c29f 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -273,7 +273,7 @@ class rcube_ldap extends rcube_addressbook } // Get the pieces needed for variable replacement. - if ($fu = $rcube->get_user_name()) + if ($fu = $rcube->get_user_email()) list($u, $d) = explode('@', $fu); else $d = $this->mail_domain; diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php index 7bd73e08c..864f2e098 100644 --- a/program/lib/Roundcube/rcube_user.php +++ b/program/lib/Roundcube/rcube_user.php @@ -86,12 +86,17 @@ class rcube_user /** * Build a user name string (as e-mail address) * - * @param string $part Username part (empty or 'local' or 'domain') + * @param string $part Username part (empty or 'local' or 'domain', 'mail') * @return string Full user name or its part */ function get_username($part = null) { if ($this->data['username']) { + // return real name + if (!$part) { + return $this->data['username']; + } + list($local, $domain) = explode('@', $this->data['username']); // at least we should always have the local part |