(bug 12905) Created [[Special:API]] which just 302s to $wgScriptPath/api.php
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 3be70ee..af58c47 100644 (file)
@@ -152,6 +152,7 @@ class SpecialPage
                'Listadmins'                => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
                'MergeHistory'              => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
                'Listbots'                  => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
+               'API'                       => array( 'SpecialAPI' ),
                );
 
        static public $mAliases;
@@ -848,3 +849,19 @@ class SpecialMycontributions extends UnlistedSpecialPage {
                return SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() );
        }
 }
+
+/**
+ * Shortcut to api.php
+ *
+ * Unfortunately we can't use SpecialRedirectToSpecial here
+ */
+class SpecialAPI extends UnlistedSpecialPage {
+       function __construct() {
+               parent::__construct('API');
+       }
+       
+       function execute($par) {
+               global $wgScriptPath, $wgOut;
+               $wgOut->redirect("$wgScriptPath/api.php?$par");
+       }
+}