summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ajax.php12
-rw-r--r--tw-sack.js22
2 files changed, 13 insertions, 21 deletions
diff --git a/ajax.php b/ajax.php
index 928a6d286..2336c314d 100644
--- a/ajax.php
+++ b/ajax.php
@@ -6,19 +6,23 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
+//fix for Opera XMLHttpRequests
+if(!count($_POST) && $HTTP_RAW_POST_DATA){
+ parse_str($HTTP_RAW_POST_DATA, $_POST);
+}
+
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
require_once(DOKU_INC.'inc/pageutils.php');
require_once(DOKU_INC.'inc/auth.php');
-
//call the requested function
-$call = 'ajax_'.$_REQUEST['call'];
+$call = 'ajax_'.$_POST['call'];
if(function_exists($call)){
$call();
}else{
- print "The called function does not exist!";
+ print "The called function does not exist!";
}
/**
@@ -30,7 +34,7 @@ function ajax_qsearch(){
global $conf;
global $lang;
- $query = cleanID($_REQUEST['q']);
+ $query = cleanID($_POST['q']);
if(empty($query)) return;
$nsdir = str_replace(':','/',getNS($query));
diff --git a/tw-sack.js b/tw-sack.js
index 6fcd5a2c4..8a9d12746 100644
--- a/tw-sack.js
+++ b/tw-sack.js
@@ -59,24 +59,12 @@ function sack(file){
if (this.element) { this.elementObj = document.getElementById(this.element); }
if (this.xmlhttp) {
var self = this; // wierd fix for odd behavior where "this" wouldn't work in the readystate function.
- // Opera doesn't support setRequestHeader, try catch is for IE
- try {
- if(!this.xmlhttp.setRequestHeader){
- this.method = "GET";
- }
- } catch (ex) { }
-
- if (this.encodeURIString){ this.URLString = this.encodeURLString(this.URLString); }
-
- if (this.method == "POST") {
- this.xmlhttp.open(this.method, this.requestFile ,true);
- this.xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- this.xmlhttp.send(this.URLString);
- }else{
- this.xmlhttp.open(this.method, this.requestFile+'?'+this.URLString, true);
- this.xmlhttp.send();
+ this.xmlhttp.open(this.method, this.requestFile ,true);
+ if (this.method == "POST" && this.xmlhttp.setRequestHeader) {
+ this.xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
}
-
+ if (this.encodeURIString){ this.URLString = this.encodeURLString(this.URLString); }
+ this.xmlhttp.send(this.URLString);
this.xmlhttp.onreadystatechange = function() {
switch (self.xmlhttp.readyState){
case 1: // Loading.