From: Magnus Manske Date: Sat, 31 Dec 2005 20:51:43 +0000 (+0000) Subject: Parameter fix for single user search; note that there is now ambiguity with the ... X-Git-Tag: 1.6.0~828 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=2f5585954595af8df234b83e774a6cc9b90bf822;p=lhc%2Fweb%2Fwiklou.git Parameter fix for single user search; note that there is now ambiguity with the $limit for images per page. --- diff --git a/includes/SpecialNewimages.php b/includes/SpecialNewimages.php index 4123a16d64..a84c9232c5 100644 --- a/includes/SpecialNewimages.php +++ b/includes/SpecialNewimages.php @@ -20,7 +20,12 @@ function wfSpecialNewimages( $par, $specialPage ) { $sk = $wgUser->getSkin(); $shownav = !$specialPage->including(); $hidebots = $wgRequest->getBool('hidebots',1); - $singleUser = $wgRequest->getInt('user',0); # Limit images to a single user? + + # Show only for a single user? + $targetUser = isset($par) ? $par : $wgRequest->getVal( 'target' ); + if ( $targetUser != "" ) { #AND !is_numeric ( $targetUser ) ) { # There might be some ambiguity between this and the $limit later on! + $singleUser = User::newFromName ( $targetUser ) ; + } if($hidebots) { @@ -88,12 +93,11 @@ function wfSpecialNewimages( $par, $specialPage ) { } } - # Single user only? - if ( $singleUser > 0 ) { - $where[] .= "img_user='{$singleUser}'" ; + # SQL for single user only? + if ( isset ( $singleUser ) ) { + $where[] .= "img_user='" . $singleUser->getID() . "'" ; } - $invertSort = false; if( $until = $wgRequest->getVal( 'until' ) ) { $where[] = 'img_timestamp < ' . $dbr->timestamp( $until ); @@ -163,15 +167,13 @@ function wfSpecialNewimages( $par, $specialPage ) { $wgOut->addHTML( "

{$text}\n

" ); } - if ( $singleUser > 0 ) { - $u = new User ; - $u->setID ( $singleUser ) ; - $u->loadFromDatabase () ; - $t = $u->getUserPage() ; + # Single user search note + if ( isset ( $singleUser ) ) { + $t = $singleUser->getUserPage() ; $uPage = $sk->makeLinkObj( $t ) ; - $wgOut->addHTML ( wfMsgForContent ( 'imagelistforuser' , $uPage ) ) ; + $wgOut->addHTML ( wfMsg ( 'imagelistforuser' , $uPage ) ) ; } - + $sub = wfMsg( 'ilsubmit' ); $titleObj = Title::makeTitle( NS_SPECIAL, 'Newimages' ); $action = $titleObj->escapeLocalURL();