[pmwiki-users] MarkupExpressionsExtensions

The Editor editor at fast.st
Thu Apr 19 12:47:28 CDT 2007


On 4/19/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Wed, Apr 18, 2007 at 04:38:16PM -0400, The Editor wrote:
> > Second post on a couple problems with the Markup Expressions
> > Extensions recipe, I'd like to resolve...
> >
> > On 4/16/07, The Editor <editor at fast.st> wrote:
> > > In trying to finish up this recipe I came up with a bug...
> > >
> > >         if (! CondAuth($p, $HandleAuth['source'])) return '';
> > >
> > > seems to fail whether or not I have permission or not (defined in
> > > config.php as admin.  $p appears to be the correct Group.Name value.  Help?
> >
> > It's supposed to return a blank if the user is not authorized to see
> > the source of page $p. Otherwise it continues on in the routine.
>
> There's not nearly enough information here to give a useful
> answer.  Is this inside of a function; if so, has $HandleAuth
> been declared global?  Is this code perhaps being executed before
> $HandleAuth['source'] is being set?  Can we see the code that
> is setting $HandleAuth['source'] and then passing control to
> this statement?

That should solve it.  Failed to declare $HandleAuth...

> > > Also, this does not work at all...  I had this problem before and
> > > never figured it out.  The problem is the $p value even
> > > though it shows up as expected, the strpos cannot find a " " in it, so
> > > it can't make the test or return the right value
> > >
> > > $MarkupExpr['wiki'] = 'MkExpExtWiki($params)';
>
> In the comments at the top of markupexpr.php, it reads:
>
>     Finally, if the code in $MarkupExpr contains '$params', then
>     it is executed directly without any preprocessing into arguments,
>     and $params contains the entire argument string.  Note that $params
>     may contain escaped values representing quoted arguments and
>     results of other expressions; these values may be un-escaped
>     by using "preg_replace($rpat, $rrep, $params)".

$rpat and $rrep need to be declared global in the extension function I presume?

> > This is supposed to work for {(wiki pagelist group=Test)}, changing it
> > to (:pagelist group=Test:).  Also any thoughts Pm on escaping this on
> > the word pagelist when it saves as you mentioned earlier?
>
> At present I don't have any plans to change the way that PmWiki
> escapes (:pagelist ...:) in the core.

It would be very nice to be able to accurately store pagelists in
PTV's.  With ZAP, various parameters can be set in a form and then a
custom pagelist returned by referring to the variable. Do you have a
suggestion for how to do this without messing up the various things
you mentioned earlier?

BTW, this approach {( )} is also much easier for ZAP than (:: ::) for
whatever that is worth.

Cheers,
Dan



More information about the pmwiki-users mailing list