From bcefbca382758f3e3e7413d348dc0f03a9aebcca Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 15 Feb 2019 08:31:47 +0100 Subject: [PATCH 1/2] check for more parameters doSearch() --- restapi/index.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/restapi/index.php b/restapi/index.php index 078a23f2e..56b5a1714 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -1214,10 +1214,16 @@ function doSearch($request, $response) { /* {{{ */ $params = $request->getQueryParams(); $querystr = $params['query']; - $mode = $params['mode']; - if(!$limit = $params['limit']) + $mode = isset($params['mode']) ? $params['mode'] : ''; + if(!isset($params['limit']) || !$limit = $params['limit']) $limit = 5; - $resArr = $dms->search($querystr); + if(!isset($params['offset']) || !$offset = $params['offset']) + $offset = 0; + if(!isset($params['searchin']) || !$searchin = explode(",",$params['searchin'])) + $searchin = array(); + if(!isset($params['objects']) || !$objects = $params['objects']) + $objects = 0x3; + $resArr = $dms->search($querystr, $limit, $offset, 'AND', $searchin, null, null, array(), array(), array(), array(), array(), array(), array(), $objects); if($resArr === false) { return $response->withJson(array(), 200); } From cc790dd61428c420bf4106d5536f13c9d5a08d5d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 15 Feb 2019 10:39:45 +0100 Subject: [PATCH 2/2] fix php warning --- restapi/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restapi/index.php b/restapi/index.php index 56b5a1714..974eb5318 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -767,7 +767,7 @@ function addDocumentLink($request, $response, $args) { /* {{{ */ $params = $request->getParsedBody(); $public = !isset($params['public']) ? true : false; if ($sourcedoc->addDocumentLink($targetdoc->getId(), $userobj->getID(), $public)){ - return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$rec), 201); + return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>''), 201); } else { return $response->withJson(array('success'=>false, 'message'=>'Could not create document link', 'data'=>''), 500); }