diff options
Diffstat (limited to 'src/web/_controller/apps')
-rw-r--r-- | src/web/_controller/apps/auth.php | 56 | ||||
-rw-r--r-- | src/web/_controller/apps/error.php | 21 | ||||
-rw-r--r-- | src/web/_controller/apps/home.php | 26 | ||||
-rw-r--r-- | src/web/_controller/apps/people.php | 48 | ||||
-rw-r--r-- | src/web/_controller/apps/profile.php | 44 | ||||
-rw-r--r-- | src/web/_controller/apps/settings.php | 41 |
6 files changed, 0 insertions, 236 deletions
diff --git a/src/web/_controller/apps/auth.php b/src/web/_controller/apps/auth.php deleted file mode 100644 index 1df74da..0000000 --- a/src/web/_controller/apps/auth.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -class Auth_controller extends Controller { - - // the home model - private $auth_model; - - // the post controller - protected $post_controller; - - function __construct($load) { - parent::__construct($load); - $this->auth_model = $this->load->model('apps/auth'); - } - - public function index(): void { - if ($this->main->session) { - $this->redirect('/home'); - } else { - $this->redirect('/auth/login'); - } - } - - public function login(): void { - if ($this->main->session) { - $this->redirect('/home'); - } - - parent::index(); - $data = $this->auth_model->get_data(); - $this->view('head', $data); - $this->view('apps/auth/login', $data); - $this->view('footer', $data); - } - - public function logout(): void { - if ($this->main->session) { - $_SESSION['jwt'] = NULL; - } - $this->redirect('/auth/login'); - } - - public function update(): void { - if (!$this->is_ajax()) { - $this->error(400); - } - if (!isset($_POST['key']) || !isset($_POST['value'])) { - $this->error(400); - } - $key = $_POST['key']; - $value = $_POST['value']; - $_SESSION[$key] = $value; - } - -} - -?> diff --git a/src/web/_controller/apps/error.php b/src/web/_controller/apps/error.php deleted file mode 100644 index 03bbd8d..0000000 --- a/src/web/_controller/apps/error.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -class Error_controller extends Controller { - - private $error_model; - - function __construct($load) { - parent::__construct($load); - $this->error_model = $this->load->model('apps/error'); - } - - public function index(): void { - parent::index(); - $data = $this->error_model->get_data(); - $this->view('header', $data); - $this->view('apps/error/main', $data); - $this->view('footer', $data); - } - -} - -?> diff --git a/src/web/_controller/apps/home.php b/src/web/_controller/apps/home.php deleted file mode 100644 index c9a116d..0000000 --- a/src/web/_controller/apps/home.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -class Home_controller extends Controller { - - // the home model - private $home_model; - - // the post controller - protected $post_controller; - - function __construct($load) { - parent::__construct($load); - $this->home_model = $this->load->model('apps/home'); - $this->post_controller = $this->load->controller('_util/post'); - } - - public function index(): void { - parent::index(); - $data = $this->home_model->get_data(); - $this->view('header', $data); - $this->view('apps/home/main', $data); - $this->view('footer', $data); - } - -} - -?> diff --git a/src/web/_controller/apps/people.php b/src/web/_controller/apps/people.php deleted file mode 100644 index 86da3b3..0000000 --- a/src/web/_controller/apps/people.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -class People_controller extends Controller { - - // the people model - private $people_model; - - // format model - protected $format_model; - - function __construct($load) { - parent::__construct($load); - $this->people_model = $this->load->model('apps/people'); - $this->format_model = $this->load->model('format'); - } - - public function index(): void { - parent::index(); - $data = $this->people_model->get_data(); - $this->view('header', $data); - $this->view('apps/people/header', $data); - $this->view('apps/people/main', $data); - $this->view('apps/people/footer', $data); - $this->view('footer', $data); - } - - public function content(): void { - $data = $this->people_model->get_data(); - $this->view('apps/people/main', $data); - } - - /** - * @return array<string,mixed> - */ - public function people(): array { - $data = $this->people_model->get_users(); - - $this->view('apps/people/people', $data); - - $max = 0; - foreach ($data['users'] as $user) { - $max = max($max, $user['id']); - } - - return $data; - } -} - -?> diff --git a/src/web/_controller/apps/profile.php b/src/web/_controller/apps/profile.php deleted file mode 100644 index 9e9fca6..0000000 --- a/src/web/_controller/apps/profile.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -class Profile_controller extends Controller { - - // the home model - private $profile_model; - - // the format model - protected $format_model; - - // the post controller - protected $post_controller; - - // the people controller - protected $people_controller; - - function __construct($load) { - parent::__construct($load); - $this->profile_model = $this->load->model('apps/profile'); - $this->people_controller = $this->load->controller('apps/people'); - $this->format_model = $this->load->model('format'); - $this->post_controller = $this->load->controller('_util/post'); - } - - public function index(): void { - - if ($this->main->user() && !isset($_GET['id'])) { - $this->redirect('/profile?id=' . $this->main->user()['id']); - } - - parent::index(); - $data = $this->profile_model->get_data(); - - if (!$data) { - $this->error(404); - } - - $this->view('header', $data); - $this->view('apps/profile/main', $data); - $this->view('footer', $data); - } - -} - -?> diff --git a/src/web/_controller/apps/settings.php b/src/web/_controller/apps/settings.php deleted file mode 100644 index 8a409cc..0000000 --- a/src/web/_controller/apps/settings.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -class Settings_controller extends Controller { - - // the home model - private $settings_model; - - // the format model - protected $format_model; - - // the post controller - protected $post_controller; - - // the people controller - protected $people_controller; - - function __construct($load) { - parent::__construct($load); - $this->settings_model = $this->load->model('apps/settings'); - } - - public function index(): void { - if (!$this->main->session) { - $this->redirect('/auth/login'); - } - - parent::index(); - $data = $this->settings_model->get_data(); - - if (!$data) { - $this->error(404); - } - - $this->load->app_lang($this->main->info['lang'], 'auth'); - $this->view('header', $data); - $this->view('apps/settings/main', $data); - $this->view('footer', $data); - } - -} - -?> |