From 03941a59af74944ef99ca0cf041be8055a9719a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Mar 2021 12:21:35 +0100 Subject: [PATCH] Clean code --- htdocs/opensurvey/card.php | 4 +++- htdocs/opensurvey/exportcsv.php | 4 +++- htdocs/opensurvey/fonctions.php | 1 - htdocs/opensurvey/index.php | 4 +++- htdocs/opensurvey/results.php | 6 +++--- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index ef583d08ff5..1a61773993f 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -32,7 +32,9 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"; // Security check -if (!$user->rights->opensurvey->read) accessforbidden(); +if (empty($user->rights->opensurvey->read)) { + accessforbidden(); +} // Initialisation des variables $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index fe814a44037..5abfd76f88e 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -40,7 +40,9 @@ $result = $object->fetch(0, $numsondage); if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage); // Security check -if (!$user->rights->opensurvey->read) accessforbidden(); +if (empty($user->rights->opensurvey->read)) { + accessforbidden(); +} /* diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 0ea701ebf0b..5832e57c46d 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -31,7 +31,6 @@ */ function opensurvey_prepare_head(Opensurveysondage $object) { - global $langs, $conf; $h = 0; diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 50198e5202f..c8cc35a0c61 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -31,7 +31,9 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; $langs->load("opensurvey"); // Security check -if (!$user->rights->opensurvey->read) accessforbidden(); +if (empty($user->rights->opensurvey->read)) { + accessforbidden(); +} $hookmanager = new HookManager($db); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index a6b192a4dba..fe03c433738 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"; require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"; - // Security check -if (!$user->rights->opensurvey->read) accessforbidden(); - +if (empty($user->rights->opensurvey->read)) { + accessforbidden(); +} // Init vars $action = GETPOST('action', 'aZ09');