From a991975c9a5f7a9ea0c71d123cff1d672e874c9e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 19 Jun 2005 06:25:53 +0000 Subject: [PATCH] * badaccess/badaccesstext to supercede sysop*, developer* messages --- RELEASE-NOTES | 1 + includes/OutputPage.php | 30 ++++++++++++++++++++++++++++-- includes/SpecialPage.php | 7 +------ languages/Language.php | 7 +++++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c4f2db9cce..1a7530bf51 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -297,6 +297,7 @@ Various bugfixes, small features, and a few experimental things: * (bug 1805) Initialise $wgContLang before $wgUser * (bug 2277) Added Friulian language file * Less gratuitous munging of content sample in delete summary +* badaccess/badaccesstext to supercede sysop*, developer* messages === Caveats === diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 624ab6cf6a..fe8ff5d21b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -531,6 +531,29 @@ class OutputPage { wfErrorExit(); } + /** + * Display an error page noting that a given permission bit is required. + * This should generally replace the sysopRequired, developerRequired etc. + * @param string $permission key required + */ + function permissionRequired( $permission ) { + global $wgUser; + + $this->setPageTitle( wfMsg( 'badaccess' ) ); + $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); + $this->setRobotpolicy( 'noindex,nofollow' ); + $this->setArticleRelated( false ); + $this->mBodytext = ''; + + $sk = $wgUser->getSkin(); + $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ) ); + $this->addHTML( wfMsgHtml( 'badaccesstext', $ap, $permission ) ); + $this->returnToMain(); + } + + /** + * @deprecated + */ function sysopRequired() { global $wgUser; @@ -542,10 +565,13 @@ class OutputPage { $sk = $wgUser->getSkin(); $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ), '' ); - $this->addHTML( wfMsg( 'sysoptext', $ap ) ); + $this->addHTML( wfMsgHtml( 'sysoptext', $ap ) ); $this->returnToMain(); } + /** + * @deprecated + */ function developerRequired() { global $wgUser; @@ -557,7 +583,7 @@ class OutputPage { $sk = $wgUser->getSkin(); $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ), '' ); - $this->addHTML( wfMsg( 'developertext', $ap ) ); + $this->addHTML( wfMsgHtml( 'developertext', $ap ) ); $this->returnToMain(); } diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 4da06a895e..fca20c0fdb 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -72,7 +72,6 @@ $wgSpecialPages = array( 'Lockdb' => new SpecialPage( 'Lockdb', 'siteadmin' ), 'Unlockdb' => new SpecialPage( 'Unlockdb', 'siteadmin' ), 'Userrights' => new SpecialPage( 'Userrights', 'userrights' ), - // 'Groups' => new SpecialPage( 'Groups' ), # currently borken ); global $wgUseValidation ; @@ -360,11 +359,7 @@ class SpecialPage */ function displayRestrictionError() { global $wgOut; - if ( $this->mRestriction == "developer" ) { - $wgOut->developerRequired(); - } else { - $wgOut->sysopRequired(); - } + $wgOut->permissionRequired( $this->mRestriction ); } /** diff --git a/languages/Language.php b/languages/Language.php index 3f5da93e8e..c95a22a2c0 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -442,6 +442,7 @@ and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide User's Guide] f 'printsubtitle' => "(From {{SERVER}})", 'protectedpage' => 'Protected page', 'administrators' => "Project:Administrators", + 'sysoptitle' => 'Sysop access required', 'sysoptext' => "The action you have requested can only be performed by users with \"sysop\" status. @@ -453,6 +454,12 @@ See $1.", 'bureaucrattitle' => 'Bureaucrat access required', "bureaucrattext" => "The action you have requested can only be performed by sysops with \"bureaucrat\" status.", + +'badaccess' => 'Permission error', +'badaccesstext' => 'The action you have requested is limited +to users with the "$2" permission assigned. +See $1.', + 'nbytes' => '$1 bytes', 'ok' => 'OK', 'sitetitle' => "{{SITENAME}}", -- 2.20.1