diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-10-20 01:24:23 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-10-20 01:24:23 +0200 |
commit | 8f77179d292d8b874c84083864f98118f7a63612 (patch) | |
tree | cf50ca7568900da94072c67c1ca0b4846de19f50 /apps/user_openid | |
parent | 273972b75af17b228a57c7cf8258ea31f2e2e3bc (diff) | |
parent | 466b41c36bf7093cdde9d2856eb520503f52640c (diff) | |
download | nextcloud-server-8f77179d292d8b874c84083864f98118f7a63612.tar.gz nextcloud-server-8f77179d292d8b874c84083864f98118f7a63612.zip |
Merge commit 'refs/merge-requests/64' of git://gitorious.org/owncloud/owncloud
Diffstat (limited to 'apps/user_openid')
-rw-r--r-- | apps/user_openid/phpmyid.php | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/apps/user_openid/phpmyid.php b/apps/user_openid/phpmyid.php index d8168c9a10d..c984dc8f5e6 100644 --- a/apps/user_openid/phpmyid.php +++ b/apps/user_openid/phpmyid.php @@ -603,7 +603,7 @@ function test_mode () { $res['gmp'] = 'pass - n/a'; } - // sys_get_temp_dir + // get_temp_dir $res['logfile'] = is_writable($profile['logfile']) ? 'pass' : "warn - log is not writable"; @@ -1374,30 +1374,38 @@ function str_diff_at ($a, $b) { } -if (! function_exists('sys_get_temp_dir') && ini_get('open_basedir') == false) { +if (! function_exists('get_temp_dir')) { /** * Create function if missing * @return string */ -function sys_get_temp_dir () { - $keys = array('TMP', 'TMPDIR', 'TEMP'); - foreach ($keys as $key) { - if (isset($_ENV[$key]) && is_dir($_ENV[$key]) && is_writable($_ENV[$key])) - return realpath($_ENV[$key]); - } + if (ini_get('open_basedir') == false) { + function get_temp_dir () { + $keys = array('TMP', 'TMPDIR', 'TEMP'); + foreach ($keys as $key) { + if (isset($_ENV[$key]) && is_dir($_ENV[$key]) && is_writable($_ENV[$key])) + return realpath($_ENV[$key]); + } - $tmp = tempnam(false, null); - if (file_exists($tmp)) { - $dir = realpath(dirname($tmp)); - unlink($tmp); - return realpath($dir); - } + $tmp = tempnam(false, null); + if (file_exists($tmp)) { + $dir = realpath(dirname($tmp)); + unlink($tmp); + return realpath($dir); + } - return realpath(dirname(__FILE__)); -}} elseif (! function_exists('sys_get_temp_dir')) { -function sys_get_temp_dir () { - return realpath(dirname(__FILE__)); -}} + return realpath(dirname(__FILE__)); + } + } + else { + function get_temp_dir () { + if (isset(ini_get('upload_tmp_dir')) && is_dir(ini_get('upload_tmp_dir')) && is_writable(ini_get('upload_tmp_dir'))) + return ini_get('upload_tmp_dir'); + else + return realpath(dirname(__FILE__)); + } + } +} /** @@ -1694,7 +1702,7 @@ if (! array_key_exists('lifetime', $profile)) { // Set a default log file if (! array_key_exists('logfile', $profile)) - $profile['logfile'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $profile['auth_realm'] . '.debug.log'; + $profile['logfile'] = get_temp_dir() . DIRECTORY_SEPARATOR . $profile['auth_realm'] . '.debug.log'; /* |