<?php
/***************************************************************************
- * Copyright (C) 2003-2011 Polytechnique.org *
+ * Copyright (C) 2003-2014 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
// Checks whether $login is a valid hruid or not.
$res = XDB::query('SELECT uid
FROM accounts
- WHERE hruid = {?}', $login);
+ WHERE hruid = {?}', $login);
if ($res->numRows()) {
return $res->fetchOneCell();
}
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)
public function firstName()
{
if (!$this->hasProfile()) {
- return $this->displayName();
+ return $this->firstname;
}
return $this->profile()->firstName();
}
public function lastName()
{
if (!$this->hasProfile()) {
- return '';
+ return $this->lastname;
}
return $this->profile()->lastName();
}
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()
}
}
-// 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:
?>