[pmwiki-users] syntax question php for a Profiles.php

Crisses crisses at kinhost.org
Sat Nov 18 10:07:49 CST 2006



On Nov 18, 2006, at 10:54 AM, Crisses wrote:

> On Nov 17, 2006, at 5:04 PM, The Editor wrote:
>
>> On 11/17/06, Florian Fischer <Flori-Fischer at gmx.net> wrote:
>>> Hello,
>>>
>>> i'm using Userauth and since i haven't found a possibility to
>>> restrict the edit-access to the pages of a user, i try it with a
>>> workaround. My Users have edit-rights for the Group Profiles. But
>>> User B shouldn't be able to edit the pages of User A. There is no
>>> automatic way to do this. I try it with a Profiles.php file
>>>
>>> $pagename = ResolvePageName($pagename);
>>>  $isAdminAuthorized = CondAuth($pagename, 'admin');
>>>  global $Author;
>>>  if (!$isAdminAuthorized) {
>
> Your variables won't be parsed here:
>>>     if ($pagename != '{$Author}' || $pagename != '{$Author}-
>>> Contribution' || $pagename != '{$Author}-Watchlist'){
>
> either:
>      if ($pagename != "{$Author}" || $pagename != "{$Author}-
> Contribution" || $pagename != "{$Author}-Watchlist"){
> or:
>      if ($pagename != $Author || $pagename != $Author . "-
> Contribution" || $pagename != $Author . "-Watchlist"){


I was wrong below here, I saw Hans' posting after and realized I  
didn't understand what you were doing.  I thought you were trying to  
test whether pages existed.

> And Caveman is right about the group names...you should use the
> variable defined in pmwiki.php for defining the profiles group:
>
> $AuthorGroup
>
>
> so I would suggest that you try this:
>
> $ThisProfile = "{$AuthorGroup}.$Author";
> if ((!PageExists($ThisProfile)) || (!PageExists($ThisProfile . "-
> Contribution")) || (!PageExists($ThisProfile . "-Watchlist")){

Crisses




More information about the pmwiki-users mailing list