--- /home/jody/mediawiki-1.5.3-orig/includes/OutputPage.php 2005-08-18 18:06:20.000000000 +0200 +++ ./includes/OutputPage.php 2005-12-08 13:59:18.531250000 +0100 @@ -635,12 +635,32 @@ function loginToUse() { global $wgUser, $wgTitle, $wgContLang; - $this->setPageTitle( wfMsg( 'loginreqtitle' ) ); - $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); - $this->setRobotpolicy( 'noindex,nofollow' ); - $this->setArticleFlag( false ); - $this->mBodytext = ''; - $this->addWikiText( wfMsg( 'loginreqtext' ) ); + $usersNamespaces = $wgUser->getAllowedRNSes(); + $usersNamespacesArray = explode("\n", $usersNamespaces); + $currentNamespace = Namespace::getCanonicalName($wgTitle->getNamespace()); + + # If the user tries to access an extra namespace but does not have + # the correct permissions, display an Access Denied message. + # You need to define MediaWiki:noaccesstitle and MediaWiki:noaccesstext + if($wgTitle->getNamespace() >= 100) { + if(!in_array($currentNamespace, $usersNamespacesArray)) { + $this->setPageTitle( wfMsg( 'noaccesstitle' ) ); + $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); + $this->setRobotpolicy( 'noindex,nofollow' ); + $this->setArticleFlag( false ); + $this->mBodytext = ''; + $this->addWikiText( wfMsg( 'noaccesstext' ) ); + } + } + + else { + $this->setPageTitle( wfMsg( 'loginreqtitle' ) ); + $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); + $this->setRobotpolicy( 'noindex,nofollow' ); + $this->setArticleFlag( false ); + $this->mBodytext = ''; + $this->addWikiText( wfMsg( 'loginreqtext' ) ); + } # We put a comment in the .html file so a Sysop can diagnose the page the # user can't see. @@ -648,9 +668,15 @@ $wgContLang->getNsText( $wgTitle->getNamespace() ) . ':' . $wgTitle->getDBkey() . '-->' ); - $this->returnToMain(); # Flip back to the main page after 10 seconds. - } + # Do not return to the main page automatically if the user tried to access + # an extra namespace. Only return if the user tried, but failed to access + # a system namespace. + if($wgTitle->getNamespace() < 100) { + $this->returnToMain(); # Flip back to the main page after 10 seconds. + } + } + function databaseError( $fname, $sql, $error, $errno ) { global $wgUser, $wgCommandLineMode, $wgShowSQLErrors;