Bug 32673: Keep the username in the input field if not existing
[lhc/web/wiklou.git] / includes / specials / SpecialMIMEsearch.php
index 43f8f8d..2ce8ec4 100644 (file)
@@ -41,7 +41,7 @@ class MIMEsearchPage extends QueryPage {
        function linkParameters() {
                return array( 'mime' => "{$this->major}/{$this->minor}" );
        }
-       
+
        public function getQueryInfo() {
                return array(
                        'tables' => array( 'image' ),
@@ -57,14 +57,13 @@ class MIMEsearchPage extends QueryPage {
                                        'img_minor_mime' => $this->minor )
                );
        }
-       
+
        function execute( $par ) {
-               global $wgRequest, $wgOut;
-               $mime = $par ? $par : $wgRequest->getText( 'mime' );
-               
+               $mime = $par ? $par : $this->getRequest()->getText( 'mime' );
+
                $this->setHeaders();
                $this->outputHeader();
-               $wgOut->addHTML(
+               $this->getOutput()->addHTML(
                        Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor( 'MIMEsearch' )->getLocalUrl() ) ) .
                        Xml::openElement( 'fieldset' ) .
                        Html::hidden( 'title', SpecialPage::getTitleFor( 'MIMEsearch' )->getPrefixedText() ) .
@@ -82,31 +81,36 @@ class MIMEsearchPage extends QueryPage {
                }
                parent::execute( $par );
        }
-               
+
 
        function formatResult( $skin, $result ) {
-               global $wgContLang, $wgLang;
+               global $wgContLang;
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getText() );
-               $plink = $skin->link(
+               $plink = Linker::link(
                        Title::newFromText( $nt->getPrefixedText() ),
                        htmlspecialchars( $text )
                );
 
-               $download = $skin->makeMediaLinkObj( $nt, wfMsgHtml( 'download' ) );
+               $download = Linker::makeMediaLinkObj( $nt, wfMsgHtml( 'download' ) );
+               $lang = $this->getLanguage();
                $bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
-                       $wgLang->formatNum( $result->img_size ) );
+                       $lang->formatNum( $result->img_size ) );
                $dimensions = htmlspecialchars( wfMsg( 'widthheight',
-                       $wgLang->formatNum( $result->img_width ),
-                       $wgLang->formatNum( $result->img_height )
+                       $lang->formatNum( $result->img_width ),
+                       $lang->formatNum( $result->img_height )
                ) );
-               $user = $skin->link( Title::makeTitle( NS_USER, $result->img_user_text ), htmlspecialchars( $result->img_user_text ) );
-               $time = htmlspecialchars( $wgLang->timeanddate( $result->img_timestamp ) );
+               $user = Linker::link( Title::makeTitle( NS_USER, $result->img_user_text ), htmlspecialchars( $result->img_user_text ) );
+               $time = htmlspecialchars( $lang->timeanddate( $result->img_timestamp ) );
 
                return "($download) $plink . . $dimensions . . $bytes . . $user . . $time";
        }
 
+       /**
+        * @param $type string
+        * @return bool
+        */
        protected static function isValidType( $type ) {
                // From maintenance/tables.sql => img_major_mime
                $types = array(