[pmwiki-users] SiteAdmin.SiteAttributes

Petko Yotov 5ko at free.fr
Sat Jun 23 10:24:52 CDT 2007


On Saturday 23 June 2007, Patrick R. Michaud wrote:
> On Sat, Jun 23, 2007 at 04:34:48PM +0200, Petko Yotov wrote:
> > On Thursday 21 June 2007, Dominique Faure wrote:
> > > On 6/21/07, Petko Yotov <5ko at free.fr> wrote:
> > > > Is there a way to have a special page Site.SiteAttributes like
> > > > Group.GroupAttributes, but for the whole site?
> > > >
> > > > Like: if one sets a read/edit password, or @lock on this page, the
> > > > whole site gets closed. Groups or Pages with the @nopass attribute
> > > > will be visible, that is, their attributes override the
> > > > Site.SiteAttributes settings.
> >
> > ...
> >
> > > BTW, this could be a perfect place to have some other global settings
> > > (for now only set via config.php), such as the $WikiTitle variable,
> > > no?
...
> > Here is something that does all this. Patrick, can you please look at
> > this code to see if it is not dangerous of some kind? Or if it may be
> > optimized/simplified?
>
> I haven't been able to look at it closely -- the bit about loading
> the passwords looks okay to me.  The $GroupTitle page variable will not
> always do what you expect, especially if one tries to use it in
> pagelists or includes.

Thanks: I have rewritten the second part and now it should work in includes 
and pagelists:


  function GroupTitles($group)
  {
    global $AsSpacedFunction;
    if(PageTextVar("$group.GroupAttributes", 'GroupTitle')>'')
      return 
        htmlspecianchars(PageTextVar("$group.GroupAttributes", 'GroupTitle'));
    return $AsSpacedFunction($group);
  }
  $FmtPV['$GroupTitle'] = 'GroupTitles($group)';

I am just not sure should the string be escaped with htmlspecianchars()?


> If there's a strong demand for being able to configure
> PmWiki features via a wikipage, we can see about developing a more
> complete recipe for it.  What features should be configurable?

* $WikiTitle
* $Skin
* $PageLogoUrl

are the best candidats, which change often as one still works on the site 
settings. However: no need for drop-down lists for available skins, just 
simple "var:value" pairs, in this admin locked page.

Then, some recipes and skins may also be configured by reading the 
PageTextVars. I am considering adapting the ThumbList recipe to override some 
of the default setings (jpeg quality, thumb height, trails, threaded...) from 
page text variables in this page SiteAdmin.SiteAttributes (if we agree on the 
page name, and when the SiteAdmin group arrives).

Thanks,
Petko




More information about the pmwiki-users mailing list