summaryrefslogtreecommitdiff
path: root/includes/SpecialNewpages.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/SpecialNewpages.php')
-rw-r--r--includes/SpecialNewpages.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php
index 48037a73..abd5e018 100644
--- a/includes/SpecialNewpages.php
+++ b/includes/SpecialNewpages.php
@@ -36,12 +36,19 @@ class NewPagesPage extends QueryPage {
}
}
+ private function makeNamespaceWhere() {
+ return $this->namespace !== 'all'
+ ? ' AND rc_namespace = ' . intval( $this->namespace )
+ : '';
+ }
+
function getSQL() {
global $wgUser, $wgUseRCPatrol;
$usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
$dbr = wfGetDB( DB_SLAVE );
list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' );
+ $nsfilter = $this->makeNamespaceWhere();
$uwhere = $this->makeUserWhere( $dbr );
# FIXME: text will break with compression
@@ -62,7 +69,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
+ {$nsfilter}
+ AND page_is_redirect = 0
{$uwhere}";
}
@@ -130,11 +138,13 @@ class NewPagesPage extends QueryPage {
* @return string
*/
function getPageHeader() {
+ global $wgScript;
$self = SpecialPage::getTitleFor( $this->getName() );
- $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
+ $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
+ $form .= Xml::hidden( 'title', $self->getPrefixedDBkey() );
# Namespace selector
$form .= '<table><tr><td align="right">' . Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '</td>';
- $form .= '<td>' . Xml::namespaceSelector( $this->namespace ) . '</td></tr>';
+ $form .= '<td>' . Xml::namespaceSelector( $this->namespace, 'all' ) . '</td></tr>';
# Username filter
$form .= '<tr><td align="right">' . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . '</td>';
$form .= '<td>' . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . '</td></tr>';
@@ -186,7 +196,7 @@ function wfSpecialNewpages($par, $specialPage) {
}
}
} else {
- if( $ns = $wgRequest->getInt( 'namespace', 0 ) )
+ if( $ns = $wgRequest->getText( 'namespace', NS_MAIN ) )
$namespace = $ns;
if( $un = $wgRequest->getText( 'username' ) )
$username = $un;
@@ -199,6 +209,4 @@ function wfSpecialNewpages($par, $specialPage) {
if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) )
$npp->doQuery( $offset, $limit, $shownavigation );
-}
-
-?>
+} \ No newline at end of file