From f169ec9259a5876452195b89a9787a6f80e7c4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Oct 2018 10:37:49 +0200 Subject: [PATCH] Update ajaxdirtree.php --- htdocs/core/ajax/ajaxdirtree.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index fc01474a072..0f3ac26693a 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2007-2018 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,7 +75,7 @@ if ($modulepart == 'ecm') $fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened=$conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : ''); } -if ($modulepart == 'medias') +elseif ($modulepart == 'medias') { $fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened=$dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : ''); @@ -96,7 +97,7 @@ if ($modulepart == 'ecm') { if (! $user->rights->ecm->read) accessforbidden(); } -if ($modulepart == 'medias') +elseif ($modulepart == 'medias') { // Always allowed } @@ -349,7 +350,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, { $files = @scandir($fullpathselecteddir); - if ($files) + if (! empty($files)) { natcasesort($files); if (count($files) > 2) /* The 2 accounts for . and .. */