- // Retrieves main user properties.
- /** TODO: Move needed informations to account tables */
- /** TODO: Currently suppressed data are matricule, promo */
- /** TODO: Data to move are: banana_last, watch_last, last_version */
- /** TODO: Use the User object to fetch all this */
- $res = XDB::query("SELECT a.uid, a.hruid, a.display_name, a.full_name, a.password,
- a.sex = 'female' AS femme, a.email_format,
- a.token, FIND_IN_SET('watch', a.flags) AS watch_account,
- UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last,
- q.last_version, g.g_account_name IS NOT NULL AS googleapps,
- UNIX_TIMESTAMP(s.start) AS lastlogin, s.host,
- a.is_admin, at.perms
- FROM accounts AS a
- INNER JOIN account_types AS at ON(a.type = at.type)
- INNER JOIN auth_user_quick AS q ON(a.uid = q.user_id)
- LEFT JOIN gapps_accounts AS g ON(a.uid = g.l_userid AND g.g_status = 'active')
- LEFT JOIN logger.last_sessions AS ls ON (ls.uid = a.uid)
- LEFT JOIN logger.sessions AS s ON(s.id = ls.id)
- WHERE a.uid = {?} AND a.state = 'active'", $user->id());
- $sess = $res->fetchOneAssoc();
- $perms = $sess['perms'];
- unset($sess['perms']);
-
- // Loads the data into the real session.
- $_SESSION = array_merge($_SESSION, $sess);