blob: dd02ed24845de5b657682e78992e2661043704a5 (
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
38
39
40
41
42
43
44
|
<?php /* Copyright (c) 2024 Freya Murphy */
class Profile_controller extends XSS_Controller {
// the profile model
private $profile_model;
// the post controller
protected $post_controller;
// the people controller
protected $people_controller;
function __construct() {
parent::__construct();
$this->profile_model = $this->load_model('profile');
$this->people_controller = $this->load_controller('people');
$this->post_controller = $this->load_controller('_post');
$this->load_lang('profile');
}
public function index(): void {
$id = $this->get_int('id');
parent::index();
$data = $this->profile_model->get_data();
// profile does not exist
if (!$data) {
// not logged in and trying to access own profile
if (!$id)
$this->redirect('/auth/login');
// directly accessing unknown user id => 404
else
$this->error(404);
}
$this->view('header', $data);
$this->view('profile/main', $data);
$this->view('footer', $data);
}
}
?>
|