diff options
author | alecpl <alec@alec.pl> | 2009-07-02 10:52:48 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2009-07-02 10:52:48 +0000 |
commit | fccdf16364bec9a15d9f44e0197f1653b0109c91 (patch) | |
tree | e281cfc388099940f32b4f1b26c17c5b48d44864 /program/include | |
parent | be6c9752f9a32c789e85fea958fb1b5ef7bd22ca (diff) |
- check virtuser before create_user hook (#1485950) + one if statement improvement
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_user.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php index e02ed49ec..d933aa3c9 100644 --- a/program/include/rcube_user.php +++ b/program/include/rcube_user.php @@ -359,21 +359,23 @@ class rcube_user $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']; - + // try to resolve user in virtuser table and file + if (!strpos($user, '@')) { + if ($email_list = self::user2email($user, false, true)) + $user_email = is_array($email_list[0]) ? $email_list[0][0] : $email_list[0]; + } + + $data = $rcmail->plugins->exec_hook('create_user', + array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email)); + // plugin aborted this operation if ($data['abort']) return false; - $dbh = $rcmail->get_dbh(); + $user_name = $data['user_name']; + $user_email = $data['user_email']; - // try to resolve user in virtuser table and file - if ($user_email != '' && !strpos($user, '@')) { - if ($email_list = self::user2email($user, false, true)) - $user_email = is_array($email_list[0]) ? $email_list[0][0] : $email_list[0]; - } + $dbh = $rcmail->get_dbh(); $dbh->query( "INSERT INTO ".get_table_name('users')." @@ -400,10 +402,9 @@ class rcube_user } if (empty($email_list)) - $email_list[] = strip_newlines($user_email); - + $email_list[] = strip_newlines($user_email); // identities_level check - if (count($email_list) > 1 && $rcmail->config->get('identities_level', 0) > 1) + else if (count($email_list) > 1 && $rcmail->config->get('identities_level', 0) > 1) $email_list = array($email_list[0]); // create new identities records |