| | |
| | | $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']; |
| | | |
| | | // plugin aborted this operation |
| | | if ($data['abort']) |
| | | return false; |
| | | |
| | | $dbh = $rcmail->get_dbh(); |
| | | |
| | |
| | | VALUES (".$dbh->now().", ".$dbh->now().", ?, ?, ?, ?)", |
| | | strip_newlines($user), |
| | | strip_newlines($host), |
| | | strip_newlines($user_email), |
| | | strip_newlines($data['alias'] ? $data['alias'] : $user_email), |
| | | $_SESSION['language']); |
| | | |
| | | if ($user_id = $dbh->insert_id(get_sequence_name('users'))) |
| | |
| | | if (empty($email_list)) |
| | | $email_list[] = strip_newlines($user_email); |
| | | |
| | | // also create new identity records |
| | | // identities_level check |
| | | if (count($email_list) > 1 && $rcmail->config->get('identities_level', 0) > 1) |
| | | $email_list = array($email_list[0]); |
| | | |
| | | // create new identities records |
| | | $standard = 1; |
| | | foreach ($email_list as $email) { |
| | | $dbh->query( |
| | | "INSERT INTO ".get_table_name('identities')." |
| | | (user_id, del, standard, name, email) |
| | | VALUES (?, 0, ?, ?, ?)", |
| | | $user_id, |
| | | $standard, |
| | | strip_newlines($user_name), |
| | | preg_replace('/^@/', $user . '@', $email)); |
| | | $plugin = $RCMAIL->plugins->exec_hook('create_identity', array('record' => array( |
| | | 'login' => true, |
| | | 'user_id' => $user_id, |
| | | 'name' => strip_newlines($user_name), |
| | | 'email' => $email, |
| | | 'standard' => $standard))); |
| | | |
| | | if (!$plugin['abort'] && $plugin['record']['name'] && $plugin['record']['email']) { |
| | | $dbh->query( |
| | | "INSERT INTO ".get_table_name('identities')." |
| | | (user_id, del, standard, name, email) |
| | | VALUES (?, 0, ?, ?, ?)", |
| | | $user_id, |
| | | $plugin['record']['standard'], |
| | | $plugin['record']['name'], |
| | | $plugin['record']['email']); |
| | | } |
| | | $standard = 0; |
| | | } |
| | | } |
| | |
| | | */ |
| | | static function email2user($email) |
| | | { |
| | | $r = self::findinvirtual('^' . quotemeta($email) . '[[:space:]]'); |
| | | $r = self::findinvirtual('/^' . preg_quote($email, '/') . '\s/'); |
| | | |
| | | for ($i=0; $i<count($r); $i++) |
| | | { |
| | |
| | | } |
| | | } |
| | | // File lookup |
| | | $r = self::findinvirtual('[[:space:]]' . quotemeta($user) . '[[:space:]]*$'); |
| | | $r = self::findinvirtual('/\s' . preg_quote($user, '/') . '\s*$/'); |
| | | for ($i=0; $i<count($r); $i++) |
| | | { |
| | | $data = $r[$i]; |
| | |
| | | if (empty($line) || $line{0}=='#') |
| | | continue; |
| | | |
| | | if (eregi($pattern, $line)) |
| | | if (preg_match($pattern, $line)) |
| | | $result[] = $line; |
| | | } |
| | | |