diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 86bb3a0a270..41ecb945509 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -150,26 +150,29 @@ if ($action == 'add' && $user->rights->ecm->setup) } // Remove file -if ($action == 'confirm_deletefile' && GETPOST('confirm') == 'yes') +if ($action == 'confirm_deletefile') { - $result=$ecmdir->fetch($section); - if (! $result > 0) - { - dol_print_error($db,$ecmdir->error); - exit; - } - $relativepath=$ecmdir->getRelativePath(); - $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; - $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + if (GETPOST('confirm') == 'yes') + { + $result=$ecmdir->fetch($section); + if (! $result > 0) + { + dol_print_error($db,$ecmdir->error); + exit; + } + $relativepath=$ecmdir->getRelativePath(); + $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; + $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $result=dol_delete_file($file); + $result=dol_delete_file($file); - $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + $mesg = '
'.$langs->trans("FileWasRemoved").'
'; - $result=$ecmdir->changeNbOfFiles('-'); - $action='file_manager'; + $result=$ecmdir->changeNbOfFiles('-'); - clearstatcache(); + clearstatcache(); + } + $action='file_manager'; } // Remove directory @@ -315,7 +318,7 @@ $moreheadcss=" _width: 700px; /* min-width for IE6 */ } "; -$moreheadjs=" +$moreheadjs=empty($conf->use_javascript_ajax)?"":" formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); + if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); + + print ''; } else { @@ -834,20 +824,12 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti // End left banner -if ($conf->use_javascript_ajax) -{ ?> - - + + + '; - print ''; -} // End of page - llxFooter(); $db->close();