[pmwiki-users] FAQ: Editable RecentChanges

H. Fox haganfox at gmail.com
Mon Aug 8 18:24:19 CDT 2005


On 8/8/05, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Sat, Aug 06, 2005 at 02:42:52PM -0700, H. Fox wrote:
> > ## Disallow editing of RecentChanges and RecentUploads pages.
> > if ($action=='edit'
> >   && preg_match('/\\.(All)?Recent(Changes|Uploads)$/', $pagename)) {
> >   unset($_POST['post']); unset($_POST['postedit']);
> > }
> 
> Shorter is
> 
>     if ($action=='edit' && substr($pagename, -13) == 'RecentChanges')
>       $action = 'browse';

That's not equivalent.  Would this be?

    if ($action=='edit' && (substr($pagename, -13) == 'RecentChanges'
      || substr($pagename, -13) == 'RecentUploads'))
      $action = 'browse';

If it's equivalent, it's not shorter.

Is there even an option to produce (All)RecentUploads pages?  That seems useful.

> > How would someone password-protect the pages, even ones that don't
> > exist yet, rather than disabling editing them completely.  Or a better
> > question: How can the answer be improved while remaining concise?
> 
>     if (substr($pagename, -13) == 'RecentChanges')
>       $DefaultPasswords['edit'] = '*';
> 
> This locks the page for editing, although the admin password will
> still work.

Is the following acceptable, or is something with substr() better?

if ($action=='edit' && preg_match('/\\.(All)?Recent(Changes|Uploads)$/',
  $pagename)) { $DefaultPasswords['edit'] = '*'; }

Hagan




More information about the pmwiki-users mailing list