From: <gem...@li...> - 2012-06-01 06:55:50
|
Revision: 729 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=729&view=rev Author: michieltcs Date: 2012-06-01 06:55:43 +0000 (Fri, 01 Jun 2012) Log Message: ----------- No longer use tempnam() to create temporary files Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 21:07:46 UTC (rev 728) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-01 06:55:43 UTC (rev 729) @@ -106,15 +106,15 @@ */ protected function _convertToPdf($content) { - $tempInputFilename = tempnam(GEMS_ROOT_DIR . '/var/tmp/', 'gemshtml') . '.html'; - $tempOutputFilename = tempnam(GEMS_ROOT_DIR . '/var/tmp/', 'gemspdf') . '.pdf'; + $tempInputFilename = GEMS_ROOT_DIR . '/var/tmp/export-' . md5(time() . rand()) . '.html'; + $tempOutputFilename = GEMS_ROOT_DIR . '/var/tmp/export-' . md5(time() . rand()) . '.pdf'; + + file_put_contents($tempInputFilename, $content); - if (empty($tempInputFilename) || empty($tempOutputFilename)) { - throw new Exception("Unable to create temporary file(s)"); + if (!file_exists($tempInputFilename)) { + throw new Exception("Unable to create temporary file '{$tempInputFilename}'"); } - file_put_contents($tempInputFilename, $content); - $lastLine = exec(escapeshellarg($this->_wkhtmltopdfLocation) . ' ' . escapeshellarg($tempInputFilename) . ' ' . escapeshellarg($tempOutputFilename), $outputLines, $return); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |