From 607f1c8d10ca33485da558b28424428399a11e11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 8 Sep 2005 14:15:28 +0000 Subject: [PATCH] * (bug 3358) Allow inclusion of Special:Newimages as {{Special:Newimages[/int]}} where int is the number of images to show --- includes/SpecialNewimages.php | 32 +++++++++++++++++++++----------- includes/SpecialPage.php | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/includes/SpecialNewimages.php b/includes/SpecialNewimages.php index 8d42f4a4fe..5d47ca947b 100644 --- a/includes/SpecialNewimages.php +++ b/includes/SpecialNewimages.php @@ -11,13 +11,14 @@ require_once( 'ImageGallery.php' ); /** * */ -function wfSpecialNewimages() { +function wfSpecialNewimages( $par, $specialPage ) { global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions; $wpIlMatch = $wgRequest->getText( 'wpIlMatch' ); $dbr =& wfGetDB( DB_SLAVE ); $sk = $wgUser->getSkin(); + $shownav = !$specialPage->including(); $hidebots = $wgRequest->getBool('hidebots',1); if($hidebots) { @@ -66,6 +67,10 @@ function wfSpecialNewimages() { /** Hardcode this for now. */ $limit = 48; + if ( $parval = intval( $par ) ) + if ( $parval <= $limit && $parval > 0 ) + $limit = $parval; + $where = array(); if ( $wpIlMatch != '' ) { $nt = Title::newFromUrl( $wpIlMatch ); @@ -141,9 +146,10 @@ function wfSpecialNewimages() { $bydate = wfMsg( 'bydate' ); $lt = $wgLang->formatNum( min( $shownImages, $limit ) ); - $text = wfMsg( "imagelisttext", - "{$lt}", "{$bydate}" ); - $wgOut->addHTML( "

{$text}\n

" ); + if ($shownav) { + $text = wfMsg( 'imagelisttext', "{$lt}", "{$bydate}" ); + $wgOut->addHTML( "

{$text}\n

" ); + } $sub = wfMsg( 'ilsubmit' ); $titleObj = Title::makeTitle( NS_SPECIAL, 'Newimages' ); @@ -151,11 +157,13 @@ function wfSpecialNewimages() { if(!$hidebots) { $action.='&hidebots=0'; } - $wgOut->addHTML( "
" . - " " . - "
" ); + if ($shownav) { + $wgOut->addHTML( "
" . + " " . + "
" ); + } $here = $wgContLang->specialPage( 'Newimages' ); /** @@ -186,11 +194,13 @@ function wfSpecialNewimages() { $prevnext = '

' . $botLink . ' '. wfMsg( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'

'; - $wgOut->addHTML( $prevnext ); + if ($shownav) + $wgOut->addHTML( $prevnext ); if( count( $images ) ) { $wgOut->addHTML( $gallery->toHTML() ); - $wgOut->addHTML( $prevnext ); + if ($shownav) + $wgOut->addHTML( $prevnext ); } else { $wgOut->addWikiText( wfMsg( 'noimages' ) ); } diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 5bc4e5103d..cea0c5ed05 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -32,7 +32,7 @@ $wgSpecialPages = array( 'Recentchanges' => new IncludableSpecialPage( 'Recentchanges' ), 'Upload' => new SpecialPage( 'Upload' ), 'Imagelist' => new SpecialPage( 'Imagelist' ), - 'Newimages' => new SpecialPage( 'Newimages' ), + 'Newimages' => new IncludableSpecialPage( 'Newimages' ), 'Listusers' => new SpecialPage( 'Listusers' ), 'Statistics' => new SpecialPage( 'Statistics' ), 'Random' => new SpecialPage( 'Randompage' ), -- 2.20.1