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
This commit is contained in:
Mark Baker 2011-11-28 14:41:17 +00:00
parent 135c0185f5
commit a083de817e
2 changed files with 6 additions and 2 deletions

View File

@ -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) {

View File

@ -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