2009-01-23 19:23:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class AbuseFilterView {
|
|
|
|
function __construct( $page, $params ) {
|
|
|
|
$this->mPage = $page;
|
|
|
|
$this->mParams = $params;
|
|
|
|
}
|
|
|
|
|
2011-02-10 17:32:57 +00:00
|
|
|
/**
|
|
|
|
* @param string $subpage
|
|
|
|
* @return Title
|
|
|
|
*/
|
2009-10-07 13:57:06 +00:00
|
|
|
function getTitle( $subpage = '' ) {
|
2009-01-23 19:23:19 +00:00
|
|
|
return $this->mPage->getTitle( $subpage );
|
|
|
|
}
|
2009-10-07 13:57:06 +00:00
|
|
|
|
2009-01-23 19:23:19 +00:00
|
|
|
abstract function show();
|
|
|
|
|
2011-08-24 22:11:52 +00:00
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
2009-01-23 19:23:19 +00:00
|
|
|
function canEdit() {
|
|
|
|
global $wgUser;
|
2009-07-03 14:17:05 +00:00
|
|
|
static $canEdit = null;
|
2009-01-23 19:23:19 +00:00
|
|
|
|
2009-07-03 14:17:05 +00:00
|
|
|
if ( is_null( $canEdit ) ) {
|
2009-01-23 19:23:19 +00:00
|
|
|
$canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
|
|
|
|
}
|
|
|
|
|
|
|
|
return $canEdit;
|
|
|
|
}
|
2009-07-03 14:17:05 +00:00
|
|
|
|
2011-08-24 22:11:52 +00:00
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
2009-07-03 14:17:05 +00:00
|
|
|
function canViewPrivate() {
|
|
|
|
global $wgUser;
|
|
|
|
static $canView = null;
|
|
|
|
|
|
|
|
if ( is_null( $canView ) ) {
|
|
|
|
$canView = $this->canEdit() || $wgUser->isAllowed( 'abusefilter-view-private' );
|
|
|
|
}
|
|
|
|
|
|
|
|
return $canView;
|
|
|
|
}
|
2009-01-29 22:44:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class AbuseFilterChangesList extends OldChangesList {
|
2009-08-03 10:17:29 +00:00
|
|
|
public function insertExtra( &$s, &$rc, &$classes ) {
|
2009-10-07 13:57:06 +00:00
|
|
|
$examineParams = empty( $rc->examineParams ) ? array() : $rc->examineParams;
|
2009-01-29 22:44:31 +00:00
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
$title = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/' . $rc->mAttribs['rc_id'] );
|
2011-09-02 15:34:55 +00:00
|
|
|
$examineLink = Linker::link( $title, wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ), array(), $examineParams );
|
2009-01-29 22:44:31 +00:00
|
|
|
|
|
|
|
$s .= " ($examineLink)";
|
2009-01-30 00:54:20 +00:00
|
|
|
|
2010-02-13 14:10:36 +00:00
|
|
|
# If we have a match..
|
2009-01-30 00:54:20 +00:00
|
|
|
if ( isset( $rc->filterResult ) ) {
|
2010-02-13 14:10:36 +00:00
|
|
|
$class = $rc->filterResult ?
|
2009-10-07 13:57:06 +00:00
|
|
|
'mw-abusefilter-changeslist-match' :
|
2009-02-07 09:34:11 +00:00
|
|
|
'mw-abusefilter-changeslist-nomatch';
|
2009-01-30 00:54:20 +00:00
|
|
|
|
|
|
|
$classes[] = $class;
|
|
|
|
}
|
2009-01-29 22:44:31 +00:00
|
|
|
}
|
2009-10-07 13:57:06 +00:00
|
|
|
|
2009-03-11 09:45:45 +00:00
|
|
|
// Kill rollback links.
|
2010-02-13 14:10:36 +00:00
|
|
|
public function insertRollback( &$s, &$rc ) { }
|
2009-02-07 09:34:11 +00:00
|
|
|
}
|