{
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();
}