summaryrefslogtreecommitdiff
path: root/program/include/rcube_user.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2009-04-19 17:44:29 +0000
committerthomascube <thomas@roundcube.net>2009-04-19 17:44:29 +0000
commitcc97ea0559af1a92a54dbcdf738ee4d95e67d3ff (patch)
treef9e18128e5a90abb06f079b09f8cd9ed92044faf /program/include/rcube_user.php
parentfb253ee9a89e2da779d11058f1f0c63c314b2840 (diff)
Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins)
Diffstat (limited to 'program/include/rcube_user.php')
-rw-r--r--program/include/rcube_user.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php
index 17debeb7a..b68c56cfa 100644
--- a/program/include/rcube_user.php
+++ b/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];
}
}