blob: 592fbcb40bab567b332158b040e4eed47273c055 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php /* Copyright (c) 2024 Freya Murphy */
class Profile_model extends Model {
private $request_model;
function __construct($load) {
parent::__construct($load);
$this->request_model = $this->load->model('request');
}
public function get_data(): ?array {
$uid = $this->request_model->get_int('id', FALSE);
if ($uid === FALSE) {
if ($this->main->session) {
$uid = $this->main->user()['id'];
} else {
return NULL;
}
}
$user = $this->db
->select('*')
->from('api.user u')
->where('u.id')
->eq($uid)
->row();
if (!$user) {
return NULL;
}
$data = parent::get_data();
$data['user'] = $user;
$data['title'] = lang('title', sub: [$user['first_name']]);
return $data;
}
}
|