From d81f562b712f2387fa02290bf2ca86392ab356f2 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 20:21:25 +0000 Subject: Aktualisierung auf Version 1.8.1 --- includes/SpecialNewpages.php | 60 +++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'includes/SpecialNewpages.php') diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index c0c6ba96..3fd0eba2 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -11,10 +11,13 @@ * @subpackage SpecialPage */ class NewPagesPage extends QueryPage { + var $namespace; + var $username = ''; - function NewPagesPage( $namespace = NS_MAIN ) { + function NewPagesPage( $namespace = NS_MAIN, $username = '' ) { $this->namespace = $namespace; + $this->username = $username; } function getName() { @@ -26,12 +29,23 @@ class NewPagesPage extends QueryPage { return false; } + function makeUserWhere( &$dbo ) { + $title = Title::makeTitleSafe( NS_USER, $this->username ); + if( $title ) { + return ' AND rc_user_text = ' . $dbo->addQuotes( $title->getText() ); + } else { + return ''; + } + } + function getSQL() { global $wgUser, $wgUseRCPatrol; $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0; $dbr =& wfGetDB( DB_SLAVE ); extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) ); + $uwhere = $this->makeUserWhere( $dbr ); + # FIXME: text will break with compression return "SELECT 'Newpages' as type, @@ -50,7 +64,8 @@ class NewPagesPage extends QueryPage { page_latest as rev_id FROM $recentchanges,$page WHERE rc_cur_id=page_id AND rc_new=1 - AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0"; + AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0 + {$uwhere}"; } function preprocessResults( &$dbo, &$res ) { @@ -112,34 +127,20 @@ class NewPagesPage extends QueryPage { } /** - * Show a namespace selection form for filtering + * Show a form for filtering namespace and username * * @return string */ function getPageHeader() { - $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() ); - $form = wfOpenElement( 'form', array( - 'method' => 'post', - 'action' => $thisTitle->getLocalUrl() ) ); - $form .= wfElement( 'label', array( 'for' => 'namespace' ), - wfMsg( 'namespace' ) ) . ' '; - $form .= HtmlNamespaceSelector( $this->namespace ); - # Preserve the offset and limit - $form .= wfElement( 'input', array( - 'type' => 'hidden', - 'name' => 'offset', - 'value' => $this->offset ) ); - $form .= wfElement( 'input', array( - 'type' => 'hidden', - 'name' => 'limit', - 'value' => $this->limit ) ); - $form .= wfElement( 'input', array( - 'type' => 'submit', - 'name' => 'submit', - 'id' => 'submit', - 'value' => wfMsg( 'allpagessubmit' ) ) ); - $form .= wfCloseElement( 'form' ); - return( $form ); + $self = Title::makeTitle( NS_SPECIAL, $this->getName() ); + $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) ); + $form .= ''; + $form .= ''; + $form .= ''; + $form .= ''; + $form .= '
' . wfMsgHtml( 'namespace' ) . '' . HtmlNamespaceSelector( $this->namespace ) . '
' . wfMsgHtml( 'newpages-username' ) . '' . wfInput( 'username', 30, $this->username ) . '
' . wfSubmitButton( wfMsg( 'allpagessubmit' ) ) . '
'; + $form .= wfHidden( 'offset', $this->offset ) . wfHidden( 'limit', $this->limit ) . ''; + return $form; } /** @@ -148,7 +149,7 @@ class NewPagesPage extends QueryPage { * @return array */ function linkParameters() { - return( array( 'namespace' => $this->namespace ) ); + return( array( 'namespace' => $this->namespace, 'username' => $this->username ) ); } } @@ -161,6 +162,7 @@ function wfSpecialNewpages($par, $specialPage) { list( $limit, $offset ) = wfCheckLimits(); $namespace = NS_MAIN; + $username = ''; if ( $par ) { $bits = preg_split( '/\s*,\s*/', trim( $par ) ); @@ -184,12 +186,14 @@ function wfSpecialNewpages($par, $specialPage) { } else { if( $ns = $wgRequest->getInt( 'namespace', 0 ) ) $namespace = $ns; + if( $un = $wgRequest->getText( 'username' ) ) + $username = $un; } if ( ! isset( $shownavigation ) ) $shownavigation = ! $specialPage->including(); - $npp = new NewPagesPage( $namespace ); + $npp = new NewPagesPage( $namespace, $username ); if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) ) $npp->doQuery( $offset, $limit, $shownavigation ); -- cgit v1.2.2