X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FAjaxDispatcher.php;h=c9ca1283020bc0e585bdb6c3a2d1da4b23dafe76;hb=9b840c281cfae3c060941e45933e7798647064be;hp=e3df5207666e3695c05bed577829a99883b73787;hpb=dee9dbb53866835b9c8df050e7e740c44b7c739a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index e3df520766..c9ca128302 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -63,7 +63,7 @@ class AjaxDispatcher { $this->mode = "post"; } - switch( $this->mode ) { + switch ( $this->mode ) { case 'get': $this->func_name = isset( $_GET["rs"] ) ? $_GET["rs"] : ''; if ( ! empty( $_GET["rsargs"] ) ) { @@ -97,7 +97,7 @@ class AjaxDispatcher { * request. */ function performAction() { - global $wgAjaxExportList, $wgOut, $wgUser; + global $wgAjaxExportList, $wgUser; if ( empty( $this->mode ) ) { return; @@ -111,26 +111,18 @@ class AjaxDispatcher { wfHttpError( 400, 'Bad Request', - "unknown function " . (string) $this->func_name + "unknown function " . $this->func_name ); - } elseif ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) - && !$wgUser->isAllowed( 'read' ) ) - { + } elseif ( !User::isEveryoneAllowed( 'read' ) && !$wgUser->isAllowed( 'read' ) ) { wfHttpError( 403, 'Forbidden', - 'You must log in to view pages.' ); + 'You are not allowed to view pages.' ); } else { wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" ); - if ( strpos( $this->func_name, '::' ) !== false ) { - $func = explode( '::', $this->func_name, 2 ); - } else { - $func = $this->func_name; - } - try { - $result = call_user_func_array( $func, $this->args ); + $result = call_user_func_array( $this->func_name, $this->args ); if ( $result === false || $result === null ) { wfDebug( __METHOD__ . ' ERROR while dispatching ' @@ -163,7 +155,6 @@ class AjaxDispatcher { } } - $wgOut = null; wfProfileOut( __METHOD__ ); } }