mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Check for failure to write at creation stage so not to go in loop
This commit is contained in:
@@ -39,12 +39,17 @@ function tempdir($dir, $prefix='', $mode=0700)
|
||||
{
|
||||
if (substr($dir, -1) != '/') $dir .= '/';
|
||||
|
||||
if (is_writable($dir))
|
||||
{
|
||||
do
|
||||
{
|
||||
$path = $dir.$prefix.mt_rand(0, 9999999);
|
||||
} while (!mkdir($path, $mode));
|
||||
|
||||
return $path;
|
||||
}
|
||||
else
|
||||
die(T_("Error: Cannot write to temporary directory"));
|
||||
}
|
||||
|
||||
$tempdir = realpath(dirname(__FILE__) . '/../include/limesurvey/tmp');
|
||||
@@ -60,8 +65,6 @@ if ($operator_id)
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
if (is_writable($tempdir))
|
||||
{
|
||||
$zipdir=tempdir($tempdir);
|
||||
|
||||
@@ -100,6 +103,5 @@ if ($operator_id)
|
||||
readfile($zipfile);
|
||||
unlink($zipfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
exit();
|
||||
|
||||
Reference in New Issue
Block a user