From b6cfc3a3e030bb52358e121ade01f231d374f66f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Dec 2021 17:25:11 +0100 Subject: [PATCH] Clean code --- htdocs/user/card.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 73d97d1a3fc..4de0a93d440 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -90,12 +90,10 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $childids = $user->getAllChildIds(1); // For later, test on salary visibility // Define value to know what current user can do on properties of edited user -if ($id) { +if ($id > 0) { // $user is the current logged user, $id is the user we want to edit - $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer) - || (($user->id != $id) && $user->rights->user->user->creer)); - $caneditpassword = ((($user->id == $id) && $user->rights->user->self->password) - || (($user->id != $id) && $user->rights->user->user->password)); + $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer) || (($user->id != $id) && $user->rights->user->user->creer)); + $caneditpassword = ((($user->id == $id) && $user->rights->user->self->password) || (($user->id != $id) && $user->rights->user->user->password)); } // Security check @@ -106,7 +104,7 @@ if ($user->socid > 0) { $feature2 = 'user'; $result = restrictedArea($user, 'user', $id, 'user', $feature2); -if ($user->id <> $id && !$canreaduser) { +if ($user->id != $id && !$canreaduser) { accessforbidden(); }