X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2Fuser.php;h=71b21c952cea83a445bb6e4009755e2f7131aa46;hb=d9b3d71282439b9b7cdf79af8f98e255cf694ddd;hp=3d8063eece2d3a8a8d4fa2cb57c51d91461fa8e6;hpb=76cbe885cee40ea53bf1c52b70b44d792024f341;p=platal.git diff --git a/classes/user.php b/classes/user.php index 3d8063e..71b21c9 100644 --- a/classes/user.php +++ b/classes/user.php @@ -24,11 +24,18 @@ class User extends PlUser private $_profile_fetched = false; private $_profile = null; + // Additional fields (non core) + protected $promo = null; + // Implementation of the login to uid method. protected function getLogin($login) { global $globals; + if (!$login) { + throw new UserNotFoundException(); + } + if ($login instanceof User) { $machin->id(); } @@ -163,11 +170,15 @@ class User extends PlUser a.email_format, a.is_admin, a.state, a.type, a.skin, FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment, a.weak_password IS NOT NULL AS weak_access, - a.token IS NOT NULL AS token_access ' . $fields . ' + a.token IS NOT NULL AS token_access, + (e.email IS NULL AND NOT FIND_IN_SET(\'googleapps\', eo.storage)) AND a.state != \'pending\' AS lost + ' . $fields . ' FROM accounts AS a INNER JOIN account_types AS at ON (at.type = a.type) LEFT JOIN aliases AS af ON (af.id = a.uid AND af.type = \'a_vie\') LEFT JOIN aliases AS ab ON (ab.id = a.uid AND FIND_IN_SET(\'bestalias\', ab.flags)) + LEFT JOIN emails AS e ON (e.uid = a.uid AND e.flags = \'active\') + LEFT JOIN email_options AS eo ON (eo.uid = a.uid) ' . $joins . ' WHERE a.uid IN (' . implode(', ', $uids) . ') GROUP BY a.uid'); @@ -475,7 +486,7 @@ class User extends PlUser public static function _default_user_callback($login, $results) { $result_count = count($results); - if ($result_count == 0 || !S::has_perms()) { + if ($result_count == 0 || !S::admin()) { Platal::page()->trigError("Il n'y a pas d'utilisateur avec l'identifiant : $login"); } else { Platal::page()->trigError("Il y a $result_count utilisateurs avec cet identifiant : " . join(', ', $results));