X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FSpecialImagelist.php;h=1ac3384680a12eb1c1d49c40ca0bca21b71446f6;hb=9868d5322d89811dc57b629868ae9a9450d0fc74;hp=0b4db550780b1a04f414464b8692766687f491e6;hpb=ac549401d4ddaf655ec47cd1e66092fdc83ab30b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialImagelist.php b/includes/SpecialImagelist.php index 0b4db55078..1ac3384680 100644 --- a/includes/SpecialImagelist.php +++ b/includes/SpecialImagelist.php @@ -1,8 +1,15 @@ getVal( 'sort' ); $wpIlMatch = $wgRequest->getText( 'wpIlMatch' ); @@ -15,26 +22,29 @@ function wfSpecialImagelist() $bydate = wfMsg( "bydate" ); $bysize = wfMsg( "bysize" ); - if ( "bysize" == $sort ) { - $sql .= " ORDER BY img_size DESC"; - $st = $bysize; - } else if ( "byname" == $sort ) { - if ( $wpIlMatch ) { - $nt = Title::newFromUrl( $wpIlMatch ); + if ( !$wgMiserMode && !empty( $wpIlMatch ) ) { + $nt = Title::newFromUrl( $wpIlMatch ); + if($nt ) { $m = $dbr->strencode( strtolower( $nt->getDBkey() ) ); $m = str_replace( "%", "\\%", $m ); $m = str_replace( "_", "\\_", $m ); $sql .= " WHERE LCASE(img_name) LIKE '%{$m}%'"; } + } + if ( "bysize" == $sort ) { + $sql .= " ORDER BY img_size DESC"; + $st = $bysize; + } else if ( "byname" == $sort ) { $sql .= " ORDER BY img_name"; $st = $byname; } else { + $sort = "bydate"; $sql .= " ORDER BY img_timestamp DESC"; $st = $bydate; } list( $limit, $offset ) = wfCheckLimits( 50 ); if ( 0 == $limit ) { - $lt = wfMsg( "all" ); + $lt = wfMsg( 'imagelistall' ); } else { $lt = $wgLang->formatNum( "${limit}" ); $sql .= " LIMIT {$limit}"; @@ -46,17 +56,19 @@ function wfSpecialImagelist() $wgOut->addHTML( "

{$text}\n

" ); $sk = $wgUser->getSkin(); - $cap = wfMsg( "ilshowmatch" ); $sub = wfMsg( "ilsubmit" ); $titleObj = Title::makeTitle( NS_SPECIAL, "Imagelist" ); $action = $titleObj->escapeLocalURL( "sort={$sort}&limit={$limit}" ); - $wgOut->addHTML( "
" . - "{$cap}: " . - "
" ); + if ( !$wgMiserMode ) { + $wgOut->addHTML( "
" . + " " . + "
" ); + } $nums = array( 50, 100, 250, 500 ); - $here = $wgLang->specialPage( "Imagelist" ); + $here = Title::makeTitle( NS_SPECIAL, 'Imagelist' ); $fill = ""; $first = true; @@ -64,8 +76,8 @@ function wfSpecialImagelist() if ( ! $first ) { $fill .= " | "; } $first = false; - $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ), - "sort=byname&limit={$num}&wpIlMatch={$wpIlMatch}" ); + $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ), + "sort=byname&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) ); } $text = wfMsg( "showlast", $fill, $byname ); $wgOut->addHTML( "

{$text}
\n" ); @@ -76,8 +88,8 @@ function wfSpecialImagelist() if ( ! $first ) { $fill .= " | "; } $first = false; - $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ), - "sort=bysize&limit={$num}&wpIlMatch={$wpIlMatch}" ); + $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ), + "sort=bysize&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) ); } $text = wfMsg( "showlast", $fill, $bysize ); $wgOut->addHTML( "{$text}
\n" ); @@ -88,8 +100,8 @@ function wfSpecialImagelist() if ( ! $first ) { $fill .= " | "; } $first = false; - $fill .= $sk->makeKnownLink( $here, $wgLang->formatNum( $num ), - "sort=bydate&limit={$num}&wpIlMatch={$wpIlMatch}" ); + $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ), + "sort=bydate&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) ); } $text = wfMsg( "showlast", $fill, $bydate ); $wgOut->addHTML( "{$text}

\n

" ); @@ -98,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( $wgLang->getNsText( - Namespace::getUser() ) . ":{$ut}", $ut ); } + if ( 0 == $s->img_user ) { + $ul = $ut; + } else { + $ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut ); + } - $ilink = "{$name}"; + $ilink = "" . strtr(htmlspecialchars( $name ), '_', ' ') . ""; $nb = wfMsg( "nbytes", $wgLang->formatNum( $s->img_size ) ); $l = "(" . - $sk->makeKnownLink( $wgLang->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 .= " ({$s->img_description})"; - } + $l .= $sk->commentBlock( $s->img_description ); $wgOut->addHTML( "{$l}
\n" ); } $wgOut->addHTML( "

" );