public function execute($parameters)
 {
     global $wgOut, $wgRequest, $wgDisableTextSearch, $wgScript;
     $this->setHeaders();
     list($limit, $offset) = wfCheckLimits();
     $wgOut->addWikiText(wfMsgForContentNoTrans('proofreadpage_specialpage_text'));
     $this->searchList = null;
     $this->searchTerm = $wgRequest->getText('key');
     $this->suppressSqlOffset = false;
     if (!$wgDisableTextSearch) {
         $self = $this->getTitle();
         $wgOut->addHTML(Xml::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::input('limit', false, $limit, array('type' => 'hidden')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('proofreadpage_specialpage_legend')) . Xml::input('key', 20, $this->searchTerm) . ' ' . Xml::submitButton(wfMsg('ilsubmit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
         if ($this->searchTerm) {
             $index_namespace = $this->index_namespace;
             $index_ns_index = MWNamespace::getCanonicalIndex(strtolower(str_replace(' ', '_', $index_namespace)));
             $searchEngine = SearchEngine::create();
             $searchEngine->setLimitOffset($limit, $offset);
             $searchEngine->setNamespaces(array($index_ns_index));
             $searchEngine->showRedirects = false;
             $textMatches = $searchEngine->searchText($this->searchTerm);
             $escIndex = preg_quote($index_namespace, '/');
             $this->searchList = array();
             while ($result = $textMatches->next()) {
                 $title = $result->getTitle();
                 if ($title->getNamespace() == $index_ns_index) {
                     array_push($this->searchList, $title->getDBkey());
                 }
             }
             $this->suppressSqlOffset = true;
         }
     }
     parent::execute($parameters);
 }
Esempio n. 2
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);
 }
 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');
         }
     }
 }
 public function onSubmit($data, $form)
 {
     $this->propName = $data['propname'];
     parent::execute($data['propname']);
 }
Esempio n. 5
0
 public function execute($par)
 {
     $this->mime = $par ? $par : $this->getRequest()->getText('mime');
     $this->mime = trim($this->mime);
     list($this->major, $this->minor) = File::splitMime($this->mime);
     if ($this->major == '' || $this->minor == '' || $this->minor == 'unknown' || !self::isValidType($this->major)) {
         $this->setHeaders();
         $this->outputHeader();
         $this->getPageHeader();
         return;
     }
     parent::execute($par);
 }
 function getList()
 {
     list($limit, $offset) = wfCheckLimits();
     $this->limit = $limit;
     $this->offset = $offset;
     parent::execute('');
 }
Esempio n. 7
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');
         }
     }
 }
Esempio n. 8
0
 function execute($par)
 {
     $this->initServices();
     $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 ($this->getConfig()->get('UrlProtocols') 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));
     $fields = array('target' => array('type' => 'text', 'name' => 'target', 'id' => 'target', 'size' => 50, 'label-message' => 'linksearch-pat', 'default' => $target, 'dir' => 'ltr'));
     if (!$this->getConfig()->get('MiserMode')) {
         $fields += array('namespace' => array('type' => 'namespaceselect', 'name' => 'namespace', 'label-message' => 'linksearch-ns', 'default' => $namespace, 'id' => 'namespace', 'all' => '', 'cssclass' => 'namespaceselector'));
     }
     $hiddenFields = array('title' => $this->getPageTitle()->getPrefixedDBkey());
     $htmlForm = HTMLForm::factory('ooui', $fields, $this->getContext());
     $htmlForm->addHiddenFields($hiddenFields);
     $htmlForm->setSubmitTextMsg('linksearch-ok');
     $htmlForm->setWrapperLegendMsg('linksearch');
     $htmlForm->setAction(wfScript());
     $htmlForm->setMethod('get');
     $htmlForm->prepareForm()->displayForm(false);
     $this->addHelpLink('Help:Linksearch');
     if ($target != '') {
         $this->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
         parent::execute($par);
         if ($this->mungedQuery === false) {
             $out->addWikiMsg('linksearch-error');
         }
     }
 }
 /**
  * Add the JS
  * @param string|null $par
  */
 public function execute($par)
 {
     parent::execute($par);
     $this->getOutput()->addModules('mediawiki.special.unwatchedPages');
 }
 function execute($unused)
 {
     if (!$this->getUser()->isAllowed('moderation')) {
         $this->displayRestrictionError();
         return;
     }
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->preventClickjacking();
     $action = $this->getRequest()->getVal('modaction');
     $id = $this->getRequest()->getVal('modid');
     $token = $this->getRequest()->getVal('token');
     if (!$action) {
         $out->addModules('ext.moderation');
         $out->addWikiMsg('moderation-text');
         return parent::execute('');
         # '' suppresses warning in QueryPage.php
     }
     # Some action was requested
     $class = null;
     switch ($action) {
         case 'showimg':
             $class = 'ModerationActionShowImage';
             break;
         case 'show':
             $class = 'ModerationActionShow';
             break;
         case 'preview':
             $class = 'ModerationActionPreview';
             break;
         case 'approve':
         case 'approveall':
             $class = 'ModerationActionApprove';
             break;
         case 'reject':
         case 'rejectall':
             $class = 'ModerationActionReject';
             break;
         case 'merge':
             $class = 'ModerationActionMerge';
             break;
         case 'block':
         case 'unblock':
             $class = 'ModerationActionBlock';
     }
     if (!$class) {
         throw new ModerationError('moderation-unknown-modaction');
     }
     $A = new $class($this);
     $A->run();
 }