From 585afa14ded687899a2b3b3ade47d02eb6958dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 17 Aug 2026 04:41:05 +0200 Subject: [PATCH] Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in ecm (#39557) * Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in ecm Replaces manual '?key='.urlencode($val).'&key2='.urlencode($val2) string-building with dolBuildUrl($path, $params) across the ECM directory-tree/file-manager code, for consistency with the rest of the codebase (see htdocs/core/lib/ecm.lib.php, which already uses this pattern for the same page) and to benefit from dolBuildUrl()'s buildurl hook. - core/ajax/ajaxdirtree.php: the dir_card.php edit link built from the sql tree loop. - ecm/dir_card.php: the edit/add-section action buttons and the two delete confirmation URLs. Also switches the three buttons that used to manually concatenate '&token='.newToken() to dolBuildUrl()'s own $addtoken parameter. - ecm/class/ecmfiles.class.php: EcmFiles::getNomUrl()'s document.php and file_card.php URLs. - ecm/tpl/enablefiletreeajax.tpl.php: the ajaxdirtree.php script URL and the ajaxdirpreview.php URL. The token here intentionally stays currentToken() (not dolBuildUrl()'s own newToken()-based $addtoken), per the existing comment: ajaxdirtree.php has NOTOKENRENEWAL defined, so the token must match the one already valid on the calling page. $paramwithoutsection is a pre-built raw query-string fragment from an external caller and is appended as-is after the dolBuildUrl() result rather than folded into it. Verified all five refactored URL-building expressions produce byte- identical output to the original code for representative inputs (including values with '/', '&' and spaces), except for query parameter order (which has no effect) and one real, minor pre- existing bug this incidentally fixes: the delete-section confirm URL in dir_card.php was building '&module='.$module without urlencode(), now correctly encoded by dolBuildUrl()/http_build_query(). Could not do a live browser check (no Chrome available for Playwright in this environment) - verified via php -l, phpcs, and a standalone script comparing old vs new output for each call site instead. * Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in filemanager.tpl.php Same refactor as the previous commit, applied to the 7 remaining manually-concatenated URLs in core/tpl/filemanager.tpl.php (used by the ECM/medias file manager): the delete-file/delete-section/ convert-to-webp confirm URLs, the create-directory and refresh-list toolbar buttons (now using dolBuildUrl()'s $addtoken instead of a manual '&token='.newToken()), the two generate-webp buttons, and the "Root" link. $websitekeyandpageid is kept as a helper to build the raw sub-query string embedded once (single-encoded) as the create-directory button's 'backtopage' value - it is not itself passed to dolBuildUrl. Verified all 7 refactored URL-building expressions produce the same query parameters as the original code for representative inputs (compared as parsed, order-independent query strings, since http_build_query() does not preserve insertion order the same way as the original manual concatenation), including one case (convertimgwebp confirm with sortfield/sortorder) where the original code had a harmless but sloppy leading '?&' that dolBuildUrl() no longer produces. * fix * Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in index_auto.php Same refactor as the previous commits, applied to the 4 manually- concatenated URLs in ecm/index_auto.php: the delete-file and delete-section confirm URLs, the refresh-list toolbar link, and the per-directory link in the auto-directories list. Verified all 4 refactored URL-building expressions produce the same query parameters as the original code for representative inputs (including an empty-module/empty-section case for the refresh link, and values with '/' and spaces for the others). * Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in ecm (file_card, dir_add_card, index_medias) Same refactor as the previous commits, applied to the remaining manually-concatenated URLs in: - ecm/file_card.php: the cancel and rename-file redirects, the internal download link (document.php), the delete-file confirm URL and the edit button. - ecm/dir_add_card.php: the delete-section confirm URL and the delete button (now using dolBuildUrl()'s $addtoken instead of a manual '&token='.newToken()). - ecm/index_medias.php: the $backtopage URL used by core/actions_linkedfiles.inc.php after a confirm_deletefile. Left ecm/search.php's '$param = "§ion=".urlencode($section)' alone: it is a raw query-string fragment (starting with '&', no leading path) passed into FormFile::list_of_documents(), not a base+params URL build, so it does not fit the dolBuildUrl($path, $params) shape - same reasoning as $paramwithoutsection in the already-refactored enablefiletreeajax.tpl.php. Verified all 8 refactored URL-building expressions produce the same query parameters as the original code for representative inputs (order-independent comparison, since http_build_query() does not preserve the original insertion order). --- htdocs/core/ajax/ajaxdirtree.php | 10 +++-- htdocs/core/tpl/filemanager.tpl.php | 46 +++++++++++++++++------ htdocs/ecm/class/ecmfiles.class.php | 6 +-- htdocs/ecm/dir_add_card.php | 4 +- htdocs/ecm/dir_card.php | 33 +++++++++++++--- htdocs/ecm/file_card.php | 19 ++++++---- htdocs/ecm/index_auto.php | 21 ++++++++--- htdocs/ecm/index_medias.php | 17 +++++++-- htdocs/ecm/tpl/enablefiletreeajax.tpl.php | 21 +++++++++-- 9 files changed, 132 insertions(+), 45 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 3055dd1c8c8..e6fb77a9818 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2024-2026 MDW * * This program is free software; you can redistribute it and/or modify @@ -503,8 +503,12 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, // Edit link print ''; print ' $modulepart, + 'section' => $val['id'], + 'relativedir' => $val['fullrelativename'], + 'backtopage' => $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid, + )); print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').''; // Add link diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 4e8196b0750..d64c4f4e7da 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,6 +55,7 @@ if (empty($conf) || !is_object($conf)) { @phan-var-force EcmDirectory $ecmdir @phan-var-force ?string $module @phan-var-force int $section +@phan-var-force string $websitekey '; ?> @@ -95,7 +96,7 @@ if (!isset($section)) { // Confirm remove file (for non javascript users) if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax)) { // TODO Add website, pageid, filemanager if defined - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section).'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section, 'urlfile' => GETPOST("urlfile"))), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1); } // Start container of all panels @@ -111,7 +112,15 @@ print '
'; // Toolbar if ($permtoadd) { $websitekeyandpageid = (!empty($websitekey) ? '&website='.urlencode($websitekey) : '').(!empty($pageid) ? '&pageid='.urlencode((string) $pageid) : ''); - print ''; + $paramscreatedir = array('action' => 'create', 'module' => $module); + if (!empty($websitekey)) { + $paramscreatedir['website'] = $websitekey; + } + if (!empty($pageid)) { + $paramscreatedir['pageid'] = $pageid; + } + $paramscreatedir['backtopage'] = $_SERVER["PHP_SELF"].'?file_manager=1'.$websitekeyandpageid; + print ''; print img_picto('', 'folder-plus', '', 0, 0, 0, '', 'size15x marginrightonly'); print ''; } else { @@ -120,19 +129,27 @@ if ($permtoadd) { print ''; } if ($module == 'ecm') { - $tmpurl = ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&module='.$module : '').($section ? '§ion='.urlencode($section) : ''))); + if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { + $tmpurl = '#'; + } else { + $paramsrefresh = array('action' => 'refreshmanual', 'module' => $module); + if ($section) { + $paramsrefresh['section'] = $section; + } + $tmpurl = dolBuildUrl($_SERVER["PHP_SELF"], $paramsrefresh); + } print ''; print img_picto('', 'refresh', 'id="refreshbutton"', 0, 0, 0, '', 'size15x marginrightonly'); print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site // @phan-suppress-next-line PhanTypeExpectedObjectPropAccess - print 'ref).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; + print ' 'confirmconvertimgwebp', 'website' => $website->ref), true).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly'); print ''; } elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm if (getDolGlobalInt('ECM_SHOW_GENERATE_WEBP_BUTTON')) { - print ''; + print ' 'confirmconvertimgwebp'), true).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly'); print ''; } @@ -222,7 +239,7 @@ print '
'; // Ask confirmation of deletion of directory if ($action == 'delete_section') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section)), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); } // End confirm @@ -241,14 +258,14 @@ if ($action == 'confirmconvertimgwebp') { if ($module == 'medias') { $formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website'); // @phan-suppress-current-line PhanTypeExpectedObjectPropAccess } - $param = ''; + $paramsconvertimgwebp = array(); if (!empty($sortfield)) { - $param .= '&sortfield='.urlencode($sortfield); + $paramsconvertimgwebp['sortfield'] = $sortfield; } if (!empty($sortorder)) { - $param .= '&sortorder='.urlencode($sortorder); + $paramsconvertimgwebp['sortorder'] = $sortorder; } - print $form->formconfirm($_SERVER["PHP_SELF"].($param ? '?'.$param : ''), empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp', basename($file)), 'convertimgwebp', $formquestion, "yes", 1); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], $paramsconvertimgwebp), empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp', basename($file)), 'convertimgwebp', $formquestion, "yes", 1); $action = 'file_manager'; } @@ -326,7 +343,12 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { // Show the link to "Root" if ($showroot) { - print '
'; + $paramsroot = array('file_manager' => 1); + if (!empty($websitekey)) { + $paramsroot['website'] = $websitekey; + } + $paramsroot['pageid'] = $pageid; + print '
'; if ($module == 'medias') { print $langs->trans("RootOfMedias"); } else { diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 1b774724f62..e89a0bfebd5 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Francis Appels - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024-2026 MDW * * This program is free software; you can redistribute it and/or modify @@ -1055,9 +1055,9 @@ class EcmFiles extends CommonObject $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); } } - $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.((int) $this->entity); + $url = dolBuildUrl(DOL_URL_ROOT.'/document.php', array('modulepart' => $option, 'file' => $tmppath.'/'.$this->filename, 'entity' => (int) $this->entity)); } else { - $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id; + $url = dolBuildUrl(DOL_URL_ROOT.'/ecm/file_card.php', array('id' => $this->id)); } $linkclose = ''; diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 434dacaf467..e03c9d6c6c7 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -292,7 +292,7 @@ if (empty($action) || $action == 'delete_section') { // Generate form to confirm deletion of a category line if ($action == 'delete_section') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection'); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section)), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection'); } @@ -300,7 +300,7 @@ if (empty($action) || $action == 'delete_section') { print '
'; // Delete - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?section='.urlencode($section).'&action=delete_section&token='.newToken(), '', $user->hasRight('ecm', 'setup')); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section, 'action' => 'delete_section'), true), '', $user->hasRight('ecm', 'setup')); print '
'; } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index ab4e52f5eb1..5fb374c9c6e 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -463,16 +463,25 @@ if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') { print '
'; if ($permissiontoadd) { - print ''.$langs->trans('Edit').''; + print ''.$langs->trans('Edit').''; } if ($permissiontoadd) { - print ''.$langs->trans('ECMAddSection').''; + print ''.$langs->trans('ECMAddSection').''; } else { print ''.$langs->trans('ECMAddSection').''; } - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&module='.urlencode($module).'§ion='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permissiontoadd); + $paramsdelete = array( + 'id' => $object->id, + 'action' => 'delete', + 'module' => $module, + 'section' => $section, + ); + if ($backtopage) { + $paramsdelete['backtopage'] = $backtopage; + } + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', dolBuildUrl($_SERVER["PHP_SELF"], $paramsdelete, true), '', $permissiontoadd); print '
'; } @@ -480,7 +489,14 @@ if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') { // Confirm remove file if ($action == 'deletefile') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST("section", 'alpha')).'&urlfile='.urlencode(GETPOST("urlfile")).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + $paramsdeletefile = array( + 'section' => GETPOST("section", 'alpha'), + 'urlfile' => GETPOST("urlfile"), + ); + if ($backtopage) { + $paramsdeletefile['backtopage'] = $backtopage; + } + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], $paramsdeletefile), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); } // Confirm remove dir @@ -495,7 +511,14 @@ if ($action == 'delete' || $action == 'delete_dir') { ); } - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).'&module='.$module.($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1); + $paramsdeletedir = array( + 'section' => GETPOST('section', 'alpha'), + 'module' => $module, + ); + if ($backtopage) { + $paramsdeletedir['backtopage'] = $backtopage; + } + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], $paramsdeletedir), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1); } diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 760d4fb452e..9a470c1b2f0 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -135,7 +135,11 @@ if ($cancel) { header("Location: ".$backtopage); exit; } else { - header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section).($module ? '&module='.urlencode($module) : '')); + $paramscancel = array('urlfile' => $urlfile, 'section' => $section); + if ($module) { + $paramscancel['module'] = $module; + } + header('Location: '.dolBuildUrl($_SERVER["PHP_SELF"], $paramscancel)); exit; } } @@ -236,7 +240,7 @@ if ($action == 'update' && $permissiontoadd) { $urlfile .= '.noexe'; } - header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section)); + header('Location: '.dolBuildUrl($_SERVER["PHP_SELF"], array('urlfile' => $urlfile, 'section' => $section))); exit; } else { $db->rollback(); @@ -343,11 +347,12 @@ print ''; print $form->textwithpicto($langs->trans("DirectDownloadInternalLink"), $langs->trans("PrivateDownloadLinkDesc")); print ''; $modulepart = 'ecm'; -$rellink = '/document.php?modulepart=' . $modulepart . '&attachment=1'; +$paramsrellink = array('modulepart' => $modulepart, 'attachment' => 1); if (!empty($object->entity)) { - $rellink .= '&entity='.$object->entity; + $paramsrellink['entity'] = $object->entity; } -$rellink .= '&file='.urlencode($filepath); +$paramsrellink['file'] = $filepath; +$rellink = dolBuildUrl('/document.php', $paramsrellink); $fulllink = $urlwithroot.$rellink; print img_picto('', 'globe').' '; if ($action != 'edit') { @@ -413,7 +418,7 @@ if ($action == 'edit') { // Confirm deletion of a file if ($action == 'deletefile') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section)), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1); } if ($action != 'edit') { @@ -421,7 +426,7 @@ if ($action != 'edit') { print '
'; if ($user->hasRight('ecm', 'setup')) { - print ''.$langs->trans('Edit').''; + print ''.$langs->trans('Edit').''; } print '
'; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 1c944478a3b..fccfc5e4aef 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -2,7 +2,7 @@ /* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2008-2010 Regis Houssin * Copyright (C) 2016 Alexandre Spangaro - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2026 MDW * Copyright (C) 2025 Joachim Kueter * @@ -428,7 +428,7 @@ print dol_get_fiche_head($head, 'index_auto', '', -1, ''); // Confirm remove file (for non javascript users) if ($action == 'deletefile' && empty($conf->use_javascript_ajax)) { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section).'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section, 'urlfile' => GETPOST("urlfile"))), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1); } // Start container of all panels @@ -442,7 +442,18 @@ if ($action == 'deletefile' && empty($conf->use_javascript_ajax)) { print '
'; // Toolbar -$url = ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&module='.urlencode($module) : '').($section ? '§ion='.urlencode($section) : ''))); +if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { + $url = '#'; +} else { + $paramsrefresh = array('action' => 'refreshmanual'); + if ($module) { + $paramsrefresh['module'] = $module; + } + if ($section) { + $paramsrefresh['section'] = $section; + } + $url = dolBuildUrl($_SERVER["PHP_SELF"], $paramsrefresh); +} print ''; print img_picto('', 'refresh', 'id="refreshbutton"', 0, 0, 0, '', 'size15x marginrightonly'); print ''; @@ -459,7 +470,7 @@ print '
'; // Generate form to confirm the deletion of a category line if ($action == 'delete_section') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); + print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], array('section' => $section)), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); } // End confirm @@ -506,7 +517,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act } print '