Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1958
access-denied.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:20 PM
2014-11-21 20:20:16 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
access-denied.patch
View Options
--- /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;
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1461
Default Alt Text
access-denied.patch (2 KB)
Attached To
Mode
T3924: Restricted read access for subset of wiki
Attached
Detach File
Event Timeline
Log In to Comment