summaryrefslogtreecommitdiff
path: root/src/web/_controller/settings.php
blob: e42389f1801dd24ed6bf3c7a520b6514fea78ece (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
<?php /* Copyright (c) 2024 Freya Murphy */
class Settings_controller extends XSS_Controller {

	// the settings model
	private $settings_model;

	// the auth model
	private $auth_model;

	function __construct() {
		parent::__construct();
		$this->settings_model = $this->load_model('settings');
		$this->auth_model = $this->load_model('auth');
		$this->load_lang('auth', 'settings');
	}

	public function index(): void {
		if (!$this->auth_model->session())
			$this->redirect('/auth/login');

		parent::index();
		$data = $this->settings_model->get_data();

		if (!$data)
			$this->error(404);

		$this->view('header', $data);
		$this->view('settings/main', $data);
		$this->view('footer', $data);
	}

}

?>