From: Brion Vibber Date: Thu, 27 Oct 2005 22:20:46 +0000 (+0000) Subject: * Fail gracefully on invalid namespace in Special:Newpages X-Git-Tag: 1.6.0~1295 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=9bda98bb80297189b1d147c2a24f8f7a6c80f070;p=lhc%2Fweb%2Fwiklou.git * Fail gracefully on invalid namespace in Special:Newpages --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 66b6900510..3617ead6a0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -177,6 +177,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 3803) Fix links on Special:Wantedcategories with miser mode off * Fix Special:BrokenRedirects on MySQL 5.0 * (bug 3807) Fix 'all' in namespaces drop-down on contribs, rc +* Fail gracefully on invalid namespace in Special:Newpages === Caveats === diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 678291b44d..f718cf5ca0 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -112,6 +112,7 @@ function wfSpecialNewpages($par, $specialPage) { global $wgRequest, $wgContLang; list( $limit, $offset ) = wfCheckLimits(); + $namespace = NS_MAIN; if ( $par ) { $bits = preg_split( '/\s*,\s*/', trim( $par ) ); @@ -125,14 +126,18 @@ function wfSpecialNewpages($par, $specialPage) { $limit = intval($m[1]); if ( preg_match( '/^offset=(\d+)$/', $bit, $m ) ) $offset = intval($m[1]); - if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) - $namespace = $wgContLang->getNsIndex( $m[1] ); + if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) { + $ns = $wgContLang->getNsIndex( $m[1] ); + if( $ns !== false ) { + $namespace = $ns; + } + } } } if ( ! isset( $shownavigation ) ) $shownavigation = ! $specialPage->including(); - $npp = new NewPagesPage( isset( $namespace ) ? $namespace : NS_MAIN ); + $npp = new NewPagesPage( $namespace ); if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) $npp->doQuery( $offset, $limit, $shownavigation );