Merge branch 'master' into fusionax
[platal.git] / classes / user.php
index 5909053..c6ea598 100644 (file)
 
 class User extends PlUser
 {
+    // Additional fields (non core)
+    protected $promo = null;
+
+    public function promo()
+    {
+        return $this->promo;
+    }
+
     // Implementation of the login to uid method.
     protected function getLogin($login)
     {
         global $globals;
 
+        if (!$login) {
+            throw new UserNotFoundException();
+        }
+
         // If $data is an integer, fetches directly the result.
         if (is_numeric($login)) {
             $res = XDB::query("SELECT user_id FROM auth_user_md5 WHERE user_id = {?}", $login);
@@ -213,7 +225,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));