From a083de817eba0e394d9d1181d55a30d0342b0b94 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 28 Nov 2011 14:41:17 +0000 Subject: [PATCH] Use PHPExcel_Shared_File::sys_get_temp_dir() for temporary files directory where not explicitly specified git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@83402 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Shared/OLE/PPS/Root.php | 4 +++- Classes/PHPExcel/Shared/XMLWriter.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Classes/PHPExcel/Shared/OLE/PPS/Root.php b/Classes/PHPExcel/Shared/OLE/PPS/Root.php index d06b14f2..532e652f 100644 --- a/Classes/PHPExcel/Shared/OLE/PPS/Root.php +++ b/Classes/PHPExcel/Shared/OLE/PPS/Root.php @@ -34,7 +34,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS * Directory for temporary files * @var string */ - protected $_tmp_dir = ''; + protected $_tmp_dir = NULL; /** * @param integer $time_1st A timestamp @@ -79,6 +79,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS if (is_resource($filename)) { $this->_FILEH_ = $filename; } else if ($filename == '-' || $filename == '') { + if (is_null($this->_tmp_dir)) + $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); if ($this->_FILEH_ == false) { diff --git a/Classes/PHPExcel/Shared/XMLWriter.php b/Classes/PHPExcel/Shared/XMLWriter.php index cc955d7e..c7dfeb56 100644 --- a/Classes/PHPExcel/Shared/XMLWriter.php +++ b/Classes/PHPExcel/Shared/XMLWriter.php @@ -59,12 +59,14 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter { * @param int $pTemporaryStorage Temporary storage location * @param string $pTemporaryStorageFolder Temporary storage folder */ - public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './') { + public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = NULL) { // Open temporary storage if ($pTemporaryStorage == self::STORAGE_MEMORY) { $this->openMemory(); } else { // Create temporary filename + if (is_null($pTemporaryStorageFolder)) + $pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); // Open storage