- $_SESSION['uid'] = $record['uid'];
- $_SESSION['theme'] = $record['theme'];
- $_SESSION['mobile-theme'] = PConfig::get($record['uid'], 'system', 'mobile_theme');
- $_SESSION['authenticated'] = 1;
- $_SESSION['page_flags'] = $record['page-flags'];
- $_SESSION['my_url'] = System::baseUrl() . '/profile/' . $record['nickname'];
- $_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
- $_SESSION["allow_api"] = true;
-
- $a->user = $record;
-
- if (strlen($a->user['timezone'])) {
- date_default_timezone_set($a->user['timezone']);
- $a->timezone = $a->user['timezone'];
- }
-
- $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
- if (DBA::isResult($contact)) {
- $a->contact = $contact;
- $a->cid = $contact['id'];
- $_SESSION['cid'] = $a->cid;
- }
-
- DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);