From a45494196f14d61fce2e376e2614027dd4b15778 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 16 Dec 2008 19:20:35 +0000 Subject: [PATCH] *Add missing 'reblock' check and message setting *Move right checks to typeAction to make the code prettier --- includes/DefaultSettings.php | 1 + includes/LogEventsList.php | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 28a91d5feb..bb23559f8b 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2902,6 +2902,7 @@ $wgLogActions = array( 'suppress/event' => 'logdelete-logentry', 'suppress/delete' => 'suppressedarticle', 'suppress/block' => 'blocklogentry', + 'suppress/reblock' => 'reblock-logentry', ); /** diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 05f5d25d9d..2e9fc2124c 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -253,7 +253,7 @@ class LogEventsList { // Add review links and such... if( ($this->flags & self::NO_ACTION_LINK) || ($row->log_deleted & LogPage::DELETED_ACTION) ) { // Action text is suppressed... - } else if( self::typeAction($row,'move','move') && !empty($paramArray[0]) && $wgUser->isAllowed( 'move' ) ) { + } else if( self::typeAction($row,'move','move','move') && !empty($paramArray[0]) ) { $destTitle = Title::newFromText( $paramArray[0] ); if( $destTitle ) { $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ), @@ -264,11 +264,11 @@ class LogEventsList { '&wpMovetalk=0' ) . ')'; } // Show undelete link - } else if( self::typeAction($row,array('delete','suppress'),'delete') && $wgUser->isAllowed( 'delete' ) ) { + } else if( self::typeAction($row,array('delete','suppress'),'delete','delete') ) { $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ), $this->message['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')'; // Show unblock/change block link - } else if( self::typeAction( $row, array( 'block', 'suppress' ), 'block' ) && $wgUser->isAllowed( 'block' ) ) { + } else if( self::typeAction($row,array('block','suppress'),array('block','reblock'),'block') ) { $revert = '(' . $this->skin->link( SpecialPage::getTitleFor( 'Ipblocklist' ), $this->message['unblocklink'], @@ -289,13 +289,13 @@ class LogEventsList { 'action=unprotect' ) . ')'; } // Show unmerge link - } else if ( self::typeAction($row,'merge','merge') ) { + } else if( self::typeAction($row,'merge','merge','mergehistory') ) { $merge = SpecialPage::getTitleFor( 'Mergehistory' ); $revert = '(' . $this->skin->makeKnownLinkObj( $merge, $this->message['revertmerge'], wfArrayToCGI( array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(), 'mergepoint' => $paramArray[1] ) ) ) . ')'; // If an edit was hidden from a page give a review link to the history - } else if( self::typeAction($row,array('delete','suppress'),'revision') && $wgUser->isAllowed( 'deleterevision' ) ) { + } else if( self::typeAction($row,array('delete','suppress'),'revision','deleterevision') ) { if( count($paramArray) == 2 ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); // Different revision types use different URL params... @@ -310,7 +310,7 @@ class LogEventsList { 'target=' . $title->getPrefixedUrl() . $revParams ) . ')'; } // Hidden log items, give review link - } else if( self::typeAction($row,array('delete','suppress'),'event') && $wgUser->isAllowed( 'deleterevision' ) ) { + } else if( self::typeAction($row,array('delete','suppress'),'event','deleterevision') ) { if( count($paramArray) == 1 ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); $Ids = explode( ',', $paramArray[0] ); @@ -376,12 +376,18 @@ class LogEventsList { * @param $row Row * @param $type Mixed: string/array * @param $action Mixed: string/array + * @param $right string * @return bool */ - public static function typeAction( $row, $type, $action ) { + public static function typeAction( $row, $type, $action, $right='' ) { $match = is_array($type) ? in_array($row->log_type,$type) : $row->log_type == $type; if( $match ) { - $match = is_array($action) ? in_array($row->log_action,$action) : $row->log_action == $action; + $match = is_array($action) ? + in_array($row->log_action,$action) : $row->log_action == $action; + if( $match && $right ) { + global $wgUser; + $match = $wgUser->isAllowed( $right ); + } } return $match; } -- 2.20.1