Fixed interwiki bug
[lhc/web/wiklou.git] / includes / SpecialImagelist.php
index cc42ad4..1ac3384 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 function wfSpecialImagelist() {
-       global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest;
+       global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgMiserMode;
        
        $sort = $wgRequest->getVal( 'sort' );
        $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
@@ -22,7 +22,7 @@ function wfSpecialImagelist() {
        $bydate = wfMsg( "bydate" );
        $bysize = wfMsg( "bysize" );
 
-       if ( !empty( $wpIlMatch ) ) {
+       if ( !$wgMiserMode && !empty( $wpIlMatch ) ) {
                $nt = Title::newFromUrl( $wpIlMatch );
                if($nt ) {
                        $m = $dbr->strencode( strtolower( $nt->getDBkey() ) );
@@ -44,7 +44,7 @@ function wfSpecialImagelist() {
        }
        list( $limit, $offset ) = wfCheckLimits( 50 );
        if ( 0 == $limit ) {
-               $lt = wfMsg( "all" );
+               $lt = wfMsg( 'imagelistall' );
        } else {
                $lt = $wgLang->formatNum( "${limit}" );
                $sql .= " LIMIT {$limit}";
@@ -56,18 +56,19 @@ function wfSpecialImagelist() {
        $wgOut->addHTML( "<p>{$text}\n</p>" );
 
        $sk = $wgUser->getSkin();
-       $cap = wfMsg( "ilshowmatch" );
        $sub = wfMsg( "ilsubmit" );
        $titleObj = Title::makeTitle( NS_SPECIAL, "Imagelist" );
        $action = $titleObj->escapeLocalURL(  "sort={$sort}&limit={$limit}" );
 
-       $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
-         "{$action}\">" .
-         "{$cap}: <input type='text' size='8' name=\"wpIlMatch\" value=\"" .
-         htmlspecialchars( $wpIlMatch ) . "\" /> " .
-         "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
+       if ( !$wgMiserMode ) {
+               $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
+                 "{$action}\">" .
+                 "<input type='text' size='20' name=\"wpIlMatch\" value=\"" .
+                 htmlspecialchars( $wpIlMatch ) . "\" /> " .
+                 "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
+       }
        $nums = array( 50, 100, 250, 500 );
-       $here = $wgContLang->specialPage( "Imagelist" );
+       $here = Title::makeTitle( NS_SPECIAL, 'Imagelist' );
 
        $fill = "";
        $first = true;
@@ -75,7 +76,7 @@ function wfSpecialImagelist() {
                if ( ! $first ) { $fill .= " | "; }
                $first = false;
 
-               $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
+               $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ),
                  "sort=byname&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) );
        }
        $text = wfMsg( "showlast", $fill, $byname );
@@ -87,7 +88,7 @@ function wfSpecialImagelist() {
                if ( ! $first ) { $fill .= " | "; }
                $first = false;
 
-               $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
+               $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ),
                  "sort=bysize&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) );
        }
        $text = wfMsg( "showlast", $fill, $bysize );
@@ -99,7 +100,7 @@ function wfSpecialImagelist() {
                if ( ! $first ) { $fill .= " | "; }
                $first = false;
 
-               $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
+               $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ),
                  "sort=bydate&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) );
        }
        $text = wfMsg( "showlast", $fill, $bydate );
@@ -109,23 +110,23 @@ function wfSpecialImagelist() {
        while ( $s = $dbr->fetchObject( $res ) ) {
                $name = $s->img_name;
                $ut = $s->img_user_text;
-               if ( 0 == $s->img_user ) { $ul = $ut; }
-               else { $ul = $sk->makeLink( $wgContLang->getNsText(
-                 Namespace::getUser() ) . ":{$ut}", $ut ); }
+               if ( 0 == $s->img_user ) {
+                       $ul = $ut;
+               } else {
+                       $ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
+               }
 
-               $ilink = "<a href=\"" . htmlspecialchars( Image::wfImageUrl( $name ) ) .
-                 "\">" . htmlspecialchars( $name ) . "</a>";
+               $ilink = "<a href=\"" . htmlspecialchars( Image::imageUrl( $name ) ) .
+                 "\">" . strtr(htmlspecialchars( $name ), '_', ' ') . "</a>";
 
                $nb = wfMsg( "nbytes", $wgLang->formatNum( $s->img_size ) );
                $l = "(" .
-                 $sk->makeKnownLink( $wgContLang->getNsText(
-                 Namespace::getImage() ) . ":{$name}", wfMsg( "imgdesc" ) ) .
+                 $sk->makeKnownLinkObj( Title::makeTitle( NS_IMAGE, $name ),
+                 wfMsg( "imgdesc" ) ) .
                  ") {$ilink} . . {$nb} . . {$ul} . . " .
                  $wgLang->timeanddate( $s->img_timestamp, true );
 
-               if ( "" != $s->img_description ) {
-                       $l .= ' <i>(' . $sk->formatComment( $s->img_description ) . ')</i>';
-               }
+               $l .= $sk->commentBlock( $s->img_description );
                $wgOut->addHTML( "{$l}<br />\n" );
        }
        $wgOut->addHTML( "</p>" );