Fix fatal error in eval.php
[lhc/web/wiklou.git] / includes / SpecialVersion.php
index 36da5ca..501ba9a 100644 (file)
@@ -2,10 +2,7 @@
 /**#@+
  * Give information about the version of MediaWiki, PHP, the DB and extensions
  *
- * @package MediaWiki
- * @subpackage SpecialPage
- *
- * @bug 2019, 4531
+ * @addtogroup SpecialPage
  *
  * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
@@ -50,15 +47,12 @@ class SpecialVersion {
         */
        function MediaWikiCredits() {
                $version = self::getVersion();
-               $dbr =& wfGetDB( DB_SLAVE );
-
-               global $wgLanguageNames, $wgLanguageCode;
-               $mwlang = $wgLanguageNames[$wgLanguageCode];
+               $dbr = wfGetDB( DB_SLAVE );
 
                $ret =
                "__NOTOC__
                This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
-               copyright (C) 2001-2007 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
+               copyright (C) 2001-2008 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
                Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
                Niklas Laxström, Domas Mituzas, Rob Church and others.
 
@@ -102,12 +96,13 @@ class SpecialVersion {
                        'specialpage' => 'Special pages',
                        'parserhook' => 'Parser hooks',
                        'variable' => 'Variables',
+                       'media' => 'Media handlers',
                        'other' => 'Other',
                );
                wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
 
                $out = "<h2>Extensions</h2>\n";
-               $out .= wfOpenElement('table', array('id' => 'sv-ext') );
+               $out .= Xml::openElement('table', array('id' => 'sv-ext') );
 
                foreach ( $extensionTypes as $type => $text ) {
                        if ( isset ( $wgExtensionCredits[$type] ) && count ( $wgExtensionCredits[$type] ) ) {
@@ -118,9 +113,9 @@ class SpecialVersion {
                                foreach ( $wgExtensionCredits[$type] as $extension ) {
                                        $out .= $this->formatCredits(
                                                isset ( $extension['name'] )        ? $extension['name']        : '',
-                                               isset ( $extension['version'] )     ? $extension['version']     : '',
+                                               isset ( $extension['version'] )     ? $extension['version']     : null,
                                                isset ( $extension['author'] )      ? $extension['author']      : '',
-                                               isset ( $extension['url'] )         ? $extension['url']         : '',
+                                               isset ( $extension['url'] )         ? $extension['url']         : null,
                                                isset ( $extension['description'] ) ? $extension['description'] : ''
                                        );
                                }
@@ -148,16 +143,20 @@ class SpecialVersion {
                        $out .= $this->openExtType('Skin extension functions');
                        $out .= '<tr><td colspan="3">' . $this->listToText( $wgSkinExtensionFunction ) . "</td></tr>\n";
                }
-               $out .= wfCloseElement( 'table' );
+               $out .= Xml::closeElement( 'table' );
                return $out;
        }
 
        /** Callback to sort extensions by type */
        function compare( $a, $b ) {
-               if ( $a['name'] === $b['name'] )
+               global $wgLang;
+               if( $a['name'] === $b['name'] ) {
                        return 0;
-               else
-                       return Language::lc( $a['name'] ) > Language::lc( $b['name'] ) ? 1 : -1;
+               } else {
+                       return $wgLang->lc( $a['name'] ) > $wgLang->lc( $b['name'] )
+                               ? 1
+                               : -1;
+               }
        }
 
        function formatCredits( $name, $version = null, $author = null, $url = null, $description = null) {
@@ -188,12 +187,12 @@ class SpecialVersion {
                        ksort( $myWgHooks );
 
                        $ret = "<h2>Hooks</h2>\n"
-                               . wfOpenElement('table', array('id' => 'sv-hooks') )
+                               . Xml::openElement('table', array('id' => 'sv-hooks') )
                                . "<tr><th>Hook name</th><th>Subscribed by</th></tr>\n";
 
                        foreach ($myWgHooks as $hook => $hooks)
                                $ret .= "<tr><td>$hook</td><td>" . $this->listToText( $hooks ) . "</td></tr>\n";
-                       
+
                        $ret .= '</table>';
                        return $ret;
                } else
@@ -206,13 +205,13 @@ class SpecialVersion {
 
                if(!$this->firstExtOpened) {
                        // Insert a spacing line
-                       $out .= '<tr class="sv-space">' . wfElement( 'td', $opt ) . "</tr>\n";
+                       $out .= '<tr class="sv-space">' . Xml::element( 'td', $opt ) . "</tr>\n";
                }
                $this->firstExtOpened = false;
 
                if($name) { $opt['id'] = "sv-$name"; }
 
-               $out .= "<tr>" . wfElement( 'th', $opt, $text) . "</tr>\n";
+               $out .= "<tr>" . Xml::element( 'th', $opt, $text) . "</tr>\n";
                return $out;
        }
 
@@ -256,7 +255,10 @@ class SpecialVersion {
         * @return mixed
         */
        function arrayToString( $list ) {
-               if ( ! is_array( $list ) ) {
+               if( is_object( $list ) ) {
+                       $class = get_class( $list );
+                       return "($class)";
+               } elseif ( ! is_array( $list ) ) {
                        return $list;
                } else {
                        $class = get_class( $list[0] );
@@ -267,8 +269,6 @@ class SpecialVersion {
        /**
         * Retrieve the revision number of a Subversion working directory.
         *
-        * @bug 7335
-        *
         * @param string $dir
         * @return mixed revision number as int, or false if not a SVN checkout
         */
@@ -290,7 +290,10 @@ class SpecialVersion {
                                return false;
                        }
 
-                       $xml = simplexml_load_file( $entries, "SimpleXMLElement", LIBXML_NOWARNING );
+                       // SimpleXml whines about the xmlns...
+                       wfSuppressWarnings();
+                       $xml = simplexml_load_file( $entries );
+                       wfRestoreWarnings();
 
                        if( $xml ) {
                                foreach( $xml->entry as $entry ) {
@@ -313,4 +316,4 @@ class SpecialVersion {
 }
 
 /**#@-*/
-?>
+