[pmwiki-users] Re: PageList Templates Recipe

Patrick R. Michaud pmichaud at pobox.com
Mon Sep 19 14:48:19 CDT 2005

On Mon, Sep 19, 2005 at 10:54:45AM -0400, Martin Fick wrote:
> On Fri, Sep 16, 2005 at 06:07:36PM -0400, Martin Fick wrote:
> > I have created a recipe that allows authors to define the
> > layout of a pagelists output using a wiki page template.
> > 
> > The recipe is at: http://www.pmwiki.org/wiki/Cookbook/PageListTemplates
> I have an update to this recipe which allows page stats
> such as author, timestamp... (any attribute returned by
> ReadPage) to be displayed.   I was wondering if any ot that
> data would be sensitive and should not be allowed to be
> printed in a pagelist.  If so, would the MakePageList only
> return authorized data anyway?

It depends on the value of $EnablePageListProtect.  If 
$EnablePageListProtect is true, then MakePageList doesn't
return the names of any pages for which the visitor lacks
read permission.

If $EnablePageListProtect is false, then MakePageList
includes all page names in the result, whether the visitor
has read permission or not.

To get the contents of a page only if the visitor
has permission, use the following instead of ReadPage:

  $page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT);

Or, you may wish to make use of the $PCache, which in some
circumstances will have already read a lot of the pages'
attributes as a result of MakePageList.  Thus you can do something

  if (isset($PCache[$pagename]['author'])) 
    $page = $PCache[$pagename];
    $page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT);

which will read the page contents from the file only if some other
markup or item hasn't done so already.  :-)


More information about the pmwiki-users mailing list