/**
  * Main function for special page. At the current time only produces html for the blacklist.
  * Should support updating the blacklist.
  * 
  * @global $wgOut object
  * @global $wgRequest object
  * @param $par
  */
 public function execute($par)
 {
     global $wgOut, $wgRequest;
     $this->setHeaders();
     //$this->outputHeader();
     $wgOut->addWikiMsg('archivelinks-modify-blacklist-desc');
     $wgOut->addHTML(HTML::openElement('form', array('method' => 'post', 'action' => SpecialPage::getTitleFor('ModifyBlacklist')->getLocalUrl())) . HTML::openElement('fieldset') . HTML::element('legend', null, wfMsg('ModifyArchiveBlacklist')) . HTML::openElement('table') . HTML::openElement('tr') . HTML::openElement('td') . wfMsg('archivelinks-modify-blacklist-blacklist-or-whitelist-field-label') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_blacklist-whitelist', 'type' => 'radio', 'value' => 'blacklist')) . ' ' . wfMsg('archivelinks-modify-blacklist-blacklist-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_blacklist-whitelist', 'type' => 'radio', 'value' => 'whitelist')) . ' ' . wfMsg('archivelinks-modify-blacklist-whitelist-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . wfMsg('archivelinks-modify-blacklist-add-or-remove-field-label') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_add-remove', 'type' => 'radio', 'value' => 'add')) . ' ' . wfMsg('archivelinks-modify-blacklist-add-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_add-remove', 'type' => 'radio', 'value' => 'remove')) . ' ' . wfMsg('archivelinks-modify-blacklist-remove-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::element('label', array('for' => 'bl_url'), wfMsg('archivelinks-modify-blacklist-url-field-label')) . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_url', 'type' => 'text', 'size' => '110')) . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::element('label', array('for' => 'bl_duration'), wfMsg('archivelinks-modify-blacklist-duration-field-label')) . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_duration', 'type' => 'text', 'size' => '60')) . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::element('label', array('for' => 'bl_reason'), wfMsg('archivelinks-modify-blacklist-reason-field-label')) . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_reason', 'type' => 'text', 'size' => '60')) . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::closeElement('table') . XML::submitButton('Blacklist URL') . HTML::closeElement('fieldset') . HTML::closeElement('form'));
 }
Esempio n. 2
0
 function execute($par)
 {
     global $wgOut, $wgUser;
     $this->setHeaders();
     if (!$wgUser->isAllowed('stafflog')) {
         throw new PermissionsError('stafflog');
     }
     $pager = new StaffLoggerPager("");
     $sTypesDropDown = XML::openElement('select', array('name' => 'type', 'id' => 'StaffLogFilterType'));
     foreach ($this->aTypes as $k => $v) {
         $sTypesDropDown .= XML::option($v, $k, $k == $this->request->getText('type', ''));
     }
     $sTypesDropDown .= XML::closeElement('select');
     $wgOut->addHTML(XML::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL())) . XML::openElement('fieldset') . XML::element('legend', null, wfMsg('stafflog-filter-label'), false) . XML::inputLabel(wfMsg('stafflog-filter-user'), 'user', 'StaffLogFilterUser', false, htmlspecialchars($this->request->getText('user', ''), ENT_QUOTES, 'UTF-8')) . XML::label(wfMsg('stafflog-filter-type'), 'StaffLogFilterType') . ' ' . $sTypesDropDown . ' ' . XML::submitButton(wfMsg('stafflog-filter-apply')) . XML::closeElement('fieldset') . XML::closeElement('form') . XML::openElement('div', array('class' => 'mw-spcontent')) . $pager->getNavigationBar() . '<ul>' . $pager->getBody() . '</ul>' . $pager->getNavigationBar() . XML::closeElement('div'));
 }
 function getNewPages($user)
 {
     global $wgOut, $wgUser;
     $wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL('action=delete'), 'method' => 'post')) . HTML::hidden('wpEditToken', $wgUser->getEditToken()) . '<ul>');
     $pages = BanPests::getBannablePages($user);
     $ips = BanPests::getBannableIP($user);
     if (count($pages)) {
         $wgOut->addHTML("<h2>" . wfMsg("blockandnuke-pages") . "</h2>");
         $wgOut->addHtml("<ul>");
         foreach ($pages as $title) {
             $wgOut->addHtml("<li>" . Linker::link($title));
             $wgOut->addHtml(HTML::hidden('pages[]', $title));
         }
         $wgOut->addHtml("</ul>\n");
     }
     if (count($user)) {
         $wgOut->addHTML("<h2>" . wfMsg("blockandnuke-users") . "</h2>");
         foreach ($user as $users) {
             $dbr = wfGetDB(DB_SLAVE);
             $result = $dbr->select('recentchanges', array('rc_user', 'rc_user_text'), array('rc_user_text' => $users), __METHOD__, array('ORDER BY' => 'rc_user ASC'));
             $name = array();
             while ($row = $dbr->fetchObject($result)) {
                 $name[] = array($row->rc_user_text, $row->rc_user);
             }
             $wgOut->addHtml("<ul>");
             $seen = array();
             foreach ($name as $infos) {
                 list($user_2, $user_id) = $infos;
                 if (!isset($seen[$user_2])) {
                     $seen[$user_2] = true;
                     $wgOut->addHtml("<li>" . Linker::link(Title::newFromText($user_2, NS_USER)));
                     $wgOut->addHTML(HTML::hidden('names_2[]', $user_2) . HTML::hidden('userid[]', $user_id));
                 }
             }
             $wgOut->addHtml("</ul>\n");
         }
     }
     if ($ips) {
         $wgOut->addHTML("<h2>" . wfMsg("blockandnuke-ip-addresses") . "</h2>");
         foreach ($ips as $ip) {
             $wgOut->addHtml("<ul>");
             $seen = array();
             if (!isset($seen[$ip])) {
                 $seen[$ip] = true;
                 $wgOut->addHtml("<li>" . Linker::link(Title::newFromText($ip, NS_USER)));
                 $wgOut->addHTML(HTML::hidden('ip[]', $ip));
             }
             $wgOut->addHtml("</ul>\n");
         }
     }
     $wgOut->addHTML("</ul>\n" . XML::submitButton(wfMsg('blockandnuke')) . "</form>");
 }
 /**
  * Uses the HTML functions to output the appropiate form for the special page if no archived version
  * exists or if no query has been specified by the user yet.
  *
  * @global $wgOut object
  */
 private function output_form()
 {
     global $wgOut;
     $this->setHeaders();
     $wgOut->addWikiMsg('archivelinks-view-archive-desc');
     $wgOut->addHTML(HTML::openElement('form', array('method' => 'get', 'action' => SpecialPage::getTitleFor('ViewArchive')->getLocalUrl())) . HTML::openElement('fieldset') . HTML::element('legend', null, wfMsg('ViewArchive')) . XML::inputLabel(wfMsg('archivelinks-view-archive-url-field'), 'archive_url', 'archive-links-archive-url', 120) . HTML::element('br') . XML::submitButton(wfMsg('archivelinks-view-archive-submit-button')) . HTML::closeElement('fieldset') . HTML::closeElement('form'));
 }