diff options
author | plegall <plg@piwigo.org> | 2010-02-17 15:06:47 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-02-17 15:06:47 +0000 |
commit | bf81ad9332925984109d2cb7ee543f8bd909e16a (patch) | |
tree | b3b783b0b177b35127b84f39a44a72321936364b | |
parent | de1f51c99875d06e1ab960c5f2179f691328f257 (diff) |
bug 1422 fixed: pwg.images.add (and sub methods) can create recursive
directories for windows.
add trace in ws_logfile for add_file + ws_images_add_chunk
git-svn-id: http://piwigo.org/svn/branches/2.0@4899 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/ws_functions.inc.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 063e42d7e..8a8901386 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -896,6 +896,7 @@ UPDATE '.IMAGES_TABLE.' function ws_images_add_chunk($params, &$service) { + ws_logfile('[ws_images_add_chunk] welcome'); // data // original_sum // type {thumb, file, high} @@ -911,6 +912,20 @@ function ws_images_add_chunk($params, &$service) return new PwgError(405, "This method requires HTTP POST"); } + foreach ($params as $param_key => $param_value) { + if ('data' == $param_key) { + continue; + } + + ws_logfile( + sprintf( + '[ws_images_add_chunk] input param "%s" : "%s"', + $param_key, + is_null($param_value) ? 'NULL' : $param_value + ) + ); + } + $upload_dir = PHPWG_ROOT_PATH.'upload/buffer'; // create the upload directory tree if not exists @@ -1029,7 +1044,14 @@ function add_file($file_path, $type, $original_sum, $file_sum) $file_path = file_path_for_type($file_path, $type); $upload_dir = dirname($file_path); + if (substr(PHP_OS, 0, 3) == 'WIN') + { + $upload_dir = str_replace('/', DIRECTORY_SEPARATOR, $upload_dir); + } + ws_logfile('[add_file] file_path : '.$file_path); + ws_logfile('[add_file] upload_dir : '.$upload_dir); + if (!is_dir($upload_dir)) { umask(0000); $recursive = true; |