From: Arne Heizmann Date: Mon, 9 Aug 2004 23:30:02 +0000 (+0000) Subject: If you really must have a useless $wgUseRCPatrol option, might as well use it X-Git-Tag: 1.5.0alpha1~2444 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=52bb460dc45f1593b20a77e9e20ebdfb89943ad0;p=lhc%2Fweb%2Fwiklou.git If you really must have a useless $wgUseRCPatrol option, might as well use it consistently everywhere to ensure that setting it to 0 actually does disable the feature. Also, tell the user that it is disabled if they happen to follow a link with &action=markpatrolled in it. Additionally, make &action=markpatrolled say "log in required" if the user is not logged in. --- diff --git a/includes/Article.php b/includes/Article.php index d56a0005e6..361b9d4a8d 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -625,7 +625,7 @@ class Article { function view() { global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMwRedir, $wgOnlySysopsCanPatrol; - global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath; + global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol; $sk = $wgUser->getSkin(); $fname = 'Article::view'; @@ -735,7 +735,7 @@ class Article { # If we have been passed an &rcid= parameter, we want to give the user a # chance to mark this new article as patrolled. - if ( !is_null ( $rcid ) && $rcid != 0 && $wgUser->getID() != 0 && + if ( $wgUseRCPatrol && !is_null ( $rcid ) && $rcid != 0 && $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) { $wgOut->addHTML( wfMsg ( 'markaspatrolledlink', @@ -1086,9 +1086,20 @@ class Article { # Mark this particular edit as patrolled function markpatrolled() { - global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol; + global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgUseRCPatrol; $wgOut->setRobotpolicy( 'noindex,follow' ); - if( $wgOnlySysopsCanPatrol && !$wgUser->isSysop() ) + + if ( !$wgUseRCPatrol ) + { + $wgOut->errorpage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); + return; + } + if ( $wgUser->getID() == 0 ) + { + $wgOut->loginToUse(); + return; + } + if ( $wgOnlySysopsCanPatrol && !$wgUser->isSysop() ) { $wgOut->sysopRequired(); return; diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index be90b6852c..7b9acb8991 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -74,9 +74,8 @@ class DifferenceEngine { } else { $rollback = ""; } - if ( $wgUseRCPatrol && - ($this->mRcidMarkPatrolled != 0 && $wgUser->getID() != 0 && - ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) ) + if ( $wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->getID() != 0 && + ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) { $patrol = " [" . $sk->makeKnownLinkObj( $wgTitle, wfMsg( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . "]"; diff --git a/includes/Skin.php b/includes/Skin.php index aa2acdfb2b..8e087ceb92 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2250,7 +2250,7 @@ class Skin { function recentChangesLineOld( &$rc, $watched = false ) { - global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol; + global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol; # Extract DB fields into local scope extract( $rc->mAttribs ); @@ -2285,7 +2285,7 @@ class Skin { if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) { $diffLink = wfMsg( 'diff' ); } else { - if ( $rc_patrolled == 0 && $wgUser->getID() != 0 && + if ( $wgUseRCPatrol && $rc_patrolled == 0 && $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) $rcidparam = "&rcid={$rc_id}"; else @@ -2309,8 +2309,8 @@ class Skin { # Article link # If it's a new article, there is no diff link, but if it hasn't been # patrolled yet, we need to give users a way to do so - if ( $rc_type == RC_NEW && $rc_patrolled == 0 && $wgUser->getID() != 0 && - ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) + if ( $wgUseRCPatrol && $rc_type == RC_NEW && $rc_patrolled == 0 && + $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" ); else $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '' ); diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index d9f85fe145..2d9a47a650 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -15,8 +15,9 @@ class NewPagesPage extends QueryPage { } function getSQL() { - global $wgUser, $wgOnlySysopsCanPatrol; - $usepatrol = ( $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) ? 1 : 0; + global $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol; + $usepatrol = ( $wgUseRCPatrol && $wgUser->getID() != 0 && + ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) ? 1 : 0; $dbr =& wfGetDB( DB_SLAVE ); extract( $dbr->tableNames( 'recentchanges', 'cur' ) ); @@ -40,14 +41,14 @@ class NewPagesPage extends QueryPage { } function formatResult( $skin, $result ) { - global $wgLang, $wgUser, $wgOnlySysopsCanPatrol; + global $wgLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol; $u = $result->user; $ut = $result->user_text; $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length ) ); $c = $skin->formatComment($result->comment ); - if ( 0 == $u ) { # not by a logged-in user + if ( $u == 0 ) { # not by a logged-in user $ul = $ut; } else { @@ -58,8 +59,8 @@ class NewPagesPage extends QueryPage { # Since there is no diff link, we need to give users a way to # mark the article as patrolled if it isn't already - if ( $result->usepatrol && $result->patrolled == 0 && $wgUser->getID() != 0 && - ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) + if ( $wgUseRCPatrol && $result->usepatrol && $result->patrolled == 0 && + $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) $link = $skin->makeKnownLink( $result->title, '', "rcid={$result->rcid}" ); else $link = $skin->makeKnownLink( $result->title, '' ); diff --git a/languages/Language.php b/languages/Language.php index df2d29d404..f97570984d 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1439,6 +1439,8 @@ You might want to check the following regular expression for patterns that are c 'markaspatrolledtext' => "Mark this article as patrolled", 'markedaspatrolled' => "Marked as patrolled", 'markedaspatrolledtext' => "The selected revision has been marked as patrolled.", +'rcpatroldisabled' => "Recent Changes Patrol disabled", +'rcpatroldisabledtext' => "The Recent Changes Patrol feature is currently disabled.", # Monobook.js: tooltips and access keys for monobook 'Monobook.js' => '/* tooltips and access keys */