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");
 }
 /**
  * Output a form to allow searching for a user
  */
 function switchForm()
 {
     global $wgScript;
     $this->getOutput()->addModules('ext.centralauth.globaluserautocomplete');
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getPageTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), $this->msg('userrights-lookup-user')->text()) . Xml::inputLabel($this->msg('userrights-user-editname')->text(), 'user', 'username', 30, $this->mTarget, array('class' => 'mw-autocomplete-global-user')) . ' <br />' . Xml::submitButton($this->msg('editusergroup')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
	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;
	}
 function addRequestWikiForm()
 {
     $localpage = $this->getPageTitle()->getLocalUrl();
     $form = Xml::openElement('form', array('action' => $localpage, 'method' => 'post'));
     $form .= '<fieldset><legend>' . $this->msg('requestwiki')->escaped() . '</legend>';
     $form .= Xml::openElement('table');
     $form .= '<tr><td>' . $this->msg('requestwiki-label-siteurl')->escaped() . '</td>';
     $form .= '<td>' . Xml::input('subdomain', 20, '') . '.miraheze.org' . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-sitename')->escaped() . '</td>';
     $form .= '<td>' . Xml::input('sitename', 20, '', array('required' => '')) . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-customdomain')->escaped() . '</td>';
     $form .= '<td>' . Xml::input('customdomain', 20, '') . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-language')->escaped() . '</td>';
     $form .= '<td>' . Xml::languageSelector('en', true, null, array('name' => 'language'))[1] . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-private')->escaped() . '</td>';
     $form .= '<td>' . Xml::check('private', false, array('value' => 0)) . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-comments')->escaped() . '</td>';
     $form .= '<td>' . Xml::textarea('comments', '', 40, 5, array('required' => '')) . '</td></tr>';
     $form .= '<tr><td>' . Xml::submitButton($this->msg('requestwiki-submit')->plain()) . '</td></tr>';
     $form .= Xml::closeElement('table');
     $form .= '</fieldset>';
     $form .= Html::hidden('token', $this->getUser()->getEditToken());
     $form .= Xml::closeElement('form');
     $this->getOutput()->addHTML($form);
 }
Esempio n. 5
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__);
 }
 public function getTag()
 {
     $this->wf->profileIn(__METHOD__);
     $imageHTML = $this->request->getVal('imageHTML');
     $align = $this->request->getVal('align');
     $width = $this->request->getVal('width');
     $showCaption = $this->request->getVal('showCaption', false);
     $caption = $this->request->getVal('caption', '');
     $zoomIcon = $this->request->getVal('zoomIcon', '');
     $showPictureAttribution = $this->request->getVal('showPictureAttribution', false);
     $attributeTo = $this->request->getVal('$attributeTo', null);
     $html = "<figure class=\"thumb" . (!empty($align) ? " t{$align}" : '') . " thumbinner\" style=\"width:{$width}px;\">{$imageHTML}{$zoomIcon}";
     if (!empty($showCaption)) {
         $html .= "<figcaption class=\"thumbcaption\">{$caption}";
     }
     //picture attribution
     if (!empty($showPictureAttribution) && !empty($attributeTo)) {
         $this->wf->profileIn(__METHOD__ . '::PictureAttribution');
         // render avatar and link to user page
         $avatar = AvatarService::renderAvatar($attributeTo, 16);
         $link = AvatarService::renderLink($attributeTo);
         $html .= Xml::openElement('div', array('class' => 'picture-attribution')) . $avatar . $this->wf->MsgExt('oasis-content-picture-added-by', array('parsemag'), $link, $attributeTo) . Xml::closeElement('div');
         $this->wf->profileOut(__METHOD__ . '::PictureAttribution');
     }
     if (!empty($showCaption)) {
         $html .= '</figcaption>';
     }
     $html .= '</figure>';
     $this->setVal('tag', $html);
     $this->wf->profileOut(__METHOD__);
 }
 public function execute($sub)
 {
     global $wgLastModifiedRange;
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->addHTML(Xml::openElement('h2'));
     $out->addHTML(wfMsg('lastmodified-options'));
     $out->addHTML(Xml::closeElement('h2'));
     $out->addHTML(Xml::openElement('p'));
     $out->addHTML(wfMsg('lastmodified-display-range-value') . ' ' . $wgLastModifiedRange);
     $out->addHTML(Xml::closeElement('p'));
     $rangeMessage = wfMsg('lastmodified-display') . ' ';
     $rangeMessageDatetime = '';
     $displayRange = array(0 => 'years', 1 => 'months', 2 => 'days', 3 => 'hours', 4 => 'minutes', 5 => 'seconds');
     // Display seconds
     foreach ($displayRange as $key => $value) {
         // Check to see which values to display.
         if ($wgLastModifiedRange == 0 || $key >= $wgLastModifiedRange) {
             // append a comma if necessary
             $rangeMessageDatetime .= empty($rangeMessageDatetime) ? '' : ', ';
             // append message
             $rangeMessageDatetime .= wfMsg('lastmodified-label-' . $value);
         }
     }
     $rangeMessage .= $rangeMessageDatetime;
     $out->addHTML(Xml::openElement('p'));
     $out->addHTML($rangeMessage);
     $out->addHTML(Xml::closeElement('p'));
 }
 /**
  * Display the submission form with the captcha injected into it
  */
 public function display_captcha()
 {
     global $wgOut;
     $publicKey = $this->gateway_adapter->getGlobal('RecaptchaPublicKey');
     $useSSL = $this->gateway_adapter->getGlobal('RecaptchaUseSSL');
     // log that a captcha's been triggered
     $this->log($this->gateway_adapter->getData_Unstaged_Escaped('contribution_tracking_id'), 'Captcha triggered');
     // construct the HTML used to display the captcha
     $captcha_html = Xml::openElement('div', array('id' => 'mw-donate-captcha'));
     $captcha_html .= recaptcha_get_html($publicKey, $this->recap_err, $useSSL);
     $captcha_html .= '<span class="creditcard-error-msg">' . wfMsg($this->gateway_adapter->getIdentifier() . '_gateway-error-msg-captcha-please') . '</span>';
     $captcha_html .= Xml::closeElement('div');
     // close div#mw-donate-captcha
     // load up the form class
     $form_class = $this->gateway_adapter->getFormClass();
     //TODO: use setValidationErrors and getValidationErrors everywhere, and
     //refactor all the form constructors one more time. Eventually.
     $data = $this->gateway_adapter->getData_Unstaged_Escaped();
     $errors = $this->gateway_adapter->getValidationErrors();
     $form_obj = new $form_class($this->gateway_adapter, $errors);
     // set the captcha HTML to use in the form
     $form_obj->setCaptchaHTML($captcha_html);
     // output the form
     $wgOut->addHTML($form_obj->getForm());
 }
 public function getDiv($value)
 {
     global $wgOut, $wgPromoterAdPreview;
     if (array_key_exists('language', $this->mParams)) {
         $language = $this->mParams['language'];
     } else {
         $language = $wgOut->getContext()->getLanguage()->getCode();
     }
     $html = Xml::openElement('div', array('id' => Sanitizer::escapeId("pr-ad-list-element-{$this->mParams['ad']}"), 'class' => "pr-ad-list-element"));
     // Make the label; this consists of a text link to the ad editor, and a series of status icons
     if (array_key_exists('withlabel', $this->mParams)) {
         $adName = $this->mParams['ad'];
         $html .= Xml::openElement('div', array('class' => 'pr-ad-list-element-label'));
         $html .= Linker::link(SpecialPage::getTitleFor('PromoterAds', "edit/{$adName}"), htmlspecialchars($adName), array('class' => 'pr-ad-list-element-label-text'));
         $html .= ' (' . Linker::link(SpecialPage::getTitleFor('Randompage'), $this->msg('promoter-live-preview'), array('class' => 'pr-ad-list-element-label-text'), array('ad' => $adName, 'uselang' => $language, 'force' => '1')) . ')';
         // TODO: Output status icons
         $html .= Xml::tags('div', array('class' => 'pr-ad-list-element-label-icons'), '');
         $html .= Xml::closeElement('div');
     }
     // Add the ad preview
     if ($wgPromoterAdPreview) {
         $html .= $this->getInputHTML(null);
     }
     $html .= Xml::closeElement('div');
     return $html;
 }
 /**
  * Render personal URLs item as HTML link
  */
 private function renderPersonalUrl($id)
 {
     wfProfileIn(__METHOD__);
     $personalUrl = $this->personal_urls[$id];
     $attributes = array('data-id' => $id, 'href' => $personalUrl['href']);
     if (in_array($id, array('login', 'register'))) {
         $attributes['rel'] = 'nofollow';
     }
     // add class attribute
     if (isset($personalUrl['class'])) {
         $attributes['class'] = $personalUrl['class'];
     }
     // add accesskey attribute
     switch ($id) {
         case 'mytalk':
             $attributes['accesskey'] = 'n';
             break;
         case 'login':
             $attributes['accesskey'] = 'o';
             break;
     }
     $ret = Xml::openElement('a', $attributes);
     $ret .= $personalUrl['text'];
     if (array_key_exists('afterText', $personalUrl)) {
         $ret .= $personalUrl['afterText'];
     }
     $ret .= Xml::closeElement('a');
     wfProfileOut(__METHOD__);
     return $ret;
 }
Esempio n. 11
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;
}
Esempio n. 12
0
 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             // date and time are separate parameters to facilitate localisation.
             // $time is kept for backward compat reasons.
             // 'emailauthenticated' is also used in SpecialPreferences.php
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $d = $wgLang->date($wgUser->mEmailAuthenticated, true);
             $t = $wgLang->time($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time, $d, $t);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->wrapWikiMsg("<div class=\"error mw-confirmemail-pending\">\n\$1</div>", 'confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl()));
         $form .= Xml::hidden('token', $wgUser->editToken());
         $form .= Xml::submitButton(wfMsg('confirmemail_send'));
         $form .= Xml::closeElement('form');
         $wgOut->addHTML($form);
     }
 }
	public static function getHTML( $file ){
		global $wgUser, $wgOut;
		
		// Add transcode table css and javascript:  
		$wgOut->addModules( array( 'ext.tmh.transcodetable' ) );
		
		$o = '<h2>' . wfMsgHtml( 'timedmedia-status-header' ) . '</h2>';
		// Give the user a purge page link
		$o.= self::$linker->link( $file->getTitle(), wfMsg('timedmedia-update-status'), array(), array( 'action'=> 'purge' ) );
		
		$o.= Xml::openElement( 'table', array( 'class' => 'wikitable transcodestatus' ) ) . "\n"
			. '<tr>'
			. '<th>'.wfMsgHtml( 'timedmedia-status' ) .'</th>'			
			. '<th>' . wfMsgHtml( 'timedmedia-transcodeinfo' ) . '</th>'
			. '<th>'.wfMsgHtml( 'timedmedia-direct-link' ) .'</th>';
			
		if( $wgUser->isAllowed( 'transcode-reset' ) ){
			$o.= '<th>' . wfMsgHtml( 'timedmedia-actions' ) . '</th>';
		}
			
		$o.= "</tr>\n";
			
		$o.= self::getTranscodeRows( $file );
		
		$o.=  Xml::closeElement( 'table' );
		return $o;
	}
Esempio n. 14
0
function wfQuickCreateButton($input, $argv, $parser)
{
    $title = Title::makeTitle(NS_SPECIAL, "CreatePage");
    $link = $title->getFullUrl();
    $output = Xml::openElement('a', array('class' => 'wikia-button', 'id' => 'mr-submit', 'href' => $link)) . wfMsg('quickcreate') . Xml::closeElement('a');
    return $parser->replaceVariables($output);
}
Esempio n. 15
0
    function execute($par)
    {
        global $wgOut, $wgUser;
        global $wgFreenodeChatChannel, $wgFreenodeChatExtraParameters;
        // Preperation.
        $this->setHeaders();
        // Introduction message, explaining to users what this is etc.
        $wgOut->addWikiMsg('freenodechat-header');
        // Prepare query string to pass to widget.
        $queryAssoc = array('channels' => $wgFreenodeChatChannel);
        if ($wgUser->IsLoggedIn()) {
            $queryAssoc['nick'] = str_replace(' ', '_', $wgUser->getName());
        }
        if ($wgFreenodeChatExtraParameters) {
            $queryAssoc = array_merge($queryAssoc, $wgFreenodeChatExtraParameters);
        }
        foreach ($queryAssoc as $parameter => $value) {
            $query[] = $parameter . '=' . urlencode($value);
        }
        $queryString = implode('&', $query);
        // Output widget.
        $wgOut->addHTML(Xml::openElement('iframe', array('width' => '1000', 'height' => '500', 'scrolling' => 'no', 'border' => '0', 'onLoad' => 'freenodeChatExpand( this )', 'src' => 'http://webchat.freenode.net/?' . $queryString)) . Xml::closeElement('iframe'));
        // Hack to make the chat area a reasonable size.
        $wgOut->addHTML(Xml::tags('script', array('type' => 'text/javascript'), '/* <![CDATA[ */
function freenodeChatExpand( elem ) {
	height = elem.height;
	width  = elem.width;
	elem.height = screen.height - 500;
	elem.width  = screen.width  - 250;
}
/* ]]> */'));
    }
Esempio n. 16
0
 public function execute($subpage)
 {
     global $wgOut, $wgRequest, $wgUser, $wgCacheEpoch, $wgCityId;
     wfProfileIn(__METHOD__);
     $this->setHeaders();
     $this->mTitle = SpecialPage::getTitleFor('cacheepoch');
     if ($this->isRestricted() && !$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     //no WikiFactory (internal wikis)
     if (empty($wgCityId)) {
         $wgOut->addHTML(wfMsg('cacheepoch-no-wf'));
         wfProfileOut(__METHOD__);
         return;
     }
     if ($wgRequest->wasPosted()) {
         $wgCacheEpoch = wfTimestampNow();
         $status = WikiFactory::setVarByName('wgCacheEpoch', $wgCityId, $wgCacheEpoch, wfMsg('cacheepoch-wf-reason'));
         if ($status) {
             $wgOut->addHTML('<h2>' . wfMsg('cacheepoch-updated', $wgCacheEpoch) . '</h2>');
         } else {
             $wgOut->addHTML('<h2>' . wfMsg('cacheepoch-not-updated') . '</h2>');
         }
     } else {
         $wgOut->addHTML('<h2>' . wfMsg('cacheepoch-header') . '</h2>');
     }
     $wgOut->addHTML(Xml::openElement('form', array('action' => $this->mTitle->getFullURL(), 'method' => 'post')));
     $wgOut->addHTML(wfMsg('cacheepoch-value', $wgCacheEpoch) . '<br>');
     $wgOut->addHTML(Xml::submitButton(wfMsg('cacheepoch-submit')));
     $wgOut->addHTML(Xml::closeElement('form'));
     wfProfileOut(__METHOD__);
 }
Esempio n. 17
0
 /**
  * Prompt for a username or IP address.
  *
  * @param $userName string
  */
 protected function promptForm($userName = '')
 {
     $out = $this->getOutput();
     $out->addModules('mediawiki.userSuggest');
     $out->addWikiMsg('nuke-tools');
     $out->addHTML(Xml::openElement('form', array('action' => $this->getPageTitle()->getLocalURL('action=submit'), 'method' => 'post')) . '<table><tr>' . '<td>' . Xml::label($this->msg('nuke-userorip')->text(), 'nuke-target') . '</td>' . '<td>' . Xml::input('target', 40, $userName, array('id' => 'nuke-target', 'class' => 'mw-autocomplete-user', 'autofocus' => true)) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-pattern')->text(), 'nuke-pattern') . '</td>' . '<td>' . Xml::input('pattern', 40, '', array('id' => 'nuke-pattern')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-namespace')->text(), 'nuke-namespace') . '</td>' . '<td>' . Html::namespaceSelector(array('all' => 'all'), array('name' => 'namespace')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-maxpages')->text(), 'nuke-limit') . '</td>' . '<td>' . Xml::input('limit', 7, '500', array('id' => 'nuke-limit')) . '</td>' . '</tr><tr>' . '<td></td>' . '<td>' . Xml::submitButton($this->msg('nuke-submit-user')->text()) . '</td>' . '</tr></table>' . Html::hidden('wpEditToken', $this->getUser()->getEditToken()) . Xml::closeElement('form'));
 }
Esempio n. 18
0
 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 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'));
     }
 }
Esempio n. 20
0
 public function renderSubmenu()
 {
     $html = '';
     $html .= Xml::openElement('ul', array('id' => $this->name . '-menu', 'class' => 'tools-menu'));
     $html .= self::renderList($this->items);
     $html .= Xml::closeElement('ul');
     return $html;
 }
Esempio n. 21
0
 function formatMonthlyQuotas()
 {
     $html = Xml::openElement('ul');
     $html .= Html::rawElement('li', array(), '<b>' . wfFormatNumber($this->mCurrentRow->wpp_monthly_page_hits) . '</b> ' . wfMessage('wp-Hits')->text());
     $html .= Html::rawElement('li', array(), '<b>' . wfFormatSizeMB($this->mCurrentRow->wpp_monthly_bandwidth) . '</b> ' . wfMessage('wp-bandwidth')->text());
     $html .= Xml::closeElement('ul');
     return $html;
 }
Esempio n. 22
0
 public function execute($subpage)
 {
     global $wgOut, $wgRequest, $wgCookiePrefix;
     wfProfileIn(__METHOD__);
     $this->mRequest = RequestContext::getMain()->getRequest();
     $this->mOut = RequestContext::getMain()->getOutput();
     $this->setHeaders();
     $this->mTitle = SpecialPage::getTitleFor("Datacenter");
     /**
      * if posted change cookie value
      */
     if ($this->mRequest->wasPosted()) {
         $val = $this->mRequest->getVal("iowacookie", 0);
         if ($val == 2) {
             $this->mOut->addHTML(Wikia::successbox("cookie set to sjc"));
             $this->mRequest->response()->setcookie($this->mCookieName, "sjc");
             $this->mCookie = "sjc";
         } elseif ($val == 1) {
             $this->mOut->addHTML(Wikia::successbox("cookie set to iowa"));
             $this->mRequest->response()->setcookie($this->mCookieName, "iowa");
             $this->mCookie = "iowa";
         } elseif ($val == 3) {
             $this->mOut->addHTML(Wikia::successbox("cookie set to ash"));
             $this->mRequest->response()->setcookie($this->mCookieName, "ash");
             $this->mCookie = "ash";
         } elseif ($val == 4) {
             $this->mOut->addHTML(Wikia::successbox("cookie set to closest"));
             $this->mRequest->response()->setcookie($this->mCookieName, "closest");
             $this->mCookie = "closest";
         } else {
             $this->mOut->addHTML(Wikia::successbox("cookie removed"));
             $this->mRequest->response()->setcookie($this->mCookieName, "sjc", 1);
             $this->mCookie = false;
         }
     } else {
         /**
          * show current value of cookie
          */
         if (isset($_COOKIE[$wgCookiePrefix . $this->mCookieName])) {
             $this->mCookie = $_COOKIE[$wgCookiePrefix . $this->mCookieName];
         }
     }
     $this->mOut->addHTML("Current value of cookie {$wgCookiePrefix}{$this->mCookieName}: <em>" . ($this->mCookie ? $this->mCookie : "not set") . "</em>");
     /**
      * show input chooser
      */
     $this->mOut->addHTML(Xml::openElement("form", array("action" => $this->mTitle->getFullURL(), "method" => "post")));
     $select = new XMLSelect("iowacookie", "iowacookie");
     $select->addOption("Switch to the closest", 4);
     $select->addOption("Switch to San Jose", 2);
     $select->addOption("Switch to Iowa", 1);
     $select->addOption("Switch to Ashburn", 3);
     $select->addOption("Remove preferences", 0);
     $this->mOut->addHTML($select->getHTML());
     $this->mOut->addHTML(Xml::submitButton("submit"));
     $this->mOut->addHTML(Xml::closeElement("form"));
     wfProfileOut(__METHOD__);
 }
 /**
  * This method actually generates the output
  * @return String HTML output
  */
 public function execute($aParams = false)
 {
     $itemsOut = '';
     foreach ($this->_mItems as $item) {
         $itemsOut .= $item->execute();
     }
     $sDivBoxes = Xml::openElement('div', array('class' => 'bs-extendedsearch-optionsformentries', 'style' => 'display: inline-block;')) . $itemsOut . Xml::closeElement('div');
     return $sDivBoxes;
 }
 /**
  * Identical to Xml::element, but does no htmlspecialchars() on $contents
  */
 static function xelement($element, $attribs = null, $contents = '', $allowShortTag = true)
 {
     if (is_null($contents)) {
         return Xml::openElement($element, $attribs);
     } elseif ($contents == '') {
         return Xml::element($element, $attribs, $contents, $allowShortTag);
     }
     return Xml::openElement($element, $attribs) . $contents . Xml::closeElement($element);
 }
	/**
	 * Get rating tier dropdown select
	 * @param int $selected, selected tier
	 * @return string
	 */	
	 public static function getRatingTierMenu( $selected = '' ) {
		$s  = "<label for='wpRatingTier'>" . wfMsgHtml('readerfeedback-tierfilter') . "</label>&#160;";
		$s .= Xml::openElement( 'select', array('name' => 'ratingtier', 'id' => 'wpRatingTier') );
		$s .= Xml::option( wfMsg( "readerfeedback-tier-high" ), 3, $selected===3);
		$s .= Xml::option( wfMsg( "readerfeedback-tier-medium" ), 2, $selected===2 );
		$s .= Xml::option( wfMsg( "readerfeedback-tier-poor" ), 1, $selected===1 );
		$s .= Xml::closeElement('select')."\n";
		return $s;
	}
 /**
  * @static
  * @param $id
  * @param Title $nt
  * @param $links
  * @return bool
  */
 public static function ContributionsToolLinks($id, $nt, &$links)
 {
     global $wgUser;
     if ($id != 0 && $wgUser->isAllowed('lookupcontribs')) {
         $attribs = array('href' => 'http://community.wikia.com/wiki/Special:LookupContribs?target=' . urlencode($nt->getText()), 'title' => wfMsg('right-lookupcontribs'));
         $links[] = Xml::openElement('a', $attribs) . wfMsg('lookupcontribs') . Xml::closeElement('a');
     }
     return true;
 }
Esempio n. 27
0
 public function getForm($par = null)
 {
     global $wgScript, $wgRequest;
     $category = $par;
     if (!$category) {
         $category = $wgRequest->getVal('category');
     }
     $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('randomincategory')) . Html::Hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('p') . Xml::label(wfMsg('randomincategory-label'), 'category') . ' ' . Xml::input('category', null, $category, array('id' => 'category')) . ' ' . Xml::submitButton(wfMsg('randomincategory-submit')) . Xml::closeElement('p') . Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $f;
 }
 function getPageHeader()
 {
     global $wgScript, $wgMiserMode;
     # Do not show useless input form if wiki is running in misermode
     if ($wgMiserMode) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getTitle();
     return Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('withoutinterwiki-legend')) . Html::hidden('title', $t->getPrefixedText()) . Xml::inputLabel(wfMsg('allpagesprefix'), 'prefix', 'wiprefix', 20, $prefix) . ' ' . Xml::submitButton(wfMsg('withoutinterwiki-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
 }
 function getPageHeader()
 {
     global $wgScript;
     # Do not show useless input form if special page is cached
     if ($this->isCached()) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getTitle();
     return Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', null, $this->msg('withoutinterwiki-legend')->text()) . Html::hidden('title', $t->getPrefixedText()) . Xml::inputLabel($this->msg('allpagesprefix')->text(), 'prefix', 'wiprefix', 20, $prefix) . ' ' . Xml::submitButton($this->msg('withoutinterwiki-submit')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form');
 }
 function draw_OTP()
 {
     global $wgOut, $wgUser;
     $formu = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl('action=submit')));
     $formu .= Xml::inputLabel(wfMsg('latch-OTP') . ' ', 'txt_OTP', 'txt_OTP', 20) . '<BR>&nbsp';
     $formu .= Xml::submitButton(wfMsg('latch-enter'), array('name' => 'clickBotOTP')) . '<BR>';
     # Adding protection against CSRF
     $formu .= Html::hidden('token', $wgUser->getEditToken(), array('id' => 'token'));
     $formu .= Xml::closeElement('form');
     $wgOut->addHTML($formu);
 }