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);
     }
 }
Exemplo n.º 2
0
 /**
  * Once a set of revisions have been selected,
  * list them and request a reason/comment for confirmation.
  */
 function showForm()
 {
     global $wgOut, $wgUser;
     $special = Title::makeTitle(NS_SPECIAL, 'HideRevision');
     $wgOut->addWikiText(wfMsg('hiderevision-text'));
     $wgOut->addHtml($this->revisionList() . $this->archiveList() . Xml::openElement('form', array('action' => $special->getLocalUrl('action=submit'), 'method' => 'post')) . "<br />" . Xml::inputLabel(wfMsgHTML('hiderevision-reason'), 'wpReason', 'wpReason', 60, $this->mReason) . "<br />" . Xml::submitButton(wfMsgHTML('hiderevision-submit')) . $this->revisionFields() . Html::Hidden('wpEditToken', $wgUser->editToken()) . Xml::closeElement('form'));
 }
 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();
     }
 }
 /**
  * Output a form to allow searching for a user
  */
 function switchForm()
 {
     global $wgScript;
     $this->getOutput()->addModules('ext.centralauth.globaluserautocomplete');
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getPageTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), $this->msg('userrights-lookup-user')->text()) . Xml::inputLabel($this->msg('userrights-user-editname')->text(), 'user', 'username', 30, $this->mTarget, array('class' => 'mw-autocomplete-global-user')) . ' <br />' . Xml::submitButton($this->msg('editusergroup')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
Exemplo n.º 5
0
 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 .= '&#160;';
         $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);
     }
 }
Exemplo n.º 6
0
 public function execute($subpage)
 {
     global $wgOut, $wgRequest, $wgUser, $wgCacheEpoch, $wgCityId;
     wfProfileIn(__METHOD__);
     $this->setHeaders();
     $this->mTitle = SpecialPage::getTitleFor('UserData');
     if ($this->isRestricted() && !$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     $result = '';
     $userId = $wgRequest->getInt('userId');
     if ($userId) {
         $user = User::newFromId($userId);
         if (!empty($user)) {
             //todo: add nicer result - right now only name and link to user page
             $result = Xml::element('a', array('href' => $user->getUserPage()->getLocalURL()), $user->getName(), false);
         }
     }
     $wgOut->addHTML(Xml::openElement('form', array('action' => $this->mTitle->getFullURL(), 'method' => 'get')));
     $wgOut->addHTML(Xml::inputLabel(wfMsg('userdata-userid-label'), 'userId', 'user-id', false, $userId));
     $wgOut->addHTML('<br>' . Xml::submitButton(wfMsg('userdata-submit')));
     $wgOut->addHTML(Xml::closeElement('form'));
     if ($result) {
         $wgOut->addHTML('<hr>' . $result);
     }
     wfProfileOut(__METHOD__);
 }
Exemplo n.º 7
0
 function getPageHeader()
 {
     global $wgScript, $wgMiserMode;
     # Do not show useless input form if wiki is running in misermode
     if ($wgMiserMode) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getTitle();
     return Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('withoutinterwiki-legend')) . Html::hidden('title', $t->getPrefixedText()) . Xml::inputLabel(wfMsg('allpagesprefix'), 'prefix', 'wiprefix', 20, $prefix) . ' ' . Xml::submitButton(wfMsg('withoutinterwiki-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
 }
 function draw_OTP()
 {
     global $wgOut, $wgUser;
     $formu = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl('action=submit')));
     $formu .= Xml::inputLabel(wfMsg('latch-OTP') . ' ', 'txt_OTP', 'txt_OTP', 20) . '<BR>&nbsp';
     $formu .= Xml::submitButton(wfMsg('latch-enter'), array('name' => 'clickBotOTP')) . '<BR>';
     # Adding protection against CSRF
     $formu .= Html::hidden('token', $wgUser->getEditToken(), array('id' => 'token'));
     $formu .= Xml::closeElement('form');
     $wgOut->addHTML($formu);
 }
Exemplo n.º 9
0
 function execute($par)
 {
     $mime = $par ? $par : $this->getRequest()->getText('mime');
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->addHTML(Xml::openElement('form', array('id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor('MIMEsearch')->getLocalUrl())) . Xml::openElement('fieldset') . Html::hidden('title', SpecialPage::getTitleFor('MIMEsearch')->getPrefixedText()) . Xml::element('legend', null, wfMsg('mimesearch')) . Xml::inputLabel(wfMsg('mimetype'), 'mime', 'mime', 20, $mime) . ' ' . Xml::submitButton(wfMsg('ilsubmit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
     list($this->major, $this->minor) = File::splitMime($mime);
     if ($this->major == '' || $this->minor == '' || $this->minor == 'unknown' || !self::isValidType($this->major)) {
         return;
     }
     parent::execute($par);
 }
Exemplo n.º 10
0
 function execute($par)
 {
     global $wgUrlProtocols, $wgMiserMode;
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->allowClickjacking();
     $request = $this->getRequest();
     $target = $request->getVal('target', $par);
     $namespace = $request->getIntorNull('namespace', null);
     $protocols_list = array();
     foreach ($wgUrlProtocols as $prot) {
         if ($prot !== '//') {
             $protocols_list[] = $prot;
         }
     }
     $target2 = $target;
     $protocol = '';
     $pr_sl = strpos($target2, '//');
     $pr_cl = strpos($target2, ':');
     if ($pr_sl) {
         // For protocols with '//'
         $protocol = substr($target2, 0, $pr_sl + 2);
         $target2 = substr($target2, $pr_sl + 2);
     } elseif (!$pr_sl && $pr_cl) {
         // For protocols without '//' like 'mailto:'
         $protocol = substr($target2, 0, $pr_cl + 1);
         $target2 = substr($target2, $pr_cl + 1);
     } elseif ($protocol == '' && $target2 != '') {
         // default
         $protocol = 'http://';
     }
     if ($protocol != '' && !in_array($protocol, $protocols_list)) {
         // unsupported protocol, show original search request
         $target2 = $target;
         $protocol = '';
     }
     $out->addWikiMsg('linksearch-text', '<nowiki>' . $this->getLanguage()->commaList($protocols_list) . '</nowiki>');
     $s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Html::hidden('title', $this->getTitle()->getPrefixedDbKey()) . '<fieldset>' . Xml::element('legend', array(), $this->msg('linksearch')->text()) . Xml::inputLabel($this->msg('linksearch-pat')->text(), 'target', 'target', 50, $target) . ' ';
     if (!$wgMiserMode) {
         $s .= Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('linksearch-ns')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'));
     }
     $s .= Xml::submitButton($this->msg('linksearch-ok')->text()) . '</fieldset>' . Xml::closeElement('form');
     $out->addHTML($s);
     if ($target != '') {
         $this->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
         parent::execute($par);
         if ($this->mMungedQuery === false) {
             $out->addWikiMsg('linksearch-error');
         }
     }
 }
/**
 * Output the HTML search form, and constructs the MIMEsearchPage object.
 */
function wfSpecialMIMEsearch($par = null)
{
    global $wgRequest, $wgTitle, $wgOut;
    $mime = isset($par) ? $par : $wgRequest->getText('mime');
    $wgOut->addHTML(Xml::openElement('form', array('id' => 'specialmimesearch', 'method' => 'get', 'action' => $wgTitle->getLocalUrl())) . Xml::inputLabel(wfMsg('mimetype'), 'mime', 'mime', 20, $mime) . Xml::submitButton(wfMsg('ilsubmit')) . Xml::closeElement('form'));
    list($major, $minor) = wfSpecialMIMEsearchParse($mime);
    if ($major == '' or $minor == '' or !wfSpecialMIMEsearchValidType($major)) {
        return;
    }
    $wpp = new MIMEsearchPage($major, $minor);
    list($limit, $offset) = wfCheckLimits();
    $wpp->doQuery($offset, $limit);
}
Exemplo n.º 12
0
 /**
  * Generate a form to allow users to enter an ISBN
  *
  * @return string
  */
 private function makeForm()
 {
     global $wgScript;
     $title = self::getTitleFor('Booksources');
     $form = '<fieldset><legend>' . wfMsgHtml('booksources-search-legend') . '</legend>';
     $form .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $form .= Xml::hidden('title', $title->getPrefixedText());
     $form .= '<p>' . Xml::inputLabel(wfMsg('booksources-isbn'), 'isbn', 'isbn', 20, $this->isbn);
     $form .= '&nbsp;' . Xml::submitButton(wfMsg('booksources-go')) . '</p>';
     $form .= Xml::closeElement('form');
     $form .= '</fieldset>';
     return $form;
 }
 function makeFilterForm()
 {
     $filterForm = Xml::openElement('form', array('method' => 'get', 'action' => $this->getConfig()->get('Script')));
     $filterForm .= Xml::openElement('fieldset') . Xml::element('legend', null, $this->msg('approvedrevs-filter-legend')->text()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::inputLabel($this->msg('approvedrevs-filter-field-org')->text(), 'organization', 'filter-field-org', null, $this->mOrganization) . ' ';
     /*
                     Xml::inputLabel(
                         $this->msg('approvedrevs-filter-field-group' )->text(),
                         'group', 'filter-field-group', null, $group ) . ' ' .
     */
     $filterForm .= $this->getModeSelector();
     $filterForm .= Xml::submitButton($this->msg('approvedrevs-filter-field-submit')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $filterForm;
 }
 /**
  * Output a form to allow searching for a user
  */
 function switchForm()
 {
     global $wgScript;
     $knownwiki = $this->getRequest()->getVal('wpKnownWiki');
     $knownwiki = $knownwiki ? $knownwiki : wfWikiId();
     // Generate wiki selector
     $selector = new XmlSelect('wpKnownWiki', 'wpKnownWiki', $knownwiki);
     foreach (CentralAuthUser::getWikiList() as $wiki) {
         $selector->addOption($wiki);
     }
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('userrights-lookup-user')) . Xml::inputLabel(wfMsg('userrights-user-editname'), 'user', 'username', 30, $this->mTarget) . ' <br />' . Xml::label(wfMsg('centralauth-globalgrouppermissions-knownwiki'), 'wpKnownWiki') . ' ' . $selector->getHTML() . '<br />' . Xml::submitButton(wfMsg('editusergroup')) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
Exemplo n.º 15
0
 function showForm()
 {
     global $wgOut;
     $wgOut->setPagetitle(wfMsg("player-title"));
     $wgOut->addWikiText(wfMsg("player-pagetext"));
     $titleObj = SpecialPage::getTitleFor("Player");
     $action = $titleObj->getLocalURL("action=submit");
     $wgOut->addHTML(Xml::openElement('form', array('id' => 'player', 'method' => 'post', 'action' => $action)));
     $wgOut->addHTML('<div>');
     $wgOut->addHTML(Xml::inputLabel(wfMsg('player-file'), 'playfile', 'playfile'));
     $wgOut->addHTML(' ');
     $wgOut->addHTML(Xml::submitButton(wfMsg('player-play')));
     $wgOut->addHTML('</div>');
     $wgOut->addHTML(Xml::closeElement('form'));
 }
Exemplo n.º 16
0
 function execute($par)
 {
     global $wgOut, $wgUser;
     $this->setHeaders();
     if (!$wgUser->isAllowed('stafflog')) {
         throw new PermissionsError('stafflog');
     }
     $pager = new StaffLoggerPager("");
     $sTypesDropDown = Xml::openElement('select', array('name' => 'type', 'id' => 'StaffLogFilterType'));
     foreach ($this->aTypes as $k => $v) {
         $sTypesDropDown .= Xml::option($v, $k, $k == $this->request->getText('type', ''));
     }
     $sTypesDropDown .= Xml::closeElement('select');
     $wgOut->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL())) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('stafflog-filter-label'), false) . Xml::inputLabel(wfMsg('stafflog-filter-user'), 'user', 'StaffLogFilterUser', false, htmlspecialchars($this->request->getText('user', ''), ENT_QUOTES, 'UTF-8')) . Xml::label(wfMsg('stafflog-filter-type'), 'StaffLogFilterType') . ' ' . $sTypesDropDown . ' ' . Xml::submitButton(wfMsg('stafflog-filter-apply')) . Xml::closeElement('fieldset') . Xml::closeElement('form') . Xml::openElement('div', array('class' => 'mw-spcontent')) . $pager->getNavigationBar() . '<ul>' . $pager->getBody() . '</ul>' . $pager->getNavigationBar() . Xml::closeElement('div'));
 }
	/**
	 * 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' )
		);
	}
Exemplo n.º 18
0
 function doForm()
 {
     global $wgOut, $wgUser;
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'name' => 'uluser', 'id' => 'mw-codeauthor-form1'));
     $form .= Html::hidden('linktoken', $wgUser->editToken('link'));
     $form .= Xml::openElement('fieldset');
     $additional = '';
     // Is there already a user linked to this author?
     if ($this->mUser) {
         $form .= Xml::element('legend', array(), wfMsg('code-author-alterlink'));
         $additional = Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('code-author-orunlink')) . Xml::submitButton(wfMsg('code-author-unlink'), array('name' => 'unlink')) . Xml::closeElement('fieldset');
     } else {
         $form .= Xml::element('legend', array(), wfMsg('code-author-dolink'));
     }
     $form .= Xml::inputLabel(wfMsg('code-author-name'), 'linktouser', 'username', 30, '') . ' ' . Xml::submitButton(wfMsg('ok'), array('name' => 'newname')) . Xml::closeElement('fieldset') . $additional . Xml::closeElement('form') . "\n";
     $wgOut->addHTML($this->linkStatus() . $form);
 }
Exemplo n.º 19
0
    /**
     * Display list of pages to delete.
     * 
     * @param string $username
     * @param string $reason
     * @param integer $limit
     */
    protected function listForm($username, $reason, $limit)
    {
        global $wgUser, $wgOut, $wgLang;
        $pages = $this->getNewPages($username, $limit);
        if (count($pages) == 0) {
            $wgOut->addWikiMsg('nuke-nopages', $username);
            return $this->promptForm();
        }
        if ($username == '') {
            $wgOut->addWikiMsg('nuke-list-multiple');
        } else {
            $wgOut->addWikiMsg('nuke-list', $username);
        }
        $nuke = $this->getTitle();
        $script = <<<JAVASCRIPT
<script type="text/javascript">
function selectPages( bool ) {
\tvar inputs = document.getElementsByTagName("input");
\tfor (i = 0; i < inputs.length; i++) {
\t\tif (inputs[i].type == "checkbox") {
\t\t\tinputs[i].checked = bool;
\t\t}
\t}
}
</script>
JAVASCRIPT;
        $wgOut->addScript($script);
        $wgOut->addHTML(Xml::openElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post', 'name' => 'nukelist')) . Html::hidden('wpEditToken', $wgUser->editToken()) . Xml::tags('p', null, Xml::inputLabel(wfMsg('deletecomment'), 'wpReason', 'wpReason', 60, $reason)));
        // Select: All, None
        $links = array();
        $links[] = '<a href="#" onclick="selectPages( true ); return false;">' . wfMsg('powersearch-toggleall') . '</a>';
        $links[] = '<a href="#" onclick="selectPages( false ); return false;">' . wfMsg('powersearch-togglenone') . '</a>';
        $wgOut->addHTML(Xml::tags('p', null, wfMsg('nuke-select', $wgLang->commaList($links))));
        // Delete button
        $wgOut->addHTML(Xml::submitButton(wfMsg('nuke-submit-delete')));
        $wgOut->addHTML('<ul>');
        $sk = $wgUser->getSkin();
        foreach ($pages as $info) {
            list($title, $edits, $userName) = $info;
            $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false;
            $thumb = $image && $image->exists() ? $image->transform(array('width' => 120, 'height' => 120), 0) : false;
            $changes = wfMsgExt('nchanges', 'parsemag', $wgLang->formatNum($edits));
            $wgOut->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . '&#160;' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . $sk->makeKnownLinkObj($title) . '&#160;(' . ($userName ? wfMsgExt('nuke-editby', 'parseinline', $userName) . ',&#160;' : '') . $sk->makeKnownLinkObj($title, $changes, 'action=history') . ")</li>\n");
        }
        $wgOut->addHTML("</ul>\n" . Xml::submitButton(wfMsg('nuke-submit-delete')) . "</form>");
    }
Exemplo n.º 20
0
/**
 * Special:LinkSearch to search the external-links table.
 */
function wfSpecialLinkSearch($par)
{
    list($limit, $offset) = wfCheckLimits();
    global $wgOut, $wgUrlProtocols, $wgMiserMode, $wgLang;
    $target = $GLOBALS['wgRequest']->getVal('target', $par);
    $namespace = $GLOBALS['wgRequest']->getIntorNull('namespace', null);
    $protocols_list[] = '';
    foreach ($wgUrlProtocols as $prot) {
        $protocols_list[] = $prot;
    }
    $target2 = $target;
    $protocol = '';
    $pr_sl = strpos($target2, '//');
    $pr_cl = strpos($target2, ':');
    if ($pr_sl) {
        // For protocols with '//'
        $protocol = substr($target2, 0, $pr_sl + 2);
        $target2 = substr($target2, $pr_sl + 2);
    } elseif (!$pr_sl && $pr_cl) {
        // For protocols without '//' like 'mailto:'
        $protocol = substr($target2, 0, $pr_cl + 1);
        $target2 = substr($target2, $pr_cl + 1);
    } elseif ($protocol == '' && $target2 != '') {
        // default
        $protocol = 'http://';
    }
    if (!in_array($protocol, $protocols_list)) {
        // unsupported protocol, show original search request
        $target2 = $target;
        $protocol = '';
    }
    $self = Title::makeTitle(NS_SPECIAL, 'Linksearch');
    $wgOut->allowClickjacking();
    $wgOut->addWikiMsg('linksearch-text', '<nowiki>' . $wgLang->commaList($wgUrlProtocols) . '</nowiki>');
    $s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Html::hidden('title', $self->getPrefixedDbKey()) . '<fieldset>' . Xml::element('legend', array(), wfMsg('linksearch')) . Xml::inputLabel(wfMsg('linksearch-pat'), 'target', 'target', 50, $target) . ' ';
    if (!$wgMiserMode) {
        $s .= Xml::label(wfMsg('linksearch-ns'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
    }
    $s .= Xml::submitButton(wfMsg('linksearch-ok')) . '</fieldset>' . Xml::closeElement('form');
    $wgOut->addHTML($s);
    if ($target != '') {
        $searcher = new LinkSearchPage();
        $searcher->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
        $searcher->doQuery($offset, $limit);
    }
}
Exemplo n.º 21
0
 function execute($par)
 {
     global $wgUrlProtocols, $wgMiserMode, $wgScript;
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->allowClickjacking();
     $request = $this->getRequest();
     $target = $request->getVal('target', $par);
     $namespace = $request->getIntorNull('namespace', null);
     $protocols_list = array();
     foreach ($wgUrlProtocols as $prot) {
         if ($prot !== '//') {
             $protocols_list[] = $prot;
         }
     }
     $target2 = $target;
     // Get protocol, default is http://
     $protocol = 'http://';
     $bits = wfParseUrl($target);
     if (isset($bits['scheme']) && isset($bits['delimiter'])) {
         $protocol = $bits['scheme'] . $bits['delimiter'];
         // Make sure wfParseUrl() didn't make some well-intended correction in the
         // protocol
         if (strcasecmp($protocol, substr($target, 0, strlen($protocol))) === 0) {
             $target2 = substr($target, strlen($protocol));
         } else {
             // If it did, let LinkFilter::makeLikeArray() handle this
             $protocol = '';
         }
     }
     $out->addWikiMsg('linksearch-text', '<nowiki>' . $this->getLanguage()->commaList($protocols_list) . '</nowiki>', count($protocols_list));
     $s = Html::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $wgScript)) . "\n" . Html::hidden('title', $this->getPageTitle()->getPrefixedDBkey()) . "\n" . Html::openElement('fieldset') . "\n" . Html::element('legend', array(), $this->msg('linksearch')->text()) . "\n" . Xml::inputLabel($this->msg('linksearch-pat')->text(), 'target', 'target', 50, $target) . "\n";
     if (!$wgMiserMode) {
         $s .= Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('linksearch-ns')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'));
     }
     $s .= Xml::submitButton($this->msg('linksearch-ok')->text()) . "\n" . Html::closeElement('fieldset') . "\n" . Html::closeElement('form') . "\n";
     $out->addHTML($s);
     if ($target != '') {
         $this->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
         parent::execute($par);
         if ($this->mMungedQuery === false) {
             $out->addWikiMsg('linksearch-error');
         }
     }
 }
Exemplo n.º 22
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;
 }
 /**
  * Get all Interwiki Links - the heart of the function
  * @param $prefix string Prefix to search for in list
  * @return string HTML
  */
 private function getInterwikis($prefix = null)
 {
     global $wgScript;
     $dbr = wfGetDB(DB_SLAVE);
     $conds = array();
     if (!is_null($prefix)) {
         $conds[] = "iw_prefix " . $dbr->buildLike($prefix, $dbr->anyString());
     }
     $results = $dbr->select('interwiki', array('iw_prefix', 'iw_url'), $conds);
     $form = Xml::openElement('form', array('action' => $wgScript, 'method' => 'get', 'id' => 'interwikilist-search')) . Html::Hidden('title', $this->mTitle->getPrefixedText()) . Xml::inputLabel(wfMsg('interwikilist-prefix'), 'iwsearch', 'interwikilist-prefix', false, $prefix) . Xml::submitButton(wfMsg('search')) . Xml::closeElement('form');
     $text = Xml::fieldSet(wfMsg('interwikilist-filter'), $form);
     $interwikiList = array();
     foreach ($results as $row) {
         $interwikiList["mw-iwlist-" . $row->iw_prefix] = array($row->iw_prefix, $row->iw_url);
     }
     $dbr->freeResult($results);
     $text .= Xml::buildTable($interwikiList, array('id' => 'sv-software'), array(wfMsg('interwikilist-linkname'), wfMsg('interwikilist-target')));
     return $text;
 }
Exemplo n.º 25
0
/**
 * Output the HTML search form, and constructs the FileDuplicateSearch object.
 */
function wfSpecialFileDuplicateSearch($par = null)
{
    global $wgRequest, $wgOut, $wgLang, $wgContLang, $wgScript;
    $hash = '';
    $filename = isset($par) ? $par : $wgRequest->getText('filename');
    $title = Title::newFromText($filename);
    if ($title && $title->getText() != '') {
        $dbr = wfGetDB(DB_SLAVE);
        $image = $dbr->tableName('image');
        $encFilename = $dbr->addQuotes(htmlspecialchars($title->getDBKey()));
        $sql = "SELECT img_sha1 from {$image} where img_name = {$encFilename}";
        $res = $dbr->query($sql);
        $row = $dbr->fetchRow($res);
        if ($row !== false) {
            $hash = $row[0];
        }
        $dbr->freeResult($res);
    }
    # Create the input form
    $wgOut->addHTML(Xml::openElement('form', array('id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript)) . Xml::hidden('title', SpecialPage::getTitleFor('FileDuplicateSearch')->getPrefixedDbKey()) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('fileduplicatesearch-legend')) . Xml::inputLabel(wfMsg('fileduplicatesearch-filename'), 'filename', 'filename', 50, $filename) . ' ' . Xml::submitButton(wfMsg('fileduplicatesearch-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
    if ($hash != '') {
        $align = $wgContLang->isRtl() ? 'left' : 'right';
        # Show a thumbnail of the file
        $img = wfFindFile($title);
        if ($img) {
            $thumb = $img->transform(array('width' => 120, 'height' => 120));
            if ($thumb) {
                $wgOut->addHTML('<div style="float:' . $align . '" id="mw-fileduplicatesearch-icon">' . $thumb->toHtml(array('desc-link' => false)) . '<br />' . wfMsgExt('fileduplicatesearch-info', array('parse'), $wgLang->formatNum($img->getWidth()), $wgLang->formatNum($img->getHeight()), $wgLang->formatSize($img->getSize()), $img->getMimeType()) . '</div>');
            }
        }
        # Do the query
        $wpp = new FileDuplicateSearchPage($hash, $filename);
        list($limit, $offset) = wfCheckLimits();
        $count = $wpp->doQuery($offset, $limit);
        # Show a short summary
        if ($count == 1) {
            $wgOut->addHTML('<p class="mw-fileduplicatesearch-result-1">' . wfMsgHtml('fileduplicatesearch-result-1', $filename) . '</p>');
        } elseif ($count > 1) {
            $wgOut->addHTML('<p class="mw-fileduplicatesearch-result-n">' . wfMsgExt('fileduplicatesearch-result-n', array('parseinline'), $filename, $wgLang->formatNum($count - 1)) . '</p>');
        }
    }
}
 /**
  * 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;
 }
Exemplo n.º 27
0
 /**
  * Display list of pages to delete.
  *
  * @param string $username
  * @param string $reason
  * @param integer $limit
  */
 protected function listForm($username, $reason, $limit)
 {
     $out = $this->getOutput();
     $pages = $this->getNewPages($username, $limit);
     if (count($pages) == 0) {
         if ($username === '') {
             $out->addWikiMsg('nuke-nopages-global');
         } else {
             $out->addWikiMsg('nuke-nopages', $username);
         }
         $this->promptForm($username);
         return;
     }
     if ($username === '') {
         $out->addWikiMsg('nuke-list-multiple');
     } else {
         $out->addWikiMsg('nuke-list', $username);
     }
     $nuke = $this->getTitle();
     $out->addModules('ext.nuke');
     $out->addHTML(Xml::openElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post', 'name' => 'nukelist')) . Html::hidden('wpEditToken', $this->getUser()->editToken()) . Xml::tags('p', null, Xml::inputLabel(wfMsg('deletecomment'), 'wpReason', 'wpReason', 70, $reason)));
     // Select: All, None
     $links = array();
     $links[] = '<a href="#" id="toggleall">' . wfMsg('powersearch-toggleall') . '</a>';
     $links[] = '<a href="#" id="togglenone">' . wfMsg('powersearch-togglenone') . '</a>';
     $out->addHTML(Xml::tags('p', null, wfMsg('nuke-select', $this->getLanguage()->commaList($links))));
     // Delete button
     $out->addHTML(Xml::submitButton(wfMsg('nuke-submit-delete')));
     $out->addHTML('<ul>');
     foreach ($pages as $info) {
         /**
          * @var $title Title
          */
         list($title, $edits, $userName) = $info;
         $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false;
         $thumb = $image && $image->exists() ? $image->transform(array('width' => 120, 'height' => 120), 0) : false;
         $changes = wfMsgExt('nchanges', 'parsemag', $this->getLanguage()->formatNum($edits));
         $out->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . '&#160;' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . Linker::linkKnown($title) . '&#160;(' . ($userName ? wfMsgExt('nuke-editby', 'parseinline', $userName) . ',&#160;' : '') . Linker::linkKnown($title, $changes, array(), array('action' => 'history')) . ")</li>\n");
     }
     $out->addHTML("</ul>\n" . Xml::submitButton(wfMsg('nuke-submit-delete')) . '</form>');
 }
Exemplo n.º 28
0
 function listForm($username, $reason)
 {
     global $wgUser, $wgOut, $wgLang;
     $pages = $this->getNewPages($username);
     if (count($pages) == 0) {
         $wgOut->addWikiMsg('nuke-nopages', $username);
         return $this->promptForm();
     }
     $wgOut->addWikiMsg('nuke-list', $username);
     $nuke = $this->getTitle();
     $submit = Xml::submitButton(wfMsg('nuke-submit-delete'));
     $wgOut->addHTML(Xml::openElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post')) . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::inputLabel(wfMsg('deletecomment'), 'wpReason', 'wpReason', 60, $reason) . '<br /><br />' . Xml::submitButton(wfMsg('nuke-submit-delete')));
     $wgOut->addHTML('<ul>');
     $sk = $wgUser->getSkin();
     foreach ($pages as $info) {
         list($title, $edits) = $info;
         $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false;
         $thumb = $image && $image->exists() ? $image->getThumbnail(120, 120) : false;
         $changes = wfMsgExt('nchanges', 'parsemag', $wgLang->formatNum($edits));
         $wgOut->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . '&nbsp;' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . $sk->makeKnownLinkObj($title) . '&nbsp;(' . $sk->makeKnownLinkObj($title, $changes, 'action=history') . ")</li>\n");
     }
     $wgOut->addHTML("</ul>\n" . Xml::submitButton(wfMsg('nuke-submit-delete')) . "</form>");
 }
Exemplo n.º 29
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');
    }
}
 function getPageHeader()
 {
     # Do not show useless input form if special page is cached
     if ($this->isCached()) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getPageTitle();
     return Html::openElement('form', array('method' => 'get', 'action' => wfScript())) . "\n" . Html::openElement('fieldset') . "\n" . Html::element('legend', null, $this->msg('withoutinterwiki-legend')->text()) . "\n" . Html::hidden('title', $t->getPrefixedText()) . "\n" . Xml::inputLabel($this->msg('allpagesprefix')->text(), 'prefix', 'wiprefix', 20, $prefix) . "\n" . Xml::submitButton($this->msg('withoutinterwiki-submit')->text()) . "\n" . Html::closeElement('fieldset') . "\n" . Html::closeElement('form');
 }