* 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).