r10952 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10951‎ | r10952 | r10953 >
Date:14:15, 8 September 2005
Author:avar
Status:old
Tags:
Comment:
* (bug 3358) Allow inclusion of Special:Newimages as {{Special:Newimages[/int]}}
where int is the number of images to show
Modified paths:
  • /trunk/phase3/includes/SpecialNewimages.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialNewimages.php
@@ -11,13 +11,14 @@
1212 /**
1313 *
1414 */
15 -function wfSpecialNewimages() {
 15+function wfSpecialNewimages( $par, $specialPage ) {
1616 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest,
1717 $wgGroupPermissions;
1818
1919 $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
2020 $dbr =& wfGetDB( DB_SLAVE );
2121 $sk = $wgUser->getSkin();
 22+ $shownav = !$specialPage->including();
2223 $hidebots = $wgRequest->getBool('hidebots',1);
2324
2425 if($hidebots) {
@@ -66,6 +67,10 @@
6768 /** Hardcode this for now. */
6869 $limit = 48;
6970
 71+ if ( $parval = intval( $par ) )
 72+ if ( $parval <= $limit && $parval > 0 )
 73+ $limit = $parval;
 74+
7075 $where = array();
7176 if ( $wpIlMatch != '' ) {
7277 $nt = Title::newFromUrl( $wpIlMatch );
@@ -141,9 +146,10 @@
142147
143148 $bydate = wfMsg( 'bydate' );
144149 $lt = $wgLang->formatNum( min( $shownImages, $limit ) );
145 - $text = wfMsg( "imagelisttext",
146 - "<strong>{$lt}</strong>", "<strong>{$bydate}</strong>" );
147 - $wgOut->addHTML( "<p>{$text}\n</p>" );
 150+ if ($shownav) {
 151+ $text = wfMsg( 'imagelisttext', "<strong>{$lt}</strong>", "<strong>{$bydate}</strong>" );
 152+ $wgOut->addHTML( "<p>{$text}\n</p>" );
 153+ }
148154
149155 $sub = wfMsg( 'ilsubmit' );
150156 $titleObj = Title::makeTitle( NS_SPECIAL, 'Newimages' );
@@ -151,11 +157,13 @@
152158 if(!$hidebots) {
153159 $action.='&hidebots=0';
154160 }
155 - $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
156 - "{$action}\">" .
157 - "<input type='text' size='20' name=\"wpIlMatch\" value=\"" .
158 - htmlspecialchars( $wpIlMatch ) . "\" /> " .
159 - "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
 161+ if ($shownav) {
 162+ $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
 163+ "{$action}\">" .
 164+ "<input type='text' size='20' name=\"wpIlMatch\" value=\"" .
 165+ htmlspecialchars( $wpIlMatch ) . "\" /> " .
 166+ "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
 167+ }
160168 $here = $wgContLang->specialPage( 'Newimages' );
161169
162170 /**
@@ -186,11 +194,13 @@
187195
188196 $prevnext = '<p>' . $botLink . ' '. wfMsg( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'</p>';
189197
190 - $wgOut->addHTML( $prevnext );
 198+ if ($shownav)
 199+ $wgOut->addHTML( $prevnext );
191200
192201 if( count( $images ) ) {
193202 $wgOut->addHTML( $gallery->toHTML() );
194 - $wgOut->addHTML( $prevnext );
 203+ if ($shownav)
 204+ $wgOut->addHTML( $prevnext );
195205 } else {
196206 $wgOut->addWikiText( wfMsg( 'noimages' ) );
197207 }
Index: trunk/phase3/includes/SpecialPage.php
@@ -32,7 +32,7 @@
3333 'Recentchanges' => new IncludableSpecialPage( 'Recentchanges' ),
3434 'Upload' => new SpecialPage( 'Upload' ),
3535 'Imagelist' => new SpecialPage( 'Imagelist' ),
36 - 'Newimages' => new SpecialPage( 'Newimages' ),
 36+ 'Newimages' => new IncludableSpecialPage( 'Newimages' ),
3737 'Listusers' => new SpecialPage( 'Listusers' ),
3838 'Statistics' => new SpecialPage( 'Statistics' ),
3939 'Random' => new SpecialPage( 'Randompage' ),

Status & tagging log