From 401d02daaf21c56609a0ed45f6f37e35f1bf3a03 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 13 Mar 2015 08:08:28 +0100 Subject: [PATCH] fixed limit restriction in doSearch() --- restapi/index.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/restapi/index.php b/restapi/index.php index 638c9b47d..fe5f653db 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -680,18 +680,17 @@ function doSearch() { /* {{{ */ $mode = $app->request()->get('mode'); if(!$limit = $app->request()->get('limit')) $limit = 8; - $resArr = $dms->search($querystr, $limit); + $resArr = $dms->search($querystr); $entries = array(); $count = 0; if($resArr['folders']) { foreach ($resArr['folders'] as $entry) { if ($entry->getAccessMode($userobj) >= M_READ) { $entries[] = $entry; - if($count < $limit) - $count++; - else - break; + $count++; } + if($count >= $limit) + break; } } $count = 0; @@ -699,11 +698,10 @@ function doSearch() { /* {{{ */ foreach ($resArr['docs'] as $entry) { if ($entry->getAccessMode($userobj) >= M_READ) { $entries[] = $entry; - if($count < $limit) - $count++; - else - break; + $count++; } + if($count >= $limit) + break; } }