Clearer escaping in CMSMain

No direct security issue, but makes intent clearer
This commit is contained in:
Ingo Schommer 2013-09-24 12:12:57 +02:00
parent e170f4c21b
commit 86339a551d

View File

@ -747,13 +747,21 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
if($num) { if($num) {
return sprintf( return sprintf(
'<a class="cms-panel-link list-children-link" data-pjax-target="ListViewForm,Breadcrumbs" href="%s">%s</a>', '<a class="cms-panel-link list-children-link" data-pjax-target="ListViewForm,Breadcrumbs" href="%s">%s</a>',
Controller::join_links($controller->Link(), "?ParentID={$item->ID}&view=list"), Controller::join_links(
$controller->Link(),
sprintf("?ParentID=%d&view=list", (int)$item->ID)
),
$num $num
); );
} }
}, },
'getTreeTitle' => function($value, &$item) use($controller) { 'getTreeTitle' => function($value, &$item) use($controller) {
return '<a class="action-detail" href="' . singleton('CMSPageEditController')->Link('show') . '/' . $item->ID . '">' . $item->TreeTitle . '</a>'; return sprintf(
'<a class="action-detail" href="%s/%d">%s</a>',
singleton('CMSPageEditController')->Link('show'),
(int)$item->ID,
$item->TreeTitle // returns HTML, does its own escaping
);
} }
)); ));