From bf81ad9332925984109d2cb7ee543f8bd909e16a Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 17 Feb 2010 15:06:47 +0000 Subject: 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 --- include/ws_functions.inc.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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; -- cgit v1.2.3