3 require_once( 'AjaxFunctions.php' );
14 function AjaxDispatcher() {
15 global $wgAjaxCachePolicy;
17 wfProfileIn( 'AjaxDispatcher::AjaxDispatcher' );
19 $wgAjaxCachePolicy = new AjaxCachePolicy();
23 if (! empty($_GET["rs"])) {
27 if (!empty($_POST["rs"])) {
31 if ($this->mode
== "get") {
32 $this->func_name
= $_GET["rs"];
33 if (! empty($_GET["rsargs"])) {
34 $this->args
= $_GET["rsargs"];
36 $this->args
= array();
39 $this->func_name
= $_POST["rs"];
40 if (! empty($_POST["rsargs"])) {
41 $this->args
= $_POST["rsargs"];
43 $this->args
= array();
46 wfProfileOut( 'AjaxDispatcher::AjaxDispatcher' );
49 function performAction() {
50 global $wgAjaxCachePolicy, $wgAjaxExportList;
51 if ( empty( $this->mode
) ) {
54 wfProfileIn( 'AjaxDispatcher::performAction' );
56 if (! in_array( $this->func_name
, $wgAjaxExportList ) ) {
57 echo "-:{$this->func_name} not callable";
60 $result = call_user_func_array($this->func_name
, $this->args
);
61 header( 'Content-Type: text/html; charset=utf-8', true );
62 $wgAjaxCachePolicy->writeHeader();
65 wfProfileOut( 'AjaxDispatcher::performAction' );