mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 05:31:42 +00:00
check if search() returns false
This commit is contained in:
parent
8f62039994
commit
a074aa6606
|
@ -427,7 +427,7 @@ function createFolder($id) { /* {{{ */
|
||||||
if($folder = $parent->addSubFolder($name, $comment, $userobj, 0, $newattrs)) {
|
if($folder = $parent->addSubFolder($name, $comment, $userobj, 0, $newattrs)) {
|
||||||
|
|
||||||
$rec = __getFolderData($folder);
|
$rec = __getFolderData($folder);
|
||||||
$app->response()->status(201);
|
$app->response()->status(201);
|
||||||
$app->response()->header('Content-Type', 'application/json');
|
$app->response()->header('Content-Type', 'application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>$rec));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>$rec));
|
||||||
} else {
|
} else {
|
||||||
|
@ -747,10 +747,10 @@ function uploadDocumentFile($documentId) { /* {{{ */
|
||||||
$app->response()->header('Content-Type', 'application/json');
|
$app->response()->header('Content-Type', 'application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No access', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No access', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if($document === null)
|
if($document === null)
|
||||||
$app->response()->status(400);
|
$app->response()->status(400);
|
||||||
else
|
else
|
||||||
$app->response()->status(500);
|
$app->response()->status(500);
|
||||||
$app->response()->header('Content-Type', 'application/json');
|
$app->response()->header('Content-Type', 'application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No such document', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No such document', 'data'=>''));
|
||||||
|
@ -1226,6 +1226,10 @@ function doSearch() { /* {{{ */
|
||||||
if(!$limit = $app->request()->get('limit'))
|
if(!$limit = $app->request()->get('limit'))
|
||||||
$limit = 5;
|
$limit = 5;
|
||||||
$resArr = $dms->search($querystr);
|
$resArr = $dms->search($querystr);
|
||||||
|
if($resArr === false) {
|
||||||
|
$app->response()->header('Content-Type', 'application/json');
|
||||||
|
echo json_encode(array());
|
||||||
|
}
|
||||||
$entries = array();
|
$entries = array();
|
||||||
$count = 0;
|
$count = 0;
|
||||||
if($resArr['folders']) {
|
if($resArr['folders']) {
|
||||||
|
@ -1377,7 +1381,7 @@ function getUsers() { /* {{{ */
|
||||||
$users = $dms->getAllUsers();
|
$users = $dms->getAllUsers();
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach($users as $u)
|
foreach($users as $u)
|
||||||
$data[] = __getUserData($u);
|
$data[] = __getUserData($u);
|
||||||
|
|
||||||
$app->response()->header('Content-Type', 'application/json');
|
$app->response()->header('Content-Type', 'application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>$data));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>$data));
|
||||||
|
@ -1803,12 +1807,12 @@ function changeFolderAccess($id, $operationType, $userOrGroup) { /* {{{ */
|
||||||
function getCategories() { /* {{{ */
|
function getCategories() { /* {{{ */
|
||||||
global $app, $dms, $userobj;
|
global $app, $dms, $userobj;
|
||||||
|
|
||||||
if(false === ($categories = $dms->getDocumentCategories())) {
|
if(false === ($categories = $dms->getDocumentCategories())) {
|
||||||
$app->response()->status(500);
|
$app->response()->status(500);
|
||||||
$app->response()->header('Content-Type', 'application/json');
|
$app->response()->header('Content-Type', 'application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Could not get categories', 'data'=>null));
|
echo json_encode(array('success'=>false, 'message'=>'Could not get categories', 'data'=>null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach($categories as $category)
|
foreach($categories as $category)
|
||||||
$data[] = ['id' => (int)$category->getId(), 'name' => $category->getName()];
|
$data[] = ['id' => (int)$category->getId(), 'name' => $category->getName()];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user