mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-30 16:54:18 +00:00
176227e721
* Replace deprecated methods. * Remove no longer needed function fnmatch(). * Remove superfluous newlines. * Remove unused and redundant local variables and globals. * Deglobalization. * Update documentation. * Fix incorrect return values or add FIXMEs when in doubt. * Escape output in a few places where needed. * Remove unneeded MEDIAWIKI constant checks. * Fix various JSHint/JSLint issues. Patch Set 11: Merged https://gerrit.wikimedia.org/r/24701 into this one per Siebrand's request Change-Id: I02ba4ce31b6aca5b7324114093f8ece143abc295
87 lines
1.7 KiB
PHP
87 lines
1.7 KiB
PHP
<?php
|
|
|
|
abstract class AbuseFilterView extends ContextSource {
|
|
/**
|
|
* @param $page SpecialPage
|
|
* @param $params array
|
|
*/
|
|
function __construct( $page, $params ) {
|
|
$this->mPage = $page;
|
|
$this->mParams = $params;
|
|
$this->setContext( $this->mPage->getContext() );
|
|
}
|
|
|
|
/**
|
|
* @param string $subpage
|
|
* @return Title
|
|
*/
|
|
function getTitle( $subpage = '' ) {
|
|
return $this->mPage->getTitle( $subpage );
|
|
}
|
|
|
|
abstract function show();
|
|
|
|
/**
|
|
* @static
|
|
* @return bool
|
|
*/
|
|
static function canEdit() {
|
|
global $wgUser;
|
|
static $canEdit = null;
|
|
|
|
if ( is_null( $canEdit ) ) {
|
|
$canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
|
|
}
|
|
|
|
return $canEdit;
|
|
}
|
|
|
|
/**
|
|
* @static
|
|
* @return bool
|
|
*/
|
|
static function canViewPrivate() {
|
|
global $wgUser;
|
|
static $canView = null;
|
|
|
|
if ( is_null( $canView ) ) {
|
|
$canView = self::canEdit() || $wgUser->isAllowed( 'abusefilter-view-private' );
|
|
}
|
|
|
|
return $canView;
|
|
}
|
|
}
|
|
|
|
class AbuseFilterChangesList extends OldChangesList {
|
|
/**
|
|
* @param $s
|
|
* @param $rc
|
|
* @param $classes array
|
|
*/
|
|
public function insertExtra( &$s, &$rc, &$classes ) {
|
|
$examineParams = empty( $rc->examineParams ) ? array() : $rc->examineParams;
|
|
|
|
$title = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/' . $rc->mAttribs['rc_id'] );
|
|
$examineLink = Linker::link(
|
|
$title,
|
|
$this->msg( 'abusefilter-changeslist-examine' )->parse(),
|
|
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.
|
|
public function insertRollback( &$s, &$rc ) { }
|
|
}
|