dolibarr/htdocs
Frédéric FRANCE 585afa14de
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 = "&section=".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).
2026-08-17 04:41:05 +02:00
..
accountancy Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-13 17:48:25 +02:00
adherents Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-15 02:00:19 +02:00
admin Clean code 2026-08-16 06:12:35 +02:00
ai New: AI MCP create_product tool to create products/services (#39434) 2026-08-13 03:08:28 +02:00
api Automated merge from 24.0 to develop 2026-08-13 17:54:41 +02:00
asset Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into 2026-08-14 16:13:22 +02:00
asterisk
barcode
blockedlog Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-15 01:59:25 +02:00
bom NEW: Migrate BOM extrafields admin pages to the unified page 2026-08-11 17:27:03 +02:00
bookcal NEW: Migrate user, usergroup and remaining orphan extrafields admin pages to the unified page 2026-08-12 04:52:17 +02:00
bookmarks
categories NEW: Migrate category extrafields admin pages to the unified page 2026-08-11 19:30:44 +02:00
collab
comm Clean code 2026-08-16 06:12:35 +02:00
commande Fix #39412 Add PRG redirect after adding a line to avoid duplicate on refresh (#39528) 2026-08-15 02:45:27 +02:00
compta Fix #39412 Add PRG redirect after adding a line to avoid duplicate on refresh (#39528) 2026-08-15 02:45:27 +02:00
conf
contact Qual: Remove SQL injection suppressions from Phan baseline (#39450) 2026-08-11 02:21:54 +02:00
contrat Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into 2026-08-14 16:13:22 +02:00
core Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in ecm (#39557) 2026-08-17 04:41:05 +02:00
cron
custom
datapolicy
dav Revert "/imports/index.php wrongly shows access refused (#39379)" (#39386) 2026-08-04 22:23:57 +02:00
debugbar
delivery
don NEW: Migrate donation extrafields admin page to the unified page 2026-08-11 19:53:57 +02:00
ecm Qual: Use dolBuildUrl() instead of manual urlencode() concatenation in ecm (#39557) 2026-08-17 04:41:05 +02:00
emailcollector Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-06 00:35:00 +02:00
eventorganization FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
expedition FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
expensereport FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
exports Fix deletion must not use the glob by default. 2026-07-29 13:20:28 +02:00
fichinter FIX: CommonObject::updateExtraField() method should call the corresponding object update trigger (#39526) 2026-08-15 02:04:45 +02:00
fourn Fix #39412 Add PRG redirect after adding a line to avoid duplicate on refresh (#39528) 2026-08-15 02:45:27 +02:00
ftp
holiday FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
hrm FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
imports Redo #39379 2026-08-04 22:46:09 +02:00
includes
install FIX #37658 - Add unit tests for TTC unit price rounding and add fixes for others objects (proposals, orders, invoices and contracts) (#39055) 2026-08-11 19:48:40 +02:00
intracommreport FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
knowledgemanagement NEW: Migrate knowledge management extrafields admin page to the unified page 2026-08-11 18:59:38 +02:00
langs Trans 2026-08-17 03:48:53 +02:00
loan
mailmanspip/class
margin Qual: Update SQL query variables for situation mode in margin reports (#39282) 2026-07-27 13:02:34 +02:00
modulebuilder Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-15 01:59:25 +02:00
mrp Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-15 01:59:25 +02:00
multicurrency qual: Update Phan baseline and suppress duplicate array key warnings (#39352) 2026-08-04 18:53:06 +02:00
opensurvey
partnership FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
paypal
printing
product FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
projet FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
public FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
quickmemo NEW: Migrate user, usergroup and remaining orphan extrafields admin pages to the unified page 2026-08-12 04:52:17 +02:00
reception reception: cache Reception/Entrepot fetches in other-receptions tooltip (#39454) 2026-08-11 19:47:57 +02:00
recruitment NEW: Migrate recruitment extrafields admin pages to the unified page 2026-08-11 20:16:03 +02:00
resource NEW: Add phpunit test for Dolresource class (#39520) 2026-08-14 20:31:06 +02:00
salaries NEW: Migrate salaries extrafields admin page to the unified page 2026-08-11 20:22:11 +02:00
societe Fix prevent edit by external users - reported by VulnCheck 2026-08-16 06:29:55 +02:00
stripe
subtotals FIX #37658 - Add unit tests for TTC unit price rounding and add fixes for others objects (proposals, orders, invoices and contracts) (#39055) 2026-08-11 19:48:40 +02:00
supplier_invoice/admin NEW: Migrate supplier invoice extrafields admin pages to the unified page 2026-08-11 20:44:37 +02:00
supplier_order/admin NEW: Migrate order and supplier order extrafields admin pages to the unified page 2026-08-11 19:10:05 +02:00
supplier_proposal Merge remote-tracking branch 'upstream/develop' into extrafields-admin-unification 2026-08-12 07:06:22 +02:00
takepos Qual: Fix 'SqlInjection' notices (#39232) 2026-08-01 23:54:52 +02:00
theme Clean code 2026-08-16 06:12:35 +02:00
ticket Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-06 00:38:13 +02:00
user FIX avoid php warnings (#39555) 2026-08-15 18:17:19 +02:00
variants NEW: Migrate product variants extrafields admin pages to the unified page 2026-08-11 17:10:27 +02:00
webhook FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523) 2026-08-15 18:33:12 +02:00
webportal FIX webportal shared documents controller page (#39485) 2026-08-12 23:04:50 +02:00
webservices Clean property 2026-08-14 19:42:47 +02:00
website Fix a user without perm for dyn content can import dyn templates - 2026-08-06 19:07:48 +02:00
workstation NEW: Migrate workstation extrafields admin page to the unified page 2026-08-11 19:23:30 +02:00
zapier
document.php Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-13 17:16:49 +02:00
favicon.ico
filefunc.inc.php
index.php
main.inc.php Clean code 2026-08-07 19:00:27 +02:00
master.inc.php
robots.txt
security.txt
version.inc.php Prepare 24.0 release 2026-08-12 22:04:04 +02:00
viewimage.php Fix file access with hasp parameter - reported by tremor hunter 2026-08-12 22:16:43 +02:00
waf.inc.php Fix: more complete blacklist in waf - reported by Paweł Bednarz 2026-08-09 02:01:05 +02:00