// Force synchronization of plat/al and Google Apps passwords.
if ($action == 'forcesync' && $account->sync_password) {
- $res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id = {?}", $user->id());
- $account->set_password($res->fetchOneCell());
+ $account->set_password($user->password());
$page->trigSuccess('Le mot de passe a été synchronisé.');
}
pl_redirect('emails/redirect');
}
- $res = XDB::query(
- "SELECT u.deces = '0000-00-00' AS alive, e.last,
- IF(e.email IS NOT NULL, e.email, IF(FIND_IN_SET('googleapps', u.mail_storage), 'googleapps', NULL)) AS email
- FROM auth_user_md5 AS u
- LEFT JOIN emails AS e ON (e.flags = 'active' AND e.uid = u.user_id)
- WHERE u.user_id = {?}
- ORDER BY e.panne_level, e.last", $user->id());
+ $res = XDB::query('SELECT p.deathdate IS NULL AS alive, e.last,
+ IF(e.email IS NOT NULL, e.email,
+ IF(FIND_IN_SET(\'googleapps\', eo.storage), \'googleapps\', NULL)) AS email
+ FROM email_options AS eo
+ LEFT JOIN account_profiles AS ap ON (ap.uid = eo.uid AND FIND_IN_SET(\'owner\', ap.perms))
+ LEFT JOIN profiles AS p ON (p.pid = ap.pid)
+ LEFT JOIN emails AS e ON (e.flags = \'active\' AND e.uid = eo.uid)
+ WHERE eo.uid = {?}
+ ORDER BY e.panne_level, e.last', $user->id());
if (!$res->numRows()) {
return PL_NOT_FOUND;
}
if (is_null($x)) {
return null;
}
- // TODO such a function should probably be provided in the User class
- // or at least not here
- $res = XDB::query('SELECT u.user_id
- FROM auth_user_md5 AS u
- INNER JOIN auth_user_quick AS q USING(user_id)
- INNER JOIN aliases AS a ON (a.id = u.user_id AND type != \'homonyme\')
- WHERE u.perms IN(\'admin\', \'user\')
- AND q.emails_alias_pub = \'public\'
- AND a.alias = {?}',
- $x);
- if (list($uid) = $res->fetchOneRow()) {
- $user = User::getSilent($uid);
- }
+ global $globals;
+ // Should we check the publicity of the alias?
+ $user = User::getSilent($x . '@' . $globals->mail->alias_dom);
return $user ? $user : null;
}
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
\ No newline at end of file
+?>