aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-02-17 15:09:44 +0000
committerplegall <plg@piwigo.org>2010-02-17 15:09:44 +0000
commita8539c990f6de6ea65ca3e8677045efd719d347c (patch)
tree9f09cb9072e4abc19ef9bfe943ee2e2ecfb837c4
parent6992b275359c8073aebd123e7280b7d2154988b0 (diff)
merge r4899 from branch 2.0 to trunk
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/trunk@4900 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/ws_functions.inc.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index b3b90a027..37784a519 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;