diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-04-19 17:44:29 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-04-19 17:44:29 +0000 |
| commit | c4185d03cfb5c4e9df4c004b2c13a9b3c3196eac (patch) | |
| tree | 4f7ca23360a62cf181bb23a0f2264d69481cac03 /roundcubemail/program/include/rcube_user.php | |
| parent | 137ee56eda15ecccb6a619a906ac532fc5d6c042 (diff) | |
Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins)
git-svn-id: https://svn.roundcube.net/trunk@2401 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_user.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_user.php | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/roundcubemail/program/include/rcube_user.php b/roundcubemail/program/include/rcube_user.php index 17debeb7a..b68c56cfa 100644 --- a/roundcubemail/program/include/rcube_user.php +++ b/roundcubemail/program/include/rcube_user.php @@ -346,16 +346,22 @@ class rcube_user */ static function create($user, $host) { + $user_name = ''; $user_email = ''; $rcmail = rcmail::get_instance(); + + $data = $rcmail->plugins->exec_hook('create_user', array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email)); + $user_name = $data['user_name']; + $user_email = $data['user_email']; + $dbh = $rcmail->get_dbh(); // try to resolve user in virtuser table and file - if (!strpos($user, '@')) { + if ($user_email != '' && !strpos($user, '@')) { if ($email_list = self::user2email($user, false)) $user_email = $email_list[0]; } - + $dbh->query( "INSERT INTO ".get_table_name('users')." (created, last_login, username, mail_host, alias, language) @@ -372,7 +378,9 @@ class rcube_user if ($user_email=='') $user_email = strpos($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain); - $user_name = $user != $user_email ? $user : ''; + if ($user_name == '') { + $user_name = $user != $user_email ? $user : ''; + } if (empty($email_list)) $email_list[] = strip_newlines($user_email); @@ -385,10 +393,10 @@ class rcube_user (user_id, del, standard, name, email) VALUES (?, 0, ?, ?, ?)", $user_id, - $standard, + $standard, strip_newlines($user_name), preg_replace('/^@/', $user . '@', $email)); - $standard = 0; + $standard = 0; } } else @@ -446,9 +454,9 @@ class rcube_user while ($sql_arr = $dbh->fetch_array($sql_result)) if (strpos($sql_arr[0], '@')) { $result[] = $sql_arr[0]; - if ($first) - return $result[0]; - } + if ($first) + return $result[0]; + } } // File lookup $r = self::findinvirtual('[[:space:]]' . quotemeta($user) . '[[:space:]]*$'); @@ -460,7 +468,7 @@ class rcube_user { $result[] = trim(str_replace('\\@', '@', $arr[0])); - if ($first) + if ($first) return $result[0]; } } |
