From 2cca3ddce43c897b4d28c8c26aaba598ec3e91ec Mon Sep 17 00:00:00 2001 From: Paul Barrett Date: Tue, 22 Sep 2009 11:15:52 +0200 Subject: [PATCH] Restored function in KTUploadManager which is required by CMIS code (or anything else which may want to store content which is not base64 encoded. --- ktwebservice/KTUploadManager.inc.php | 31 +++++++++++++++++++++++++++++++ webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php | 5 +---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ktwebservice/KTUploadManager.inc.php b/ktwebservice/KTUploadManager.inc.php index 57dc38f..be50f93 100644 --- a/ktwebservice/KTUploadManager.inc.php +++ b/ktwebservice/KTUploadManager.inc.php @@ -110,6 +110,7 @@ class KTUploadManager return ($tempdir == $this->temp_dir); */ } + function store_base64_file($base64, $prefix= 'sa_') { $tempfilename = $this->get_temp_filename($prefix); @@ -133,6 +134,36 @@ class KTUploadManager return $tempfilename; } + + /** + * + * @param string $content file content NOT base64 encoded (may be string, may be binary) + * @param string $prefix [optional] + * @return $tempfilename the name of the temporary file created + */ + function store_file($content, $prefix= 'sa_') + { + $tempfilename = $this->get_temp_filename($prefix); + if (!is_writable($tempfilename)) + { + return new PEAR_Error("Cannot write to file: $tempfilename"); + } + + if (!$this->is_valid_temporary_file($tempfilename)) + { + return new PEAR_Error("Invalid temporary file: $tempfilename. There is a problem with the temporary storage path: $this->temp_dir."); + } + + $fp=fopen($tempfilename, 'wb'); + if ($fp === false) + { + return new PEAR_Error("Cannot write content to temporary file: $tempfilename."); + } + fwrite($fp, $content); + fclose($fp); + + return $tempfilename; + } /** * This tells the manager to manage a file that has been uploaded. diff --git a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php index 4c851e0..fe264de 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php @@ -447,7 +447,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { $repositoryId = $repositories[0]['repositoryId']; $checkedout = $NavigationService->getCheckedOutDocs($repositoryId); -//print_r($checkedout);exit; + //Create a new response feed $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); $workspace = $feed->getWorkspace(); @@ -492,9 +492,6 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { $feed->newField('cmis:hasMoreItems', 'false', $feed); -// $entry = null; -// $feed->newField('cmis:hasMoreItems', 'false', $entry, true); - // Expose the responseFeed $this->responseFeed = $feed; } -- libgit2 0.21.4