Ejemplo n.º 1
0
 /**
  * Prompt for a username or IP address.
  *
  * @param $userName string
  */
 protected function promptForm($userName = '')
 {
     $out = $this->getOutput();
     $out->addModules('mediawiki.userSuggest');
     $out->addWikiMsg('nuke-tools');
     $out->addHTML(Xml::openElement('form', array('action' => $this->getPageTitle()->getLocalURL('action=submit'), 'method' => 'post')) . '<table><tr>' . '<td>' . Xml::label($this->msg('nuke-userorip')->text(), 'nuke-target') . '</td>' . '<td>' . Xml::input('target', 40, $userName, array('id' => 'nuke-target', 'class' => 'mw-autocomplete-user', 'autofocus' => true)) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-pattern')->text(), 'nuke-pattern') . '</td>' . '<td>' . Xml::input('pattern', 40, '', array('id' => 'nuke-pattern')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-namespace')->text(), 'nuke-namespace') . '</td>' . '<td>' . Html::namespaceSelector(array('all' => 'all'), array('name' => 'namespace')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-maxpages')->text(), 'nuke-limit') . '</td>' . '<td>' . Xml::input('limit', 7, '500', array('id' => 'nuke-limit')) . '</td>' . '</tr><tr>' . '<td></td>' . '<td>' . Xml::submitButton($this->msg('nuke-submit-user')->text()) . '</td>' . '</tr></table>' . Html::hidden('wpEditToken', $this->getUser()->getEditToken()) . Xml::closeElement('form'));
 }
Ejemplo n.º 2
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');
         }
     }
 }
Ejemplo n.º 3
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');
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Creates the choose namespace selection
  *
  * @todo Uses radio buttons (HASHAR)
  * @param $opts FormOptions
  * @return String
  */
 protected function namespaceFilterForm(FormOptions $opts)
 {
     # start wikia change
     $nsSelect = '';
     /* Wikia Change */
     wfRunHooks('onGetNamespaceCheckbox', array(&$nsSelect, $opts['namespace'], '', 'namespace', null));
     $nsLabel = Xml::label(wfMsg('namespace'), 'namespace');
     if (empty($nsSelect)) {
         $nsSelect = Html::namespaceSelector(array('selected' => $opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace'));
         # end wikia change
         $invert = Xml::checkLabel(wfMsg('invert'), 'invert', 'nsinvert', $opts['invert'], array('title' => wfMsg('tooltip-invert')));
         $associated = Xml::checkLabel(wfMsg('namespace_association'), 'associated', 'nsassociated', $opts['associated'], array('title' => wfMsg('tooltip-namespace_association')));
     } else {
         $invert = "";
         $associated = "";
     }
     /* Wikia Change end*/
     return array($nsLabel, "{$nsSelect} {$invert} {$associated}");
 }
Ejemplo n.º 5
0
	/**
	 * Prepare the namespace filter drop-down; standard namespace
	 * selector, sans the MediaWiki namespace
	 *
	 * @param $namespace Mixed: pre-select namespace
	 * @return string
	 */
	function getNamespaceMenu( $namespace = null ) {
		return Html::namespaceSelector(
			array(
				'selected' => $namespace,
				'all' => '',
				'label' => $this->msg( 'namespace' )->text()
			), array(
				'name' => 'namespace',
				'id' => 'namespace',
				'class' => 'namespaceselector',
			)
		);
	}
Ejemplo n.º 6
0
 /**
  * Build a drop-down box for selecting a namespace
  *
  * @param $selected Mixed: Namespace which should be pre-selected
  * @param $all Mixed: Value of an item denoting all namespaces, or null to omit
  * @param $element_name String: value of the "name" attribute of the select tag
  * @param string $label optional label to add to the field
  * @return string
  * @deprecated since 1.19
  */
 public static function namespaceSelector($selected = '', $all = null, $element_name = 'namespace', $label = null)
 {
     wfDeprecated(__METHOD__, '1.19');
     return Html::namespaceSelector(array('selected' => $selected, 'all' => $all, 'label' => $label), array('name' => $element_name, 'id' => 'namespace', 'class' => 'namespaceselector'));
 }
Ejemplo n.º 7
0
 private function showForm()
 {
     global $wgImportSources, $wgExportMaxLinkDepth;
     $action = $this->getTitle()->getLocalUrl(array('action' => 'submit'));
     $user = $this->getUser();
     $out = $this->getOutput();
     if ($user->isAllowed('importupload')) {
         $out->addHTML(Xml::fieldset($this->msg('import-upload')->text()) . Xml::openElement('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action, 'id' => 'mw-import-upload-form')) . $this->msg('importtext')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'upload') . Xml::openElement('table', array('id' => 'mw-import-table')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-upload-filename')->text(), 'xmlimport') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('xmlimport', 50, '', array('type' => 'file')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-comment')->text(), 'mw-import-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, '', array('id' => 'mw-import-comment', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('uploadbtn')->text()) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Html::hidden('editToken', $user->getEditToken()) . Xml::closeElement('form') . Xml::closeElement('fieldset'));
     } else {
         if (empty($wgImportSources)) {
             $out->addWikiMsg('importnosources');
         }
     }
     if ($user->isAllowed('import') && !empty($wgImportSources)) {
         # Show input field for import depth only if $wgExportMaxLinkDepth > 0
         $importDepth = '';
         if ($wgExportMaxLinkDepth > 0) {
             $importDepth = "<tr>\n\t\t\t\t\t\t\t<td class='mw-label'>" . $this->msg('export-pagelinks')->parse() . "</td>\n\t\t\t\t\t\t\t<td class='mw-input'>" . Xml::input('pagelink-depth', 3, 0) . "</td>\n\t\t\t\t\t\t</tr>";
         }
         $out->addHTML(Xml::fieldset($this->msg('importinterwiki')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form')) . $this->msg('import-interwiki-text')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'interwiki') . Html::hidden('editToken', $user->getEditToken()) . Xml::openElement('table', array('id' => 'mw-import-table')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-source')->text(), 'interwiki') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::openElement('select', array('name' => 'interwiki')));
         foreach ($wgImportSources as $prefix) {
             $selected = $this->interwiki === $prefix ? ' selected="selected"' : '';
             $out->addHTML(Xml::option($prefix, $prefix, $selected));
         }
         $out->addHTML(Xml::closeElement('select') . Xml::input('frompage', 50, $this->frompage) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-history')->text(), 'interwikiHistory', 'interwikiHistory', $this->history) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-templates')->text(), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$importDepth}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-namespace')->text(), 'namespace') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $this->namespace, 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-comment')->text(), 'mw-interwiki-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, '', array('id' => 'mw-interwiki-comment', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('import-interwiki-submit')->text(), Linker::tooltipAndAccesskeyAttribs('import')) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset'));
     }
 }
Ejemplo n.º 8
0
 /**
  * HTML for the top form
  *
  * @param int $namespace A namespace constant (default NS_MAIN).
  * @param string $from DbKey we are starting listing at.
  * @param string $to DbKey we are ending listing at.
  * @param bool $hideredirects Dont show redirects  (default false)
  * @return string
  */
 function namespaceForm($namespace = NS_MAIN, $from = '', $to = '', $hideredirects = false)
 {
     $t = $this->getPageTitle();
     $out = Xml::openElement('div', array('class' => 'namespaceoptions'));
     $out .= Xml::openElement('form', array('method' => 'get', 'action' => $this->getConfig()->get('Script')));
     $out .= Html::hidden('title', $t->getPrefixedText());
     $out .= Xml::openElement('fieldset');
     $out .= Xml::element('legend', null, $this->msg('allpages')->text());
     $out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
     $out .= "<tr>\n\t<td class='mw-label'>" . Xml::label($this->msg('allpagesfrom')->text(), 'nsfrom') . "\t</td>\n\t<td class='mw-input'>" . Xml::input('from', 30, str_replace('_', ' ', $from), array('id' => 'nsfrom')) . "\t</td>\n</tr>\n<tr>\n\t<td class='mw-label'>" . Xml::label($this->msg('allpagesto')->text(), 'nsto') . "\t</td>\n\t\t\t<td class='mw-input'>" . Xml::input('to', 30, str_replace('_', ' ', $to), array('id' => 'nsto')) . "\t\t</td>\n</tr>\n<tr>\n\t<td class='mw-label'>" . Xml::label($this->msg('namespace')->text(), 'namespace') . "\t</td>\n\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $namespace), array('name' => 'namespace', 'id' => 'namespace')) . ' ' . Xml::checkLabel($this->msg('allpages-hide-redirects')->text(), 'hideredirects', 'hideredirects', $hideredirects) . ' ' . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\t</td>\n</tr>";
     $out .= Xml::closeElement('table');
     $out .= Xml::closeElement('fieldset');
     $out .= Xml::closeElement('form');
     $out .= Xml::closeElement('div');
     return $out;
 }
Ejemplo n.º 9
0
 /**
  * Set the text to be displayed above the changes
  *
  * @param FormOptions $opts
  * @param int $numRows Number of rows in the result to show after this header
  */
 public function doHeader($opts, $numRows)
 {
     $user = $this->getUser();
     $this->getOutput()->addSubtitle($this->msg('watchlistfor2', $user->getName())->rawParams(SpecialEditWatchlist::buildTools(null)));
     $this->setTopText($opts);
     $lang = $this->getLanguage();
     $wlInfo = '';
     if ($opts['days'] > 0) {
         $timestamp = wfTimestampNow();
         $wlInfo = $this->msg('wlnote')->numParams($numRows, round($opts['days'] * 24))->params($lang->userDate($timestamp, $user), $lang->userTime($timestamp, $user))->parse() . "<br />\n";
     }
     $nondefaults = $opts->getChangedValues();
     $cutofflinks = $this->cutoffLinks($opts['days'], $nondefaults) . "<br />\n";
     # Spit out some control panel links
     $filters = array('hideminor' => 'rcshowhideminor', 'hidebots' => 'rcshowhidebots', 'hideanons' => 'rcshowhideanons', 'hideliu' => 'rcshowhideliu', 'hidemyself' => 'rcshowhidemine', 'hidepatrolled' => 'rcshowhidepatr');
     foreach ($this->getCustomFilters() as $key => $params) {
         $filters[$key] = $params['msg'];
     }
     // Disable some if needed
     if (!$user->useNPPatrol()) {
         unset($filters['hidepatrolled']);
     }
     $links = array();
     foreach ($filters as $name => $msg) {
         $links[] = $this->showHideLink($nondefaults, $msg, $name, $opts[$name]);
     }
     $hiddenFields = $nondefaults;
     unset($hiddenFields['namespace']);
     unset($hiddenFields['invert']);
     unset($hiddenFields['associated']);
     # Create output
     $form = '';
     # Namespace filter and put the whole form together.
     $form .= $wlInfo;
     $form .= $cutofflinks;
     $form .= $lang->pipeList($links) . "\n";
     $form .= "<hr />\n<p>";
     $form .= Html::namespaceSelector(array('selected' => $opts['namespace'], 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;';
     $form .= Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $opts['invert'], array('title' => $this->msg('tooltip-invert')->text())) . '&#160;';
     $form .= Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'nsassociated', $opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text())) . '&#160;';
     $form .= Xml::submitButton($this->msg('allpagessubmit')->text()) . "</p>\n";
     foreach ($hiddenFields as $key => $value) {
         $form .= Html::hidden($key, $value) . "\n";
     }
     $form .= Xml::closeElement('fieldset') . "\n";
     $form .= Xml::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
     $this->setBottomText($opts);
 }
Ejemplo n.º 10
0
 private function getMappingFormPart($sourceName)
 {
     $isSameSourceAsBefore = $this->sourceName === $sourceName;
     $defaultNamespace = $this->getConfig()->get('ImportTargetNamespace');
     return "<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-default')->text(), 'mapping', 'default', "mw-import-mapping-{$sourceName}-default", $isSameSourceAsBefore ? $this->mapping === 'default' : is_null($defaultNamespace)) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-namespace')->text(), 'mapping', 'namespace', "mw-import-mapping-{$sourceName}-namespace", $isSameSourceAsBefore ? $this->mapping === 'namespace' : !is_null($defaultNamespace)) . ' ' . Html::namespaceSelector(['selected' => $isSameSourceAsBefore ? $this->namespace : $defaultNamespace || ''], ['name' => "namespace", 'id' => "mw-import-namespace-{$sourceName}", 'class' => 'namespaceselector']) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-subpage')->text(), 'mapping', 'subpage', "mw-import-mapping-{$sourceName}-subpage", $isSameSourceAsBefore ? $this->mapping === 'subpage' : '') . ' ' . Xml::input('rootpage', 50, $isSameSourceAsBefore ? $this->rootpage : '', ['id' => "mw-interwiki-rootpage-{$sourceName}", 'type' => 'text']) . ' ' . "</td>\n\t\t\t\t</tr>";
 }
Ejemplo n.º 11
0
 public function testCanDisableANamespaces()
 {
     $this->assertEquals('<select id=namespace name=namespace>' . "\n" . '<option disabled value=0>(Main)</option>' . "\n" . '<option disabled value=1>Talk</option>' . "\n" . '<option disabled value=2>User</option>' . "\n" . '<option disabled value=3>User talk</option>' . "\n" . '<option disabled value=4>MyWiki</option>' . "\n" . '<option value=5>MyWiki Talk</option>' . "\n" . '<option value=6>File</option>' . "\n" . '<option value=7>File talk</option>' . "\n" . '<option value=8>MediaWiki</option>' . "\n" . '<option value=9>MediaWiki talk</option>' . "\n" . '<option value=10>Template</option>' . "\n" . '<option value=11>Template talk</option>' . "\n" . '<option value=14>Category</option>' . "\n" . '<option value=15>Category talk</option>' . "\n" . '<option value=100>Custom</option>' . "\n" . '<option value=101>Custom talk</option>' . "\n" . '</select>', Html::namespaceSelector(array('disable' => array(0, 1, 2, 3, 4))), 'Namespace selector namespace disabling');
 }
Ejemplo n.º 12
0
 /**
  * Show the form
  *
  * @param $err Array: error messages. Each item is an error message.
  *    It may either be a string message name or array message name and
  *    parameters, like the second argument to OutputPage::wrapWikiMsg().
  */
 function showForm($err)
 {
     global $wgContLang, $wgFixDoubleRedirects, $wgMaximumMovedPages;
     $this->getSkin()->setRelevantTitle($this->oldTitle);
     $oldTitleLink = Linker::link($this->oldTitle);
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('move-page', $this->oldTitle->getPrefixedText()));
     $out->addModules('mediawiki.special.movePage');
     $newTitle = $this->newTitle;
     if (!$newTitle) {
         # Show the current title as a default
         # when the form is first opened.
         $newTitle = $this->oldTitle;
     } elseif (!count($err)) {
         # If a title was supplied, probably from the move log revert
         # link, check for validity. We can then show some diagnostic
         # information and save a click.
         $newerr = $this->oldTitle->isValidMoveOperation($newTitle);
         if (is_array($newerr)) {
             $err = $newerr;
         }
     }
     $user = $this->getUser();
     if (count($err) == 1 && isset($err[0][0]) && $err[0][0] == 'articleexists' && $newTitle->quickUserCan('delete', $user)) {
         $out->addWikiMsg('delete_and_move_text', $newTitle->getPrefixedText());
         $movepagebtn = wfMsg('delete_and_move');
         $submitVar = 'wpDeleteAndMove';
         $confirm = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('delete_and_move_confirm'), 'wpConfirm', 'wpConfirm') . "</td>\n\t\t\t\t</tr>";
         $err = array();
     } else {
         if ($this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage()) {
             $out->wrapWikiMsg("<div class=\"error mw-moveuserpage-warning\">\n\$1\n</div>", 'moveuserpage-warning');
         }
         $out->addWikiMsg($wgFixDoubleRedirects ? 'movepagetext' : 'movepagetext-noredirectfixer');
         $movepagebtn = wfMsg('movepagebtn');
         $submitVar = 'wpMove';
         $confirm = false;
     }
     if (count($err) == 1 && isset($err[0][0]) && $err[0][0] == 'file-exists-sharedrepo' && $user->isAllowed('reupload-shared')) {
         $out->addWikiMsg('move-over-sharedrepo', $newTitle->getPrefixedText());
         $submitVar = 'wpMoveOverSharedFile';
         $err = array();
     }
     $oldTalk = $this->oldTitle->getTalkPage();
     $oldTitleSubpages = $this->oldTitle->hasSubpages();
     $oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
     $canMoveSubpage = ($oldTitleSubpages || $oldTitleTalkSubpages) && !count($this->oldTitle->getUserPermissionsErrors('move-subpages', $user));
     # We also want to be able to move assoc. subpage talk-pages even if base page
     # has no associated talk page, so || with $oldTitleTalkSubpages.
     $considerTalk = !$this->oldTitle->isTalkPage() && ($oldTalk->exists() || $oldTitleTalkSubpages && $canMoveSubpage);
     $dbr = wfGetDB(DB_SLAVE);
     if ($wgFixDoubleRedirects) {
         $hasRedirects = $dbr->selectField('redirect', '1', array('rd_namespace' => $this->oldTitle->getNamespace(), 'rd_title' => $this->oldTitle->getDBkey()), __METHOD__);
     } else {
         $hasRedirects = false;
     }
     if ($considerTalk) {
         $out->addWikiMsg('movepagetalktext');
     }
     if (count($err)) {
         $out->addHTML("<div class='error'>\n");
         $action_desc = $this->msg('action-move')->plain();
         $out->addWikiMsg('permissionserrorstext-withaction', count($err), $action_desc);
         if (count($err) == 1) {
             $errMsg = $err[0];
             $errMsgName = array_shift($errMsg);
             if ($errMsgName == 'hookaborted') {
                 $out->addHTML("<p>{$errMsg[0]}</p>\n");
             } else {
                 $out->addWikiMsgArray($errMsgName, $errMsg);
             }
         } else {
             $errStr = array();
             foreach ($err as $errMsg) {
                 if ($errMsg[0] == 'hookaborted') {
                     $errStr[] = $errMsg[1];
                 } else {
                     $errMsgName = array_shift($errMsg);
                     $errStr[] = $this->msg($errMsgName, $errMsg)->parse();
                 }
             }
             $out->addHTML('<ul><li>' . implode("</li>\n<li>", $errStr) . "</li></ul>\n");
         }
         $out->addHTML("</div>\n");
     }
     if ($this->oldTitle->isProtected('move')) {
         # Is the title semi-protected?
         if ($this->oldTitle->isSemiProtected('move')) {
             $noticeMsg = 'semiprotectedpagemovewarning';
             $classes[] = 'mw-textarea-sprotected';
         } else {
             # Then it must be protected based on static groups (regular)
             $noticeMsg = 'protectedpagemovewarning';
             $classes[] = 'mw-textarea-protected';
         }
         $out->addHTML("<div class='mw-warning-with-logexcerpt'>\n");
         $out->addWikiMsg($noticeMsg);
         LogEventsList::showLogExtract($out, 'protect', $this->oldTitle, '', array('lim' => 1));
         $out->addHTML("</div>\n");
     }
     // Byte limit (not string length limit) for wpReason and wpNewTitleMain
     // is enforced in the mediawiki.special.movePage module
     $out->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL('action=submit'), 'id' => 'movepage')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('move-page-legend')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-movepage-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>" . wfMsgHtml('movearticle') . "</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<strong>{$oldTitleLink}</strong>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('newtitle'), 'wpNewTitleMain') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $newTitle->getNamespace()), array('name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs')) . Xml::input('wpNewTitleMain', 60, $wgContLang->recodeForEdit($newTitle->getText()), array('type' => 'text', 'id' => 'wpNewTitleMain', 'maxlength' => 255)) . Html::hidden('wpOldTitle', $this->oldTitle->getPrefixedText()) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('movereason'), 'wpReason') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::element('textarea', array('name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2, 'maxlength' => 200), $this->reason) . "</td>\n\t\t\t</tr>");
     if ($considerTalk) {
         $out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('movetalk'), 'wpMovetalk', 'wpMovetalk', $this->moveTalk) . "</td>\n\t\t\t\t</tr>");
     }
     if ($user->isAllowed('suppressredirect')) {
         $out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input' >" . Xml::checkLabel(wfMsg('move-leave-redirect'), 'wpLeaveRedirect', 'wpLeaveRedirect', $this->leaveRedirect) . "</td>\n\t\t\t\t</tr>");
     }
     if ($hasRedirects) {
         $out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input' >" . Xml::checkLabel(wfMsg('fix-double-redirects'), 'wpFixRedirects', 'wpFixRedirects', $this->fixRedirects) . "</td>\n\t\t\t\t</tr>");
     }
     if ($canMoveSubpage) {
         $out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class=\"mw-input\">" . Xml::check('wpMovesubpages', $this->moveSubpages && ($this->oldTitle->hasSubpages() || $this->moveTalk), array('id' => 'wpMovesubpages')) . '&#160;' . Xml::tags('label', array('for' => 'wpMovesubpages'), wfMsgExt($this->oldTitle->hasSubpages() ? 'move-subpages' : 'move-talk-subpages', array('parseinline'), $this->getLanguage()->formatNum($wgMaximumMovedPages), $wgMaximumMovedPages)) . "</td>\n\t\t\t\t</tr>");
     }
     $watchChecked = $user->isLoggedIn() && ($this->watch || $user->getBoolOption('watchmoves') || $this->oldTitle->userIsWatching());
     # Don't allow watching if user is not logged in
     if ($user->isLoggedIn()) {
         $out->addHTML("\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('move-watch'), 'wpWatch', 'watch', $watchChecked) . "</td>\n\t\t\t</tr>");
     }
     $out->addHTML("\n\t\t\t\t{$confirm}\n\t\t\t<tr>\n\t\t\t\t<td>&#160;</td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($movepagebtn, array('name' => $submitVar)) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Html::hidden('wpEditToken', $user->getEditToken()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
     $this->showLogFragment($this->oldTitle);
     $this->showSubpages($this->oldTitle);
 }
Ejemplo n.º 13
0
 function whatlinkshereForm()
 {
     global $wgScript;
     // We get nicer value from the title object
     $this->opts->consumeValue('target');
     // Reset these for new requests
     $this->opts->consumeValues(array('back', 'from'));
     $target = $this->target ? $this->target->getPrefixedText() : '';
     $namespace = $this->opts->consumeValue('namespace');
     # Build up the form
     $f = Xml::openElement('form', array('action' => $wgScript));
     # Values that should not be forgotten
     $f .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     foreach ($this->opts->getUnconsumedValues() as $name => $value) {
         $f .= Html::hidden($name, $value);
     }
     $f .= Xml::fieldset($this->msg('whatlinkshere')->text());
     # Target input
     $f .= Xml::inputLabel($this->msg('whatlinkshere-page')->text(), 'target', 'mw-whatlinkshere-target', 40, $target);
     $f .= ' ';
     # Namespace selector
     $f .= Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'));
     $f .= ' ';
     # Submit
     $f .= Xml::submitButton($this->msg('allpagessubmit')->text());
     # Close
     $f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
     return $f;
 }
 /**
  * Generates the namespace selector form with hidden attributes.
  * @param array $options The options to be included.
  * @return string
  */
 function getForm($options)
 {
     $options['title'] = $this->getPageTitle()->getPrefixedText();
     if (!isset($options['target'])) {
         $options['target'] = '';
     } else {
         $options['target'] = str_replace('_', ' ', $options['target']);
     }
     if (!isset($options['namespace'])) {
         $options['namespace'] = '';
     }
     if (!isset($options['contribs'])) {
         $options['contribs'] = 'user';
     }
     if ($options['contribs'] == 'newbie') {
         $options['target'] = '';
     }
     $f = Xml::openElement('form', ['method' => 'get', 'action' => wfScript()]);
     foreach ($options as $name => $value) {
         if (in_array($name, ['namespace', 'target', 'contribs'])) {
             continue;
         }
         $f .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $this->getOutput()->addModules('mediawiki.userSuggest');
     $f .= Xml::openElement('fieldset');
     $f .= Xml::element('legend', [], $this->msg('sp-contributions-search')->text());
     $f .= Xml::tags('label', ['for' => 'target'], $this->msg('sp-contributions-username')->parse()) . ' ';
     $f .= Html::input('target', $options['target'], 'text', ['size' => '20', 'required' => '', 'class' => ['mw-autocomplete-user']] + ($options['target'] ? [] : ['autofocus'])) . ' ';
     $f .= Html::namespaceSelector(['selected' => $options['namespace'], 'all' => '', 'label' => $this->msg('namespace')->text()], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']) . ' ';
     $f .= Xml::submitButton($this->msg('sp-contributions-submit')->text());
     $f .= Xml::closeElement('fieldset');
     $f .= Xml::closeElement('form');
     return $f;
 }
Ejemplo n.º 15
0
	/**
	 * Execute
	 * @param $par Parameter passed to the page
	 */
	function execute( $par ) {
		global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;

		$user = $this->getUser();
		$output = $this->getOutput();

		# Anons don't get a watchlist
		if ( $user->isAnon() ) {
			$output->setPageTitle( $this->msg( 'watchnologin' ) );
			$output->setRobotPolicy( 'noindex,nofollow' );
			$llink = Linker::linkKnown(
				SpecialPage::getTitleFor( 'Userlogin' ),
				$this->msg( 'loginreqlink' )->escaped(),
				array(),
				array( 'returnto' => $this->getTitle()->getPrefixedText() )
			);
			$output->addHTML( $this->msg( 'watchlistanontext' )->rawParams( $llink )->parse() );
			return;
		}

		// Check permissions
		$this->checkPermissions();

		// Add feed links
		$wlToken = $user->getTokenFromOption( 'watchlisttoken' );
		if ( $wlToken ) {
			$this->addFeedLinks( array( 'action' => 'feedwatchlist', 'allrev' => 'allrev',
								'wlowner' => $user->getName(), 'wltoken' => $wlToken ) );
		}

		$this->setHeaders();
		$this->outputHeader();

		$output->addSubtitle( $this->msg( 'watchlistfor2', $user->getName()
			)->rawParams( SpecialEditWatchlist::buildTools( null ) ) );

		$request = $this->getRequest();

		$mode = SpecialEditWatchlist::getMode( $request, $par );
		if ( $mode !== false ) {
			# TODO: localise?
			switch ( $mode ) {
				case SpecialEditWatchlist::EDIT_CLEAR:
					$mode = 'clear';
					break;
				case SpecialEditWatchlist::EDIT_RAW:
					$mode = 'raw';
					break;
				default:
					$mode = null;
			}
			$title = SpecialPage::getTitleFor( 'EditWatchlist', $mode );
			$output->redirect( $title->getLocalURL() );
			return;
		}

		$dbr = wfGetDB( DB_SLAVE, 'watchlist' );

		$nitems = $this->countItems( $dbr );
		if ( $nitems == 0 ) {
			$output->addWikiMsg( 'nowatchlist' );
			return;
		}

		// @todo use FormOptions!
		$defaults = array(
		/* float */ 'days' => floatval( $user->getOption( 'watchlistdays' ) ),
		/* bool  */ 'hideMinor' => (int)$user->getBoolOption( 'watchlisthideminor' ),
		/* bool  */ 'hideBots' => (int)$user->getBoolOption( 'watchlisthidebots' ),
		/* bool  */ 'hideAnons' => (int)$user->getBoolOption( 'watchlisthideanons' ),
		/* bool  */ 'hideLiu' => (int)$user->getBoolOption( 'watchlisthideliu' ),
		/* bool  */ 'hidePatrolled' => (int)$user->getBoolOption( 'watchlisthidepatrolled' ),
		/* bool  */ 'hideOwn' => (int)$user->getBoolOption( 'watchlisthideown' ),
		/* bool  */ 'extended' => (int)$user->getBoolOption( 'extendwatchlist' ),
		/* ?     */ 'namespace' => '', //means all
		/* ?     */ 'invert' => false,
		/* bool  */ 'associated' => false,
		);
		$this->customFilters = array();
		wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
		foreach ( $this->customFilters as $key => $params ) {
			$defaults[$key] = $params['default'];
		}

		# Extract variables from the request, falling back to user preferences or
		# other default values if these don't exist
		$values = array();
		$values['days'] = floatval( $request->getVal( 'days', $defaults['days'] ) );
		$values['hideMinor'] = (int)$request->getBool( 'hideMinor', $defaults['hideMinor'] );
		$values['hideBots'] = (int)$request->getBool( 'hideBots', $defaults['hideBots'] );
		$values['hideAnons'] = (int)$request->getBool( 'hideAnons', $defaults['hideAnons'] );
		$values['hideLiu'] = (int)$request->getBool( 'hideLiu', $defaults['hideLiu'] );
		$values['hideOwn'] = (int)$request->getBool( 'hideOwn', $defaults['hideOwn'] );
		$values['hidePatrolled'] = (int)$request->getBool( 'hidePatrolled', $defaults['hidePatrolled'] );
		$values['extended'] = (int)$request->getBool( 'extended', $defaults['extended'] );
		foreach ( $this->customFilters as $key => $params ) {
			$values[$key] = (int)$request->getBool( $key, $defaults[$key] );
		}

		# Get namespace value, if supplied, and prepare a WHERE fragment
		$nameSpace = $request->getIntOrNull( 'namespace' );
		$invert = $request->getBool( 'invert' );
		$associated = $request->getBool( 'associated' );
		if ( !is_null( $nameSpace ) ) {
			$eq_op = $invert ? '!=' : '=';
			$bool_op = $invert ? 'AND' : 'OR';
			$nameSpace = intval( $nameSpace ); // paranioa
			if ( !$associated ) {
				$nameSpaceClause = "rc_namespace $eq_op $nameSpace";
			} else {
				$associatedNS = MWNamespace::getAssociated( $nameSpace );
				$nameSpaceClause =
					"rc_namespace $eq_op $nameSpace " .
					$bool_op .
					" rc_namespace $eq_op $associatedNS";
			}
		} else {
			$nameSpace = '';
			$nameSpaceClause = '';
		}
		$values['namespace'] = $nameSpace;
		$values['invert'] = $invert;
		$values['associated'] = $associated;

		// Dump everything here
		$nondefaults = array();
		foreach ( $defaults as $name => $defValue ) {
			wfAppendToArrayIfNotDefault( $name, $values[$name], $defaults, $nondefaults );
		}

		if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
			$request->wasPosted() )
		{
			$user->clearAllNotifications();
			$output->redirect( $this->getTitle()->getFullURL( $nondefaults ) );
			return;
		}

		# Possible where conditions
		$conds = array();

		if ( $values['days'] > 0 ) {
			$conds[] = 'rc_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( time() - intval( $values['days'] * 86400 ) ) );
		}

		# Toggles
		if ( $values['hideOwn'] ) {
			$conds[] = 'rc_user != ' . $user->getId();
		}
		if ( $values['hideBots'] ) {
			$conds[] = 'rc_bot = 0';
		}
		if ( $values['hideMinor'] ) {
			$conds[] = 'rc_minor = 0';
		}
		if ( $values['hideLiu'] ) {
			$conds[] = 'rc_user = 0';
		}
		if ( $values['hideAnons'] ) {
			$conds[] = 'rc_user != 0';
		}
		if ( $user->useRCPatrol() && $values['hidePatrolled'] ) {
			$conds[] = 'rc_patrolled != 1';
		}
		if ( $nameSpaceClause ) {
			$conds[] = $nameSpaceClause;
		}

		# Toggle watchlist content (all recent edits or just the latest)
		if ( $values['extended'] ) {
			$limitWatchlist = $user->getIntOption( 'wllimit' );
			$usePage = false;
		} else {
			# Top log Ids for a page are not stored
			$nonRevisionTypes = array( RC_LOG );
			wfRunHooks( 'SpecialWatchlistGetNonRevisionTypes', array( &$nonRevisionTypes ) );
			if ( $nonRevisionTypes ) {
				if ( count( $nonRevisionTypes ) === 1 ) {
					// if only one use an equality instead of IN condition
					$nonRevisionTypes = reset( $nonRevisionTypes );
				}
				$conds[] = $dbr->makeList(
					array(
						'rc_this_oldid=page_latest',
						'rc_type' => $nonRevisionTypes,
					),
					LIST_OR
				);
			}
			$limitWatchlist = 0;
			$usePage = true;
		}

		# Show a message about slave lag, if applicable
		$lag = wfGetLB()->safeGetLag( $dbr );
		if ( $lag > 0 ) {
			$output->showLagWarning( $lag );
		}

		# Create output
		$form = '';

		# Show watchlist header
		$form .= "<p>";
		$form .= $this->msg( 'watchlist-details' )->numParams( $nitems )->parse() . "\n";
		if ( $wgEnotifWatchlist && $user->getOption( 'enotifwatchlistpages' ) ) {
			$form .= $this->msg( 'wlheader-enotif' )->parse() . "\n";
		}
		if ( $wgShowUpdatedMarker ) {
			$form .= $this->msg( 'wlheader-showupdated' )->parse() . "\n";
		}
		$form .= "</p>";

		if ( $wgShowUpdatedMarker ) {
			$form .= Xml::openElement( 'form', array( 'method' => 'post',
				'action' => $this->getTitle()->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' => 'post',
			'action' => $this->getTitle()->getLocalURL(),
			'id' => 'mw-watchlist-form'
		) );
		$form .= Xml::fieldset(
			$this->msg( 'watchlist-options' )->text(),
			false,
			array( 'id' => 'mw-watchlist-options' )
		);

		$tables = array( 'recentchanges', 'watchlist' );
		$fields = RecentChange::selectFields();
		$join_conds = array(
			'watchlist' => array(
				'INNER JOIN',
				array(
					'wl_user' => $user->getId(),
					'wl_namespace=rc_namespace',
					'wl_title=rc_title'
				),
			),
		);
		$options = array( 'ORDER BY' => 'rc_timestamp DESC' );
		if ( $wgShowUpdatedMarker ) {
			$fields[] = 'wl_notificationtimestamp';
		}
		if ( $limitWatchlist ) {
			$options['LIMIT'] = $limitWatchlist;
		}

		$rollbacker = $user->isAllowed( 'rollback' );
		if ( $usePage || $rollbacker ) {
			$tables[] = 'page';
			$join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
			if ( $rollbacker ) {
				$fields[] = 'page_latest';
			}
		}

		// Log entries with DELETED_ACTION must not show up unless the user has
		// the necessary rights.
		if ( !$user->isAllowed( 'deletedhistory' ) ) {
			$bitmask = LogPage::DELETED_ACTION;
		} elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
			$bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
		} else {
			$bitmask = 0;
		}
		if ( $bitmask ) {
			$conds[] = $dbr->makeList( array(
				'rc_type != ' . RC_LOG,
				$dbr->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
			), LIST_OR );
		}

		ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
		wfRunHooks( 'SpecialWatchlistQuery', array( &$conds, &$tables, &$join_conds, &$fields, $values ) );

		$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
		$numRows = $res->numRows();

		/* Start bottom header */

		$lang = $this->getLanguage();
		$wlInfo = '';
		if ( $values['days'] > 0 ) {
			$timestamp = wfTimestampNow();
			$wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $values['days'] * 24 ) )->params(
				$lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() . "<br />\n";
		}

		$cutofflinks = $this->cutoffLinks( $values['days'], $nondefaults ) . "<br />\n";

		# Spit out some control panel links
		$filters = array(
			'hideMinor' => 'rcshowhideminor',
			'hideBots' => 'rcshowhidebots',
			'hideAnons' => 'rcshowhideanons',
			'hideLiu' => 'rcshowhideliu',
			'hideOwn' => 'rcshowhidemine',
			'hidePatrolled' => 'rcshowhidepatr'
		);
		foreach ( $this->customFilters as $key => $params ) {
			$filters[$key] = $params['msg'];
		}
		// Disable some if needed
		if ( !$user->useNPPatrol() ) {
			unset( $filters['hidePatrolled'] );
		}

		$links = array();
		foreach ( $filters as $name => $msg ) {
			$links[] = $this->showHideLink( $nondefaults, $msg, $name, $values[$name] );
		}

		$hiddenFields = $nondefaults;
		unset( $hiddenFields['namespace'] );
		unset( $hiddenFields['invert'] );
		unset( $hiddenFields['associated'] );

		# Namespace filter and put the whole form together.
		$form .= $wlInfo;
		$form .= $cutofflinks;
		$form .= $lang->pipeList( $links ) . "\n";
		$form .= "<hr />\n<p>";
		$form .= Html::namespaceSelector(
			array(
				'selected' => $nameSpace,
				'all' => '',
				'label' => $this->msg( 'namespace' )->text()
			), array(
				'name' => 'namespace',
				'id' => 'namespace',
				'class' => 'namespaceselector',
			)
		) . '&#160;';
		$form .= Xml::checkLabel(
			$this->msg( 'invert' )->text(),
			'invert',
			'nsinvert',
			$invert,
			array( 'title' => $this->msg( 'tooltip-invert' )->text() )
		) . '&#160;';
		$form .= Xml::checkLabel(
			$this->msg( 'namespace_association' )->text(),
			'associated',
			'associated',
			$associated,
			array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
		) . '&#160;';
		$form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "</p>\n";
		foreach ( $hiddenFields as $key => $value ) {
			$form .= Html::hidden( $key, $value ) . "\n";
		}
		$form .= Xml::closeElement( 'fieldset' ) . "\n";
		$form .= Xml::closeElement( 'form' ) . "\n";
		$output->addHTML( $form );

		# If there's nothing to show, stop here
		if ( $numRows == 0 ) {
			$output->wrapWikiMsg(
				"<div class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
			);
			return;
		}

		/* End bottom header */

		/* Do link batch query */
		$linkBatch = new LinkBatch;
		foreach ( $res as $row ) {
			$userNameUnderscored = str_replace( ' ', '_', $row->rc_user_text );
			if ( $row->rc_user != 0 ) {
				$linkBatch->add( NS_USER, $userNameUnderscored );
			}
			$linkBatch->add( NS_USER_TALK, $userNameUnderscored );

			$linkBatch->add( $row->rc_namespace, $row->rc_title );
		}
		$linkBatch->execute();
		$dbr->dataSeek( $res, 0 );

		$list = ChangesList::newFromContext( $this->getContext() );
		$list->setWatchlistDivs();

		$s = $list->beginRecentChangesList();
		$counter = 1;
		foreach ( $res as $obj ) {
			# Make RC entry
			$rc = RecentChange::newFromRow( $obj );
			$rc->counter = $counter++;

			if ( $wgShowUpdatedMarker ) {
				$updated = $obj->wl_notificationtimestamp;
			} else {
				$updated = false;
			}

			if ( $wgRCShowWatchingUsers && $user->getOption( 'shownumberswatching' ) ) {
				$rc->numberofWatchingusers = $dbr->selectField( 'watchlist',
					'COUNT(*)',
					array(
						'wl_namespace' => $obj->rc_namespace,
						'wl_title' => $obj->rc_title,
					),
					__METHOD__ );
			} else {
				$rc->numberofWatchingusers = 0;
			}

			$changeLine = $list->recentChangesLine( $rc, $updated, $counter );
			if ( $changeLine !== false ) {
				$s .= $changeLine;
			}
		}
		$s .= $list->endRecentChangesList();

		$output->addHTML( $s );
	}
Ejemplo n.º 16
0
 function whatlinkshereForm()
 {
     // We get nicer value from the title object
     $this->opts->consumeValue('target');
     // Reset these for new requests
     $this->opts->consumeValues(['back', 'from']);
     $target = $this->target ? $this->target->getPrefixedText() : '';
     $namespace = $this->opts->consumeValue('namespace');
     $nsinvert = $this->opts->consumeValue('invert');
     # Build up the form
     $f = Xml::openElement('form', ['action' => wfScript()]);
     # Values that should not be forgotten
     $f .= Html::hidden('title', $this->getPageTitle()->getPrefixedText());
     foreach ($this->opts->getUnconsumedValues() as $name => $value) {
         $f .= Html::hidden($name, $value);
     }
     $f .= Xml::fieldset($this->msg('whatlinkshere')->text());
     # Target input (.mw-searchInput enables suggestions)
     $f .= Xml::inputLabel($this->msg('whatlinkshere-page')->text(), 'target', 'mw-whatlinkshere-target', 40, $target, ['class' => 'mw-searchInput']);
     $f .= ' ';
     # Namespace selector
     $f .= Html::namespaceSelector(['selected' => $namespace, 'all' => '', 'label' => $this->msg('namespace')->text()], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']);
     $f .= '&#160;' . Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $nsinvert, ['title' => $this->msg('tooltip-whatlinkshere-invert')->text()]);
     $f .= ' ';
     # Submit
     $f .= Xml::submitButton($this->msg('whatlinkshere-submit')->text());
     # Close
     $f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
     return $f;
 }
	/**
	 * Generates the namespace selector form with hidden attributes.
	 * @param array $options the options to be included.
	 * @return string
	 */
	function getForm( $options ) {
		global $wgScript;

		$options['title'] = $this->getTitle()->getPrefixedText();
		if ( !isset( $options['target'] ) ) {
			$options['target'] = '';
		} else {
			$options['target'] = str_replace( '_', ' ', $options['target'] );
		}

		if ( !isset( $options['namespace'] ) ) {
			$options['namespace'] = '';
		}

		if ( !isset( $options['contribs'] ) ) {
			$options['contribs'] = 'user';
		}

		if ( $options['contribs'] == 'newbie' ) {
			$options['target'] = '';
		}

		$f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );

		foreach ( $options as $name => $value ) {
			if ( in_array( $name, array( 'namespace', 'target', 'contribs' ) ) ) {
				continue;
			}
			$f .= "\t" . Html::hidden( $name, $value ) . "\n";
		}

		$f .= Xml::openElement( 'fieldset' );
		$f .= Xml::element( 'legend', array(), $this->msg( 'sp-contributions-search' )->text() );
		$f .= Xml::tags(
			'label',
			array( 'for' => 'target' ),
			$this->msg( 'sp-contributions-username' )->parse()
		) . ' ';
		$f .= Html::input(
			'target',
			$options['target'],
			'text',
			array(
				'size' => '20',
				'required' => ''
			) + ( $options['target'] ? array() : array( 'autofocus' ) )
		) . ' ';
		$f .= Html::namespaceSelector(
			array(
				'selected' => $options['namespace'],
				'all' => '',
				'label' => $this->msg( 'namespace' )->text()
			),
			array(
				'name' => 'namespace',
				'id' => 'namespace',
				'class' => 'namespaceselector',
			)
		) . ' ';
		$f .= Xml::submitButton( $this->msg( 'sp-contributions-submit' )->text() );
		$f .= Xml::closeElement( 'fieldset' );
		$f .= Xml::closeElement( 'form' );

		return $f;
	}
Ejemplo n.º 18
0
 function testNamespaceSelectorIdAndNameDefaultsAttributes()
 {
     $this->assertNsSelectorIdAndName('namespace', 'namespace', Html::namespaceSelector(array(), array()), "Neither 'id' nor 'name' key given");
     $this->assertNsSelectorIdAndName('namespace', 'select_name', Html::namespaceSelector(array(), array('name' => 'select_name')), "No 'id' key given, 'name' given");
     $this->assertNsSelectorIdAndName('select_id', 'namespace', Html::namespaceSelector(array(), array('id' => 'select_id')), "'id' given, no 'name' key given");
     $this->assertNsSelectorIdAndName('select_id', 'select_name', Html::namespaceSelector(array(), array('id' => 'select_id', 'name' => 'select_name')), "Both 'id' and 'name' given");
 }
Ejemplo n.º 19
0
 public function testCanDisableANamespaces()
 {
     $this->assertEquals('<select id="namespace" name="namespace">' . "\n" . '<option disabled="" value="0">(Main)</option>' . "\n" . '<option disabled="" value="1">Talk</option>' . "\n" . '<option disabled="" value="2">User</option>' . "\n" . '<option disabled="" value="3">User talk</option>' . "\n" . '<option disabled="" value="4">MyWiki</option>' . "\n" . '<option value="5">MyWiki Talk</option>' . "\n" . '<option value="6">File</option>' . "\n" . '<option value="7">File talk</option>' . "\n" . '<option value="8">MediaWiki</option>' . "\n" . '<option value="9">MediaWiki talk</option>' . "\n" . '<option value="10">Template</option>' . "\n" . '<option value="11">Template talk</option>' . "\n" . '<option value="14">Category</option>' . "\n" . '<option value="15">Category talk</option>' . "\n" . '<option value="100">Custom</option>' . "\n" . '<option value="101">Custom talk</option>' . "\n" . '</select>', Html::namespaceSelector(['disable' => [0, 1, 2, 3, 4]]), 'Namespace selector namespace disabling');
 }
Ejemplo n.º 20
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @return string HTML fragment
  */
 protected function getForm()
 {
     $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     if (!isset($this->opts['newOnly'])) {
         $this->opts['newOnly'] = false;
     }
     if (!isset($this->opts['hideMinor'])) {
         $this->opts['hideMinor'] = false;
     }
     $form = Html::openElement('form', ['method' => 'get', 'action' => wfScript(), 'class' => 'mw-contributions-form']);
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = ['namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'newOnly', 'hideMinor', 'associated', 'tagfilter'];
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Html::rawElement('div', [], implode('&#160;', $tagFilter));
     } else {
         $filterSelection = Html::rawElement('div', [], '');
     }
     $this->getOutput()->addModules('mediawiki.userSuggest');
     $labelNewbies = Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', ['class' => 'mw-input']);
     $labelUsername = Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', ['class' => 'mw-input']);
     $input = Html::input('target', $this->opts['target'], 'text', ['size' => '40', 'required' => '', 'class' => ['mw-input', 'mw-ui-input-inline', 'mw-autocomplete-user']] + ($this->opts['contribs'] === 'newbie' || $this->opts['target'] ? [] : ['autofocus' => true]));
     $targetSelection = Html::rawElement('div', [], $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' ');
     $namespaceSelection = Xml::tags('div', [], Xml::label($this->msg('namespace')->text(), 'namespace', '') . '&#160;' . Html::namespaceSelector(['selected' => $this->opts['namespace'], 'all' => ''], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']) . '&#160;' . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], ['title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input']) . '&#160;') . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], ['title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input']) . '&#160;'));
     $filters = [];
     if ($this->getUser()->isAllowed('deletedhistory')) {
         $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], ['class' => 'mw-input']));
     }
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], ['class' => 'mw-input']));
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-newonly')->text(), 'newOnly', 'mw-show-new-only', $this->opts['newOnly'], ['class' => 'mw-input']));
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-hideminor')->text(), 'hideMinor', 'mw-hide-minor-edits', $this->opts['hideMinor'], ['class' => 'mw-input']));
     Hooks::run('SpecialContributions::getForm::filters', [$this, &$filters]);
     $extraOptions = Html::rawElement('div', [], implode('', $filters));
     $dateSelectionAndSubmit = Xml::tags('div', [], Xml::dateMenu($this->opts['year'] === '' ? MWTimestamp::getInstance()->format('Y') : $this->opts['year'], $this->opts['month']) . ' ' . Html::submitButton($this->msg('sp-contributions-submit')->text(), ['class' => 'mw-submit'], ['mw-ui-progressive']));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text(), $targetSelection . $namespaceSelection . $filterSelection . $extraOptions . $dateSelectionAndSubmit, ['class' => 'mw-contributions-table']);
     $explain = $this->msg('sp-contributions-explain');
     if (!$explain->isBlank()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
     }
     $form .= Xml::closeElement('form');
     return $form;
 }
    protected function form()
    {
        global $wgEnableNewpagesUserFilter, $wgScript;
        // Consume values
        $this->opts->consumeValue('offset');
        // don't carry offset, DWIW
        $namespace = $this->opts->consumeValue('namespace');
        $username = $this->opts->consumeValue('username');
        $tagFilterVal = $this->opts->consumeValue('tagfilter');
        $nsinvert = $this->opts->consumeValue('invert');
        // Check username input validity
        $ut = Title::makeTitleSafe(NS_USER, $username);
        $userText = $ut ? $ut->getText() : '';
        // Store query values in hidden fields so that form submission doesn't lose them
        $hidden = array();
        foreach ($this->opts->getUnconsumedValues() as $key => $value) {
            $hidden[] = Html::hidden($key, $value);
        }
        $hidden = implode("\n", $hidden);
        $tagFilter = ChangeTags::buildTagFilterSelector($tagFilterVal);
        if ($tagFilter) {
            list($tagFilterLabel, $tagFilterSelector) = $tagFilter;
        }
        $form = Xml::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . Xml::fieldset($this->msg('newpages')->text()) . Xml::openElement('table', array('id' => 'mw-newpages-table')) . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('namespace')->text(), 'namespace') . '</td>
				<td class="mw-input">' . Html::namespaceSelector(array('selected' => $namespace, 'all' => 'all'), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;' . Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $nsinvert, array('title' => $this->msg('tooltip-invert')->text())) . '</td>
			</tr>' . ($tagFilter ? '<tr>
				<td class="mw-label">' . $tagFilterLabel . '</td>
				<td class="mw-input">' . $tagFilterSelector . '</td>
			</tr>' : '') . ($wgEnableNewpagesUserFilter ? '<tr>
				<td class="mw-label">' . Xml::label($this->msg('newpages-username')->text(), 'mw-np-username') . '</td>
				<td class="mw-input">' . Xml::input('username', 30, $userText, array('id' => 'mw-np-username')) . '</td>
			</tr>' : '') . '<tr> <td></td>
				<td class="mw-submit">' . Xml::submitButton($this->msg('allpagessubmit')->text()) . '</td>
			</tr>' . '<tr>
				<td></td>
				<td class="mw-input">' . $this->filterLinks() . '</td>
			</tr>' . Xml::closeElement('table') . Xml::closeElement('fieldset') . $hidden . Xml::closeElement('form');
        $this->getOutput()->addHTML($form);
    }
Ejemplo n.º 22
0
 /**
  * HTML for the top form
  * @param $namespace Integer: a namespace constant (default NS_MAIN).
  * @param string $from dbKey we are starting listing at.
  * @return string
  */
 protected function namespacePrefixForm($namespace = NS_MAIN, $from = '')
 {
     global $wgScript;
     $out = Xml::openElement('div', array('class' => 'namespaceoptions'));
     $out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $out .= Html::hidden('title', $this->getPageTitle()->getPrefixedText());
     $out .= Xml::openElement('fieldset');
     $out .= Xml::element('legend', null, $this->msg('allpages')->text());
     $out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
     $out .= "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('allpagesprefix')->text(), 'nsfrom') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('prefix', 30, str_replace('_', ' ', $from), array('id' => 'nsfrom')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class='mw-label'>" . Xml::label($this->msg('namespace')->text(), 'namespace') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $namespace), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . Xml::checkLabel($this->msg('allpages-hide-redirects')->text(), 'hideredirects', 'hideredirects', $this->hideRedirects) . ' ' . Xml::checkLabel($this->msg('prefixindex-strip')->text(), 'stripprefix', 'stripprefix', $this->stripPrefix) . ' ' . Xml::submitButton($this->msg('allpagessubmit')->text()) . "</td>\n\t\t\t</tr>";
     $out .= Xml::closeElement('table');
     $out .= Xml::closeElement('fieldset');
     $out .= Xml::closeElement('form');
     $out .= Xml::closeElement('div');
     return $out;
 }
Ejemplo n.º 23
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @return String: HTML fragment
  */
 protected function getForm()
 {
     global $wgScript;
     $this->opts['title'] = $this->getTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     $form = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form'));
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated');
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Xml::tags('td', array('class' => 'mw-label'), array_shift($tagFilter)) . Xml::tags('td', array('class' => 'mw-input'), implode('&#160', $tagFilter));
     } else {
         $filterSelection = Xml::tags('td', array('colspan' => 2), '');
     }
     $targetSelection = Xml::tags('td', array('colspan' => 2), Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input')) . '<br />' . Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input')) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '40', 'required' => '', 'class' => 'mw-input') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ');
     $namespaceSelection = Xml::tags('td', array('class' => 'mw-label'), Xml::label($this->msg('namespace')->text(), 'namespace', '')) . Xml::tags('td', null, Html::namespaceSelector(array('selected' => $this->opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . '&#160;') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . '&#160;'));
     $extraOptions = Xml::tags('td', array('colspan' => 2), Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input'))) . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input'))));
     $dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit')));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text()) . Xml::openElement('table', array('class' => 'mw-contributions-table')) . Xml::openElement('tr') . $targetSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $namespaceSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $filterSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $extraOptions . Xml::closeElement('tr') . Xml::openElement('tr') . $dateSelectionAndSubmit . Xml::closeElement('tr') . Xml::closeElement('table');
     $explain = $this->msg('sp-contributions-explain');
     if ($explain->exists()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
     }
     $form .= Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $form;
 }
Ejemplo n.º 24
0
 public function execute($par)
 {
     global $wgSitename, $wgExportAllowListContributors, $wgExportFromNamespaces;
     global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth;
     global $wgExportAllowAll;
     $this->setHeaders();
     $this->outputHeader();
     // Set some variables
     $this->curonly = true;
     $this->doExport = false;
     $request = $this->getRequest();
     $this->templates = $request->getCheck('templates');
     $this->images = $request->getCheck('images');
     // Doesn't do anything yet
     $this->pageLinkDepth = $this->validateLinkDepth($request->getIntOrNull('pagelink-depth'));
     $nsindex = '';
     $exportall = false;
     if ($request->getCheck('addcat')) {
         $page = $request->getText('pages');
         $catname = $request->getText('catname');
         if ($catname !== '' && $catname !== null && $catname !== false) {
             $t = Title::makeTitleSafe(NS_MAIN, $catname);
             if ($t) {
                 /**
                  * @todo FIXME: This can lead to hitting memory limit for very large
                  * categories. Ideally we would do the lookup synchronously
                  * during the export in a single query.
                  */
                 $catpages = $this->getPagesFromCategory($t);
                 if ($catpages) {
                     $page .= "\n" . implode("\n", $catpages);
                 }
             }
         }
     } elseif ($request->getCheck('addns') && $wgExportFromNamespaces) {
         $page = $request->getText('pages');
         $nsindex = $request->getText('nsindex', '');
         if (strval($nsindex) !== '') {
             /**
              * Same implementation as above, so same @todo
              */
             $nspages = $this->getPagesFromNamespace($nsindex);
             if ($nspages) {
                 $page .= "\n" . implode("\n", $nspages);
             }
         }
     } elseif ($request->getCheck('exportall') && $wgExportAllowAll) {
         $this->doExport = true;
         $exportall = true;
         /* Although $page and $history are not used later on, we
         			nevertheless set them to avoid that PHP notices about using
         			undefined variables foul up our XML output (see call to
         			doExport(...) further down) */
         $page = '';
         $history = '';
     } elseif ($request->wasPosted() && $par == '') {
         $page = $request->getText('pages');
         $this->curonly = $request->getCheck('curonly');
         $rawOffset = $request->getVal('offset');
         if ($rawOffset) {
             $offset = wfTimestamp(TS_MW, $rawOffset);
         } else {
             $offset = null;
         }
         $limit = $request->getInt('limit');
         $dir = $request->getVal('dir');
         $history = array('dir' => 'asc', 'offset' => false, 'limit' => $wgExportMaxHistory);
         $historyCheck = $request->getCheck('history');
         if ($this->curonly) {
             $history = WikiExporter::CURRENT;
         } elseif (!$historyCheck) {
             if ($limit > 0 && ($wgExportMaxHistory == 0 || $limit < $wgExportMaxHistory)) {
                 $history['limit'] = $limit;
             }
             if (!is_null($offset)) {
                 $history['offset'] = $offset;
             }
             if (strtolower($dir) == 'desc') {
                 $history['dir'] = 'desc';
             }
         }
         if ($page != '') {
             $this->doExport = true;
         }
     } else {
         // Default to current-only for GET requests.
         $page = $request->getText('pages', $par);
         $historyCheck = $request->getCheck('history');
         if ($historyCheck) {
             $history = WikiExporter::FULL;
         } else {
             $history = WikiExporter::CURRENT;
         }
         if ($page != '') {
             $this->doExport = true;
         }
     }
     if (!$wgExportAllowHistory) {
         // Override
         $history = WikiExporter::CURRENT;
     }
     $list_authors = $request->getCheck('listauthors');
     if (!$this->curonly || !$wgExportAllowListContributors) {
         $list_authors = false;
     }
     if ($this->doExport) {
         $this->getOutput()->disable();
         // Cancel output buffering and gzipping if set
         // This should provide safer streaming for pages with history
         wfResetOutputBuffers();
         $request->response()->header("Content-type: application/xml; charset=utf-8");
         if ($request->getCheck('wpDownload')) {
             // Provide a sane filename suggestion
             $filename = urlencode($wgSitename . '-' . wfTimestampNow() . '.xml');
             $request->response()->header("Content-disposition: attachment;filename={$filename}");
         }
         $this->doExport($page, $history, $list_authors, $exportall);
         return;
     }
     $out = $this->getOutput();
     $out->addWikiMsg('exporttext');
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl('action=submit')));
     $form .= Xml::inputLabel($this->msg('export-addcattext')->text(), 'catname', 'catname', 40) . '&#160;';
     $form .= Xml::submitButton($this->msg('export-addcat')->text(), array('name' => 'addcat')) . '<br />';
     if ($wgExportFromNamespaces) {
         $form .= Html::namespaceSelector(array('selected' => $nsindex, 'label' => $this->msg('export-addnstext')->text()), array('name' => 'nsindex', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;';
         $form .= Xml::submitButton($this->msg('export-addns')->text(), array('name' => 'addns')) . '<br />';
     }
     if ($wgExportAllowAll) {
         $form .= Xml::checkLabel($this->msg('exportall')->text(), 'exportall', 'exportall', $request->wasPosted() ? $request->getCheck('exportall') : false) . '<br />';
     }
     $form .= Xml::element('textarea', array('name' => 'pages', 'cols' => 40, 'rows' => 10), $page, false);
     $form .= '<br />';
     if ($wgExportAllowHistory) {
         $form .= Xml::checkLabel($this->msg('exportcuronly')->text(), 'curonly', 'curonly', $request->wasPosted() ? $request->getCheck('curonly') : true) . '<br />';
     } else {
         $out->addWikiMsg('exportnohistory');
     }
     $form .= Xml::checkLabel($this->msg('export-templates')->text(), 'templates', 'wpExportTemplates', $request->wasPosted() ? $request->getCheck('templates') : false) . '<br />';
     if ($wgExportMaxLinkDepth || $this->userCanOverrideExportDepth()) {
         $form .= Xml::inputLabel($this->msg('export-pagelinks')->text(), 'pagelink-depth', 'pagelink-depth', 20, 0) . '<br />';
     }
     // Enable this when we can do something useful exporting/importing image information. :)
     //$form .= Xml::checkLabel( $this->msg( 'export-images' )->text(), 'images', 'wpExportImages', false ) . '<br />';
     $form .= Xml::checkLabel($this->msg('export-download')->text(), 'wpDownload', 'wpDownload', $request->wasPosted() ? $request->getCheck('wpDownload') : true) . '<br />';
     if ($wgExportAllowListContributors) {
         $form .= Xml::checkLabel($this->msg('exportlistauthors')->text(), 'listauthors', 'listauthors', $request->wasPosted() ? $request->getCheck('listauthors') : false) . '<br />';
     }
     $form .= Xml::submitButton($this->msg('export-submit')->text(), Linker::tooltipAndAccesskeyAttribs('export'));
     $form .= Xml::closeElement('form');
     $out->addHTML($form);
 }
Ejemplo n.º 25
0
 /**
  * Creates the choose namespace selection
  *
  * @param FormOptions $opts
  * @return string
  */
 protected function namespaceFilterForm(FormOptions $opts)
 {
     $nsSelect = Html::namespaceSelector(array('selected' => $opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace'));
     $nsLabel = Xml::label($this->msg('namespace')->text(), 'namespace');
     $invert = Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $opts['invert'], array('title' => $this->msg('tooltip-invert')->text()));
     $associated = Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'nsassociated', $opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text()));
     return array($nsLabel, "{$nsSelect} {$invert} {$associated}");
 }
Ejemplo n.º 26
0
 function getInputHTML($value)
 {
     return Html::namespaceSelector(['selected' => $value, 'all' => $this->mAllValue], ['name' => $this->mName, 'id' => $this->mID, 'class' => 'namespaceselector']);
 }
Ejemplo n.º 27
0
 /**
  * Set the text to be displayed above the changes
  *
  * @param FormOptions $opts
  * @param int $numRows Number of rows in the result to show after this header
  */
 public function doHeader($opts, $numRows)
 {
     $user = $this->getUser();
     $out = $this->getOutput();
     // if the user wishes, that the watchlist is reloaded, whenever a filter changes,
     // add the module for that
     if ($user->getBoolOption('watchlistreloadautomatically')) {
         $out->addModules(array('mediawiki.special.watchlist'));
     }
     $out->addSubtitle($this->msg('watchlistfor2', $user->getName())->rawParams(SpecialEditWatchlist::buildTools(null)));
     $this->setTopText($opts);
     $lang = $this->getLanguage();
     if ($opts['days'] > 0) {
         $days = $opts['days'];
     } else {
         $days = $this->getConfig()->get('RCMaxAge') / (3600 * 24);
     }
     $timestamp = wfTimestampNow();
     $wlInfo = $this->msg('wlnote')->numParams($numRows, round($days * 24))->params($lang->userDate($timestamp, $user), $lang->userTime($timestamp, $user))->parse() . "<br />\n";
     $nondefaults = $opts->getChangedValues();
     $cutofflinks = $this->msg('wlshowtime') . ' ' . $this->cutoffselector($opts);
     # Spit out some control panel links
     $filters = array('hideminor' => 'wlshowhideminor', 'hidebots' => 'wlshowhidebots', 'hideanons' => 'wlshowhideanons', 'hideliu' => 'wlshowhideliu', 'hidemyself' => 'wlshowhidemine', 'hidepatrolled' => 'wlshowhidepatr');
     if ($this->getConfig()->get('RCWatchCategoryMembership')) {
         $filters['hidecategorization'] = 'wlshowhidecategorization';
     }
     foreach ($this->getCustomFilters() as $key => $params) {
         $filters[$key] = $params['msg'];
     }
     // Disable some if needed
     if (!$user->useRCPatrol()) {
         unset($filters['hidepatrolled']);
     }
     $links = array();
     foreach ($filters as $name => $msg) {
         $links[] = $this->showHideCheck($nondefaults, $msg, $name, $opts[$name]);
     }
     $hiddenFields = $nondefaults;
     $hiddenFields['action'] = 'submit';
     unset($hiddenFields['namespace']);
     unset($hiddenFields['invert']);
     unset($hiddenFields['associated']);
     unset($hiddenFields['days']);
     foreach ($filters as $key => $value) {
         unset($hiddenFields[$key]);
     }
     # Create output
     $form = '';
     # Namespace filter and put the whole form together.
     $form .= $wlInfo;
     $form .= $cutofflinks;
     $form .= $this->msg('watchlist-hide') . $this->msg('colon-separator')->escaped() . implode(' ', $links);
     $form .= "\n<br />\n";
     $form .= Html::namespaceSelector(array('selected' => $opts['namespace'], 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . "\n";
     $form .= '<span class="mw-input-with-label">' . Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $opts['invert'], array('title' => $this->msg('tooltip-invert')->text())) . "</span>\n";
     $form .= '<span class="mw-input-with-label">' . Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'nsassociated', $opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text())) . "</span>\n";
     $form .= Xml::submitButton($this->msg('watchlist-submit')->text()) . "\n";
     foreach ($hiddenFields as $key => $value) {
         $form .= Html::hidden($key, $value) . "\n";
     }
     $form .= Xml::closeElement('fieldset') . "\n";
     $form .= Xml::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
     $this->setBottomText($opts);
 }
Ejemplo n.º 28
0
 private function showForm()
 {
     $action = $this->getPageTitle()->getLocalURL(array('action' => 'submit'));
     $user = $this->getUser();
     $out = $this->getOutput();
     $importSources = $this->getConfig()->get('ImportSources');
     if ($user->isAllowed('importupload')) {
         $out->addHTML(Xml::fieldset($this->msg('import-upload')->text()) . Xml::openElement('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action, 'id' => 'mw-import-upload-form')) . $this->msg('importtext')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'upload') . Xml::openElement('table', array('id' => 'mw-import-table-upload')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-upload-filename')->text(), 'xmlimport') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Html::input('xmlimport', '', 'file', array('id' => 'xmlimport')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-comment')->text(), 'mw-import-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, $this->sourceName == 'upload' ? $this->logcomment : '', array('id' => 'mw-import-comment', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage-upload') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage-upload', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('uploadbtn')->text()) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Html::hidden('editToken', $user->getEditToken()) . Xml::closeElement('form') . Xml::closeElement('fieldset'));
     } else {
         if (empty($importSources)) {
             $out->addWikiMsg('importnosources');
         }
     }
     if ($user->isAllowed('import') && !empty($importSources)) {
         # Show input field for import depth only if $wgExportMaxLinkDepth > 0
         $importDepth = '';
         if ($this->getConfig()->get('ExportMaxLinkDepth') > 0) {
             $importDepth = "<tr>\n\t\t\t\t\t\t\t<td class='mw-label'>" . $this->msg('export-pagelinks')->parse() . "</td>\n\t\t\t\t\t\t\t<td class='mw-input'>" . Xml::input('pagelink-depth', 3, 0) . "</td>\n\t\t\t\t</tr>";
         }
         $out->addHTML(Xml::fieldset($this->msg('importinterwiki')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form')) . $this->msg('import-interwiki-text')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'interwiki') . Html::hidden('editToken', $user->getEditToken()) . Xml::openElement('table', array('id' => 'mw-import-table-interwiki')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-sourcewiki')->text(), 'interwiki') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::openElement('select', array('name' => 'interwiki', 'id' => 'interwiki')));
         $needSubprojectField = false;
         foreach ($importSources as $key => $value) {
             if (is_int($key)) {
                 $key = $value;
             } elseif ($value !== $key) {
                 $needSubprojectField = true;
             }
             $attribs = array('value' => $key);
             if (is_array($value)) {
                 $attribs['data-subprojects'] = implode(' ', $value);
             }
             if ($this->interwiki === $key) {
                 $attribs['selected'] = 'selected';
             }
             $out->addHTML(Html::element('option', $attribs, $key));
         }
         $out->addHTML(Xml::closeElement('select'));
         if ($needSubprojectField) {
             $out->addHTML(Xml::openElement('select', array('name' => 'subproject', 'id' => 'subproject')));
             $subprojectsToAdd = array();
             foreach ($importSources as $key => $value) {
                 if (is_array($value)) {
                     $subprojectsToAdd = array_merge($subprojectsToAdd, $value);
                 }
             }
             $subprojectsToAdd = array_unique($subprojectsToAdd);
             sort($subprojectsToAdd);
             foreach ($subprojectsToAdd as $subproject) {
                 $out->addHTML(Xml::option($subproject, $subproject, $this->subproject === $subproject));
             }
             $out->addHTML(Xml::closeElement('select'));
         }
         $out->addHTML("</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-sourcepage')->text(), 'frompage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('frompage', 50, $this->frompage, array('id' => 'frompage')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-history')->text(), 'interwikiHistory', 'interwikiHistory', $this->history) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-templates')->text(), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$importDepth}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-namespace')->text(), 'namespace') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $this->namespace, 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-comment')->text(), 'mw-interwiki-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, $this->sourceName == 'interwiki' ? $this->logcomment : '', array('id' => 'mw-interwiki-comment', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage-interwiki') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage-interwiki', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('import-interwiki-submit')->text(), Linker::tooltipAndAccesskeyAttribs('import')) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset'));
     }
 }
Ejemplo n.º 29
0
 /**
  * Prepare the namespace filter drop-down; standard namespace
  * selector, sans the MediaWiki namespace
  *
  * @param string|null $namespace Pre-select namespace
  * @return string
  */
 protected function getNamespaceMenu($namespace = null)
 {
     return Html::rawElement('span', array('class' => 'mw-input-with-label'), Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')));
 }
Ejemplo n.º 30
0
 /**
  * Input form for entering a category
  */
 function executeInputForm()
 {
     global $wgScript;
     $thisTitle = SpecialPage::getTitleFor($this->getName());
     $namespaces = $this->getRequest()->getVal('namespaces', '');
     //mode may be overriden by namespaces option
     $mode = $namespaces == '' ? $this->getOption('mode') : CT_MODE_ALL;
     $modeSelector = Xml::openElement('select', array('name' => 'mode'));
     $modeSelector .= Xml::option(wfMessage('categorytree-mode-categories')->plain(), 'categories', $mode == CT_MODE_CATEGORIES);
     $modeSelector .= Xml::option(wfMessage('categorytree-mode-pages')->plain(), 'pages', $mode == CT_MODE_PAGES);
     $modeSelector .= Xml::option(wfMessage('categorytree-mode-all')->plain(), 'all', $mode == CT_MODE_ALL);
     $modeSelector .= Xml::closeElement('select');
     $table = Xml::buildForm(array('categorytree-category' => Xml::input('target', 20, $this->target, array('id' => 'target')), 'categorytree-mode-label' => $modeSelector, 'namespace' => Html::namespaceSelector(array('selected' => $namespaces, 'all' => ''), array('name' => 'namespaces', 'id' => 'namespaces'))), 'categorytree-go');
     $preTable = Xml::element('legend', null, wfMessage('categorytree-legend')->plain());
     $preTable .= Html::Hidden('title', $thisTitle->getPrefixedDbKey());
     $fieldset = Xml::tags('fieldset', array(), $preTable . $table);
     $output = $this->getOutput();
     $output->addHTML(Xml::tags('form', array('name' => 'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-categorytree-form'), $fieldset));
 }