Exemplo n.º 1
0
 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  * @return bool|null
  */
 public function execute($par)
 {
     global $wgExtensionAssetsPath;
     $out = $this->getOutput();
     // Add CSS
     if (defined('MW_SUPPORTS_RESOURCE_MODULES')) {
         $out->addModuleStyles('ext.video');
     } else {
         $out->addExtensionStyle($wgExtensionAssetsPath . '/Video/Video.css');
     }
     // If the user doesn't have the required 'addvideo' permission, display an error
     if (!$this->userCanExecute($this->getUser())) {
         $this->displayRestrictionError();
         return;
     }
     // Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         throw new ReadOnlyError();
     }
     // If user is blocked, s/he doesn't need to access this page
     if ($this->getUser()->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     $this->setHeaders();
     $form = new HTMLForm($this->getFormFields(), $this->getContext());
     $form->setIntro(wfMsgExt('video-addvideo-instructions', 'parse'));
     $form->setWrapperLegend(wfMsg('video-addvideo-title'));
     $form->setSubmitText(wfMsg('video-addvideo-button'));
     $form->setSubmitCallback(array($this, 'submit'));
     if ($this->getRequest()->getCheck('forReUpload')) {
         $form->addHiddenField('forReUpload', true);
     }
     $form->show();
 }
Exemplo n.º 2
0
 public function execute($par)
 {
     $this->checkPermissions();
     $this->checkReadOnly();
     list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $this->getRequest());
     $this->block = Block::newFromTarget($this->target);
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('unblockip'));
     $out->addModules('mediawiki.special');
     $form = new HTMLForm($this->getFields(), $this->getContext());
     $form->setWrapperLegend(wfMsg('unblockip'));
     $form->setSubmitCallback(array(__CLASS__, 'processUIUnblock'));
     $form->setSubmitText(wfMsg('ipusubmit'));
     $form->addPreText(wfMsgExt('unblockiptext', 'parse'));
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_USER:
             case Block::TYPE_IP:
                 $out->addWikiMsg('unblocked', $this->target);
                 break;
             case Block::TYPE_RANGE:
                 $out->addWikiMsg('unblocked-range', $this->target);
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $out->addWikiMsg('unblocked-id', $this->target);
                 break;
         }
     }
 }
 /**
  * @return void
  */
 function listDomains()
 {
     $this->setHeaders();
     $this->getOutput()->setPagetitle($this->msg('openstackmanager-domainlist'));
     $this->getOutput()->addModuleStyles('ext.openstack');
     $domainInfo = array();
     $domainInfo['domainname'] = array('type' => 'text', 'label-message' => 'openstackmanager-domainname', 'default' => '', 'section' => 'domain', 'name' => 'domainname');
     $domainInfo['fqdn'] = array('type' => 'text', 'label-message' => 'openstackmanager-fqdn', 'default' => '', 'section' => 'domain', 'name' => 'fqdn');
     $domainInfo['location'] = array('type' => 'text', 'label-message' => 'openstackmanager-location', 'default' => '', 'section' => 'domain', 'help-message' => 'openstackmanager-location-help', 'name' => 'location');
     $domainInfo['action'] = array('type' => 'hidden', 'default' => 'create', 'name' => 'action');
     $domainForm = new HTMLForm($domainInfo, $this->getContext(), 'openstackmanager-novadomain');
     $domainForm->setSubmitID('novadomain-form-createdomainsubmit');
     $domainForm->setSubmitCallback(array($this, 'tryCreateSubmit'));
     $domainForm->show();
     $headers = array('openstackmanager-domainname', 'openstackmanager-fqdn', 'openstackmanager-location', 'openstackmanager-actions');
     $domains = OpenStackNovaDomain::getAllDomains();
     $domainRows = array();
     foreach ($domains as $domain) {
         $domainRow = array();
         $domainName = $domain->getDomainName();
         $this->pushResourceColumn($domainRow, $domainName);
         $this->pushResourceColumn($domainRow, $domain->getFullyQualifiedDomainName());
         $this->pushResourceColumn($domainRow, $domain->getLocation());
         $this->pushRawResourceColumn($domainRow, $this->createActionLink('openstackmanager-delete', array('action' => 'delete', 'domainname' => $domainName)));
         $domainRows[] = $domainRow;
     }
     if ($domainRows) {
         $out = $this->createResourceTable($headers, $domainRows);
     } else {
         $out = '';
     }
     $this->getOutput()->addHTML($out);
 }
 public function show($par)
 {
     $formFields = array('account' => array('type' => 'text', 'validation-callback' => array(__CLASS__, 'validateUser'), 'label-message' => 'disableaccount-user'), 'confirm' => array('type' => 'toggle', 'validation-callback' => array(__CLASS__, 'checkConfirmation'), 'label-message' => 'disableaccount-confirm'));
     $htmlForm = new HTMLForm($formFields, 'disableaccount');
     $htmlForm->setSubmitCallback(array(__CLASS__, 'submit'));
     $htmlForm->setTitle($this->getTitle());
     $htmlForm->show();
 }
 function execute($par)
 {
     global $wgOut, $wgUser, $wgEmailAuthentication;
     $this->setHeaders();
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     $error = SpecialEmailUser::getPermissionsError($wgUser, $wgUser->editToken());
     if ($error) {
         switch ($error) {
             case 'blockedemailuser':
                 $wgOut->blockedPage();
                 return;
             case 'actionthrottledtext':
                 $wgOut->rateLimited();
                 return;
             case 'mailnologin':
                 $wgOut->showErrorPage('mailnologin', 'mailnologintext');
                 return;
             default:
                 list($title, $msg, $params) = $error;
                 $wgOut->showErrorPage($title, $msg, $params);
                 return;
         }
     }
     $dbr = wfGetDB(DB_SLAVE);
     # $conds can be not that strict but cannot be too strict.
     $conds = array("user_email <> ''");
     if ($wgEmailAuthentication) {
         $conds[] = 'user_email_authenticated IS NOT NULL';
     }
     $res = $dbr->select('user', '*', $conds);
     $users = UserArray::newFromResult($res);
     $usernames = array();
     foreach ($users as $user) {
         if ($user->canReceiveEmail() && $user->getId() != $wgUser->getId()) {
             $usernames[$user->getName()] = $user->getId();
         }
     }
     $this->userIds = array_values($usernames);
     if (empty($usernames)) {
         # No one to send mail to
         $wgOut->addWikiMsg('emailusers-norecipient');
         $wgOut->returnToMain();
         return;
     }
     $form = array('target' => array('type' => 'multiselect', 'label-message' => 'emailto', 'options' => $usernames, 'validation-callback' => array($this, 'validateTarget')), 'target-reverse' => array('type' => 'check', 'default' => true, 'label-message' => 'emailusers-target-reverse'), 'subject' => array('type' => 'text', 'default' => wfMsg('defemailsubject'), 'label-message' => 'emailsubject'), 'text' => array('type' => 'textarea', 'label-message' => 'emailmessage'), 'ccme' => array('type' => 'check', 'default' => $wgUser->getOption('ccmeonemails'), 'label-message' => 'emailccme'));
     $htmlForm = new HTMLForm($form);
     $htmlForm->setTitle($this->getTitle($par));
     $htmlForm->setSubmitCallback(array($this, 'submit'));
     $this->outputHeader();
     if ($htmlForm->show()) {
         $wgOut->addWikiMsg('emailsenttext');
         $htmlForm->displayForm(false);
     }
 }
Exemplo n.º 6
0
 private function showResetForm()
 {
     $this->getOutput()->addWikiMsg('prefs-reset-intro');
     $htmlForm = new HTMLForm(array(), $this->getContext(), 'prefs-restore');
     $htmlForm->setSubmitText(wfMsg('restoreprefs'));
     $htmlForm->setTitle($this->getTitle('reset'));
     $htmlForm->setSubmitCallback(array($this, 'submitReset'));
     $htmlForm->suppressReset();
     $htmlForm->show();
 }
Exemplo n.º 7
0
 public function execute($par)
 {
     $this->checkPermissions();
     $this->setHeaders();
     $form = new HTMLForm(array('dbname' => array('default' => $par, 'filter-callback' => array('SpecialCreateWiki', 'filter'), 'label-message' => 'createwiki-label-dbname', 'maxlength' => 30, 'required' => true, 'size' => 30, 'type' => 'text', 'validation-callback' => array('SpecialCreateWiki', 'validateDBname')), 'founder' => array('filter-callback' => array('SpecialCreateWiki', 'filter'), 'label-message' => 'createwiki-label-founder', 'required' => true, 'size' => 30, 'type' => 'text', 'validation-callback' => array('SpecialCreateWiki', 'validateFounder')), 'comment' => array('label-message' => 'createwiki-label-comment', 'maxlength' => 79, 'size' => 79, 'type' => 'text')));
     $form->setSubmitTextMsg('createwiki-label-create');
     $form->setTitle($this->getPageTitle());
     $form->setSubmitCallback(array('SpecialCreateWiki', 'processInput'));
     $form->show();
 }
 function execute($par)
 {
     global $wgRequest;
     $this->setHeaders();
     $form = new HTMLForm(array('TitleText' => array('type' => 'text', 'label-message' => 'luafoo-convert-title')));
     $form->setSubmitText(wfMsg('luafoo-convert-submit'));
     $form->setSubmitCallback(array($this, 'showTranslation'));
     $form->setTitle($this->getTitle());
     $form->show();
 }
Exemplo n.º 9
0
 function showResetForm()
 {
     global $wgOut;
     $wgOut->addWikiMsg('prefs-reset-intro');
     $htmlForm = new HTMLForm(array(), 'prefs-restore');
     $htmlForm->setSubmitText(wfMsg('restoreprefs'));
     $htmlForm->setTitle($this->getTitle('reset'));
     $htmlForm->setSubmitCallback(array(__CLASS__, 'submitReset'));
     $htmlForm->suppressReset();
     $htmlForm->show();
 }
Exemplo n.º 10
0
 function showResetForm()
 {
     $this->getOutput()->addWikiMsg('prefs-reset-intro');
     $htmlForm = new HTMLForm(array(), $this->getContext(), 'prefs-restore');
     $htmlForm->setSubmitText(wfMsg('restoreprefs'));
     $htmlForm->addHiddenField('username', $this->target);
     $htmlForm->addHiddenField('reset', '1');
     $htmlForm->setSubmitCallback(array($this, 'submitReset'));
     $htmlForm->suppressReset();
     $htmlForm->show();
 }
 function execute($par)
 {
     global $wgOut;
     $wgOut->setPageTitle(wfMsg('communityhiring-header'));
     $formDescriptor = array('about-intro' => array('type' => 'info', 'default' => wfMsgExt('communityhiring-about-intro', 'parse'), 'raw' => 1, 'section' => 'aboutyou'), 'given-name' => array('type' => 'text', 'label-message' => 'communityhiring-given', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'family-name' => array('type' => 'text', 'label-message' => 'communityhiring-family', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'address-line1' => array('type' => 'textarea', 'label-message' => 'communityhiring-address', 'section' => 'aboutyou', 'rows' => '3', 'cols' => '20'), 'address-city' => array('type' => 'text', 'label-message' => 'communityhiring-address-city', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'address-postal' => array('type' => 'text', 'label-message' => 'communityhiring-address-postal', 'section' => 'aboutyou'), 'address-country' => array('type' => 'text', 'label-message' => 'communityhiring-address-country', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'phone' => array('type' => 'text', 'label-message' => 'communityhiring-phone', 'section' => 'aboutyou'), 'email' => array('type' => 'text', 'label-message' => 'communityhiring-email', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'paragraph-intro' => array('type' => 'info', 'default' => wfMsgExt('communityhiring-paragraphs-intro', 'parse'), 'raw' => 1, 'section' => 'paragraphs', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'significance' => array('type' => 'textarea', 'label-message' => 'communityhiring-significance', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'excitement' => array('type' => 'textarea', 'label-message' => 'communityhiring-excitement', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'experiences' => array('type' => 'textarea', 'label-message' => 'communityhiring-experiences', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'other' => array('type' => 'textarea', 'label-message' => 'communityhiring-other', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1), 'languages' => array('type' => 'textarea', 'options' => array_flip(Language::getLanguageNames()), 'section' => 'demonstrative/languages', 'rows' => '3', 'label-message' => 'communityhiring-languages-label', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'contributor' => array('type' => 'radio', 'label-message' => 'communityhiring-contributor', 'section' => 'demonstrative/involvement', 'options' => array('Yes' => 'yes', 'No' => 'no')), 'usernames' => array('type' => 'textarea', 'rows' => '3', 'cols' => '20', 'label-message' => 'communityhiring-usernames', 'section' => 'demonstrative/involvement', 'vertical-label' => 1), 'wikimedia-links' => array('type' => 'textarea', 'label-message' => 'communityhiring-links', 'section' => 'demonstrative/involvement', 'rows' => '3', 'cols' => '20', 'vertical-label' => 1), 'other-links' => array('type' => 'textarea', 'label-message' => 'communityhiring-links-other', 'section' => 'demonstrative', 'rows' => '3', 'cols' => '20', 'vertical-label' => 1), 'availability-time' => array('type' => 'text', 'label-message' => 'communityhiring-availability-intro', 'section' => 'availability', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'availability-info' => array('type' => 'textarea', 'label-message' => 'communityhiring-availability-info', 'section' => 'availability', 'rows' => '5', 'cols' => '20', 'vertical-label' => 1), 'relocation' => array('type' => 'radio', 'label-message' => 'communityhiring-relocation-ok', 'section' => 'availability', 'vertical-label' => 1, 'options' => array('Yes' => 'yes', 'No' => 'no', 'It would be hard, but maybe I would' => 'maybe')), 'research' => array('type' => 'textarea', 'rows' => '5', 'label-message' => 'communityhiring-research', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')));
     $form = new HTMLForm($formDescriptor, 'communityhiring');
     $form->setIntro(wfMsgExt('communityhiring-intro', 'parse'));
     $form->setSubmitCallback(array($this, 'submit'));
     $form->setTitle($this->getTitle());
     $form->show();
 }
Exemplo n.º 12
0
 private function showResetForm()
 {
     if (!$this->getUser()->isAllowed('editmyoptions')) {
         throw new PermissionsError('editmyoptions');
     }
     $this->getOutput()->addWikiMsg('prefs-reset-intro');
     $context = new DerivativeContext($this->getContext());
     $context->setTitle($this->getPageTitle('reset'));
     // Reset subpage
     $htmlForm = new HTMLForm(array(), $context, 'prefs-restore');
     $htmlForm->setSubmitTextMsg('restoreprefs');
     $htmlForm->setSubmitCallback(array($this, 'submitReset'));
     $htmlForm->suppressReset();
     $htmlForm->show();
 }
Exemplo n.º 13
0
 public function execute($par)
 {
     global $wgUser, $wgOut, $wgRequest;
     # Check permissions
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     # Check for database lock
     if (wfReadOnly()) {
         throw new ReadOnlyError();
     }
     list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $wgRequest);
     $this->block = Block::newFromTarget($this->target);
     # bug 15810: blocked admins should have limited access here.  This won't allow sysops
     # to remove autoblocks on themselves, but they should have ipblock-exempt anyway
     $status = SpecialBlock::checkUnblockSelf($this->target);
     if ($status !== true) {
         throw new ErrorPageError('badaccess', $status);
     }
     $wgOut->setPageTitle(wfMsg('unblockip'));
     $wgOut->addModules('mediawiki.special');
     $form = new HTMLForm($this->getFields(), $this->getContext());
     $form->setWrapperLegend(wfMsg('unblockip'));
     $form->setSubmitCallback(array(__CLASS__, 'processUnblock'));
     $form->setSubmitText(wfMsg('ipusubmit'));
     $form->addPreText(wfMsgExt('unblockiptext', 'parse'));
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_USER:
             case Block::TYPE_IP:
                 $wgOut->addWikiMsg('unblocked', $this->target);
                 break;
             case Block::TYPE_RANGE:
                 $wgOut->addWikiMsg('unblocked-range', $this->target);
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $wgOut->addWikiMsg('unblocked-id', $this->target);
                 break;
         }
     }
 }
Exemplo n.º 14
0
 public function execute($par)
 {
     $this->checkPermissions();
     $this->checkReadOnly();
     list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $this->getRequest());
     $this->block = Block::newFromTarget($this->target);
     if ($this->target instanceof User) {
         # Set the 'relevant user' in the skin, so it displays links like Contributions,
         # User logs, UserRights, etc.
         $this->getSkin()->setRelevantUser($this->target);
     }
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('unblockip'));
     $out->addModules(['mediawiki.special', 'mediawiki.userSuggest']);
     $form = new HTMLForm($this->getFields(), $this->getContext());
     $form->setWrapperLegendMsg('unblockip');
     $form->setSubmitCallback([__CLASS__, 'processUIUnblock']);
     $form->setSubmitTextMsg('ipusubmit');
     $form->addPreText($this->msg('unblockiptext')->parseAsBlock());
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_IP:
                 $out->addWikiMsg('unblocked-ip', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_USER:
                 $out->addWikiMsg('unblocked', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_RANGE:
                 $out->addWikiMsg('unblocked-range', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $out->addWikiMsg('unblocked-id', wfEscapeWikiText($this->target));
                 break;
         }
     }
 }
 /**
  * Show form if user wants to delete all data 
  */
 public function showDeletionForm()
 {
     $out = $this->out;
     $max_length = $this->max_string_formfield_length;
     $out->setPageTitle($out->msg('helperscripts'));
     $html = '';
     $html .= $this->getHTMLJavascriptLoader();
     $html .= "<div class='javascripthide'>";
     if (!empty($error_message)) {
         $html .= "<br>";
         $html .= "<div class = 'error'>{$error_message}</div>";
     }
     $html .= "</div>";
     $out->addHTML($html);
     $descriptor = array();
     $descriptor['phrase'] = array('label-message' => 'phrase-message', 'class' => 'HTMLTextField', 'type' => 'password', 'maxlength' => $max_length * 20);
     $html_form = new HTMLForm($descriptor, $out->getContext());
     $html_form->setSubmitText($out->msg('delete-submit'));
     $html_form->addHiddenField('phrase_posted', 'phrase_posted');
     $html_form->setSubmitCallback(array('SpecialHelperScripts', 'processInput'));
     return $html_form->show();
 }
Exemplo n.º 16
0
 public function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser;
     $this->setHeaders();
     $this->outputHeader();
     $this->mTarget = is_null($par) ? $wgRequest->getVal('wpTarget', $wgRequest->getVal('target', '')) : $par;
     $ret = self::getTarget($this->mTarget);
     if ($ret instanceof User) {
         $this->mTargetObj = $ret;
     } else {
         $wgOut->showErrorPage("{$ret}title", "{$ret}text");
         return false;
     }
     $error = self::getPermissionsError($wgUser, $wgRequest->getVal('wpEditToken'));
     switch ($error) {
         case null:
             # Wahey!
             break;
         case 'badaccess':
             $wgOut->permissionRequired('sendemail');
             return;
         case 'blockedemailuser':
             $wgOut->blockedPage();
             return;
         case 'actionthrottledtext':
             $wgOut->rateLimited();
             return;
         case 'mailnologin':
         case 'usermaildisabled':
             $wgOut->showErrorPage($error, "{$error}text");
             return;
         default:
             # It's a hook error
             list($title, $msg, $params) = $error;
             $wgOut->showErrorPage($title, $msg, $params);
             return;
     }
     $form = new HTMLForm($this->getFormFields());
     $form->addPreText(wfMsgExt('emailpagetext', 'parseinline'));
     $form->setSubmitText(wfMsg('emailsend'));
     $form->setTitle($this->getTitle());
     $form->setSubmitCallback(array(__CLASS__, 'submit'));
     $form->setWrapperLegend(wfMsgExt('email-legend', 'parsemag'));
     $form->loadData();
     if (!wfRunHooks('EmailUserForm', array(&$form))) {
         return false;
     }
     $wgOut->setPagetitle(wfMsg('emailpage'));
     $result = $form->show();
     if ($result === true || $result instanceof Status && $result->isGood()) {
         $wgOut->setPagetitle(wfMsg('emailsent'));
         $wgOut->addWikiMsg('emailsenttext');
         $wgOut->returnToMain(false, $this->mTargetObj->getUserPage());
     }
 }
 /**
  * Display the signup form for this contest.
  *
  * @since 0.1
  *
  * @param Contest $contest
  * @param integer|false $challengeId
  */
 protected function showSignupForm(Contest $contest, $challengeId = false)
 {
     $form = new HTMLForm($this->getFormFields($contest, $challengeId), $this->getContext());
     $form->setSubmitCallback(array($this, 'handleSubmission'));
     $form->setSubmitText(wfMsg('contest-signup-submit'));
     if ($form->show()) {
         $this->onSuccess($contest);
     } else {
         $this->getOutput()->addModules('contest.special.signup');
     }
     $this->getOutput()->addScript(Skin::makeVariablesScript(array('ContestConfig' => array('rules_page' => ContestUtils::getParsedArticleContent($contest->getField('rules_page'))))));
 }
Exemplo n.º 18
0
 public function execute($par)
 {
     $out = $this->getOutput();
     $out->addModuleStyles('mediawiki.special');
     $this->mTarget = is_null($par) ? $this->getRequest()->getVal('wpTarget', $this->getRequest()->getVal('target', '')) : $par;
     // This needs to be below assignment of $this->mTarget because
     // getDescription() needs it to determine the correct page title.
     $this->setHeaders();
     $this->outputHeader();
     // error out if sending user cannot do this
     $error = self::getPermissionsError($this->getUser(), $this->getRequest()->getVal('wpEditToken'), $this->getConfig());
     switch ($error) {
         case null:
             # Wahey!
             break;
         case 'badaccess':
             throw new PermissionsError('sendemail');
         case 'blockedemailuser':
             throw new UserBlockedError($this->getUser()->mBlock);
         case 'actionthrottledtext':
             throw new ThrottledError();
         case 'mailnologin':
         case 'usermaildisabled':
             throw new ErrorPageError($error, "{$error}text");
         default:
             # It's a hook error
             list($title, $msg, $params) = $error;
             throw new ErrorPageError($title, $msg, $params);
     }
     // Got a valid target user name? Else ask for one.
     $ret = self::getTarget($this->mTarget);
     if (!$ret instanceof User) {
         if ($this->mTarget != '') {
             // Messages used here: notargettext, noemailtext, nowikiemailtext
             $ret = $ret == 'notarget' ? 'emailnotarget' : $ret . 'text';
             $out->wrapWikiMsg("<p class='error'>\$1</p>", $ret);
         }
         $out->addHTML($this->userForm($this->mTarget));
         return;
     }
     $this->mTargetObj = $ret;
     $context = new DerivativeContext($this->getContext());
     $context->setTitle($this->getPageTitle());
     // Remove subpage
     $form = new HTMLForm($this->getFormFields(), $context);
     // By now we are supposed to be sure that $this->mTarget is a user name
     $form->addPreText($this->msg('emailpagetext', $this->mTarget)->parse());
     $form->setSubmitTextMsg('emailsend');
     $form->setSubmitCallback(array(__CLASS__, 'uiSubmit'));
     $form->setWrapperLegendMsg('email-legend');
     $form->loadData();
     if (!Hooks::run('EmailUserForm', array(&$form))) {
         return;
     }
     $result = $form->show();
     if ($result === true || $result instanceof Status && $result->isGood()) {
         $out->setPageTitle($this->msg('emailsent'));
         $out->addWikiMsg('emailsenttext', $this->mTarget);
         $out->returnToMain(false, $this->mTargetObj->getUserPage());
     }
 }
 /**
  * Constructs and show form 2
  */
 public function showForm2(array $collection_data, array $collection_name_data, RequestContext $context, $error_message = '')
 {
     global $wgArticleUrl;
     $article_url = $wgArticleUrl;
     $max_int_formfield_length = $this->max_int_formfield_length;
     $out = $this->out;
     $collection_data = $this->HTMLSpecialCharachtersArray($collection_data);
     $collection_name_data = $this->HTMLSpecialCharachtersArray($collection_name_data);
     $collections_message = implode(', ', $collection_name_data) . ".";
     $out->setPageTitle($out->msg('stylometricanalysis-options'));
     $html = "";
     $html .= $this->getHTMLJavascriptLoader();
     $html .= "<div class='javascripthide'>";
     $html .= "<a href='" . $article_url . "Special:StylometricAnalysis' class='link-transparent' title='Go Back'>Go Back</a>";
     $html .= "<br><br>";
     $html .= $out->msg('stylometricanalysis-chosencollections') . $collections_message . "<br>";
     $html .= $out->msg('stylometricanalysis-chosencollection2');
     $html .= "<br><br>";
     //display the error
     if (!empty($error_message)) {
         $html .= "<div class = 'error'>" . $error_message . "</div>";
     }
     $html .= "</div>";
     $out->addHTML($html);
     $descriptor = array();
     $descriptor['removenonalpha'] = array('label' => 'Remove non-alpha', 'class' => 'HTMLCheckField', 'section' => 'stylometricanalysis-section-import');
     $descriptor['lowercase'] = array('label' => 'Lowercase', 'class' => 'HTMLCheckField', 'section' => 'stylometricanalysis-section-import');
     $descriptor['tokenizer'] = array('label' => 'Tokenizer', 'class' => 'HTMLSelectField', 'options' => array('Whitespace' => 'whitespace', 'Words' => 'words'), 'default' => 'whitespace', 'section' => 'stylometricanalysis-section-preprocess');
     $descriptor['minimumsize'] = array('label' => 'Minimum Size', 'class' => 'HTMLTextField', 'default' => 0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
     $descriptor['maximumsize'] = array('label' => 'Maximum Size', 'class' => 'HTMLTextField', 'default' => 10000, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
     $descriptor['segmentsize'] = array('label' => 'Segment Size', 'class' => 'HTMLTextField', 'default' => 0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
     $descriptor['stepsize'] = array('label' => 'Step Size', 'class' => 'HTMLTextField', 'default' => 0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
     $descriptor['removepronouns'] = array('label' => 'Remove Pronouns', 'class' => 'HTMLCheckField', 'section' => 'stylometricanalysis-section-preprocess');
     $descriptor['vectorspace'] = array('label' => 'Vector Space', 'class' => 'HTMLSelectField', 'options' => array('tf' => 'tf', 'tf_scaled' => 'tf_scaled', 'tf_std' => 'tf_std', 'tf_idf' => 'tf_idf', 'bin' => 'bin'), 'default' => 'tf', 'section' => 'stylometricanalysis-section-feature');
     $descriptor['featuretype'] = array('label' => 'Feature Type', 'class' => 'HTMLSelectField', 'options' => array('word' => 'word', 'char' => 'char', 'char_wb' => 'char_wb'), 'default' => 'word', 'section' => 'stylometricanalysis-section-feature');
     $descriptor['ngramsize'] = array('label' => 'Ngram Size', 'class' => 'HTMLTextField', 'default' => 1, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
     $descriptor['mfi'] = array('label' => 'MFI', 'class' => 'HTMLTextField', 'default' => 100, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
     $descriptor['minimumdf'] = array('class' => 'HTMLTextField', 'label' => 'Minimum DF', 'default' => 0.0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
     $descriptor['maximumdf'] = array('class' => 'HTMLTextField', 'label' => 'Maximum DF', 'default' => 0.9, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
     $descriptor['visualization1'] = array('label' => 'Visualization1', 'class' => 'HTMLSelectField', 'options' => array('PCA Scatterplot' => 'pcascatterplot', 'TNSE Scatterplot' => 'tnsescatterplot', 'Distance Matrix Clustering' => 'distancematrix', 'Variability Based Neighbour Clustering' => 'neighbourclustering'), 'default' => 'pcascatterplot', 'section' => 'stylometricanalysis-section-visualization');
     $descriptor['visualization2'] = array('label' => 'Visualization2', 'class' => 'HTMLSelectField', 'options' => array('PCA Scatterplot' => 'pcascatterplot', 'TNSE Scatterplot' => 'tnsescatterplot', 'Distance Matrix Clustering' => 'distancematrix', 'Variability Based Neighbour Clustering' => 'neighbourclustering'), 'default' => 'pcascatterplot', 'section' => 'stylometricanalysis-section-visualization');
     $html_form = new HTMLForm($descriptor, $context);
     $html_form->setSubmitText($out->msg('stylometricanalysis-submit'));
     $html_form->addHiddenField('collection_data', json_encode($collection_data));
     $html_form->addHiddenField('form_2_posted', 'form_2_posted');
     $html_form->setSubmitCallback(array('SpecialStylometricAnalysis', 'callbackForm2'));
     $html_form->show();
     return true;
 }
Exemplo n.º 20
0
 /**
  * @param $id
  * @return mixed
  */
 function showHideForm($id)
 {
     if (!$this->getUser()->isAllowed('abusefilter-hide-log')) {
         $this->getOutput()->addWikiMsg('abusefilter-log-hide-forbidden');
         return;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $row = $dbr->selectRow(array('abuse_filter_log', 'abuse_filter'), '*', array('afl_id' => $id), __METHOD__, array(), array('abuse_filter' => array('LEFT JOIN', 'af_id=afl_filter')));
     if (!$row) {
         return;
     }
     $formInfo = array('logid' => array('type' => 'info', 'default' => $id, 'label-message' => 'abusefilter-log-hide-id'), 'reason' => array('type' => 'text', 'label-message' => 'abusefilter-log-hide-reason'), 'hidden' => array('type' => 'toggle', 'default' => $row->afl_deleted, 'label-message' => 'abusefilter-log-hide-hidden'));
     $form = new HTMLForm($formInfo, $this->getContext());
     $form->setTitle($this->getPageTitle());
     $form->setWrapperLegend($this->msg('abusefilter-log-hide-legend')->text());
     $form->addHiddenField('hide', $id);
     $form->setSubmitCallback(array($this, 'saveHideForm'));
     $form->show();
 }
Exemplo n.º 21
0
	/**
	 * Add the upload JS and show the form.
	 */
	public function show() {
		HTMLForm::show();
	}
Exemplo n.º 22
0
    /**
     * Add the upload JS and show the form.
     */
    public function show()
    {
        $this->addUploadJS();
        parent::show();
        // disable output - we'll print out the page manually,
        // taking the body created by the form, plus the necessary
        // Javascript files, and turning them into an HTML page
        global $wgTitle, $wgLanguageCode, $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgContLang;
        $out = $this->getOutput();
        $out->disable();
        $wgTitle = SpecialPage::getTitleFor('Upload');
        $out->addModules(array('mediawiki.action.edit', 'mediawiki.special.upload', 'mediawiki.legacy.upload'));
        $text = <<<END
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="{$wgXhtmlDefaultNamespace}"
END;
        foreach ($wgXhtmlNamespaces as $tag => $ns) {
            $text .= "xmlns:{$tag}=\"{$ns}\" ";
        }
        $dir = $wgContLang->isRTL() ? "rtl" : "ltr";
        $text .= "xml:lang=\"{$wgLanguageCode}\" lang=\"{$wgLanguageCode}\" dir=\"{$dir}\">";
        $text .= <<<END

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
{$out->getHeadScripts()}
</head>
<body>
{$out->getHTML()}
{$out->getBottomScripts()}
</body>
</html>


END;
        print $text;
    }
 /**
  * @return bool
  */
 function removeRule()
 {
     $this->setHeaders();
     $this->getOutput()->setPagetitle($this->msg('openstackmanager-removerule'));
     $project = $this->getRequest()->getText('project');
     $region = $this->getRequest()->getText('region');
     if (!$this->userLDAP->inRole('projectadmin', $project)) {
         $this->notInRole('projectadmin', $project);
         return false;
     }
     $groupid = $this->getRequest()->getText('groupid');
     $ruleid = $this->getRequest()->getText('ruleid');
     if (!$this->getRequest()->wasPosted()) {
         $securitygroup = $this->userNova->getSecurityGroup($groupid);
         if ($securitygroup) {
             $securitygroupname = $securitygroup->getGroupName();
             $this->getOutput()->addWikiMsg('openstackmanager-removerule-confirm', $securitygroupname);
         } else {
             $this->getOutput()->addWikiMsg('openstackmanager-nonexistantsecuritygroup');
             return false;
         }
     }
     $securityGroupInfo = array();
     $securityGroupInfo['groupid'] = array('type' => 'hidden', 'default' => $groupid, 'name' => 'groupid');
     $securityGroupInfo['ruleid'] = array('type' => 'hidden', 'default' => $ruleid, 'name' => 'ruleid');
     $securityGroupInfo['project'] = array('type' => 'hidden', 'default' => $project, 'name' => 'project');
     $securityGroupInfo['region'] = array('type' => 'hidden', 'default' => $region, 'name' => 'region');
     $securityGroupInfo['action'] = array('type' => 'hidden', 'default' => 'removerule', 'name' => 'action');
     $securityGroupForm = new HTMLForm($securityGroupInfo, $this->getContext(), 'openstackmanager-novasecuritygroup');
     $securityGroupForm->setSubmitID('novainstance-form-removerulesubmit');
     $securityGroupForm->setSubmitCallback(array($this, 'tryRemoveRuleSubmit'));
     $securityGroupForm->show();
     return true;
 }
Exemplo n.º 24
0
 protected function showActivateDeactivateForm($tag, $activate)
 {
     $actionStr = $activate ? 'activate' : 'deactivate';
     $user = $this->getUser();
     if (!$user->isAllowed('managechangetags')) {
         throw new PermissionsError('managechangetags');
     }
     $out = $this->getOutput();
     // tags-activate-title, tags-deactivate-title
     $out->setPageTitle($this->msg("tags-{$actionStr}-title"));
     $out->addBacklinkSubtitle($this->getPageTitle());
     // is it possible to do this?
     $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
     $result = ChangeTags::$func($tag, $user);
     if (!$result->isGood()) {
         $out->addWikiText("<div class=\"error\">\n" . $result->getWikiText() . "\n</div>");
         if (!$result->isOK()) {
             return;
         }
     }
     // tags-activate-question, tags-deactivate-question
     $preText = $this->msg("tags-{$actionStr}-question", $tag)->parseAsBlock();
     $fields = [];
     // tags-activate-reason, tags-deactivate-reason
     $fields['Reason'] = ['type' => 'text', 'label' => $this->msg("tags-{$actionStr}-reason")->plain(), 'size' => 50];
     $fields['HiddenTag'] = ['type' => 'hidden', 'name' => 'tag', 'default' => $tag, 'required' => true];
     $form = new HTMLForm($fields, $this->getContext());
     $form->setAction($this->getPageTitle($actionStr)->getLocalURL());
     $form->tagAction = $actionStr;
     $form->setSubmitCallback([$this, 'processTagForm']);
     // tags-activate-submit, tags-deactivate-submit
     $form->setSubmitTextMsg("tags-{$actionStr}-submit");
     $form->addPreText($preText);
     $form->show();
 }
 /**
  * Handle ?action=reboot
  * @return bool
  */
 function rebootInstance()
 {
     $this->setHeaders();
     $project = $this->getRequest()->getText('project');
     $region = $this->getRequest()->getText('region');
     if (!$this->userLDAP->inRole('projectadmin', $project)) {
         $this->notInRole('projectadmin', $project);
         return false;
     }
     $instanceosid = $this->getRequest()->getText('instanceid');
     if (!$this->getRequest()->wasPosted()) {
         # @todo memcache this instanceid lookup
         $instance = $this->userNova->getInstance($instanceosid);
         if (!$instance) {
             $this->getOutput()->addWikiMsg('openstackmanager-nonexistanthost');
             return false;
         }
         $this->getOutput()->addWikiMsg('openstackmanager-rebootinstancequestion', $instance->getInstanceId());
         $instanceid = $instance->getInstanceId();
         $instancename = $instance->getInstanceName();
         $this->getOutput()->setPagetitle($this->msg('openstackmanager-rebootinstancewithname', $instanceid, $instancename));
     } else {
         $this->getOutput()->setPagetitle($this->msg('openstackmanager-rebootinstance'));
     }
     $instanceInfo = array();
     $instanceInfo['instanceid'] = array('type' => 'hidden', 'default' => $instanceosid, 'name' => 'instanceid');
     $instanceInfo['project'] = array('type' => 'hidden', 'default' => $project, 'name' => 'project');
     $instanceInfo['region'] = array('type' => 'hidden', 'default' => $region, 'name' => 'region');
     $instanceInfo['action'] = array('type' => 'hidden', 'default' => 'reboot', 'name' => 'action');
     $instanceForm = new HTMLForm($instanceInfo, $this->getContext(), 'openstackmanager-novainstance');
     $instanceForm->setSubmitID('novainstance-form-deleteinstancesubmit');
     $instanceForm->setSubmitCallback(array($this, 'tryRebootSubmit'));
     $instanceForm->show();
     return true;
 }
Exemplo n.º 26
0
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->addModuleStyles('mediawiki.special');
     $this->mTarget = is_null($par) ? $this->getRequest()->getVal('wpTarget', $this->getRequest()->getVal('target', '')) : $par;
     // error out if sending user cannot do this
     $error = self::getPermissionsError($this->getUser(), $this->getRequest()->getVal('wpEditToken'));
     switch ($error) {
         case null:
             # Wahey!
             break;
         case 'badaccess':
             throw new PermissionsError('sendemail');
         case 'blockedemailuser':
             throw new UserBlockedError($this->getUser()->mBlock);
         case 'actionthrottledtext':
             throw new ThrottledError();
         case 'mailnologin':
         case 'usermaildisabled':
             throw new ErrorPageError($error, "{$error}text");
         default:
             # It's a hook error
             list($title, $msg, $params) = $error;
             throw new ErrorPageError($title, $msg, $params);
     }
     // Got a valid target user name? Else ask for one.
     $ret = self::getTarget($this->mTarget);
     if (!$ret instanceof User) {
         if ($this->mTarget != '') {
             $ret = $ret == 'notarget' ? 'emailnotarget' : $ret . 'text';
             $out->wrapWikiMsg("<p class='error'>\$1</p>", $ret);
         }
         $out->addHTML($this->userForm($this->mTarget));
         return false;
     }
     $this->mTargetObj = $ret;
     $form = new HTMLForm($this->getFormFields(), $this->getContext());
     $form->addPreText(wfMsgExt('emailpagetext', 'parseinline'));
     $form->setSubmitText(wfMsg('emailsend'));
     $form->setTitle($this->getTitle());
     $form->setSubmitCallback(array(__CLASS__, 'submit'));
     $form->setWrapperLegend(wfMsgExt('email-legend', 'parsemag'));
     $form->loadData();
     if (!wfRunHooks('EmailUserForm', array(&$form))) {
         return false;
     }
     $out->setPageTitle($this->msg('emailpage'));
     $result = $form->show();
     if ($result === true || $result instanceof Status && $result->isGood()) {
         $out->setPageTitle($this->msg('emailsent'));
         $out->addWikiMsg('emailsenttext');
         $out->returnToMain(false, $this->mTargetObj->getUserPage());
     }
 }
 /**
  * @return bool
  */
 function configureProject()
 {
     global $wgOpenStackManagerServiceGroupPrefix;
     $this->setHeaders();
     $projectName = $this->getRequest()->getText('projectname');
     $this->getOutput()->setPagetitle($this->msg('openstackmanager-configureproject', $projectName));
     if (!$this->userCanExecute($this->getUser()) && !$this->userLDAP->inRole('projectadmin', $projectName)) {
         $this->notInRole('projectadmin', $projectName);
         return false;
     }
     $project = OpenStackNovaProject::getProjectByName($projectName);
     $volumes = $project->getVolumeSettings();
     $defaultHomedirs = in_array("home", $volumes);
     $defaultProject = in_array("project", $volumes);
     $homePattern = $project->getServiceGroupHomedirPattern();
     $formInfo = array();
     $formInfo['homedirs'] = array('type' => 'check', 'label-message' => 'openstackmanager-configureproject-sharedhomedirs', 'default' => $defaultHomedirs, 'section' => 'volume', 'name' => 'sharedhomedirs');
     $formInfo['storage'] = array('type' => 'check', 'label-message' => 'openstackmanager-configureproject-sharedstorage', 'default' => $defaultProject, 'section' => 'volume', 'name' => 'sharedstorage');
     $formInfo['serviceuserhome'] = array('type' => 'text', 'label-message' => 'openstackmanager-configureproject-serviceuserhome', 'default' => $homePattern, 'section' => 'servicegroup', 'name' => 'serviceuserhome');
     $msg = $this->msg('openstackmanager-configureproject-serviceuserinfo', $wgOpenStackManagerServiceGroupPrefix);
     $formInfo['serviceuserhomeinfo'] = array('type' => 'info', 'section' => 'servicegroup', 'label' => $msg);
     $formInfo['action'] = array('type' => 'hidden', 'default' => 'configureproject', 'name' => 'action');
     $formInfo['projectname'] = array('type' => 'hidden', 'default' => $projectName, 'name' => 'projectname');
     $projectForm = new HTMLForm($formInfo, $this->getContext(), 'openstackmanager-configureproject');
     $projectForm->setSubmitID('novaproject-form-configuresubmit');
     $projectForm->setSubmitCallback(array($this, 'tryConfigureProjectSubmit'));
     $projectForm->show();
     return true;
 }
Exemplo n.º 28
0
 /**
  * Show the survey.
  * 
  * @since 0.1
  * 
  * @param Survey $survey
  */
 protected function showSurvey(Survey $survey)
 {
     $fields = array();
     $fields[] = array('type' => 'hidden', 'default' => $survey->getId(), 'name' => 'survey-id', 'id' => 'survey-id');
     $fields[] = array('type' => 'hidden', 'default' => $survey->getField('name'), 'name' => 'survey-name', 'id' => 'survey-name');
     $fields[] = array('type' => 'hidden', 'default' => $survey->getField('expiry'), 'name' => 'survey-expiry', 'id' => 'survey-expiry');
     $fields[] = array('class' => 'SurveyNameField', 'default' => $survey->getField('name'), 'label-message' => 'survey-special-label-name', 'style' => 'font-weight: bold;');
     $fields[] = array('type' => 'text', 'default' => $survey->getField('title'), 'label-message' => 'survey-special-label-title', 'id' => 'survey-title', 'name' => 'survey-title');
     $fields[] = array('type' => 'check', 'default' => $survey->getField('enabled') ? '1' : '0', 'label-message' => 'survey-special-label-enabled', 'id' => 'survey-enabled', 'name' => 'survey-enabled');
     $fields[] = array('type' => 'radio', 'default' => $survey->getField('user_type'), 'label-message' => 'survey-special-label-usertype', 'id' => 'survey-user_type', 'name' => 'survey-user_type', 'options' => array(wfMsg('survey-user-type-all') => Survey::$USER_ALL, wfMsg('survey-user-type-loggedin') => Survey::$USER_LOGGEDIN, wfMsg('survey-user-type-confirmed') => Survey::$USER_CONFIRMED, wfMsg('survey-user-type-editor') => Survey::$USER_EDITOR, wfMsg('survey-user-type-anon') => Survey::$USER_ANON));
     $fields[] = array('type' => 'select', 'default' => $survey->getField('ratio'), 'label-message' => 'survey-special-label-ratio', 'id' => 'survey-ratio', 'name' => 'survey-ratio', 'options' => $this->getNumericalOptions(array_merge(array(0.01, 0.1), range(1, 100))));
     $fields[] = array('type' => 'select', 'default' => $survey->getField('min_pages'), 'label-message' => 'survey-special-label-minpages', 'id' => 'survey-min_pages', 'name' => 'survey-min_pages', 'options' => $this->getNumericalOptions(range(0, 250)));
     $fields[] = array('type' => 'text', 'default' => $survey->getField('header'), 'label-message' => 'survey-special-label-header', 'id' => 'survey-header', 'name' => 'survey-header');
     $fields[] = array('type' => 'text', 'default' => $survey->getField('footer'), 'label-message' => 'survey-special-label-footer', 'id' => 'survey-footer', 'name' => 'survey-footer');
     $fields[] = array('type' => 'text', 'default' => $survey->getField('thanks'), 'label-message' => 'survey-special-label-thanks', 'id' => 'survey-thanks', 'name' => 'survey-thanks');
     foreach ($survey->getQuestions() as $question) {
         $fields[] = array('class' => 'SurveyQuestionField', 'options' => $question->toArray());
     }
     // getContext was added in 1.18 and since that version is
     // the second argument for the HTMLForm constructor.
     if (version_compare($GLOBALS['wgVersion'], '1.18', '>=')) {
         $form = new HTMLForm($fields, $this->getContext());
     } else {
         $form = new HTMLForm($fields);
         $form->setTitle($this->getTitle());
     }
     $form->setSubmitText(wfMsg('surveys-special-save'));
     $form->addButton('cancelEdit', wfMsg('cancel'), 'cancelEdit', array('onclick' => 'window.location="' . SpecialPage::getTitleFor('Surveys')->getFullURL() . '";return false;'));
     $form->show();
 }
Exemplo n.º 29
0
 /**
  * Add the upload JS and show the form.
  */
 public function show()
 {
     $this->addUploadJS();
     parent::show();
 }
 protected function form()
 {
     $out = $this->getOutput();
     $out->addModules('mediawiki.userSuggest');
     // Consume values
     $this->opts->consumeValue('offset');
     // don't carry offset, DWIW
     $namespace = $this->opts->consumeValue('namespace');
     $username = $this->opts->consumeValue('username');
     $tagFilterVal = $this->opts->consumeValue('tagfilter');
     $nsinvert = $this->opts->consumeValue('invert');
     // Check username input validity
     $ut = Title::makeTitleSafe(NS_USER, $username);
     $userText = $ut ? $ut->getText() : '';
     // Store query values in hidden fields so that form submission doesn't lose them
     $hidden = array();
     foreach ($this->opts->getUnconsumedValues() as $key => $value) {
         $hidden[] = Html::hidden($key, $value);
     }
     $hidden = implode("\n", $hidden);
     $form = array('namespace' => array('type' => 'namespaceselect', 'name' => 'namespace', 'label-message' => 'namespace', 'default' => $namespace), 'nsinvert' => array('type' => 'check', 'name' => 'invert', 'label-message' => 'invert', 'default' => $nsinvert, 'tooltip' => 'invert'), 'tagFilter' => array('type' => 'tagfilter', 'name' => 'tagfilter', 'label-raw' => $this->msg('tag-filter')->parse(), 'default' => $tagFilterVal), 'username' => array('type' => 'text', 'name' => 'username', 'label-message' => 'newpages-username', 'default' => $userText, 'id' => 'mw-np-username', 'size' => 30, 'cssclass' => 'mw-autocomplete-user'));
     $htmlForm = new HTMLForm($form, $this->getContext());
     $htmlForm->setSubmitText($this->msg('allpagessubmit')->text());
     $htmlForm->setSubmitProgressive();
     // The form should be visible on each request (inclusive requests with submitted forms), so
     // return always false here.
     $htmlForm->setSubmitCallback(function () {
         return false;
     });
     $htmlForm->setMethod('get');
     $out->addHtml(Xml::fieldset($this->msg('newpages')->text()));
     $htmlForm->show();
     $out->addHtml(Html::rawElement('div', null, $this->filterLinks()) . Xml::closeElement('fieldset'));
 }