<?php /** * AJAX call handler for ACL plugin * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Andreas Gohr <*****@*****.**> */ if (!defined('DOKU_INC')) { define('DOKU_INC', dirname(__FILE__) . '/../../../'); } require_once DOKU_INC . 'inc/init.php'; //close session session_write_close(); //fix for Opera XMLHttpRequests $postData = http_get_raw_post_data(); if (!count($_POST) && !empty($postData)) { parse_str($postData, $_POST); } if (!auth_isadmin()) { die('for admins only'); } if (!checkSecurityToken()) { die('CRSF Attack'); } $ID = getID(); $acl = plugin_load('admin', 'acl'); $acl->handle(); $ajax = $_REQUEST['ajax']; header('Content-Type: text/html; charset=utf-8'); if ($ajax == 'info') {
/** * @param bool|string $data */ function serve($data = false) { if (!$data) { $postData = trim(http_get_raw_post_data()); if (!$postData) { header('Content-Type: text/plain'); // merged from WP #9093 die('XML-RPC server accepts POST requests only.'); } $data = $postData; } $this->message = new IXR_Message($data); if (!$this->message->parse()) { $this->error(-32700, 'parse error. not well formed'); } if ($this->message->messageType != 'methodCall') { $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall'); } $result = $this->call($this->message->methodName, $this->message->params); // Is the result an error? if (is_a($result, 'IXR_Error')) { $this->error($result); } // Encode the result $r = new IXR_Value($result); $resultxml = $r->getXml(); // Create the XML $xml = <<<EOD <methodResponse> <params> <param> <value> {$resultxml} </value> </param> </params> </methodResponse> EOD; // Send it $this->output($xml); }