function getTempDirectory() { global $tempDirectory; if (empty($tempDirectory)) { $directories = array(); if (ini_get('upload_tmp_dir')) { $directories[] = ini_get('upload_tmp_dir'); } if (function_exists('sys_get_temp_dir')) { $directories[] = sys_get_temp_dir(); } $directories[] = '/tmp'; foreach ($directories as $directory) { if (is_dir($directory) && is_writable($directory)) { $tempDirectory = $directory; break; } } if (empty($tempDirectory)) { $tempDirectory = getProfilePath() . '/tmp'; } $tempDirectory = addslash($tempDirectory); } return $tempDirectory; }
function getUploadsPath() { return getProfilePath() . '/torrents'; }