API: Requesting a token you aren't allowed to request no longer dies with an error...
[lhc/web/wiklou.git] / includes / AjaxDispatcher.php
index 452c3b3..c3d4ea9 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 /**
+ * @defgroup Ajax Ajax
+ *
+ * @file
+ * @ingroup Ajax
  * Handle ajax requests and send them to the proper handler.
  */
 
@@ -11,7 +15,7 @@ require_once( 'AjaxFunctions.php' );
 
 /**
  * Object-Oriented Ajax functions.
- * @addtogroup Ajax
+ * @ingroup Ajax
  */
 class AjaxDispatcher {
        /** The way the request was made, either a 'get' or a 'post' */
@@ -58,6 +62,7 @@ class AjaxDispatcher {
                break;
 
                default:
+                       wfProfileOut( __METHOD__ );
                        return;
                        # Or we could throw an exception:
                        #throw new MWException( __METHOD__ . ' called without any data (mode empty).' );
@@ -84,8 +89,13 @@ class AjaxDispatcher {
                        wfHttpError( 400, 'Bad Request',
                                "unknown function " . (string) $this->func_name );
                } else {
+                       if ( strpos( $this->func_name, '::' ) !== false ) {
+                               $func = explode( '::', $this->func_name, 2 );
+                       } else {
+                               $func = $this->func_name;
+                       }
                        try {
-                               $result = call_user_func_array($this->func_name, $this->args);
+                               $result = call_user_func_array($func, $this->args);
 
                                if ( $result === false || $result === NULL ) {
                                        wfHttpError( 500, 'Internal Error',
@@ -114,5 +124,3 @@ class AjaxDispatcher {
                $wgOut = null;
        }
 }
-
-