*/
function view() {
global $wgUser, $wgOut, $wgRequest, $wgContLang;
- global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
+ global $wgEnableParserCache, $wgStylePath, $wgParser;
global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
$sk = $wgUser->getSkin();
# 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->isAllowed( 'patrol' ) ) {
+ if (!is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) {
$wgOut->addHTML(
"<div class='patrollink'>" .
wfMsgHtml( 'markaspatrolledlink',
}
/**
- * Mark this particular edit as patrolled
+ * Mark this particular edit/page as patrolled
*/
function markpatrolled() {
- global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser;
+ global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUseNPPatrol, $wgUser;
$wgOut->setRobotPolicy( 'noindex,nofollow' );
- # Check RC patrol config. option
- if( !$wgUseRCPatrol ) {
+ # Check patrol config options
+
+ if ( !($wgUseNPPatrol || $wgUseRCPatrol)) {
+ $wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
+ return;
+ }
+
+ # If we haven't been given an rc_id value, we can't do anything
+ $rcid = (int) $wgRequest->getVal('rcid');
+ $rc = $rcid ? RecentChange::newFromId($rcid) : null;
+ if ( is_null ( $rc ) )
+ {
+ $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
+ return;
+ }
+
+ if ( $rc->mAttribs['rc_type'] == RC_NEW && !$wgUseNPPatrol ) {
+ $wgOut->errorpage( 'nppatroldisabled', 'nppatroldisabledtext' );
+ return;
+ }
+
+ if ( !$wgUseRCPatrol && $rc->mAttribs['rc_type'] != RC_NEW) {
$wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
return;
}
return;
}
- # If we haven't been given an rc_id value, we can't do anything
- $rcid = $wgRequest->getVal( 'rcid' );
- if( !$rcid ) {
- $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
- return;
- }
-
# Handle the 'MarkPatrolled' hook
if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) {
return;
}
- $return = SpecialPage::getTitleFor( 'Recentchanges' );
+ #It would be nice to see where the user had actually come from, but for now just guess
+ $returnto = $rc->mAttribs['rc_type'] == RC_NEW ? 'Newpages' : 'Recentchanges';
+ $return = Title::makeTitle( NS_SPECIAL, $returnto );
+
# If it's left up to us, check that the user is allowed to patrol this edit
# If the user has the "autopatrol" right, then we'll assume there are no
# other conditions stopping them doing so
}
function getSQL() {
- global $wgUser, $wgUseRCPatrol;
- $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
+ global $wgUser, $wgUseNPPatrol;
+ $usepatrol = ( $wgUseNPPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
$dbr = wfGetDB( DB_SLAVE );
list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' );
* @return bool
*/
function patrollable( $result ) {
- global $wgUser, $wgUseRCPatrol;
- return $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) && !$result->patrolled;
+ global $wgUser, $wgUseNPPatrol;
+ return $wgUseNPPatrol && $wgUser->isAllowed( 'patrol' ) && !$result->patrolled;
}
function feedItemDesc( $row ) {