dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "http: Support HTTP Basic Authentication"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiUnblock.php
diff --git
a/includes/api/ApiUnblock.php
b/includes/api/ApiUnblock.php
index
fb41839
..
ace41a4
100644
(file)
--- a/
includes/api/ApiUnblock.php
+++ b/
includes/api/ApiUnblock.php
@@
-53,14
+53,29
@@
class ApiUnblock extends ApiBase {
if ( $user->isBlocked() ) {
$status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
if ( $status !== true ) {
if ( $user->isBlocked() ) {
$status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
if ( $status !== true ) {
- $this->dieUsageMsg( $status );
+ $msg = $this->parseMsg( $status );
+ $this->dieUsage(
+ $msg['info'],
+ $msg['code'],
+ 0,
+ [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ]
+ );
}
}
}
}
- $data = array(
+ // Check if user can add tags
+ if ( !is_null( $params['tags'] ) ) {
+ $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user );
+ if ( !$ableToTag->isOK() ) {
+ $this->dieStatus( $ableToTag );
+ }
+ }
+
+ $data = [
'Target' => is_null( $params['id'] ) ? $params['user'] : "#{$params['id']}",
'Target' => is_null( $params['id'] ) ? $params['user'] : "#{$params['id']}",
- 'Reason' => $params['reason']
- );
+ 'Reason' => $params['reason'],
+ 'Tags' => $params['tags']
+ ];
$block = Block::newFromTarget( $data['Target'] );
$retval = SpecialUnblock::processUnblock( $data, $this->getContext() );
if ( $retval !== true ) {
$block = Block::newFromTarget( $data['Target'] );
$retval = SpecialUnblock::processUnblock( $data, $this->getContext() );
if ( $retval !== true ) {
@@
-84,26
+99,30
@@
class ApiUnblock extends ApiBase {
}
public function getAllowedParams() {
}
public function getAllowedParams() {
- return
array(
- 'id' =>
array(
+ return
[
+ 'id' =>
[
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_TYPE => 'integer',
-
)
,
+
]
,
'user' => null,
'reason' => '',
'user' => null,
'reason' => '',
- );
+ 'tags' => [
+ ApiBase::PARAM_TYPE => 'tags',
+ ApiBase::PARAM_ISMULTI => true,
+ ],
+ ];
}
public function needsToken() {
return 'csrf';
}
}
public function needsToken() {
return 'csrf';
}
- p
ublic
function getExamplesMessages() {
- return
array(
+ p
rotected
function getExamplesMessages() {
+ return
[
'action=unblock&id=105'
=> 'apihelp-unblock-example-id',
'action=unblock&user=Bob&reason=Sorry%20Bob'
=> 'apihelp-unblock-example-user',
'action=unblock&id=105'
=> 'apihelp-unblock-example-id',
'action=unblock&user=Bob&reason=Sorry%20Bob'
=> 'apihelp-unblock-example-user',
-
)
;
+
]
;
}
public function getHelpUrls() {
}
public function getHelpUrls() {