?
avatar ryandemmer
ryandemmer
28 Feb 2012

In components/com_content/router.php, the following condition (line 47) does not remove the layout from the query :

// are we dealing with an article or category that is attached to a menu item?
if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == intval($query['id'])) {
        unset($query['view']);

        if (isset($query['catid'])) {
            unset($query['catid']);
        }

        unset($query['id']);

        return $segments;
    }

this may result in links like index.php/extensions?layout=blog, where the original link was something like index.php?option=com_content&view=category&layout=blog&id=20&Itemid=527

Easily fixed by removing the layout from the $query, eg:

// are we dealing with an article or category that is attached to a menu item?
if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == intval($query['id'])) {
        unset($query['view']);

        if (isset($query['catid'])) {
            unset($query['catid']);
        }
        
        if (isset($query['layout'])) {
            unset($query['layout']);
        }

        unset($query['id']);

        return $segments;
    }
avatar ryandemmer ryandemmer - open - 28 Feb 2012
avatar ryandemmer
ryandemmer - comment - 28 Feb 2012

Re-submitted with pull request

avatar zero-24 zero-24 - close - 28 Feb 2012
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?
Build staging

Add a Comment

Login with GitHub to post a comment