X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBlock.php;h=c67281736c2565cca7da7e5bb0e52c6908ed1650;hb=145f1c1bb4dfa6e173bdd5dcbabfedbe91722daf;hp=a4269d18507a3d25f8e8809a34047e926e98b6c8;hpb=bd95dc1d5c345ed94fac17dc060e0432a5912c8c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index a4269d1850..c67281736c 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -105,7 +105,7 @@ class SpecialBlock extends FormSpecialPage { # 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', @@ -220,7 +220,7 @@ class SpecialBlock extends FormSpecialPage { $this->maybeAlterFormDefaults( $a ); // Allow extensions to add more fields - wfRunHooks( 'SpecialBlockModifyFormFields', array( $this, &$a ) ); + Hooks::run( 'SpecialBlockModifyFormFields', array( $this, &$a ) ); return $a; } @@ -236,6 +236,14 @@ class SpecialBlock extends FormSpecialPage { # 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; @@ -317,7 +325,7 @@ class SpecialBlock extends FormSpecialPage { $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( @@ -626,7 +634,7 @@ class SpecialBlock extends FormSpecialPage { # 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'] ) @@ -701,7 +709,7 @@ class SpecialBlock extends FormSpecialPage { $block->mHideName = $data['HideUser']; $reason = array( 'hookaborted' ); - if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) { + if ( !Hooks::run( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) { return $reason; } @@ -762,7 +770,7 @@ class SpecialBlock extends FormSpecialPage { $logaction = 'block'; } - wfRunHooks( 'BlockIpComplete', array( $block, $performer ) ); + Hooks::run( 'BlockIpComplete', array( $block, $performer ) ); # Set *_deleted fields if requested if ( $data['HideUser'] ) { @@ -784,22 +792,21 @@ class SpecialBlock extends FormSpecialPage { # 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; @@ -829,7 +836,7 @@ class SpecialBlock extends FormSpecialPage { } list( $show, $value ) = explode( ':', $option ); - $a[htmlspecialchars( $show )] = htmlspecialchars( $value ); + $a[$show] = $value; } return $a;