]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - extlib/get_temp_dir.php
Merge branch 'master' into social-master
[quix0rs-gnu-social.git] / extlib / get_temp_dir.php
1 <?php
2 if ( !function_exists('sys_get_temp_dir')) {
3         function sys_get_temp_dir() {
4                 if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
5                 if (!empty($_ENV['TMPDIR'])) { return realpath( $_ENV['TMPDIR']); }
6                 if (!empty($_ENV['TEMP'])) { return realpath( $_ENV['TEMP']); }
7                 $tempfile=tempnam(uniqid(rand(),TRUE),'');
8                 if (file_exists($tempfile)) {
9                         unlink($tempfile);
10                 }
11                 return realpath(dirname($tempfile));
12         }
13 }
14 ?>