Summary:
includeprefix checks for substring anywhere in alias instead of at the beginning of the alias
Detailed Description:
In CMSMS 1.11.8 and 1.11.9, the includeprefix option doesn't actually match a
true prefix, but instead it matches a substring anywhere in the page aliases.
In the CMSMS 1.11.9 code, this is found in
/modules/MenuManager/MenuManager.module.php on line 177. In the CMSMS trunk,
this is found in /modules/MenuManager/MenuManager.module.php on line 128 (as of
this writing).
The line in each is nearly the same, minus spacing of characters:
if( strstr($content->Alias(),$oneprefix) !== FALSE ) {
If we actually want to search for a true prefix, the strstr should either
accompanied by a check of strpos or should be replaced with a substr call, such
as:
if( strstr($content->Alias(),$oneprefix) !== FALSE &&
strpos($content->Alias(),$oneprefix) === 0 ) {
Or maybe this:
if( substr($content->Alias(),0,strlen($oneprefix)) === $oneprefix ) {
Please note, I haven't had a chance to test these code snippets - I've only just
typed them up here as a train of thought. As an aside, this sort of full
substring/wildcard searching in page aliases for building menus could be useful,
so perhaps we ought to move it to another parameter.