Commit 11b6e2cffbe2991e2e784939df431013071b82d8

Authored by kevin_fourie
1 parent 03ffcb91

Merged in from DEV trunk...

WSA-9
"Disabled document type causes web service timeout"
Implemented validation on resolution of document type.

Reviewed By: Jalaloedien Abrahams

WSA-15
"File Corruption when using Base64 and VB.NET"
Fixed. Files should have been written as binary and not as text.

Reviewed By: Martin Kirsten

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7021 c91229c3-7414-0410-bfa2-8a42b809f60b
ktapi/KTAPIFolder.inc.php
... ... @@ -443,6 +443,11 @@ class KTAPI_Folder extends KTAPI_FolderItem
443 443  
444 444 $filename = basename($filename);
445 445 $documenttypeid = KTAPI::get_documenttypeid($documenttype);
  446 + if (PEAR::isError($documenttypeid))
  447 + {
  448 + return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype);
  449 + }
  450 +
446 451  
447 452 $options = array(
448 453 'contents' => new KTFSFileLike($tempfilename),
... ...
ktwebservice/webservice.php
... ... @@ -1418,7 +1418,7 @@ class KTWebService
1418 1418 }
1419 1419  
1420 1420 // write to the temporary file
1421   - $fp=fopen($tempfilename, 'wt');
  1421 + $fp=fopen($tempfilename, 'wb');
1422 1422 if ($fp === false)
1423 1423 {
1424 1424 $response=array(
... ... @@ -1552,7 +1552,7 @@ class KTWebService
1552 1552 }
1553 1553  
1554 1554 // write to the temporary file
1555   - $fp=fopen($tempfilename, 'wt');
  1555 + $fp=fopen($tempfilename, 'wb');
1556 1556 if ($fp === false)
1557 1557 {
1558 1558 $response=array(
... ... @@ -1678,7 +1678,7 @@ class KTWebService
1678 1678 $oStorage =& KTStorageManagerUtil::getSingleton();
1679 1679 $filename = $oStorage->temporaryFile($document);
1680 1680  
1681   - $fp=fopen($filename,'rt');
  1681 + $fp=fopen($filename,'rb');
1682 1682 if ($fp === false)
1683 1683 {
1684 1684 $response['message'] = 'The file is not in the storage system. Please contact an administrator!';
... ... @@ -1824,7 +1824,7 @@ class KTWebService
1824 1824 $oStorage =& KTStorageManagerUtil::getSingleton();
1825 1825 $filename = $oStorage->temporaryFile($document);
1826 1826  
1827   - $fp=fopen($filename,'rt');
  1827 + $fp=fopen($filename,'rb');
1828 1828 if ($fp === false)
1829 1829 {
1830 1830 $response['message'] = 'The file is not in the storage system. Please contact an administrator!';
... ...