Category namespaces
[lhc/web/wiklou.git] / includes / SpecialImagelist.php
index d7fde56..39737fe 100644 (file)
@@ -1,15 +1,11 @@
-<?
+<?php
 
 function wfSpecialImagelist()
 {
-       global $wgUser, $wgOut, $wgLang, $sort;
-       global $wpIlMatch, $wpIlSubmit;
-       $sort        = $_REQUEST['sort'];
-       $wpIlMatch   = $_REQUEST["wpIlMatch"];
-       $wpIlSubmit  = $_REQUEST["wpIlSubmit"];
-
-       $fields = array( 'wpIlMatch' );
-       wfCleanFormFields( $fields );
+       global $wgUser, $wgOut, $wgLang, $wgRequest;
+       
+       $sort = $wgRequest->getVal( 'sort' );
+       $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
 
        $sql = "SELECT img_size,img_name,img_user,img_user_text," .
          "img_description,img_timestamp FROM image";
@@ -39,26 +35,25 @@ function wfSpecialImagelist()
        if ( 0 == $limit ) {
                $lt = wfMsg( "all" );
        } else {
-               $lt = "${limit}";
+               $lt = $wgLang->formatNum( "${limit}" );
                $sql .= " LIMIT {$limit}";
        }
-       $wgOut->addHTML( "<p>" . wfMsg( "imglegend" ) . "\n" );
+       $wgOut->addHTML( "<p>" . wfMsg( "imglegend" ) . "</p>\n" );
 
        $text = wfMsg( "imagelisttext",
                "<strong>{$lt}</strong>", "<strong>{$st}</strong>" );
-       $wgOut->addHTML( "<p>{$text}\n<p>" );
+       $wgOut->addHTML( "<p>{$text}\n</p>" );
 
        $sk = $wgUser->getSkin();
        $cap = wfMsg( "ilshowmatch" );
        $sub = wfMsg( "ilsubmit" );
-       $action = wfLocalUrlE( $wgLang->specialPage( "Imagelist" ),
-         "sort=byname&limit={$limit}" );
+       $titleObj = Title::makeTitle( NS_SPECIAL, "Imagelist" );
+       $action = $titleObj->escapeLocalURL(  "sort=byname&limit={$limit}" );
 
        $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
          "{$action}\">" .
-         "{$cap}: <input type=text size=8 name=\"wpIlMatch\" value=\"\"> " .
-         "<input type=submit name=\"wpIlSubmit\" value=\"{$sub}\"></form>" );
-
+         "{$cap}: <input type='text' size='8' name=\"wpIlMatch\" value=\"\" /> " .
+         "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
        $nums = array( 50, 100, 250, 500 );
        $here = $wgLang->specialPage( "Imagelist" );
 
@@ -68,11 +63,11 @@ function wfSpecialImagelist()
                if ( ! $first ) { $fill .= " | "; }
                $first = false;
 
-               $fill .= $sk->makeKnownLink( $here, "{$num}",
+               $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
                  "sort=bysize&limit={$num}" );
        }
        $text = wfMsg( "showlast", $fill, $bysize );
-       $wgOut->addHTML( "{$text}<br>\n" );
+       $wgOut->addHTML( "<p>{$text}<br />\n" );
 
        $fill = "";
        $first = true;
@@ -80,11 +75,11 @@ function wfSpecialImagelist()
                if ( ! $first ) { $fill .= " | "; }
                $first = false;
 
-               $fill .= $sk->makeKnownLink( $here, $num,
+               $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ),
                  "sort=bydate&limit={$num}" );
        }
        $text = wfMsg( "showlast", $fill, $bydate );
-       $wgOut->addHTML( "{$text}<br>\n<p>" );
+       $wgOut->addHTML( "{$text}</p>\n<p>" );
 
        $res = wfQuery( $sql, DB_READ, "wfSpecialImagelist" );
        while ( $s = wfFetchObject( $res ) ) {
@@ -97,7 +92,7 @@ function wfSpecialImagelist()
                $ilink = "<a href=\"" . wfImageUrl( $name ) .
                  "\">{$name}</a>";
 
-               $nb = wfMsg( "nbytes", $s->img_size );
+               $nb = wfMsg( "nbytes", $wgLang->formatNum( $s->img_size ) );
                $l = "(" .
                  $sk->makeKnownLink( $wgLang->getNsText(
                  Namespace::getImage() ) . ":{$name}", wfMsg( "imgdesc" ) ) .
@@ -107,8 +102,9 @@ function wfSpecialImagelist()
                if ( "" != $s->img_description ) {
                        $l .= " <em>({$s->img_description})</em>";
                }
-               $wgOut->addHTML( "{$l}<br>\n" );
+               $wgOut->addHTML( "{$l}<br />\n" );
        }
+       $wgOut->addHTML( "</p>" );
        wfFreeResult( $res );
 }