Commit 918d33f4 authored by Dries's avatar Dries

- Modified patch #7235: do a better job checking the OS and acting upon it.
parent c0ea0481
......@@ -12,11 +12,12 @@
* Common file handling functions.
*/
define('IS_WINDOWS', substr(PHP_OS, 0, 3) == 'WIN');
define('FILE_DOWNLOADS_PUBLIC', 1);
define('FILE_DOWNLOADS_PRIVATE', 2);
define('FILE_CREATE_DIRECTORY', 1);
define('FILE_MODIFY_PERMISSIONS', 2);
define('FILE_DIRECTORY_TEMP', PHP_OS == 'WINNT' ? 'c:\\windows\\temp' : '/tmp');
define('FILE_DIRECTORY_TEMP', IS_WINDOWS ? 'c:\\windows\\temp' : '/tmp');
define('FILE_EXISTS_RENAME', 0);
define('FILE_EXISTS_REPLACE', 1);
define('FILE_EXISTS_ERROR', 2);
......@@ -52,7 +53,7 @@ function file_create_path($dest = 0) {
return variable_get('file_directory_path', 'files');
}
$regex = (PHP_OS == 'WINNT' ? '.?:\\\\' : '/');
$regex = (IS_WINDOWS ? '.?:\\\\' : '/');
if (!file_check_location($dest, variable_get('file_directory_path', 'files')) && !preg_match("|^$regex|", $dest)) {
return variable_get('file_directory_path', 'files') .'/'. trim($dest, '\\/');
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment