* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* Query module to enumerate all user blocks
*
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$this->addTimestampWhereRange( 'ipb_timestamp', $params['dir'], $params['start'], $params['end'] );
+
+ $db = $this->getDB();
+
if ( isset( $params['ids'] ) ) {
$this->addWhereFld( 'ipb_id', $params['ids'] );
}
}
$prefix = substr( $lower, 0, 4 );
- $db = $this->getDB();
+ # Fairly hard to make a malicious SQL statement out of hex characters,
+ # but it is good practice to add quotes
+ $lower = $db->addQuotes( $lower );
+ $upper = $db->addQuotes( $upper );
+
$this->addWhere( array(
'ipb_range_start' . $db->buildLike( $prefix, $db->anyString() ),
- "ipb_range_start <= '$lower'",
- "ipb_range_end >= '$upper'",
+ 'ipb_range_start <= ' . $lower,
+ 'ipb_range_end >= ' . $upper,
'ipb_auto' => 0
) );
}
$this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) );
$this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) );
$this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) );
- $this->addWhereIf( 'ipb_expiry = '.$db->addQuotes($db->getInfinity(), isset( $show['!temp'] ) );
- $this->addWhereIf( 'ipb_expiry != '.$db->addQuotes($db->getInfinity(), isset( $show['temp'] ) );
+ $this->addWhereIf( 'ipb_expiry = '.$db->addQuotes($db->getInfinity()), isset( $show['!temp'] ) );
+ $this->addWhereIf( 'ipb_expiry != '.$db->addQuotes($db->getInfinity()), isset( $show['temp'] ) );
$this->addWhereIf( "ipb_range_end = ipb_range_start", isset( $show['!range'] ) );
$this->addWhereIf( "ipb_range_end > ipb_range_start", isset( $show['range'] ) );
}
);
}
+ public function getResultProperties() {
+ return array(
+ 'id' => array(
+ 'id' => 'integer'
+ ),
+ 'user' => array(
+ 'user' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
+ 'userid' => array(
+ 'userid' => array(
+ ApiBase::PROP_TYPE => 'integer',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
+ 'by' => array(
+ 'by' => 'string'
+ ),
+ 'byid' => array(
+ 'byid' => 'integer'
+ ),
+ 'timestamp' => array(
+ 'timestamp' => 'timestamp'
+ ),
+ 'expiry' => array(
+ 'expiry' => 'timestamp'
+ ),
+ 'reason' => array(
+ 'reason' => 'string'
+ ),
+ 'range' => array(
+ 'rangestart' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'rangeend' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
+ 'flags' => array(
+ 'automatic' => 'boolean',
+ 'anononly' => 'boolean',
+ 'nocreate' => 'boolean',
+ 'autoblock' => 'boolean',
+ 'noemail' => 'boolean',
+ 'hidden' => 'boolean',
+ 'allowusertalk' => 'boolean'
+ )
+ );
+ }
+
public function getDescription() {
return 'List all blocked users and IP addresses';
}
}
public function getHelpUrls() {
- return 'http://www.mediawiki.org/wiki/API:Blocks';
+ return 'https://www.mediawiki.org/wiki/API:Blocks';
}
public function getVersion() {