Code style cleanup for ApiQuerySiteinfo.php.
[lhc/web/wiklou.git] / includes / api / ApiQuerySiteinfo.php
index f79083e..7bb7e38 100644 (file)
@@ -129,6 +129,20 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['dbtype'] = $GLOBALS['wgDBtype'];
                $data['dbversion'] = $this->getDB()->getServerVersion();
 
+               $allowFrom = array( '' );
+               $allowException = true;
+               if ( !$GLOBALS['wgAllowExternalImages'] ) {
+                       if ( $GLOBALS['wgEnableImageWhitelist'] ) {
+                               $data['imagewhitelistenabled'] = '';
+                       }
+                       $allowFrom = $GLOBALS['wgAllowExternalImagesFrom'];
+                       $allowException = !empty( $allowFrom );
+               }
+               if ( $allowException ) {
+                       $data['externalimages'] = (array) $allowFrom;
+                       $this->getResult()->setIndexedTagName( $data['externalimages'], 'prefix' );
+               }
+
                if ( !$wgDisableLangConversion ) {
                        $data['langconversion'] = '';
                }
@@ -170,15 +184,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['lang'] = $GLOBALS['wgLanguageCode'];
 
                $fallbacks = array();
-               foreach( $wgContLang->getFallbackLanguages() as $code ) {
+               foreach ( $wgContLang->getFallbackLanguages() as $code ) {
                        $fallbacks[] = array( 'code' => $code );
                }
                $data['fallback'] = $fallbacks;
                $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
 
-               if( $wgContLang->hasVariants() ) {
+               if ( $wgContLang->hasVariants() ) {
                        $variants = array();
-                       foreach( $wgContLang->getVariants() as $code ) {
+                       foreach ( $wgContLang->getVariants() as $code ) {
                                $variants[] = array( 'code' => $code );
                        }
                        $data['variants'] = $variants;
@@ -345,10 +359,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                $val['language'] = $langNames[$prefix];
                        }
                        $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
-                       if( isset( $row['iw_wikiid'] ) ) {
+                       if ( isset( $row['iw_wikiid'] ) ) {
                                $val['wikiid'] = $row['iw_wikiid'];
                        }
-                       if( isset( $row['iw_api'] ) ) {
+                       if ( isset( $row['iw_api'] ) ) {
                                $val['api'] = $row['iw_api'];
                        }
 
@@ -408,7 +422,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
        }
 
        protected function appendUserGroups( $property, $numberInGroup ) {
-               global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
+               global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
+               global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
 
                $data = array();
                $result = $this->getResult();
@@ -520,7 +535,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
                $data = array(
                        'url' => $url ? $url : '',
-                       'text' => $text ?  $text : ''
+                       'text' => $text ? $text : ''
                );
 
                return $this->getResult()->addValue( 'query', $property, $data );
@@ -544,9 +559,17 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        public function appendSkins( $property ) {
                $data = array();
+               $usable = Skin::getUsableSkins();
+               $default = Skin::normalizeKey( 'default' );
                foreach ( Skin::getSkinNames() as $name => $displayName ) {
                        $skin = array( 'code' => $name );
                        ApiResult::setContent( $skin, $displayName );
+                       if ( !isset( $usable[$name] ) ) {
+                               $skin['unusable'] = '';
+                       }
+                       if ( $name === $default ) {
+                               $skin['default'] = '';
+                       }
                        $data[] = $skin;
                }
                $this->getResult()->setIndexedTagName( $data, 'skin' );
@@ -661,13 +684,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                ' specialpagealiases    - List of special page aliases',
                                ' magicwords            - List of magic words and their aliases',
                                ' statistics            - Returns site statistics',
-                               " interwikimap          - Returns interwiki map (optionally filtered, (optionally localised by using {$p}inlanguagecode))",
+                               " interwikimap          - Returns interwiki map " .
+                                       "(optionally filtered, (optionally localised by using {$p}inlanguagecode))",
                                ' dbrepllag             - Returns database server with the highest replication lag',
                                ' usergroups            - Returns user groups and the associated permissions',
                                ' extensions            - Returns extensions installed on the wiki',
                                ' fileextensions        - Returns list of file extensions allowed to be uploaded',
                                ' rightsinfo            - Returns wiki rights (license) information if available',
-                               " languages             - Returns a list of languages MediaWiki supports (optionally localised by using {$p}inlanguagecode)",
+                               " languages             - Returns a list of languages MediaWiki supports".
+                                       "(optionally localised by using {$p}inlanguagecode)",
                                ' skins                 - Returns a list of all enabled skins',
                                ' extensiontags         - Returns a list of parser extension tags',
                                ' functionhooks         - Returns a list of parser function hooks',
@@ -687,9 +712,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
        }
 
        public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'includeAllDenied', 'info' => 'Cannot view all servers info unless $wgShowHostnames is true' ),
-               ) );
+               return array_merge( parent::getPossibleErrors(), array( array(
+                       'code' => 'includeAllDenied',
+                       'info' => 'Cannot view all servers info unless $wgShowHostnames is true'
+               ), ) );
        }
 
        public function getExamples() {