function show()
 {
     global $wgOut, $wgUser, $wgRequest;
     AbuseFilter::disableConditionLimit();
     if (!$wgUser->isAllowed('abusefilter-modify')) {
         $wgOut->addWikiMsg('abusefilter-mustbeeditor');
         return;
     }
     $this->loadParameters();
     $wgOut->setPageTitle(wfMsg('abusefilter-test'));
     $wgOut->addWikiMsg('abusefilter-test-intro', self::$mChangeLimit);
     $output = '';
     $output .= AbuseFilter::buildEditBox($this->mFilter, 'wpTestFilter') . "\n";
     $output .= Xml::inputLabel(wfMsg('abusefilter-test-load-filter'), 'wpInsertFilter', 'mw-abusefilter-load-filter', 10, '') . ' ' . Xml::element('input', array('type' => 'button', 'value' => wfMsg('abusefilter-test-load'), 'id' => 'mw-abusefilter-load'));
     $output = Xml::tags('div', array('id' => 'mw-abusefilter-test-editor'), $output);
     $output .= Xml::tags('p', null, Xml::checkLabel(wfMsg('abusefilter-test-shownegative'), 'wpShowNegative', 'wpShowNegative', $this->mShowNegative));
     // Selectory stuff
     $selectFields = array();
     $selectFields['abusefilter-test-user'] = Xml::input('wpTestUser', 45, $this->mTestUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpTestPeriodStart', 45, $this->mTestPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpTestPeriodEnd', 45, $this->mTestPeriodEnd);
     $selectFields['abusefilter-test-page'] = Xml::input('wpTestPage', 45, $this->mTestPage);
     $output .= Xml::buildForm($selectFields, 'abusefilter-test-submit');
     $output .= Html::hidden('title', $this->getTitle('test')->getPrefixedText());
     $output = Xml::tags('form', array('action' => $this->getTitle('test')->getLocalURL(), 'method' => 'post'), $output);
     $output = Xml::fieldset(wfMsg('abusefilter-test-legend'), $output);
     $wgOut->addHTML($output);
     if ($wgRequest->wasPosted()) {
         $this->doTest();
     }
 }
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
     $output = '';
     $output .= Xml::element('h2', null, $this->msg('abusefilter-list')->parse());
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     $scope = $optarray['scope'];
     # Options form
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel($this->msg('abusefilter-list-options-deleted-show')->text(), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-hide')->text(), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-only')->text(), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral) {
         $fields['abusefilter-list-options-scope'] = Xml::radioLabel($this->msg('abusefilter-list-options-scope-local')->text(), 'rulescope', 'local', 'mw-abusefilter-rulescope-local', $scope == 'local') . Xml::radioLabel($this->msg('abusefilter-list-options-scope-global')->text(), 'rulescope', 'global', 'mw-abusefilter-rulescope-global', $scope == 'global');
     }
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel($this->msg('abusefilter-list-options-hidedisabled')->text(), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset($this->msg('abusefilter-list-options')->text(), $options);
     $output .= $options;
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral && $scope == 'global') {
         $globalPager = new GlobalAbuseFilterPager($this, $conds);
         $output .= $globalPager->getNavigationBar() . $globalPager->getBody() . $globalPager->getNavigationBar();
     } else {
         $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     }
     $this->getOutput()->addHTML($output);
 }
 function show($params)
 {
     global $wgOut, $wgUser, $wgLang;
     $dqi = DeleteQueueItem::newFromId($params[1]);
     if (!$dqi) {
         $wgOut->setPageTitle(wfMsg('deletequeue-case-no-case-title'));
         $wgOut->addWikiMsg('deletequeue-case-no-case', $params[1]);
         return;
     }
     $wgOut->setPageTitle(wfMsg('deletequeue-case-title'));
     $wgOut->addWikiMsg('deletequeue-case-intro');
     if (wfTimestamp(TS_UNIX, $dqi->getExpiry()) < time() && $wgUser->isAllowed($dqi->getQueue() . '-review')) {
         $wgOut->addWikiMsg('deletequeue-case-needs-review', $this->getTitle("case/" . $params[1] . "/review"));
     }
     // Show basic data
     $sk = $wgUser->getSkin();
     $fields = array();
     $fields['deletequeue-case-page'] = $sk->link($this->getTitle());
     $fields['deletequeue-case-reason'] = DeleteQueueInterface::formatReason(null, $dqi->getReason());
     $expiry = $dqi->getExpiry();
     if ($expiry) {
         $fields['deletequeue-case-expiry'] = $wgLang->timeanddate($expiry);
     }
     $fields['deletequeue-case-votes'] = $dqi->formatVoteCount();
     $wgOut->addHTML(Xml::element('h2', null, wfMsg('deletequeue-case-details')) . Xml::buildForm($fields) . Xml::element('h2', null, wfMsg('deletequeue-case-votes')));
     $article = $dqi->getArticle();
     $this->showVotes($article, $dqi);
 }
 function showList()
 {
     global $wgOut, $wgScript;
     $errors = array();
     // Validate search IP
     $ip = $this->mSearchIP;
     if (!IP::isIPAddress($ip) && strlen($ip)) {
         $errors[] = array('globalblocking-list-ipinvalid', $ip);
         $ip = '';
     }
     $wgOut->addWikiMsg('globalblocking-list-intro');
     // Build the search form
     $searchForm = '';
     $searchForm .= Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('globalblocking-search-legend'));
     $searchForm .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'globalblocklist-search'));
     $searchForm .= Html::hidden('title', SpecialPage::getTitleFor('GlobalBlockList')->getPrefixedText());
     if (is_array($errors) && count($errors) > 0) {
         $errorstr = '';
         foreach ($errors as $error) {
             if (is_array($error)) {
                 $msg = array_shift($error);
             } else {
                 $msg = $error;
                 $error = array();
             }
             $errorstr .= Xml::tags('li', null, wfMsgExt($msg, array('parseinline'), $error));
         }
         $wgOut->addWikiMsg('globalblocking-unblock-errors', count($errors));
         $wgOut->addHTML(Xml::tags('ul', array('class' => 'error'), $errorstr));
     }
     $fields = array();
     $fields['globalblocking-search-ip'] = Xml::input('ip', 45, $ip);
     $searchForm .= Xml::buildForm($fields, 'globalblocking-search-submit');
     $searchForm .= Xml::closeElement('form') . Xml::closeElement('fieldset');
     $wgOut->addHTML($searchForm);
     // Build a list of blocks.
     $conds = array();
     if (strlen($ip)) {
         list($range_start, $range_end) = IP::parseRange($ip);
         if ($range_start != $range_end) {
             // They searched for a range. Match that exact range only
             $conds = array('gb_address' => $ip);
         } else {
             // They searched for an IP. Match any range covering that IP
             $hex_ip = IP::toHex($ip);
             $ip_pattern = substr($hex_ip, 0, 4) . '%';
             // Don't bother checking blocks out of this /16.
             $dbr = wfGetDB(DB_SLAVE);
             $conds = array('gb_range_end>=' . $dbr->addQuotes($hex_ip), 'gb_range_start<=' . $dbr->addQuotes($hex_ip), 'gb_range_start like ' . $dbr->addQuotes($ip_pattern), 'gb_expiry>' . $dbr->addQuotes($dbr->timestamp(wfTimestampNow())));
         }
     }
     $pager = new GlobalBlockListPager($this, $conds);
     $body = $pager->getBody();
     if ($body != '') {
         $wgOut->addHTML($pager->getNavigationBar() . Html::rawElement('ul', array(), $body) . $pager->getNavigationBar());
     } else {
         $wgOut->wrapWikiMsg("<div class='mw-globalblocking-noresults'>\n\$1</div>\n", array('globalblocking-list-noresults'));
     }
 }
 public function show($params)
 {
     global $wgOut;
     $wgOut->setPageTitle(wfMsg('deletequeue'));
     $this->loadSearch();
     // Intro text
     $wgOut->addWikiMsg('deletequeue-list-text');
     // Search box
     $searchBox = array();
     // // Queue selector
     $selector = Xml::openElement('select', array('name' => 'queue')) . "\n";
     $queues = array('speedy', 'prod', 'deletediscuss');
     $attribs = array('value' => '');
     if (in_array($this->mQueue, $queues)) {
         $attribs['selected'] = 'selected';
     }
     $selector .= Xml::element('option', $attribs, wfMsg('deletequeue-list-anyqueue'));
     foreach ($queues as $queue) {
         $attribs = array('value' => $queue);
         if ($this->mQueue == $queue) {
             $attribs['selected'] = 'selected';
         }
         $selector .= Xml::element('option', $attribs, wfMsg("deletequeue-queue-{$queue}"));
     }
     $selector .= Xml::closeElement('select');
     $searchBox['deletequeue-list-queue'] = $selector;
     $searchBox['deletequeue-list-status'] = Xml::checkLabel(wfMsg('deletequeue-list-expired'), 'expired', 'mw-dq-expired', $this->mExpired);
     $searchBox = Xml::buildForm($searchBox, 'deletequeue-list-search');
     $searchBox .= Html::Hidden('title', $this->getTitle()->getPrefixedText());
     $searchBox = Xml::tags('form', array('action' => $this->getTitle()->getFullURL(), 'method' => 'get'), $searchBox);
     $searchBox = Xml::fieldset(wfMsg('deletequeue-list-search-legend'), $searchBox);
     $wgOut->addHTML($searchBox);
     $conds = array('dq_active' => 1);
     if ($this->mQueue) {
         $conds['dq_queue'] = $this->mQueue;
     }
     if ($this->mExpired) {
         $dbr = wfGetDB(DB_SLAVE);
         $conds[] = 'dq_expiry<' . $dbr->addQuotes($dbr->timestamp(wfTimestampNow()));
     }
     // Headers
     $body = '';
     $headers = array('page', 'queue', 'votes', 'expiry', 'discusspage');
     foreach ($headers as $header) {
         $body .= Xml::element('th', null, wfMsg("deletequeue-list-header-{$header}")) . "\n";
     }
     $body = Xml::tags('tr', null, $body);
     // The list itself
     $pager = new DeleteQueuePager($conds);
     $body .= $pager->getBody();
     $body = Xml::tags('table', array('class' => 'wikitable'), $body);
     $wgOut->addHTML($pager->getNavigationBar() . $body . $pager->getNavigationBar());
 }
 function searchForm()
 {
     $output = Html::element('legend', null, $this->msg('majorchanges-log-filter')->text());
     $fields = array();
     // Search conditions
     $fields['majorchanges-log-user-filter'] = Html::input('wpUserFilter', $this->mUserFilter);
     $fields['majorchanges-log-title-filter'] = Html::input('wpTitleFilter', $this->mTitleFilter);
     /*
     $fields['majorchanges-log-tag-filter'] =
     	Html::input( 'wpRevTagFilter', $this->mRevTagFilter );
     */
     $fields['majorchanges-log-mode-filter'] = $this->getModeFilter();
     $output .= Xml::tags('form', array('method' => 'get', 'action' => $this->getPageTitle()->getLocalURL()), Xml::buildForm($fields, 'htmlform-submit') . Html::hidden('title', $this->getPageTitle()->getPrefixedDBkey()));
     $output = Xml::tags('fieldset', null, $output);
     $this->getOutput()->addHTML($output);
 }
 function searchForm()
 {
     $output = Xml::element('legend', null, wfMsg('abusefilter-log-search'));
     $fields = array();
     // Search conditions
     $fields['abusefilter-log-search-user'] = Xml::input('wpSearchUser', 45, $this->mSearchUser);
     if (self::canSeeDetails()) {
         $fields['abusefilter-log-search-filter'] = Xml::input('wpSearchFilter', 45, $this->mSearchFilter);
     }
     $fields['abusefilter-log-search-title'] = Xml::input('wpSearchTitle', 45, $this->mSearchTitle);
     $form = Html::hidden('title', $this->getTitle()->getPrefixedText());
     $form .= Xml::buildForm($fields, 'abusefilter-log-search-submit');
     $output .= Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL()), $form);
     $output = Xml::tags('fieldset', null, $output);
     $this->getOutput()->addHTML($output);
 }
 function show()
 {
     $filter = $this->mPage->mFilter;
     global $wgUser, $wgRequest, $wgOut;
     $sk = $wgUser->getSkin();
     if (!$wgUser->isAllowed('abusefilter-revert')) {
         $wgOut->permissionRequired('abusefilter-revert');
         return;
     }
     $this->loadParameters();
     if ($this->attemptRevert()) {
         return;
     }
     $wgOut->addWikiMsg('abusefilter-revert-intro', $filter);
     $wgOut->setPageTitle(wfMsg('abusefilter-revert-title', $filter));
     // First, the search form.
     $searchFields = array();
     $searchFields['abusefilter-revert-filter'] = Xml::element('strong', null, $filter);
     $searchFields['abusefilter-revert-periodstart'] = Xml::input('wpPeriodStart', 45, $this->origPeriodStart);
     $searchFields['abusefilter-revert-periodend'] = Xml::input('wpPeriodEnd', 45, $this->origPeriodEnd);
     $searchForm = Xml::buildForm($searchFields, 'abusefilter-revert-search');
     $searchForm .= "\n" . Xml::hidden('submit', 1);
     $searchForm = Xml::tags('form', array('action' => $this->getTitle("revert/{$filter}")->getLocalURL(), 'method' => 'POST'), $searchForm);
     $searchForm = Xml::fieldset(wfMsg('abusefilter-revert-search-legend'), $searchForm);
     $wgOut->addHTML($searchForm);
     if ($this->mSubmit) {
         // Add a summary of everything that will be reversed.
         $wgOut->addWikiMsg('abusefilter-revert-preview-intro');
         // Look up all of them.
         $results = $this->doLookup();
         $list = array();
         foreach ($results as $result) {
             $displayActions = array();
             global $wgLang;
             $displayActions = array_map(array('AbuseFilter', 'getActionDisplay'), $result['actions']);
             $msg = wfMsgExt('abusefilter-revert-preview-item', array('parseinline', 'replaceafter'), array($wgLang->timeanddate($result['timestamp'], true), $sk->userLink($result['userid'], $result['user']), $result['action'], $sk->link($result['title']), $wgLang->commaList($displayActions), $sk->link(SpecialPage::getTitleFor('AbuseLog'), wfMsgNoTrans('abusefilter-log-detailslink'), array(), array('details' => $result['id']))));
             $list[] = Xml::tags('li', null, $msg);
         }
         $wgOut->addHTML(Xml::tags('ul', null, implode("\n", $list)));
         // Add a button down the bottom.
         $confirmForm = Xml::hidden('editToken', $wgUser->editToken("abusefilter-revert-{$filter}")) . Xml::hidden('title', $this->getTitle("revert/{$filter}")->getPrefixedText()) . Xml::hidden('wpPeriodStart', $this->origPeriodStart) . Xml::hidden('wpPeriodEnd', $this->origPeriodEnd) . Xml::inputLabel(wfMsg('abusefilter-revert-reasonfield'), 'wpReason', 'wpReason', 45) . "\n" . Xml::submitButton(wfMsg('abusefilter-revert-confirm'));
         $confirmForm = Xml::tags('form', array('action' => $this->getTitle("revert/{$filter}")->getLocalURL(), 'method' => 'post'), $confirmForm);
         $wgOut->addHTML($confirmForm);
     }
 }
 /**
  * Process the 'delvote' action.
  * @param Article $article The article to endorse/object to deletion of.
  */
 public function process($article)
 {
     global $wgRequest, $wgOut, $wgUser;
     $errs = $article->mTitle->getUserPermissionsErrors('deletequeue-vote', $wgUser);
     if (count($errs) > 0) {
         $wgOut->showPermissionsErrorPage($errs);
         return;
     }
     $dqi = DeleteQueueItem::newFromArticle($article);
     $wgOut->setPageTitle(wfMsg('deletequeue-vote-title', $article->mTitle->getPrefixedText()));
     // Load form data
     $token = $wgRequest->getVal('wpEditToken');
     $action = $wgRequest->getVal('wpVote');
     $comments = $wgRequest->getText('wpComments');
     if ($wgUser->matchEditToken($token) && in_array($action, array('endorse', 'object'))) {
         $dqi->addVote($action, $comments);
         if ($action == 'object' && $dqi->getQueue() == 'prod') {
             $dbw = wfGetDB(DB_MASTER);
             $dbw->begin();
             $dqi->setQueue('deletediscuss', $dqi->getReason());
             $lp = new LogPage('delete');
             $lp->addEntry('requeue', $article->mTitle, $comments, array(wfMsgForContent('deletequeue-queue-prod'), wfMsgForContent("deletequeue-queue-deletediscuss")));
             $dbw->commit();
             $wgOut->addWikiMsg('deletequeue-vote-requeued', wfMsgNoTrans('deletequeue-queue-deletediscuss'));
         } else {
             $wgOut->addWikiMsg("deletequeue-vote-success-{$action}");
         }
         return;
     }
     $wgOut->addWikiMsg('deletequeue-vote-text', $article->mTitle->getPrefixedText(), $dqi->getReason());
     // Add main form.
     $fields = array();
     $options = Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-endorse'), 'wpVote', 'endorse', 'mw-deletequeue-vote-endorse'));
     $options .= Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-object'), 'wpVote', 'object', 'mw-deletequeue-vote-object'));
     $fields['deletequeue-vote-action'] = $options;
     $fields['deletequeue-vote-reason'] = Xml::input('wpComments', 45, $comments);
     $article_id = $article->getId();
     $title = $this->getTitle("vote/{$article_id}");
     $form = Xml::buildForm($fields, 'deletequeue-vote-submit') . Html::Hidden('wpEditToken', $wgUser->editToken()) . Html::Hidden('title', $title->getPrefixedText());
     $form = Xml::tags('form', array('action' => $title->getLocalURL(), 'method' => 'POST'), $form);
     $form = Xml::fieldset(wfMsg('deletequeue-vote-legend'), $form);
     $wgOut->addHTML($form);
 }
 function showSearch()
 {
     // Add selector
     $selector = '';
     $selectFields = array();
     # Same fields as in Test
     $selectFields['abusefilter-test-user'] = Xml::input('wpSearchUser', 45, $this->mSearchUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpSearchPeriodStart', 45, $this->mSearchPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpSearchPeriodEnd', 45, $this->mSearchPeriodEnd);
     $selector .= Xml::buildForm($selectFields, 'abusefilter-examine-submit');
     $selector .= Html::hidden('submit', 1);
     $selector .= Html::hidden('title', $this->getTitle('examine')->getPrefixedText());
     $selector = Xml::tags('form', array('action' => $this->getTitle('examine')->getLocalURL(), 'method' => 'get'), $selector);
     $selector = Xml::fieldset($this->msg('abusefilter-examine-legend')->text(), $selector);
     $this->getOutput()->addHTML($selector);
     if ($this->mSubmit) {
         $this->showResults();
     }
 }
function wfSpecialRemoveRestrictions()
{
    global $wgOut, $wgRequest, $wgUser, $wgLang;
    $sk = $wgUser->getSkin();
    $title = SpecialPage::getTitleFor('RemoveRestrictions');
    $id = $wgRequest->getVal('id');
    if (!is_numeric($id)) {
        $wgOut->addWikiMsg('removerestrictions-noid');
        return;
    }
    UserRestriction::purgeExpired();
    $r = UserRestriction::newFromId($id, true);
    if (!$r) {
        $wgOut->addWikiMsg('removerestrictions-wrongid');
        return;
    }
    $form = array();
    $form['removerestrictions-user'] = $sk->userLink($r->getSubjectId(), $r->getSubjectText()) . $sk->userToolLinks($r->getSubjectId(), $r->getSubjectText());
    $form['removerestrictions-type'] = UserRestriction::formatType($r->getType());
    if ($r->isPage()) {
        $form['removerestrictions-page'] = $sk->link($r->getPage());
    }
    if ($r->isNamespace()) {
        $form['removerestrictions-namespace'] = $wgLang->getDisplayNsText($r->getNamespace());
    }
    $form['removerestrictions-reason'] = Xml::input('reason');
    $result = null;
    if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('edittoken'))) {
        $result = wfSpecialRemoveRestrictionsProcess($r);
    }
    $wgOut->addWikiMsg('removerestrictions-intro');
    $wgOut->addHTML(Xml::fieldset(wfMsgHtml('removerestrictions-legend')));
    if ($result) {
        $wgOut->addHTML('<strong class="success">' . wfMsgExt('removerestrictions-success', 'parseinline', $r->getSubjectText()) . '</strong>');
    }
    $wgOut->addHTML(Xml::openElement('form', array('action' => $title->getLocalUrl(array('id' => $id)), 'method' => 'post')));
    $wgOut->addHTML(Xml::buildForm($form, 'removerestrictions-submit'));
    $wgOut->addHTML(Xml::hidden('id', $r->getId()));
    $wgOut->addHTML(Xml::hidden('title', $title->getPrefixedDbKey()));
    $wgOut->addHTML(Xml::hidden('edittoken', $wgUser->editToken()));
    $wgOut->addHTML("</form></fieldset>");
}
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     $output = '';
     $output .= Xml::element('h2', null, wfMsgExt('abusefilter-list', array('parseinline')));
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     # Options form
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-show'), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-hide'), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-only'), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel(wfMsg('abusefilter-list-options-hidedisabled'), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset(wfMsg('abusefilter-list-options'), $options);
     $output .= $options;
     $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     $this->getOutput()->addHTML($output);
 }
 function show()
 {
     global $wgRequest, $wgOut, $wgLang, $wgUser;
     $filter = $this->mFilter;
     if ($filter) {
         $wgOut->setPageTitle(wfMsg('abusefilter-history', $filter));
     } else {
         $wgOut->setPageTitle(wfMsg('abusefilter-filter-log'));
     }
     # Check perms
     if ($filter && !$wgUser->isAllowed('abusefilter-modify') && AbuseFilter::filterHidden($filter)) {
         $wgOut->addWikiMsg('abusefilter-history-error-hidden');
         return;
     }
     # Useful links
     $sk = $wgUser->getSkin();
     $links = array();
     if ($filter) {
         $links['abusefilter-history-backedit'] = $this->getTitle($filter);
     }
     foreach ($links as $msg => $title) {
         $links[$msg] = $sk->link($title, wfMsgExt($msg, 'parseinline'));
     }
     $backlinks = $wgLang->pipeList($links);
     $wgOut->addHTML(Xml::tags('p', null, $backlinks));
     # For user
     $user = $wgRequest->getText('user');
     if ($user) {
         $wgOut->setSubtitle(wfMsg('abusefilter-history-foruser', $sk->userLink(1, $user), $user));
     }
     // Add filtering of changes et al.
     $fields['abusefilter-history-select-user'] = Xml::input('user', 45, $user);
     $filterForm = Xml::buildForm($fields, 'abusefilter-history-select-submit');
     $filterForm .= "\n" . Xml::hidden('title', $this->getTitle("history/{$filter}"));
     $filterForm = Xml::tags('form', array('action' => $this->getTitle("history/{$filter}")->getLocalURL(), 'method' => 'get'), $filterForm);
     $filterForm = Xml::fieldset(wfMsg('abusefilter-history-select-legend'), $filterForm);
     $wgOut->addHTML($filterForm);
     $pager = new AbuseFilterHistoryPager($filter, $this, $user);
     $table = $pager->getBody();
     $wgOut->addHTML($pager->getNavigationBar() . $table . $pager->getNavigationBar());
 }
 private function displayNavigation()
 {
     global $wgOut;
     $groupSelector = new XmlSelect('group', 'group-select');
     // pull groups
     $groups = MessageGroups::singleton()->getGroups();
     foreach ($groups as $group) {
         if (!$group->isMeta()) {
             continue;
         }
         $groupSelector->addOption($group->getLabel(), $group->getId());
     }
     $fields = array();
     $fields['transstats-choose-group'] = $groupSelector->getHTML();
     $fields['transstats-breakdown'] = Xml::check('breakdown', false);
     $out = Xml::openElement('form');
     $out .= Xml::buildForm($fields);
     $out .= Xml::submitButton(wfMsg('transstats-submit'));
     $out .= Xml::closeElement('form');
     $wgOut->addHTML($out);
 }
 function show()
 {
     $out = $this->getOutput();
     $filter = $this->mFilter;
     if ($filter) {
         $out->setPageTitle($this->msg('abusefilter-history', $filter));
     } else {
         $out->setPageTitle($this->msg('abusefilter-filter-log'));
     }
     # Check perms
     if ($filter && !$this->getUser()->isAllowed('abusefilter-modify') && AbuseFilter::filterHidden($filter)) {
         $out->addWikiMsg('abusefilter-history-error-hidden');
         return;
     }
     # Useful links
     $links = array();
     if ($filter) {
         $links['abusefilter-history-backedit'] = $this->getTitle($filter);
     }
     foreach ($links as $msg => $title) {
         $links[$msg] = Linker::link($title, $this->msg($msg)->parse());
     }
     $backlinks = $this->getLanguage()->pipeList($links);
     $out->addHTML(Xml::tags('p', null, $backlinks));
     # For user
     $user = User::getCanonicalName($this->getRequest()->getText('user'), 'valid');
     if ($user) {
         $out->addSubtitle($this->msg('abusefilter-history-foruser', Linker::userLink(1, $user), $user)->text());
     }
     // Add filtering of changes et al.
     $fields['abusefilter-history-select-user'] = Xml::input('user', 45, $user);
     $filterForm = Xml::buildForm($fields, 'abusefilter-history-select-submit');
     $filterForm .= "\n" . Html::hidden('title', $this->getTitle("history/{$filter}"));
     $filterForm = Xml::tags('form', array('action' => $this->getTitle("history/{$filter}")->getLocalURL(), 'method' => 'get'), $filterForm);
     $filterForm = Xml::fieldset($this->msg('abusefilter-history-select-legend')->text(), $filterForm);
     $out->addHTML($filterForm);
     $pager = new AbuseFilterHistoryPager($filter, $this, $user);
     $table = $pager->getBody();
     $out->addHTML($pager->getNavigationBar() . $table . $pager->getNavigationBar());
 }
 /**
  * Generate a "deletion nomination" form.
  * @param $article Article object to nominate.
  */
 public function buildForm($article, $queue)
 {
     global $wgOut, $wgScript, $wgUser, $wgRequest;
     // Check for submission
     if ($this->trySubmit($article, $queue)) {
         return;
     }
     $wgOut->setPageTitle(wfMsg("deletequeue-{$queue}-title", $article->mTitle->getPrefixedText()));
     $wgOut->addWikiMsg("deletequeue-{$queue}-text", $article->mTitle->getPrefixedText());
     // Build deletion form.
     $fields = array();
     $fields['deletequeue-delnom-reason'] = Xml::listDropDown('wpReason', DeleteQueueInterface::getReasonList($queue), wfMsg("deletequeue-delnom-otherreason"));
     $fields['deletequeue-delnom-extra'] = Xml::input('wpExtra', 45);
     $article_id = $article->getId();
     $title = $this->getTitle("nominate/{$article_id}/{$queue}");
     $form = Xml::buildForm($fields, "deletequeue-delnom-submit");
     $form .= Html::Hidden('title', $title->getPrefixedText());
     $form .= Html::Hidden('queue', $queue);
     $form .= Html::Hidden('wpEditToken', $wgUser->editToken());
     $form = Xml::tags('form', array('action' => $title->getLocalUrl(), 'method' => 'POST'), $form);
     $wgOut->addHTML($form);
 }
 /**
  * @param $group
  */
 function buildGroupView($group)
 {
     $editable = $this->userCanEdit($this->getUser());
     $subtitleMessage = $editable ? 'centralauth-editgroup-subtitle' : 'centralauth-editgroup-subtitle-readonly';
     $this->getOutput()->setSubtitle($this->msg($subtitleMessage, $group));
     $fieldsetClass = $editable ? 'mw-centralauth-editgroup' : 'mw-centralauth-editgroup-readonly';
     $html = Xml::fieldset($this->msg('centralauth-editgroup-fieldset', $group)->text(), false, array('class' => $fieldsetClass));
     if ($editable) {
         $html .= Xml::openElement('form', array('method' => 'post', 'action' => SpecialPage::getTitleFor('GlobalGroupPermissions', $group)->getLocalUrl(), 'name' => 'centralauth-globalgroups-newgroup'));
         $html .= Html::hidden('wpGroup', $group);
         $html .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
     }
     $fields = array();
     if ($editable) {
         $fields['centralauth-editgroup-name'] = Xml::input('wpGlobalGroupName', 50, $group);
     } else {
         $fields['centralauth-editgroup-name'] = $group;
     }
     if ($this->getUser()->isAllowed('editinterface')) {
         # Show edit link only to user with the editinterface right
         $fields['centralauth-editgroup-display'] = $this->msg('centralauth-editgroup-display-edit', $group, User::getGroupName($group))->parse();
         $fields['centralauth-editgroup-member'] = $this->msg('centralauth-editgroup-member-edit', $group, User::getGroupMember($group))->parse();
     } else {
         $fields['centralauth-editgroup-display'] = User::getGroupName($group);
         $fields['centralauth-editgroup-member'] = User::getGroupMember($group);
     }
     $fields['centralauth-editgroup-members'] = $this->msg('centralauth-editgroup-members-link', $group, User::getGroupMember($group))->parse();
     $fields['centralauth-editgroup-restrictions'] = $this->buildWikiSetSelector($group);
     $fields['centralauth-editgroup-perms'] = $this->buildCheckboxes($group);
     if ($editable) {
         $fields['centralauth-editgroup-reason'] = Xml::input('wpReason', 60);
     }
     $html .= Xml::buildForm($fields, $editable ? 'centralauth-editgroup-submit' : null);
     if ($editable) {
         $html .= Xml::closeElement('form');
     }
     $html .= Xml::closeElement('fieldset');
     $this->getOutput()->addHTML($html);
     $this->showLogFragment($group, $this->getOutput());
 }
 /**
  * @param $subpage
  * @return mixed
  */
 function buildDeleteView($subpage)
 {
     $this->getOutput()->setSubtitle(wfMsgExt('centralauth-editset-subtitle', 'parseinline'));
     $set = WikiSet::newFromID($subpage);
     if (!$set) {
         $this->buildMainView('<strong class="error">' . wfMsgHtml('centralauth-editset-notfound', $subpage) . '</strong>');
         return;
     }
     $legend = wfMsgHtml('centralauth-editset-legend-delete', $set->getName());
     $form = array('centralauth-editset-reason' => Xml::input('wpReason'));
     $url = htmlspecialchars(SpecialPage::getTitleFor('WikiSets', "delete/{$subpage}")->getLocalUrl());
     $edittoken = Html::hidden('wpEditToken', $this->getUser()->getEditToken());
     $this->getOutput()->addHTML("<fieldset><legend>{$legend}</legend><form action='{$url}' method='post'>");
     $this->getOutput()->addHTML(Xml::buildForm($form, 'centralauth-editset-submit-delete'));
     $this->getOutput()->addHTML("<p>{$edittoken}</p></form></fieldset>");
 }
 protected function _executeDelete($wgFarmer)
 {
     global $wgOut, $wgUser, $wgRequest;
     if (!$wgFarmer->getActiveWiki()->isDefaultWiki()) {
         $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-notaccessible', 'farmer-notaccessible-test');
         return;
     }
     if (!MediaWikiFarmer::userIsFarmerAdmin($wgUser)) {
         $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-permissiondenied', 'farmer-permissiondenied-text');
         return;
     }
     if ($wgRequest->wasPosted() && ($wiki = $wgRequest->getVal('wpWiki')) && $wiki != '-1') {
         if ($wgRequest->getCheck('wpConfirm')) {
             $wgOut->wrapWikiMsg('<div class="successbox">$1</div>', array('farmer-deleting', $wiki));
             $log = new LogPage('farmer');
             $log->addEntry('delete', $this->getTitle(), $wgRequest->getVal('wpReason'), array($wiki));
             $deleteWiki = MediaWikiFarmer_Wiki::factory($wiki);
             $deleteWiki->deleteWiki();
         } else {
             $wgOut->addWikiMsg('farmer-delete-confirm-wiki', $wiki);
             $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'name' => 'deleteWiki')) . "\n" . Xml::buildForm(array('farmer-delete-reason' => Xml::input('wpReason', false, $wgRequest->getVal('wpReason')), 'farmer-delete-confirm' => Xml::check('wpConfirm')), 'farmer-delete-form-submit') . "\n" . Html::Hidden('wpWiki', $wiki) . "\n" . Xml::closeElement('form'));
         }
         return;
     }
     $list = $wgFarmer->getFarmList();
     $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-delete-title', 'farmer-delete-text');
     $select = new XmlSelect('wpWiki', false, $wgRequest->getVal('wpWiki'));
     $select->addOption(wfMsg('farmer-delete-form'), '-1');
     foreach ($list as $wiki) {
         if ($wiki['name'] != $wgFarmer->getDefaultWiki()) {
             $name = $wiki['name'];
             $title = $wiki['title'];
             $select->addOption("{$name} - {$title}", $name);
         }
     }
     $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'name' => 'deleteWiki')) . "\n" . $select->getHTML() . "\n" . Xml::submitButton(wfMsg('farmer-delete-form-submit')) . "\n" . Xml::closeElement('form'));
 }
	function getForm() {
		global $wgScript, $wgMiserMode;
		$inputForm = array();
		$inputForm['table_pager_limit_label'] = $this->getLimitSelect( array( 'tabindex' => 1 ) );
		if ( !$wgMiserMode ) {
			$inputForm['listfiles_search_for'] = Html::input(
				'ilsearch',
				$this->mSearch,
				'text',
				array(
					'size' => '40',
					'maxlength' => '255',
					'id' => 'mw-ilsearch',
					'tabindex' => 2,
				)
			);
		}
		$inputForm['username'] = Html::input( 'user', $this->mUserName, 'text', array(
			'size' => '40',
			'maxlength' => '255',
			'id' => 'mw-listfiles-user',
			'tabindex' => 3,
		) );

		$inputForm['listfiles-show-all'] = Html::input( 'ilshowall', 1, 'checkbox', array(
			'checked' => $this->mShowAll,
			'tabindex' => 4,
		) );
		return Html::openElement( 'form',
			array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' )
		) .
			Xml::fieldset( $this->msg( 'listfiles' )->text() ) .
			Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
			Xml::buildForm( $inputForm, 'table_pager_limit_submit', array( 'tabindex' => 5 ) ) .
			$this->getHiddenFields( array( 'limit', 'ilsearch', 'user', 'title', 'ilshowall' ) ) .
			Html::closeElement( 'fieldset' ) .
			Html::closeElement( 'form' ) . "\n";
	}
 /**
  * Show the Lock and/or Hide form, appropriate for this admin user's rights.
  * The <form> and <fieldset> were started in showTableHeader()
  */
 private function showStatusForm()
 {
     $form = '';
     $radioLocked = Xml::radioLabel($this->msg('centralauth-admin-action-lock-nochange')->parse(), 'wpActionLock', 'nochange', 'mw-centralauth-status-locked-no', true) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-lock-unlock')->parse(), 'wpActionLock', 'unlock', 'centralauth-admin-action-lock-unlock', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-lock-lock')->parse(), 'wpActionLock', 'lock', 'centralauth-admin-action-lock-lock', false);
     $radioHidden = Xml::radioLabel($this->msg('centralauth-admin-action-hide-nochange')->parse(), 'wpActionHide', 'nochange', 'mw-centralauth-status-hidden-nochange', true) . '<br />';
     if ($this->mCanOversight) {
         $radioHidden .= Xml::radioLabel($this->msg('centralauth-admin-action-hide-none')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-hide-lists')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-hide-oversight')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', false);
     }
     $reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text());
     $reasonField = Xml::input('wpReason', 45, false);
     $botField = Xml::check('markasbot') . $this->msg('centralauth-admin-multi-botcheck');
     $form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField, 'centralauth-admin-multi-bot' => $botField), 'centralauth-admin-status-submit');
     $searchlist = $this->mUserNames;
     if (is_array($this->mUserNames)) {
         $searchlist = implode("\n", $this->mUserNames);
     }
     $form .= Html::hidden('wpTarget', $searchlist);
     $form .= '</fieldset></form>';
     $this->getOutput()->addHTML($form);
 }
 function getForm()
 {
     global $wgScript, $wgMiserMode;
     $inputForm = array();
     $inputForm['table_pager_limit_label'] = $this->getLimitSelect();
     if (!$wgMiserMode) {
         $inputForm['listfiles_search_for'] = Html::input('ilsearch', $this->mSearch, 'text', array('size' => '40', 'maxlength' => '255', 'id' => 'mw-ilsearch'));
     }
     $inputForm['username'] = Html::input('user', $this->mUserName, 'text', array('size' => '40', 'maxlength' => '255', 'id' => 'mw-listfiles-user'));
     return Html::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form')) . Xml::fieldset(wfMsg('listfiles')) . Xml::buildForm($inputForm, 'table_pager_limit_submit') . $this->getHiddenFields(array('limit', 'ilsearch', 'user')) . Html::closeElement('fieldset') . Html::closeElement('form') . "\n";
 }
 function buildConsequenceSelector($action, $set, $parameters)
 {
     global $wgAbuseFilterAvailableActions;
     if (!in_array($action, $wgAbuseFilterAvailableActions)) {
         return;
     }
     $readOnlyAttrib = array();
     $cbReadOnlyAttrib = array();
     // For checkboxes
     if (!$this->canEdit()) {
         $readOnlyAttrib['readonly'] = 'readonly';
         $cbReadOnlyAttrib['disabled'] = 'disabled';
     }
     switch ($action) {
         case 'throttle':
             $throttleSettings = Xml::checkLabel(wfMsg('abusefilter-edit-action-throttle'), 'wpFilterActionThrottle', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $throttleFields = array();
             if ($set) {
                 array_shift($parameters);
                 $throttleRate = explode(',', $parameters[0]);
                 $throttleCount = $throttleRate[0];
                 $throttlePeriod = $throttleRate[1];
                 $throttleGroups = implode("\n", array_slice($parameters, 1));
             } else {
                 $throttleCount = 3;
                 $throttlePeriod = 60;
                 $throttleGroups = "user\n";
             }
             $throttleFields['abusefilter-edit-throttle-count'] = Xml::input('wpFilterThrottleCount', 20, $throttleCount, $readOnlyAttrib);
             $throttleFields['abusefilter-edit-throttle-period'] = wfMsgExt('abusefilter-edit-throttle-seconds', array('parseinline', 'replaceafter'), array(Xml::input('wpFilterThrottlePeriod', 20, $throttlePeriod, $readOnlyAttrib)));
             $throttleFields['abusefilter-edit-throttle-groups'] = Xml::textarea('wpFilterThrottleGroups', $throttleGroups . "\n", 40, 5, $readOnlyAttrib);
             $throttleSettings .= Xml::tags('div', array('id' => 'mw-abusefilter-throttle-parameters'), Xml::buildForm($throttleFields));
             return $throttleSettings;
         case 'flag':
             $checkbox = Xml::checkLabel(wfMsg('abusefilter-edit-action-flag'), 'wpFilterActionFlag', "mw-abusefilter-action-checkbox-{$action}", true, array('disabled' => '1', 'class' => 'mw-abusefilter-action-checkbox'));
             return Xml::tags('p', null, $checkbox);
         case 'warn':
             $output = '';
             $checkbox = Xml::checkLabel(wfMsg('abusefilter-edit-action-warn'), 'wpFilterActionWarn', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $output .= Xml::tags('p', null, $checkbox);
             $warnMsg = empty($set) ? 'abusefilter-warning' : $parameters[0];
             $warnFields['abusefilter-edit-warn-message'] = $this->getExistingSelector($warnMsg);
             $warnFields['abusefilter-edit-warn-other-label'] = Xml::input('wpFilterWarnMessageOther', 45, $warnMsg ? $warnMsg : 'abusefilter-warning-', array('id' => 'mw-abusefilter-warn-message-other') + $cbReadOnlyAttrib);
             $previewButton = Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-warn-preview-button', 'value' => wfMsg('abusefilter-edit-warn-preview')));
             $editButton = Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-warn-edit-button', 'value' => wfMsg('abusefilter-edit-warn-edit')));
             $previewHolder = Xml::element('div', array('id' => 'mw-abusefilter-warn-preview'), '');
             $warnFields['abusefilter-edit-warn-actions'] = Xml::tags('p', null, "{$previewButton} {$editButton}") . "\n{$previewHolder}";
             $output .= Xml::tags('div', array('id' => 'mw-abusefilter-warn-parameters'), Xml::buildForm($warnFields));
             return $output;
         case 'tag':
             if ($set) {
                 $tags = $parameters;
             } else {
                 $tags = array();
             }
             $output = '';
             $checkbox = Xml::checkLabel(wfMsg('abusefilter-edit-action-tag'), 'wpFilterActionTag', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $output .= Xml::tags('p', null, $checkbox);
             $tagFields['abusefilter-edit-tag-tag'] = Xml::textarea('wpFilterTags', implode("\n", $tags), 40, 5, $readOnlyAttrib);
             $output .= Xml::tags('div', array('id' => 'mw-abusefilter-tag-parameters'), Xml::buildForm($tagFields));
             return $output;
         default:
             $message = 'abusefilter-edit-action-' . $action;
             $form_field = 'wpFilterAction' . ucfirst($action);
             $status = $set;
             $thisAction = Xml::checkLabel(wfMsg($message), $form_field, "mw-abusefilter-action-checkbox-{$action}", $status, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $thisAction = Xml::tags('p', null, $thisAction);
             return $thisAction;
     }
 }
Exemple #24
0
function wfBuildForm($fields, $submitLabel)
{
    wfDeprecated(__FUNCTION__);
    return Xml::buildForm($fields, $submitLabel);
}
 private function showStatusForm()
 {
     // Allows locking, hiding, locking and hiding.
     $form = '';
     $form .= Xml::fieldset($this->msg('centralauth-admin-status')->text());
     $form .= Html::hidden('wpMethod', 'set-status');
     $form .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
     $form .= Html::hidden('wpUserState', $this->mGlobalUser->getStateHash(false));
     $form .= $this->msg('centralauth-admin-status-intro')->parseAsBlock();
     // Radio buttons
     $radioLocked = Xml::radioLabel($this->msg('centralauth-admin-status-locked-no')->parse(), 'wpStatusLocked', '0', 'mw-centralauth-status-locked-no', !$this->mGlobalUser->isLocked()) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-locked-yes')->parse(), 'wpStatusLocked', '1', 'mw-centralauth-status-locked-yes', $this->mGlobalUser->isLocked());
     $radioHidden = Xml::radioLabel($this->msg('centralauth-admin-status-hidden-no')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_NONE);
     if ($this->mCanOversight) {
         $radioHidden .= '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-list')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_LISTS) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-oversight')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_OVERSIGHT);
     }
     // Reason
     $reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text());
     $reasonField = Xml::input('wpReason', 45, false);
     $form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField), 'centralauth-admin-status-submit');
     $form .= Xml::closeElement('fieldset');
     $form = Xml::tags('form', array('method' => 'POST', 'action' => $this->getPageTitle()->getFullURL(array('target' => $this->mUserName))), $form);
     $this->getOutput()->addHTML($form);
 }
 function form($error)
 {
     global $wgUser, $wgOut;
     $wgOut->addWikiMsg('globalblocking-whitelist-intro');
     $wgOut->addHTML($error);
     $form = '';
     $form .= Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('globalblocking-whitelist-legend'));
     $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getFullURL(), 'name' => 'globalblock-whitelist'));
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $form .= Html::hidden('action', 'whitelist');
     $fields = array();
     // uses ipaddress msg
     $fields['globalblocking-ipaddress'] = Xml::input('address', 45, $this->mAddress);
     $fields['globalblocking-whitelist-reason'] = Xml::input('wpReason', 45, $this->mReason);
     $fields['globalblocking-whitelist-status'] = Xml::checkLabel(wfMsgExt('globalblocking-whitelist-statuslabel', 'parsemag'), 'wpWhitelistStatus', 'wpWhitelistStatus', $this->mCurrentStatus);
     $form .= Xml::buildForm($fields, 'globalblocking-whitelist-submit');
     $form .= Html::hidden('wpEditToken', $wgUser->editToken());
     $form .= Xml::closeElement('form');
     $form .= Xml::closeElement('fieldset');
     $wgOut->addHTML($form);
 }
 function searchForm()
 {
     global $wgAbuseFilterIsCentral;
     $output = Xml::element('legend', null, $this->msg('abusefilter-log-search')->text());
     $fields = array();
     // Search conditions
     $fields['abusefilter-log-search-user'] = Xml::input('wpSearchUser', 45, $this->mSearchUser);
     if (self::canSeeDetails()) {
         $fields['abusefilter-log-search-filter'] = Xml::input('wpSearchFilter', 45, $this->mSearchFilter);
     }
     $fields['abusefilter-log-search-title'] = Xml::input('wpSearchTitle', 45, $this->mSearchTitle);
     if ($wgAbuseFilterIsCentral) {
         // Add free form input for wiki name. Would be nice to generate
         // a select with unique names in the db at some point.
         $fields['abusefilter-log-search-wiki'] = Xml::input('wpSearchWiki', 45, $this->mSearchWiki);
     }
     $output .= Xml::tags('form', array('method' => 'get', 'action' => $this->getPageTitle()->getLocalURL()), Xml::buildForm($fields, 'abusefilter-log-search-submit'));
     $output = Xml::tags('fieldset', null, $output);
     $this->getOutput()->addHTML($output);
 }
 protected function reopenForm()
 {
     global $wgOut, $wgUser, $wgRequest;
     $status = '';
     $statusOK = false;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wprEdittoken'))) {
         global $wgLocalDatabases;
         $wiki = $wgRequest->getVal('wprWiki');
         $lreason = $wgRequest->getVal('wprReason');
         if (!in_array($wiki, $wgLocalDatabases)) {
             $status = wfMsgExt('closewikis-page-err-nowiki', 'parseinline');
         } else {
             $statusOK = CloseWikis::reopen($wiki);
             if ($statusOK) {
                 $status = wfMsgExt('closewikis-page-reopen-success', 'parseinline');
                 $logpage = new LogPage('closewiki');
                 $logpage->addEntry('reopen', $this->getTitle(), $lreason, array($wiki));
             } else {
                 $status = wfMsgExt('closewikis-page-err-opened', 'parseinline');
             }
         }
     }
     $legend = wfMsgHtml('closewikis-page-reopen');
     // If operation was successful, empty all fields
     $defaultWiki = $statusOK ? '' : $wgRequest->getVal('wprWiki');
     $defaultReason = $statusOK ? '' : $wgRequest->getVal('wprReason');
     $wgOut->addHTML("<fieldset><legend>{$legend}</legend>");
     if ($status) {
         $statusStyle = $statusOK ? 'success' : 'error';
         $wgOut->addHTML("<p><strong class=\"{$statusStyle}\">{$status}</strong></p>");
     }
     $wgOut->addHTML('<form method="post" action="' . htmlspecialchars($this->getTitle()->getLocalURL()) . '">');
     $form = array();
     $form['closewikis-page-reopen-wiki'] = $this->buildSelect(CloseWikis::getList(), 'wprWiki', $defaultWiki);
     $form['closewikis-page-reopen-reason'] = Xml::input('wprReason', false, $defaultReason);
     $wgOut->addHTML(Xml::buildForm($form, 'closewikis-page-reopen-submit'));
     $wgOut->addHTML(Html::hidden('wprEdittoken', $wgUser->editToken()));
     $wgOut->addHTML("</form></fieldset>");
 }
 /**
  * @param $action string The action to build an editor for
  * @param $set bool Whether or not the action is activated
  * @param $parameters array Action parameters
  * @param $row stdClass abuse_filter row object
  * @return string
  */
 function buildConsequenceSelector($action, $set, $parameters, $row)
 {
     global $wgAbuseFilterAvailableActions, $wgMainCacheType;
     if (!in_array($action, $wgAbuseFilterAvailableActions)) {
         return '';
     }
     $readOnlyAttrib = array();
     $cbReadOnlyAttrib = array();
     // For checkboxes
     if (!$this->canEditFilter($row)) {
         $readOnlyAttrib['readonly'] = 'readonly';
         $cbReadOnlyAttrib['disabled'] = 'disabled';
     }
     switch ($action) {
         case 'throttle':
             // Throttling is only available via object caching
             if ($wgMainCacheType === CACHE_NONE) {
                 return '';
             }
             $throttleSettings = Xml::checkLabel($this->msg('abusefilter-edit-action-throttle')->text(), 'wpFilterActionThrottle', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $throttleFields = array();
             if ($set) {
                 array_shift($parameters);
                 $throttleRate = explode(',', $parameters[0]);
                 $throttleCount = $throttleRate[0];
                 $throttlePeriod = $throttleRate[1];
                 $throttleGroups = implode("\n", array_slice($parameters, 1));
             } else {
                 $throttleCount = 3;
                 $throttlePeriod = 60;
                 $throttleGroups = "user\n";
             }
             $throttleFields['abusefilter-edit-throttle-count'] = Xml::input('wpFilterThrottleCount', 20, $throttleCount, $readOnlyAttrib);
             $throttleFields['abusefilter-edit-throttle-period'] = $this->msg('abusefilter-edit-throttle-seconds')->rawParams(Xml::input('wpFilterThrottlePeriod', 20, $throttlePeriod, $readOnlyAttrib))->parse();
             $throttleFields['abusefilter-edit-throttle-groups'] = Xml::textarea('wpFilterThrottleGroups', $throttleGroups . "\n", 40, 5, $readOnlyAttrib);
             $throttleSettings .= Xml::tags('div', array('id' => 'mw-abusefilter-throttle-parameters'), Xml::buildForm($throttleFields));
             return $throttleSettings;
         case 'flag':
             $checkbox = Xml::checkLabel($this->msg('abusefilter-edit-action-flag')->text(), 'wpFilterActionFlag', "mw-abusefilter-action-checkbox-{$action}", true, array('disabled' => '1', 'class' => 'mw-abusefilter-action-checkbox'));
             return Xml::tags('p', null, $checkbox);
         case 'warn':
             global $wgAbuseFilterDefaultWarningMessage;
             $output = '';
             $checkbox = Xml::checkLabel($this->msg('abusefilter-edit-action-warn')->text(), 'wpFilterActionWarn', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $output .= Xml::tags('p', null, $checkbox);
             if ($set) {
                 $warnMsg = $parameters[0];
             } elseif ($row && isset($row->af_group) && $row->af_group && isset($wgAbuseFilterDefaultWarningMessage[$row->af_group])) {
                 $warnMsg = $wgAbuseFilterDefaultWarningMessage[$row->af_group];
             } else {
                 $warnMsg = 'abusefilter-warning';
             }
             $warnFields['abusefilter-edit-warn-message'] = $this->getExistingSelector($warnMsg);
             $warnFields['abusefilter-edit-warn-other-label'] = Xml::input('wpFilterWarnMessageOther', 45, $warnMsg ? $warnMsg : 'abusefilter-warning-', array('id' => 'mw-abusefilter-warn-message-other') + $cbReadOnlyAttrib);
             $previewButton = Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-warn-preview-button', 'value' => $this->msg('abusefilter-edit-warn-preview')->text()));
             $editButton = Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-warn-edit-button', 'value' => $this->msg('abusefilter-edit-warn-edit')->text()));
             $previewHolder = Xml::element('div', array('id' => 'mw-abusefilter-warn-preview'), '');
             $warnFields['abusefilter-edit-warn-actions'] = Xml::tags('p', null, "{$previewButton} {$editButton}") . "\n{$previewHolder}";
             $output .= Xml::tags('div', array('id' => 'mw-abusefilter-warn-parameters'), Xml::buildForm($warnFields));
             return $output;
         case 'tag':
             if ($set) {
                 $tags = $parameters;
             } else {
                 $tags = array();
             }
             $output = '';
             $checkbox = Xml::checkLabel($this->msg('abusefilter-edit-action-tag')->text(), 'wpFilterActionTag', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $output .= Xml::tags('p', null, $checkbox);
             $tagFields['abusefilter-edit-tag-tag'] = Xml::textarea('wpFilterTags', implode("\n", $tags), 40, 5, $readOnlyAttrib);
             $output .= Xml::tags('div', array('id' => 'mw-abusefilter-tag-parameters'), Xml::buildForm($tagFields));
             return $output;
         default:
             // Give grep a chance to find the usages:
             // abusefilter-edit-action-warn, abusefilter-edit-action-disallow
             // abusefilter-edit-action-flag, abusefilter-edit-action-blockautopromote
             // abusefilter-edit-action-degroup, abusefilter-edit-action-block
             // abusefilter-edit-action-throttle, abusefilter-edit-action-rangeblock
             // abusefilter-edit-action-tag
             $message = 'abusefilter-edit-action-' . $action;
             $form_field = 'wpFilterAction' . ucfirst($action);
             $status = $set;
             $thisAction = Xml::checkLabel($this->msg($message)->text(), $form_field, "mw-abusefilter-action-checkbox-{$action}", $status, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
             $thisAction = Xml::tags('p', null, $thisAction);
             return $thisAction;
     }
 }
 function execute()
 {
     global $wgOut, $wgRequest, $wgUser;
     $repoExists = (bool) $this->repo;
     $repoPath = $wgRequest->getVal('wpRepoPath', $repoExists ? $this->repo->getPath() : '');
     $bugPath = $wgRequest->getVal('wpBugPath', $repoExists ? $this->repo->getBugzillaBase() : '');
     $viewPath = $wgRequest->getVal('wpViewPath', $repoExists ? $this->repo->getViewVcBase() : '');
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'), $this->repoName)) {
         // @todo log
         $dbw = wfGetDB(DB_MASTER);
         if ($repoExists) {
             $dbw->update('code_repo', array('repo_path' => $repoPath, 'repo_viewvc' => $viewPath, 'repo_bugzilla' => $bugPath), array('repo_id' => $this->repo->getId()), __METHOD__);
         } else {
             $dbw->insert('code_repo', array('repo_name' => $this->repoName, 'repo_path' => $repoPath, 'repo_viewvc' => $viewPath, 'repo_bugzilla' => $bugPath), __METHOD__);
         }
         $wgOut->wrapWikiMsg('<div class="successbox">$1</div>', array('repoadmin-edit-sucess', $this->repoName));
         return;
     }
     $wgOut->addHTML(Xml::fieldset(wfMsg('repoadmin-edit-legend', $this->repoName)) . Xml::openElement('form', array('method' => 'post', 'action' => $this->title->getLocalURL())) . Xml::buildForm(array('repoadmin-edit-path' => Xml::input('wpRepoPath', 60, $repoPath, array('dir' => 'ltr')), 'repoadmin-edit-bug' => Xml::input('wpBugPath', 60, $bugPath, array('dir' => 'ltr')), 'repoadmin-edit-view' => Xml::input('wpViewPath', 60, $viewPath, array('dir' => 'ltr')))) . Html::hidden('wpEditToken', $wgUser->editToken($this->repoName)) . Xml::submitButton(wfMsg('repoadmin-edit-button')) . '</form></fieldset>');
 }