# Don't need to do anything if the form has been posted
if ( !$this->getRequest()->wasPosted() && $this->preErrors ) {
- $s = HTMLForm::formatErrors( $this->preErrors );
+ $s = $form->formatErrors( $this->preErrors );
if ( $s ) {
$form->addHeaderText( Html::rawElement(
'div',
'autofocus' => true,
'required' => true,
'validation-callback' => array( __CLASS__, 'validateTargetField' ),
+ 'cssclass' => 'mw-autocomplete-user', // used by mediawiki.userSuggest
),
'Expiry' => array(
'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother',
$this->maybeAlterFormDefaults( $a );
// Allow extensions to add more fields
- wfRunHooks( 'SpecialBlockModifyFormFields', array( $this, &$a ) );
+ Hooks::run( 'SpecialBlockModifyFormFields', array( $this, &$a ) );
return $a;
}
# This will be overwritten by request data
$fields['Target']['default'] = (string)$this->target;
+ if ( $this->target ) {
+ $status = self::validateTarget( $this->target, $this->getUser() );
+ if ( !$status->isOK() ) {
+ $errors = $status->getErrorsArray();
+ $this->preErrors = array_merge( $this->preErrors, $errors );
+ }
+ }
+
# This won't be
$fields['PreviousTarget']['default'] = (string)$this->target;
* @return string
*/
protected function preText() {
- $this->getOutput()->addModules( 'mediawiki.special.block' );
+ $this->getOutput()->addModules( array( 'mediawiki.special.block', 'mediawiki.userSuggest' ) );
$text = $this->msg( 'blockiptext' )->parse();
$otherBlockMessages = array();
if ( $this->target !== null ) {
# Get other blocks, i.e. from GlobalBlocking or TorBlock extension
- wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) );
+ Hooks::run( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) );
if ( count( $otherBlockMessages ) ) {
$s = Html::rawElement(
# permission anyway, although the code does allow for it.
# Note: Important to use $target instead of $data['Target']
# since both $data['PreviousTarget'] and $target are normalized
- # but $data['target'] gets overriden by (non-normalized) request variable
+ # but $data['target'] gets overridden by (non-normalized) request variable
# from previous request.
if ( $target === $performer->getName() &&
( $data['PreviousTarget'] !== $target || !$data['Confirm'] )
$block->mHideName = $data['HideUser'];
$reason = array( 'hookaborted' );
- if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
+ if ( !Hooks::run( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
return $reason;
}
$logaction = 'block';
}
- wfRunHooks( 'BlockIpComplete', array( $block, $performer ) );
+ Hooks::run( 'BlockIpComplete', array( $block, $performer ) );
# Set *_deleted fields if requested
if ( $data['HideUser'] ) {
# Prepare log parameters
$logParams = array();
- $logParams[] = $data['Expiry'];
- $logParams[] = self::blockLogFlags( $data, $type );
+ $logParams['5::duration'] = $data['Expiry'];
+ $logParams['6::flags'] = self::blockLogFlags( $data, $type );
# Make log entry, if the name is hidden, put it in the oversight log
$log_type = $data['HideUser'] ? 'suppress' : 'block';
- $log = new LogPage( $log_type );
- $log_id = $log->addEntry(
- $logaction,
- Title::makeTitle( NS_USER, $target ),
- $data['Reason'][0],
- $logParams,
- $performer
- );
+ $logEntry = new ManualLogEntry( $log_type, $logaction );
+ $logEntry->setTarget( Title::makeTitle( NS_USER, $target ) );
+ $logEntry->setComment( $data['Reason'][0] );
+ $logEntry->setPerformer( $performer );
+ $logEntry->setParameters( $logParams );
# Relate log ID to block IDs (bug 25763)
$blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
- $log->addRelations( 'ipb_id', $blockIds, $log_id );
+ $logEntry->setRelations( array( 'ipb_id' => $blockIds ) );
+ $logId = $logEntry->insert();
+ $logEntry->publish( $logId );
# Report to the user
return true;
}
list( $show, $value ) = explode( ':', $option );
- $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
+ $a[$show] = $value;
}
return $a;