2009-01-23 19:23:19 +00:00
|
|
|
<?php
|
|
|
|
|
2011-11-16 05:34:24 +00:00
|
|
|
abstract class AbuseFilterView extends ContextSource {
|
|
|
|
/**
|
|
|
|
* @param $page SpecialPage
|
|
|
|
* @param $params array
|
|
|
|
*/
|
2009-01-23 19:23:19 +00:00
|
|
|
function __construct( $page, $params ) {
|
|
|
|
$this->mPage = $page;
|
|
|
|
$this->mParams = $params;
|
2011-11-16 05:34:24 +00:00
|
|
|
$this->setContext( $this->mPage->getContext() );
|
2009-01-23 19:23:19 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/**
|
2012-01-03 17:29:10 +00:00
|
|
|
* @static
|
2011-08-24 22:11:52 +00:00
|
|
|
* @return bool
|
|
|
|
*/
|
2012-01-03 17:29:10 +00:00
|
|
|
static function canEdit() {
|
2009-01-23 19:23:19 +00:00
|
|
|
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
|
|
|
/**
|
2012-01-03 17:29:10 +00:00
|
|
|
* @static
|
2011-08-24 22:11:52 +00:00
|
|
|
* @return bool
|
2012-09-12 15:31:24 +00:00
|
|
|
*/
|
|
|
|
static function canEditGlobal() {
|
|
|
|
global $wgUser;
|
|
|
|
static $canEditGlobal = null;
|
|
|
|
|
|
|
|
if ( is_null( $canEditGlobal ) ) {
|
|
|
|
$canEditGlobal = $wgUser->isAllowed( 'abusefilter-modify-global' );
|
|
|
|
}
|
|
|
|
|
|
|
|
return $canEditGlobal;
|
|
|
|
}
|
|
|
|
|
2011-08-24 22:11:52 +00:00
|
|
|
/**
|
2012-01-03 17:29:10 +00:00
|
|
|
* @static
|
2011-08-24 22:11:52 +00:00
|
|
|
* @return bool
|
|
|
|
*/
|
2012-01-03 17:29:10 +00:00
|
|
|
static function canViewPrivate() {
|
2009-07-03 14:17:05 +00:00
|
|
|
global $wgUser;
|
|
|
|
static $canView = null;
|
|
|
|
|
|
|
|
if ( is_null( $canView ) ) {
|
2012-01-03 17:29:10 +00:00
|
|
|
$canView = self::canEdit() || $wgUser->isAllowed( 'abusefilter-view-private' );
|
2009-07-03 14:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $canView;
|
|
|
|
}
|
2009-01-29 22:44:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class AbuseFilterChangesList extends OldChangesList {
|
2012-03-11 20:51:54 +00:00
|
|
|
/**
|
|
|
|
* @param $s
|
|
|
|
* @param $rc
|
|
|
|
* @param $classes array
|
|
|
|
*/
|
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'] );
|
2012-09-02 11:07:02 +00:00
|
|
|
$examineLink = Linker::link(
|
|
|
|
$title,
|
|
|
|
$this->msg( 'abusefilter-changeslist-examine' )->parse(),
|
|
|
|
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
|
|
|
}
|