* Remove deprecated $wgOnlySysopsCanPatrol references; use User::isAllowed( 'patrol' ) per bug 5282. Patch by Alan Harder.

This commit is contained in:
Rob Church 2006-03-18 16:07:17 +00:00
parent 867bd26aa9
commit fcd1cdeb93
5 changed files with 23 additions and 42 deletions

View file

@ -322,6 +322,8 @@ Security:
* Blocked users can no longer roll back, change the protection of, or delete/undelete pages
* Protect against spoofing of X-Forwarded-For header
* XSS issue : now sanitize search query input (fixed in 1.5rc3)
* Remove deprecated $wgOnlySysopsCanPatrol references; use User::isAllowed( 'patrol' )
per bug 5282. Patch by Alan Harder.
Special Pages:
* Rearranged Special:Movepage form to reduce confusion between destination

View file

@ -727,7 +727,7 @@ class Article {
* the given title.
*/
function view() {
global $wgUser, $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgContLang;
global $wgUser, $wgOut, $wgRequest, $wgContLang;
global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
global $wgUseTrackbacks;
$sk = $wgUser->getSkin();
@ -920,12 +920,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 ( $wgUseRCPatrol
&& !is_null($rcid)
&& $rcid != 0
&& $wgUser->isLoggedIn()
&& ( $wgUser->isAllowed('patrol') || !$wgOnlySysopsCanPatrol ) )
{
if ( $wgUseRCPatrol && !is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) {
$wgOut->addHTML(
"<div class='patrollink'>" .
wfMsg ( 'markaspatrolledlink',
@ -1522,7 +1517,7 @@ class Article {
* Mark this particular edit as patrolled
*/
function markpatrolled() {
global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgUseRCPatrol, $wgUser;
global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser;
$wgOut->setRobotpolicy( 'noindex,follow' );
# Check RC patrol config. option
@ -1532,31 +1527,24 @@ class Article {
}
# Check permissions
if( $wgUser->isLoggedIn() ) {
if( !$wgUser->isAllowed( 'patrol' ) ) {
$wgOut->permissionRequired( 'patrol' );
return;
}
} else {
$wgOut->loginToUse();
if( !$wgUser->isAllowed( 'patrol' ) ) {
$wgOut->permissionRequired( 'patrol' );
return;
}
$rcid = $wgRequest->getVal( 'rcid' );
if ( !is_null ( $rcid ) )
{
if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, $wgOnlySysopsCanPatrol ) ) ) {
if ( !is_null ( $rcid ) ) {
if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) {
require_once( 'RecentChange.php' );
RecentChange::markPatrolled( $rcid );
wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, $wgOnlySysopsCanPatrol ) );
wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
$wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) );
$wgOut->addWikiText( wfMsg( 'markedaspatrolledtext' ) );
}
$rcTitle = Title::makeTitle( NS_SPECIAL, 'Recentchanges' );
$wgOut->returnToMain( false, $rcTitle->getPrefixedText() );
}
else
{
else {
$wgOut->errorpage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
}
}

View file

@ -194,13 +194,12 @@ class ChangesList {
}
/**
* Check whether to enable RC-Patrol features
* Check whether to enable recent changes patrol features
* @return bool
*/
function usePatrol() {
global $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgUser;
return $wgUseRCPatrol && $wgUser->isLoggedIn() &&
( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed( 'patrol' ) );
global $wgUseRCPatrol, $wgUser;
return( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) );
}

View file

@ -70,8 +70,7 @@ class DifferenceEngine {
}
function showDiffPage() {
global $wgUser, $wgOut, $wgContLang, $wgOnlySysopsCanPatrol;
global $wgUseExternalEditor, $wgUseRCPatrol;
global $wgUser, $wgOut, $wgContLang, $wgUseExternalEditor, $wgUseRCPatrol;
$fname = 'DifferenceEngine::showDiffPage';
wfProfileIn( $fname );
@ -160,11 +159,8 @@ CONTROL;
} else {
$rollback = '';
}
if ( $wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->isLoggedIn() &&
( $wgUser->isAllowed('rollback') || !$wgOnlySysopsCanPatrol ) )
{
$patrol = ' [' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'markaspatrolleddiff' ),
"action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . ']';
if( $wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->isAllowed( 'patrol' ) ) {
$patrol = ' [' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . ']';
} else {
$patrol = '';
}

View file

@ -32,9 +32,8 @@ class NewPagesPage extends QueryPage {
}
function getSQL() {
global $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
$usepatrol = ( $wgUseRCPatrol && $wgUser->isLoggedIn() &&
( $wgUser->isAllowed('patrol') || !$wgOnlySysopsCanPatrol ) ) ? 1 : 0;
global $wgUser, $wgUseRCPatrol;
$usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) );
@ -60,7 +59,7 @@ class NewPagesPage extends QueryPage {
}
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
global $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol;
$u = $result->user;
$ut = $result->user_text;
@ -80,17 +79,14 @@ 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
$ns = $wgContLang->getNsText( $result->namespace );
if ( $wgUseRCPatrol && !is_null ( $result->usepatrol ) && $result->usepatrol &&
$result->patrolled == 0 && $wgUser->isLoggedIn() &&
( $wgUser->isAllowed('patrol') || !$wgOnlySysopsCanPatrol ) )
if( $wgUseRCPatrol && !is_null( $result->usepatrol ) && $result->usepatrol && $result->patrolled == 0 && $wgUser->isAllowed( 'patrol' ) ) {
$link = $skin->makeKnownLink( $ns . ':' . $result->title, '', "rcid={$result->rcid}" );
else
} else {
$link = $skin->makeKnownLink( $ns . ':' . $result->title, '' );
}
$s = "{$d} {$link} ({$length}) . . {$ul}";
$s .= $skin->commentBlock( $result->comment );
return $s;
}