48 parent::__construct(
'Unblock',
'block' );
61 $this->target = $this->getTargetFromRequest( $par, $this->
getRequest() );
68 if ( $this->target ===
null ) {
78 $this->block = $this->blockStore->newFromTarget( $this->target );
82 $this->
getSkin()->setRelevantUser( $this->target->getUserIdentity() );
90 $out->setPageTitleMsg( $this->
msg(
'unblock-target' ) );
91 $out->addModules( [
'mediawiki.userSuggest',
'mediawiki.special.block' ] );
94 ->setWrapperLegendMsg(
'unblock-target' )
95 ->setSubmitCallback(
function ( array $data,
HTMLForm $form ) {
97 $this->watchlistManager->addWatchIgnoringRights(
99 Title::newFromPageReference( $this->target->getUserPage() )
102 $status = $this->unblockUserFactory->newUnblockUser(
109 if ( $status->hasMessage(
'ipb_cant_unblock_multiple_blocks' ) ) {
111 $status->error(
'unblock-error-multiblocks', $this->target->toString() );
115 ->setSubmitTextMsg(
'ipusubmit' )
116 ->addPreHtml( $this->
msg(
'unblockiptext' )->parseAsBlock() );
118 if ( $this->target ) {
119 $userPage = $this->target->getLogPage();
120 $targetName = (string)$this->target;
123 LogEventsList::showLogExtract(
131 'unblocklog-showlog',
134 'showIfEmpty' =>
false
137 if ( $logExtract !==
'' ) {
142 if ( $this->
getAuthority()->isAllowed(
'suppressionlog' ) ) {
144 LogEventsList::showLogExtract(
151 'conds' => [
'log_action' => [
'block',
'reblock',
'unblock' ] ],
153 'unblocklog-showsuppresslog',
156 'showIfEmpty' =>
false
159 if ( $logExtract !==
'' ) {
165 if ( $form->
show() ) {
167 Block::TYPE_IP =>
'unblocked-ip',
168 Block::TYPE_USER =>
'unblocked',
169 Block::TYPE_RANGE =>
'unblocked-range',
170 Block::TYPE_AUTO =>
'unblocked-id'
173 $msgsByType[$this->target->getType()],
188 private function getTargetFromRequest( ?
string $par,
WebRequest $request ) {
190 $request->
getVal(
'wpTarget',
null ),
192 $request->
getVal(
'ip',
null ),
194 $request->
getVal(
'wpBlockAddress',
null ),
196 foreach ( $possibleTargets as $possibleTarget ) {
197 $target = $this->blockTargetFactory->newFromString( $possibleTarget );
210 'label-message' =>
'unblock-target-label',
214 'cssclass' =>
'mw-autocomplete-user',
218 'label-message' =>
'unblock-target-label',
222 'label-message' =>
'ipbreason',
226 if ( $this->block instanceof
Block ) {
227 $type = $this->block->getType();
228 $targetName = $this->block->getTargetName();
234 if ( $type == Block::TYPE_AUTO && $this->target->getType() == Block::TYPE_IP ) {
235 $fields[
'Target'][
'default'] = (string)$this->target;
236 unset( $fields[
'Name'] );
238 $fields[
'Target'][
'default'] = $targetName;
239 $fields[
'Target'][
'type'] =
'hidden';
246 $fields[
'Name'][
'raw'] =
true;
248 case Block::TYPE_USER:
253 $fields[
'Name'][
'raw'] =
true;
256 case Block::TYPE_RANGE:
257 $fields[
'Name'][
'default'] = $targetName;
260 case Block::TYPE_AUTO:
262 $fields[
'Name'][
'default'] = $this->block->getRedactedName();
263 $fields[
'Name'][
'raw'] =
true;
264 $fields[
'Target'][
'default'] = $this->block->getRedactedTarget()->toString();
268 $fields[
'Target'][
'autofocus'] =
false;
269 $fields[
'Reason'][
'autofocus'] =
true;
273 unset( $fields[
'Name'] );
276 if ( $this->
getUser()->isRegistered() ) {
279 'label-message' =>
'ipbwatchuser',
295 $search = $this->userNameUtils->getCanonical( $search );
301 return $this->userNamePrefixSearch
315class_alias( SpecialUnblock::class,
'SpecialUnblock' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getContext()
Get the base IContextSource object.
A class containing constants representing the names of configuration variables.
const UseCodexSpecialBlock
Name constant for the UseCodexSpecialBlock setting, for use with Config::get()
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getSkin()
Shortcut to get the skin being used for this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getUser()
Shortcut to get the User executing this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getAuthority()
Shortcut to get the Authority executing this instance.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Shared interface for user and single IP targets, that is, for targets with a meaningful user page lin...