예제 #1
0
 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;
	}
예제 #4
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__);
 }
예제 #5
0
파일: Poem.php 프로젝트: akoehn/wikireader
function PoemExtension($in, $param = array(), $parser = null)
{
    /* using newlines in the text will cause the parser to add <p> tags,
     * which may not be desired in some cases
     */
    $nl = isset($param['compact']) ? '' : "\n";
    if (method_exists($parser, 'recursiveTagParse')) {
        //new methods in 1.8 allow nesting <nowiki> in <poem>.
        $tag = $parser->insertStripItem("<br />", $parser->mStripState);
        $text = preg_replace(array("/^\n/", "/\n\$/D", "/\n/", "/^( +)/me"), array("", "", "{$tag}\n", "str_replace(' ','&nbsp;','\\1')"), $in);
        $text = $parser->recursiveTagParse($text);
    } else {
        $text = preg_replace(array("/^\n/", "/\n\$/D", "/\n/", "/^( +)/me"), array("", "", "<br />\n", "str_replace(' ','&nbsp;','\\1')"), $in);
        $ret = $parser->parse($text, $parser->getTitle(), $parser->getOptions(), true, false);
        $text = $ret->getText();
    }
    global $wgVersion;
    if (version_compare($wgVersion, "1.7alpha") >= 0) {
        // Pass HTML attributes through to the output.
        $attribs = Sanitizer::validateTagAttributes($param, 'div');
    } else {
        // Can't guarantee safety on 1.6 or older.
        $attribs = array();
    }
    // Wrap output in a <div> with "poem" class.
    if (isset($attribs['class'])) {
        $attribs['class'] = 'poem ' . $attribs['class'];
    } else {
        $attribs['class'] = 'poem';
    }
    return Xml::openElement('div', $attribs) . $nl . trim($text) . "{$nl}</div>";
}
 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'));
 }
예제 #7
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);
}
 /**
  * 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;
 }
	public function execute( $subpage ) {
		$this->setHeaders();

		$out = $this->getOutput();
		$out->addHTML( Xml::openElement( 'table', array( 'class' => 'wikitable' ) ) );

		$out->addHTML( '<thead>' );
		$out->addHTML( '<tr>' );
		$out->addHTML( '<th>' );
		$out->addWikiMsg( 'userdebuginfo-key' );
		$out->addHTML( '</th>' );
		$out->addHTML( '<th>' );
		$out->addWikiMsg( 'userdebuginfo-value' );
		$out->addHTML( '</th>' );
		$out->addHTML( '</tr>' );
		$out->addHTML( '</thead>' );

		$out->addHTML( '<tbody>' );

		$this->printRow( 'userdebuginfo-useragent', htmlspecialchars( $_SERVER['HTTP_USER_AGENT'] ) );

		if ( isset( $_SERVER['REMOTE_HOST'] ) ) {
			$this->printRow( 'userdebuginfo-remotehost', $_SERVER['REMOTE_HOST'] );
		}

		$this->printRow( 'userdebuginfo-remoteaddr', wfGetIP() );
		$this->printRow( 'userdebuginfo-language', htmlspecialchars( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) );

		$out->addHTML( '</tbody>' );
		$out->addHTML( '</table>' );
	}
예제 #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);
     }
 }
	protected function getDeletionButton( $ip ) {
		return Xml::openElement( 'form', array( 'id' => 'prem-wl-delete' . $ip, 'method' => 'post' ) ) .
			Xml::submitButton( wfMsg( 'premoderation-table-list-delete' ) ) .
			'<input type="hidden" name="action" value="delete" />' .
			'<input type="hidden" name="ip" value="' . $ip . '" />' .
			Xml::closeElement( 'form' );
	}
예제 #14
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;
}
 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 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;
	}
예제 #17
0
 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);
 }
예제 #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);
 }
예제 #19
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;
}
/* ]]> */'));
    }
예제 #20
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__);
 }
예제 #21
0
 /**
  * Core parser tag hook function for 'pre'.
  * Text is treated roughly as 'nowiki' wrapped in an HTML 'pre' tag;
  * valid HTML attributes are passed on.
  *
  * @param string $text
  * @param array $attribs
  * @param Parser $parser
  * @return string HTML
  */
 public static function pre($text, $attribs, $parser)
 {
     // Backwards-compatibility hack
     $content = StringUtils::delimiterReplace('<nowiki>', '</nowiki>', '$1', $text, 'i');
     $attribs = Sanitizer::validateTagAttributes($attribs, 'pre');
     return Xml::openElement('pre', $attribs) . Xml::escapeTagsOnly($content) . '</pre>';
 }
예제 #22
0
 /**
  * Writes a <site> tag representing the given Site object.
  *
  * @param Site $site
  */
 private function exportSite(Site $site)
 {
     if ($site->getType() !== Site::TYPE_UNKNOWN) {
         $siteAttr = ['type' => $site->getType()];
     } else {
         $siteAttr = null;
     }
     fwrite($this->sink, "\t" . Xml::openElement('site', $siteAttr) . "\n");
     fwrite($this->sink, "\t\t" . Xml::element('globalid', null, $site->getGlobalId()) . "\n");
     if ($site->getGroup() !== Site::GROUP_NONE) {
         fwrite($this->sink, "\t\t" . Xml::element('group', null, $site->getGroup()) . "\n");
     }
     if ($site->getSource() !== Site::SOURCE_LOCAL) {
         fwrite($this->sink, "\t\t" . Xml::element('source', null, $site->getSource()) . "\n");
     }
     if ($site->shouldForward()) {
         fwrite($this->sink, "\t\t" . Xml::element('forward', null, '') . "\n");
     }
     foreach ($site->getAllPaths() as $type => $path) {
         fwrite($this->sink, "\t\t" . Xml::element('path', ['type' => $type], $path) . "\n");
     }
     foreach ($site->getLocalIds() as $type => $ids) {
         foreach ($ids as $id) {
             fwrite($this->sink, "\t\t" . Xml::element('localid', ['type' => $type], $id) . "\n");
         }
     }
     // @todo: export <data>
     // @todo: export <config>
     fwrite($this->sink, "\t" . Xml::closeElement('site') . "\n");
 }
 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'));
     }
 }
예제 #24
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;
 }
예제 #25
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;
 }
예제 #26
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__);
 }
	/**
	 * 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;
 }
예제 #29
0
 /**
  * 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);
 }
	private function makeSearchForm( $process, $wild = false ) {
		$self = SpecialPage::getTitleFor( 'Profiling' );
		$html  = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
		$html .= '<table><tr><td>' . wfMsgHtml( 'profiling-process' ) . '</td><td>';
		$html .= Xml::input( 'process', 50, $process ) . '</td></tr><td align="right">' . Xml::check( 'wildcard', $wild ) . '</td>';
		$html .= '<td>' . wfMsgHtml( 'profiling-wildcard' ) . '</td></tr>';
		$html .= '<tr><td>&#160;</td><td>' . Xml::submitButton( wfMsg( 'profiling-ok' ), array( 'name' => 'submit' ) ) . '</td></table></form>';
		return $html;
	}