From 7dbb373ef226e981155095107adeff0912907afd Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 13 Apr 2008 17:37:41 +0000 Subject: [PATCH] * Move useRCPatrol() to User * Add useNPPatrol() --- includes/ChangesList.php | 17 ++++------------- includes/SpecialRecentchanges.php | 6 +++--- includes/User.php | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 1a923c72cc..6bb93d628f 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -241,15 +241,6 @@ class ChangesList { } } - /** - * Check whether to enable recent changes patrol features - * @return bool - */ - public static function usePatrol() { - global $wgUseRCPatrol, $wgUser; - return( $wgUseRCPatrol && ($wgUser->isAllowed('patrol') || $wgUser->isAllowed('patrolmarks')) ); - } - /** * Returns the string which indicates the number of watching users */ @@ -307,7 +298,7 @@ class OldChangesList extends ChangesList { * Format a line using the old system (aka without any javascript). */ public function recentChangesLine( &$rc, $watched = false ) { - global $wgContLang, $wgRCShowChangedSize; + global $wgContLang, $wgRCShowChangedSize, $wgUser; $fname = 'ChangesList::recentChangesLineOld'; wfProfileIn( $fname ); @@ -317,7 +308,7 @@ class OldChangesList extends ChangesList { extract( $rc->mAttribs ); # Should patrol-related stuff be shown? - $unpatrolled = $this->usePatrol() && $rc_patrolled == 0; + $unpatrolled = $wgUser->usePatrol() && $rc_patrolled == 0; $this->insertDateHeader($s,$rc_timestamp); @@ -390,7 +381,7 @@ class EnhancedChangesList extends ChangesList { * Format a line for enhanced recentchange (aka with javascript and block of lines). */ public function recentChangesLine( &$baseRC, $watched = false ) { - global $wgLang, $wgContLang; + global $wgLang, $wgContLang, $wgUser; # Create a specialised object $rc = RCCacheEntry::newFromParent( $baseRC ); @@ -412,7 +403,7 @@ class EnhancedChangesList extends ChangesList { } # Should patrol-related stuff be shown? - if( $this->usePatrol() ) { + if( $wgUser->usePatrol() ) { $rc->unpatrolled = !$rc_patrolled; } else { $rc->unpatrolled = false; diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index 22c92c52e1..b71886429f 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -147,7 +147,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) { $hidem = $hideminor ? 'AND rc_minor = 0' : ''; $hidem .= $hidebots ? ' AND rc_bot = 0' : ''; $hidem .= $hideliu && !$forcebot ? ' AND rc_user = 0' : ''; - $hidem .= ( ChangesList::usePatrol() && $hidepatrolled ) ? ' AND rc_patrolled = 0' : ''; + $hidem .= ($wgUser->usePatrol() && $hidepatrolled ) ? ' AND rc_patrolled = 0' : ''; $hidem .= $hideanons && !$forcebot ? ' AND rc_user != 0' : ''; $hidem .= $forcebot ? ' AND rc_bot = 1' : ''; @@ -521,7 +521,7 @@ function makeOptionsLink( $title, $override, $options ) { * @param $nondefaults */ function rcOptionsPanel( $defaults, $nondefaults ) { - global $wgLang, $wgUseRCPatrol; + global $wgLang, $wgUser; $options = $nondefaults + $defaults; @@ -571,7 +571,7 @@ function rcOptionsPanel( $defaults, $nondefaults ) { $links[] = wfMsgHtml( 'rcshowhidebots', $botLink ); $links[] = wfMsgHtml( 'rcshowhideanons', $anonsLink ); $links[] = wfMsgHtml( 'rcshowhideliu', $liuLink ); - if( ChangesList::usePatrol() ) + if( $wgUser->usePatrol() ) $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink ); $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink ); $hl = implode( ' | ', $links ); diff --git a/includes/User.php b/includes/User.php index 6106733e57..e3f190d169 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1776,6 +1776,24 @@ class User { return in_array( $action, $this->getRights() ); } + + /** + * Check whether to enable recent changes patrol features for this user + * @return bool + */ + public function useRCPatrol() { + global $wgUseRCPatrol; + return( $wgUseRCPatrol && ($this->isAllowed('patrol') || $this->isAllowed('patrolmarks')) ); + } + + /** + * Check whether to enable recent changes patrol features for this user + * @return bool + */ + public function useNPPatrol() { + global $wgUseRCPatrol, $wgUseNPPatrol; + return( ($wgUseRCPatrol || $wgUseNPPatrol) && ($this->isAllowed('patrol') || $this->isAllowed('patrolmarks')) ); + } /** * Load a skin if it doesn't exist or return it -- 2.20.1