protected function createUserPage(User $user)
 {
     global $wgMakeUserPageFromBio, $wgAutoUserBioText;
     global $wgConfirmAccountSortkey, $wgContLang;
     $body = '';
     // page text
     if ($wgMakeUserPageFromBio) {
         # Add account request bio to userpage
         $body .= $this->bio;
         # Add any automatic text for all confirmed accounts
         if ($wgAutoUserBioText != '') {
             $body .= "\n\n{$wgAutoUserBioText}";
         }
     }
     # Add any automatic text for confirmed accounts of this type
     $autoText = self::getAutoTextFromType($this->type);
     if ($autoText != '') {
         $body .= "\n\n{$autoText}";
     }
     # Add any areas of interest categories...
     foreach (ConfirmAccount::getUserAreaConfig() as $name => $conf) {
         if (in_array($name, $this->areas)) {
             # General userpage text for anyone with this interest
             if ($conf['userText'] != '') {
                 $body .= $conf['userText'];
             }
             # Message for users with this interested with the given account type
             if (isset($conf['grpUserText'][$this->type]) && $conf['grpUserText'][$this->type] != '') {
                 $body .= $conf['grpUserText'];
             }
         }
     }
     # Set sortkey and use it on userpage. This can be used to
     # normalize things like firstname, lastname and so fourth.
     if (!empty($wgConfirmAccountSortkey)) {
         $sortKey = preg_replace($wgConfirmAccountSortkey[0], $wgConfirmAccountSortkey[1], $user->getUserPage()->getText());
         $body .= "\n{{DEFAULTSORT:{$sortKey}}}";
         # Clean up any other categories...
         $catNS = $wgContLang->getNSText(NS_CATEGORY);
         $replace = '/\\[\\[' . preg_quote($catNS) . ':([^\\]]+)\\]\\]/i';
         // [[Category:x]]
         $with = "[[{$catNS}:\$1|" . str_replace('$', '\\$', $sortKey) . "]]";
         // [[Category:x|sortkey]]
         $body = preg_replace($replace, $with, $body);
     }
     # Create userpage!
     $article = new WikiPage($user->getUserPage());
     $article->doEdit($body, wfMsg('confirmaccount-summary'), EDIT_MINOR);
 }
 /**
  * @param $msg string
  */
 protected function showAccountConfirmForm($msg = '')
 {
     global $wgAccountRequestTypes;
     $out = $this->getOutput();
     $reqUser = $this->getUser();
     $titleObj = $this->getFullTitle();
     $accountReq = $this->accountReq;
     // convenience
     if (!$accountReq || $accountReq->isDeleted() && !$this->showRejects) {
         $out->addHTML($this->msg('confirmaccount-badid')->escaped());
         $out->returnToMain(true, $titleObj);
         return;
     }
     # Output any failure message
     if ($msg != '') {
         $out->addHTML('<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>');
     }
     $out->addWikiMsg('confirmaccount-text');
     $rejectTimestamp = $accountReq->getRejectTimestamp();
     $heldTimestamp = $accountReq->getHeldTimestamp();
     $reason = strlen($accountReq->getHandlingComment()) ? htmlspecialchars($accountReq->getHandlingComment()) : $this->msg('confirmaccount-noreason')->escaped();
     $adminId = $accountReq->getHandlingUser();
     if ($rejectTimestamp) {
         $datim = $this->getLanguage()->timeanddate($rejectTimestamp, true);
         $date = $this->getLanguage()->date($rejectTimestamp, true);
         $time = $this->getLanguage()->time($rejectTimestamp, true);
         # Auto-rejected requests have a user ID of zero
         if ($adminId) {
             $out->addHTML('<p><b>' . $this->msg('confirmaccount-reject', User::whoIs($adminId), $datim, $date, $time)->parse() . '</b></p>');
             $out->addHTML('<p><strong>' . $this->msg('confirmaccount-rational')->escaped() . '</strong><i> ' . $reason . '</i></p>');
         } else {
             $out->addHTML("<p><i> {$reason} </i></p>");
         }
     } elseif ($heldTimestamp) {
         $datim = $this->getLanguage()->timeanddate($heldTimestamp, true);
         $date = $this->getLanguage()->date($heldTimestamp, true);
         $time = $this->getLanguage()->time($heldTimestamp, true);
         $out->addHTML('<p><b>' . $this->msg('confirmaccount-held', User::whoIs($adminId), $datim, $date, $time)->parse() . '</b></p>');
         $out->addHTML('<p><strong>' . $this->msg('confirmaccount-rational')->escaped() . '</strong><i> ' . $reason . '</i></p>');
     }
     $form = Xml::openElement('form', array('method' => 'post', 'name' => 'accountconfirm', 'action' => $titleObj->getLocalUrl()));
     $form .= "<fieldset>";
     $form .= '<legend>' . $this->msg('confirmaccount-leg-user')->escaped() . '</legend>';
     $form .= '<table cellpadding=\'4\'>';
     $form .= "<tr><td>" . Xml::label($this->msg('username')->text(), 'wpNewName') . "</td>";
     $form .= "<td>" . Xml::input('wpNewName', 30, $this->reqUsername, array('id' => 'wpNewName')) . "</td></tr>\n";
     $econf = '';
     if ($accountReq->getEmailAuthTimestamp()) {
         $econf = ' <strong>' . $this->msg('confirmaccount-econf')->escaped() . '</strong>';
     }
     $form .= "<tr><td>" . $this->msg('confirmaccount-email')->escaped() . "</td>";
     $form .= "<td>" . htmlspecialchars($accountReq->getEmail()) . $econf . "</td></tr>\n";
     if (count($wgAccountRequestTypes) > 1) {
         $options = array();
         $form .= "<tr><td><strong>" . $this->msg('confirmaccount-reqtype')->escaped() . "</strong></td><td>";
         foreach ($wgAccountRequestTypes as $i => $params) {
             // Give grep a chance to find the usages: confirmaccount-pos-0, confirmaccount-pos-1
             $options[] = Xml::option($this->msg("confirmaccount-pos-{$i}")->text(), $i, $i == $this->reqType);
         }
         $form .= Xml::openElement('select', array('name' => "wpType"));
         $form .= implode("\n", $options);
         $form .= Xml::closeElement('select') . "\n";
         $form .= "</td></tr>\n";
     }
     $form .= '</table></fieldset>';
     $userAreas = ConfirmAccount::getUserAreaConfig();
     if ($this->hasItem('AreasOfInterest') && count($userAreas) > 0) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-areas')->escaped() . '</legend>';
         $form .= "<div style='height:150px; overflow:scroll; background-color:#f9f9f9;'>";
         $form .= "<table cellspacing='5' cellpadding='0' style='background-color:#f9f9f9;'><tr valign='top'>";
         $count = 0;
         foreach ($userAreas as $name => $conf) {
             $count++;
             if ($count > 5) {
                 $form .= "</tr><tr valign='top'>";
                 $count = 1;
             }
             $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name));
             if ($conf['project'] != '') {
                 $pg = Linker::linkKnown(Title::newFromText($conf['project']), $this->msg('requestaccount-info')->escaped());
             } else {
                 $pg = '';
             }
             $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, $this->reqAreas[$name] > 0) . " {$pg}</td>\n";
         }
         $form .= "</tr></table></div>";
         $form .= '</fieldset>';
     }
     if ($this->hasItem('Biography') || $this->hasItem('RealName')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-person')->escaped() . '</legend>';
         if ($this->hasItem('RealName')) {
             $form .= '<table cellpadding=\'4\'>';
             $form .= "<tr><td>" . $this->msg('confirmaccount-real')->escaped() . "</td>";
             $form .= "<td>" . htmlspecialchars($accountReq->getRealName()) . "</td></tr>\n";
             $form .= '</table>';
         }
         if ($this->hasItem('Biography')) {
             $form .= "<p>" . $this->msg('confirmaccount-bio')->escaped() . "\n";
             $form .= "<textarea tabindex='1' name='wpNewBio' id='wpNewBio' rows='12' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->reqBio) . "</textarea></p>\n";
         }
         $form .= '</fieldset>';
     }
     if ($this->hasItem('CV') || $this->hasItem('Notes') || $this->hasItem('Links')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-other')->escaped() . '</legend>';
         if ($this->hasItem('CV')) {
             $form .= '<p>' . $this->msg('confirmaccount-attach')->escaped() . ' ';
             if ($accountReq->getFileName() !== null) {
                 $form .= Linker::makeKnownLinkObj($titleObj, htmlspecialchars($accountReq->getFileName()), 'file=' . $accountReq->getFileStorageKey());
             } else {
                 $form .= $this->msg('confirmaccount-none-p')->escaped();
             }
         }
         if ($this->hasItem('Notes')) {
             $form .= "</p><p>" . $this->msg('confirmaccount-notes')->escaped() . "\n";
             $form .= "<textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . htmlspecialchars($accountReq->getNotes()) . "</textarea></p>\n";
         }
         if ($this->hasItem('Links')) {
             $form .= "<p>" . $this->msg('confirmaccount-urls')->escaped() . "</p>\n";
             $form .= self::parseLinks($accountReq->getUrls());
         }
         $form .= '</fieldset>';
     }
     if ($reqUser->isAllowed('requestips')) {
         $blokip = SpecialPage::getTitleFor('Block');
         $link = Linker::makeKnownLinkObj($blokip, $this->msg('confirmaccount-blockip')->escaped(), 'ip=' . $accountReq->getIP() . '&wpCreateAccount=1');
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-ip')->escaped() . '</legend>';
         $wordSeparator = $this->msg('word-separator')->plain();
         $form .= "<p>";
         // @todo FIXME: Bad i18n. Should probably be something like
         // "confirmaccount-ip $1 ($2)" to get rid of this mess.
         $form .= $this->msg('confirmaccount-ip')->escaped();
         $form .= $wordSeparator;
         $form .= htmlspecialchars($accountReq->getIP());
         $form .= $wordSeparator;
         $form .= $this->msg('parentheses')->rawParams($link)->escaped();
         $form .= "</p>\n";
         if ($accountReq->getXFF()) {
             $form .= "<p>" . $this->msg('confirmaccount-xff')->escaped() . $wordSeparator . htmlspecialchars($accountReq->getXFF()) . "</p>\n";
         }
         if ($accountReq->getAgent()) {
             $form .= "<p>" . $this->msg('confirmaccount-agent')->escaped() . $wordSeparator . htmlspecialchars($accountReq->getAgent()) . "</p>\n";
         }
         $form .= '</fieldset>';
     }
     $form .= '<fieldset>';
     $form .= '<legend>' . $this->msg('confirmaccount-legend')->escaped() . '</legend>';
     $form .= "<strong>" . $this->msg('confirmaccount-confirm')->parse() . "</strong>\n";
     $form .= "<table cellpadding='5'><tr>";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'accept', $this->submitType == 'accept', array('id' => 'submitCreate', 'onclick' => 'document.getElementById("wpComment").style.display="block"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-create')->text(), 'submitCreate') . "</td>\n";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'reject', $this->submitType == 'reject', array('id' => 'submitDeny', 'onclick' => 'document.getElementById("wpComment").style.display="block"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-deny')->text(), 'submitDeny') . "</td>\n";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'hold', $this->submitType == 'hold', array('id' => 'submitHold', 'onclick' => 'document.getElementById("wpComment").style.display="block"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-hold')->text(), 'submitHold') . "</td>\n";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'spam', $this->submitType == 'spam', array('id' => 'submitSpam', 'onclick' => 'document.getElementById("wpComment").style.display="none"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-spam')->text(), 'submitSpam') . "</td>\n";
     $form .= "</tr></table>";
     $form .= "<div id='wpComment'><p>" . $this->msg('confirmaccount-reason')->escaped() . "</p>\n";
     $form .= "<p><textarea name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%; display=block;'>" . htmlspecialchars($this->reason) . "</textarea></p></div>\n";
     $form .= "<p>" . Xml::submitButton($this->msg('confirmaccount-submit')->text()) . "</p>\n";
     $form .= '</fieldset>';
     $form .= Html::Hidden('title', $titleObj->getPrefixedDBKey()) . "\n";
     $form .= Html::Hidden('action', 'reject');
     $form .= Html::Hidden('acrid', $accountReq->getId());
     $form .= Html::Hidden('wpShowRejects', $this->showRejects);
     $form .= Html::Hidden('wpEditToken', $reqUser->getEditToken($accountReq->getId())) . "\n";
     $form .= Xml::closeElement('form');
     $out->addHTML($form);
     global $wgMemc;
     # Set a key to who is looking at this request.
     # Have it expire in 10 minutes...
     $key = wfMemcKey('acctrequest', 'view', $accountReq->getId());
     $wgMemc->set($key, $reqUser->getID(), 60 * 10);
 }
 protected function showForm($msg = '', $forgotFile = 0)
 {
     global $wgUseRealNamesOnly, $wgAllowRealName;
     global $wgAccountRequestToS, $wgAccountRequestTypes, $wgAccountRequestExtraInfo, $wgAllowAccountRequestFiles, $wgMakeUserPageFromBio;
     $reqUser = $this->getUser();
     $this->mForgotAttachment = $forgotFile;
     $out = $this->getOutput();
     $out->setPagetitle(wfMsgHtml("requestaccount"));
     # Output failure message if any
     if ($msg) {
         $out->addHTML('<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>');
     }
     # Give notice to users that are logged in
     if ($reqUser->getID()) {
         $out->addWikiMsg('requestaccount-dup');
     }
     $out->addWikiMsg('requestaccount-text');
     $form = Xml::openElement('form', array('method' => 'post', 'name' => 'accountrequest', 'action' => $this->getTitle()->getLocalUrl(), 'enctype' => 'multipart/form-data'));
     $form .= '<fieldset><legend>' . wfMsgHtml('requestaccount-leg-user') . '</legend>';
     $form .= wfMsgExt('requestaccount-acc-text', 'parse') . "\n";
     $form .= '<table cellpadding=\'4\'>';
     if ($wgUseRealNamesOnly) {
         $form .= "<tr><td>" . wfMsgHtml('username') . "</td>";
         $form .= "<td>" . wfMsgHtml('requestaccount-same') . "</td></tr>\n";
     } else {
         $form .= "<tr><td>" . Xml::label(wfMsgHtml('username'), 'wpUsername') . "</td>";
         $form .= "<td>" . Xml::input('wpUsername', 30, $this->mUsername, array('id' => 'wpUsername')) . "</td></tr>\n";
     }
     $form .= "<tr><td>" . Xml::label(wfMsgHtml('requestaccount-email'), 'wpEmail') . "</td>";
     $form .= "<td>" . Xml::input('wpEmail', 30, $this->mEmail, array('id' => 'wpEmail')) . "</td></tr>\n";
     if (count($wgAccountRequestTypes) > 1) {
         $form .= "<tr><td>" . wfMsgHtml('requestaccount-reqtype') . "</td><td>";
         $options = array();
         foreach ($wgAccountRequestTypes as $i => $params) {
             $options[] = Xml::option(wfMsg("requestaccount-level-{$i}"), $i, $i == $this->mType);
         }
         $form .= Xml::openElement('select', array('name' => "wpType"));
         $form .= implode("\n", $options);
         $form .= Xml::closeElement('select') . "\n";
         $form .= '</td></tr>';
     }
     $form .= '</table></fieldset>';
     $userAreas = ConfirmAccount::getUserAreaConfig();
     if (count($userAreas) > 0) {
         $form .= '<fieldset>';
         $form .= '<legend>' . wfMsgHtml('requestaccount-leg-areas') . '</legend>';
         $form .= wfMsgExt('requestaccount-areas-text', 'parse') . "\n";
         $form .= "<div style='height:150px; overflow:scroll; background-color:#f9f9f9;'>";
         $form .= "<table cellspacing='5' cellpadding='0' style='background-color:#f9f9f9;'><tr valign='top'>";
         $count = 0;
         foreach ($userAreas as $name => $conf) {
             $count++;
             if ($count > 5) {
                 $form .= "</tr><tr valign='top'>";
                 $count = 1;
             }
             $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name));
             if ($conf['project'] != '') {
                 $pg = Linker::link(Title::newFromText($conf['project']), wfMsgHtml('requestaccount-info'), array(), array(), "known");
             } else {
                 $pg = '';
             }
             $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, $this->mAreas[$name] > 0) . " {$pg}</td>\n";
         }
         $form .= "</tr></table></div>";
         $form .= '</fieldset>';
     }
     $form .= '<fieldset>';
     $form .= '<legend>' . wfMsgHtml('requestaccount-leg-person') . '</legend>';
     if ($wgMakeUserPageFromBio) {
         $form .= wfMsgExt('requestaccount-bio-text-i', 'parse') . "\n";
     }
     $form .= wfMsgExt('requestaccount-bio-text', 'parse') . "\n";
     if ($wgUseRealNamesOnly || $wgAllowRealName) {
         $form .= '<table cellpadding=\'4\'>';
         $form .= "<tr><td>" . Xml::label(wfMsgHtml('requestaccount-real'), 'wpRealName') . "</td>";
         $form .= "<td>" . Xml::input('wpRealName', 35, $this->mRealName, array('id' => 'wpRealName')) . "</td></tr>\n";
         $form .= '</table>';
     }
     $form .= "<p>" . wfMsgWikiHtml('requestaccount-bio') . "\n";
     $form .= "<textarea tabindex='1' name='wpBio' id='wpBio' rows='12' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->mBio) . "</textarea></p>\n";
     $form .= '</fieldset>';
     if ($wgAccountRequestExtraInfo) {
         $form .= '<fieldset>';
         $form .= '<legend>' . wfMsgHtml('requestaccount-leg-other') . '</legend>';
         $form .= wfMsgExt('requestaccount-ext-text', 'parse') . "\n";
         if ($wgAllowAccountRequestFiles) {
             $form .= "<p>" . wfMsgHtml('requestaccount-attach') . " ";
             $form .= Xml::input('wpUploadFile', 35, '', array('id' => 'wpUploadFile', 'type' => 'file')) . "</p>\n";
         }
         $form .= "<p>" . wfMsgHtml('requestaccount-notes') . "\n";
         $form .= "<textarea tabindex='1' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%;background-color:#f9f9f9;'>" . htmlspecialchars($this->mNotes) . "</textarea></p>\n";
         $form .= "<p>" . wfMsgHtml('requestaccount-urls') . "\n";
         $form .= "<textarea tabindex='1' name='wpUrls' id='wpUrls' rows='2' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->mUrls) . "</textarea></p>\n";
         $form .= '</fieldset>';
     }
     if ($wgAccountRequestToS) {
         $form .= '<fieldset>';
         $form .= '<legend>' . wfMsgHtml('requestaccount-leg-tos') . '</legend>';
         $form .= "<p>" . Xml::check('wpToS', $this->mToS, array('id' => 'wpToS')) . ' <label for="wpToS">' . wfMsgExt('requestaccount-tos', array('parseinline')) . "</label></p>\n";
         $form .= '</fieldset>';
     }
     # FIXME: do this better...
     global $wgConfirmAccountCaptchas, $wgCaptchaClass, $wgCaptchaTriggers;
     if ($wgConfirmAccountCaptchas && isset($wgCaptchaClass) && $wgCaptchaTriggers['createaccount'] && !$reqUser->isAllowed('skipcaptcha')) {
         $captcha = new $wgCaptchaClass();
         # Hook point to add captchas
         $form .= '<fieldset>';
         $form .= wfMsgExt('captcha-createaccount', 'parse');
         $form .= $captcha->getForm();
         $form .= '</fieldset>';
     }
     $form .= Html::Hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n";
     $form .= Html::Hidden('wpEditToken', $reqUser->editToken()) . "\n";
     $form .= Html::Hidden('attachment', $this->mPrevAttachment) . "\n";
     $form .= Html::Hidden('forgotAttachment', $this->mForgotAttachment) . "\n";
     $form .= "<p>" . Xml::submitButton(wfMsgHtml('requestaccount-submit')) . "</p>";
     $form .= Xml::closeElement('form');
     $out->addHTML($form);
     $out->addWikiMsg('requestaccount-footer');
 }
 function showCredentials()
 {
     $reqUser = $this->getUser();
     $out = $this->getOutput();
     $titleObj = SpecialPage::getTitleFor('UserCredentials');
     $row = $this->getAccountData();
     if (!$row) {
         $out->addHTML(wfMsgHtml('usercredentials-badid'));
         return;
     }
     $out->addWikiText(wfMsg("usercredentials-text"));
     $user = User::newFromName($this->target);
     $list = array();
     foreach ($user->getGroups() as $group) {
         $list[] = self::buildGroupLink($group);
     }
     $grouplist = '';
     if (count($list) > 0) {
         $grouplist = '<tr><td>' . wfMsgHtml('usercredentials-member') . '</td><td>' . implode(', ', $list) . '</td></tr>';
     }
     $form = "<fieldset>";
     $form .= '<legend>' . wfMsgHtml('usercredentials-leg-user') . '</legend>';
     $form .= '<table cellpadding=\'4\'>';
     $form .= "<tr><td>" . wfMsgHtml('username') . "</td>";
     $form .= "<td>" . Linker::makeLinkObj($user->getUserPage(), htmlspecialchars($user->getUserPage()->getText())) . "</td></tr>\n";
     $econf = $row->acd_email_authenticated ? ' <strong>' . wfMsgHtml('confirmaccount-econf') . '</strong>' : '';
     $form .= "<tr><td>" . wfMsgHtml('usercredentials-email') . "</td>";
     $form .= "<td>" . htmlspecialchars($row->acd_email) . $econf . "</td></tr>\n";
     $form .= $grouplist;
     $form .= '</table></fieldset>';
     $areaSet = UserAccountRequest::expandAreas($row->acd_areas);
     $userAreas = ConfirmAccount::getUserAreaConfig();
     if (count($userAreas) > 0) {
         $form .= '<fieldset>';
         $form .= '<legend>' . wfMsgHtml('confirmaccount-leg-areas') . '</legend>';
         $form .= "<div style='height:150px; overflow:scroll; background-color:#f9f9f9;'>";
         $form .= "<table cellspacing='5' cellpadding='0' style='background-color:#f9f9f9;'><tr valign='top'>";
         $count = 0;
         $att = array('disabled' => 'disabled');
         foreach ($userAreas as $name => $conf) {
             $count++;
             if ($count > 5) {
                 $form .= "</tr><tr valign='top'>";
                 $count = 1;
             }
             $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name));
             if ($conf['project'] != '') {
                 $pg = Linker::link(Title::newFromText($name), wfMsgHtml('requestaccount-info'), array(), array(), "known");
             } else {
                 $pg = '';
             }
             $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, in_array($formName, $areaSet), $att) . " {$pg}</td>\n";
         }
         $form .= "</tr></table></div>";
         $form .= '</fieldset>';
     }
     $form .= '<fieldset>';
     $form .= '<legend>' . wfMsgHtml('usercredentials-leg-person') . '</legend>';
     $form .= '<table cellpadding=\'4\'>';
     $form .= "<tr><td>" . wfMsgHtml('usercredentials-real') . "</td>";
     $form .= "<td>" . htmlspecialchars($row->acd_real_name) . "</td></tr>\n";
     $form .= '</table>';
     $form .= "<p>" . wfMsgHtml('usercredentials-bio') . "</p>";
     $form .= "<p><textarea tabindex='1' readonly='readonly' name='wpBio' id='wpNewBio' rows='10' cols='80' style='width:100%'>" . htmlspecialchars($row->acd_bio) . "</textarea></p>\n";
     $form .= '</fieldset>';
     $form .= '<fieldset>';
     $form .= '<legend>' . wfMsgHtml('usercredentials-leg-other') . '</legend>';
     global $wgAccountRequestExtraInfo;
     if ($wgAccountRequestExtraInfo) {
         $form .= '<p>' . wfMsgHtml('usercredentials-attach') . ' ';
         if ($row->acd_filename) {
             $form .= Linker::makeKnownLinkObj($titleObj, htmlspecialchars($row->acd_filename), 'file=' . $row->acd_storage_key);
         } else {
             $form .= wfMsgHtml('confirmaccount-none-p');
         }
         $form .= "</p><p>" . wfMsgHtml('usercredentials-notes') . "</p>\n";
         $form .= "<p><textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . htmlspecialchars($row->acd_notes) . "</textarea></p>\n";
         $form .= "<p>" . wfMsgHtml('usercredentials-urls') . "</p>\n";
         $form .= ConfirmAccountsPage::parseLinks($row->acd_urls);
     }
     if ($reqUser->isAllowed('requestips')) {
         $form .= "<p>" . wfMsgHtml('usercredentials-ip') . " " . htmlspecialchars($row->acd_ip) . "</p>\n";
     }
     $form .= '</fieldset>';
     $out->addHTML($form);
 }
Пример #5
0
 protected function showForm($msg = '', $forgotFile = 0)
 {
     global $wgAccountRequestTypes, $wgMakeUserPageFromBio;
     $reqUser = $this->getUser();
     $this->mForgotAttachment = $forgotFile;
     $out = $this->getOutput();
     $out->setPagetitle($this->msg("requestaccount")->escaped());
     # Output failure message if any
     if ($msg) {
         $out->addHTML('<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>');
     }
     # Give notice to users that are logged in
     if ($reqUser->getID()) {
         $out->addWikiMsg('requestaccount-dup');
     }
     $out->addWikiMsg('requestaccount-text');
     $form = Xml::openElement('form', array('method' => 'post', 'name' => 'accountrequest', 'action' => $this->getPageTitle()->getLocalUrl(), 'enctype' => 'multipart/form-data'));
     $form .= '<fieldset><legend>' . $this->msg('requestaccount-leg-user')->escaped() . '</legend>';
     $form .= $this->msg('requestaccount-acc-text')->parseAsBlock() . "\n";
     $form .= '<table style="padding:4px;">';
     if ($this->hasItem('UserName')) {
         $form .= "<tr><td>" . Xml::label($this->msg('username')->text(), 'wpUsername') . "</td>";
         $form .= "<td>" . Xml::input('wpUsername', 30, $this->mUsername, array('id' => 'wpUsername')) . "</td></tr>\n";
     } else {
         $form .= "<tr><td>" . $this->msg('username')->escaped() . "</td>";
         $form .= "<td>" . $this->msg('requestaccount-same')->escaped() . "</td></tr>\n";
     }
     $form .= "<tr><td>" . Xml::label($this->msg('requestaccount-email')->text(), 'wpEmail') . "</td>";
     $form .= "<td>" . Xml::input('wpEmail', 30, $this->mEmail, array('id' => 'wpEmail')) . "</td></tr>\n";
     if (count($wgAccountRequestTypes) > 1) {
         $form .= "<tr><td>" . $this->msg('requestaccount-reqtype')->escaped() . "</td><td>";
         $options = array();
         foreach ($wgAccountRequestTypes as $i => $params) {
             // Give grep a chance to find the usages: requestaccount-level-0, requestaccount-level-1
             $options[] = Xml::option($this->msg("requestaccount-level-{$i}")->text(), $i, $i == $this->mType);
         }
         $form .= Xml::openElement('select', array('name' => "wpType"));
         $form .= implode("\n", $options);
         $form .= Xml::closeElement('select') . "\n";
         $form .= '</td></tr>';
     }
     $form .= '</table></fieldset>';
     $userAreas = ConfirmAccount::getUserAreaConfig();
     if ($this->hasItem('AreasOfInterest') && count($userAreas) > 0) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('requestaccount-leg-areas')->escaped() . '</legend>';
         $form .= $this->msg('requestaccount-areas-text')->parseAsBlock() . "\n";
         $form .= "<div style='height:150px; overflow:scroll; background-color:#f9f9f9;'>";
         $form .= "<table style='border-spacing:5px; padding:0px; background-color:#f9f9f9;'><tr valign='top'>";
         $count = 0;
         foreach ($userAreas as $name => $conf) {
             $count++;
             if ($count > 5) {
                 $form .= "</tr><tr style='vertical-align:top;'>";
                 $count = 1;
             }
             $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name));
             if ($conf['project'] != '') {
                 $pg = Linker::link(Title::newFromText($conf['project']), $this->msg('requestaccount-info')->escaped(), array(), array(), "known");
             } else {
                 $pg = '';
             }
             $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, $this->mAreas[$name] > 0) . " {$pg}</td>\n";
         }
         $form .= "</tr></table></div>";
         $form .= '</fieldset>';
     }
     if ($this->hasItem('Biography') || $this->hasItem('RealName')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('requestaccount-leg-person')->escaped() . '</legend>';
         if ($this->hasItem('RealName')) {
             $form .= '<table style="padding:4px;">';
             $form .= "<tr><td>" . Xml::label($this->msg('requestaccount-real')->text(), 'wpRealName') . "</td>";
             $form .= "<td>" . Xml::input('wpRealName', 35, $this->mRealName, array('id' => 'wpRealName')) . "</td></tr>\n";
             $form .= '</table>';
         }
         if ($this->hasItem('Biography')) {
             if ($wgMakeUserPageFromBio) {
                 $form .= $this->msg('requestaccount-bio-text-i')->parseAsBlock() . "\n";
             }
             $form .= $this->msg('requestaccount-bio-text')->parseAsBlock() . "\n";
             $form .= "<p>" . $this->msg('requestaccount-bio')->parse() . "\n";
             $form .= "<textarea tabindex='1' name='wpBio' id='wpBio' rows='12' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->mBio) . "</textarea></p>\n";
         }
         $form .= '</fieldset>';
     }
     if ($this->hasItem('CV') || $this->hasItem('Notes') || $this->hasItem('Links')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('requestaccount-leg-other')->escaped() . '</legend>';
         $form .= $this->msg('requestaccount-ext-text')->parseAsBlock() . "\n";
         if ($this->hasItem('CV')) {
             $form .= "<p>" . $this->msg('requestaccount-attach')->escaped() . " ";
             $form .= Xml::input('wpUploadFile', 35, '', array('id' => 'wpUploadFile', 'type' => 'file')) . "</p>\n";
         }
         if ($this->hasItem('Notes')) {
             $form .= "<p>" . $this->msg('requestaccount-notes')->escaped() . "\n";
             $form .= "<textarea tabindex='1' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%;background-color:#f9f9f9;'>" . htmlspecialchars($this->mNotes) . "</textarea></p>\n";
         }
         if ($this->hasItem('Links')) {
             $form .= "<p>" . $this->msg('requestaccount-urls')->escaped() . "\n";
             $form .= "<textarea tabindex='1' name='wpUrls' id='wpUrls' rows='2' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->mUrls) . "</textarea></p>\n";
         }
         $form .= '</fieldset>';
     }
     if ($this->hasItem('TermsOfService')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('requestaccount-leg-tos')->escaped() . '</legend>';
         $form .= "<p>" . Xml::check('wpToS', $this->mToS, array('id' => 'wpToS')) . ' <label for="wpToS">' . $this->msg('requestaccount-tos')->parse() . "</label></p>\n";
         $form .= '</fieldset>';
     }
     # FIXME: do this better...
     global $wgConfirmAccountCaptchas, $wgCaptchaClass, $wgCaptchaTriggers;
     if ($wgConfirmAccountCaptchas && isset($wgCaptchaClass) && $wgCaptchaTriggers['createaccount'] && !$reqUser->isAllowed('skipcaptcha')) {
         $captcha = new $wgCaptchaClass();
         # Hook point to add captchas
         $form .= '<fieldset>';
         $form .= $this->msg('captcha-createaccount')->parseAsBlock();
         /* original, commented due to error, suggested fix below
         			$form .= $captcha->getForm();
                     */
         //fix from: https://www.mediawiki.org/wiki/Topic:Sxl47i90ybevish0
         $form .= $captcha->getForm($this->getOutput());
         $form .= '</fieldset>';
     }
     $form .= Html::Hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
     $form .= Html::Hidden('wpEditToken', $reqUser->getEditToken()) . "\n";
     $form .= Html::Hidden('attachment', $this->mPrevAttachment) . "\n";
     $form .= Html::Hidden('forgotAttachment', $this->mForgotAttachment) . "\n";
     $form .= "<p>" . Xml::submitButton($this->msg('requestaccount-submit')->text()) . "</p>";
     $form .= Xml::closeElement('form');
     $out->addHTML($form);
     $out->addWikiMsg('requestaccount-footer');
 }