/**
  * Prompt for a username or IP address.
  *
  * @param $userName string
  */
 protected function promptForm($userName = '')
 {
     $out = $this->getOutput();
     $out->addModules('mediawiki.userSuggest');
     $out->addWikiMsg('nuke-tools');
     $out->addHTML(Xml::openElement('form', array('action' => $this->getPageTitle()->getLocalURL('action=submit'), 'method' => 'post')) . '<table><tr>' . '<td>' . Xml::label($this->msg('nuke-userorip')->text(), 'nuke-target') . '</td>' . '<td>' . Xml::input('target', 40, $userName, array('id' => 'nuke-target', 'class' => 'mw-autocomplete-user', 'autofocus' => true)) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-pattern')->text(), 'nuke-pattern') . '</td>' . '<td>' . Xml::input('pattern', 40, '', array('id' => 'nuke-pattern')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-namespace')->text(), 'nuke-namespace') . '</td>' . '<td>' . Html::namespaceSelector(array('all' => 'all'), array('name' => 'namespace')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-maxpages')->text(), 'nuke-limit') . '</td>' . '<td>' . Xml::input('limit', 7, '500', array('id' => 'nuke-limit')) . '</td>' . '</tr><tr>' . '<td></td>' . '<td>' . Xml::submitButton($this->msg('nuke-submit-user')->text()) . '</td>' . '</tr></table>' . Html::hidden('wpEditToken', $this->getUser()->getEditToken()) . Xml::closeElement('form'));
 }
 public function showForm()
 {
     global $wgScript;
     # Explanatory text
     $this->getOutput()->addWikiMsg('pendingchanges-list', $this->getLang()->formatNum($this->pager->getNumRows()));
     $form = Html::openElement('form', array('name' => 'pendingchanges', 'action' => $wgScript, 'method' => 'get')) . "\n";
     $form .= "<fieldset><legend>" . wfMsgHtml('pendingchanges-legend') . "</legend>\n";
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n";
     $items = array();
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getNamespaceMenu($this->namespace, '') . '</span>';
     }
     if (FlaggedRevs::qualityVersions()) {
         $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span>';
     }
     if (!FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected()) {
         $items[] = "<span style='white-space: nowrap;'>" . Xml::check('stable', $this->stable, array('id' => 'wpStable')) . Xml::label(wfMsg('pendingchanges-stable'), 'wpStable') . '</span>';
     }
     if ($items) {
         $form .= implode(' ', $items) . '<br />';
     }
     $items = array();
     $items[] = Xml::label(wfMsg("pendingchanges-category"), 'wpCategory') . '&#160;' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory'));
     if ($this->getUser()->getId()) {
         $items[] = Xml::check('watched', $this->watched, array('id' => 'wpWatched')) . Xml::label(wfMsg('pendingchanges-onwatchlist'), 'wpWatched');
     }
     $form .= implode(' ', $items) . '<br />';
     $form .= Xml::label(wfMsg('pendingchanges-size'), 'wpSize') . Xml::input('size', 4, $this->size, array('id' => 'wpSize')) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\n";
     $form .= "</fieldset>";
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
	/**
	 * Input form
	 */
	static function onSpecialListusersHeaderForm( $pager, &$out ) {
		$testwiki = IncubatorTest::getUrlParam();
		$project = self::getProjectInput();
		$input = $project ? $project['name'] : ( $testwiki ? $testwiki['prefix'] : null );
		$out .= Xml::label( wfMsg( 'wminc-testwiki' ), 'testwiki' ) . ' ' .
			Xml::input( 'testwiki', 20, $input, array( 'id' => 'testwiki' ) ) . '<br />';
		return true;
	}
 public function getForm($par = null)
 {
     global $wgScript, $wgRequest;
     $category = $par;
     if (!$category) {
         $category = $wgRequest->getVal('category');
     }
     $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('randomincategory')) . Html::Hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('p') . Xml::label(wfMsg('randomincategory-label'), 'category') . ' ' . Xml::input('category', null, $category, array('id' => 'category')) . ' ' . Xml::submitButton(wfMsg('randomincategory-submit')) . Xml::closeElement('p') . Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $f;
 }
 public function getPageHeader()
 {
     $self = SpecialPage::getTitleFor($this->getName());
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
     $form .= '<table><tr><td align="right">' . Xml::label("Exclude titles", 'excludetitles') . '</td>';
     $form .= '<td>' . Xml::input('excludetitles', 30, $this->excludeorig, array('id' => 'excludetitles')) . '</td></tr>';
     $form .= '<tr><td></td><td>' . Xml::submitButton(wfMsg('allpagessubmit')) . '</td></tr></table>';
     $form .= Html::hidden('offset', $this->offset) . Html::hidden('limit', $this->limit) . '</form>';
     return $form;
 }
 function execute($par)
 {
     global $wgUrlProtocols, $wgMiserMode;
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->allowClickjacking();
     $request = $this->getRequest();
     $target = $request->getVal('target', $par);
     $namespace = $request->getIntorNull('namespace', null);
     $protocols_list = array();
     foreach ($wgUrlProtocols as $prot) {
         if ($prot !== '//') {
             $protocols_list[] = $prot;
         }
     }
     $target2 = $target;
     $protocol = '';
     $pr_sl = strpos($target2, '//');
     $pr_cl = strpos($target2, ':');
     if ($pr_sl) {
         // For protocols with '//'
         $protocol = substr($target2, 0, $pr_sl + 2);
         $target2 = substr($target2, $pr_sl + 2);
     } elseif (!$pr_sl && $pr_cl) {
         // For protocols without '//' like 'mailto:'
         $protocol = substr($target2, 0, $pr_cl + 1);
         $target2 = substr($target2, $pr_cl + 1);
     } elseif ($protocol == '' && $target2 != '') {
         // default
         $protocol = 'http://';
     }
     if ($protocol != '' && !in_array($protocol, $protocols_list)) {
         // unsupported protocol, show original search request
         $target2 = $target;
         $protocol = '';
     }
     $out->addWikiMsg('linksearch-text', '<nowiki>' . $this->getLang()->commaList($wgUrlProtocols) . '</nowiki>');
     $s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Html::hidden('title', $this->getTitle()->getPrefixedDbKey()) . '<fieldset>' . Xml::element('legend', array(), wfMsg('linksearch')) . Xml::inputLabel(wfMsg('linksearch-pat'), 'target', 'target', 50, $target) . ' ';
     if (!$wgMiserMode) {
         $s .= Xml::label(wfMsg('linksearch-ns'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
     }
     $s .= Xml::submitButton(wfMsg('linksearch-ok')) . '</fieldset>' . Xml::closeElement('form');
     $out->addHTML($s);
     if ($target != '') {
         $this->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
         parent::execute($par);
         if ($this->mMungedQuery === false) {
             $out->addWikiMsg('linksearch-error');
         }
     }
 }
 /**
  * Output a form to allow searching for a user
  */
 function switchForm()
 {
     global $wgScript;
     $knownwiki = $this->getRequest()->getVal('wpKnownWiki');
     $knownwiki = $knownwiki ? $knownwiki : wfWikiId();
     // Generate wiki selector
     $selector = new XmlSelect('wpKnownWiki', 'wpKnownWiki', $knownwiki);
     foreach (CentralAuthUser::getWikiList() as $wiki) {
         $selector->addOption($wiki);
     }
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('userrights-lookup-user')) . Xml::inputLabel(wfMsg('userrights-user-editname'), 'user', 'username', 30, $this->mTarget) . ' <br />' . Xml::label(wfMsg('centralauth-globalgrouppermissions-knownwiki'), 'wpKnownWiki') . ' ' . $selector->getHTML() . '<br />' . Xml::submitButton(wfMsg('editusergroup')) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
    function buildForm()
    {
        global $wgScript;
        $languages = Language::getLanguageNames(false);
        ksort($languages);
        $out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form')) . Xml::fieldset(wfMsg('allmessages-filter-legend')) . Xml::hidden('title', $this->getTitle()) . Xml::openElement('table', array('class' => 'mw-allmessages-table')) . "\n" . '<tr>
				<td class="mw-label">' . Xml::label(wfMsg('allmessages-prefix'), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->prefix), array('id' => 'mw-allmessages-form-prefix')) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class='mw-label'>" . wfMsg('allmessages-filter') . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel(wfMsg('allmessages-filter-unmodified'), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter == 'unmodified' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-all'), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter == 'all' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-modified'), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter == 'modified' ? true : false) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . Xml::label(wfMsg('allmessages-language'), 'mw-allmessages-form-lang') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::openElement('select', array('id' => 'mw-allmessages-form-lang', 'name' => 'lang'));
        foreach ($languages as $lang => $name) {
            $selected = $lang == $this->langCode ? true : false;
            $out .= Xml::option($lang . ' - ' . $name, $lang, $selected) . "\n";
        }
        $out .= Xml::closeElement('select') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsg('allmessages-filter-submit')) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->table->getHiddenFields(array('title', 'prefix', 'filter', 'lang')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
        return $out;
    }
 protected function generateBillingFields()
 {
     global $wgScriptPath;
     $form = '';
     // name
     $form .= $this->getNameField();
     // email
     $form .= $this->getEmailField();
     // amount
     $form .= '<tr>';
     $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['amount'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td class="label">' . Xml::label(wfMsg('donate_interface-donor-amount'), 'amount') . '</td>';
     $form .= '<td>' . Xml::input('amount', '7', $this->getEscapedValue('amount'), array('type' => 'text', 'maxlength' => '10', 'id' => 'amount')) . ' ' . $this->generateCurrencyDropdown() . '</td>';
     $form .= '</tr>';
     // card logos
     if ($this->getEscapedValue('currency_code') == 'USD') {
         $form .= '<tr id="four_cards" style="display:table-row;">';
         $form .= '<td class="label"> </td><td>' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif")) . '</td>';
         $form .= '</tr>';
         $form .= '<tr id="two_cards" style="display:none;">';
         $form .= '<td class="label"> </td><td>' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos3.gif")) . '</td>';
         $form .= '</tr>';
     } else {
         $form .= '<tr id="four_cards" style="display:none;">';
         $form .= '<td class="label"> </td><td>' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif")) . '</td>';
         $form .= '</tr>';
         $form .= '<tr id="two_cards" style="display:table-row;">';
         $form .= '<td class="label"> </td><td>' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos3.gif")) . '</td>';
         $form .= '</tr>';
     }
     // card number
     $form .= $this->getCardNumberField();
     // cvv
     $form .= $this->getCvvField();
     // expiry
     $form .= $this->getExpiryField();
     // street
     $form .= $this->getStreetField();
     // city
     $form .= $this->getCityField();
     // state
     $form .= $this->getStateField();
     // zip
     $form .= $this->getZipField();
     // country
     $form .= $this->getCountryField();
     return $form;
 }
    function buildForm()
    {
        $attrs = ['id' => 'mw-allmessages-form-lang', 'name' => 'lang'];
        $msg = wfMessage('allmessages-language');
        $langSelect = Xml::languageSelector($this->langcode, false, null, $attrs, $msg);
        $out = Xml::openElement('form', ['method' => 'get', 'action' => $this->getConfig()->get('Script'), 'id' => 'mw-allmessages-form']) . Xml::fieldset($this->msg('allmessages-filter-legend')->text()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('table', ['class' => 'mw-allmessages-table']) . "\n" . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('allmessages-prefix')->text(), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->displayPrefix), ['id' => 'mw-allmessages-form-prefix']) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t<td class='mw-label'>" . $this->msg('allmessages-filter')->escaped() . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('allmessages-filter-unmodified')->text(), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter === 'unmodified') . Xml::radioLabel($this->msg('allmessages-filter-all')->text(), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter === 'all') . Xml::radioLabel($this->msg('allmessages-filter-modified')->text(), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter === 'modified') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . $langSelect[0] . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . $langSelect[1] . "</td>\n\n\t\t\t</tr>" . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('table_pager_limit_label')->text(), 'mw-table_pager_limit_label') . '</td>
			<td class="mw-input">' . $this->getLimitSelect(['id' => 'mw-table_pager_limit_label']) . '</td>
			<tr>
				<td></td>
				<td>' . Xml::submitButton($this->msg('allmessages-filter-submit')->text()) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->getHiddenFields(['title', 'prefix', 'filter', 'lang', 'limit']) . Xml::closeElement('fieldset') . Xml::closeElement('form');
        return $out;
    }
Exemple #11
0
 function execute($par)
 {
     global $wgOut, $wgUser;
     $this->setHeaders();
     if (!$wgUser->isAllowed('stafflog')) {
         throw new PermissionsError('stafflog');
     }
     $pager = new StaffLoggerPager("");
     $sTypesDropDown = Xml::openElement('select', array('name' => 'type', 'id' => 'StaffLogFilterType'));
     foreach ($this->aTypes as $k => $v) {
         $sTypesDropDown .= Xml::option($v, $k, $k == $this->request->getText('type', ''));
     }
     $sTypesDropDown .= Xml::closeElement('select');
     $wgOut->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL())) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('stafflog-filter-label'), false) . Xml::inputLabel(wfMsg('stafflog-filter-user'), 'user', 'StaffLogFilterUser', false, htmlspecialchars($this->request->getText('user', ''), ENT_QUOTES, 'UTF-8')) . Xml::label(wfMsg('stafflog-filter-type'), 'StaffLogFilterType') . ' ' . $sTypesDropDown . ' ' . Xml::submitButton(wfMsg('stafflog-filter-apply')) . Xml::closeElement('fieldset') . Xml::closeElement('form') . Xml::openElement('div', array('class' => 'mw-spcontent')) . $pager->getNavigationBar() . '<ul>' . $pager->getBody() . '</ul>' . $pager->getNavigationBar() . Xml::closeElement('div'));
 }
	/**
	 * Hooks SpecialRecentChangesPanel. See the hook documentation for
	 * documentation of the function parameters.
	 *
	 * Adds a HTMl selector into $items
	 * @param $items
	 * @param $opts
	 * @return bool true
	 */
	public static function translationFilterForm( &$items, $opts ) {
		$opts->consumeValue( 'translations' );
		$default = $opts->getValue( 'translations' );

		$label = Xml::label( wfMsg( 'translate-rc-translation-filter' ), 'mw-translation-filter' );
		$select = new XmlSelect( 'translations', 'mw-translation-filter', $default );
		$select->addOption( wfMsg( 'translate-rc-translation-filter-no' ), 'noaction' );
		$select->addOption( wfMsg( 'translate-rc-translation-filter-only' ), 'only' );
		$select->addOption( wfMsg( 'translate-rc-translation-filter-filter' ), 'filter' );
		$select->addOption( wfMsg( 'translate-rc-translation-filter-site' ), 'site' );

		$items['translations'] = array( $label, $select->getHTML() );

		return true;
	}
 /**
  * HTML for the top form
  * @param integer $namespace A namespace constant (default NS_MAIN).
  * @param string $from Article name we are starting listing at.
  */
 function namespaceForm($namespace = NS_MAIN, $from = '')
 {
     global $wgScript, $wgContLang;
     $t = SpecialPage::getTitleFor($this->name);
     $align = $wgContLang->isRtl() ? 'left' : 'right';
     $out = Xml::openElement('div', array('class' => 'namespaceoptions'));
     $out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $out .= Xml::hidden('title', $t->getPrefixedText());
     $out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
     $out .= "<tr>\n\t\t\t<td align='{$align}'>" . Xml::label(wfMsg($this->nsfromMsg), 'nsfrom') . "</td>\n\t\t\t<td>" . Xml::input('from', 20, $from, array('id' => 'nsfrom')) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('namespace'), 'namespace') . "</td>\n\t\t\t<td>" . Xml::namespaceSelector($namespace, null) . Xml::submitButton(wfMsg('allpagessubmit')) . "</td>\n\t\t\t</tr>";
     $out .= Xml::closeElement('table');
     $out .= Xml::closeElement('form');
     $out .= Xml::closeElement('div');
     return $out;
 }
/**
 * Special:LinkSearch to search the external-links table.
 */
function wfSpecialLinkSearch($par)
{
    list($limit, $offset) = wfCheckLimits();
    global $wgOut, $wgUrlProtocols, $wgMiserMode, $wgLang;
    $target = $GLOBALS['wgRequest']->getVal('target', $par);
    $namespace = $GLOBALS['wgRequest']->getIntorNull('namespace', null);
    $protocols_list[] = '';
    foreach ($wgUrlProtocols as $prot) {
        $protocols_list[] = $prot;
    }
    $target2 = $target;
    $protocol = '';
    $pr_sl = strpos($target2, '//');
    $pr_cl = strpos($target2, ':');
    if ($pr_sl) {
        // For protocols with '//'
        $protocol = substr($target2, 0, $pr_sl + 2);
        $target2 = substr($target2, $pr_sl + 2);
    } elseif (!$pr_sl && $pr_cl) {
        // For protocols without '//' like 'mailto:'
        $protocol = substr($target2, 0, $pr_cl + 1);
        $target2 = substr($target2, $pr_cl + 1);
    } elseif ($protocol == '' && $target2 != '') {
        // default
        $protocol = 'http://';
    }
    if (!in_array($protocol, $protocols_list)) {
        // unsupported protocol, show original search request
        $target2 = $target;
        $protocol = '';
    }
    $self = Title::makeTitle(NS_SPECIAL, 'Linksearch');
    $wgOut->allowClickjacking();
    $wgOut->addWikiMsg('linksearch-text', '<nowiki>' . $wgLang->commaList($wgUrlProtocols) . '</nowiki>');
    $s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Html::hidden('title', $self->getPrefixedDbKey()) . '<fieldset>' . Xml::element('legend', array(), wfMsg('linksearch')) . Xml::inputLabel(wfMsg('linksearch-pat'), 'target', 'target', 50, $target) . ' ';
    if (!$wgMiserMode) {
        $s .= Xml::label(wfMsg('linksearch-ns'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
    }
    $s .= Xml::submitButton(wfMsg('linksearch-ok')) . '</fieldset>' . Xml::closeElement('form');
    $wgOut->addHTML($s);
    if ($target != '') {
        $searcher = new LinkSearchPage();
        $searcher->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
        $searcher->doQuery($offset, $limit);
    }
}
 /**
  * HTML for the top form
  * @param integer $code A language code (default empty, example: 'en').
  * @param bool $suppressComplete If completely translated groups should be suppressed
  * @return string HTML
  */
 function languageForm($code = '', $suppressComplete = false, $suppressEmpty = false)
 {
     global $wgScript;
     $t = $this->getTitle();
     $out = Xml::openElement('div', array('class' => 'languagecode'));
     $out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $out .= Html::hidden('title', $t->getPrefixedText());
     $out .= Xml::openElement('fieldset');
     $out .= Xml::element('legend', null, wfMsg('translate-language-code'));
     $out .= Xml::openElement('table', array('id' => 'langcodeselect', 'class' => 'allpages'));
     $out .= "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('translate-language-code-field-name'), 'code') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('code', 30, str_replace('_', ' ', $code), array('id' => 'code')) . "</td></tr><tr><td colspan='2'>" . Xml::checkLabel(wfMsg('translate-suppress-complete'), 'suppresscomplete', 'suppresscomplete', $suppressComplete) . Xml::checkLabel(wfMsg('translate-suppress-empty'), 'suppressempty', 'suppressempty', $suppressEmpty) . "</td>" . "</tr>" . "<tr>" . "<td class='mw-input'>" . Xml::submitButton(wfMsg('allpagessubmit')) . "</td>\n\t\t\t</tr>";
     $out .= Xml::closeElement('table');
     $out .= Xml::closeElement('fieldset');
     $out .= Xml::closeElement('form');
     $out .= Xml::closeElement('div');
     return $out;
 }
 function getPageHeader()
 {
     global $wgScript, $wgContLang;
     $prefix = $this->prefix;
     $t = SpecialPage::getTitleFor($this->getName());
     $align = $wgContLang->isRtl() ? 'left' : 'right';
     $s = '<p>' . wfMsgExt('withoutinterwiki-header', array('parseinline')) . '</p>';
     $s .= Xml::openElement('div', array('class' => 'namespaceoptions'));
     $s .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $s .= Xml::hidden('title', $t->getPrefixedText());
     $s .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'withoutinterwiki'));
     $s .= "<tr>\n\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('allpagesprefix'), 'wiprefix') . "</td>\n\t\t\t\t<td>" . Xml::input('prefix', 20, htmlspecialchars($prefix), array('id' => 'wiprefix')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='{$align}'></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsgHtml('withoutinterwiki-submit')) . "</td>\n\t\t\t</tr>";
     $s .= Xml::closeElement('table');
     $s .= Xml::closeElement('form');
     $s .= Xml::closeElement('div');
     return $s;
 }
 /**
  * HTML for the top form
  * @param integer $namespace A namespace constant (default NS_MAIN).
  * @param string $from dbKey we are starting listing at.
  * @param string $to dbKey we are ending listing at.
  */
 function namespaceForm($namespace = NS_MAIN, $from = '', $to = '')
 {
     global $wgScript;
     $t = $this->getTitle();
     $out = Xml::openElement('div', array('class' => 'namespaceoptions'));
     $out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $out .= Xml::hidden('title', $t->getPrefixedText());
     $out .= Xml::openElement('fieldset');
     $out .= Xml::element('legend', null, wfMsg('allpages'));
     $out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
     $out .= "<tr>\n\t<td class='mw-label'>" . Xml::label(wfMsg('allpagesfrom'), 'nsfrom') . "\t</td>\n\t<td class='mw-input'>" . Xml::input('from', 30, str_replace('_', ' ', $from), array('id' => 'nsfrom')) . "\t</td>\n</tr>\n<tr>\n\t<td class='mw-label'>" . Xml::label(wfMsg('allpagesto'), 'nsto') . "\t</td>\n\t\t\t<td class='mw-input'>" . Xml::input('to', 30, str_replace('_', ' ', $to), array('id' => 'nsto')) . "\t\t</td>\n</tr>\n<tr>\n\t<td class='mw-label'>" . Xml::label(wfMsg('namespace'), 'namespace') . "\t</td>\n\t\t\t<td class='mw-input'>" . Xml::namespaceSelector($namespace, null) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\t</td>\n</tr>";
     $out .= Xml::closeElement('table');
     $out .= Xml::closeElement('fieldset');
     $out .= Xml::closeElement('form');
     $out .= Xml::closeElement('div');
     return $out;
 }
	function getform() {
		global $wgScript;

		$out = Html::openElement( 'div' );
		$out .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
		$out .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() );
		$out .= Html::hidden( 'x', 'D' ); // To detect submission
		$out .= Html::openElement( 'fieldset' );
		$out .= Html::element( 'legend', null, wfMsg( 'translate-mgs-fieldset' ) );
		$out .= Html::openElement( 'table' );

		$out .= Html::openElement( 'tr' );
		$out .= Html::openElement( 'td', array( 'class' => 'mw-label' ) );
		$out .= Xml::label( wfMsg( 'translate-mgs-group' ), 'group' );
		$out .= Html::closeElement( 'td' );
		$out .= Html::openElement( 'td', array( 'class' => 'mw-input' ) );
		$out .= TranslateUtils::groupSelector( $this->target )->getHTML();
		$out .= Html::closeElement( 'td' );
		$out .= Html::closeElement( 'tr' );

		$out .= Html::openElement( 'tr' );
		$out .= Html::openElement( 'td', array( 'colspan' => 2 ) );
		$out .= Xml::checkLabel( wfMsg( 'translate-mgs-nocomplete' ), 'suppresscomplete', 'suppresscomplete', $this->noComplete );
		$out .= Html::closeElement( 'td' );
		$out .= Html::closeElement( 'tr' );

		$out .= Html::openElement( 'tr' );
		$out .= Html::openElement( 'td', array( 'colspan' => 2 ) );
		$out .= Xml::checkLabel( wfMsg( 'translate-mgs-noempty' ), 'suppressempty', 'suppressempty', $this->noEmpty );
		$out .= Html::closeElement( 'td' );
		$out .= Html::closeElement( 'tr' );

		$out .= Html::openElement( 'tr' );
		$out .= Html::openElement( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ) );
		$out .= Xml::submitButton( wfMsg( 'translate-mgs-submit' ) );
		$out .= Html::closeElement( 'td' );
		$out .= Html::closeElement( 'tr' );

		$out .= Html::closeElement( 'table' );
		$out .= Html::closeElement( 'fieldset' );
		$out .= Html::closeElement( 'form' );
		$out .= Html::closeElement( 'div' );

		return $out;
	}
	static function onRcForm( &$items, $opts ) {
		global $wmincProjects, $wmincProjectSite, $wmincLangCodeLength;
		
		list( $projectvalue, $codevalue ) = self::getValues();
		$opts->consumeValue( 'rc-testwiki-project' );
		$opts->consumeValue( 'rc-testwiki-code' );
		$label = Xml::label( wfMsg( 'wminc-testwiki' ), 'rc-testwiki' );
		$select = new XmlSelect( 'rc-testwiki-project', 'rc-testwiki-project', $projectvalue );
		$select->addOption( wfMsg( 'wminc-testwiki-none' ), 'none' );
		foreach( $wmincProjects as $prefix => $name ) {
			$select->addOption( $name, $prefix );
		}
		$select->addOption( $wmincProjectSite['name'], $wmincProjectSite['short'] );
		$langcode = Xml::input( 'rc-testwiki-code', (int)$wmincLangCodeLength, $codevalue,
			array( 'id' => 'rc-testwiki-code', 'maxlength' => (int)$wmincLangCodeLength ) );
		$items['testwiki'] = array( $label, $select->getHTML() . ' ' . $langcode );
		return true;
	}
 public function getHTML()
 {
     global $wgRequest, $wgScript, $wgTitle;
     $s = '';
     $s .= Xml::fieldset(wfMsg('listuserrestrictions-legend'));
     $s .= "<form action=\"{$wgScript}\">";
     $s .= Xml::hidden('title', $wgTitle->getPrefixedDbKey());
     $s .= Xml::label(wfMsgHtml('listuserrestrictions-type'), 'type') . '&nbsp;' . self::typeSelector('type', $wgRequest->getVal('type'), 'type');
     $s .= '&nbsp;';
     $s .= Xml::inputLabel(wfMsgHtml('listuserrestrictions-user'), 'user', 'user', false, $wgRequest->getVal('user'));
     $s .= '<p>';
     $s .= Xml::label(wfMsgHtml('listuserrestrictions-namespace'), 'namespace') . '&nbsp;' . Xml::namespaceSelector($wgRequest->getVal('namespace'), '', 'namespace');
     $s .= '&nbsp;';
     $s .= Xml::inputLabel(wfMsgHtml('listuserrestrictions-page'), 'page', 'page', false, $wgRequest->getVal('page'));
     $s .= Xml::submitButton(wfMsg('listuserrestrictions-submit'));
     $s .= "</p></form></fieldset>";
     return $s;
 }
 protected function showForm()
 {
     global $wgScript;
     # Add explanatory text
     $this->getOutput()->addWikiMsg('unreviewedpages-list', $this->getLanguage()->formatNum($this->pager->getNumRows()));
     # show/hide links
     $showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped());
     $onoff = 1 - $this->hideRedirs;
     $link = Linker::link($this->getPageTitle(), $showhide[$onoff], array(), array('hideredirs' => $onoff, 'category' => $this->category, 'namespace' => $this->namespace));
     $showhideredirs = $this->msg('whatlinkshere-hideredirs')->rawParams($link)->escaped();
     # Add form...
     $form = Html::openElement('form', array('name' => 'unreviewedpages', 'action' => $wgScript, 'method' => 'get')) . "\n";
     $form .= "<fieldset><legend>" . $this->msg('unreviewedpages-legend')->escaped() . "</legend>\n";
     $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
     # Add dropdowns as needed
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $form .= FlaggedRevsXML::getNamespaceMenu($this->namespace) . '&#160;';
     }
     if (FlaggedRevs::qualityVersions()) {
         $form .= FlaggedRevsXML::getLevelMenu($this->level, false, 1) . '&#160;';
     }
     $form .= "<span style='white-space: nowrap;'>" . Xml::label($this->msg('unreviewedpages-category')->text(), 'category') . '&#160;' . Xml::input('category', 30, $this->category, array('id' => 'category')) . '</span><br />';
     $form .= $showhideredirs . '&#160;&#160;';
     $form .= Xml::submitButton($this->msg('allpagessubmit')->text());
     $form .= '</fieldset>';
     $form .= Html::closeElement('form') . "\n";
     # Query may get too slow to be live...
     if (!$this->live) {
         $dbr = wfGetDB(DB_SLAVE);
         $ts = $dbr->selectField('querycache_info', 'qci_timestamp', array('qci_type' => 'fr_unreviewedpages'), __METHOD__);
         if ($ts) {
             $ts = wfTimestamp(TS_MW, $ts);
             $td = $this->getLanguage()->timeanddate($ts);
             $d = $this->getLanguage()->date($ts);
             $t = $this->getLanguage()->time($ts);
             $form .= $this->msg('perfcachedts', $td, $d, $t)->parseAsBlock();
         } else {
             $form .= $this->msg('perfcached')->parseAsBlock();
         }
     }
     $this->getOutput()->addHTML($form);
 }
 /**
  * Generate a form allowing users to enter information
  *
  * @param $title Value for context title field
  * @param $input Value for input textbox
  * @return string
  */
 private function makeForm($title, $input)
 {
     $self = $this->getTitle();
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
     $form .= "<fieldset><legend>" . wfMsgHtml('expandtemplates') . "</legend>\n";
     $form .= '<p>' . Xml::inputLabel(wfMsgNoTrans('expand_templates_title'), 'contexttitle', 'contexttitle', 60, $title) . '</p>';
     $form .= '<p>' . Xml::label(wfMsg('expand_templates_input'), 'input') . '</p>';
     $form .= Xml::openElement('textarea', array('name' => 'input', 'id' => 'input', 'rows' => 10, 'cols' => 10));
     $form .= htmlspecialchars($input);
     $form .= Xml::closeElement('textarea');
     $form .= '<p>' . Xml::checkLabel(wfMsg('expand_templates_remove_comments'), 'removecomments', 'removecomments', $this->removeComments) . '</p>';
     $form .= '<p>' . Xml::checkLabel(wfMsg('expand_templates_remove_nowiki'), 'removenowiki', 'removenowiki', $this->removeNowiki) . '</p>';
     if ($this->isNewParser) {
         $form .= '<p>' . Xml::checkLabel(wfMsg('expand_templates_generate_xml'), 'generate_xml', 'generate_xml', $this->generateXML) . '</p>';
     }
     $form .= '<p>' . Xml::submitButton(wfMsg('expand_templates_ok'), array('accesskey' => 's')) . '</p>';
     $form .= "</fieldset>\n";
     $form .= Xml::closeElement('form');
     return $form;
 }
/**
 * Add new fields (1 shown + 1-5 hidden ones) to Special:Contact.
 *
 * @param $contactForm Object: instance of EmailContactForm class
 * @param $form Sringt: HTML
 * @return Boolean: true
 */
function addContactFormFields($contactForm, $form)
{
    global $wgServer, $wgDBname;
    $form .= '<tr>
				<td class="mw-label">' . Xml::label(wfMsg('contactpage-wikiurl'), 'wpWikiURL') . '</td>
				<td class="mw-input" id="mw-contactpage-address">' . Xml::input('wpWikiURL', 60, $wgServer, array('type' => 'text', 'maxlength' => 200)) . '</td>
			</tr>
			<tr>' . Html::Hidden('wpDBname', $wgDBname, array('maxlength' => 100)) . "</tr>\n\t\t\t";
    if (class_exists('MyInfo')) {
        $myinfo = new MyInfo();
        $myinfo->browser = get_browser(null, true);
        $myinfo->info = browser_detection('full');
        $myinfo->info[] = browser_detection('moz_version');
        $form .= '<tr>' . Html::Hidden('wpBrowser', $myinfo->getBrowser(), array('maxlength' => 255)) . '</tr>
			<tr>' . Html::Hidden('wpOperatingSystem', $myinfo->getOs(), array('maxlength' => 255)) . '</tr>
			<tr>' . Html::Hidden('wpSkinName', $myinfo->getSkin(), array('maxlength' => 35)) . '</tr>
			<tr>' . Html::Hidden('wpUserAgent', $myinfo->getUAgent(), array('maxlength' => 500)) . '</tr>';
    }
    return true;
}
 public function showForm()
 {
     global $wgScript;
     // Add explanatory text
     $this->getOutput()->addWikiMsg('problemchanges-list', $this->getLanguage()->formatNum($this->pager->getNumRows()));
     $form = Html::openElement('form', array('name' => 'problemchanges', 'action' => $wgScript, 'method' => 'get')) . "\n";
     $form .= "<fieldset><legend>" . $this->msg('problemchanges-legend')->escaped() . "</legend>\n";
     $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
     $form .= FlaggedRevs::qualityVersions() ? "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span> ' : "";
     $tagForm = ChangeTags::buildTagFilterSelector($this->tag);
     if (count($tagForm)) {
         $form .= Xml::tags('td', array('class' => 'mw-label'), $tagForm[0]);
         $form .= Xml::tags('td', array('class' => 'mw-input'), $tagForm[1]);
     }
     $form .= '<br />' . Xml::label($this->msg("problemchanges-category")->text(), 'wpCategory') . '&#160;' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory')) . ' ';
     $form .= Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n";
     $form .= '</fieldset>';
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
 function pretty($fields)
 {
     $out = '';
     foreach ($fields as $list) {
         list($name, $label, $type, $value) = $list;
         if ($type == 'text') {
             $field = '<tt>' . htmlspecialchars($value) . '</tt>';
         } else {
             $field = Xml::input($name, 20, $value, array('id' => $name, 'type' => $type));
         }
         $out .= '<tr>';
         $out .= '<td align="right">';
         $out .= Xml::label(wfMsg($label), $name);
         $out .= '</td>';
         $out .= '<td>';
         $out .= $field;
         $out .= '</td>';
         $out .= '</tr>';
     }
     return $out;
 }
 /**
  * Message input fieldset
  *
  * @param $title Title (default: null)
  * @return \string HTML for fieldset.
  */
 function namespaceMessageForm(Title $title = null)
 {
     global $wgScript;
     $namespaces = new XmlSelect('namespace', 'namespace');
     $namespaces->setDefault($title->getNamespace());
     foreach ($this->getSortedNamespaces() as $text => $index) {
         $namespaces->addOption($text, $index);
     }
     $out = Xml::openElement('div', array('class' => 'namespaceoptions'));
     $out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $out .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $out .= Xml::openElement('fieldset');
     $out .= Xml::element('legend', null, wfMsg('translate-translations-fieldset-title'));
     $out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
     $out .= "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('translate-translations-messagename'), 'message') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('message', 30, $title->getText(), array('id' => 'message')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('translate-translations-project'), 'namespace') . "</td>\n\t\t\t\t<td class='mw-input'>" . $namespaces->getHTML() . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "</td>\n\t\t\t\t</tr>";
     $out .= Xml::closeElement('table');
     $out .= Xml::closeElement('fieldset');
     $out .= Xml::closeElement('form');
     $out .= Xml::closeElement('div');
     return $out;
 }
 /**
  * Show the special page
  *
  * @param mixed $par Parameter passed to the page
  */
 public function execute($par)
 {
     global $wgOut, $wgUser, $wgTitle, $wgRequest, $wgContLang, $wgLang;
     global $wgVersion, $wgMaxNameChars, $wgCapitalLinks;
     $this->setHeaders();
     if (!$wgUser->isAllowed('renameuser')) {
         $wgOut->permissionRequired('renameuser');
         return;
     }
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     $showBlockLog = $wgRequest->getBool('submit-showBlockLog');
     $oldusername = Title::newFromText($wgRequest->getText('oldusername'), NS_USER);
     $newusername = Title::newFromText($wgContLang->ucfirst($wgRequest->getText('newusername')), NS_USER);
     // Force uppercase of newusername otherweise wikis with wgCapitalLinks=false can create lc usernames
     $oun = is_object($oldusername) ? $oldusername->getText() : '';
     $nun = is_object($newusername) ? $newusername->getText() : '';
     $token = $wgUser->editToken();
     $reason = $wgRequest->getText('reason');
     $is_checked = true;
     if ($wgRequest->wasPosted() && !$wgRequest->getCheck('movepages')) {
         $is_checked = false;
     }
     $wgOut->addHTML("\n\t\t\t<!-- Current contributions limit is " . RENAMEUSER_CONTRIBLIMIT . " -->" . Xml::openElement('form', array('method' => 'post', 'action' => $wgTitle->getLocalUrl(), 'id' => 'renameuser')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('renameuser')) . Xml::openElement('table', array('id' => 'mw-renameuser-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('renameuserold'), 'oldusername') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('oldusername', 20, $oun, array('type' => 'text', 'tabindex' => '1')) . ' ' . Xml::submitButton(wfMsg('blocklogpage'), array('name' => 'submit-showBlockLog', 'id' => 'submit-showBlockLog', 'tabindex' => '2')) . ' ' . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('renameusernew'), 'newusername') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('newusername', 20, $nun, array('type' => 'text', 'tabindex' => '3')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('renameuserreason'), 'reason') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('reason', 40, $reason, array('type' => 'text', 'tabindex' => '4', 'maxlength' => 255)) . "</td>\n\t\t\t</tr>");
     if ($wgUser->isAllowed('move') && version_compare($wgVersion, '1.9alpha', '>=')) {
         $wgOut->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td>&nbsp;\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('renameusermove'), 'movepages', 'movepages', $is_checked, array('tabindex' => '5')) . "</td>\n\t\t\t\t</tr>");
     }
     $wgOut->addHTML("\n\t\t\t<tr>\n\t\t\t\t<td>&nbsp;\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMsg('renameusersubmit'), array('name' => 'submit', 'tabindex' => '6', 'id' => 'submit')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . Xml::hidden('token', $token) . Xml::closeElement('form') . "\n");
     // Show block log if requested
     if ($showBlockLog && is_object($oldusername)) {
         $this->showLogExtract($oldusername, 'block', $wgOut);
         return;
     }
     if ($wgRequest->getText('token') === '') {
         # They probably haven't even submitted the form, so don't go further.
         return;
     } elseif (!$wgRequest->wasPosted() || !$wgUser->matchEditToken($wgRequest->getVal('token'))) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameuser-error-request') . "</div>");
         return;
     } elseif (!is_object($oldusername)) {
         // FIXME: This is bogus.  Invalid titles need to be rename-able! (bug 12654)
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrorinvalid', $wgRequest->getText('oldusername')) . "</div>");
         return;
     } elseif (!is_object($newusername)) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrorinvalid', $wgRequest->getText('newusername')) . "</div>");
         return;
     } elseif ($oldusername->getText() == $newusername->getText()) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameuser-error-same-user') . "</div>");
         return;
     }
     // Suppress username validation of old username
     $olduser = User::newFromName($oldusername->getText(), false);
     $newuser = User::newFromName($newusername->getText());
     // It won't be an object if for instance "|" is supplied as a value
     if (!is_object($olduser)) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrorinvalid', $oldusername->getText()) . "</div>");
         return;
     }
     if (!is_object($newuser) || !User::isCreatableName($newuser->getName())) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrorinvalid', $newusername->getText()) . "</div>");
         return;
     }
     // Check for the existence of lowercase oldusername in database.
     // Until r19631 it was possible to rename a user to a name with first character as lowercase
     if ($wgRequest->getText('oldusername') !== $wgContLang->ucfirst($wgRequest->getText('oldusername'))) {
         // oldusername was entered as lowercase -> check for existence in table 'user'
         $dbr_lc = wfGetDB(DB_SLAVE);
         $s = trim($wgRequest->getText('oldusername'));
         $uid = $dbr_lc->selectField('user', 'user_id', array('BINARY user_name' => $s), __METHOD__);
         if ($uid === false) {
             $uid = 0;
             #	if ( !$wgCapitalLinks ) {
             #		$uid = 0; // We are on a lowercase wiki but lowercase username does not exists
             #	} else {
             #		$uid = $olduser->idForName(); // We are on a standard uppercase wiki, use normal
             #	}
         } else {
             // username with lowercase exists
             // Title::newFromText was nice, but forces uppercase
             // for older rename accidents on lowercase wikis we need the lowercase username as entered in the form
             $oldusername->mTextform = $wgRequest->getText('oldusername');
             $oldusername->mUrlform = $wgRequest->getText('oldusername');
             $oldusername->mDbkeyform = $wgRequest->getText('oldusername');
         }
     } else {
         // oldusername was entered as upperase -> standard procedure
         $uid = $olduser->idForName();
     }
     if ($uid == 0) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrordoesnotexist', $wgRequest->getText('oldusername')) . "</div>");
         return;
     }
     if ($newuser->idForName() != 0) {
         $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrorexists', $newusername->getText()) . "</div>");
         return;
     }
     // Always get the edits count, it will be used for the log message
     $contribs = User::edits($uid);
     // Check edit count
     if (!$wgUser->isAllowed('siteadmin')) {
         if (RENAMEUSER_CONTRIBLIMIT != 0 && $contribs > RENAMEUSER_CONTRIBLIMIT) {
             $wgOut->addWikiText("<div class=\"errorbox\">" . wfMsg('renameusererrortoomany', $oldusername->getText(), $wgLang->formatNum($contribs), $wgLang->formatNum(RENAMEUSER_CONTRIBLIMIT)) . "</div>");
             return;
         }
     }
     // Give other affected extensions a chance to validate or abort
     if (!wfRunHooks('RenameUserAbort', array($uid, $oldusername->getText(), $newusername->getText()))) {
         return;
     }
     $rename = new RenameuserSQL($oldusername->getText(), $newusername->getText(), $uid);
     $rename->rename();
     $log = new LogPage('renameuser');
     $log->addEntry('renameuser', $oldusername, wfMsgExt('renameuser-log', array('parsemag', 'content'), $wgContLang->formatNum($contribs), $reason), $newusername->getText());
     $wgOut->addWikiText("<div class=\"successbox\">" . wfMsg('renameusersuccess', $oldusername->getText(), $newusername->getText()) . "</div><br style=\"clear:both\" />");
     if ($wgRequest->getCheck('movepages') && $wgUser->isAllowed('move') && version_compare($wgVersion, '1.9alpha', '>=')) {
         $dbr =& wfGetDB(DB_SLAVE);
         $oldkey = $oldusername->getDBkey();
         $pages = $dbr->select('page', array('page_namespace', 'page_title'), array('page_namespace IN (' . NS_USER . ',' . NS_USER_TALK . ')', '(page_title LIKE ' . $dbr->addQuotes($dbr->escapeLike($oldusername->getDBkey()) . '/%') . ' OR page_title = ' . $dbr->addQuotes($oldusername->getDBkey()) . ')'), __METHOD__);
         $output = '';
         $skin =& $wgUser->getSkin();
         while ($row = $dbr->fetchObject($pages)) {
             $oldPage = Title::makeTitleSafe($row->page_namespace, $row->page_title);
             $newPage = Title::makeTitleSafe($row->page_namespace, preg_replace('!^[^/]+!', $newusername->getDBkey(), $row->page_title));
             if ($newPage->exists() && !$oldPage->isValidMoveTarget($newPage)) {
                 $link = $skin->makeKnownLinkObj($newPage);
                 $output .= '<li class="mw-renameuser-pe">' . wfMsgHtml('renameuser-page-exists', $link) . '</li>';
             } else {
                 $success = $oldPage->moveTo($newPage, false, wfMsgForContent('renameuser-move-log', $oldusername->getText(), $newusername->getText()));
                 if ($success === true) {
                     $oldLink = $skin->makeKnownLinkObj($oldPage, '', 'redirect=no');
                     $newLink = $skin->makeKnownLinkObj($newPage);
                     $output .= '<li class="mw-renameuser-pm">' . wfMsgHtml('renameuser-page-moved', $oldLink, $newLink) . '</li>';
                 } else {
                     $oldLink = $skin->makeKnownLinkObj($oldPage);
                     $newLink = $skin->makeLinkObj($newPage);
                     $output .= '<li class="mw-renameuser-pu">' . wfMsgHtml('renameuser-page-unmoved', $oldLink, $newLink) . '</li>';
                 }
             }
         }
         if ($output) {
             $wgOut->addHtml('<ul>' . $output . '</ul>');
         }
     }
 }
Exemple #28
0
 /**
  * Same as Xml::inputLabel() but return input and label in an array
  *
  * @param string $label
  * @param string $name
  * @param string $id
  * @param int|bool $size
  * @param string|bool $value
  * @param array $attribs
  *
  * @return array
  */
 public static function inputLabelSep($label, $name, $id, $size = false, $value = false, $attribs = array())
 {
     return array(Xml::label($label, $id, $attribs), self::input($name, $size, $value, array('id' => $id) + $attribs));
 }
 /**
  * @param $fields array
  * @return string
  */
 protected function pretty($fields)
 {
     $out = '';
     foreach ($fields as $list) {
         list($name, $label, $type, $value) = $list;
         if ($type == 'text') {
             $field = htmlspecialchars($value);
         } else {
             $attribs = array('id' => $name);
             if ($name == 'wpPassword') {
                 $attribs[] = 'autofocus';
             }
             $field = Html::input($name, $value, $type, $attribs);
         }
         $out .= "<tr>\n";
         $out .= "\t<td class='mw-label'>";
         if ($type != 'text') {
             $out .= Xml::label($this->msg($label)->text(), $name);
         } else {
             $out .= $this->msg($label)->escaped();
         }
         $out .= "</td>\n";
         $out .= "\t<td class='mw-input'>";
         $out .= $field;
         $out .= "</td>\n";
         $out .= "</tr>";
     }
     return $out;
 }
 /**
  * Creates the input label of the restriction level
  * @param string $pr_level Protection level
  * @return string Formatted HTML
  */
 protected function getLevelMenu($pr_level)
 {
     // Temporary array
     $m = array($this->msg('restriction-level-all')->text() => 0);
     $options = array();
     // First pass to load the log names
     foreach ($this->getConfig()->get('RestrictionLevels') as $type) {
         // Messages used can be 'restriction-level-sysop' and 'restriction-level-autoconfirmed'
         if ($type != '' && $type != '*') {
             $text = $this->msg("restriction-level-{$type}")->text();
             $m[$text] = $type;
         }
     }
     // Third pass generates sorted XHTML content
     foreach ($m as $text => $type) {
         $selected = $type == $pr_level;
         $options[] = Xml::option($text, $type, $selected);
     }
     return '<span class="mw-input-with-label">' . Xml::label($this->msg('restriction-level')->text(), $this->IdLevel) . ' ' . Xml::tags('select', array('id' => $this->IdLevel, 'name' => $this->IdLevel), implode("\n", $options)) . "</span>";
 }