3 $AuthFunction = "AuthPlatal";
5 function authPerms($pagename,$key,$could=false
)
7 $words = explode(' ', $key);
10 foreach ($words as $word) {
12 if ($word == 'and:') { $and = true
; continue; }
13 $parts = explode(':', $word);
16 if ($cond == "identified" && $could)
18 $iauth = CondText($pagename, "if ".$cond." ".$param, true
);
19 if ($and) $auth &= $iauth;
26 function TryAllAuths($pagename, $level, $page_read, $group_read, $could = false
)
28 global $DefaultPasswords;
29 if (isset($page_read['passwd'.$level]) && $page_read['passwd'.$level] != '*')
30 return authPerms($pagename,$page_read['passwd'.$level], $could);
31 if (isset($group_read['passwd'.$level]) && $group_read['passwd'.$level] != '*')
32 return authPerms($pagename,$group_read['passwd'.$level], $could);
33 if (isset($DefaultPasswords[$level]))
34 return authPerms($pagename,$DefaultPasswords[$level], $could);
38 function AuthPlatal($pagename, $level, $authprompt, $since)
44 $page_read = ReadPage($pagename, $since);
45 $groupattr = FmtPageName('$Group/GroupAttributes', $pagename);
46 $group_read = ReadPage($groupattr, $since);
48 if (!isset($Conditions['canedit']))
49 $Conditions['canedit'] = TryAllAuths($pagename, 'edit', $page_read, $group_read, true
);
50 if (!isset($Conditions['canattr']))
51 $Conditions['canattr'] = TryAllAuths($pagename, 'attr', $page_read, $group_read, true
);
53 if (TryAllAuths($pagename, $level, $page_read, $group_read))
58 if ($authprompt && !identified())
60 new_skinned_page('wiki.tpl', AUTH_MDP
);
64 new_skinned_page('', AUTH_MDP
);
66 $page->trig("Erreur : page Wiki inutilisable sur plat/al");
68 $page->trig("Tu n'as pas le droit d'accéder à ce service");
69 // don't return false or pmwiki will send an exit breaking smarty page
73 $Conditions['logged'] = 'logged()';
74 $Conditions['identified'] = 'identified()';
75 $Conditions['has_perms'] = 'has_perms()';
76 $Conditions['public'] = 'true';
77 $Conditions['only_public'] = '!identified()';