Merge branch 'fusionax' into account
authorVincent Zanotti <vincent.zanotti@m4x.org>
Sat, 11 Apr 2009 01:20:01 +0000 (03:20 +0200)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Sat, 11 Apr 2009 01:20:01 +0000 (03:20 +0200)
Conflicts:
classes/user.php

Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
1  2 
classes/user.php

@@@ -29,28 -26,13 +29,32 @@@ class User extends PlUse
      {
          global $globals;
  
+         if (!$login) {
+             throw new UserNotFoundException();
+         }
 +        if ($login instanceof User) {
 +            $machin->id();
 +        }
 +
 +        if ($login instanceof Profile) {
 +            $this->_profile = $login;
 +            $this->_profile_fetched = true;
 +            $res = XDB::query('SELECT  ap.uid
 +                                 FROM  account_profiles AS ap
 +                                WHERE  ap.pid = {?} AND FIND_IN_SET(\'owner\', perms)',
 +                              $login->id());
 +            if ($res->numRows()) {
 +                return $res->fetchOneCell();
 +            }
 +            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);
 +            $res = XDB::query('SELECT  a.uid
 +                                 FROM  accounts AS a
 +                                WHERE  a.uid = {?}', $login);
              if ($res->numRows()) {
                  return $res->fetchOneCell();
              }