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)) {
11 return realpath(dirname($tempfile));