pass parameters to search() by array

This commit is contained in:
Uwe Steinmann 2019-06-26 18:03:07 +02:00
parent 86c03d3ee4
commit 3ab6d050cd

View File

@ -171,6 +171,13 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
$query = "";
}
if (isset($_GET["orderby"]) && is_string($_GET["orderby"])) {
$orderby = $_GET["orderby"];
}
else {
$orderby = "";
}
/* Select if only documents (0x01), only folders (0x02) or both (0x03)
* are found
*/
@ -360,7 +367,26 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
// ---------------- Start searching -----------------------------------------
$startTime = getTime();
$resArr = $dms->search($query, 0, 0 /*$limit, ($pageNumber-1)*$limit*/, $mode, $searchin, $startFolder, $owner, $status, $creationdate ? $startdate : array(), $creationdate ? $stopdate : array(), array(), array(), $categories, $attributes, $resultmode, $expirationdate ? $expstartdate : array(), $expirationdate ? $expstopdate : array());
$resArr = $dms->search(array(
'query'=>$query,
'limit'=>0,
'offset'=>0 /*$limit, ($pageNumber-1)*$limit*/,
'logicalmode'=>$mode,
'searchin'=>$searchin,
'startFolder'=>$startFolder,
'owner'=>$owner,
'status'=>$status,
'creationstartdate'=>$creationdate ? $startdate : array(),
'creationenddate'=>$creationdate ? $stopdate : array(),
'modificationstartdate'=>array(),
'modificationenddate'=>array(),
'categories'=>$categories,
'attributes'=>$attributes,
'mode'=>$resultmode,
'expirationstartdate'=>$expirationdate ? $expstartdate : array(),
'expirationenddate'=>$expirationdate ? $expstopdate : array(),
'orderby'=>$orderby
));
$searchTime = getTime() - $startTime;
$searchTime = round($searchTime, 2);
@ -409,10 +435,14 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'query'=>$query, 'searchhits'=>$entries, 'totalpages'=>$totalPages, 'pagenumber'=>$pageNumber, 'searchtime'=>$searchTime, 'urlparams'=>$_GET, 'cachedir'=>$settings->_cacheDir));
if($view) {
$view->setParam('showtree', showtree());
$view->setParam('enableRecursiveCount', $settings->_enableRecursiveCount);
$view->setParam('maxRecursiveCount', $settings->_maxRecursiveCount);
$view->setParam('totaldocs', $dcount /*resArr['totalDocs']*/);
$view->setParam('totalfolders', $fcount /*resArr['totalFolders']*/);
$view->setParam('fullsearch', (isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSearch) ? true : false);
$view->setParam('mode', isset($mode) ? $mode : '');
$view->setParam('orderby', isset($orderby) ? $orderby : '');
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
$view->setParam('resultmode', isset($resultmode) ? $resultmode : '');
$view->setParam('searchin', isset($searchin) ? $searchin : array());