function showForm($err = '')
 {
     global $wgOut, $wgUser, $wgLang;
     $wgOut->setPagetitle(wfMsg("makesysoptitle"));
     $wgOut->addWikiText(wfMsg("makesysoptext"));
     $titleObj = Title::makeTitle(NS_SPECIAL, "Makesysop");
     $action = $titleObj->getLocalUrl("action=submit");
     if ($wgUser->isAllowed('userrights')) {
         $wgOut->addWikiText(wfMsg('makesysop-see-userrights'));
     }
     if ("" != $err) {
         $wgOut->setSubtitle(wfMsg("formerror"));
         $wgOut->addHTML("<p class='error'>{$err}</p>\n");
     }
     $namedesc = wfMsg("makesysopname");
     if (!is_null($this->mUser)) {
         $encUser = htmlspecialchars($this->mUser);
     } else {
         $encUser = "";
     }
     $reason = htmlspecialchars(wfMsg("userrights-reason"));
     $makebureaucrat = wfMsg("setbureaucratflag");
     $mss = wfMsg("set_user_rights");
     $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'makesysop')) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('makesysoptitle')) . "<table border='0'>\n\t\t\t<tr>\n\t\t\t\t<td align='right'>{$namedesc}</td>\n\t\t\t\t<td align='left'>" . Xml::input('wpMakesysopUser', 40, $encUser) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td align='right'>{$reason}</td>\n\t\t\t\t<td align='left'>" . Xml::input('wpMakesysopReason', 40, $this->mReason, array('maxlength' => 255)) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td align='left'>" . Xml::checkLabel($makebureaucrat, 'wpSetBureaucrat', 'wpSetBureaucrat', $this->mSetBureaucrat) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td align='left'>" . Xml::submitButton($mss, array('name' => 'wpMakesysopSubmit')) . "</td>\n\t\t\t</tr>\n\t\t\t</table>" . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
 public function execute($par)
 {
     global $wgCooperationStatsGoogleCharts, $wgOut;
     $nb_of_revuser = wfMsg('cooperationstatistics-limit-few-revisors');
     $nbpages = $this->getNbOfPages($nb_of_revuser, '<=');
     if (!$this->mIncluding) {
         $this->OutputTableRaw($nbpages, $nb_of_revuser, 'init');
     }
     $retval = array();
     $retval[$nb_of_revuser] = $this->getNbOfPages($nb_of_revuser, '=');
     $nb_of_revuser++;
     $range = 1 + wfMsg('cooperationstatistics-limit-many-revisors') - $nb_of_revuser;
     for ($j = 0; $j < $range; $j++) {
         $nbpages = $this->getNbOfPages($nb_of_revuser, '=');
         if (!$this->mIncluding) {
             $this->OutputTableRaw($nbpages, $nb_of_revuser, '=');
         }
         $retval[$nb_of_revuser] = $nbpages;
         $nb_of_revuser++;
     }
     $nbpages = $this->getNbOfPages($nb_of_revuser, '>=');
     if (!$this->mIncluding) {
         $this->OutputTableRaw($nbpages, $nb_of_revuser, 'end');
     }
     $retval[$nb_of_revuser] = $nbpages;
     if ($wgCooperationStatsGoogleCharts == True) {
         $wgOut->addHTML(Xml::element('img', array('src' => $this->getGoogleChartBarParams($retval))) . Xml::element('img', array('src' => $this->getGoogleChartParams($retval))));
     }
 }
示例#3
0
 /**
  * Format a table cell. The return value should be HTML, but use an empty
  * string not &#160; for empty cells. Do not include the <td> and </td>.
  *
  * The current result row is available as $this->mCurrentRow, in case you
  * need more context.
  *
  * @param $name String: the database field name
  * @param $value String: the value retrieved from the database
  */
 function formatValue($name, $value)
 {
     global $wgLang;
     switch ($name) {
         case 'wpp_name':
             return SpecialSubscriptions::getLinkNew($value, 'wpp-' . $value);
         case 'wpp_period_months':
             return wfMessage('wp-period', $value);
         case 'wpp_nb_wikiplaces':
         case 'wpp_nb_wikiplace_pages':
             return wfFormatNumber($value);
         case 'wpp_monthly_bandwidth':
         case 'wpp_diskspace':
             return wfFormatSizeMB($value);
         case 'wpp_price':
             $cur = ' ' . $this->mCurrentRow->wpp_currency;
             if ($cur == ' EUR') {
                 $cur = ' ' . wfMessage('cur-euro')->text();
             }
             $cur = Xml::element('span', array('class' => 'currency'), $cur);
             return $wgLang->formatNum($value) . $cur;
         case 'wpp_end_date':
             return $wgLang->date($value, true);
         case 'hard_quotas':
             return $this->formatHardQuotas();
         case 'monthly_quotas':
             return $this->formatMonthlyQuotas();
         default:
             return htmlspecialchars($value);
     }
 }
 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 show()
 {
     global $wgOut, $wgUser;
     // Header
     $wgOut->setSubTitle(wfMsg('abusefilter-tools-subtitle'));
     $wgOut->addWikiMsg('abusefilter-tools-text');
     // Expression evaluator
     $eval = '';
     $eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
     // Only let users with permission actually test it
     if ($wgUser->isAllowed('abusefilter-modify')) {
         $eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'onclick' => 'doExprSubmit();', 'value' => wfMsg('abusefilter-tools-submitexpr'))));
         $eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
     }
     $eval = Xml::fieldset(wfMsg('abusefilter-tools-expr'), $eval);
     $wgOut->addHTML($eval);
     // Associated script
     $exprScript = file_get_contents(dirname(__FILE__) . '/tools.js');
     $wgOut->addInlineScript($exprScript);
     global $wgUser;
     if ($wgUser->isAllowed('abusefilter-modify')) {
         // Hacky little box to re-enable autoconfirmed if it got disabled
         $rac = '';
         $rac .= Xml::inputLabel(wfMsg('abusefilter-tools-reautoconfirm-user'), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
         $rac .= '&#160;';
         $rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'onclick' => 'doReautoSubmit();', 'value' => wfMsg('abusefilter-tools-reautoconfirm-submit')));
         $rac = Xml::fieldset(wfMsg('abusefilter-tools-reautoconfirm'), $rac);
         $wgOut->addHTML($rac);
     }
 }
 function deleteForm($query, $reason)
 {
     $title = $this->getTitle();
     $output = $this->getOutput();
     $pages = $this->getPages($query);
     $count = count($pages);
     if ($count == 0) {
         $output->addWikiText($this->msg('nukedpl-nopages', $query)->text());
         return $this->queryForm();
     }
     $output->addWikiText($this->msg('nukedpl-list', $count, $query)->text());
     $output->addHTML(Xml::element('form', array('action' => $title->getLocalURL('action=delete'), 'method' => 'post'), null));
     $output->addHTML(Xml::element('input', array('type' => 'submit', 'value' => $this->msg('nukedpl-nuke')->text())));
     $output->addHTML('<div>' . $this->msg('deletecomment')->escaped() . '</div>');
     $output->addHTML(Xml::element('input', array('name' => 'reason', 'value' => $reason, 'size' => 60)));
     $output->addHTML('<ol>');
     foreach ($pages as $page) {
         $page = Title::newFromText($page);
         if ($page and $page->isKnown()) {
             $output->addHTML('<li>');
             $output->addHTML(Xml::element('input', array('type' => 'checkbox', 'name' => 'ids[]', 'value' => $page->getArticleID(), 'checked' => 'checked')));
             $output->addHTML(Linker::makeKnownLinkObj($page));
             $output->addHTML('</li>');
         }
     }
     $output->addHTML('</ol>');
     $output->addHTML(Xml::element('input', array('type' => 'submit', 'value' => $this->msg('nukedpl-nuke')->text())));
     $output->addHTML('</form>');
 }
示例#7
0
 function doTagRow($tag, $hitcount)
 {
     static $sk = null, $doneTags = array();
     if (!$sk) {
         global $wgUser;
         $sk = $wgUser->getSkin();
     }
     if (in_array($tag, $doneTags)) {
         return '';
     }
     $newRow = '';
     $newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
     $disp = ChangeTags::tagDescription($tag);
     $disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsg('tags-edit')) . ')';
     $newRow .= Xml::tags('td', null, $disp);
     $desc = wfMsgExt("tag-{$tag}-description", 'parseinline');
     $desc = wfEmptyMsg("tag-{$tag}-description", $desc) ? '' : $desc;
     $desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsg('tags-edit')) . ')';
     $newRow .= Xml::tags('td', null, $desc);
     $hitcount = wfMsg('tags-hitcount', $hitcount);
     $hitcount = $sk->link(SpecialPage::getTitleFor('RecentChanges'), $hitcount, array(), array('tagfilter' => $tag));
     $newRow .= Xml::tags('td', null, $hitcount);
     $doneTags[] = $tag;
     return Xml::tags('tr', null, $newRow) . "\n";
 }
 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);
 }
示例#9
0
 function doTagRow($tag, $hitcount)
 {
     static $doneTags = array();
     if (in_array($tag, $doneTags)) {
         return '';
     }
     $newRow = '';
     $newRow .= Xml::tags('td', null, Xml::element('code', null, $tag));
     $disp = ChangeTags::tagDescription($tag);
     $disp .= ' ';
     $editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped());
     $disp .= $this->msg('parentheses')->rawParams($editLink)->escaped();
     $newRow .= Xml::tags('td', null, $disp);
     $msg = $this->msg("tag-{$tag}-description");
     $desc = !$msg->exists() ? '' : $msg->parse();
     $desc .= ' ';
     $editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped());
     $desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped();
     $newRow .= Xml::tags('td', null, $desc);
     $hitcount = $this->msg('tags-hitcount')->numParams($hitcount)->escaped();
     $hitcount = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
     $newRow .= Xml::tags('td', null, $hitcount);
     $doneTags[] = $tag;
     return Xml::tags('tr', null, $newRow) . "\n";
 }
	/**
	 * @param  $resourcename
	 * @param  $error
	 * @param  $alldata
	 * @return bool|string
	 */
	function validateDomain( $resourcename, $alldata ) {
		if ( ! preg_match( "/^[a-z\*][a-z0-9\-]*$/", $resourcename ) ) {
			return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badresourcename' ) );
		} else {
			return true;
		}
	}
示例#11
0
 public function execute($subpage)
 {
     global $wgOut, $wgRequest, $wgUser, $wgCacheEpoch, $wgCityId;
     wfProfileIn(__METHOD__);
     $this->setHeaders();
     $this->mTitle = SpecialPage::getTitleFor('UserData');
     if ($this->isRestricted() && !$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     $result = '';
     $userId = $wgRequest->getInt('userId');
     if ($userId) {
         $user = User::newFromId($userId);
         if (!empty($user)) {
             //todo: add nicer result - right now only name and link to user page
             $result = Xml::element('a', array('href' => $user->getUserPage()->getLocalURL()), $user->getName(), false);
         }
     }
     $wgOut->addHTML(Xml::openElement('form', array('action' => $this->mTitle->getFullURL(), 'method' => 'get')));
     $wgOut->addHTML(Xml::inputLabel(wfMsg('userdata-userid-label'), 'userId', 'user-id', false, $userId));
     $wgOut->addHTML('<br>' . Xml::submitButton(wfMsg('userdata-submit')));
     $wgOut->addHTML(Xml::closeElement('form'));
     if ($result) {
         $wgOut->addHTML('<hr>' . $result);
     }
     wfProfileOut(__METHOD__);
 }
 /**
  * Modify personal URLs list
  */
 private function setupPersonalUrls()
 {
     global $wgUser;
     // Import the starting set of urls from the skin template
     $this->personal_urls = F::app()->getSkinTemplateObj()->data['personal_urls'];
     if ($wgUser->isAnon()) {
         // add login and register links for anons
         //$skin = RequestContext::getMain()->getSkin();
         // where to redirect after login
         $query = F::app()->wg->Request->getValues();
         if (isset($query['title'])) {
             if (!self::isBlacklisted($query['title'])) {
                 $returnto = $query['title'];
             } else {
                 $returnto = Title::newMainPage()->getPartialURL();
             }
         } else {
             $returnto = Title::newMainPage()->getPartialURL();
         }
         $returnto = wfGetReturntoParam($returnto);
         $this->personal_urls['login'] = array('text' => wfMsg('login'), 'href' => Skin::makeSpecialUrl('UserLogin', $returnto), 'class' => 'ajaxLogin', 'afterText' => Xml::element('img', array('src' => $this->wg->BlankImgUrl, 'class' => 'chevron', 'width' => '0', 'height' => '0'), ''));
         $this->personal_urls['register'] = array('text' => wfMsg('oasis-signup'), 'href' => Skin::makeSpecialUrl('UserSignup'), 'class' => 'ajaxRegister');
     } else {
         // use Mypage message for userpage entry
         $this->personal_urls['userpage']['text'] = wfMsg('mypage');
     }
 }
示例#13
0
 function doTagRow($tag, $hitcount)
 {
     static $sk = null, $doneTags = array();
     if (!$sk) {
         $sk = $this->getSkin();
     }
     if (in_array($tag, $doneTags)) {
         return '';
     }
     global $wgLang;
     $newRow = '';
     $newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
     $disp = ChangeTags::tagDescription($tag);
     $disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsgHtml('tags-edit')) . ')';
     $newRow .= Xml::tags('td', null, $disp);
     $msg = wfMessage("tag-{$tag}-description");
     $desc = !$msg->exists() ? '' : $msg->parse();
     $desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsgHtml('tags-edit')) . ')';
     $newRow .= Xml::tags('td', null, $desc);
     $hitcount = wfMsgExt('tags-hitcount', array('parsemag'), $wgLang->formatNum($hitcount));
     $hitcount = $sk->link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
     $newRow .= Xml::tags('td', null, $hitcount);
     $doneTags[] = $tag;
     return Xml::tags('tr', null, $newRow) . "\n";
 }
示例#14
0
 public static function onThumbnailImageHTML($options, $linkAttribs, $attribs, $file, &$html)
 {
     if (self::isValidLazyLoadedImage($attribs['src'])) {
         $origImgAlt = Xml::element('img', $attribs, '', true);
         // Remove empty alt attributes (messes up string replace later if not removed)
         if (isset($attribs['alt']) && empty($attribs['alt'])) {
             unset($attribs['alt']);
         }
         $origImg = Xml::element('img', $attribs, '', true);
         $lazyImageAttribs = $attribs;
         $lazyImageAttribs['data-src'] = $lazyImageAttribs['src'];
         $lazyImageAttribs['src'] = wfBlankImgUrl();
         $lazyImageAttribs['class'] = self::getImgClass($lazyImageAttribs);
         /* for AJAX requests - makes sure that they are handled properly */
         /* ImgLzy.load is not executed for main content because ImgLzy object is initiated on DOM ready event and those images */
         /* are base64 encoded so they are "loaded" with the content itself */
         $lazyImageAttribs['onload'] = self::IMG_ONLOAD;
         $count = 0;
         $html = str_replace($origImg, Xml::element('img', $lazyImageAttribs) . "<noscript>{$origImg}</noscript>", $html, $count);
         if ($count == 0) {
             $html = str_replace($origImgAlt, Xml::element('img', $lazyImageAttribs) . "<noscript>{$origImg}</noscript>", $html);
         }
     }
     return true;
 }
示例#15
0
function WidgetCategoryCloud($id, $params)
{
    $output = "";
    wfProfileIn(__METHOD__);
    global $wgMemc;
    $key = wfMemcKey("WidgetCategoryCloud", "data");
    $data = $wgMemc->get($key);
    if (is_null($data)) {
        $data = WidgetCategoryCloudCloudizeData(WidgetCategoryCloudGetData());
        $wgMemc->set($key, $data, 3600);
    }
    if (empty($data)) {
        wfProfileOut(__METHOD__);
        return wfMsgForContent("widget-categorycloud-empty");
    }
    foreach ($data as $name => $value) {
        $category = Title::newFromText($name, NS_CATEGORY);
        if (is_object($category)) {
            $class = "cloud" . $value;
            $output .= Xml::openElement("li", array("class" => $class));
            // FIXME fix Wikia:link and use it here
            $output .= Xml::element("a", array("class" => $class, "href" => $category->getLocalURL(), "title" => $category->getFullText()), $category->getBaseText());
            $output .= Xml::closeElement("li");
            $output .= "\n";
        }
    }
    if (empty($output)) {
        wfProfileOut(__METHOD__);
        return wfMsgForContent("widget-categorycloud-empty");
    }
    $output = Xml::openElement("ul") . $output . Xml::closeElement("ul");
    wfProfileOut(__METHOD__);
    return $output;
}
	/**
	 * Get a selector of rateable namespaces
	 * @param int $selected, namespace selected
	 * @param $all Mixed: Value of an item denoting all namespaces, or null to omit
	 * @return string
	 */
	public static function getNamespaceMenu( $selected=null, $all=null ) {
		global $wgContLang, $wgFeedbackNamespaces;
		$s = "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>";
		if( $selected !== '' ) {
			if( is_null( $selected ) ) {
				# No namespace selected; let exact match work without hitting Main
				$selected = '';
			} else {
				# Let input be numeric strings without breaking the empty match.
				$selected = intval($selected);
			}
		}
		$s .= "\n<select id='namespace' name='namespace' class='namespaceselector'>\n";
		$arr = $wgContLang->getFormattedNamespaces();
		if( !is_null($all) ) {
			$arr = array( $all => wfMsg( 'namespacesall' ) ) + $arr; // should be first
		}
		foreach( $arr as $index => $name ) {
			# Content pages only (except 'all')
			if( $index !== $all && !in_array($index, $wgFeedbackNamespaces) ) {
				continue;
			}
			$name = $index !== 0 ? $name : wfMsg('blanknamespace');
			if( $index === $selected ) {
				$s .= "\t" . Xml::element("option", array("value" => $index, "selected" => "selected"), $name) . "\n";
			} else {
				$s .= "\t" . Xml::element("option", array("value" => $index), $name) . "\n";
			}
		}
		$s .= "</select>\n";
		return $s;
	}
 /**
  * @param $user User
  * @param $output OutputPage
  */
 protected function showLogFragment($user, $output)
 {
     $pageTitle = Title::makeTitleSafe(NS_USER, $user->getName());
     $logPage = new LogPage('gblrights');
     $output->addHTML(Xml::element('h2', null, $logPage->getName()->text() . "\n"));
     LogEventsList::showLogExtract($output, 'gblrights', $pageTitle->getPrefixedText());
 }
示例#18
0
 function doTagRow($tag, $hitcount)
 {
     $user = $this->getUser();
     $newRow = '';
     $newRow .= Xml::tags('td', null, Xml::element('code', null, $tag));
     $disp = ChangeTags::tagDescription($tag);
     if ($user->isAllowed('editinterface')) {
         $disp .= ' ';
         $editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped());
         $disp .= $this->msg('parentheses')->rawParams($editLink)->escaped();
     }
     $newRow .= Xml::tags('td', null, $disp);
     $msg = $this->msg("tag-{$tag}-description");
     $desc = !$msg->exists() ? '' : $msg->parse();
     if ($user->isAllowed('editinterface')) {
         $desc .= ' ';
         $editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped());
         $desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped();
     }
     $newRow .= Xml::tags('td', null, $desc);
     $active = isset($this->definedTags[$tag]) ? 'tags-active-yes' : 'tags-active-no';
     $active = $this->msg($active)->escaped();
     $newRow .= Xml::tags('td', null, $active);
     $hitcountLabel = $this->msg('tags-hitcount')->numParams($hitcount)->escaped();
     $hitcountLink = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcountLabel, array(), array('tagfilter' => $tag));
     // add raw $hitcount for sorting, because tags-hitcount contains numbers and letters
     $newRow .= Xml::tags('td', array('data-sort-value' => $hitcount), $hitcountLink);
     return Xml::tags('tr', null, $newRow) . "\n";
 }
function efImageReviewDisplayStatus($imagePage, &$html)
{
    global $wgCityId, $wgExternalDatawareDB, $wgUser;
    if (!$wgUser->isAllowed('imagereviewstats')) {
        return true;
    }
    $html .= Xml::element('h2', array(), wfMsg('imagereview-imagepage-header'));
    $reviews = array();
    $headers = array('Reviewer', 'State', 'Time');
    $where = array('wiki_id' => $wgCityId, 'page_id' => $imagePage->getId());
    $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalDatawareDB);
    $res = $dbr->select('image_review_stats', '*', $where);
    if ($dbr->numRows($res) == 0) {
        //check if image is in the queue at all!
        $imgCurState = $dbr->selectField('image_review', 'state', $where);
        if (false === $imgCurState) {
            // oh oh, image is not in queue at all
            $html .= wfMsg('imagereview-imagepage-not-in-queue');
        } else {
            // image is in the queue but not reviewed yet
            $html .= wfMsg('imagereview-state-0');
        }
    } else {
        // go through the list and display review states
        while ($row = $dbr->fetchObject($res)) {
            $data = array();
            $data[] = User::newFromId($row->reviewer_id)->getName();
            $data[] = wfMsg('imagereview-state-' . $row->review_state);
            $data[] = $row->review_end . ' (UTC)';
            $reviews[] = $data;
        }
        $html .= Xml::buildTable($reviews, array('class' => 'wikitable filehistory sortable', 'style' => 'width: 60%'), $headers);
    }
    return true;
}
	function getHtmlResult() {
		$ballot = $this->election->getBallot();
		if ( !is_callable( array( $ballot, 'getColumnLabels' ) ) ) {
			throw new MWException( __METHOD__.': ballot type not supported by this tallier' );
		}
		$optionLabels = array();
		foreach ( $this->question->getOptions() as $option ) {
			$optionLabels[$option->getId()] = $option->parseMessageInline( 'text' );
		}

		$labels = $ballot->getColumnLabels( $this->question );
		$s = "<table class=\"securepoll-table\">\n" .
			"<tr>\n" .
			"<th>&#160;</th>\n";
		foreach ( $labels as $label ) {
			$s .= Xml::element( 'th', array(), $label ) . "\n";
		}
		$s .= Xml::element( 'th', array(), wfMsg( 'securepoll-average-score' ) );
		$s .= "</tr>\n";
		
		foreach ( $this->averages as $oid => $average ) {
			$s .= "<tr>\n" . 
				Xml::tags( 'td', array( 'class' => 'securepoll-results-row-heading' ),
					$optionLabels[$oid] ) .
				"\n";
			foreach ( $labels as $score => $label ) {
				$s .= Xml::element( 'td', array(), $this->histogram[$oid][$score] ) . "\n";
			}
			$s .= Xml::element( 'td', array(), $average ) . "\n";
			$s .= "</tr>\n";
		}
		$s .= "</table>\n";
		return $s;
	}
 function show()
 {
     $out = $this->getOutput();
     $user = $this->getUser();
     // Header
     $out->addWikiMsg('abusefilter-tools-text');
     // Expression evaluator
     $eval = '';
     $eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
     // Only let users with permission actually test it
     if ($user->isAllowed('abusefilter-modify')) {
         $eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'value' => $this->msg('abusefilter-tools-submitexpr')->text())));
         $eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
     }
     $eval = Xml::fieldset($this->msg('abusefilter-tools-expr')->text(), $eval);
     $out->addHTML($eval);
     $out->addModules('ext.abuseFilter.tools');
     if ($user->isAllowed('abusefilter-modify')) {
         // Hacky little box to re-enable autoconfirmed if it got disabled
         $rac = '';
         $rac .= Xml::inputLabel($this->msg('abusefilter-tools-reautoconfirm-user')->text(), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
         $rac .= '&#160;';
         $rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'value' => $this->msg('abusefilter-tools-reautoconfirm-submit')->text()));
         $rac = Xml::fieldset($this->msg('abusefilter-tools-reautoconfirm')->text(), $rac);
         $out->addHTML($rac);
     }
 }
 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);
 }
 function execute()
 {
     $this->out->setPageTitle($this->app->runFunction('wfMsg', 'spellchecker-info'));
     // get information about enchant
     $dict = new SpellCheckerDictionary();
     // show list of all supported lanuages
     $languages = $dict->getLanguages();
     $rows = array();
     foreach ($languages as $lang) {
         $rows[] = array($lang);
     }
     $this->out->addHtml(Xml::buildTable($rows, array('class' => 'wikitable'), array($this->app->runFunction('wfMsg', 'spellchecker-info-languages', count($languages)))));
     // list providers
     $providers = $dict->getProviders();
     $rows = array();
     foreach ($providers as $provider => $dictionaries) {
         sort($dictionaries);
         $count = count($dictionaries);
         $rows[] = array($provider, implode(', ', $dictionaries) . " ({$count})");
     }
     $this->out->addHtml(Xml::buildTable($rows, array('class' => 'wikitable'), array($this->app->runFunction('wfMsg', 'spellchecker-info-provider'), $this->app->runFunction('wfMsg', 'spellchecker-info-dictionaries'))));
     // spell checking demo
     $this->out->addHtml(Xml::element('hr'));
     $this->spellCheckingForm($languages);
 }
 function show()
 {
     global $wgOut, $wgUser, $wgRequest;
     AbuseFilter::disableConditionLimit();
     if (!$wgUser->isAllowed('abusefilter-modify')) {
         $wgOut->addWikiMsg('abusefilter-mustbeeditor');
         return;
     }
     $this->loadParameters();
     $wgOut->setPageTitle(wfMsg('abusefilter-test'));
     $wgOut->addWikiMsg('abusefilter-test-intro', self::$mChangeLimit);
     $output = '';
     $output .= AbuseFilter::buildEditBox($this->mFilter, 'wpTestFilter') . "\n";
     $output .= Xml::inputLabel(wfMsg('abusefilter-test-load-filter'), 'wpInsertFilter', 'mw-abusefilter-load-filter', 10, '') . '&#160;' . Xml::element('input', array('type' => 'button', 'value' => wfMsg('abusefilter-test-load'), 'id' => 'mw-abusefilter-load'));
     $output = Xml::tags('div', array('id' => 'mw-abusefilter-test-editor'), $output);
     $output .= Xml::tags('p', null, Xml::checkLabel(wfMsg('abusefilter-test-shownegative'), 'wpShowNegative', 'wpShowNegative', $this->mShowNegative));
     // Selectory stuff
     $selectFields = array();
     $selectFields['abusefilter-test-user'] = Xml::input('wpTestUser', 45, $this->mTestUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpTestPeriodStart', 45, $this->mTestPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpTestPeriodEnd', 45, $this->mTestPeriodEnd);
     $selectFields['abusefilter-test-page'] = Xml::input('wpTestPage', 45, $this->mTestPage);
     $output .= Xml::buildForm($selectFields, 'abusefilter-test-submit');
     $output .= Html::hidden('title', $this->getTitle('test')->getPrefixedText());
     $output = Xml::tags('form', array('action' => $this->getTitle('test')->getLocalURL(), 'method' => 'post'), $output);
     $output = Xml::fieldset(wfMsg('abusefilter-test-legend'), $output);
     $wgOut->addHTML($output);
     if ($wgRequest->wasPosted()) {
         $this->doTest();
     }
 }
	function makeForm() {
		$self = $this->getTitle();
		$form  = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
		$form .= Xml::element( 'input', array( 'type' => 'submit', 'name' => 'purge', 'value' => wfMsg( 'purgecache-button' ) ) );
		$form .= Xml::closeElement( 'form' );
		return $form;
	}
 /**
  * Format a table cell. The return value should be HTML, but use an empty
  * string not &#160; for empty cells. Do not include the <td> and </td>.
  *
  * The current result row is available as $this->mCurrentRow, in case you
  * need more context.
  *
  * @param $name String: the database field name
  * @param $value String: the value retrieved from the database
  */
 function formatValue($name, $value)
 {
     global $wgLang;
     switch ($name) {
         case 'tmr_id':
             if (isset($this->mCurrentRow->tmr_tmb_id)) {
                 return SpecialBills::getLinkBill($this->mCurrentRow->tmr_tmb_id, $wgLang->formatNum($value));
             } else {
                 return $wgLang->formatNum($value);
             }
         case 'tmr_type':
             return wfMessage('tm-' . $value)->text();
         case 'tmr_date_created':
         case 'tmr_date_modified':
             return $wgLang->timeanddate($value, true);
         case 'tmr_desc':
             return wfMessage($value)->text();
         case 'tmr_status':
             return wfMessage('status-' . $value)->text();
         case 'tmr_amount':
             if ($this->mCurrentRow->tmr_currency == 'EUR') {
                 $cur = wfMessage('cur-euro')->text();
             } else {
                 $cur = $this->mCurrentRow->tmr_currency;
             }
             $cur = Xml::element('span', array('class' => 'currency'), $cur);
             return ($value > 0 ? '+' . $wgLang->formatNum($value) : $wgLang->formatNum($value)) . $cur;
         default:
             return htmlspecialchars($value);
     }
 }
 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'));
     }
 }
 /**
  * @param $namespace int
  * @param $type string
  * @param $level string
  * @param $minsize int
  * @private
  */
 function showOptions($namespace, $type = 'edit', $level, $sizetype, $size)
 {
     global $wgScript;
     $action = htmlspecialchars($wgScript);
     $title = SpecialPage::getTitleFor('ProtectedTitles');
     $special = htmlspecialchars($title->getPrefixedDBkey());
     return "<form action=\"{$action}\" method=\"get\">\n" . '<fieldset>' . Xml::element('legend', array(), wfMsg('protectedtitles')) . Xml::hidden('title', $special) . "&nbsp;\n" . $this->getNamespaceMenu($namespace) . "&nbsp;\n" . $this->getLevelMenu($level) . "&nbsp;\n" . "&nbsp;" . Xml::submitButton(wfMsg('allpagessubmit')) . "\n" . "</fieldset></form>";
 }
示例#29
0
 /**
  * Show options for the log list
  * @param $type String
  * @param $user String
  * @param $page String
  * @param $pattern String
  * @param $year Integer: year
  * @param $month Integer: month
  * @param $filter Boolean
  */
 public function showOptions($type = '', $user = '', $page = '', $pattern = '', $year = '', $month = '', $filter = null)
 {
     global $wgScript, $wgMiserMode;
     $action = htmlspecialchars($wgScript);
     $title = SpecialPage::getTitleFor('Log');
     $special = htmlspecialchars($title->getPrefixedDBkey());
     $this->out->addHTML("<form action=\"{$action}\" method=\"get\"><fieldset>" . Xml::element('legend', array(), wfMsg('log')) . Xml::hidden('title', $special) . "\n" . $this->getTypeMenu($type) . "\n" . $this->getUserInput($user) . "\n" . $this->getTitleInput($page) . "\n" . (!$wgMiserMode ? $this->getTitlePattern($pattern) . "\n" : "") . "<p>" . $this->getDateMenu($year, $month) . "\n" . ($filter ? "</p><p>" . $this->getFilterLinks($type, $filter) . "\n" : "") . Xml::submitButton(wfMsg('allpagessubmit')) . "</p>\n" . "</fieldset></form>");
 }
 function getForm(OutputPage $out)
 {
     $captcha = $this->getCaptcha();
     if (!$captcha) {
         die("No questions found; set some in LocalSettings.php using the format from QuestyCaptcha.php.");
     }
     $index = $this->storeCaptcha($captcha);
     return "<p><label for=\"wpCaptchaWord\">{$captcha['question']}</label> " . Html::element('input', array('name' => 'wpCaptchaWord', 'id' => 'wpCaptchaWord', 'class' => 'mw-ui-input', 'required', 'autocomplete' => 'off', 'tabindex' => 1)) . "</p>\n" . Xml::element('input', array('type' => 'hidden', 'name' => 'wpCaptchaId', 'id' => 'wpCaptchaId', 'value' => $index));
 }