[pmwiki-users] recognizing read protection

Jabba Laci jabba.laci at gmail.com
Fri Jun 8 04:05:21 CDT 2007


Hi,

I'll try to give some more details. All my pages are write protected,
so I have the following lines in my config.php:
$DefaultPasswords['admin'] = ...
$DefaultPasswords['edit']  = ...

Most of the pages are public, but some of them are made private. These
private pages have the following line in their source:
name=<name_of_the_page>
passwdread=<encrypted_password>                            # here!

So what I want to catch is: if the page is read protected, i.e. if its
source contains the line "passwdread=...", then do something (display
a message for instance).

I tried the code below, but it always displays that the page is read
protected, even if it is not. I don't know what I did wrong.

> (:if expr auth admin && pageattribute read :)
> page has read-protection
> (:if expr auth admin && ! pageattribute read:)
> page does not have read-protection
> (:ifend:)

           Thanks,

                     Laszlo

P.S.: I have a workaround idea. Until we find an elegant solution, I
thought of writing a custom markup. I want to read the current page in
wiki.d/ to test if it contains the "passwdread=..." line or not. My
question: how to ask the full name (probably with path too) of the
current file in an included function? That is:
$readProtected = getReadProtectedInfo();
Markup('(:isReadProtected:)', '>','/\\(\\:isReadProtected\\:\\)/',
"$readProtected");
function getReadProtectedInfo()
{
   $fullname = ???;       # help here
   ...
}



More information about the pmwiki-users mailing list