$em = trim(rtrim($str));
$em = str_replace('<', '', $em);
$em = str_replace('>', '', $em);
+ if (strpos($em, '@') === false) {
+ return;
+ }
list($ident, $dom) = explode('@', $em);
- if ($dom == $globals->mail->domain or $dom == $globals->mail->domain2) {
+ if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
list($ident1) = explode('_', $ident);
list($ident) = explode('+', $ident1);
}
// Look up user ids for addresses in domain
if (count($domain_mails)) {
- $domain_users = array();
- $domain_users = array_map('XDB::escape', array_keys($domain_mails));
+ $domain_users = array_map(array('XDB', 'escape'), array_keys($domain_mails));
$list = implode(',', $domain_users);
$res = XDB::query("SELECT alias, id
FROM aliases
// Look up user ids for other addresses in the email redirection list
if (count($other_mails)) {
- $other_users = array();
- $other_users = array_map('XDB::escape', $other_mails);
+ $other_users = array_map(array('XDB', 'escape'), $other_mails);
$list = implode(',', $other_users);
$res = XDB::query("SELECT email, uid
FROM emails
// Retrieves the current list of actives storages.
private function get_storages()
{
- $res = XDB::query("SELECT mail_storage
- FROM auth_user_md5
- WHERE user_id = {?}", $this->user->id());
- return new PlFlagSet($res->fetchOneCell());
+ return new PlFlagSet(XDB::fetchOneCell('SELECT storage
+ FROM email_options
+ WHERE uid = {?}',
+ $this->user->id()));
}
// Updates the list of active storages.
private function set_storages($storages)
{
- XDB::execute("UPDATE auth_user_md5
- SET mail_storage = {?}
- WHERE user_id = {?}", $storages, $this->user->id());
+ XDB::execute("UPDATE email_options
+ SET storage = {?}
+ WHERE uid = {?}", $storages, $this->user->id());
}
// Returns the list of allowed storages for the @p user.