API: Making a bunch of state-changing modules require POST requests.
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index 4362125..4c294a4 100644 (file)
@@ -56,7 +56,6 @@ class ApiMain extends ApiBase {
                'logout' => 'ApiLogout',
                'query' => 'ApiQuery',
                'expandtemplates' => 'ApiExpandTemplates',
-               'render' => 'ApiRender',
                'parse' => 'ApiParse',
                'opensearch' => 'ApiOpenSearch',
                'feedwatchlist' => 'ApiFeedWatchlist',
@@ -321,8 +320,11 @@ class ApiMain extends ApiBase {
                                return;
                        }
                }
-
+               
                if (!$this->mInternalMode) {
+                       // Ignore mustBePosted() for internal calls
+                       if($module->mustBePosted() && !$this->mRequest->wasPosted())
+                               $this->dieUsage("The {$this->mAction} module requires a POST request", 'mustbeposted');
 
                        // See if custom printer is used
                        $this->mPrinter = $module->getCustomPrinter();