mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
fix setting of Content-Type in header (Closes: #233)
This commit is contained in:
parent
af91b6813f
commit
e35cc9f3c6
|
@ -208,7 +208,7 @@ switch($command) {
|
||||||
case 'movefolder': /* {{{ */
|
case 'movefolder': /* {{{ */
|
||||||
if($user) {
|
if($user) {
|
||||||
if(!checkFormKey('movefolder', 'GET')) {
|
if(!checkFormKey('movefolder', 'GET')) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
$mfolder = $dms->getFolder($_REQUEST['folderid']);
|
$mfolder = $dms->getFolder($_REQUEST['folderid']);
|
||||||
|
@ -217,26 +217,26 @@ switch($command) {
|
||||||
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
||||||
if($folder->getAccessMode($user) >= M_READWRITE) {
|
if($folder->getAccessMode($user) >= M_READWRITE) {
|
||||||
if($mfolder->setParent($folder)) {
|
if($mfolder->setParent($folder)) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'Folder moved', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'Folder moved', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error moving folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error moving folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No access on destination folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No access on destination folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No destination folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No destination folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
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 {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ switch($command) {
|
||||||
case 'movedocument': /* {{{ */
|
case 'movedocument': /* {{{ */
|
||||||
if($user) {
|
if($user) {
|
||||||
if(!checkFormKey('movedocument', 'GET')) {
|
if(!checkFormKey('movedocument', 'GET')) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
$mdocument = $dms->getDocument($_REQUEST['docid']);
|
$mdocument = $dms->getDocument($_REQUEST['docid']);
|
||||||
|
@ -255,26 +255,26 @@ switch($command) {
|
||||||
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
||||||
if($folder->getAccessMode($user) >= M_READWRITE) {
|
if($folder->getAccessMode($user) >= M_READWRITE) {
|
||||||
if($mdocument->setFolder($folder)) {
|
if($mdocument->setFolder($folder)) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'Document moved', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'Document moved', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error moving folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error moving folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No access on destination folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No access on destination folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No destination folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No destination folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
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 {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,25 +284,25 @@ switch($command) {
|
||||||
case 'deletefolder': /* {{{ */
|
case 'deletefolder': /* {{{ */
|
||||||
if($user) {
|
if($user) {
|
||||||
if(!checkFormKey('removefolder', 'GET')) {
|
if(!checkFormKey('removefolder', 'GET')) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
$folder = $dms->getFolder($_REQUEST['id']);
|
$folder = $dms->getFolder($_REQUEST['id']);
|
||||||
if($folder) {
|
if($folder) {
|
||||||
if ($folder->getAccessMode($user) >= M_READWRITE) {
|
if ($folder->getAccessMode($user) >= M_READWRITE) {
|
||||||
if($folder->remove()) {
|
if($folder->remove()) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error removing folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error removing folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
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 {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ switch($command) {
|
||||||
case 'deletedocument': /* {{{ */
|
case 'deletedocument': /* {{{ */
|
||||||
if($user) {
|
if($user) {
|
||||||
if(!checkFormKey('removedocument', 'GET')) {
|
if(!checkFormKey('removedocument', 'GET')) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
$document = $dms->getDocument($_REQUEST['id']);
|
$document = $dms->getDocument($_REQUEST['id']);
|
||||||
|
@ -330,18 +330,18 @@ switch($command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error removing document', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error removing document', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
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 {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No document', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No document', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,31 +357,31 @@ switch($command) {
|
||||||
$lockingUser = $document->getLockingUser();
|
$lockingUser = $document->getLockingUser();
|
||||||
if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL)) {
|
if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL)) {
|
||||||
if (!$document->setLocked(false)) {
|
if (!$document->setLocked(false)) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error unlocking document', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error unlocking document', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
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->setLocked($user)) {
|
if (!$document->setLocked($user)) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error locking document', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error locking document', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
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 {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'No document', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'No document', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,10 +394,10 @@ switch($command) {
|
||||||
fputcsv($fp, array(date('Y-m-d H:i:s'), $user->getLogin(), $_POST['key'], $_POST['lang'], $_POST['phrase']));
|
fputcsv($fp, array(date('Y-m-d H:i:s'), $user->getLogin(), $_POST['key'], $_POST['lang'], $_POST['phrase']));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'Thank you for your contribution', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'Thank you for your contribution', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Missing translation', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Missing translation', 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ switch($command) {
|
||||||
if($user) {
|
if($user) {
|
||||||
if(checkFormKey('adddocument')) {
|
if(checkFormKey('adddocument')) {
|
||||||
if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) {
|
if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id")));
|
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id")));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ switch($command) {
|
||||||
$folder = $dms->getFolder($folderid);
|
$folder = $dms->getFolder($folderid);
|
||||||
|
|
||||||
if (!is_object($folder)) {
|
if (!is_object($folder)) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id")));
|
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id")));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -469,12 +469,12 @@ switch($command) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_uploaded_file($_FILES["userfile"]["tmp_name"]) || $_FILES['userfile']['error']!=0){
|
if (!is_uploaded_file($_FILES["userfile"]["tmp_name"]) || $_FILES['userfile']['error']!=0){
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_failed")));
|
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_failed")));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if ($_FILES["userfile"]["size"]==0) {
|
if ($_FILES["userfile"]["size"]==0) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_zerosize")));
|
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_zerosize")));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ switch($command) {
|
||||||
/* Check if name already exists in the folder */
|
/* Check if name already exists in the folder */
|
||||||
if(!$settings->_enableDuplicateDocNames) {
|
if(!$settings->_enableDuplicateDocNames) {
|
||||||
if($folder->hasDocumentByName($name)) {
|
if($folder->hasDocumentByName($name)) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText("document_duplicate_name")));
|
echo json_encode(array('success'=>false, 'message'=>getMLText("document_duplicate_name")));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ switch($command) {
|
||||||
'', array(), array(), $workflow);
|
'', array(), array(), $workflow);
|
||||||
|
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText("error_occured")));
|
echo json_encode(array('success'=>false, 'message'=>getMLText("error_occured")));
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
|
@ -634,10 +634,10 @@ switch($command) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_added'), 'data'=>$document->getID()));
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_added'), 'data'=>$document->getID()));
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type', 'application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user