[ 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  //fix for Opera XMLHttpRequests
  10  if(!count($_POST) && $HTTP_RAW_POST_DATA){
  11    parse_str($HTTP_RAW_POST_DATA, $_POST);
  12  }
  13  
  14  if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
  15  require_once (DOKU_INC.'inc/init.php');
  16  require_once (DOKU_INC.'inc/common.php');
  17  require_once (DOKU_INC.'inc/pageutils.php');
  18  require_once (DOKU_INC.'inc/auth.php');
  19  //close sesseion
  20  session_write_close();
  21  
  22  $ID    = getID();
  23  
  24  if(!auth_isadmin) die('for admins only');
  25  require_once (DOKU_INC.'inc/pluginutils.php');
  26  require_once (DOKU_INC.'inc/html.php');
  27  $acl = plugin_load('admin','acl');
  28  $acl->handle();
  29  
  30  $ajax = $_REQUEST['ajax'];
  31  header('Content-Type: text/html; charset=utf-8');
  32  
  33  if($ajax == 'info'){
  34      $acl->_html_info();
  35  }elseif($ajax == 'tree'){
  36      require_once (DOKU_INC.'inc/search.php');
  37      global $conf;
  38      global $ID;
  39  
  40      $dir = $conf['datadir'];
  41      $ns  = $_REQUEST['ns'];
  42      if($ns == '*'){
  43          $ns ='';
  44      }
  45      $lvl = count(explode(':',$ns));
  46      $ns  = utf8_encodeFN(str_replace(':','/',$ns));
  47  
  48      $data = array();
  49      search($data,$conf['datadir'],'search_index',array('ns' => $ns),$ns);
  50  
  51      foreach($data as $item){
  52          $item['level'] = $lvl+1;
  53          echo $acl->_html_li_acl($item);
  54          echo '<div class="li">';
  55          echo $acl->_html_list_acl($item);
  56          echo '</div>';
  57          echo '</li>';
  58      }
  59  }
  60  


Generated: Tue Dec 2 01:30:01 2008 Cross-referenced by PHPXref 0.7