function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
     $request = $this->getRequest();
     $propname = $request->getVal('propname', $par);
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page_props', 'pp_propname', '', __METHOD__, array('DISTINCT', 'ORDER BY' => 'pp_propname'));
     $propnames = array();
     foreach ($res as $row) {
         $propnames[$row->pp_propname] = $row->pp_propname;
     }
     $form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
     $form->setMethod('get');
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegendMsg('pageswithprop-legend');
     $form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
     $form->setSubmitTextMsg('pageswithprop-submit');
     $form->prepareForm();
     $form->displayForm(false);
     if ($propname !== '' && $propname !== null) {
         $form->trySubmit();
     }
 }
Exemplo n.º 2
0
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegendMsg('filerevert-legend');
     $form->setSubmitTextMsg('filerevert-submit');
     $form->addHiddenField('oldimage', $this->getRequest()->getText('oldimage'));
     $form->setTokenSalt(['revert', $this->getTitle()->getPrefixedDBkey()]);
 }
 /**
  * Main execution point
  *
  * @param string $par title fragment
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $lang = $this->getLanguage();
     $out->setPageTitle($this->msg('ipblocklist'));
     $out->addModuleStyles('mediawiki.special');
     $request = $this->getRequest();
     $par = $request->getVal('ip', $par);
     $this->target = trim($request->getVal('wpTarget', $par));
     $this->options = $request->getArray('wpOptions', array());
     $action = $request->getText('action');
     if ($action == 'unblock' || $action == 'submit' && $request->wasPosted()) {
         # B/C @since 1.18: Unblock interface is now at Special:Unblock
         $title = SpecialPage::getTitleFor('Unblock', $this->target);
         $out->redirect($title->getFullUrl());
         return;
     }
     # Just show the block list
     $fields = array('Target' => array('type' => 'text', 'label-message' => 'ipadressorusername', 'tabindex' => '1', 'size' => '45', 'default' => $this->target), 'Options' => array('type' => 'multiselect', 'options' => array($this->msg('blocklist-userblocks')->text() => 'userblocks', $this->msg('blocklist-tempblocks')->text() => 'tempblocks', $this->msg('blocklist-addressblocks')->text() => 'addressblocks', $this->msg('blocklist-rangeblocks')->text() => 'rangeblocks'), 'flatlist' => true), 'Limit' => array('class' => 'HTMLBlockedUsersItemSelect', 'label-message' => 'table_pager_limit_label', 'options' => array($lang->formatNum(20) => 20, $lang->formatNum(50) => 50, $lang->formatNum(100) => 100, $lang->formatNum(250) => 250, $lang->formatNum(500) => 500), 'name' => 'limit', 'default' => 50));
     $form = new HTMLForm($fields, $this->getContext());
     $form->setMethod('get');
     $form->setWrapperLegendMsg('ipblocklist-legend');
     $form->setSubmitTextMsg('ipblocklist-submit');
     $form->prepareForm();
     $form->displayForm('');
     $this->showList();
 }
 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->setWrapperLegendMsg('unblockip');
     $form->setSubmitCallback(array(__CLASS__, 'processUIUnblock'));
     $form->setSubmitTextMsg('ipusubmit');
     $form->addPreText($this->msg('unblockiptext')->parseAsBlock());
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_USER:
             case Block::TYPE_IP:
                 $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;
         }
     }
 }
 protected function alterForm(HTMLForm $form)
 {
     if (!$this->title) {
         $form->setMethod('GET');
     }
     $this->addHelpLink('Help:ChangeContentModel');
     // T120576
     $form->setSubmitTextMsg('changecontentmodel-submit');
 }
 protected function alterForm(HTMLForm $form)
 {
     $form->setId('mw-changeemail-form');
     $form->setTableId('mw-changeemail-table');
     $form->setWrapperLegendMsg('changeemail-header');
     $form->setSubmitTextMsg('changeemail-submit');
     $form->addButton('wpCancel', $this->msg('changeemail-cancel')->text());
     $form->addHiddenField('returnto', $this->getRequest()->getVal('returnto'));
 }
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();
 }
Exemplo n.º 8
0
 private function showResetForm()
 {
     $this->getOutput()->addWikiMsg('prefs-reset-intro');
     $htmlForm = new HTMLForm(array(), $this->getContext(), 'prefs-restore');
     $htmlForm->setSubmitTextMsg('restoreprefs');
     $htmlForm->setTitle($this->getTitle('reset'));
     $htmlForm->setSubmitCallback(array($this, 'submitReset'));
     $htmlForm->suppressReset();
     $htmlForm->show();
 }
 protected function alterForm(HTMLForm $form)
 {
     $form->setId('mw-resetpass-form');
     $form->setTableId('mw-resetpass-table');
     $form->setWrapperLegendMsg('resetpass_header');
     $form->setSubmitTextMsg($this->getUser()->isLoggedIn() ? 'resetpass-submit-loggedin' : 'resetpass_submit');
     $form->addButton('wpCancel', $this->msg('resetpass-submit-cancel')->text());
     $form->setHeaderText($this->msg('resetpass_text')->parseAsBlock());
     $form->addHiddenFields($this->getRequest()->getValues('wpName', 'wpDomain', 'returnto', 'returntoquery'));
 }
 /**
  * Show a form for filtering namespace and username
  *
  * @param $par String
  * @return String
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $form = new HTMLForm(array('Page1' => array('type' => 'text', 'name' => 'page1', 'label-message' => 'compare-page1', 'size' => '40', 'section' => 'page1', 'validation-callback' => array($this, 'checkExistingTitle')), 'Revision1' => array('type' => 'int', 'name' => 'rev1', 'label-message' => 'compare-rev1', 'size' => '8', 'section' => 'page1', 'validation-callback' => array($this, 'checkExistingRevision')), 'Page2' => array('type' => 'text', 'name' => 'page2', 'label-message' => 'compare-page2', 'size' => '40', 'section' => 'page2', 'validation-callback' => array($this, 'checkExistingTitle')), 'Revision2' => array('type' => 'int', 'name' => 'rev2', 'label-message' => 'compare-rev2', 'size' => '8', 'section' => 'page2', 'validation-callback' => array($this, 'checkExistingRevision')), 'Action' => array('type' => 'hidden', 'name' => 'action'), 'Diffonly' => array('type' => 'hidden', 'name' => 'diffonly'), 'Unhide' => array('type' => 'hidden', 'name' => 'unhide')), $this->getContext(), 'compare');
     $form->setSubmitTextMsg('compare-submit');
     $form->suppressReset();
     $form->setMethod('get');
     $form->setSubmitCallback(array(__CLASS__, 'showDiff'));
     $form->loadData();
     $form->displayForm('');
     $form->trySubmit();
 }
Exemplo n.º 11
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.º 12
0
 protected function alterForm(HTMLForm $form)
 {
     $form->setSubmitTextMsg('confirm-rollback-button');
     $form->setTokenSalt('rollback');
     // Copy parameters from GET to confirmation form
     $from = $this->getRequest()->getVal('from');
     if ($from === null) {
         throw new BadRequestError('rollbackfailed', 'rollback-missingparam');
     }
     foreach (['from', 'bot', 'hidediff', 'summary'] as $param) {
         $val = $this->getRequest()->getVal($param);
         if ($val !== null) {
             $form->addHiddenField($param, $val);
         }
     }
 }
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
     $request = $this->getRequest();
     $propname = $request->getVal('propname', $par);
     $propnames = $this->getExistingPropNames();
     $form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
     $form->setMethod('get');
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegendMsg('pageswithprop-legend');
     $form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
     $form->setSubmitTextMsg('pageswithprop-submit');
     $form->prepareForm();
     $form->displayForm(false);
     if ($propname !== '' && $propname !== null) {
         $form->trySubmit();
     }
 }
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;
         }
     }
 }
Exemplo n.º 15
0
 /**
  * Get a form for editing the watchlist in "raw" mode
  *
  * @return HTMLForm
  */
 protected function getRawForm()
 {
     $titles = implode($this->getWatchlist(), "\n");
     $fields = array('Titles' => array('type' => 'textarea', 'label-message' => 'watchlistedit-raw-titles', 'default' => $titles));
     $form = new HTMLForm($fields, $this->getContext());
     $form->setTitle($this->getTitle('raw'));
     $form->setSubmitTextMsg('watchlistedit-raw-submit');
     # Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
     $form->setSubmitTooltip('watchlistedit-raw-submit');
     $form->setWrapperLegendMsg('watchlistedit-raw-legend');
     $form->addHeaderText($this->msg('watchlistedit-raw-explain')->parse());
     $form->setSubmitCallback(array($this, 'submitRaw'));
     return $form;
 }
Exemplo n.º 16
0
 /**
  * Default action when we don't have a subpage -- just show links to the uploads we have,
  * Also show a button to clear stashed files
  * @return bool
  */
 private function showUploads()
 {
     // sets the title, etc.
     $this->setHeaders();
     $this->outputHeader();
     // create the form, which will also be used to execute a callback to process incoming form data
     // this design is extremely dubious, but supposedly HTMLForm is our standard now?
     $context = new DerivativeContext($this->getContext());
     $context->setTitle($this->getPageTitle());
     // Remove subpage
     $form = new HTMLForm(array('Clear' => array('type' => 'hidden', 'default' => true, 'name' => 'clear')), $context, 'clearStashedUploads');
     $form->setSubmitCallback(array(__CLASS__, 'tryClearStashedUploads'));
     $form->setSubmitTextMsg('uploadstash-clear');
     $form->prepareForm();
     $formResult = $form->tryAuthorizedSubmit();
     // show the files + form, if there are any, or just say there are none
     $refreshHtml = Html::element('a', array('href' => $this->getPageTitle()->getLocalURL()), $this->msg('uploadstash-refresh')->text());
     $files = $this->stash->listFiles();
     if ($files && count($files)) {
         sort($files);
         $fileListItemsHtml = '';
         foreach ($files as $file) {
             // TODO: Use Linker::link or even construct the list in plain wikitext
             $fileListItemsHtml .= Html::rawElement('li', array(), Html::element('a', array('href' => $this->getPageTitle("file/{$file}")->getLocalURL()), $file));
         }
         $this->getOutput()->addHtml(Html::rawElement('ul', array(), $fileListItemsHtml));
         $form->displayForm($formResult);
         $this->getOutput()->addHtml(Html::rawElement('p', array(), $refreshHtml));
     } else {
         $this->getOutput()->addHtml(Html::rawElement('p', array(), Html::element('span', array(), $this->msg('uploadstash-nofiles')->text()) . ' ' . $refreshHtml));
     }
     return true;
 }
Exemplo n.º 17
0
 /**
  * Get a form for clearing the watchlist
  *
  * @return HTMLForm
  */
 protected function getClearForm()
 {
     $context = new DerivativeContext($this->getContext());
     $context->setTitle($this->getPageTitle('clear'));
     // Reset subpage
     $form = new HTMLForm(array(), $context);
     $form->setSubmitTextMsg('watchlistedit-clear-submit');
     # Used message keys: 'accesskey-watchlistedit-clear-submit', 'tooltip-watchlistedit-clear-submit'
     $form->setSubmitTooltip('watchlistedit-clear-submit');
     $form->setWrapperLegendMsg('watchlistedit-clear-legend');
     $form->addHeaderText($this->msg('watchlistedit-clear-explain')->parse());
     $form->setSubmitCallback(array($this, 'submitClear'));
     $form->setSubmitDestructive();
     return $form;
 }
Exemplo n.º 18
0
 /**
  * Suppress the submit button if there's nothing to do;
  * provide additional message on it otherwise.
  * @param HTMLForm $form
  */
 protected function alterForm(HTMLForm $form)
 {
     if ($this->getTokensList()) {
         $form->setSubmitTextMsg('resettokens-resetbutton');
     } else {
         $form->suppressDefaultSubmit();
     }
 }
Exemplo n.º 19
0
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegend(false);
     $form->setHeaderText($this->msg('lockdbtext')->parseAsBlock());
     $form->setSubmitTextMsg('lockbtn');
 }
Exemplo n.º 20
0
 protected function alterForm(\HTMLForm $form)
 {
     $form->setSubmitTextMsg('uploadbtn');
 }
Exemplo n.º 21
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();
 }
 protected function alterForm(HTMLForm $form)
 {
     $form->setId('mw-changeemail-form');
     $form->setTableId('mw-changeemail-table');
     $form->setSubmitTextMsg('changeemail-submit');
     $form->addHiddenFields($this->getRequest()->getValues('returnto', 'returntoquery'));
 }
Exemplo n.º 23
0
 /**
  * Customizes the HTMLForm a bit
  *
  * @param $form HTMLForm
  */
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegendMsg('blockip-legend');
     $form->setHeaderText('');
     $form->setSubmitCallback(array(__CLASS__, 'processUIForm'));
     $msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
     $form->setSubmitTextMsg($msg);
     # Don't need to do anything if the form has been posted
     if (!$this->getRequest()->wasPosted() && $this->preErrors) {
         $s = HTMLForm::formatErrors($this->preErrors);
         if ($s) {
             $form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
         }
     }
 }
Exemplo n.º 24
0
 function getForm()
 {
     $fields = array();
     $fields['limit'] = array('type' => 'select', 'name' => 'limit', 'label-message' => 'table_pager_limit_label', 'options' => $this->getLimitSelectList(), 'default' => $this->mLimit);
     if (!$this->getConfig()->get('MiserMode')) {
         $fields['ilsearch'] = array('type' => 'text', 'name' => 'ilsearch', 'id' => 'mw-ilsearch', 'label-message' => 'listfiles_search_for', 'default' => $this->mSearch, 'size' => '40', 'maxlength' => '255');
     }
     $this->getOutput()->addModules('mediawiki.userSuggest');
     $fields['user'] = array('type' => 'text', 'name' => 'user', 'id' => 'mw-listfiles-user', 'label-message' => 'username', 'default' => $this->mUserName, 'size' => '40', 'maxlength' => '255', 'cssclass' => 'mw-autocomplete-user');
     $fields['ilshowall'] = array('type' => 'check', 'name' => 'ilshowall', 'id' => 'mw-listfiles-show-all', 'label-message' => 'listfiles-show-all', 'default' => $this->mShowAll);
     $query = $this->getRequest()->getQueryValues();
     unset($query['title']);
     unset($query['limit']);
     unset($query['ilsearch']);
     unset($query['ilshowall']);
     unset($query['user']);
     $form = new HTMLForm($fields, $this->getContext());
     $form->setMethod('get');
     $form->setTitle($this->getTitle());
     $form->setId('mw-listfiles-form');
     $form->setWrapperLegendMsg('listfiles');
     $form->setSubmitTextMsg('table_pager_limit_submit');
     $form->addHiddenFields($query);
     $form->prepareForm();
     $form->displayForm('');
 }
 public function alterForm(HTMLForm $form)
 {
     global $wgPasswordResetRoutes;
     $form->setDisplayFormat('vform');
     // Turn the old-school line around the form off.
     // XXX This wouldn't be necessary here if we could set the format of
     // the HTMLForm to 'vform' at its creation, but there's no way to do so
     // from a FormSpecialPage class.
     $form->setWrapperLegend(false);
     $form->addHiddenFields($this->getRequest()->getValues('returnto', 'returntoquery'));
     $i = 0;
     if (isset($wgPasswordResetRoutes['username']) && $wgPasswordResetRoutes['username']) {
         $i++;
     }
     if (isset($wgPasswordResetRoutes['email']) && $wgPasswordResetRoutes['email']) {
         $i++;
     }
     if (isset($wgPasswordResetRoutes['domain']) && $wgPasswordResetRoutes['domain']) {
         $i++;
     }
     $message = $i > 1 ? 'passwordreset-text-many' : 'passwordreset-text-one';
     $form->setHeaderText($this->msg($message, $i)->parseAsBlock());
     $form->setSubmitTextMsg('mailmypassword');
 }
Exemplo n.º 26
0
 protected function alterForm(HTMLForm $form)
 {
     $form->setSubmitTextMsg('confirm_purge_button');
 }
Exemplo n.º 27
0
 /**
  * Customizes the HTMLForm a bit
  *
  * @param HTMLForm $form
  */
 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegendMsg('blockip-legend');
     $form->setHeaderText('');
     $form->setSubmitDestructive();
     $msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
     $form->setSubmitTextMsg($msg);
     $this->addHelpLink('Help:Blocking users');
     # Don't need to do anything if the form has been posted
     if (!$this->getRequest()->wasPosted() && $this->preErrors) {
         $s = $form->formatErrors($this->preErrors);
         if ($s) {
             $form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
         }
     }
 }
Exemplo n.º 28
0
 function getForm()
 {
     $fields = array('like' => array('type' => 'text', 'label-message' => 'newimages-label', 'name' => 'like'), 'showbots' => array('type' => 'check', 'label-message' => 'newimages-showbots', 'name' => 'showbots'), 'limit' => array('type' => 'hidden', 'default' => $this->mLimit, 'name' => 'limit'), 'offset' => array('type' => 'hidden', 'default' => $this->getRequest()->getText('offset'), 'name' => 'offset'));
     if ($this->getConfig()->get('MiserMode')) {
         unset($fields['like']);
     }
     $context = new DerivativeContext($this->getContext());
     $context->setTitle($this->getTitle());
     // Remove subpage
     $form = new HTMLForm($fields, $context);
     $form->setSubmitTextMsg('ilsubmit');
     $form->setMethod('get');
     $form->setWrapperLegendMsg('newimages-legend');
     return $form;
 }
Exemplo n.º 29
0
 protected function alterForm(HTMLForm $form)
 {
     /* display summary at top of page */
     $this->outputHeader();
     // tweak label on submit button
     // Message: redirect-submit
     $form->setSubmitTextMsg($this->getMessagePrefix() . '-submit');
     /* submit form every time */
     $form->setMethod('get');
 }
Exemplo n.º 30
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());
     }
 }