From: Vincent Zanotti Date: Sat, 11 Apr 2009 01:20:01 +0000 (+0200) Subject: Merge branch 'fusionax' into account X-Git-Tag: xorg/1.0.0~332^2~337 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=89274a92006f2e3d3124667cd77525f7d01f8012;p=platal.git Merge branch 'fusionax' into account Conflicts: classes/user.php Signed-off-by: Vincent Zanotti --- 89274a92006f2e3d3124667cd77525f7d01f8012 diff --cc classes/user.php index d048e5a,819a7a6..c533bd1 --- a/classes/user.php +++ b/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(); }