[pmwiki-devel] PostPage in recipe

Hans design5 at softflow.co.uk
Mon Mar 30 02:33:14 CDT 2009


Monday, March 30, 2009, 6:08:14 AM, Frank wrote:

>  $HandleActions['convert'] = 'HandleConvert';
>  $HandleAuth['convert'] = 'frankobot2';
>  
>  function HandleConvert($pagename, $auth) {
>    $old = RetrieveAuthPage('Test.Page1', 'read');
>    if ($old) {
>      $new = $old;
>      $new['text'] = "x".$old['text'];
>      $pn='Test.Page1';
>      $oldAuthor = $Author;
>      $Author='frankobot3';
>      UpdatePage($pn,$old,$new);
>      $Author=$oldAuthor;
>      HandleBrowse($pagename);
>    }
>  }

I should add that setting $HandleAuth['convert'] is entirely
optional, and in the example you give does do nothing.

Setting

   $HandleAuth['convert'] = 'admin';

for instance will result that 'admin' is passed as default
authorisation level to the HandleConvert function via the second
parameter $auth, so $auth will become 'admin'.
But the function needs to exploit this with for instance

   $old = RetrieveAuthPage($pagename, $auth);

only then will the 'convert' action be restricted to users with admin
authorisation, and not others (others will get a login prompt in this
case).


Hans




More information about the pmwiki-devel mailing list