Esempio n. 1
0
 function showForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     $self = SpecialPage::getTitleFor('Resetpass');
     $form = '<div id="userloginForm">' . wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl())) . '<h2>' . wfMsgHtml('resetpass_header') . '</h2>' . '<div id="userloginprompt">' . wfMsgExt('resetpass_text', array('parse')) . '</div>' . '<table>' . wfHidden('token', $wgUser->editToken()) . wfHidden('wpName', $this->mName) . wfHidden('wpPassword', $this->mTemporaryPassword) . wfHidden('returnto', $wgRequest->getVal('returnto')) . $this->pretty(array(array('wpName', 'username', 'text', $this->mName), array('wpNewPassword', 'newpassword', 'password', ''), array('wpRetype', 'yourpasswordagain', 'password', ''))) . '<tr>' . '<td></td>' . '<td>' . Xml::checkLabel(wfMsg('remembermypassword'), 'wpRemember', 'wpRemember', $wgRequest->getCheck('wpRemember')) . '</td>' . '</tr>' . '<tr>' . '<td></td>' . '<td>' . wfSubmitButton(wfMsgHtml('resetpass_submit')) . '</td>' . '</tr>' . '</table>' . wfCloseElement('form') . '</div>';
     $wgOut->addHtml($form);
 }
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
     $output = '';
     $output .= Xml::element('h2', null, $this->msg('abusefilter-list')->parse());
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     $scope = $optarray['scope'];
     # Options form
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel($this->msg('abusefilter-list-options-deleted-show')->text(), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-hide')->text(), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-only')->text(), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral) {
         $fields['abusefilter-list-options-scope'] = Xml::radioLabel($this->msg('abusefilter-list-options-scope-local')->text(), 'rulescope', 'local', 'mw-abusefilter-rulescope-local', $scope == 'local') . Xml::radioLabel($this->msg('abusefilter-list-options-scope-global')->text(), 'rulescope', 'global', 'mw-abusefilter-rulescope-global', $scope == 'global');
     }
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel($this->msg('abusefilter-list-options-hidedisabled')->text(), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset($this->msg('abusefilter-list-options')->text(), $options);
     $output .= $options;
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral && $scope == 'global') {
         $globalPager = new GlobalAbuseFilterPager($this, $conds);
         $output .= $globalPager->getNavigationBar() . $globalPager->getBody() . $globalPager->getNavigationBar();
     } else {
         $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     }
     $this->getOutput()->addHTML($output);
 }
 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, '') . '&#160;' . 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 .= Html::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();
     }
 }
 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");
 }
/**
 * Ajax function to create checkboxes for a new group in $wgGroupPermissions
 *
 * @param String $group new group name
 * @return either <err#> if group already exist or html fragment
 */
function efConfigureAjax($group)
{
    global $wgUser, $wgGroupPermissions;
    if (!$wgUser->isAllowed('configure-all')) {
        return '<err#>';
    }
    if (isset($wgGroupPermissions[$group])) {
        $html = '<err#>';
    } else {
        if (is_callable(array('User', 'getAllRights'))) {
            // 1.13 +
            $all = User::getAllRights();
        } else {
            $all = array();
            foreach ($wgGroupPermissions as $rights) {
                $all = array_merge($all, array_keys($rights));
            }
            $all = array_unique($all);
        }
        $row = '<div style="-moz-column-count:2"><ul>';
        foreach ($all as $right) {
            $id = Sanitizer::escapeId('wpwgGroupPermissions-' . $group . '-' . $right);
            $desc = is_callable(array('User', 'getRightDescription')) ? User::getRightDescription($right) : $right;
            $row .= '<li>' . Xml::checkLabel($desc, $id, $id) . "</li>\n";
        }
        $row .= '</ul></div>';
        $groupName = User::getGroupName($group);
        // Firefox seems to not like that :(
        $html = str_replace('&nbsp;', ' ', $row);
    }
    return $html;
}
/**
 * Adds the "Show all users" checkbox for privileged users.
 *
 * @param $usersPager Object: instance of UsersPager
 * @param $out String: HTML output
 * @return Boolean: true
 */
function efFilterListUsersHeaderForm($usersPager, &$out)
{
    global $wgRequest, $wgUser;
    // Show this checkbox only to privileged users
    if ($wgUser->isAllowed('viewallusers')) {
        $out .= Xml::checkLabel(wfMsg('listusers-showall'), 'showall', 'showall', $wgRequest->getVal('showall'));
        $out .= '&nbsp;';
    }
    return true;
}
 public function show($params)
 {
     global $wgOut;
     $wgOut->setPageTitle(wfMsg('deletequeue'));
     $this->loadSearch();
     // Intro text
     $wgOut->addWikiMsg('deletequeue-list-text');
     // Search box
     $searchBox = array();
     // // Queue selector
     $selector = Xml::openElement('select', array('name' => 'queue')) . "\n";
     $queues = array('speedy', 'prod', 'deletediscuss');
     $attribs = array('value' => '');
     if (in_array($this->mQueue, $queues)) {
         $attribs['selected'] = 'selected';
     }
     $selector .= Xml::element('option', $attribs, wfMsg('deletequeue-list-anyqueue'));
     foreach ($queues as $queue) {
         $attribs = array('value' => $queue);
         if ($this->mQueue == $queue) {
             $attribs['selected'] = 'selected';
         }
         $selector .= Xml::element('option', $attribs, wfMsg("deletequeue-queue-{$queue}"));
     }
     $selector .= Xml::closeElement('select');
     $searchBox['deletequeue-list-queue'] = $selector;
     $searchBox['deletequeue-list-status'] = Xml::checkLabel(wfMsg('deletequeue-list-expired'), 'expired', 'mw-dq-expired', $this->mExpired);
     $searchBox = Xml::buildForm($searchBox, 'deletequeue-list-search');
     $searchBox .= Html::Hidden('title', $this->getTitle()->getPrefixedText());
     $searchBox = Xml::tags('form', array('action' => $this->getTitle()->getFullURL(), 'method' => 'get'), $searchBox);
     $searchBox = Xml::fieldset(wfMsg('deletequeue-list-search-legend'), $searchBox);
     $wgOut->addHTML($searchBox);
     $conds = array('dq_active' => 1);
     if ($this->mQueue) {
         $conds['dq_queue'] = $this->mQueue;
     }
     if ($this->mExpired) {
         $dbr = wfGetDB(DB_SLAVE);
         $conds[] = 'dq_expiry<' . $dbr->addQuotes($dbr->timestamp(wfTimestampNow()));
     }
     // Headers
     $body = '';
     $headers = array('page', 'queue', 'votes', 'expiry', 'discusspage');
     foreach ($headers as $header) {
         $body .= Xml::element('th', null, wfMsg("deletequeue-list-header-{$header}")) . "\n";
     }
     $body = Xml::tags('tr', null, $body);
     // The list itself
     $pager = new DeleteQueuePager($conds);
     $body .= $pager->getBody();
     $body = Xml::tags('table', array('class' => 'wikitable'), $body);
     $wgOut->addHTML($pager->getNavigationBar() . $body . $pager->getNavigationBar());
 }
 /**
  * (non-PHPdoc)
  * @see includes/EnhancedChangesList#endRecentChangesList()
  */
 public function endRecentChangesList()
 {
     global $wgRequest;
     $collabWatchlist = $wgRequest->getIntOrNull('collabwatchlist');
     $result = '';
     $result .= parent::endRecentChangesList();
     $glWlIdAndName = $this->getCollabWatchlistIdAndName($this->user->getId());
     $result .= $this->collabWatchlistAndTagSelectors($glWlIdAndName, $collabWatchlist, null, 'collabwatchlist', wfMsg('collabwatchlist')) . '&nbsp;';
     $result .= Xml::label(wfMsg('collabwatchlisttagcomment'), 'tagcomment') . '&nbsp;' . Xml::input('tagcomment') . '&nbsp;';
     if ($this->user->useRCPatrol()) {
         $result .= Xml::checkLabel(wfMsg('collabwatchlistpatrol'), 'setpatrolled', 'setpatrolled', true) . '&nbsp;';
     }
     $result .= Xml::submitButton(wfMsg('collabwatchlistsettagbutton'));
     $result .= Xml::closeElement('form');
     return $result;
 }
Esempio n. 9
0
 /**
  * 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 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;
	}
 /**
  * Shows the search form
  */
 private function showForm()
 {
     global $wgScript, $wgOut, $wgRequest;
     /* Build form */
     $html = Xml::openElement('form', array('action' => $wgScript)) . "\n";
     // Name of SpecialPage
     $html .= Html::hidden('title', $this->getTitle()->getPrefixedText()) . "\n";
     // Limit
     $html .= Html::hidden('limit', $wgRequest->getInt('limit', 50));
     // Input box with target prefilled if available
     $formContent = "\t" . Xml::input('target', 40, is_null($this->target) ? '' : $this->target->getText()) . "\n\t" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('globalusage-ok'))) . "\n\t<p>" . Xml::checkLabel(wfMsg('globalusage-filterlocal'), 'filterlocal', 'mw-filterlocal', $this->filterLocal) . '</p>';
     if (!is_null($this->target) && wfFindFile($this->target)) {
         // Show the image if it exists
         $html .= Linker::makeThumbLinkObj($this->target, wfFindFile($this->target), $this->target->getPrefixedText(), '', wfUILang()->alignEnd(), array(), false, false);
     }
     // Wrap the entire form in a nice fieldset
     $html .= Xml::fieldSet(wfMsg('globalusage-text'), $formContent) . "\n</form>";
     $wgOut->addHtml($html);
 }
Esempio n. 12
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')) . "\n" . Xml::hidden('token', $wgUser->editToken()) . "\n" . Xml::hidden('wpName', $this->mUserName) . "\n" . Xml::hidden('returnto', $wgRequest->getVal('returnto')) . "\n" . wfMsgExt('resetpass_text', array('parse')) . "\n" . Xml::openElement('table', array('id' => 'mw-resetpass-table')) . "\n" . $this->pretty(array(array('wpName', 'username', 'text', $this->mUserName), array('wpPassword', $oldpassMsg, 'password', $this->mOldpass), array('wpNewPassword', 'newpassword', 'password', null), array('wpRetype', 'retypenew', 'password', null))) . "\n" . $rememberMe . "<tr>\n" . "<td></td>\n" . '<td class="mw-input">' . Xml::submitButton(wfMsg($submitMsg)) . Xml::submitButton(wfMsg('resetpass-submit-cancel'), array('name' => 'wpCancel')) . "</td>\n" . "</tr>\n" . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset') . "\n");
 }
Esempio n. 13
0
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     $output = '';
     $output .= Xml::element('h2', null, wfMsgExt('abusefilter-list', array('parseinline')));
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     # Options form
     $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 .= Html::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();
     $this->getOutput()->addHTML($output);
 }
 /**
  * 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;
 }
 protected function showForm()
 {
     global $wgScript;
     $this->getOutput()->addWikiMsg('stablepages-list', $this->getLang()->formatNum($this->pager->getNumRows()));
     $fields = array();
     // Namespace selector
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace, '');
     }
     // Restriction level selector
     if (FlaggedRevs::getRestrictionLevels()) {
         $fields[] = FlaggedRevsXML::getRestrictionFilterMenu($this->autoreview);
     }
     $fields[] = Xml::checkLabel(wfMsg('stablepages-indef'), 'indef', 'stablepages-indef', $this->indef);
     $form = Html::openElement('form', array('name' => 'stablepages', 'action' => $wgScript, 'method' => 'get'));
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey());
     $form .= "<fieldset><legend>" . wfMsg('stablepages') . "</legend>\n";
     $form .= implode('&#160;', $fields) . '&nbsp';
     $form .= " " . Xml::submitButton(wfMsg('go'));
     $form .= "</fieldset>\n";
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
Esempio n. 16
0
 /**
  * Create an input to filter changes by categories
  *
  * @param FormOptions $opts
  * @return array
  */
 protected function categoryFilterForm(FormOptions $opts)
 {
     list($label, $input) = Xml::inputLabelSep($this->msg('rc_categories')->text(), 'categories', 'mw-categories', false, $opts['categories']);
     $input .= ' ' . Xml::checkLabel($this->msg('rc_categories_any')->text(), 'categories_any', 'mw-categories_any', $opts['categories_any']);
     return array($label, $input);
 }
Esempio n. 17
0
    /**
     * Build the input form
     *
     * @return String: HTML form
     */
    function buildForm()
    {
        global $wgUser, $wgLang, $wgOut;
        $mProtectreasonother = Xml::label(wfMessage('protectcomment')->text(), 'wpProtectReasonSelection');
        $mProtectreason = Xml::label(wfMessage('protect-otherreason')->text(), 'mwProtect-reason');
        $out = '';
        if (!$this->disabled) {
            $wgOut->addModules('mediawiki.legacy.protect');
            $out .= Xml::openElement('form', array('method' => 'post', 'action' => $this->mTitle->getLocalURL('action=protect'), 'id' => 'mw-Protect-Form', 'onsubmit' => 'ProtectionForm.enableUnchainedInputs(true)'));
        }
        $out .= Xml::openElement('fieldset') . Xml::element('legend', null, wfMessage('protect-legend')->text()) . Xml::openElement('table', array('id' => 'mwProtectSet')) . Xml::openElement('tbody');
        // Not all languages have V_x <-> N_x relation
        foreach ($this->mRestrictions as $action => $selected) {
            // Messages:
            // restriction-edit, restriction-move, restriction-create, restriction-upload
            $msg = wfMessage('restriction-' . $action);
            $out .= "<tr><td>" . Xml::openElement('fieldset') . Xml::element('legend', null, $msg->exists() ? $msg->text() : $action) . Xml::openElement('table', array('id' => "mw-protect-table-{$action}")) . "<tr><td>" . $this->buildSelector($action, $selected) . "</td></tr><tr><td>";
            $reasonDropDown = Xml::listDropDown('wpProtectReasonSelection', wfMessage('protect-dropdown')->inContentLanguage()->text(), wfMessage('protect-otherreason-op')->inContentLanguage()->text(), $this->mReasonSelection, 'mwProtect-reason', 4);
            $scExpiryOptions = wfMessage('protect-expiry-options')->inContentLanguage()->text();
            $showProtectOptions = $scExpiryOptions !== '-' && !$this->disabled;
            $mProtectexpiry = Xml::label(wfMessage('protectexpiry')->text(), "mwProtectExpirySelection-{$action}");
            $mProtectother = Xml::label(wfMessage('protect-othertime')->text(), "mwProtect-{$action}-expires");
            $expiryFormOptions = '';
            if ($this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity') {
                $timestamp = $wgLang->timeanddate($this->mExistingExpiry[$action], true);
                $d = $wgLang->date($this->mExistingExpiry[$action], true);
                $t = $wgLang->time($this->mExistingExpiry[$action], true);
                $expiryFormOptions .= Xml::option(wfMessage('protect-existing-expiry', $timestamp, $d, $t)->text(), 'existing', $this->mExpirySelection[$action] == 'existing') . "\n";
            }
            $expiryFormOptions .= Xml::option(wfMessage('protect-othertime-op')->text(), "othertime") . "\n";
            foreach (explode(',', $scExpiryOptions) as $option) {
                if (strpos($option, ":") === false) {
                    $show = $value = $option;
                } else {
                    list($show, $value) = explode(":", $option);
                }
                $show = htmlspecialchars($show);
                $value = htmlspecialchars($value);
                $expiryFormOptions .= Xml::option($show, $value, $this->mExpirySelection[$action] === $value) . "\n";
            }
            # Add expiry dropdown
            if ($showProtectOptions && !$this->disabled) {
                $out .= "\n\t\t\t\t\t<table><tr>\n\t\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t\t{$mProtectexpiry}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => "mwProtectExpirySelection-{$action}", 'name' => "wpProtectExpirySelection-{$action}", 'onchange' => "ProtectionForm.updateExpiryList(this)", 'tabindex' => '2') + $this->disabledAttrib, $expiryFormOptions) . "</td>\n\t\t\t\t\t</tr></table>";
            }
            # Add custom expiry field
            $attribs = array('id' => "mwProtect-{$action}-expires", 'onkeyup' => 'ProtectionForm.updateExpiry(this)', 'onchange' => 'ProtectionForm.updateExpiry(this)') + $this->disabledAttrib;
            $out .= "<table><tr>\n\t\t\t\t\t<td class='mw-label'>" . $mProtectother . '</td>
					<td class="mw-input">' . Xml::input("mwProtect-expiry-{$action}", 50, $this->mExpiry[$action], $attribs) . '</td>
				</tr></table>';
            $out .= "</td></tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . "</td></tr>";
        }
        # Give extensions a chance to add items to the form
        wfRunHooks('ProtectionForm::buildForm', array($this->mArticle, &$out));
        $out .= Xml::closeElement('tbody') . Xml::closeElement('table');
        // JavaScript will add another row with a value-chaining checkbox
        if ($this->mTitle->exists()) {
            $out .= Xml::openElement('table', array('id' => 'mw-protect-table2')) . Xml::openElement('tbody');
            $out .= '<tr>
					<td></td>
					<td class="mw-input">' . Xml::checkLabel(wfMessage('protect-cascade')->text(), 'mwProtect-cascade', 'mwProtect-cascade', $this->mCascade, $this->disabledAttrib) . "</td>\n\t\t\t\t</tr>\n";
            $out .= Xml::closeElement('tbody') . Xml::closeElement('table');
        }
        # Add manual and custom reason field/selects as well as submit
        if (!$this->disabled) {
            $out .= Xml::openElement('table', array('id' => 'mw-protect-table3')) . Xml::openElement('tbody');
            $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t{$mProtectreasonother}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t{$reasonDropDown}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t{$mProtectreason}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('mwProtect-reason', 60, $this->mReason, array('type' => 'text', 'id' => 'mwProtect-reason', 'maxlength' => 180)) . "</td>\n\t\t\t\t</tr>";
            # Disallow watching is user is not logged in
            if ($wgUser->isLoggedIn()) {
                $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMessage('watchthis')->text(), 'mwProtectWatch', 'mwProtectWatch', $wgUser->isWatched($this->mTitle) || $wgUser->getOption('watchdefault')) . "</td>\n\t\t\t\t</tr>";
            }
            $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMessage('confirm')->text(), array('id' => 'mw-Protect-submit')) . "</td>\n\t\t\t\t</tr>\n";
            $out .= Xml::closeElement('tbody') . Xml::closeElement('table');
        }
        $out .= Xml::closeElement('fieldset');
        if ($wgUser->isAllowed('editinterface')) {
            $title = Title::makeTitle(NS_MEDIAWIKI, 'Protect-dropdown');
            $link = Linker::link($title, wfMessage('protect-edit-reasonlist')->escaped(), array(), array('action' => 'edit'));
            $out .= '<p class="mw-protect-editreasons">' . $link . '</p>';
        }
        if (!$this->disabled) {
            $out .= Html::hidden('wpEditToken', $wgUser->getEditToken(array('protect', $this->mTitle->getPrefixedDBkey())));
            $out .= Xml::closeElement('form');
            $wgOut->addScript($this->buildCleanupScript());
        }
        return $out;
    }
Esempio n. 18
0
 protected function showHistory()
 {
     $this->checkReadOnly();
     $out = $this->getOutput();
     if ($this->mAllowed) {
         $out->addModules('mediawiki.special.undelete');
     }
     $out->wrapWikiMsg("<div class='mw-undelete-pagetitle'>\n\$1\n</div>\n", array('undeletepagetitle', wfEscapeWikiText($this->mTargetObj->getPrefixedText())));
     $archive = new PageArchive($this->mTargetObj, $this->getConfig());
     Hooks::run('UndeleteForm::showHistory', array(&$archive, $this->mTargetObj));
     /*
     $text = $archive->getLastRevisionText();
     if( is_null( $text ) ) {
     	$out->addWikiMsg( 'nohistory' );
     	return;
     }
     */
     $out->addHTML('<div class="mw-undelete-history">');
     if ($this->mAllowed) {
         $out->addWikiMsg('undeletehistory');
         $out->addWikiMsg('undeleterevdel');
     } else {
         $out->addWikiMsg('undeletehistorynoadmin');
     }
     $out->addHTML('</div>');
     # List all stored revisions
     $revisions = $archive->listRevisions();
     $files = $archive->listFiles();
     $haveRevisions = $revisions && $revisions->numRows() > 0;
     $haveFiles = $files && $files->numRows() > 0;
     # Batch existence check on user and talk pages
     if ($haveRevisions) {
         $batch = new LinkBatch();
         foreach ($revisions as $row) {
             $batch->addObj(Title::makeTitleSafe(NS_USER, $row->ar_user_text));
             $batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->ar_user_text));
         }
         $batch->execute();
         $revisions->seek(0);
     }
     if ($haveFiles) {
         $batch = new LinkBatch();
         foreach ($files as $row) {
             $batch->addObj(Title::makeTitleSafe(NS_USER, $row->fa_user_text));
             $batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->fa_user_text));
         }
         $batch->execute();
         $files->seek(0);
     }
     if ($this->mAllowed) {
         $action = $this->getPageTitle()->getLocalURL(array('action' => 'submit'));
         # Start the form here
         $top = Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'undelete'));
         $out->addHTML($top);
     }
     # Show relevant lines from the deletion log:
     $deleteLogPage = new LogPage('delete');
     $out->addHTML(Xml::element('h2', null, $deleteLogPage->getName()->text()) . "\n");
     LogEventsList::showLogExtract($out, 'delete', $this->mTargetObj);
     # Show relevant lines from the suppression log:
     $suppressLogPage = new LogPage('suppress');
     if ($this->getUser()->isAllowed('suppressionlog')) {
         $out->addHTML(Xml::element('h2', null, $suppressLogPage->getName()->text()) . "\n");
         LogEventsList::showLogExtract($out, 'suppress', $this->mTargetObj);
     }
     if ($this->mAllowed && ($haveRevisions || $haveFiles)) {
         # Format the user-visible controls (comment field, submission button)
         # in a nice little table
         if ($this->getUser()->isAllowed('suppressrevision')) {
             $unsuppressBox = "<tr>\n\t\t\t\t\t\t<td>&#160;</td>\n\t\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('revdelete-unsuppress')->text(), 'wpUnsuppress', 'mw-undelete-unsuppress', $this->mUnsuppress) . "</td>\n\t\t\t\t\t</tr>";
         } else {
             $unsuppressBox = '';
         }
         $table = Xml::fieldset($this->msg('undelete-fieldset-title')->text()) . Xml::openElement('table', array('id' => 'mw-undelete-table')) . "<tr>\n\t\t\t\t\t<td colspan='2' class='mw-undelete-extrahelp'>" . $this->msg('undeleteextrahelp')->parseAsBlock() . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('undeletecomment')->text(), 'wpComment') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('wpComment', 50, $this->mComment, array('id' => 'wpComment', 'autofocus' => '')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>&#160;</td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('undeletebtn')->text(), array('name' => 'restore', 'id' => 'mw-undelete-submit')) . ' ' . Xml::submitButton($this->msg('undeleteinvert')->text(), array('name' => 'invert', 'id' => 'mw-undelete-invert')) . "</td>\n\t\t\t</tr>" . $unsuppressBox . Xml::closeElement('table') . Xml::closeElement('fieldset');
         $out->addHTML($table);
     }
     $out->addHTML(Xml::element('h2', null, $this->msg('history')->text()) . "\n");
     if ($haveRevisions) {
         # The page's stored (deleted) history:
         $out->addHTML('<ul>');
         $remaining = $revisions->numRows();
         $earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
         foreach ($revisions as $row) {
             $remaining--;
             $out->addHTML($this->formatRevisionRow($row, $earliestLiveTime, $remaining));
         }
         $revisions->free();
         $out->addHTML('</ul>');
     } else {
         $out->addWikiMsg('nohistory');
     }
     if ($haveFiles) {
         $out->addHTML(Xml::element('h2', null, $this->msg('filehist')->text()) . "\n");
         $out->addHTML('<ul>');
         foreach ($files as $row) {
             $out->addHTML($this->formatFileRow($row));
         }
         $files->free();
         $out->addHTML('</ul>');
     }
     if ($this->mAllowed) {
         # Slip in the hidden controls here
         $misc = Html::hidden('target', $this->mTarget);
         $misc .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
         $misc .= Xml::closeElement('form');
         $out->addHTML($misc);
     }
     return true;
 }
Esempio n. 19
0
 /**
  * Output deletion confirmation dialog
  * @todo FIXME: Move to another file?
  * @param string $reason Prefilled reason
  */
 public function confirmDelete($reason)
 {
     wfDebug("Article::confirmDelete\n");
     $title = $this->getTitle();
     $ctx = $this->getContext();
     $outputPage = $ctx->getOutput();
     $useMediaWikiUIEverywhere = $ctx->getConfig()->get('UseMediaWikiUIEverywhere');
     $outputPage->setPageTitle(wfMessage('delete-confirm', $title->getPrefixedText()));
     $outputPage->addBacklinkSubtitle($title);
     $outputPage->setRobotPolicy('noindex,nofollow');
     $backlinkCache = $title->getBacklinkCache();
     if ($backlinkCache->hasLinks('pagelinks') || $backlinkCache->hasLinks('templatelinks')) {
         $outputPage->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'deleting-backlinks-warning');
     }
     $outputPage->addWikiMsg('confirmdeletetext');
     Hooks::run('ArticleConfirmDelete', array($this, $outputPage, &$reason));
     $user = $this->getContext()->getUser();
     if ($user->isAllowed('suppressrevision')) {
         $suppress = Html::openElement('div', array('id' => 'wpDeleteSuppressRow')) . Xml::checkLabel(wfMessage('revdelete-suppress')->text(), 'wpSuppress', 'wpSuppress', false, array('tabindex' => '4')) . Html::closeElement('div');
     } else {
         $suppress = '';
     }
     $checkWatch = $user->getBoolOption('watchdeletion') || $user->isWatched($title);
     $form = Html::openElement('form', array('method' => 'post', 'action' => $title->getLocalURL('action=delete'), 'id' => 'deleteconfirm')) . Html::openElement('fieldset', array('id' => 'mw-delete-table')) . Html::element('legend', null, wfMessage('delete-legend')->text()) . Html::openElement('div', array('id' => 'mw-deleteconfirm-table')) . Html::openElement('div', array('id' => 'wpDeleteReasonListRow')) . Html::label(wfMessage('deletecomment')->text(), 'wpDeleteReasonList') . '&nbsp;' . Xml::listDropDown('wpDeleteReasonList', wfMessage('deletereason-dropdown')->inContentLanguage()->text(), wfMessage('deletereasonotherlist')->inContentLanguage()->text(), '', 'wpReasonDropDown', 1) . Html::closeElement('div') . Html::openElement('div', array('id' => 'wpDeleteReasonRow')) . Html::label(wfMessage('deleteotherreason')->text(), 'wpReason') . '&nbsp;' . Html::input('wpReason', $reason, 'text', array('size' => '60', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason', 'class' => 'mw-ui-input-inline', 'autofocus')) . Html::closeElement('div');
     # Disallow watching if user is not logged in
     if ($user->isLoggedIn()) {
         $form .= Xml::checkLabel(wfMessage('watchthis')->text(), 'wpWatch', 'wpWatch', $checkWatch, array('tabindex' => '3'));
     }
     $form .= Html::openElement('div') . $suppress . Xml::submitButton(wfMessage('deletepage')->text(), array('name' => 'wpConfirmB', 'id' => 'wpConfirmB', 'tabindex' => '5', 'class' => $useMediaWikiUIEverywhere ? 'mw-ui-button mw-ui-destructive' : '')) . Html::closeElement('div') . Html::closeElement('div') . Xml::closeElement('fieldset') . Html::hidden('wpEditToken', $user->getEditToken(array('delete', $title->getPrefixedText()))) . Xml::closeElement('form');
     if ($user->isAllowed('editinterface')) {
         $link = Linker::linkKnown($ctx->msg('deletereason-dropdown')->inContentLanguage()->getTitle(), wfMessage('delete-edit-reasonlist')->escaped(), array(), array('action' => 'edit'));
         $form .= '<p class="mw-delete-editreasons">' . $link . '</p>';
     }
     $outputPage->addHTML($form);
     $deleteLogPage = new LogPage('delete');
     $outputPage->addHTML(Xml::element('h2', null, $deleteLogPage->getName()->text()));
     LogEventsList::showLogExtract($outputPage, 'delete', $title);
 }
 /**
  * Generate a form allowing users to enter information
  *
  * @param string $title Value for context title field
  * @param string $input Value for input textbox
  * @return string
  */
 private function makeForm($title, $input)
 {
     $self = $this->getPageTitle();
     $request = $this->getRequest();
     $user = $this->getUser();
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
     $form .= "<fieldset><legend>" . $this->msg('expandtemplates')->escaped() . "</legend>\n";
     $form .= '<p>' . Xml::inputLabel($this->msg('expand_templates_title')->plain(), 'wpContextTitle', 'contexttitle', 60, $title, array('autofocus' => true)) . '</p>';
     $form .= '<p>' . Xml::label($this->msg('expand_templates_input')->text(), 'input') . '</p>';
     $form .= Xml::textarea('wpInput', $input, 10, 10, array('id' => 'input'));
     $form .= '<p>' . Xml::checkLabel($this->msg('expand_templates_remove_comments')->text(), 'wpRemoveComments', 'removecomments', $this->removeComments) . '</p>';
     $form .= '<p>' . Xml::checkLabel($this->msg('expand_templates_remove_nowiki')->text(), 'wpRemoveNowiki', 'removenowiki', $this->removeNowiki) . '</p>';
     $form .= '<p>' . Xml::checkLabel($this->msg('expand_templates_generate_xml')->text(), 'wpGenerateXml', 'generate_xml', $this->generateXML) . '</p>';
     $form .= '<p>' . Xml::checkLabel($this->msg('expand_templates_generate_rawhtml')->text(), 'wpGenerateRawHtml', 'generate_rawhtml', $this->generateRawHtml) . '</p>';
     $form .= '<p>' . Xml::submitButton($this->msg('expand_templates_ok')->text(), array('accesskey' => 's')) . '</p>';
     $form .= "</fieldset>\n";
     $form .= Html::hidden('wpEditToken', $user->getEditToken('', $request));
     $form .= Xml::closeElement('form');
     return $form;
 }
Esempio n. 21
0
 /**
  * Adds a table with checkboxes where you can select what groups to add/remove
  *
  * @param $usergroups Array: groups the user belongs to
  * @return string XHTML table element with checkboxes
  */
 private function groupCheckboxes($usergroups)
 {
     $allgroups = $this->getAllGroups();
     $ret = '';
     $column = 1;
     $settable_col = '';
     $unsettable_col = '';
     foreach ($allgroups as $group) {
         $set = in_array($group, $usergroups);
         # Should the checkbox be disabled?
         $disabled = !($set && $this->canRemove($group) || !$set && $this->canAdd($group));
         # Do we need to point out that this action is irreversible?
         $irreversible = !$disabled && ($set && !$this->canAdd($group) || !$set && !$this->canRemove($group));
         $attr = $disabled ? array('disabled' => 'disabled') : array();
         $text = $irreversible ? wfMsgHtml('userrights-irreversible-marker', User::getGroupMember($group)) : User::getGroupMember($group);
         $checkbox = Xml::checkLabel($text, "wpGroup-{$group}", "wpGroup-{$group}", $set, $attr);
         $checkbox = $disabled ? Xml::tags('span', array('class' => 'mw-userrights-disabled'), $checkbox) : $checkbox;
         if ($disabled) {
             $unsettable_col .= "{$checkbox}<br />\n";
         } else {
             $settable_col .= "{$checkbox}<br />\n";
         }
     }
     if ($column) {
         $ret .= Xml::openElement('table', array('border' => '0', 'class' => 'mw-userrights-groups')) . "<tr>\n";
         if ($settable_col !== '') {
             $ret .= xml::element('th', null, wfMsg('userrights-changeable-col'));
         }
         if ($unsettable_col !== '') {
             $ret .= xml::element('th', null, wfMsg('userrights-unchangeable-col'));
         }
         $ret .= "</tr>\n\t\t\t\t<tr>\n";
         if ($settable_col !== '') {
             $ret .= "\t\t\t\t\t<td style='vertical-align:top;'>\n\t\t\t\t\t\t{$settable_col}\n\t\t\t\t\t</td>\n";
         }
         if ($unsettable_col !== '') {
             $ret .= "\t\t\t\t\t<td style='vertical-align:top;'>\n\t\t\t\t\t\t{$unsettable_col}\n\t\t\t\t\t</td>\n";
         }
         $ret .= Xml::closeElement('tr') . Xml::closeElement('table');
     }
     return $ret;
 }
Esempio n. 22
0
    /**
     * Replace entire showEditForm, need to add our own textbox and stuff
     */
    function showEditForm($formCallback = null)
    {
        global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize, $wgTitle, $wgRequest;
        # If $wgTitle is null, that means we're in API mode.
        # Some hook probably called this function  without checking
        # for is_null($wgTitle) first. Bail out right here so we don't
        # do lots of work just to discard it right after.
        if (is_null($wgTitle)) {
            return;
        }
        $fname = 'EditPage::showEditForm';
        wfProfileIn($fname);
        $sk = $wgUser->getSkin();
        wfRunHooks('EditPage::showEditForm:initial', array(&$this));
        #need to parse the preview early so that we know which templates are used,
        #otherwise users with "show preview after edit box" will get a blank list
        #we parse this near the beginning so that setHeaders can do the title
        #setting work instead of leaving it in getPreviewText
        $previewOutput = '';
        if ($this->formtype == 'preview') {
            $previewOutput = $this->getPreviewText();
        }
        $this->setHeaders();
        # Enabled article-related sidebar, toplinks, etc.
        $wgOut->setArticleRelated(true);
        if ($this->isConflict) {
            $wgOut->wrapWikiMsg("<div class='mw-explainconflict'>\n\$1</div>", 'explainconflict');
            $this->textbox2 = $this->textbox1;
            $this->textbox1 = $this->getContent();
            $this->edittime = $this->mArticle->getTimestamp();
            # MeanEditor: too complicated for visual editing
            $this->noVisualEditor = false;
        } else {
            if ($this->section != '' && $this->section != 'new') {
                $matches = array();
                if (!$this->summary && !$this->preview && !$this->diff) {
                    preg_match("/^(=+)(.+)\\1/mi", $this->textbox1, $matches);
                    if (!empty($matches[2])) {
                        global $wgParser;
                        $this->summary = "/* " . $wgParser->stripSectionName(trim($matches[2])) . " */ ";
                    }
                }
            }
            if ($this->missingComment) {
                $wgOut->wrapWikiMsg('<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext');
            }
            if ($this->missingSummary && $this->section != 'new') {
                $wgOut->wrapWikiMsg('<div id="mw-missingsummary">$1</div>', 'missingsummary');
            }
            if ($this->missingSummary && $this->section == 'new') {
                $wgOut->wrapWikiMsg('<div id="mw-missingcommentheader">$1</div>', 'missingcommentheader');
            }
            if ($this->hookError !== '') {
                $wgOut->addWikiText($this->hookError);
            }
            if (!$this->checkUnicodeCompliantBrowser()) {
                $wgOut->addWikiMsg('nonunicodebrowser');
            }
            if (isset($this->mArticle) && isset($this->mArticle->mRevision)) {
                // Let sysop know that this will make private content public if saved
                if (!$this->mArticle->mRevision->userCan(Revision::DELETED_TEXT)) {
                    $wgOut->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1</div>\n", 'rev-deleted-text-permission');
                } else {
                    if ($this->mArticle->mRevision->isDeleted(Revision::DELETED_TEXT)) {
                        $wgOut->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1</div>\n", 'rev-deleted-text-view');
                    }
                }
                if (!$this->mArticle->mRevision->isCurrent()) {
                    $this->mArticle->setOldSubtitle($this->mArticle->mRevision->getId());
                    $wgOut->addWikiMsg('editingold');
                }
            }
        }
        if (wfReadOnly()) {
            $wgOut->wrapWikiMsg("<div id=\"mw-read-only-warning\">\n\$1\n</div>", array('readonlywarning', wfReadOnlyReason()));
            # MeanEditor: visual editing makes no sense here
            $this->noVisualEditor = true;
        } elseif ($wgUser->isAnon() && $this->formtype != 'preview') {
            $wgOut->wrapWikiMsg('<div id="mw-anon-edit-warning">$1</div>', 'anoneditwarning');
        } else {
            if ($this->isCssJsSubpage) {
                # Check the skin exists
                if ($this->isValidCssJsSubpage) {
                    if ($this->formtype !== 'preview') {
                        $wgOut->addWikiMsg('usercssjsyoucanpreview');
                    }
                } else {
                    $wgOut->addWikiMsg('userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage());
                }
            }
        }
        $classes = array();
        // Textarea CSS
        if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
        } elseif ($this->mTitle->isProtected('edit')) {
            # Is the title semi-protected?
            if ($this->mTitle->isSemiProtected()) {
                $noticeMsg = 'semiprotectedpagewarning';
                $classes[] = 'mw-textarea-sprotected';
            } else {
                # Then it must be protected based on static groups (regular)
                $noticeMsg = 'protectedpagewarning';
                $classes[] = 'mw-textarea-protected';
            }
            $wgOut->addHTML("<div class='mw-warning-with-logexcerpt'>\n");
            $wgOut->addWikiMsg($noticeMsg);
            LogEventsList::showLogExtract($wgOut, 'protect', $this->mTitle->getPrefixedText(), '', 1);
            $wgOut->addHTML("</div>\n");
        }
        if ($this->mTitle->isCascadeProtected()) {
            # Is this page under cascading protection from some source pages?
            list($cascadeSources, ) = $this->mTitle->getCascadeProtectionSources();
            $notice = "<div class='mw-cascadeprotectedwarning'>\$1\n";
            $cascadeSourcesCount = count($cascadeSources);
            if ($cascadeSourcesCount > 0) {
                # Explain, and list the titles responsible
                foreach ($cascadeSources as $page) {
                    $notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
                }
            }
            $notice .= '</div>';
            $wgOut->wrapWikiMsg($notice, array('cascadeprotectedwarning', $cascadeSourcesCount));
        }
        if (!$this->mTitle->exists() && $this->mTitle->getRestrictions('create')) {
            $wgOut->wrapWikiMsg('<div class="mw-titleprotectedwarning">$1</div>', 'titleprotectedwarning');
        }
        if ($this->kblength === false) {
            # MeanEditor: the length will probably be different in HTML
            $this->kblength = (int) (strlen($this->textbox1) / 1024);
        }
        if ($this->tooBig || $this->kblength > $wgMaxArticleSize) {
            $wgOut->addHTML("<div class='error' id='mw-edit-longpageerror'>\n");
            $wgOut->addWikiMsg('longpageerror', $wgLang->formatNum($this->kblength), $wgLang->formatNum($wgMaxArticleSize));
            $wgOut->addHTML("</div>\n");
        } elseif ($this->kblength > 29) {
            $wgOut->addHTML("<div id='mw-edit-longpagewarning'>\n");
            $wgOut->addWikiMsg('longpagewarning', $wgLang->formatNum($this->kblength));
            $wgOut->addHTML("</div>\n");
        }
        $q = 'action=' . $this->action;
        #if ( "no" == $redirect ) { $q .= "&redirect=no"; }
        $action = $wgTitle->escapeLocalURL($q);
        $summary = wfMsg('summary');
        $subject = wfMsg('subject');
        $cancel = $sk->makeKnownLink($wgTitle->getPrefixedText(), wfMsgExt('cancel', array('parseinline')));
        $separator = wfMsgExt('pipe-separator', 'escapenoentities');
        $edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
        $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
        global $wgRightsText;
        if ($wgRightsText) {
            $copywarnMsg = array('copyrightwarning', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText);
        } else {
            $copywarnMsg = array('copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]');
        }
        /* MeanEditor: always disable the toolbar */
        if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) {
            # prepare toolbar for edit buttons
            $toolbar = '';
        } else {
            $toolbar = '';
        }
        // activate checkboxes if user wants them to be always active
        if (!$this->preview && !$this->diff) {
            # Sort out the "watch" checkbox
            if ($wgUser->getOption('watchdefault')) {
                # Watch all edits
                $this->watchthis = true;
            } elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) {
                # Watch creations
                $this->watchthis = true;
            } elseif ($this->mTitle->userIsWatching()) {
                # Already watched
                $this->watchthis = true;
            }
            # May be overriden by request parameters
            if ($wgRequest->getBool('watchthis')) {
                $this->watchthis = true;
            }
            if ($wgUser->getOption('minordefault')) {
                $this->minoredit = true;
            }
            # MeanEditor: User preference
            if ($wgUser->getOption('prefer_traditional_editor')) {
                $this->userWantsTraditionalEditor = true;
            }
        }
        $wgOut->addHTML($this->editFormPageTop);
        if ($wgUser->getOption('previewontop')) {
            $this->displayPreviewArea($previewOutput, true);
        }
        $wgOut->addHTML($this->editFormTextTop);
        # if this is a comment, show a subject line at the top, which is also the edit summary.
        # Otherwise, show a summary field at the bottom
        $summarytext = $wgContLang->recodeForEdit($this->summary);
        # If a blank edit summary was previously provided, and the appropriate
        # user preference is active, pass a hidden tag as wpIgnoreBlankSummary. This will stop the
        # user being bounced back more than once in the event that a summary
        # is not required.
        #####
        # For a bit more sophisticated detection of blank summaries, hash the
        # automatic one and pass that in the hidden field wpAutoSummary.
        $summaryhiddens = '';
        if ($this->missingSummary) {
            $summaryhiddens .= Xml::hidden('wpIgnoreBlankSummary', true);
        }
        $autosumm = $this->autoSumm ? $this->autoSumm : md5($this->summary);
        $summaryhiddens .= Xml::hidden('wpAutoSummary', $autosumm);
        if ($this->section == 'new') {
            $commentsubject = '';
            if (!$wgRequest->getBool('nosummary')) {
                # Add a class if 'missingsummary' is triggered to allow styling of the summary line
                $summaryClass = $this->missingSummary ? 'mw-summarymissed' : 'mw-summary';
                $commentsubject = Xml::tags('label', array('for' => 'wpSummary'), $subject);
                $commentsubject = Xml::tags('span', array('class' => $summaryClass, 'id' => "wpSummaryLabel"), $commentsubject);
                $commentsubject .= '&nbsp;';
                $commentsubject .= Xml::input('wpSummary', 60, $summarytext, array('id' => 'wpSummary', 'maxlength' => '200', 'tabindex' => '1'));
            }
            $editsummary = "<div class='editOptions'>\n";
            global $wgParser;
            $formattedSummary = wfMsgForContent('newsectionsummary', $wgParser->stripSectionName($this->summary));
            $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('subject-preview') . $sk->commentBlock($formattedSummary, $this->mTitle, true) . "</div>\n" : '';
            $summarypreview = '';
        } else {
            $commentsubject = '';
            # Add a class if 'missingsummary' is triggered to allow styling of the summary line
            $summaryClass = $this->missingSummary ? 'mw-summarymissed' : 'mw-summary';
            $editsummary = Xml::tags('label', array('for' => 'wpSummary'), $summary);
            $editsummary = Xml::tags('span', array('class' => $summaryClass, 'id' => "wpSummaryLabel"), $editsummary) . ' ';
            $editsummary .= Xml::input('wpSummary', 60, $summarytext, array('id' => 'wpSummary', 'maxlength' => '200', 'tabindex' => '1'));
            // No idea where this is closed.
            $editsummary = Xml::openElement('div', array('class' => 'editOptions')) . $editsummary . '<br/>';
            $summarypreview = '';
            if ($summarytext && $this->preview) {
                $summarypreview = Xml::tags('div', array('class' => 'mw-summary-preview'), wfMsg('summary-preview') . $sk->commentBlock($this->summary, $this->mTitle));
            }
            $subjectpreview = '';
        }
        $commentsubject .= $summaryhiddens;
        # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
        if (!$this->preview && !$this->diff) {
            $wgOut->setOnloadHandler('document.editform.wpTextbox1.focus()');
        }
        $templates = $this->getTemplates();
        $formattedtemplates = $sk->formatTemplates($templates, $this->preview, $this->section != '');
        $hiddencats = $this->mArticle->getHiddenCategories();
        $formattedhiddencats = $sk->formatHiddenCategories($hiddencats);
        global $wgUseMetadataEdit;
        if ($wgUseMetadataEdit) {
            $metadata = $this->mMetaData;
            $metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata));
            $top = wfMsgWikiHtml('metadata_help');
            /* ToDo: Replace with clean code */
            $ew = $wgUser->getOption('editwidth');
            if ($ew) {
                $ew = " style=\"width:100%\"";
            } else {
                $ew = '';
            }
            $cols = $wgUser->getIntOption('cols');
            /* /ToDo */
            $metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
        } else {
            $metadata = "";
        }
        $recreate = '';
        if ($this->wasDeletedSinceLastEdit()) {
            if ('save' != $this->formtype) {
                $wgOut->wrapWikiMsg("<div class='error mw-deleted-while-editing'>\n\$1</div>", 'deletedwhileediting');
            } else {
                // Hide the toolbar and edit area, user can click preview to get it back
                // Add an confirmation checkbox and explanation.
                $toolbar = '';
                $recreate = '<div class="mw-confirm-recreate">' . $wgOut->parse(wfMsg('confirmrecreate', $this->lastDelete->user_name, $this->lastDelete->log_comment)) . Xml::checkLabel(wfMsg('recreate'), 'wpRecreate', 'wpRecreate', false, array('title' => $sk->titleAttrib('recreate'), 'tabindex' => 1, 'id' => 'wpRecreate')) . '</div>';
            }
        }
        $tabindex = 2;
        $checkboxes = $this->getCheckboxes($tabindex, $sk, array('minor' => $this->minoredit, 'watch' => $this->watchthis, 'want_traditional_editor' => $this->userWantsTraditionalEditor));
        $checkboxhtml = implode($checkboxes, "\n");
        $buttons = $this->getEditButtons($tabindex);
        $buttonshtml = implode($buttons, "\n");
        $safemodehtml = $this->checkUnicodeCompliantBrowser() ? '' : Xml::hidden('safemode', '1');
        $wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
END
);
        if (is_callable($formCallback)) {
            call_user_func_array($formCallback, array(&$wgOut));
        }
        wfRunHooks('EditPage::showEditForm:fields', array(&$this, &$wgOut));
        // Put these up at the top to ensure they aren't lost on early form submission
        $this->showFormBeforeText();
        $wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
{$subjectpreview}
{$this->editFormTextBeforeContent}
END
);
        if ($this->isConflict || $this->diff) {
            # MeanEditor: should be redundant, but let's be sure
            $this->noVisualEditor = true;
        }
        # MeanEditor: also apply htmlspecialchars? See $encodedtext
        $html_text = $this->safeUnicodeOutput($this->textbox1);
        if (!($this->noVisualEditor || $this->userWantsTraditionalEditor)) {
            $this->noVisualEditor = wfRunHooks('EditPage::wiki2html', array($this->mArticle, $wgUser, &$this, &$html_text));
        }
        if (!$this->noVisualEditor && !$this->userWantsTraditionalEditor) {
            $this->noVisualEditor = wfRunHooks('EditPage::showBox', array(&$this, $html_text, $rows, $cols, $ew));
        }
        if (!$this->noVisualEditor && !$this->userWantsTraditionalEditor) {
            $wgOut->addHTML("<input type='hidden' value=\"0\" name=\"wpNoVisualEditor\" />\n");
        } else {
            $wgOut->addHTML("<input type='hidden' value=\"1\" name=\"wpNoVisualEditor\" />\n");
            $this->showTextbox1($classes);
        }
        $wgOut->wrapWikiMsg("<div id=\"editpage-copywarn\">\n\$1\n</div>", $copywarnMsg);
        $wgOut->addHTML(<<<END
{$this->editFormTextAfterWarn}
{$metadata}
{$editsummary}
{$summarypreview}
{$checkboxhtml}
{$safemodehtml}
END
);
        $wgOut->addHTML("<div class='editButtons'>\n{$buttonshtml}\n\t<span class='editHelp'>{$cancel}{$separator}{$edithelp}</span>\n</div><!-- editButtons -->\n</div><!-- editOptions -->");
        /**
         * To make it harder for someone to slip a user a page
         * which submits an edit form to the wiki without their
         * knowledge, a random token is associated with the login
         * session. If it's not passed back with the submission,
         * we won't save the page, or render user JavaScript and
         * CSS previews.
         *
         * For anon editors, who may not have a session, we just
         * include the constant suffix to prevent editing from
         * broken text-mangling proxies.
         */
        $token = htmlspecialchars($wgUser->editToken());
        $wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n");
        $this->showEditTools();
        $wgOut->addHTML(<<<END
{$this->editFormTextAfterTools}
<div class='templatesUsed'>
{$formattedtemplates}
</div>
<div class='hiddencats'>
{$formattedhiddencats}
</div>
END
);
        if ($this->isConflict && wfRunHooks('EditPageBeforeConflictDiff', array(&$this, &$wgOut))) {
            $wgOut->wrapWikiMsg('==$1==', "yourdiff");
            $de = new DifferenceEngine($this->mTitle);
            $de->setText($this->textbox2, $this->textbox1);
            $de->showDiff(wfMsg("yourtext"), wfMsg("storedversion"));
            $wgOut->wrapWikiMsg('==$1==', "yourtext");
            $this->showTextbox2();
        }
        $wgOut->addHTML($this->editFormTextBottom);
        $wgOut->addHTML("</form>\n");
        if (!$wgUser->getOption('previewontop')) {
            $this->displayPreviewArea($previewOutput, false);
        }
        wfProfileOut($fname);
    }
Esempio n. 23
0
 private function showForm()
 {
     global $wgImportSources, $wgExportMaxLinkDepth;
     $action = $this->getTitle()->getLocalUrl(array('action' => 'submit'));
     $user = $this->getUser();
     $out = $this->getOutput();
     if ($user->isAllowed('importupload')) {
         $out->addHTML(Xml::fieldset($this->msg('import-upload')->text()) . Xml::openElement('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action, 'id' => 'mw-import-upload-form')) . $this->msg('importtext')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'upload') . Xml::openElement('table', array('id' => 'mw-import-table')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-upload-filename')->text(), 'xmlimport') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('xmlimport', 50, '', array('type' => 'file')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-comment')->text(), 'mw-import-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, '', array('id' => 'mw-import-comment', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('uploadbtn')->text()) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Html::hidden('editToken', $user->getEditToken()) . Xml::closeElement('form') . Xml::closeElement('fieldset'));
     } else {
         if (empty($wgImportSources)) {
             $out->addWikiMsg('importnosources');
         }
     }
     if ($user->isAllowed('import') && !empty($wgImportSources)) {
         # Show input field for import depth only if $wgExportMaxLinkDepth > 0
         $importDepth = '';
         if ($wgExportMaxLinkDepth > 0) {
             $importDepth = "<tr>\n\t\t\t\t\t\t\t<td class='mw-label'>" . $this->msg('export-pagelinks')->parse() . "</td>\n\t\t\t\t\t\t\t<td class='mw-input'>" . Xml::input('pagelink-depth', 3, 0) . "</td>\n\t\t\t\t\t\t</tr>";
         }
         $out->addHTML(Xml::fieldset($this->msg('importinterwiki')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form')) . $this->msg('import-interwiki-text')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'interwiki') . Html::hidden('editToken', $user->getEditToken()) . Xml::openElement('table', array('id' => 'mw-import-table')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-source')->text(), 'interwiki') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::openElement('select', array('name' => 'interwiki')));
         foreach ($wgImportSources as $prefix) {
             $selected = $this->interwiki === $prefix ? ' selected="selected"' : '';
             $out->addHTML(Xml::option($prefix, $prefix, $selected));
         }
         $out->addHTML(Xml::closeElement('select') . Xml::input('frompage', 50, $this->frompage) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-history')->text(), 'interwikiHistory', 'interwikiHistory', $this->history) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-templates')->text(), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$importDepth}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-namespace')->text(), 'namespace') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $this->namespace, 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-comment')->text(), 'mw-interwiki-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, '', array('id' => 'mw-interwiki-comment', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('import-interwiki-submit')->text(), Linker::tooltipAndAccesskeyAttribs('import')) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset'));
     }
 }
Esempio n. 24
0
 function getPageHeader()
 {
     global $wgScript, $wgRequest;
     $self = $this->getTitle();
     $limit = $this->mLimit ? Xml::hidden('limit', $this->mLimit) : '';
     $out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     # Form tag
     $out .= Xml::fieldset(wfMsg('activeusers')) . "\n";
     $out .= Xml::hidden('title', $self->getPrefixedDBkey()) . $limit . "\n";
     $out .= Xml::inputLabel(wfMsg('activeusers-from'), 'username', 'offset', 20, $this->requestedUser) . '<br />';
     # Username field
     $out .= Xml::checkLabel(wfMsg('activeusers-hidebots'), 'hidebots', 'hidebots', $this->opts->getValue('hidebots'));
     $out .= Xml::checkLabel(wfMsg('activeusers-hidesysops'), 'hidesysops', 'hidesysops', $this->opts->getValue('hidesysops')) . '<br />';
     $out .= Xml::submitButton(wfMsg('allpagessubmit')) . "\n";
     # Submit button and form bottom
     $out .= Xml::closeElement('fieldset');
     $out .= Xml::closeElement('form');
     return $out;
 }
 /**
  * @param bool $noRedirect
  * @return string Formatted HTML
  */
 protected function getRedirectCheck($noRedirect)
 {
     return '<span class="mw-input-with-label">' . Xml::checkLabel($this->msg('protectedpages-noredirect')->text(), 'noredirect', 'noredirect', $noRedirect) . "</span>\n";
 }
 /**
  * @return string HTML
  */
 protected function buildCheckBoxes()
 {
     $html = '<table>';
     // If there is just one item, use checkboxes
     $list = $this->getList();
     if ($list->length() == 1) {
         $list->reset();
         $bitfield = $list->current()->getBits();
         // existing field
         if ($this->submitClicked) {
             $bitfield = RevisionDeleter::extractBitfield($this->extractBitParams(), $bitfield);
         }
         foreach ($this->checks as $item) {
             // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
             // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
             list($message, $name, $field) = $item;
             $innerHTML = Xml::checkLabel($this->msg($message)->text(), $name, $name, $bitfield & $field);
             if ($field == Revision::DELETED_RESTRICTED) {
                 $innerHTML = "<b>{$innerHTML}</b>";
             }
             $line = Xml::tags('td', array('class' => 'mw-input'), $innerHTML);
             $html .= "<tr>{$line}</tr>\n";
         }
     } else {
         // Otherwise, use tri-state radios
         $html .= '<tr>';
         $html .= '<th class="mw-revdel-checkbox">' . $this->msg('revdelete-radio-same')->escaped() . '</th>';
         $html .= '<th class="mw-revdel-checkbox">' . $this->msg('revdelete-radio-unset')->escaped() . '</th>';
         $html .= '<th class="mw-revdel-checkbox">' . $this->msg('revdelete-radio-set')->escaped() . '</th>';
         $html .= "<th></th></tr>\n";
         foreach ($this->checks as $item) {
             // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
             // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
             list($message, $name, $field) = $item;
             // If there are several items, use third state by default...
             if ($this->submitClicked) {
                 $selected = $this->getRequest()->getInt($name, 0);
             } else {
                 $selected = -1;
                 // use existing field
             }
             $line = '<td class="mw-revdel-checkbox">' . Xml::radio($name, -1, $selected == -1) . '</td>';
             $line .= '<td class="mw-revdel-checkbox">' . Xml::radio($name, 0, $selected == 0) . '</td>';
             $line .= '<td class="mw-revdel-checkbox">' . Xml::radio($name, 1, $selected == 1) . '</td>';
             $label = $this->msg($message)->escaped();
             if ($field == Revision::DELETED_RESTRICTED) {
                 $label = "<b>{$label}</b>";
             }
             $line .= "<td>{$label}</td>";
             $html .= "<tr>{$line}</tr>\n";
         }
     }
     $html .= '</table>';
     return $html;
 }
Esempio n. 27
0
 protected function showHideCheck($options, $message, $name, $value)
 {
     $options[$name] = 1 - (int) $value;
     return '<span class="mw-input-with-label">' . Xml::checkLabel($this->msg($message, '')->text(), $name, $name, (int) $value) . '</span>';
 }
 /**
  * Print the history page for an article.
  */
 function onView()
 {
     $out = $this->getOutput();
     $request = $this->getRequest();
     /**
      * Allow client caching.
      */
     if ($out->checkLastModified($this->page->getTouched())) {
         return;
         // Client cache fresh and headers sent, nothing more to do.
     }
     wfProfileIn(__METHOD__);
     $this->preCacheMessages();
     $config = $this->context->getConfig();
     # Fill in the file cache if not set already
     $useFileCache = $config->get('UseFileCache');
     if ($useFileCache && HTMLFileCache::useFileCache($this->getContext())) {
         $cache = HTMLFileCache::newFromTitle($this->getTitle(), 'history');
         if (!$cache->isCacheGood()) {
             ob_start(array(&$cache, 'saveToFileCache'));
         }
     }
     // Setup page variables.
     $out->setFeedAppendQuery('action=history');
     $out->addModules('mediawiki.action.history');
     if ($config->get('UseMediaWikiUIEverywhere')) {
         $out = $this->getOutput();
         $out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox'));
     }
     // Handle atom/RSS feeds.
     $feedType = $request->getVal('feed');
     if ($feedType) {
         $this->feed($feedType);
         wfProfileOut(__METHOD__);
         return;
     }
     // Fail nicely if article doesn't exist.
     if (!$this->page->exists()) {
         $out->addWikiMsg('nohistory');
         # show deletion/move log if there is an entry
         LogEventsList::showLogExtract($out, array('delete', 'move'), $this->getTitle(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice')));
         wfProfileOut(__METHOD__);
         return;
     }
     /**
      * Add date selector to quickly get to a certain time
      */
     $year = $request->getInt('year');
     $month = $request->getInt('month');
     $tagFilter = $request->getVal('tagfilter');
     $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter);
     /**
      * Option to show only revisions that have been (partially) hidden via RevisionDelete
      */
     if ($request->getBool('deleted')) {
         $conds = array('rev_deleted != 0');
     } else {
         $conds = array();
     }
     if ($this->getUser()->isAllowed('deletedhistory')) {
         $checkDeleted = Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deleted', 'mw-show-deleted-only', $request->getBool('deleted')) . "\n";
     } else {
         $checkDeleted = '';
     }
     // Add the general form
     $action = htmlspecialchars(wfScript());
     $out->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset($this->msg('history-fieldset-title')->text(), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year == null ? MWTimestamp::getLocalInstance()->format('Y') : $year, $month) . '&#160;' . ($tagSelector ? implode('&#160;', $tagSelector) . '&#160;' : '') . $checkDeleted . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n" . '</fieldset></form>');
     wfRunHooks('PageHistoryBeforeList', array(&$this->page, $this->getContext()));
     // Create and output the list.
     $pager = new HistoryPager($this, $year, $month, $tagFilter, $conds);
     $out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
     $out->preventClickjacking($pager->getPreventClickjacking());
     wfProfileOut(__METHOD__);
 }
Esempio n. 29
0
 /**
  * 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>');
         }
     }
 }
Esempio n. 30
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @return String: HTML fragment
  */
 protected function getForm()
 {
     global $wgScript;
     $this->opts['title'] = $this->getTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     $form = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form'));
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated');
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Xml::tags('td', array('class' => 'mw-label'), array_shift($tagFilter)) . Xml::tags('td', array('class' => 'mw-input'), implode('&#160', $tagFilter));
     } else {
         $filterSelection = Xml::tags('td', array('colspan' => 2), '');
     }
     $targetSelection = Xml::tags('td', array('colspan' => 2), Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input')) . '<br />' . Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input')) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '40', 'required' => '', 'class' => 'mw-input') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ');
     $namespaceSelection = Xml::tags('td', array('class' => 'mw-label'), Xml::label($this->msg('namespace')->text(), 'namespace', '')) . Xml::tags('td', null, Html::namespaceSelector(array('selected' => $this->opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . '&#160;') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . '&#160;'));
     $extraOptions = Xml::tags('td', array('colspan' => 2), Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input'))) . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input'))));
     $dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit')));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text()) . Xml::openElement('table', array('class' => 'mw-contributions-table')) . Xml::openElement('tr') . $targetSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $namespaceSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $filterSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $extraOptions . Xml::closeElement('tr') . Xml::openElement('tr') . $dateSelectionAndSubmit . Xml::closeElement('tr') . Xml::closeElement('table');
     $explain = $this->msg('sp-contributions-explain');
     if ($explain->exists()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
     }
     $form .= Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $form;
 }