Index: /trunk/admin/include/configuration_watermark_process.inc.php
===================================================================
--- /trunk/admin/include/configuration_watermark_process.inc.php (revision 17674)
+++ /trunk/admin/include/configuration_watermark_process.inc.php (revision 17675)
@@ -44,14 +44,22 @@
{
$upload_dir = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'watermarks';
+ if (mkgetdir($upload_dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR))
+ {
+ $new_name = get_filename_wo_extension($_FILES['watermarkImage']['name']).'.png';
+ $file_path = $upload_dir.'/'.$new_name;
- include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
- prepare_directory($upload_dir);
-
- $new_name = get_filename_wo_extension($_FILES['watermarkImage']['name']).'.png';
- $file_path = $upload_dir.'/'.$new_name;
-
- move_uploaded_file($_FILES['watermarkImage']['tmp_name'], $file_path);
-
- $pwatermark['file'] = substr($file_path, strlen(PHPWG_ROOT_PATH));
+ if (move_uploaded_file($_FILES['watermarkImage']['tmp_name'], $file_path))
+ {
+ $pwatermark['file'] = substr($file_path, strlen(PHPWG_ROOT_PATH));
+ }
+ else
+ {
+ $page['errors'][] = $errors['watermarkImage'] = "$file_path " .l10n('no write access');
+ }
+ }
+ else
+ {
+ $page['errors'][] = $errors['watermarkImage'] = sprintf( l10n('Add write access to the "%s" directory'), $upload_dir);
+ }
}
}
Index: /trunk/admin/include/functions_upload.inc.php
===================================================================
--- /trunk/admin/include/functions_upload.inc.php (revision 17674)
+++ /trunk/admin/include/functions_upload.inc.php (revision 17675)
@@ -247,4 +247,5 @@
rename($source_filepath, $file_path);
}
+ @chmod($file_path, 0644);
if (pwg_image::get_library() != 'gd')
Index: /trunk/admin/themes/default/template/configuration.tpl
===================================================================
--- /trunk/admin/themes/default/template/configuration.tpl (revision 17674)
+++ /trunk/admin/themes/default/template/configuration.tpl (revision 17675)
@@ -519,5 +519,5 @@
{'add a new watermark'|@translate} {'... or '|@translate}{'Select a file'|@translate}
(png)
- {if isset($ferrors.watermarkImage)}!{/if}
+ {if isset($ferrors.watermarkImage)}!{/if}
{* #addWatermark *}
Index: /trunk/i.php
===================================================================
--- /trunk/i.php (revision 17674)
+++ /trunk/i.php (revision 17675)
@@ -624,4 +624,5 @@
$image->write( $page['derivative_path'] );
$image->destroy();
+@chmod($page['derivative_path'], 0644);
$timing['save'] = time_step($step);
Index: /trunk/include/template.class.php
===================================================================
--- /trunk/include/template.class.php (revision 17674)
+++ /trunk/include/template.class.php (revision 17675)
@@ -79,26 +79,4 @@
}
- if (!isset($conf['combined_dir_checked']))
- {
- $dir = PHPWG_ROOT_PATH.PWG_COMBINED_DIR;
- mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
- if (!is_writable($dir))
- {
- load_language('admin.lang');
- fatal_error(
- sprintf(
- l10n('Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'),
- PWG_COMBINED_DIR
- ),
- l10n('an error happened'),
- false // show trace
- );
- }
- if (function_exists('pwg_query')) {
- conf_update_param('combined_dir_checked', 1);
- }
- }
-
-
$compile_dir = PHPWG_ROOT_PATH.$conf['data_location'].'templates_c';
mkgetdir( $compile_dir );
@@ -1344,5 +1322,7 @@
}
- file_put_contents( PHPWG_ROOT_PATH . $file, $output );
+ mkgetdir( dirname(PHPWG_ROOT_PATH.$file) );
+ file_put_contents( PHPWG_ROOT_PATH.$file, $output );
+ @chmod(PHPWG_ROOT_PATH.$file, 0644);
$out_file = $file;
$out_version = false;
Index: /trunk/include/ws_functions.inc.php
===================================================================
--- /trunk/include/ws_functions.inc.php (revision 17674)
+++ /trunk/include/ws_functions.inc.php (revision 17675)
@@ -1508,24 +1508,8 @@
// create the upload directory tree if not exists
- if (!is_dir($upload_dir)) {
- umask(0000);
- if (!@mkdir($upload_dir, 0777, true))
- {
- return new PwgError(500, 'error during buffer directory creation');
- }
- }
-
- if (!is_writable($upload_dir))
- {
- // last chance to make the directory writable
- @chmod($upload_dir, 0777);
-
- if (!is_writable($upload_dir))
- {
- return new PwgError(500, 'buffer directory has no write access');
- }
- }
-
- secure_directory($upload_dir);
+ if (!mkgetdir($upload_dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR))
+ {
+ return new PwgError(500, 'error during buffer directory creation');
+ }
$filename = sprintf(