X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fprofile.php;h=7af43e9d060723a1e7ac35279363c3bc35c974d1;hb=c52d86d1d876e6def108e1d458604cc9714c252d;hp=7eb1d944f17d7c69c32d4eb8fe2d6b1ba8ac7efb;hpb=a3118782f4caef2d97c1466f74a65c48f7a81b7d;p=platal.git diff --git a/classes/profile.php b/classes/profile.php index 7eb1d94..7af43e9 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -1,6 +1,6 @@ numRows() != 1) { + __autoload('PlUser'); throw new UserNotFoundException(); } $this->data = $res->fetchOneAssoc(); @@ -110,12 +112,12 @@ class Profile public function firstName() { - return $this->first_name; + return $this->firstname; } public function lastName() { - return $this->last_name; + return $this->lastname; } public function isFemale() @@ -162,9 +164,11 @@ class Profile } catch (UserNotFoundException $e) { /* Let say we can identify a profile using the identifiers of its owner. */ - $user = User::getSilent($login); - if ($user && $user->hasProfile()) { - return $user->profile(); + if (!($login instanceof PlUser)) { + $user = User::getSilent($login); + if ($user && $user->hasProfile()) { + return $user->profile(); + } } return null; } @@ -173,8 +177,8 @@ class Profile public static function getNameTypeId($type, $for_sql = false) { if (!S::has('name_types')) { - $table = XDB::fetchAllAssoc('name', 'SELECT id, name - FROM profile_name_search_enum'); + $table = XDB::fetchAllAssoc('type', 'SELECT id, type + FROM profile_name_enum'); S::set('name_types', $table); } else { $table = S::v('name_types'); @@ -185,7 +189,6 @@ class Profile return $table[$type]; } } - } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: