From 5a2ba9c2e7605bb788bc406184547d22c6436867 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 23 Dec 2024 11:13:27 -0500 Subject: v2.1.0, refactor w/ crimson --- src/web/_controller/profile.php | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/web/_controller/profile.php (limited to 'src/web/_controller/profile.php') diff --git a/src/web/_controller/profile.php b/src/web/_controller/profile.php new file mode 100644 index 0000000..dd02ed2 --- /dev/null +++ b/src/web/_controller/profile.php @@ -0,0 +1,44 @@ +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); + } + +} + +?> -- cgit v1.2.3-freya