source: documentation/trunk/packages/dokuwiki-2011-05-25a/lib/plugins/acl/ajax.php@ 25027

Last change on this file since 25027 was 25027, checked in by jmt12, 12 years ago

Adding the packages directory, and within it a configured version of dokuwiki all ready to run

File size: 1.2 KB
Line 
1<?php
2/**
3 * AJAX call handler for ACL plugin
4 *
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author Andreas Gohr <[email protected]>
7 */
8
9//fix for Opera XMLHttpRequests
10if(!count($_POST) && $HTTP_RAW_POST_DATA){
11 parse_str($HTTP_RAW_POST_DATA, $_POST);
12}
13
14if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
15require_once(DOKU_INC.'inc/init.php');
16//close session
17session_write_close();
18
19if(!auth_isadmin()) die('for admins only');
20if(!checkSecurityToken()) die('CRSF Attack');
21
22$ID = getID();
23
24$acl = plugin_load('admin','acl');
25$acl->handle();
26
27$ajax = $_REQUEST['ajax'];
28header('Content-Type: text/html; charset=utf-8');
29
30if($ajax == 'info'){
31 $acl->_html_info();
32}elseif($ajax == 'tree'){
33 global $conf;
34 global $ID;
35
36 $dir = $conf['datadir'];
37 $ns = $_REQUEST['ns'];
38 if($ns == '*'){
39 $ns ='';
40 }
41 $ns = cleanID($ns);
42 $lvl = count(explode(':',$ns));
43 $ns = utf8_encodeFN(str_replace(':','/',$ns));
44
45 $data = $acl->_get_tree($ns,$ns);
46
47 foreach($data as $item){
48 $item['level'] = $lvl+1;
49 echo $acl->_html_li_acl($item);
50 echo '<div class="li">';
51 echo $acl->_html_list_acl($item);
52 echo '</div>';
53 echo '</li>';
54 }
55}
56
Note: See TracBrowser for help on using the repository browser.