[pmwiki-users] How to use if ($page['=auth']['edit'])

Tom Lederer celok at gmx.net
Sun Sep 10 10:26:12 CDT 2006


Again, one mystery gets solved... somehow at least.

i had in my config:
$HandleAuth['edit']        = 'admin';

This made me think...

i added:
$DefaultPasswords['edit'] = crypt('password');

and ever since it works as desired, though

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

still is present. *shrug*

Best Regards,
Tom
--  

Tom
http://www.celok.de
http://www.frappr.com/celok


Am 10.09.2006 um 04:23 schrieb Tom Lederer:

> Hi,
>
> thanks for the quick answer. Unfortunatly it does not work. It  
> still shows the authorized view even for not logged in people. They  
> can't edit the page though.
>
> I have no EnableIMS or like that in config.php.
>
> Man, sometimes i wish i'd _really_ knew php ;)
>
> Best Regards,
> Tom
>
> -- 
>
> Tom
> http://www.celok.de
> http://www.frappr.com/celok
>
>
> Am 10.09.2006 um 03:52 schrieb Patrick R. Michaud:
>
>> On Sat, Sep 09, 2006 at 10:27:02PM +0200, Tom Lederer wrote:
>>> Hi all,
>>> after reading http://www.pmwiki.org/wiki/Cookbook/
>>> ConditionalMarkupSamples
>>> i assumed that i could use if ($page['=auth']['edit']) in a file:
>>>
>>> What i try to do is
>>>
>>> Markup("taghead",       "directives", '/\\(:markupname:\\)/
>>> ei',        'Keep(MarkupFunction())');
>>>
>>> this should display different things to a editor than to a  
>>> reader. So
>>> i did:
>>>
>>> function MarkupFunction() {
>>>      global $pagename,$ScriptUrl;
>>>      $page = RetrieveAuthPage($pagename, 'read', false,
>>> READPAGE_CURRENT);
>>>      if ($page['=auth']['edit']) {
>>> 	return "You have edit rights.";	
>>>      }
>>>      else {
>>> 	return "Read only.";
>>>      }
>>> }
>>
>> Since the page is already loaded into the cache by the time the
>> markup is processed, it's a bit faster to do:
>>
>>     global $PCache, $pagename;
>>     if ($PCache[$pagename]['=auth']['edit']) {
>>       return 'You have edit rights.';
>>     } else {
>>       return 'Read only.';
>>     }
>>
>>> Does anyone spot an error, or can tell me how to accomplish this?
>>
>> I don't immediately see an error with what you're doing, however,
>> so I'm not exactly sure what's going on.
>>
>> Are you running your site with $EnableIMS set?  If so, you
>> might be seeing the effects of the browser cache.
>>
>> Pm
>>
>





More information about the pmwiki-users mailing list