]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/specials/SpecialListfiles.php
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialListfiles.php
index e15b6959aca6903cf43acc229b9da4b0c5e6e6fe..b93324227cf1098ce981263e806838373430ea14 100644 (file)
@@ -34,13 +34,11 @@ class ImageListPager extends TablePager {
                }
                $search = $wgRequest->getText( 'ilsearch' );
                if ( $search != '' && !$wgMiserMode ) {
-                       $nt = Title::newFromUrl( $search );
+                       $nt = Title::newFromURL( $search );
                        if( $nt ) {
                                $dbr = wfGetDB( DB_SLAVE );
-                               $m = $dbr->strencode( strtolower( $nt->getDBkey() ) );
-                               $m = str_replace( "%", "\\%", $m );
-                               $m = str_replace( "_", "\\_", $m );
-                               $this->mQueryConds = array( "LOWER(img_name) LIKE '%{$m}%'" );
+                               $this->mQueryConds = array( 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(), 
+                                       strtolower( $nt->getDBkey() ), $dbr->anyString() ) );
                        }
                }
 
@@ -127,21 +125,23 @@ class ImageListPager extends TablePager {
                global $wgLang;
                switch ( $field ) {
                        case 'img_timestamp':
-                               return $wgLang->timeanddate( $value, true );
+                               return htmlspecialchars( $wgLang->timeanddate( $value, true ) );
                        case 'img_name':
                                static $imgfile = null;
                                if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' );
 
                                $name = $this->mCurrentRow->img_name;
-                               $link = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_FILE, $name ), $value );
+                               $link = $this->getSkin()->linkKnown( Title::makeTitle( NS_FILE, $name ), $value );
                                $image = wfLocalFile( $value );
                                $url = $image->getURL();
                                $download = Xml::element('a', array( 'href' => $url ), $imgfile );
                                return "$link ($download)";
                        case 'img_user_text':
                                if ( $this->mCurrentRow->img_user ) {
-                                       $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ),
-                                               htmlspecialchars( $value ) );
+                                       $link = $this->getSkin()->link(
+                                               Title::makeTitle( NS_USER, $value ),
+                                               htmlspecialchars( $value )
+                                       );
                                } else {
                                        $link = htmlspecialchars( $value );
                                }
@@ -156,10 +156,10 @@ class ImageListPager extends TablePager {
        }
 
        function getForm() {
-               global $wgRequest, $wgMiserMode;
+               global $wgRequest, $wgScript, $wgMiserMode;
                $search = $wgRequest->getText( 'ilsearch' );
 
-               $s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getTitle()->getLocalURL(), 'id' => 'mw-listfiles-form' ) ) .
+               $s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
                        Xml::openElement( 'fieldset' ) .
                        Xml::element( 'legend', null, wfMsg( 'listfiles' ) ) .
                        Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) );