From 565290fbf9e3727655921a969550167aa59a6e24 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Mon, 24 Feb 2014 19:07:25 -0500 Subject: Display a page not found when the data is not in the dabase anymore --- controllers/user.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'controllers/user.php') diff --git a/controllers/user.php b/controllers/user.php index 0fdd9d1e..9f9781ef 100644 --- a/controllers/user.php +++ b/controllers/user.php @@ -112,11 +112,13 @@ class User extends Base { $user = $this->user->getById($this->request->getIntegerParam('user_id')); + if (! $user) $this->notfound(); + if (! $_SESSION['user']['is_admin'] && $_SESSION['user']['id'] != $user['id']) { - $this->response->redirect('?controller=user&action=forbidden'); + $this->forbidden(); } - if (! empty($user)) unset($user['password']); + unset($user['password']); $this->response->html($this->template->layout('user_edit', array( 'projects' => $this->project->getList(), @@ -138,7 +140,7 @@ class User extends Base else { if ($_SESSION['user']['id'] != $values['id']) { - $this->response->redirect('?controller=user&action=forbidden'); + $this->forbidden(); } if (isset($values['is_admin'])) { @@ -173,8 +175,12 @@ class User extends Base { $this->checkPermissions(); + $user = $this->user->getById($this->request->getIntegerParam('user_id')); + + if (! $user) $this->notfound(); + $this->response->html($this->template->layout('user_remove', array( - 'user' => $this->user->getById($this->request->getIntegerParam('user_id')), + 'user' => $user, 'menu' => 'users', 'title' => t('Remove user') ))); -- cgit v1.2.3