[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/plugins/acl/ -> ajax.php (source)

   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 <andi@splitbrain.org>
   7   */
   8  
   9  if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
  10  require_once (DOKU_INC.'inc/init.php');
  11  //close session
  12  session_write_close();
  13  
  14  global $conf;
  15  global $ID;
  16  global $INPUT;
  17  
  18  //fix for Opera XMLHttpRequests
  19  $postData = http_get_raw_post_data();
  20  if(!count($_POST) && !empty($postData)){
  21      parse_str($postData, $_POST);
  22  }
  23  
  24  if(!auth_isadmin()) die('for admins only');
  25  if(!checkSecurityToken()) die('CRSF Attack');
  26  
  27  $ID    = getID();
  28  
  29  /** @var $acl admin_plugin_acl */
  30  $acl = plugin_load('admin','acl');
  31  $acl->handle();
  32  
  33  $ajax = $INPUT->str('ajax');
  34  header('Content-Type: text/html; charset=utf-8');
  35  
  36  if($ajax == 'info'){
  37      $acl->_html_info();
  38  }elseif($ajax == 'tree'){
  39  
  40      $dir = $conf['datadir'];
  41      $ns  = $INPUT->str('ns');
  42      if($ns == '*'){
  43          $ns ='';
  44      }
  45      $ns  = cleanID($ns);
  46      $lvl = count(explode(':',$ns));
  47      $ns  = utf8_encodeFN(str_replace(':','/',$ns));
  48  
  49      $data = $acl->_get_tree($ns,$ns);
  50  
  51      foreach(array_keys($data) as $item){
  52          $data[$item]['level'] = $lvl+1;
  53      }
  54      echo html_buildlist($data, 'acl', array($acl, '_html_list_acl'),
  55                          array($acl, '_html_li_acl'));
  56  }
  57  


Generated: Sun Oct 20 03:00:06 2013 Cross-referenced by PHPXref 0.7