mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-05-09 18:05:56 +03:00
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
This commit is contained in:
parent
6992b27535
commit
a8539c990f
1 changed files with 22 additions and 0 deletions
|
@ -896,6 +896,7 @@ UPDATE '.IMAGES_TABLE.'
|
||||||
|
|
||||||
function ws_images_add_chunk($params, &$service)
|
function ws_images_add_chunk($params, &$service)
|
||||||
{
|
{
|
||||||
|
ws_logfile('[ws_images_add_chunk] welcome');
|
||||||
// data
|
// data
|
||||||
// original_sum
|
// original_sum
|
||||||
// type {thumb, file, high}
|
// type {thumb, file, high}
|
||||||
|
@ -911,6 +912,20 @@ function ws_images_add_chunk($params, &$service)
|
||||||
return new PwgError(405, "This method requires HTTP POST");
|
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';
|
$upload_dir = PHPWG_ROOT_PATH.'upload/buffer';
|
||||||
|
|
||||||
// create the upload directory tree if not exists
|
// create the upload directory tree if not exists
|
||||||
|
@ -1029,6 +1044,13 @@ function add_file($file_path, $type, $original_sum, $file_sum)
|
||||||
$file_path = file_path_for_type($file_path, $type);
|
$file_path = file_path_for_type($file_path, $type);
|
||||||
|
|
||||||
$upload_dir = dirname($file_path);
|
$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)) {
|
if (!is_dir($upload_dir)) {
|
||||||
umask(0000);
|
umask(0000);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue