[pmwiki-users] Two quick questions

Patrick R. Michaud pmichaud at pobox.com
Tue Sep 26 16:29:51 CDT 2006


On Tue, Sep 26, 2006 at 05:18:09PM -0400, The Editor wrote:
> I've been going through the FAST Data recipe, thinking about how the
> new approach to using page variables will affect it.  Had a quick
> question:
> 
> Is there anyway to block data from being read from protected pages?
> For example, if I store passwords as Password: mypass  in some data
> page, I can set the read permissions to admin to keep out prying eyes.
>  But if a text variable is used to call the value, it would be
> displayed by anyone that wanted to see it.
> 
> Can the text variables be blocked based on page permissions?  

They already are.  :-)  If a visitor doesn't have read authorization
to a page, then it's not possible to view the page's text variables.

> And if
> so, can they still be made available (searchable) in pagelists?

This depends entirely on the $EnablePageListProtect variable.

> Second, I have a php question.  In a php recipe is there a way to use
> a string replacement function that takes part of the first pattern and
> inserts it into the second.  For example, I like to be able to take:
> 
> text {field} more text
> 
> and get for the output
> 
> text $_POST[field] more text.

Here's a simplistic version that should get you started:

    $text = preg_replace('/\\{(.*?)\\}/e', "$_POST['$1']", $text);

Pm




More information about the pmwiki-users mailing list