From 0ad137e73419bdb077c375dc75add335e4f5b5dd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 9 Aug 2012 07:47:41 +0200 Subject: [PATCH] Fix: uniformize code --- htdocs/core/lib/files.lib.php | 4 ++-- htdocs/ecm/search.php | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 36851694460..4ac18c0985f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -139,12 +139,12 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil closedir($dir); // Obtain a list of columns - if ($sortcriteria) + if (! empty($sortcriteria)) { $myarray=array(); foreach ($file_list as $key => $row) { - $myarray[$key] = $row[$sortcriteria]; + $myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:''); } // Sort the data if ($sortorder) array_multisort($myarray, $sortorder, $file_list); diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 16ca5d56a36..8870d50c639 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -48,9 +48,9 @@ $result = restrictedArea($user, 'ecm',''); $user->getrights('ecm'); // Get parameters -$socid = isset($_GET["socid"])?$_GET["socid"]:''; -$action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; -$section=isset($_GET["section"])?$_GET["section"]:$_POST['section']; +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); +$section=GETPOST('section'); if (! $section) $section=0; $upload_dir = $conf->ecm->dir_output.'/'.$section; @@ -66,9 +66,9 @@ if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="label"; $ecmdir = new EcmDirectory($db); -if (! empty($_REQUEST["section"])) +if (! empty($section)) { - $result=$ecmdir->fetch($_REQUEST["section"]); + $result=$ecmdir->fetch($section); if (! $result > 0) { dol_print_error($db,$ecmdir->error); @@ -123,10 +123,8 @@ print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("Search")); //print "
\n"; print $langs->trans("FeatureNotYetAvailable").'.

'; -if ($mesg) { print $mesg."
"; } - // Tool bar -$head = ecm_prepare_head_fm($fac); +$head = ecm_prepare_head_fm($ecmdir); //dol_fiche_head($head, 'search_form', '', 1); @@ -210,7 +208,6 @@ print ''; print '
'; // End of page -$db->close(); - llxFooter(); +$db->close(); ?>