diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 651280369a1..7251db1476e 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1270,6 +1270,7 @@ class FormFile
{
print '';
$section_dir = dirname(GETPOST('urlfile', 'alpha'));
+ if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
print '';
print '';
print '';
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index bd480dc865e..fc4d7b9f24c 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -272,7 +272,11 @@ if (empty($backtourl))
}
elseif (in_array($modulepart, array('bank'))) $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($file);
elseif (in_array($modulepart, array('mrp'))) $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".$id.'&file='.urldecode($file);
- elseif (in_array($modulepart, array('medias'))) $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website."&file=".urldecode($file).'&preopend=image';
+ elseif (in_array($modulepart, array('medias'))) {
+ $section_dir = dirname($file);
+ if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
+ $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website.'§ion_dir='.urlencode($section_dir);
+ }
// Generic case that should work for everybody else
else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file);
}
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index aa24134a6f4..7153a7bc3d0 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -321,10 +321,7 @@ if (GETPOST('refreshsite', 'alpha') || GETPOST('refreshsite.x', 'alpha') || GETP
}
if (GETPOST('refreshpage', 'alpha') && !in_array($action, array('updatecss'))) $action = 'preview';
-if ($action == 'renamefile') {
- $action = 'file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager'
-}
-if ($cancel && $action == 'file_manager') {
+if ($cancel && $action == 'renamefile') {
$cancel = '';
}
@@ -346,6 +343,10 @@ if ($sortorder) $backtopage .= '&sortorder='.$sortorder;
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$backtopage = $savbacktopage;
+if ($action == 'renamefile') { // Must be after include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; If action were renamefile, we set it to 'file_manager'
+ $action = 'file_manager';
+}
+
if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
@@ -2423,8 +2424,7 @@ if (!GETPOST('hide_websitemenu'))
// Toolbar for pages
-
- if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')))
+ if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')) && !$file_manager)
{
print ''; // Close current websitebar to open a new one