Skip to content
Snippets Groups Projects
Commit 96946cc9 authored by Dominik Eckelmann's avatar Dominik Eckelmann
Browse files

replaced $HTTP_RAW_POST_DATA with http_get_raw_post_data function

parent c2eb026d
No related branches found
No related tags found
No related merge requests found
......@@ -302,11 +302,12 @@ class IXR_Server {
}
function serve($data = false) {
if (!$data) {
global $HTTP_RAW_POST_DATA;
if (!$HTTP_RAW_POST_DATA) {
$postData = trim(http_get_raw_post_data());
if (!$postData) {
die('XML-RPC server accepts POST requests only.');
}
$data = $HTTP_RAW_POST_DATA;
$data = $postData;
}
$this->message = new IXR_Message($data);
if (!$this->message->parse()) {
......
......@@ -249,3 +249,11 @@ function http_cached_finish($file, $content) {
print $content;
}
}
function http_get_raw_post_data() {
static $postData = null;
if ($postData === null) {
$postData = file_get_contents('php://input');
}
return $postData;
}
<?php
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
// fix when '< ?xml' isn't on the very first line
if(isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/remote.php');
session_write_close(); //close session
......
......@@ -6,16 +6,17 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
//fix for Opera XMLHttpRequests
if(!count($_POST) && !empty($HTTP_RAW_POST_DATA)){
parse_str($HTTP_RAW_POST_DATA, $_POST);
}
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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment