X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fuser.php;h=10e131c7d41202db5a5355f09103f503e0e78b2e;hb=fda78a6777a5f385537fc9f291afb310e12525e5;hp=3aea2fc858dcbbcc929d4e5219ab22343e72ed1c;hpb=07d0a10adbc2578f9b85875e551a03b99d3650e8;p=platal.git diff --git a/classes/user.php b/classes/user.php index 3aea2fc..10e131c 100644 --- a/classes/user.php +++ b/classes/user.php @@ -1,6 +1,6 @@ numRows()) { return $res->fetchOneCell(); } @@ -170,7 +170,7 @@ class User extends PlUser FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment, a.weak_password IS NOT NULL AS weak_access, g.g_account_name IS NOT NULL AS googleapps, a.token IS NOT NULL AS token_access, a.token, a.last_version, - UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, UNIX_TIMESTAMP(fp.last_seen) AS banana_last + s.start AS lastlogin, s.host, fp.last_seen AS banana_last ' . $fields . ' FROM accounts AS a INNER JOIN account_types AS at ON (at.type = a.type) @@ -306,7 +306,7 @@ class User extends PlUser public function firstName() { if (!$this->hasProfile()) { - return $this->displayName(); + return $this->firstname; } return $this->profile()->firstName(); } @@ -314,7 +314,7 @@ class User extends PlUser public function lastName() { if (!$this->hasProfile()) { - return ''; + return $this->lastname; } return $this->profile()->lastName(); } @@ -363,12 +363,18 @@ class User extends PlUser if (!$this->_profile_fetched || $forceFetch) { $this->_profile_fetched = true; $this->_profile = Profile::get($this, $fields, $visibility); - } else if ($this->_profile !== null && !$this->_profile->visibility->equals($visibility)) { + } else if ($this->_profile !== null && $visibility !== null && !$this->_profile->visibility->equals($visibility)) { return Profile::get($this, $fields, $visibility); } return $this->_profile; } + public function setPrefetchedProfile(Profile $profile) + { + $this->_profile_fetched = true; + $this->_profile = $profile; + } + /** Return true if the user has an associated profile. */ public function hasProfile() @@ -1101,5 +1107,5 @@ class UserIterator implements PlIterator } } -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>