From 9a6425bb1b66c2920a18da7d2d25cf1d7501eba4 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Tue, 4 Mar 2008 07:25:01 +0000 Subject: [PATCH] Merged in from DEV trunk... --- lib/foldermanagement/compressionArchiveUtil.inc.php | 15 +++++++++++---- plugins/ktstandard/KTBulkExportPlugin.php | 5 ++++- resources/css/kt-ie-icons.css | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/foldermanagement/compressionArchiveUtil.inc.php b/lib/foldermanagement/compressionArchiveUtil.inc.php index 9e35401..ff74e2e 100644 --- a/lib/foldermanagement/compressionArchiveUtil.inc.php +++ b/lib/foldermanagement/compressionArchiveUtil.inc.php @@ -58,19 +58,23 @@ class ZipFolder { $this->oStorage =& KTStorageManagerUtil::getSingleton(); $this->sOutputEncoding = $this->oKTConfig->get('export/encoding', 'UTF-8'); + + $this->sPattern = "[\*|\%|\\\|\/|\<|\>|\+|\:|\?|\||\'|\"]"; + $this->sFolderPattern = "[\*|\%|\<|\>|\+|\:|\?|\||\'|\"]"; $sBasedir = $this->oKTConfig->get("urls/tmpDirectory"); $sTmpPath = tempnam($sBasedir, 'kt_compress_zip'); unlink($sTmpPath); mkdir($sTmpPath, 0700); + + // Hard coding the zip file name - else it doesn't download properly + $sZipFileName = 'kt_zip'; $this->sTmpPath = $sTmpPath; $this->sZipFileName = $sZipFileName; $this->aPaths = array(); - $this->sPattern = "[\*|\%|\\\|\/|\<|\>|\+|\:|\?|\||\'|\"]"; - $this->sFolderPattern = "[\*|\%|\<|\>|\+|\:|\?|\||\'|\"]"; $aReplace = array( "[" => "[[]", @@ -178,6 +182,8 @@ class ZipFolder { putenv("LANG=$loc"); putenv("LANGUAGE=$loc"); $loc = setlocale(LC_ALL, $loc); + + $sManifest = sprintf("%s/%s", $this->sTmpPath, "MANIFEST"); file_put_contents($sManifest, join("\n", $this->aPaths)); @@ -187,6 +193,7 @@ class ZipFolder { $aCmd = array($sZipCommand, "-r", $sZipFile, ".", "-i@MANIFEST"); $sOldPath = getcwd(); chdir($this->sTmpPath); + // Note that the popen means that pexec will return a file descriptor $aOptions = array('popen' => 'r'); $fh = KTUtil::pexec($aCmd, $aOptions); @@ -218,7 +225,7 @@ class ZipFolder { 'dir' => $this->oZip->sTmpPath, ); $_SESSION['zipcompression']['exportcode'] = $sExportCode; - + $this->sZipFile = $sZipFile; return $sExportCode; } @@ -244,7 +251,7 @@ class ZipFolder { if (!file_exists($sZipFile)) { return PEAR::raiseError(_kt('The ZIP file can only be downloaded once - if you cancel the download, you will need to reload the page.')); } - + header("Content-Type: application/zip; charset=utf-8"); header("Content-Length: ". filesize($sZipFile)); header("Content-Disposition: attachment; filename=\"" . $this->sZipFileName . ".zip" . "\""); diff --git a/plugins/ktstandard/KTBulkExportPlugin.php b/plugins/ktstandard/KTBulkExportPlugin.php index 7af5381..5b579a5 100644 --- a/plugins/ktstandard/KTBulkExportPlugin.php +++ b/plugins/ktstandard/KTBulkExportPlugin.php @@ -223,7 +223,10 @@ class KTBulkExportAction extends KTFolderAction { $folderName = $this->oFolder->getName(); $this->oZip = new ZipFolder($folderName); - if(!$this->oZip->downloadZipFile($sCode)){ + $res = $this->oZip->downloadZipFile($sCode); + + if(PEAR::isError($res)){ + $this->addErrorMessage($res->getMessage()); redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); } exit(0); diff --git a/resources/css/kt-ie-icons.css b/resources/css/kt-ie-icons.css index a141a13..2fa7dfc 100644 --- a/resources/css/kt-ie-icons.css +++ b/resources/css/kt-ie-icons.css @@ -381,3 +381,8 @@ #loginbox.hasDisclaimer #loginboxRightBottom { height: 260px; } + +#content .field.error .errorMessage +{ + display: block; +} -- libgit2 0.21.4