On 12/30/05, Magnus Manske magnus_manske@users.sourceforge.net wrote:
Update of /cvsroot/wikipedia/phase3/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2885/includes
Modified Files: SpecialNewimages.php Log Message: SpecialNewimages can now be called with user=X to limit display to a single user
Index: SpecialNewimages.php
RCS file: /cvsroot/wikipedia/phase3/includes/SpecialNewimages.php,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- SpecialNewimages.php 12 Dec 2005 03:23:01 -0000 1.18 +++ SpecialNewimages.php 30 Dec 2005 20:31:57 -0000 1.19 @@ -20,6 +20,7 @@ $sk = $wgUser->getSkin(); $shownav = !$specialPage->including(); $hidebots = $wgRequest->getBool('hidebots',1);
$singleUser = $wgRequest->getInt('user',0); # Limit images to a single user? if($hidebots) {
@@ -47,9 +48,12 @@ $image = $dbr->tableName('image');
$sql="SELECT img_timestamp from $image";
# Hide bots? if($hidebots) { $sql.=$joinsql.' WHERE ug_group IS NULL'; }
$sql.=' ORDER BY img_timestamp DESC LIMIT 1'; $res = $dbr->query($sql, 'wfSpecialNewImages'); $row = $dbr->fetchRow($res);
@@ -84,6 +88,12 @@ } }
# Single user only?
if ( $singleUser > 0 ) {
$where[] .= "img_user='{$singleUser}'" ;
}
$invertSort = false; if( $until = $wgRequest->getVal( 'until' ) ) { $where[] = 'img_timestamp < ' . $dbr->timestamp( $until );
@@ -153,6 +163,15 @@ $wgOut->addHTML( "<p>{$text}\n</p>" ); }
if ( $singleUser > 0 ) {
$u = new User ;
$u->setID ( $singleUser ) ;
$u->loadFromDatabase () ;
$t = $u->getUserPage() ;
$uPage = $sk->makeLinkObj( $t ) ;
$wgOut->addHTML ( wfMsgForContent ( 'imagelistforuser' , $uPage ) ) ;
}
$sub = wfMsg( 'ilsubmit' ); $titleObj = Title::makeTitle( NS_SPECIAL, 'Newimages' ); $action = $titleObj->escapeLocalURL();
What's the point of allowing user agents to specify a user ID to limit to? This should use ->getText() and User::newFromName() instead. and wfMsg() instead of wfMsgForContent().
wikitech-l@lists.wikimedia.org