[pmwiki-devel] MatchPageNames

Hans design5 at softflow.co.uk
Tue May 22 16:04:08 CDT 2007


Tuesday, May 22, 2007, 9:47:03 PM, Patrick wrote:

> Any chance you could give an example of code that is
> showing the wrong value?

In fox.php a permission pattern check is done:

   $namecheck = (boolean)MatchPageNames($targetname,$pnames);

$pnames is a string with page name patterns, separated by commas,
like "-PmWiki.*,-Site.*,Forum.*"

$targetname is the full pagename of the target page for posting.

For instance this:

   echo (boolean)MatchPageNames('Forum.Test1','-PmWiki.*,-Site.*');

will echo 1.
But the target page is not part of the pattern.

I can avoid the problem with this code:

   $match = MatchPageNames($targetname,$pnames);
   if($targetname==$match[0]) $namecheck=1;

but it introduces an extra comparison.

Hans




More information about the pmwiki-devel mailing list