diff options
author | Hendrik Langer <hendrik.langer@gmx.de> | 2011-10-19 23:38:35 +0200 |
---|---|---|
committer | Hendrik Langer <hendrik.langer@gmx.de> | 2011-10-19 23:38:35 +0200 |
commit | 466b41c36bf7093cdde9d2856eb520503f52640c (patch) | |
tree | 6456918f3f142f0ade1370ffb948fa9ffc59a267 /lib/base.php | |
parent | da8d32ae38acdab576a30ca56b30579f427c780d (diff) | |
download | nextcloud-server-466b41c36bf7093cdde9d2856eb520503f52640c.tar.gz nextcloud-server-466b41c36bf7093cdde9d2856eb520503f52640c.zip |
Don't use sys_get_temp_dir(), as it reports the wrong path in restricted environments
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/base.php b/lib/base.php index 8adb1cc9102..d5fff1e0a74 100644 --- a/lib/base.php +++ b/lib/base.php @@ -186,18 +186,19 @@ if( !isset( $RUNTIME_NOAPPS )){ OC::init(); -if(!function_exists('sys_get_temp_dir')) { - function sys_get_temp_dir() { - if( $temp=getenv('TMP') ) return $temp; - if( $temp=getenv('TEMP') ) return $temp; - if( $temp=getenv('TMPDIR') ) return $temp; - $temp=tempnam(__FILE__,''); - if (file_exists($temp)) { - unlink($temp); - return dirname($temp); - } - return null; - } +if(!function_exists('get_temp_dir')) { + function get_temp_dir() { + if( $temp=ini_get('upload_tmp_dir') ) return $temp; + if( $temp=getenv('TMP') ) return $temp; + if( $temp=getenv('TEMP') ) return $temp; + if( $temp=getenv('TMPDIR') ) return $temp; + $temp=tempnam(__FILE__,''); + if (file_exists($temp)) { + unlink($temp); + return dirname($temp); + } + return null; + } } require_once('fakedirstream.php'); |