mediawiki-extensions-AbuseF.../Views/AbuseFilterView.php
Andrew Garrett f9c9c07ccf Abuse Filter changes designed for testing filters against real data:
* Add searching and filtering functionality to the existing 'test' interface.
* Add an 'examine' interface designed for testing filters against a previous change, selectable through the search interface in either the 'test' or the 'examine' view.
* Minor enabling change in ChangesList core, to allow subclassing.
2009-01-29 22:44:31 +00:00

40 lines
890 B
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 = 'unset';
if ($canEdit == 'unset') {
$canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
}
return $canEdit;
}
}
class AbuseFilterChangesList extends OldChangesList {
protected function insertExtra( &$s, &$rc, &$classes ) {
## Empty, used for subclassers to add anything special.
$sk = $this->skin;
$title = SpecialPage::getTitleFor( 'AbuseFilter', "examine/".$rc->mAttribs['rc_id'] );
$examineLink = $sk->link( $title, wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ) );
$s .= " ($examineLink)";
}
}