3 //$wgRequestTime = microtime();
6 // @ini_set( 'allow_url_fopen', 0 ); # For security...
8 # Valid web server entry point, enable includes.
9 # Please don't move this line to includes/Defines.php. This line essentially defines
10 # a valid entry point. If you put it in includes/Defines.php, then any script that includes
11 # it becomes an entry point, thereby defeating its purpose.
12 // define( 'MEDIAWIKI', true );
13 // require_once( './includes/Defines.php' );
14 // require_once( './LocalSettings.php' );
15 // require_once( 'includes/Setup.php' );
16 require_once( 'AjaxFunctions.php' );
22 class AjaxDispatcher
{
27 function AjaxDispatcher() {
28 global $wgAjaxCachePolicy;
30 wfProfileIn( 'AjaxDispatcher::AjaxDispatcher' );
32 $wgAjaxCachePolicy = new AjaxCachePolicy();
36 if (! empty($_GET["rs"])) {
40 if (!empty($_POST["rs"])) {
44 if ($this->mode
== "get") {
45 $this->func_name
= $_GET["rs"];
46 if (! empty($_GET["rsargs"])) {
47 $this->args
= $_GET["rsargs"];
49 $this->args
= array();
52 $this->func_name
= $_POST["rs"];
53 if (! empty($_POST["rsargs"])) {
54 $this->args
= $_POST["rsargs"];
56 $this->args
= array();
59 wfProfileOut( 'AjaxDispatcher::AjaxDispatcher' );
62 function performAction() {
63 global $wgAjaxCachePolicy, $wgAjaxExportList;
64 if ( empty( $this->mode
) ) {
67 wfProfileIn( 'AjaxDispatcher::performAction' );
69 if (! in_array( $this->func_name
, $wgAjaxExportList ) ) {
70 echo "-:{$this->func_name} not callable";
73 $result = call_user_func_array($this->func_name
, $this->args
);
74 header( 'Content-Type: text/html; charset=utf-8', true );
75 $wgAjaxCachePolicy->writeHeader();
78 wfProfileOut( 'AjaxDispatcher::performAction' );