/**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             // date and time are separate parameters to facilitate localisation.
             // $time is kept for backward compat reasons.
             // 'emailauthenticated' is also used in SpecialPreferences.php
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $d = $wgLang->date($wgUser->mEmailAuthenticated, true);
             $t = $wgLang->time($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time, $d, $t);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->wrapWikiMsg("<div class=\"error mw-confirmemail-pending\">\n\$1</div>", 'confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl()));
         $form .= Xml::hidden('token', $wgUser->editToken());
         $form .= Xml::submitButton(wfMsg('confirmemail_send'));
         $form .= Xml::closeElement('form');
         $wgOut->addHTML($form);
     }
 }
	/**
	 * Helper function to display a hidden field for different versions
	 * of MediaWiki.
	 */
	static function hiddenField( $name, $value ) {
		if ( class_exists( 'Html' ) ) {
			return "\t" . Html::hidden( $name, $value ) . "\n";
		} else {
			return "\t" . Xml::hidden( $name, $value ) . "\n";
		}
	}
 function showForm($err = '')
 {
     global $wgOut, $wgUser, $wgLang;
     $wgOut->setPagetitle(wfMsg("makesysoptitle"));
     $wgOut->addWikiText(wfMsg("makesysoptext"));
     $titleObj = Title::makeTitle(NS_SPECIAL, "Makesysop");
     $action = $titleObj->getLocalUrl("action=submit");
     if ($wgUser->isAllowed('userrights')) {
         $wgOut->addWikiText(wfMsg('makesysop-see-userrights'));
     }
     if ("" != $err) {
         $wgOut->setSubtitle(wfMsg("formerror"));
         $wgOut->addHTML("<p class='error'>{$err}</p>\n");
     }
     $namedesc = wfMsg("makesysopname");
     if (!is_null($this->mUser)) {
         $encUser = htmlspecialchars($this->mUser);
     } else {
         $encUser = "";
     }
     $reason = htmlspecialchars(wfMsg("userrights-reason"));
     $makebureaucrat = wfMsg("setbureaucratflag");
     $mss = wfMsg("set_user_rights");
     $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'makesysop')) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('makesysoptitle')) . "<table border='0'>\n\t\t\t<tr>\n\t\t\t\t<td align='right'>{$namedesc}</td>\n\t\t\t\t<td align='left'>" . Xml::input('wpMakesysopUser', 40, $encUser) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td align='right'>{$reason}</td>\n\t\t\t\t<td align='left'>" . Xml::input('wpMakesysopReason', 40, $this->mReason, array('maxlength' => 255)) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td align='left'>" . Xml::checkLabel($makebureaucrat, 'wpSetBureaucrat', 'wpSetBureaucrat', $this->mSetBureaucrat) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td align='left'>" . Xml::submitButton($mss, array('name' => 'wpMakesysopSubmit')) . "</td>\n\t\t\t</tr>\n\t\t\t</table>" . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
 function show()
 {
     global $wgOut, $wgUser, $wgRequest;
     AbuseFilter::disableConditionLimit();
     if (!$wgUser->isAllowed('abusefilter-modify')) {
         $wgOut->addWikiMsg('abusefilter-mustbeeditor');
         return;
     }
     $this->loadParameters();
     $wgOut->setPageTitle(wfMsg('abusefilter-test'));
     $wgOut->addWikiMsg('abusefilter-test-intro', self::$mChangeLimit);
     $output = '';
     $output .= AbuseFilter::buildEditBox($this->mFilter, 'wpTestFilter') . "\n";
     $output .= Xml::inputLabel(wfMsg('abusefilter-test-load-filter'), 'wpInsertFilter', 'mw-abusefilter-load-filter', 10, '') . '&nbsp;' . Xml::element('input', array('type' => 'button', 'value' => wfMsg('abusefilter-test-load'), 'id' => 'mw-abusefilter-load'));
     $output = Xml::tags('div', array('id' => 'mw-abusefilter-test-editor'), $output);
     $output .= Xml::tags('p', null, Xml::checkLabel(wfMsg('abusefilter-test-shownegative'), 'wpShowNegative', 'wpShowNegative', $this->mShowNegative));
     // Selectory stuff
     $selectFields = array();
     $selectFields['abusefilter-test-user'] = Xml::input('wpTestUser', 45, $this->mTestUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpTestPeriodStart', 45, $this->mTestPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpTestPeriodEnd', 45, $this->mTestPeriodEnd);
     $selectFields['abusefilter-test-page'] = Xml::input('wpTestPage', 45, $this->mTestPage);
     $output .= Xml::buildForm($selectFields, 'abusefilter-test-submit');
     $output .= Xml::hidden('title', $this->getTitle('test')->getPrefixedText());
     $output = Xml::tags('form', array('action' => $this->getTitle('test')->getLocalURL(), 'method' => 'POST'), $output);
     $output = Xml::fieldset(wfMsg('abusefilter-test-legend'), $output);
     $wgOut->addHTML($output);
     if ($wgRequest->wasPosted()) {
         $this->doTest();
     }
 }
    /**
     * Show the form for retrieving a user's current avatar
     * @return HTML
     */
    private function showUserForm()
    {
        $output = '<form method="get" name="avatar" action="">' . Xml::hidden('title', $this->getTitle()) . '<b>' . wfMsg('username') . '</b>
				<input type="text" name="user" />
				<input type="submit" value="' . wfMsg('search') . '" />
			</form>';
        return $output;
    }
 /**
  * @param $namespace int
  * @param $type string
  * @param $level string
  * @param $minsize int
  * @private
  */
 function showOptions($namespace, $type = 'edit', $level, $sizetype, $size)
 {
     global $wgScript;
     $action = htmlspecialchars($wgScript);
     $title = SpecialPage::getTitleFor('ProtectedTitles');
     $special = htmlspecialchars($title->getPrefixedDBkey());
     return "<form action=\"{$action}\" method=\"get\">\n" . '<fieldset>' . Xml::element('legend', array(), wfMsg('protectedtitles')) . Xml::hidden('title', $special) . "&nbsp;\n" . $this->getNamespaceMenu($namespace) . "&nbsp;\n" . $this->getLevelMenu($level) . "&nbsp;\n" . "&nbsp;" . Xml::submitButton(wfMsg('allpagessubmit')) . "\n" . "</fieldset></form>";
 }
Beispiel #7
0
 /**
  * Show options for the log list
  * @param $type String
  * @param $user String
  * @param $page String
  * @param $pattern String
  * @param $year Integer: year
  * @param $month Integer: month
  * @param $filter Boolean
  */
 public function showOptions($type = '', $user = '', $page = '', $pattern = '', $year = '', $month = '', $filter = null)
 {
     global $wgScript, $wgMiserMode;
     $action = htmlspecialchars($wgScript);
     $title = SpecialPage::getTitleFor('Log');
     $special = htmlspecialchars($title->getPrefixedDBkey());
     $this->out->addHTML("<form action=\"{$action}\" method=\"get\"><fieldset>" . Xml::element('legend', array(), wfMsg('log')) . Xml::hidden('title', $special) . "\n" . $this->getTypeMenu($type) . "\n" . $this->getUserInput($user) . "\n" . $this->getTitleInput($page) . "\n" . (!$wgMiserMode ? $this->getTitlePattern($pattern) . "\n" : "") . "<p>" . $this->getDateMenu($year, $month) . "\n" . ($filter ? "</p><p>" . $this->getFilterLinks($type, $filter) . "\n" : "") . Xml::submitButton(wfMsg('allpagessubmit')) . "</p>\n" . "</fieldset></form>");
 }
Beispiel #8
0
 /** Produce a nice little form */
 function getForm()
 {
     list($sum, $answer) = $this->pickSum();
     $index = $this->storeCaptcha(array('answer' => $answer));
     $form = '<table><tr><td>' . $this->fetchMath($sum) . '</td>';
     $form .= '<td>' . Xml::input('wpCaptchaWord', false, false, array('tabindex' => '1')) . '</td></tr></table>';
     $form .= Xml::hidden('wpCaptchaId', $index);
     return $form;
 }
 public function fooBarBaz($par)
 {
     global $wgBarBarBar, $wgUser;
     if ($par) {
         return;
     }
     $wgBarBarBar->dobar(Xml::fieldset(wfMessage('importinterwiki')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $par, 'id' => 'mw-import-interwiki-form')) . wfMessage('import-interwiki-text')->parse() . Xml::hidden('action', 'submit') . Xml::hidden('source', 'interwiki') . Xml::hidden('editToken', $wgUser->editToken()), 'secondArgument');
     $foo = $par;
     return $foo + $wgBarBarBar + $this->foo;
 }
 function getPageHeader()
 {
     global $wgScript, $wgMiserMode;
     # Do not show useless input form if wiki is running in misermode
     if ($wgMiserMode) {
         return '';
     }
     $prefix = $this->prefix;
     $t = SpecialPage::getTitleFor($this->getName());
     return Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('withoutinterwiki-legend')) . Xml::hidden('title', $t->getPrefixedText()) . Xml::inputLabel(wfMsg('allpagesprefix'), 'prefix', 'wiprefix', 20, $prefix) . ' ' . Xml::submitButton(wfMsg('withoutinterwiki-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
 }
Beispiel #11
0
/**
 * Output the HTML search form, and constructs the MIMEsearchPage object.
 */
function wfSpecialMIMEsearch($par = null)
{
    global $wgRequest, $wgOut;
    $mime = isset($par) ? $par : $wgRequest->getText('mime');
    $wgOut->addHTML(Xml::openElement('form', array('id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor('MIMEsearch')->getLocalUrl())) . Xml::openElement('fieldset') . Xml::hidden('title', SpecialPage::getTitleFor('MIMEsearch')->getPrefixedText()) . Xml::element('legend', null, wfMsg('mimesearch')) . Xml::inputLabel(wfMsg('mimetype'), 'mime', 'mime', 20, $mime) . ' ' . Xml::submitButton(wfMsg('ilsubmit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
    list($major, $minor) = wfSpecialMIMEsearchParse($mime);
    if ($major == '' or $minor == '' or !wfSpecialMIMEsearchValidType($major)) {
        return;
    }
    $wpp = new MIMEsearchPage($major, $minor);
    list($limit, $offset) = wfCheckLimits();
    $wpp->doQuery($offset, $limit);
}
 /**
  * Generate a form to allow users to enter an ISBN
  *
  * @return string
  */
 private function makeForm()
 {
     global $wgScript;
     $title = self::getTitleFor('Booksources');
     $form = '<fieldset><legend>' . wfMsgHtml('booksources-search-legend') . '</legend>';
     $form .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $form .= Xml::hidden('title', $title->getPrefixedText());
     $form .= '<p>' . Xml::inputLabel(wfMsg('booksources-isbn'), 'isbn', 'isbn', 20, $this->isbn);
     $form .= '&nbsp;' . Xml::submitButton(wfMsg('booksources-go')) . '</p>';
     $form .= Xml::closeElement('form');
     $form .= '</fieldset>';
     return $form;
 }
Beispiel #13
0
    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;
    }
Beispiel #14
0
 /**
  * Show the confirmation form
  */
 protected function showForm()
 {
     global $wgOut, $wgUser, $wgRequest, $wgLang, $wgContLang;
     $timestamp = $this->getTimestamp();
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getAction()));
     $form .= Xml::hidden('wpEditToken', $wgUser->editToken($this->archiveName));
     $form .= '<fieldset><legend>' . wfMsgHtml('filerevert-legend') . '</legend>';
     $form .= wfMsgExt('filerevert-intro', 'parse', $this->title->getText(), $wgLang->date($timestamp, true), $wgLang->time($timestamp, true), wfExpandUrl($this->file->getArchiveUrl($this->archiveName)));
     $form .= '<p>' . Xml::inputLabel(wfMsg('filerevert-comment'), 'wpComment', 'wpComment', 60, wfMsgForContent('filerevert-defaultcomment', $wgContLang->date($timestamp, false, false), $wgContLang->time($timestamp, false, false))) . '</p>';
     $form .= '<p>' . Xml::submitButton(wfMsg('filerevert-submit')) . '</p>';
     $form .= '</fieldset>';
     $form .= '</form>';
     $wgOut->addHTML($form);
 }
 /**
  * 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;
 }
Beispiel #16
0
/**
 * Special:LinkSearch to search the external-links table.
 */
function wfSpecialLinkSearch($par)
{
    list($limit, $offset) = wfCheckLimits();
    global $wgOut, $wgRequest, $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 = '';
    }
    $wgOut->allowClickjacking();
    $self = Title::makeTitle(NS_SPECIAL, 'Linksearch');
    $wgOut->addWikiMsg('linksearch-text', '<nowiki>' . $wgLang->commaList($wgUrlProtocols) . '</nowiki>');
    $s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Xml::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);
    }
}
 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;
 }
Beispiel #19
0
 function searchForm()
 {
     global $wgOut, $wgUser;
     $output = Xml::element('legend', null, wfMsg('abusefilter-log-search'));
     $fields = array();
     // Search conditions
     $fields['abusefilter-log-search-user'] = Xml::input('wpSearchUser', 45, $this->mSearchUser);
     if ($this->canSeeDetails()) {
         $fields['abusefilter-log-search-filter'] = Xml::input('wpSearchFilter', 45, $this->mSearchFilter);
     }
     $fields['abusefilter-log-search-title'] = Xml::input('wpSearchTitle', 45, $this->mSearchTitle);
     $form = Xml::hidden('title', $this->getTitle()->getPrefixedText());
     $form .= Xml::buildForm($fields, 'abusefilter-log-search-submit');
     $output .= Xml::tags('form', array('method' => 'GET', 'action' => $this->getTitle()->getLocalURL()), $form);
     $output = Xml::tags('fieldset', null, $output);
     $wgOut->addHTML($output);
 }
 function show()
 {
     $filter = $this->mPage->mFilter;
     global $wgUser, $wgRequest, $wgOut;
     $sk = $wgUser->getSkin();
     if (!$wgUser->isAllowed('abusefilter-revert')) {
         $wgOut->permissionRequired('abusefilter-revert');
         return;
     }
     $this->loadParameters();
     if ($this->attemptRevert()) {
         return;
     }
     $wgOut->addWikiMsg('abusefilter-revert-intro', $filter);
     $wgOut->setPageTitle(wfMsg('abusefilter-revert-title', $filter));
     // First, the search form.
     $searchFields = array();
     $searchFields['abusefilter-revert-filter'] = Xml::element('strong', null, $filter);
     $searchFields['abusefilter-revert-periodstart'] = Xml::input('wpPeriodStart', 45, $this->origPeriodStart);
     $searchFields['abusefilter-revert-periodend'] = Xml::input('wpPeriodEnd', 45, $this->origPeriodEnd);
     $searchForm = Xml::buildForm($searchFields, 'abusefilter-revert-search');
     $searchForm .= "\n" . Xml::hidden('submit', 1);
     $searchForm = Xml::tags('form', array('action' => $this->getTitle("revert/{$filter}")->getLocalURL(), 'method' => 'POST'), $searchForm);
     $searchForm = Xml::fieldset(wfMsg('abusefilter-revert-search-legend'), $searchForm);
     $wgOut->addHTML($searchForm);
     if ($this->mSubmit) {
         // Add a summary of everything that will be reversed.
         $wgOut->addWikiMsg('abusefilter-revert-preview-intro');
         // Look up all of them.
         $results = $this->doLookup();
         $list = array();
         foreach ($results as $result) {
             $displayActions = array();
             global $wgLang;
             $displayActions = array_map(array('AbuseFilter', 'getActionDisplay'), $result['actions']);
             $msg = wfMsgExt('abusefilter-revert-preview-item', array('parseinline', 'replaceafter'), array($wgLang->timeanddate($result['timestamp'], true), $sk->userLink($result['userid'], $result['user']), $result['action'], $sk->link($result['title']), $wgLang->commaList($displayActions), $sk->link(SpecialPage::getTitleFor('AbuseLog'), wfMsgNoTrans('abusefilter-log-detailslink'), array(), array('details' => $result['id']))));
             $list[] = Xml::tags('li', null, $msg);
         }
         $wgOut->addHTML(Xml::tags('ul', null, implode("\n", $list)));
         // Add a button down the bottom.
         $confirmForm = Xml::hidden('editToken', $wgUser->editToken("abusefilter-revert-{$filter}")) . Xml::hidden('title', $this->getTitle("revert/{$filter}")->getPrefixedText()) . Xml::hidden('wpPeriodStart', $this->origPeriodStart) . Xml::hidden('wpPeriodEnd', $this->origPeriodEnd) . Xml::inputLabel(wfMsg('abusefilter-revert-reasonfield'), 'wpReason', 'wpReason', 45) . "\n" . Xml::submitButton(wfMsg('abusefilter-revert-confirm'));
         $confirmForm = Xml::tags('form', array('action' => $this->getTitle("revert/{$filter}")->getLocalURL(), 'method' => 'post'), $confirmForm);
         $wgOut->addHTML($confirmForm);
     }
 }
 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;
 }
Beispiel #22
0
 function showForm()
 {
     global $wgOut, $wgUser, $wgRequest;
     $wgOut->disallowUserJs();
     $self = SpecialPage::getTitleFor('Resetpass');
     if (!$this->mUserName) {
         $this->mUserName = $wgUser->getName();
     }
     $rememberMe = '';
     if (!$wgUser->isLoggedIn()) {
         $rememberMe = '<tr>' . '<td></td>' . '<td class="mw-input">' . Xml::checkLabel(wfMsg('remembermypassword'), 'wpRemember', 'wpRemember', $wgRequest->getCheck('wpRemember')) . '</td>' . '</tr>';
         $submitMsg = 'resetpass_submit';
         $oldpassMsg = 'resetpass-temp-password';
     } else {
         $oldpassMsg = 'oldpassword';
         $submitMsg = 'resetpass-submit-loggedin';
     }
     $wgOut->addHTML(Xml::fieldset(wfMsg('resetpass_header')) . Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl(), 'id' => 'mw-resetpass-form')) . Xml::hidden('token', $wgUser->editToken()) . Xml::hidden('wpName', $this->mUserName) . Xml::hidden('returnto', $wgRequest->getVal('returnto')) . wfMsgExt('resetpass_text', array('parse')) . Xml::openElement('table', array('id' => 'mw-resetpass-table')) . $this->pretty(array(array('wpName', 'username', 'text', $this->mUserName), array('wpPassword', $oldpassMsg, 'password', $this->mOldpass), array('wpNewPassword', 'newpassword', 'password', ''), array('wpRetype', 'retypenew', 'password', ''))) . $rememberMe . '<tr>' . '<td></td>' . '<td class="mw-input">' . Xml::submitButton(wfMsg($submitMsg)) . '</td>' . '</tr>' . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset'));
 }
 function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser;
     wfLoadExtensionMessages('UserExport');
     $this->setHeaders();
     if (!$wgUser->isAllowed('userexport')) {
         $wgOut->permissionRequired('userexport');
         return;
     }
     if ($wgRequest->getText('exportusers')) {
         if (!$wgUser->matchEditToken($wgRequest->getVal('token'))) {
             // bad edit token
             $wgOut->addHtml("<span style=\"color: red;\">" . wfMsg('userexport-badtoken') . "</span><br />\n");
         } else {
             $this->exportUsers();
         }
     }
     $wgOut->addHTML(Xml::openElement('p') . wfMsg('userexport-description') . Xml::closeElement('p') . Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'userexportform')) . Xml::submitButton(wfMsg('userexport-submit')) . Xml::hidden('token', $wgUser->editToken()) . Xml::hidden('exportusers', true) . Xml::closeElement('form') . "\n");
 }
function wfSpecialRemoveRestrictions()
{
    global $wgOut, $wgRequest, $wgUser, $wgLang;
    $sk = $wgUser->getSkin();
    $title = SpecialPage::getTitleFor('RemoveRestrictions');
    $id = $wgRequest->getVal('id');
    if (!is_numeric($id)) {
        $wgOut->addWikiMsg('removerestrictions-noid');
        return;
    }
    UserRestriction::purgeExpired();
    $r = UserRestriction::newFromId($id, true);
    if (!$r) {
        $wgOut->addWikiMsg('removerestrictions-wrongid');
        return;
    }
    $form = array();
    $form['removerestrictions-user'] = $sk->userLink($r->getSubjectId(), $r->getSubjectText()) . $sk->userToolLinks($r->getSubjectId(), $r->getSubjectText());
    $form['removerestrictions-type'] = UserRestriction::formatType($r->getType());
    if ($r->isPage()) {
        $form['removerestrictions-page'] = $sk->link($r->getPage());
    }
    if ($r->isNamespace()) {
        $form['removerestrictions-namespace'] = $wgLang->getDisplayNsText($r->getNamespace());
    }
    $form['removerestrictions-reason'] = Xml::input('reason');
    $result = null;
    if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('edittoken'))) {
        $result = wfSpecialRemoveRestrictionsProcess($r);
    }
    $wgOut->addWikiMsg('removerestrictions-intro');
    $wgOut->addHTML(Xml::fieldset(wfMsgHtml('removerestrictions-legend')));
    if ($result) {
        $wgOut->addHTML('<strong class="success">' . wfMsgExt('removerestrictions-success', 'parseinline', $r->getSubjectText()) . '</strong>');
    }
    $wgOut->addHTML(Xml::openElement('form', array('action' => $title->getLocalUrl(array('id' => $id)), 'method' => 'post')));
    $wgOut->addHTML(Xml::buildForm($form, 'removerestrictions-submit'));
    $wgOut->addHTML(Xml::hidden('id', $r->getId()));
    $wgOut->addHTML(Xml::hidden('title', $title->getPrefixedDbKey()));
    $wgOut->addHTML(Xml::hidden('edittoken', $wgUser->editToken()));
    $wgOut->addHTML("</form></fieldset>");
}
/**
 * Output the HTML search form, and constructs the FileDuplicateSearch object.
 */
function wfSpecialFileDuplicateSearch($par = null)
{
    global $wgRequest, $wgOut, $wgLang, $wgContLang, $wgScript;
    $hash = '';
    $filename = isset($par) ? $par : $wgRequest->getText('filename');
    $title = Title::newFromText($filename);
    if ($title && $title->getText() != '') {
        $dbr = wfGetDB(DB_SLAVE);
        $image = $dbr->tableName('image');
        $encFilename = $dbr->addQuotes(htmlspecialchars($title->getDBKey()));
        $sql = "SELECT img_sha1 from {$image} where img_name = {$encFilename}";
        $res = $dbr->query($sql);
        $row = $dbr->fetchRow($res);
        if ($row !== false) {
            $hash = $row[0];
        }
        $dbr->freeResult($res);
    }
    # Create the input form
    $wgOut->addHTML(Xml::openElement('form', array('id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript)) . Xml::hidden('title', SpecialPage::getTitleFor('FileDuplicateSearch')->getPrefixedDbKey()) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('fileduplicatesearch-legend')) . Xml::inputLabel(wfMsg('fileduplicatesearch-filename'), 'filename', 'filename', 50, $filename) . ' ' . Xml::submitButton(wfMsg('fileduplicatesearch-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
    if ($hash != '') {
        $align = $wgContLang->isRtl() ? 'left' : 'right';
        # Show a thumbnail of the file
        $img = wfFindFile($title);
        if ($img) {
            $thumb = $img->transform(array('width' => 120, 'height' => 120));
            if ($thumb) {
                $wgOut->addHTML('<div style="float:' . $align . '" id="mw-fileduplicatesearch-icon">' . $thumb->toHtml(array('desc-link' => false)) . '<br />' . wfMsgExt('fileduplicatesearch-info', array('parse'), $wgLang->formatNum($img->getWidth()), $wgLang->formatNum($img->getHeight()), $wgLang->formatSize($img->getSize()), $img->getMimeType()) . '</div>');
            }
        }
        # Do the query
        $wpp = new FileDuplicateSearchPage($hash, $filename);
        list($limit, $offset) = wfCheckLimits();
        $count = $wpp->doQuery($offset, $limit);
        # Show a short summary
        if ($count == 1) {
            $wgOut->addHTML('<p class="mw-fileduplicatesearch-result-1">' . wfMsgHtml('fileduplicatesearch-result-1', $filename) . '</p>');
        } elseif ($count > 1) {
            $wgOut->addHTML('<p class="mw-fileduplicatesearch-result-n">' . wfMsgExt('fileduplicatesearch-result-n', array('parseinline'), $filename, $wgLang->formatNum($count - 1)) . '</p>');
        }
    }
}
 function showSearch()
 {
     global $wgUser, $wgOut;
     // Add selector
     $selector = '';
     $selectFields = array();
     # # Same fields as in Test
     $selectFields['abusefilter-test-user'] = Xml::input('wpSearchUser', 45, $this->mSearchUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpSearchPeriodStart', 45, $this->mSearchPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpSearchPeriodEnd', 45, $this->mSearchPeriodEnd);
     $selector .= Xml::buildForm($selectFields, 'abusefilter-examine-submit');
     $selector .= Xml::hidden('submit', 1);
     $selector .= Xml::hidden('title', $this->getTitle('examine')->getPrefixedText());
     $selector = Xml::tags('form', array('action' => $this->getTitle('examine')->getLocalURL(), 'method' => 'GET'), $selector);
     $selector = Xml::fieldset(wfMsg('abusefilter-examine-legend'), $selector);
     $wgOut->addHTML($selector);
     if ($this->mSubmit) {
         $this->showResults();
     }
 }
 function show()
 {
     global $wgRequest, $wgOut, $wgLang, $wgUser;
     $filter = $this->mFilter;
     if ($filter) {
         $wgOut->setPageTitle(wfMsg('abusefilter-history', $filter));
     } else {
         $wgOut->setPageTitle(wfMsg('abusefilter-filter-log'));
     }
     # Check perms
     if ($filter && !$wgUser->isAllowed('abusefilter-modify') && AbuseFilter::filterHidden($filter)) {
         $wgOut->addWikiMsg('abusefilter-history-error-hidden');
         return;
     }
     # Useful links
     $sk = $wgUser->getSkin();
     $links = array();
     if ($filter) {
         $links['abusefilter-history-backedit'] = $this->getTitle($filter);
     }
     foreach ($links as $msg => $title) {
         $links[$msg] = $sk->link($title, wfMsgExt($msg, 'parseinline'));
     }
     $backlinks = $wgLang->pipeList($links);
     $wgOut->addHTML(Xml::tags('p', null, $backlinks));
     # For user
     $user = $wgRequest->getText('user');
     if ($user) {
         $wgOut->setSubtitle(wfMsg('abusefilter-history-foruser', $sk->userLink(1, $user), $user));
     }
     // Add filtering of changes et al.
     $fields['abusefilter-history-select-user'] = Xml::input('user', 45, $user);
     $filterForm = Xml::buildForm($fields, 'abusefilter-history-select-submit');
     $filterForm .= "\n" . Xml::hidden('title', $this->getTitle("history/{$filter}"));
     $filterForm = Xml::tags('form', array('action' => $this->getTitle("history/{$filter}")->getLocalURL(), 'method' => 'get'), $filterForm);
     $filterForm = Xml::fieldset(wfMsg('abusefilter-history-select-legend'), $filterForm);
     $wgOut->addHTML($filterForm);
     $pager = new AbuseFilterHistoryPager($filter, $this, $user);
     $table = $pager->getBody();
     $wgOut->addHTML($pager->getNavigationBar() . $table . $pager->getNavigationBar());
 }
Beispiel #28
0
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     global $wgOut, $wgUser;
     $sk = $this->mSkin = $wgUser->getSkin();
     $output = '';
     $output .= Xml::element('h2', null, wfMsgExt('abusefilter-list', array('parseinline')));
     $pager = new AbuseFilterPager($this, $conds);
     extract($optarray);
     # Options form
     $options = '';
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-show'), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-hide'), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-only'), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel(wfMsg('abusefilter-list-options-hidedisabled'), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Xml::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset(wfMsg('abusefilter-list-options'), $options);
     $output .= $options;
     $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     $wgOut->addHTML($output);
 }
Beispiel #29
0
 function listForm($username, $reason)
 {
     global $wgUser, $wgOut, $wgLang;
     $pages = $this->getNewPages($username);
     if (count($pages) == 0) {
         $wgOut->addWikiMsg('nuke-nopages', $username);
         return $this->promptForm();
     }
     $wgOut->addWikiMsg('nuke-list', $username);
     $nuke = $this->getTitle();
     $submit = Xml::submitButton(wfMsg('nuke-submit-delete'));
     $wgOut->addHTML(Xml::openElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post')) . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::inputLabel(wfMsg('deletecomment'), 'wpReason', 'wpReason', 60, $reason) . '<br /><br />' . Xml::submitButton(wfMsg('nuke-submit-delete')));
     $wgOut->addHTML('<ul>');
     $sk = $wgUser->getSkin();
     foreach ($pages as $info) {
         list($title, $edits) = $info;
         $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false;
         $thumb = $image && $image->exists() ? $image->getThumbnail(120, 120) : false;
         $changes = wfMsgExt('nchanges', 'parsemag', $wgLang->formatNum($edits));
         $wgOut->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . '&nbsp;' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . $sk->makeKnownLinkObj($title) . '&nbsp;(' . $sk->makeKnownLinkObj($title, $changes, 'action=history') . ")</li>\n");
     }
     $wgOut->addHTML("</ul>\n" . Xml::submitButton(wfMsg('nuke-submit-delete')) . "</form>");
 }
 /**
  * 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>');
         }
     }
 }