[pmwiki-users] Update equivalent for RetrieveAuthSection

V.Krishn vkrishn at insteps.net
Tue Apr 6 08:55:37 CDT 2010

On Tuesday 06 Apr 2010 4:57:06 pm you wrote:
> On Sun, Apr 4, 2010 at 12:35 PM, V.Krishn <vkrishn at insteps.net> wrote:
> > Is there Update equivalent for RetrieveAuthSection or TextSection similar
> > to UpdatePage, maybe used in some recipe?
> http://www.pmwiki.org/wiki/Cookbook/Toolbox includes a function
> tbUpdateAuthPage() (which, I hasten to add, is undocumented,
> incomplete, and probably non-working) which is intended to offer this
> functionality, among others.  You may find something helpful there...
> It may even work -- I don't remember why it never got off the
> workbench...
> -Peter

Just a suggestion:
The script's tbRetrieveAuthPage() is already checking the auth part.
I think the recipe that uses toolbox could call tbRetrieveAuthPage(), and if 
authorization is positive(as required) call tbUpdatePage().

So this function could be simplified to(just outlined):

function tbUpdatePage($pagename, $opage, $npage)
    global $tbError, $PageNameChars;

    $tbError = '';
    SDV($PageNameChars, '-[:alnum:]'); 
    # Isolate pagename, operators, etc.
    if (!preg_match("/(?P<pagename>[$PageNameChars]+)...", $pagename, $m)) {
        $tbError = 'Pagename ($pagesource) does not match expected pattern';

   if (!is_array($npage)) {
      .....do section update...
   } else {
      ....normal or op/pat write update.

Functions like these could be part of PmWiki core, maybe as extended_lib.php 
in scripts/
The problem is identifying such functions :)


More information about the pmwiki-users mailing list