[pmwiki-users] Fwd: AuthUser problem

Jason Frisvold xenophage0 at gmail.com
Fri Apr 6 11:47:33 CDT 2007


On 4/6/07, Hans <design5 at softflow.co.uk> wrote:
> I am not sure why $SiteGroup does not point to the default value
> 'Site'. But you can safely set this in config.php:
> $SiteGroup = 'Site';

The problem is that it does, usually..  It's only when the FmtPageName
call from authuser.php is processed that it doesn't..  although,
that's not strictly true now that I've done more debugging..

When FmtPageName is called, $fmt is set to $SiteGroup.AuthUser.  When
it gets to this line :

  $fmt = preg_replace("/(?:$pvpat)\\b/e", "PageVar(\$pagename, '$0')", $fmt);

it strips out $SiteGroup and replaces it with nothing.

$pvpat is set to an empty string when this is called.  So, the
replacement is, I believe, to parse the string, currently set to
"$SiteGroup.AuthUser" and replace any occurances of "\b" with
"PageVar($pagename, '$0')"

At least, I think that's right..  (?:$pvpat) means to match without a
backreference.  I'm guessing the parentheses are required in case
$pvpat evaluates to an expression with a pipe in it?

The double backslash escapes itself, leaving a backslash in it's
place.  b, of course, is b.  And finally, the e modifier at the end
means that the replacement string should be evaluated as PHP before
replacing the search string with it..  So the PageVal function would
be called in the event of a match and a replacement made..

Sorry, had to walk myself through it too...

So I'm confused as to why $SiteGroup disappears after this..  Since
$pvpat isn't set at all, preg_replace should never replace anything,
and $fmt should be returned unchanged..

Now, if I comment out that line, it works as it should.
Authentication succeeds and life goes one.  However, I'm not sure what
I'm breaking by removing that code ...

And this is stock code!  That's the real kicker here, there's nothing
modified..  ???

So, I'm stumped...  Any thoughts?

> The variable exists so admins can customise the wiki and use a
> different value for Site group. Perhaps important for non-english
> sites.
>
> $SiteGroup = 'Site';  is set otherwise in pmwiki.php.

Thanks, unfortunately, as I outlined above, it appears upon further
inspection that $SiteGroup never loses it's value, but that
FmtPageName is stripping it out for some odd reason..

>   ~Hans

-- 
Jason 'XenoPhage' Frisvold
XenoPhage0 at gmail.com
http://blog.godshell.com



More information about the pmwiki-users mailing list