mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 18:01:31 +02:00
bug 2725: Piwigo isn't compatible with suPHP + better handling of watermark upload errors merge from trunk to branch 2.4
git-svn-id: http://piwigo.org/svn/branches/2.4@17676 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -43,16 +43,24 @@ if (isset($_FILES['watermarkImage']) and !empty($_FILES['watermarkImage']['tmp_n
|
||||
else
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +246,7 @@ SELECT
|
||||
{
|
||||
rename($source_filepath, $file_path);
|
||||
}
|
||||
@chmod($file_path, 0644);
|
||||
|
||||
if (pwg_image::get_library() != 'gd')
|
||||
{
|
||||
|
||||
@@ -518,7 +518,7 @@ jQuery(document).ready(function() {
|
||||
<span id="addWatermark"{if isset($ferrors.watermarkImage)} style="display:inline"{/if}>
|
||||
{'add a new watermark'|@translate} {'... or '|@translate}<a href="#" class="addWatermarkOpen">{'Select a file'|@translate}</a>
|
||||
<br><input type="file" size="60" id="watermarkImage" name="watermarkImage"{if isset($ferrors.watermarkImage)} class="dError"{/if}> (png)
|
||||
{if isset($ferrors.watermarkImage)}<span class="dErrorDesc" title="{$ferrors.watermarkImage}">!</span>{/if}
|
||||
{if isset($ferrors.watermarkImage)}<span class="dErrorDesc" title="{$ferrors.watermarkImage|@htmlspecialchars}">!</span>{/if}
|
||||
</span>{* #addWatermark *}
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user