function show()
 {
     global $wgOut, $wgUser;
     // Header
     $wgOut->setSubTitle(wfMsg('abusefilter-tools-subtitle'));
     $wgOut->addWikiMsg('abusefilter-tools-text');
     // Expression evaluator
     $eval = '';
     $eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
     // Only let users with permission actually test it
     if ($wgUser->isAllowed('abusefilter-modify')) {
         $eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'onclick' => 'doExprSubmit();', 'value' => wfMsg('abusefilter-tools-submitexpr'))));
         $eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
     }
     $eval = Xml::fieldset(wfMsg('abusefilter-tools-expr'), $eval);
     $wgOut->addHTML($eval);
     // Associated script
     $exprScript = file_get_contents(dirname(__FILE__) . '/tools.js');
     $wgOut->addInlineScript($exprScript);
     global $wgUser;
     if ($wgUser->isAllowed('abusefilter-modify')) {
         // Hacky little box to re-enable autoconfirmed if it got disabled
         $rac = '';
         $rac .= Xml::inputLabel(wfMsg('abusefilter-tools-reautoconfirm-user'), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
         $rac .= ' ';
         $rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'onclick' => 'doReautoSubmit();', 'value' => wfMsg('abusefilter-tools-reautoconfirm-submit')));
         $rac = Xml::fieldset(wfMsg('abusefilter-tools-reautoconfirm'), $rac);
         $wgOut->addHTML($rac);
     }
 }
 function show()
 {
     $out = $this->getOutput();
     $user = $this->getUser();
     // Header
     $out->addWikiMsg('abusefilter-tools-text');
     // Expression evaluator
     $eval = '';
     $eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
     // Only let users with permission actually test it
     if ($user->isAllowed('abusefilter-modify')) {
         $eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'value' => $this->msg('abusefilter-tools-submitexpr')->text())));
         $eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
     }
     $eval = Xml::fieldset($this->msg('abusefilter-tools-expr')->text(), $eval);
     $out->addHTML($eval);
     $out->addModules('ext.abuseFilter.tools');
     if ($user->isAllowed('abusefilter-modify')) {
         // Hacky little box to re-enable autoconfirmed if it got disabled
         $rac = '';
         $rac .= Xml::inputLabel($this->msg('abusefilter-tools-reautoconfirm-user')->text(), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
         $rac .= ' ';
         $rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'value' => $this->msg('abusefilter-tools-reautoconfirm-submit')->text()));
         $rac = Xml::fieldset($this->msg('abusefilter-tools-reautoconfirm')->text(), $rac);
         $out->addHTML($rac);
     }
 }
 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, '') . ' ' . 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();
     }
 }
Esempio n. 5
0
 public function fooBarBaz($par)
 {
     global $wgBarBarBar, $wgUser;
     if ($par) {
         return;
     }
     $wgBarBarBar->dobar(Xml::fieldset(wfMessage('importinterwiki')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $par, 'id' => 'mw-import-interwiki-form')) . wfMessage('import-interwiki-text')->parse() . Xml::hidden('action', 'submit') . Xml::hidden('source', 'interwiki') . Xml::hidden('editToken', $wgUser->editToken()), 'secondArgument');
     $foo = $par;
     return $foo + $wgBarBarBar + $this->foo;
 }
	protected function getAddForm() {
		return Xml::fieldset( wfMsg( 'premoderation-wl-addip-fieldset' ) ) .
			Xml::openElement( 'form', array( 'id' => 'prem-wl-form', 'method' => 'post' ) ) .
			'<table><tr><td>' .	wfMsg( 'premoderation-private-ip' ) . '</td><td>' .
			Xml::input( 'ip', 50, '', array( 'id' => 'prem-whitelist-addip' ) ) . '</td></tr>' .
			'<tr><td>' . wfMsg( 'summary' ) . '</td><td>' . Xml::input( 'summary', 50, '',
			array( 'id' => 'prem-summary' ) ) . '</td></tr><tr>' . '<td>' .
			Xml::submitButton( wfMsg( 'htmlform-submit' ), array( 'id' => 'prem-wl-submit' ) ) .
			'<input type="hidden" name="action" value="add" /></td></tr></table>' .
			Xml::closeElement( 'form' ) . Xml::closeElement( 'fieldset' );
	}
 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());
 }
Esempio n. 8
0
 function execute($subpage)
 {
     global $wgRequest, $wgOut;
     $wgOut->setPageTitle('Wikitext Preview');
     if ($wikitext = $wgRequest->getText('wikitext')) {
         $wgOut->addHTML(Xml::fieldset('Wikitext preview', $wgOut->parse($wikitext)));
     }
     $f = Xml::textarea('wikitext', $wikitext);
     $f .= Xml::submitButton('Preview wikitext');
     $f .= Html::Hidden('title', $this->getTitle()->getPrefixedText());
     $f = Xml::tags('form', array('method' => 'POST', 'action' => $this->getTitle()->getLocalURL()), $f);
     $wgOut->addHTML(Xml::fieldset('Preview wikitext', $f));
 }
    function buildForm()
    {
        $attrs = ['id' => 'mw-allmessages-form-lang', 'name' => 'lang'];
        $msg = wfMessage('allmessages-language');
        $langSelect = Xml::languageSelector($this->langcode, false, null, $attrs, $msg);
        $out = Xml::openElement('form', ['method' => 'get', 'action' => $this->getConfig()->get('Script'), 'id' => 'mw-allmessages-form']) . Xml::fieldset($this->msg('allmessages-filter-legend')->text()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('table', ['class' => 'mw-allmessages-table']) . "\n" . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('allmessages-prefix')->text(), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->displayPrefix), ['id' => 'mw-allmessages-form-prefix']) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t<td class='mw-label'>" . $this->msg('allmessages-filter')->escaped() . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('allmessages-filter-unmodified')->text(), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter === 'unmodified') . Xml::radioLabel($this->msg('allmessages-filter-all')->text(), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter === 'all') . Xml::radioLabel($this->msg('allmessages-filter-modified')->text(), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter === 'modified') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . $langSelect[0] . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . $langSelect[1] . "</td>\n\n\t\t\t</tr>" . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('table_pager_limit_label')->text(), 'mw-table_pager_limit_label') . '</td>
			<td class="mw-input">' . $this->getLimitSelect(['id' => 'mw-table_pager_limit_label']) . '</td>
			<tr>
				<td></td>
				<td>' . Xml::submitButton($this->msg('allmessages-filter-submit')->text()) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->getHiddenFields(['title', 'prefix', 'filter', 'lang', 'limit']) . Xml::closeElement('fieldset') . Xml::closeElement('form');
        return $out;
    }
Esempio n. 10
0
    function buildForm()
    {
        global $wgScript;
        $languages = Language::getLanguageNames(false);
        ksort($languages);
        $out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form')) . Xml::fieldset(wfMsg('allmessages-filter-legend')) . Xml::hidden('title', $this->getTitle()) . Xml::openElement('table', array('class' => 'mw-allmessages-table')) . "\n" . '<tr>
				<td class="mw-label">' . Xml::label(wfMsg('allmessages-prefix'), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->prefix), array('id' => 'mw-allmessages-form-prefix')) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class='mw-label'>" . wfMsg('allmessages-filter') . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel(wfMsg('allmessages-filter-unmodified'), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter == 'unmodified' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-all'), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter == 'all' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-modified'), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter == 'modified' ? true : false) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . Xml::label(wfMsg('allmessages-language'), 'mw-allmessages-form-lang') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::openElement('select', array('id' => 'mw-allmessages-form-lang', 'name' => 'lang'));
        foreach ($languages as $lang => $name) {
            $selected = $lang == $this->langCode ? true : false;
            $out .= Xml::option($lang . ' - ' . $name, $lang, $selected) . "\n";
        }
        $out .= Xml::closeElement('select') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsg('allmessages-filter-submit')) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->table->getHiddenFields(array('title', 'prefix', 'filter', 'lang')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
        return $out;
    }
Esempio n. 11
0
 /**
  * Wrap the form innards in an actual <form> element
  * @param $html String HTML contents to wrap.
  * @return String wrapped HTML.
  */
 function wrapForm($html)
 {
     # Include a <fieldset> wrapper for style, if requested.
     if ($this->mWrapperLegend !== false) {
         $html = Xml::fieldset($this->mWrapperLegend, $html);
     }
     # Use multipart/form-data
     $encType = $this->mUseMultipart ? 'multipart/form-data' : 'application/x-www-form-urlencoded';
     # Attributes
     $attribs = array('action' => $this->getTitle()->getFullURL($this->query), 'method' => $this->mMethod, 'class' => 'visualClear', 'enctype' => $encType);
     if (!empty($this->mId)) {
         $attribs['id'] = $this->mId;
     }
     return Html::rawElement('form', $attribs, $html);
 }
	/**
	 * Show the ViewUserLang form
	 * @param $target Mixed: user whose language and test wiki we're about to look up
	 */
	function showForm( $target ) {
		global $wgScript, $wgOut;

		$wgOut->addHTML(
			Xml::fieldset( wfMsgHtml( 'wminc-viewuserlang' ) ) .
			Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
			Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
			"<p>" .
				Xml::inputLabel( wfMsgHtml( 'wminc-viewuserlang-user' ), 'target', 'viewuserlang-username', 40, $target ) .
				' ' .
				Xml::submitButton( wfMsgHtml( 'wminc-viewuserlang-go' ) ) .
			"</p>" .
			Xml::closeElement( 'form' ) .
			Xml::closeElement( 'fieldset' )
		);
	}
Esempio n. 13
0
 function show()
 {
     $filter = $this->mPage->mFilter;
     global $wgUser, $wgRequest, $wgOut;
     $sk = $wgUser->getSkin();
     if (!$wgUser->isAllowed('abusefilter-revert')) {
         $wgOut->permissionRequired('abusefilter-revert');
         return;
     }
     $this->loadParameters();
     if ($this->attemptRevert()) {
         return;
     }
     $wgOut->addWikiMsg('abusefilter-revert-intro', $filter);
     $wgOut->setPageTitle(wfMsg('abusefilter-revert-title', $filter));
     // First, the search form.
     $searchFields = array();
     $searchFields['abusefilter-revert-filter'] = Xml::element('strong', null, $filter);
     $searchFields['abusefilter-revert-periodstart'] = Xml::input('wpPeriodStart', 45, $this->origPeriodStart);
     $searchFields['abusefilter-revert-periodend'] = Xml::input('wpPeriodEnd', 45, $this->origPeriodEnd);
     $searchForm = Xml::buildForm($searchFields, 'abusefilter-revert-search');
     $searchForm .= "\n" . Xml::hidden('submit', 1);
     $searchForm = Xml::tags('form', array('action' => $this->getTitle("revert/{$filter}")->getLocalURL(), 'method' => 'POST'), $searchForm);
     $searchForm = Xml::fieldset(wfMsg('abusefilter-revert-search-legend'), $searchForm);
     $wgOut->addHTML($searchForm);
     if ($this->mSubmit) {
         // Add a summary of everything that will be reversed.
         $wgOut->addWikiMsg('abusefilter-revert-preview-intro');
         // Look up all of them.
         $results = $this->doLookup();
         $list = array();
         foreach ($results as $result) {
             $displayActions = array();
             global $wgLang;
             $displayActions = array_map(array('AbuseFilter', 'getActionDisplay'), $result['actions']);
             $msg = wfMsgExt('abusefilter-revert-preview-item', array('parseinline', 'replaceafter'), array($wgLang->timeanddate($result['timestamp'], true), $sk->userLink($result['userid'], $result['user']), $result['action'], $sk->link($result['title']), $wgLang->commaList($displayActions), $sk->link(SpecialPage::getTitleFor('AbuseLog'), wfMsgNoTrans('abusefilter-log-detailslink'), array(), array('details' => $result['id']))));
             $list[] = Xml::tags('li', null, $msg);
         }
         $wgOut->addHTML(Xml::tags('ul', null, implode("\n", $list)));
         // Add a button down the bottom.
         $confirmForm = Xml::hidden('editToken', $wgUser->editToken("abusefilter-revert-{$filter}")) . Xml::hidden('title', $this->getTitle("revert/{$filter}")->getPrefixedText()) . Xml::hidden('wpPeriodStart', $this->origPeriodStart) . Xml::hidden('wpPeriodEnd', $this->origPeriodEnd) . Xml::inputLabel(wfMsg('abusefilter-revert-reasonfield'), 'wpReason', 'wpReason', 45) . "\n" . Xml::submitButton(wfMsg('abusefilter-revert-confirm'));
         $confirmForm = Xml::tags('form', array('action' => $this->getTitle("revert/{$filter}")->getLocalURL(), 'method' => 'post'), $confirmForm);
         $wgOut->addHTML($confirmForm);
     }
 }
 public function getHTML()
 {
     global $wgRequest, $wgScript, $wgTitle;
     $s = '';
     $s .= Xml::fieldset(wfMsg('listuserrestrictions-legend'));
     $s .= "<form action=\"{$wgScript}\">";
     $s .= Xml::hidden('title', $wgTitle->getPrefixedDbKey());
     $s .= Xml::label(wfMsgHtml('listuserrestrictions-type'), 'type') . '&nbsp;' . self::typeSelector('type', $wgRequest->getVal('type'), 'type');
     $s .= '&nbsp;';
     $s .= Xml::inputLabel(wfMsgHtml('listuserrestrictions-user'), 'user', 'user', false, $wgRequest->getVal('user'));
     $s .= '<p>';
     $s .= Xml::label(wfMsgHtml('listuserrestrictions-namespace'), 'namespace') . '&nbsp;' . Xml::namespaceSelector($wgRequest->getVal('namespace'), '', 'namespace');
     $s .= '&nbsp;';
     $s .= Xml::inputLabel(wfMsgHtml('listuserrestrictions-page'), 'page', 'page', false, $wgRequest->getVal('page'));
     $s .= Xml::submitButton(wfMsg('listuserrestrictions-submit'));
     $s .= "</p></form></fieldset>";
     return $s;
 }
	protected function showForm() {
		global $wgOut, $wgScript, $wgFeedbackNamespaces;
		$form = Xml::openElement( 'form',
			array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) );
		$form .= Xml::fieldset( wfMsg( 'ratedpages-leg' ) );
		$form .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() );
		$form .= ReaderFeedbackXML::getRatingTierMenu($this->tier) . '&#160;';
		if( count($wgFeedbackNamespaces) > 1 ) {
			$form .= ReaderFeedbackXML::getNamespaceMenu( $this->namespace ) . '&#160;';
		}
		if( count( ReaderFeedback::getFeedbackTags() ) > 0 ) {
			$form .= ReaderFeedbackXML::getTagMenu( $this->tag );
		}
		$form .= " " . Xml::submitButton( wfMsg( 'go' ) ) .
			Xml::closeElement( 'fieldset' ) .
			Xml::closeElement( 'form' ) . "\n";

		$wgOut->addHTML( $form );
	}
 /**
  * Process the 'delvote' action.
  * @param Article $article The article to endorse/object to deletion of.
  */
 public function process($article)
 {
     global $wgRequest, $wgOut, $wgUser;
     $errs = $article->mTitle->getUserPermissionsErrors('deletequeue-vote', $wgUser);
     if (count($errs) > 0) {
         $wgOut->showPermissionsErrorPage($errs);
         return;
     }
     $dqi = DeleteQueueItem::newFromArticle($article);
     $wgOut->setPageTitle(wfMsg('deletequeue-vote-title', $article->mTitle->getPrefixedText()));
     // Load form data
     $token = $wgRequest->getVal('wpEditToken');
     $action = $wgRequest->getVal('wpVote');
     $comments = $wgRequest->getText('wpComments');
     if ($wgUser->matchEditToken($token) && in_array($action, array('endorse', 'object'))) {
         $dqi->addVote($action, $comments);
         if ($action == 'object' && $dqi->getQueue() == 'prod') {
             $dbw = wfGetDB(DB_MASTER);
             $dbw->begin();
             $dqi->setQueue('deletediscuss', $dqi->getReason());
             $lp = new LogPage('delete');
             $lp->addEntry('requeue', $article->mTitle, $comments, array(wfMsgForContent('deletequeue-queue-prod'), wfMsgForContent("deletequeue-queue-deletediscuss")));
             $dbw->commit();
             $wgOut->addWikiMsg('deletequeue-vote-requeued', wfMsgNoTrans('deletequeue-queue-deletediscuss'));
         } else {
             $wgOut->addWikiMsg("deletequeue-vote-success-{$action}");
         }
         return;
     }
     $wgOut->addWikiMsg('deletequeue-vote-text', $article->mTitle->getPrefixedText(), $dqi->getReason());
     // Add main form.
     $fields = array();
     $options = Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-endorse'), 'wpVote', 'endorse', 'mw-deletequeue-vote-endorse'));
     $options .= Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-object'), 'wpVote', 'object', 'mw-deletequeue-vote-object'));
     $fields['deletequeue-vote-action'] = $options;
     $fields['deletequeue-vote-reason'] = Xml::input('wpComments', 45, $comments);
     $article_id = $article->getId();
     $title = $this->getTitle("vote/{$article_id}");
     $form = Xml::buildForm($fields, 'deletequeue-vote-submit') . Html::Hidden('wpEditToken', $wgUser->editToken()) . Html::Hidden('title', $title->getPrefixedText());
     $form = Xml::tags('form', array('action' => $title->getLocalURL(), 'method' => 'POST'), $form);
     $form = Xml::fieldset(wfMsg('deletequeue-vote-legend'), $form);
     $wgOut->addHTML($form);
 }
Esempio n. 17
0
 function showForm()
 {
     global $wgOut, $wgUser, $wgRequest;
     $wgOut->disallowUserJs();
     $self = SpecialPage::getTitleFor('Resetpass');
     if (!$this->mUserName) {
         $this->mUserName = $wgUser->getName();
     }
     $rememberMe = '';
     if (!$wgUser->isLoggedIn()) {
         $rememberMe = '<tr>' . '<td></td>' . '<td class="mw-input">' . Xml::checkLabel(wfMsg('remembermypassword'), 'wpRemember', 'wpRemember', $wgRequest->getCheck('wpRemember')) . '</td>' . '</tr>';
         $submitMsg = 'resetpass_submit';
         $oldpassMsg = 'resetpass-temp-password';
     } else {
         $oldpassMsg = 'oldpassword';
         $submitMsg = 'resetpass-submit-loggedin';
     }
     $wgOut->addHTML(Xml::fieldset(wfMsg('resetpass_header')) . Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl(), 'id' => 'mw-resetpass-form')) . Xml::hidden('token', $wgUser->editToken()) . Xml::hidden('wpName', $this->mUserName) . Xml::hidden('returnto', $wgRequest->getVal('returnto')) . wfMsgExt('resetpass_text', array('parse')) . Xml::openElement('table', array('id' => 'mw-resetpass-table')) . $this->pretty(array(array('wpName', 'username', 'text', $this->mUserName), array('wpPassword', $oldpassMsg, 'password', $this->mOldpass), array('wpNewPassword', 'newpassword', 'password', ''), array('wpRetype', 'retypenew', 'password', ''))) . $rememberMe . '<tr>' . '<td></td>' . '<td class="mw-input">' . Xml::submitButton(wfMsg($submitMsg)) . '</td>' . '</tr>' . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset'));
 }
 function showSearch()
 {
     // Add selector
     $selector = '';
     $selectFields = array();
     # Same fields as in Test
     $selectFields['abusefilter-test-user'] = Xml::input('wpSearchUser', 45, $this->mSearchUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpSearchPeriodStart', 45, $this->mSearchPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpSearchPeriodEnd', 45, $this->mSearchPeriodEnd);
     $selector .= Xml::buildForm($selectFields, 'abusefilter-examine-submit');
     $selector .= Html::hidden('submit', 1);
     $selector .= Html::hidden('title', $this->getTitle('examine')->getPrefixedText());
     $selector = Xml::tags('form', array('action' => $this->getTitle('examine')->getLocalURL(), 'method' => 'get'), $selector);
     $selector = Xml::fieldset($this->msg('abusefilter-examine-legend')->text(), $selector);
     $this->getOutput()->addHTML($selector);
     if ($this->mSubmit) {
         $this->showResults();
     }
 }
function wfSpecialRemoveRestrictions()
{
    global $wgOut, $wgRequest, $wgUser, $wgLang;
    $sk = $wgUser->getSkin();
    $title = SpecialPage::getTitleFor('RemoveRestrictions');
    $id = $wgRequest->getVal('id');
    if (!is_numeric($id)) {
        $wgOut->addWikiMsg('removerestrictions-noid');
        return;
    }
    UserRestriction::purgeExpired();
    $r = UserRestriction::newFromId($id, true);
    if (!$r) {
        $wgOut->addWikiMsg('removerestrictions-wrongid');
        return;
    }
    $form = array();
    $form['removerestrictions-user'] = $sk->userLink($r->getSubjectId(), $r->getSubjectText()) . $sk->userToolLinks($r->getSubjectId(), $r->getSubjectText());
    $form['removerestrictions-type'] = UserRestriction::formatType($r->getType());
    if ($r->isPage()) {
        $form['removerestrictions-page'] = $sk->link($r->getPage());
    }
    if ($r->isNamespace()) {
        $form['removerestrictions-namespace'] = $wgLang->getDisplayNsText($r->getNamespace());
    }
    $form['removerestrictions-reason'] = Xml::input('reason');
    $result = null;
    if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('edittoken'))) {
        $result = wfSpecialRemoveRestrictionsProcess($r);
    }
    $wgOut->addWikiMsg('removerestrictions-intro');
    $wgOut->addHTML(Xml::fieldset(wfMsgHtml('removerestrictions-legend')));
    if ($result) {
        $wgOut->addHTML('<strong class="success">' . wfMsgExt('removerestrictions-success', 'parseinline', $r->getSubjectText()) . '</strong>');
    }
    $wgOut->addHTML(Xml::openElement('form', array('action' => $title->getLocalUrl(array('id' => $id)), 'method' => 'post')));
    $wgOut->addHTML(Xml::buildForm($form, 'removerestrictions-submit'));
    $wgOut->addHTML(Xml::hidden('id', $r->getId()));
    $wgOut->addHTML(Xml::hidden('title', $title->getPrefixedDbKey()));
    $wgOut->addHTML(Xml::hidden('edittoken', $wgUser->editToken()));
    $wgOut->addHTML("</form></fieldset>");
}
Esempio n. 20
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);
 }
Esempio n. 21
0
 function show()
 {
     global $wgRequest, $wgOut, $wgLang, $wgUser;
     $filter = $this->mFilter;
     if ($filter) {
         $wgOut->setPageTitle(wfMsg('abusefilter-history', $filter));
     } else {
         $wgOut->setPageTitle(wfMsg('abusefilter-filter-log'));
     }
     # Check perms
     if ($filter && !$wgUser->isAllowed('abusefilter-modify') && AbuseFilter::filterHidden($filter)) {
         $wgOut->addWikiMsg('abusefilter-history-error-hidden');
         return;
     }
     # Useful links
     $sk = $wgUser->getSkin();
     $links = array();
     if ($filter) {
         $links['abusefilter-history-backedit'] = $this->getTitle($filter);
     }
     foreach ($links as $msg => $title) {
         $links[$msg] = $sk->link($title, wfMsgExt($msg, 'parseinline'));
     }
     $backlinks = $wgLang->pipeList($links);
     $wgOut->addHTML(Xml::tags('p', null, $backlinks));
     # For user
     $user = $wgRequest->getText('user');
     if ($user) {
         $wgOut->setSubtitle(wfMsg('abusefilter-history-foruser', $sk->userLink(1, $user), $user));
     }
     // Add filtering of changes et al.
     $fields['abusefilter-history-select-user'] = Xml::input('user', 45, $user);
     $filterForm = Xml::buildForm($fields, 'abusefilter-history-select-submit');
     $filterForm .= "\n" . Xml::hidden('title', $this->getTitle("history/{$filter}"));
     $filterForm = Xml::tags('form', array('action' => $this->getTitle("history/{$filter}")->getLocalURL(), 'method' => 'get'), $filterForm);
     $filterForm = Xml::fieldset(wfMsg('abusefilter-history-select-legend'), $filterForm);
     $wgOut->addHTML($filterForm);
     $pager = new AbuseFilterHistoryPager($filter, $this, $user);
     $table = $pager->getBody();
     $wgOut->addHTML($pager->getNavigationBar() . $table . $pager->getNavigationBar());
 }
 function show()
 {
     $out = $this->getOutput();
     $filter = $this->mFilter;
     if ($filter) {
         $out->setPageTitle($this->msg('abusefilter-history', $filter));
     } else {
         $out->setPageTitle($this->msg('abusefilter-filter-log'));
     }
     # Check perms
     if ($filter && !$this->getUser()->isAllowed('abusefilter-modify') && AbuseFilter::filterHidden($filter)) {
         $out->addWikiMsg('abusefilter-history-error-hidden');
         return;
     }
     # Useful links
     $links = array();
     if ($filter) {
         $links['abusefilter-history-backedit'] = $this->getTitle($filter);
     }
     foreach ($links as $msg => $title) {
         $links[$msg] = Linker::link($title, $this->msg($msg)->parse());
     }
     $backlinks = $this->getLanguage()->pipeList($links);
     $out->addHTML(Xml::tags('p', null, $backlinks));
     # For user
     $user = User::getCanonicalName($this->getRequest()->getText('user'), 'valid');
     if ($user) {
         $out->addSubtitle($this->msg('abusefilter-history-foruser', Linker::userLink(1, $user), $user)->text());
     }
     // Add filtering of changes et al.
     $fields['abusefilter-history-select-user'] = Xml::input('user', 45, $user);
     $filterForm = Xml::buildForm($fields, 'abusefilter-history-select-submit');
     $filterForm .= "\n" . Html::hidden('title', $this->getTitle("history/{$filter}"));
     $filterForm = Xml::tags('form', array('action' => $this->getTitle("history/{$filter}")->getLocalURL(), 'method' => 'get'), $filterForm);
     $filterForm = Xml::fieldset($this->msg('abusefilter-history-select-legend')->text(), $filterForm);
     $out->addHTML($filterForm);
     $pager = new AbuseFilterHistoryPager($filter, $this, $user);
     $table = $pager->getBody();
     $out->addHTML($pager->getNavigationBar() . $table . $pager->getNavigationBar());
 }
	function execute( $par ) {
		global $wgRequest, $wgOut, $wgScript;

		$this->setHeaders();

		# Get request data from, e.g.
		$action = $wgRequest->getText( 'action' );

		$query = htmlentities( $wgRequest->getText( 'query' ) );

		# Output
		$wgOut->addHTML(
			Xml::fieldset( wfMsg( RefHelper::MSG . 'refsearch_legend' ) ) .
			Xml::openElement( 'form', array( 'action' => $wgScript, 'id' => 'mw_search-ref-form' ) ) .
			Html::Hidden( 'title', $this->getTitle()->getPrefixedText() ) .
			Html::Hidden( 'action', 'submit' ) .
			Xml::openElement( 'table', array( 'id' => 'mw_search-ref-table' ) ) .
			Xml::openElement( 'tbody' ) );

		$wgOut->addHTML(
			Xml::openElement( 'tr' ) .
			Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) .
			Xml::input( 'query', 50, $query ) .
			Xml::closeElement( 'td' ) .
			Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) .
			Xml::element( 'input', array( 'value' => wfMsg( RefHelper::MSG . 'search' ), 'type' => 'submit' ) ) .
			Xml::closeElement( 'td' ) .
			Xml::closeElement( 'tr' ) );

		$wgOut->addHTML(
			Xml::closeElement( 'tbody' ) .
			Xml::closeElement( 'table' ) .
			Xml::closeElement( 'form' ) );

		$reqfilled = strlen( $query );
		if ( $action == "submit" || $reqfilled ) {
			$wgOut->addHTML( self::perform_search( $query ) );
		}
		$wgOut->addHTML( Xml::closeElement( 'fieldset' ) );
	}
 /**
  * Generate the content of each table row (1 row = 1 banner)
  * @param $row object: database row
  * @return string HTML
  */
 function formatRow($row)
 {
     // Begin banner row
     $htmlOut = Xml::openElement('tr');
     if ($this->editable) {
         // Remove box
         $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('removeTemplates[]', false, array('value' => $row->tmp_name, 'onchange' => $this->onRemoveChange)));
     }
     // Link and Preview
     $render = new SpecialBannerLoader();
     $render->siteName = 'Wikipedia';
     $render->language = $this->mRequest->getVal('wpUserLanguage');
     try {
         $preview = $render->getHtmlNotice($row->tmp_name);
     } catch (SpecialBannerLoaderException $e) {
         $preview = wfMsg('centralnotice-nopreview');
     }
     $htmlOut .= Xml::tags('td', array('valign' => 'top'), $this->getSkin()->makeLinkObj($this->viewPage, htmlspecialchars($row->tmp_name), 'template=' . urlencode($row->tmp_name)) . Xml::fieldset(wfMsg('centralnotice-preview'), $preview, array('class' => 'cn-bannerpreview')));
     // End banner row
     $htmlOut .= Xml::closeElement('tr');
     return $htmlOut;
 }
 /**
  * Generate the content of each table row (1 row = 1 banner)
  */
 function formatRow($row)
 {
     // Begin banner row
     $htmlOut = Xml::openElement('tr');
     if ($this->editable) {
         // Add box
         $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('addTemplates[]', '', array('value' => $row->tmp_name)));
         // Weight select
         $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::listDropDown("weight[{$row->tmp_id}]", CentralNotice::dropDownList(wfMsg('centralnotice-weight'), range(0, 100, 5)), '', '25', '', ''));
     }
     // Link and Preview
     $render = new SpecialBannerLoader();
     $render->siteName = 'Wikipedia';
     $render->language = $this->mRequest->getVal('wpUserLanguage');
     try {
         $preview = $render->getHtmlNotice($row->tmp_name);
     } catch (SpecialBannerLoaderException $e) {
         $preview = wfMsg('centralnotice-nopreview');
     }
     $htmlOut .= Xml::tags('td', array('valign' => 'top'), $this->getSkin()->makeLinkObj($this->viewPage, htmlspecialchars($row->tmp_name), 'template=' . urlencode($row->tmp_name)) . Xml::fieldset(wfMsg('centralnotice-preview'), $preview, array('class' => 'cn-bannerpreview')));
     // End banner row
     $htmlOut .= Xml::closeElement('tr');
     return $htmlOut;
 }
Esempio n. 26
0
 protected function showForm()
 {
     global $wgRequirePasswordforEmailChange;
     $user = $this->getUser();
     $oldEmailText = $user->getEmail() ? $user->getEmail() : $this->msg('changeemail-none')->text();
     $this->getOutput()->addHTML(Xml::fieldset($this->msg('changeemail-header')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'mw-changeemail-form')) . "\n" . Html::hidden('token', $user->getEditToken()) . "\n" . Html::hidden('returnto', $this->getRequest()->getVal('returnto')) . "\n" . $this->msg('changeemail-text')->parseAsBlock() . "\n" . Xml::openElement('table', array('id' => 'mw-changeemail-table')) . "\n");
     $items = array(array('wpName', 'username', 'text', $user->getName()), array('wpOldEmail', 'changeemail-oldemail', 'text', $oldEmailText), array('wpNewEmail', 'changeemail-newemail', 'input', $this->mNewEmail));
     if ($wgRequirePasswordforEmailChange) {
         $items[] = array('wpPassword', 'yourpassword', 'password', $this->mPassword);
     }
     $this->getOutput()->addHTML($this->pretty($items) . "\n" . "<tr>\n" . "<td></td>\n" . '<td class="mw-input">' . Xml::submitButton($this->msg('changeemail-submit')->text()) . Xml::submitButton($this->msg('changeemail-cancel')->text(), array('name' => 'wpCancel')) . "</td>\n" . "</tr>\n" . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset') . "\n");
 }
Esempio n. 27
0
/**
 * @file
 * @ingroup SpecialPage
 * FIXME: this code is crap, should use Pager and Database::select().
 */
function wfSpecialNewimages($par, $specialPage)
{
    global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMiserMode;
    $wpIlMatch = $wgRequest->getText('wpIlMatch');
    $dbr = wfGetDB(DB_SLAVE);
    $sk = $wgUser->getSkin();
    $shownav = !$specialPage->including();
    $hidebots = $wgRequest->getBool('hidebots', 1);
    $hidebotsql = '';
    if ($hidebots) {
        # Make a list of group names which have the 'bot' flag set.
        $botconds = array();
        foreach (User::getGroupsWithPermission('bot') as $groupname) {
            $botconds[] = 'ug_group = ' . $dbr->addQuotes($groupname);
        }
        # If not bot groups, do not set $hidebotsql
        if ($botconds) {
            $isbotmember = $dbr->makeList($botconds, LIST_OR);
            # This join, in conjunction with WHERE ug_group IS NULL, returns
            # only those rows from IMAGE where the uploading user is not a mem-
            # ber of a group which has the 'bot' permission set.
            $ug = $dbr->tableName('user_groups');
            $hidebotsql = " LEFT JOIN {$ug} ON img_user=ug_user AND ({$isbotmember})";
        }
    }
    $image = $dbr->tableName('image');
    $sql = "SELECT img_timestamp from {$image}";
    if ($hidebotsql) {
        $sql .= "{$hidebotsql} WHERE ug_group IS NULL";
    }
    $sql .= ' ORDER BY img_timestamp DESC LIMIT 1';
    $res = $dbr->query($sql, __FUNCTION__);
    $row = $dbr->fetchRow($res);
    if ($row !== false) {
        $ts = $row[0];
    } else {
        $ts = false;
    }
    $dbr->freeResult($res);
    $sql = '';
    # If we were clever, we'd use this to cache.
    $latestTimestamp = wfTimestamp(TS_MW, $ts);
    # Hardcode this for now.
    $limit = 48;
    if ($parval = intval($par)) {
        if ($parval <= $limit && $parval > 0) {
            $limit = $parval;
        }
    }
    $where = array();
    $searchpar = '';
    if ($wpIlMatch != '' && !$wgMiserMode) {
        $nt = Title::newFromUrl($wpIlMatch);
        if ($nt) {
            $m = $dbr->escapeLike(strtolower($nt->getDBkey()));
            $where[] = "LOWER(img_name) LIKE '%{$m}%'";
            $searchpar = '&wpIlMatch=' . urlencode($wpIlMatch);
        }
    }
    $invertSort = false;
    if ($until = $wgRequest->getVal('until')) {
        $where[] = "img_timestamp < '" . $dbr->timestamp($until) . "'";
    }
    if ($from = $wgRequest->getVal('from')) {
        $where[] = "img_timestamp >= '" . $dbr->timestamp($from) . "'";
        $invertSort = true;
    }
    $sql = 'SELECT img_size, img_name, img_user, img_user_text,' . "img_description,img_timestamp FROM {$image}";
    if ($hidebotsql) {
        $sql .= $hidebotsql;
        $where[] = 'ug_group IS NULL';
    }
    if (count($where)) {
        $sql .= ' WHERE ' . $dbr->makeList($where, LIST_AND);
    }
    $sql .= ' ORDER BY img_timestamp ' . ($invertSort ? '' : ' DESC');
    $sql .= ' LIMIT ' . ($limit + 1);
    $res = $dbr->query($sql, __FUNCTION__);
    /**
     * We have to flip things around to get the last N after a certain date
     */
    $images = array();
    while ($s = $dbr->fetchObject($res)) {
        if ($invertSort) {
            array_unshift($images, $s);
        } else {
            array_push($images, $s);
        }
    }
    $dbr->freeResult($res);
    $gallery = new ImageGallery();
    $firstTimestamp = null;
    $lastTimestamp = null;
    $shownImages = 0;
    foreach ($images as $s) {
        $shownImages++;
        if ($shownImages > $limit) {
            # One extra just to test for whether to show a page link;
            # don't actually show it.
            break;
        }
        $name = $s->img_name;
        $ut = $s->img_user_text;
        $nt = Title::newFromText($name, NS_FILE);
        $ul = $sk->makeLinkObj(Title::makeTitle(NS_USER, $ut), $ut);
        $gallery->add($nt, "{$ul}<br />\n<i>" . $wgLang->timeanddate($s->img_timestamp, true) . "</i><br />\n");
        $timestamp = wfTimestamp(TS_MW, $s->img_timestamp);
        if (empty($firstTimestamp)) {
            $firstTimestamp = $timestamp;
        }
        $lastTimestamp = $timestamp;
    }
    $titleObj = SpecialPage::getTitleFor('Newimages');
    $action = $titleObj->getLocalURL($hidebots ? '' : 'hidebots=0');
    if ($shownav && !$wgMiserMode) {
        $wgOut->addHTML(Xml::openElement('form', array('action' => $action, 'method' => 'post', 'id' => 'imagesearch')) . Xml::fieldset(wfMsg('newimages-legend')) . Xml::inputLabel(wfMsg('newimages-label'), 'wpIlMatch', 'wpIlMatch', 20, $wpIlMatch) . ' ' . Xml::submitButton(wfMsg('ilsubmit'), array('name' => 'wpIlSubmit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
    }
    $bydate = wfMsg('bydate');
    $lt = $wgLang->formatNum(min($shownImages, $limit));
    if ($shownav) {
        $text = wfMsgExt('imagelisttext', array('parse'), $lt, $bydate);
        $wgOut->addHTML($text . "\n");
    }
    /**
     * Paging controls...
     */
    # If we change bot visibility, this needs to be carried along.
    if (!$hidebots) {
        $botpar = '&hidebots=0';
    } else {
        $botpar = '';
    }
    $now = wfTimestampNow();
    $d = $wgLang->date($now, true);
    $t = $wgLang->time($now, true);
    $dateLink = $sk->makeKnownLinkObj($titleObj, wfMsgHtml('sp-newimages-showfrom', $d, $t), 'from=' . $now . $botpar . $searchpar);
    $botLink = $sk->makeKnownLinkObj($titleObj, wfMsgHtml('showhidebots', $hidebots ? wfMsgHtml('show') : wfMsgHtml('hide')), 'hidebots=' . ($hidebots ? '0' : '1') . $searchpar);
    $opts = array('parsemag', 'escapenoentities');
    $prevLink = wfMsgExt('pager-newer-n', $opts, $wgLang->formatNum($limit));
    if ($firstTimestamp && $firstTimestamp != $latestTimestamp) {
        $prevLink = $sk->makeKnownLinkObj($titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar);
    }
    $nextLink = wfMsgExt('pager-older-n', $opts, $wgLang->formatNum($limit));
    if ($shownImages > $limit && $lastTimestamp) {
        $nextLink = $sk->makeKnownLinkObj($titleObj, $nextLink, 'until=' . $lastTimestamp . $botpar . $searchpar);
    }
    $prevnext = '<p>' . $botLink . ' ' . wfMsgHtml('viewprevnext', $prevLink, $nextLink, $dateLink) . '</p>';
    if ($shownav) {
        $wgOut->addHTML($prevnext);
    }
    if (count($images)) {
        $wgOut->addHTML($gallery->toHTML());
        if ($shownav) {
            $wgOut->addHTML($prevnext);
        }
    } else {
        $wgOut->addWikiMsg('noimages');
    }
}
Esempio n. 28
0
 function setTopText(FormOptions $opts)
 {
     $nondefaults = $opts->getChangedValues();
     $form = "";
     $user = $this->getUser();
     $dbr = $this->getDB();
     $numItems = $this->countItems($dbr);
     $showUpdatedMarker = $this->getConfig()->get('ShowUpdatedMarker');
     // Show watchlist header
     $form .= "<p>";
     if ($numItems == 0) {
         $form .= $this->msg('nowatchlist')->parse() . "\n";
     } else {
         $form .= $this->msg('watchlist-details')->numParams($numItems)->parse() . "\n";
         if ($this->getConfig()->get('EnotifWatchlist') && $user->getOption('enotifwatchlistpages')) {
             $form .= $this->msg('wlheader-enotif')->parse() . "\n";
         }
         if ($showUpdatedMarker) {
             $form .= $this->msg('wlheader-showupdated')->parse() . "\n";
         }
     }
     $form .= "</p>";
     if ($numItems > 0 && $showUpdatedMarker) {
         $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-resetbutton')) . "\n" . Xml::submitButton($this->msg('enotif_reset')->text(), array('name' => 'dummy')) . "\n" . Html::hidden('reset', 'all') . "\n";
         foreach ($nondefaults as $key => $value) {
             $form .= Html::hidden($key, $value) . "\n";
         }
         $form .= Xml::closeElement('form') . "\n";
     }
     $form .= Xml::openElement('form', array('method' => 'get', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-form'));
     $form .= Xml::fieldset($this->msg('watchlist-options')->text(), false, array('id' => 'mw-watchlist-options'));
     $form .= $this->makeLegend();
     $this->getOutput()->addHTML($form);
 }
 /**
  * @param $group
  */
 function buildGroupView($group)
 {
     $editable = $this->userCanEdit($this->getUser());
     $subtitleMessage = $editable ? 'centralauth-editgroup-subtitle' : 'centralauth-editgroup-subtitle-readonly';
     $this->getOutput()->setSubtitle($this->msg($subtitleMessage, $group));
     $fieldsetClass = $editable ? 'mw-centralauth-editgroup' : 'mw-centralauth-editgroup-readonly';
     $html = Xml::fieldset($this->msg('centralauth-editgroup-fieldset', $group)->text(), false, array('class' => $fieldsetClass));
     if ($editable) {
         $html .= Xml::openElement('form', array('method' => 'post', 'action' => SpecialPage::getTitleFor('GlobalGroupPermissions', $group)->getLocalUrl(), 'name' => 'centralauth-globalgroups-newgroup'));
         $html .= Html::hidden('wpGroup', $group);
         $html .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
     }
     $fields = array();
     if ($editable) {
         $fields['centralauth-editgroup-name'] = Xml::input('wpGlobalGroupName', 50, $group);
     } else {
         $fields['centralauth-editgroup-name'] = $group;
     }
     if ($this->getUser()->isAllowed('editinterface')) {
         # Show edit link only to user with the editinterface right
         $fields['centralauth-editgroup-display'] = $this->msg('centralauth-editgroup-display-edit', $group, User::getGroupName($group))->parse();
         $fields['centralauth-editgroup-member'] = $this->msg('centralauth-editgroup-member-edit', $group, User::getGroupMember($group))->parse();
     } else {
         $fields['centralauth-editgroup-display'] = User::getGroupName($group);
         $fields['centralauth-editgroup-member'] = User::getGroupMember($group);
     }
     $fields['centralauth-editgroup-members'] = $this->msg('centralauth-editgroup-members-link', $group, User::getGroupMember($group))->parse();
     $fields['centralauth-editgroup-restrictions'] = $this->buildWikiSetSelector($group);
     $fields['centralauth-editgroup-perms'] = $this->buildCheckboxes($group);
     if ($editable) {
         $fields['centralauth-editgroup-reason'] = Xml::input('wpReason', 60);
     }
     $html .= Xml::buildForm($fields, $editable ? 'centralauth-editgroup-submit' : null);
     if ($editable) {
         $html .= Xml::closeElement('form');
     }
     $html .= Xml::closeElement('fieldset');
     $this->getOutput()->addHTML($html);
     $this->showLogFragment($group, $this->getOutput());
 }
Esempio n. 30
0
 /**
  * @todo Document
  * @param $fields array[]|HTMLFormField[] array of fields (either arrays or objects)
  * @param $sectionName string ID attribute of the "<table>" tag for this section, ignored if empty
  * @param $fieldsetIDPrefix string ID prefix for the "<fieldset>" tag of each subsection, ignored if empty
  * @return String
  */
 public function displaySection($fields, $sectionName = '', $fieldsetIDPrefix = '')
 {
     $displayFormat = $this->getDisplayFormat();
     $html = '';
     $subsectionHtml = '';
     $hasLabel = false;
     $getFieldHtmlMethod = $displayFormat == 'table' ? 'getTableRow' : 'get' . ucfirst($displayFormat);
     foreach ($fields as $key => $value) {
         if ($value instanceof HTMLFormField) {
             $v = empty($value->mParams['nodata']) ? $this->mFieldData[$key] : $value->getDefault();
             $html .= $value->{$getFieldHtmlMethod}($v);
             $labelValue = trim($value->getLabel());
             if ($labelValue != '&#160;' && $labelValue !== '') {
                 $hasLabel = true;
             }
         } elseif (is_array($value)) {
             $section = $this->displaySection($value, $key);
             $legend = $this->getLegend($key);
             if (isset($this->mSectionHeaders[$key])) {
                 $section = $this->mSectionHeaders[$key] . $section;
             }
             if (isset($this->mSectionFooters[$key])) {
                 $section .= $this->mSectionFooters[$key];
             }
             $attributes = array();
             if ($fieldsetIDPrefix) {
                 $attributes['id'] = Sanitizer::escapeId("{$fieldsetIDPrefix}{$key}");
             }
             $subsectionHtml .= Xml::fieldset($legend, $section, $attributes) . "\n";
         }
     }
     if ($displayFormat !== 'raw') {
         $classes = array();
         if (!$hasLabel) {
             // Avoid strange spacing when no labels exist
             $classes[] = 'mw-htmlform-nolabel';
         }
         $attribs = array('class' => implode(' ', $classes));
         if ($sectionName) {
             $attribs['id'] = Sanitizer::escapeId("mw-htmlform-{$sectionName}");
         }
         if ($displayFormat === 'table') {
             $html = Html::rawElement('table', $attribs, Html::rawElement('tbody', array(), "\n{$html}\n")) . "\n";
         } elseif ($displayFormat === 'div') {
             $html = Html::rawElement('div', $attribs, "\n{$html}\n");
         }
     }
     if ($this->mSubSectionBeforeFields) {
         return $subsectionHtml . "\n" . $html;
     } else {
         return $html . "\n" . $subsectionHtml;
     }
 }