public function __construct() {
parent::__construct( 'Block', 'block' );
public function __construct() {
parent::__construct( 'Block', 'block' );
'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother',
'label-message' => 'ipbexpiry',
'required' => true,
'options' => $suggestedDurations,
'other' => $this->msg( 'ipbother' )->text(),
'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother',
'label-message' => 'ipbexpiry',
'required' => true,
'options' => $suggestedDurations,
'other' => $this->msg( 'ipbother' )->text(),
'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
'type' => 'selectandother',
'maxlength' => 255,
'label-message' => 'ipbreason',
'options-message' => 'ipbreason-dropdown',
'type' => 'selectandother',
'maxlength' => 255,
'label-message' => 'ipbreason',
'options-message' => 'ipbreason-dropdown',
# Allow some users to hide name from block log, blocklist and listusers
if ( $user->isAllowed( 'hideuser' ) ) {
# Allow some users to hide name from block log, blocklist and listusers
if ( $user->isAllowed( 'hideuser' ) ) {
'type' => 'check',
'label-message' => 'ipbhidename',
'cssclass' => 'mw-block-hideuser',
'type' => 'check',
'label-message' => 'ipbhidename',
'cssclass' => 'mw-block-hideuser',
# This is basically a copy of the Target field, but the user can't change it, so we
# can see if the warnings we maybe showed to the user before still apply
# This is basically a copy of the Target field, but the user can't change it, so we
# can see if the warnings we maybe showed to the user before still apply
}
# We always need confirmation to do HideUser
if ( $this->requestedHideUser ) {
$fields['Confirm']['type'] = 'check';
unset( $fields['Confirm']['default'] );
}
# We always need confirmation to do HideUser
if ( $this->requestedHideUser ) {
$fields['Confirm']['type'] = 'check';
unset( $fields['Confirm']['default'] );
}
# Or if the user is trying to block themselves
if ( (string)$this->target === $this->getUser()->getName() ) {
$fields['Confirm']['type'] = 'check';
unset( $fields['Confirm']['default'] );
}
# Or if the user is trying to block themselves
if ( (string)$this->target === $this->getUser()->getName() ) {
$fields['Confirm']['type'] = 'check';
unset( $fields['Confirm']['default'] );
$blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' );
$text = $this->msg( 'blockiptext', $blockCIDRLimit['IPv4'], $blockCIDRLimit['IPv6'] )->parse();
$blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' );
$text = $this->msg( 'blockiptext', $blockCIDRLimit['IPv4'], $blockCIDRLimit['IPv6'] )->parse();
$this->msg( 'ipb-otherblocks-header', count( $otherBlockMessages ) )->parse()
) . "\n";
$list = '';
foreach ( $otherBlockMessages as $link ) {
$this->msg( 'ipb-otherblocks-header', count( $otherBlockMessages ) )->parse()
) . "\n";
$list = '';
foreach ( $otherBlockMessages as $link ) {
$links[] = Linker::linkKnown(
$this->msg( 'ipbreason-dropdown' )->inContentLanguage()->getTitle(),
$this->msg( 'ipb-edit-dropdown' )->escaped(),
$links[] = Linker::linkKnown(
$this->msg( 'ipbreason-dropdown' )->inContentLanguage()->getTitle(),
$this->msg( 'ipb-edit-dropdown' )->escaped(),
- 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
- 'msgKey' => array( 'blocklog-showsuppresslog', $userTitle->getText() ),
+ 'conds' => [ 'log_action' => [ 'block', 'reblock', 'unblock' ] ],
+ 'msgKey' => [ 'blocklog-showsuppresslog', $userTitle->getText() ],
- $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
+ $data['Confirm'] = !in_array( $data['Confirm'], [ '', '0', null, false ], true );
if ( $target === $performer->getName() &&
( $data['PreviousTarget'] !== $target || !$data['Confirm'] )
) {
if ( $target === $performer->getName() &&
( $data['PreviousTarget'] !== $target || !$data['Confirm'] )
) {
}
// an expiry time should be in the future, not in the
// past (wouldn't make any sense) - bug T123069
if ( $expiryTime < wfTimestampNow() ) {
}
// an expiry time should be in the future, not in the
// past (wouldn't make any sense) - bug T123069
if ( $expiryTime < wfTimestampNow() ) {
# or by race conditions (user has hideuser and block rights, loads block form,
# and loses hideuser rights before submission); so need to fail completely
# rather than just silently disable hiding
# or by race conditions (user has hideuser and block rights, loads block form,
# and loses hideuser rights before submission); so need to fail completely
# rather than just silently disable hiding
$data['HideUser'] = false; # IP users should not be hidden
} elseif ( !wfIsInfinity( $data['Expiry'] ) ) {
# Bad expiry.
$data['HideUser'] = false; # IP users should not be hidden
} elseif ( !wfIsInfinity( $data['Expiry'] ) ) {
# Bad expiry.
} elseif ( $wgHideUserContribLimit !== false
&& $user->getEditCount() > $wgHideUserContribLimit
) {
# Typically, the user should have a handful of edits.
# Disallow hiding users with many edits for performance.
} elseif ( $wgHideUserContribLimit !== false
&& $user->getEditCount() > $wgHideUserContribLimit
) {
# Typically, the user should have a handful of edits.
# Disallow hiding users with many edits for performance.
- return array( array( 'ipb_hide_invalid',
- Message::numParam( $wgHideUserContribLimit ) ) );
+ return [ [ 'ipb_hide_invalid',
+ Message::numParam( $wgHideUserContribLimit ) ] ];
- $reason = array( 'hookaborted' );
- if ( !Hooks::run( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
+ $reason = [ 'hookaborted' ];
+ if ( !Hooks::run( 'BlockIp', [ &$block, &$performer, &$reason ] ) ) {
# Show form unless the user is already aware of this...
if ( $blockNotConfirmed || $reblockNotAllowed ) {
# Show form unless the user is already aware of this...
if ( $blockNotConfirmed || $reblockNotAllowed ) {
# Otherwise, try to update the block...
} else {
# This returns direct blocks before autoblocks/rangeblocks, since we should
# Otherwise, try to update the block...
} else {
# This returns direct blocks before autoblocks/rangeblocks, since we should
}
# If the name was hidden and the blocking user cannot hide
# names, then don't allow any block changes...
if ( $currentBlock->mHideName && !$performer->isAllowed( 'hideuser' ) ) {
}
# If the name was hidden and the blocking user cannot hide
# names, then don't allow any block changes...
if ( $currentBlock->mHideName && !$performer->isAllowed( 'hideuser' ) ) {
$logParams['5::duration'] = $data['Expiry'];
$logParams['6::flags'] = self::blockLogFlags( $data, $type );
$logParams['5::duration'] = $data['Expiry'];
$logParams['6::flags'] = self::blockLogFlags( $data, $type );
$logEntry->setPerformer( $performer );
$logEntry->setParameters( $logParams );
# Relate log ID to block IDs (bug 25763)
$logEntry->setPerformer( $performer );
$logEntry->setParameters( $logParams );
# Relate log ID to block IDs (bug 25763)
- $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
- $logEntry->setRelations( array( 'ipb_id' => $blockIds ) );
+ $blockIds = array_merge( [ $status['id'] ], $status['autoIds'] );
+ $logEntry->setRelations( [ 'ipb_id' => $blockIds ] );
$msg = $lang === null
? wfMessage( 'ipboptions' )->inContentLanguage()->text()
: wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
if ( $msg == '-' ) {
$msg = $lang === null
? wfMessage( 'ipboptions' )->inContentLanguage()->text()
: wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
if ( $msg == '-' ) {
*/
protected static function blockLogFlags( array $data, $type ) {
global $wgBlockAllowsUTEdit;
*/
protected static function blockLogFlags( array $data, $type ) {
global $wgBlockAllowsUTEdit;
# when blocking a user the option 'anononly' is not available/has no effect
# -> do not write this into log
# when blocking a user the option 'anononly' is not available/has no effect
# -> do not write this into log
}
// Autocomplete subpage as user list - public to allow caching
return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
}
// Autocomplete subpage as user list - public to allow caching
return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );