mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 14:13:54 +00:00
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
if (!defined( 'MEDIAWIKI' ))
|
|
die();
|
|
|
|
abstract class AbuseFilterView {
|
|
function __construct( $page, $params ) {
|
|
$this->mPage = $page;
|
|
$this->mParams = $params;
|
|
}
|
|
|
|
function getTitle( $subpage='' ) {
|
|
return $this->mPage->getTitle( $subpage );
|
|
}
|
|
|
|
abstract function show();
|
|
|
|
function canEdit() {
|
|
global $wgUser;
|
|
static $canEdit = null;
|
|
|
|
if ( is_null( $canEdit ) ) {
|
|
$canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
|
|
}
|
|
|
|
return $canEdit;
|
|
}
|
|
|
|
function canViewPrivate() {
|
|
global $wgUser;
|
|
static $canView = null;
|
|
|
|
if ( is_null( $canView ) ) {
|
|
$canView = $this->canEdit() || $wgUser->isAllowed( 'abusefilter-view-private' );
|
|
}
|
|
|
|
return $canView;
|
|
}
|
|
}
|
|
|
|
class AbuseFilterChangesList extends OldChangesList {
|
|
protected function insertExtra( &$s, &$rc, &$classes ) {
|
|
$sk = $this->skin;
|
|
$examineParams = empty($rc->examineParams) ? array() : $rc->examineParams;
|
|
|
|
$title = SpecialPage::getTitleFor( 'AbuseFilter', "examine/".$rc->mAttribs['rc_id'] );
|
|
$examineLink = $sk->link( $title, wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ), array(), $examineParams );
|
|
|
|
$s .= " ($examineLink)";
|
|
|
|
## If we have a match..
|
|
if ( isset( $rc->filterResult ) ) {
|
|
$class = $rc->filterResult ?
|
|
'mw-abusefilter-changeslist-match' :
|
|
'mw-abusefilter-changeslist-nomatch';
|
|
|
|
$classes[] = $class;
|
|
}
|
|
}
|
|
|
|
// Kill rollback links.
|
|
protected function insertRollback( &$s, &$rc ) {}
|
|
}
|