* action=login now returns the correct waiting time in the details property
* (bug 13792) Broken titles are now silently skipped in search results.
* (bug 13819) exturlusage paging skipped an item
+* Fixed handling of usernames containing spaces in list=block
=== Languages updated in 1.13 ===
* @addtogroup API
*/
class ApiQueryBlocks extends ApiQueryBase {
+
+ var $users;
public function __construct($query, $moduleName) {
parent :: __construct($query, $moduleName, 'bk');
if(isset($params['ids']))
$this->addWhere(array('ipb_id' => $params['ids']));
if(isset($params['users']))
- $this->addWhere(array('ipb_address' => $params['users']));
+ {
+ foreach((array)$params['users'] as $u)
+ $this->prepareUsername($u);
+ $this->addWhere(array('ipb_address' => $this->usernames));
+ }
if(!$wgUser->isAllowed('suppress'))
$this->addWhere(array('ipb_deleted' => 0));
$result->setIndexedTagName($data, 'block');
$result->addValue('query', $this->getModuleName(), $data);
}
+
+ protected function prepareUsername($user) {
+ if( $user ) {
+ $name = User::isIP( $user )
+ ? $user
+ : User::getCanonicalName( $user, 'valid' );
+ if( $name === false ) {
+ $this->dieUsage( "User name {$user} is not valid", 'param_user' );
+ } else {
+ $this->usernames[] = $name;
+ }
+ } else {
+ $this->dieUsage( 'User parameter may not be empty', 'param_user' );
+ }
+ }
protected function convertHexIP($ip)
{