no more smarty in the templates, that was a BIG security flaw !!!
[platal.git] / plugins / pmwiki.platalAuth.php
1 <?php
2
3 $AuthFunction = 'AuthPlatal';
4
5 $Conditions['logged'] = S::logged();
6 $Conditions['identified'] = S::identified();
7 $Conditions['has_perms'] = S::has_perms();
8 $Conditions['public'] = 'true';
9
10 $HandleAuth['diff'] = 'edit';
11 $HandleAuth['source'] = 'edit';
12
13 // impossible to see the diff without the source because of the smarty tags
14 $DiffShow['source'] = 'y';
15 $DiffSourceFmt = '';
16
17 // for read pages: will come only once so we have to be careful
18 // and translate any auth from the wiki to smarty auth
19 function AuthPlatal($pagename, $level, $authprompt)
20 {
21 global $Conditions, $page;
22
23 $page_read = ReadPage($pagename);
24
25 $levels = array('read', 'attr', 'edit', 'upload');
26
27 if (S::identified() && S::has_perms())
28 {
29 $page_read['=passwd'] = $passwds;
30 $page_read['=pwsource'] = $pwsources;
31
32 return $page_read;
33 }
34
35 // if we arrive here, the user doesn't have enough permission to access page
36
37 // maybe it is because he is not identified
38 if ($authprompt && !S::identified()) {
39 require_once dirname(__FILE__).'/../classes/Platal.php';
40 require_once dirname(__FILE__).'/../classes/PLModule.php';
41 $platal = new Platal();
42 $platal->force_login($page);
43 }
44
45 if (S::has_perms()) {
46 $page->trig('Erreur : page Wiki inutilisable sur plat/al');
47 }
48 $page->run();
49 }
50
51 ?>