/**
  * Render the special page and redirect the user to the editor (if page exists)
  * @param string $subpage The name of the page to edit
  */
 public function executeWhenAvailable($subpage)
 {
     if (!is_string($subpage)) {
         $this->showPageNotFound();
         return;
     } else {
         $title = Title::newFromText($subpage);
         if (is_null($title)) {
             $this->showPageNotFound();
             return;
         }
     }
     $data = $this->getRequest()->getValues();
     unset($data['title']);
     // Remove the title of the special page
     $section = (int) $this->getRequest()->getVal('section', 0);
     $output = $this->getOutput();
     $output->addModules('mobile.special.mobileeditor.scripts');
     $output->setPageTitle($this->msg('mobile-frontend-editor-redirect-title')->text());
     $context = MobileContext::singleton();
     $articleUrl = $context->getMobileUrl($title->getFullURL($data));
     $targetUrl = $articleUrl . '#/editor/' . $section;
     $html = Html::openElement('div', array('id' => 'mw-mf-editor', 'data-targeturl' => $targetUrl)) . Html::openElement('noscript') . MobileUI::errorBox($this->msg('mobile-frontend-editor-unavailable')->text()) . Html::openElement('p') . Html::element('a', array('href' => $title->getLocalUrl()), $this->msg('returnto', $title->getText())->text()) . Html::closeElement('noscript') . Html::closeElement('div');
     // #mw-mf-editorunavailable
     $output->addHTML($html);
 }
 /**
  * Generates HTML for the uploads page for the passed user.
  *
  * @param User $user
  * @return string
  */
 public function getUserUploadsPageHtml(User $user)
 {
     $uploadCount = $this->getUserUploadCount($user->getName());
     $mobileContext = MobileContext::singleton();
     $html = '';
     $attrs = array();
     if ($uploadCount !== false) {
         $threshold = $this->getUploadCountThreshold();
         // FIXME: Use Html class?
         $html .= '<div class="content">';
         if ($mobileContext->userCanUpload()) {
             $html .= '<div class="ctaUploadPhoto"></div>';
         }
         if ($uploadCount > $threshold) {
             $msg = $this->msg('mobile-frontend-photo-upload-user-count-over-limit')->text();
         } else {
             $msg = $this->msg('mobile-frontend-photo-upload-user-count')->numParams($uploadCount)->parse();
             if ($uploadCount === 0) {
                 $attrs = array('style' => 'display:none');
             }
         }
         $html .= Html::openElement('h2', $attrs) . $msg . Html::closeElement('h2');
         $html .= '</div>';
     }
     return $html;
 }
Пример #3
0
 public function execute($par)
 {
     $this->setHeaders();
     $out = $this->getContext()->getOutput();
     $out->addModules('ext.wikihiero.Special');
     $out->addModuleStyles('ext.wikihiero.Special');
     // apply CSS during slow load
     $out->addWikiMsg('wikihiero-special-page-text');
     $out->addHTML('<div id="hiero-result">');
     $text = trim($this->getContext()->getRequest()->getVal('text', ''));
     if ($text !== '') {
         $hiero = new WikiHiero();
         $out->addHTML('<table class="wikitable">' . '<tr><th>' . wfMsg('wikihiero-input') . '</th><th>' . wfMsg('wikihiero-result') . '</th></tr>' . '<tr><td><code>&lt;hiero&gt;' . nl2br(htmlspecialchars($text)) . "&lt;/hiero&gt;</code></td><td>{$hiero->render($text)}</td></tr></table>");
     }
     $out->addHTML('</div>');
     // id="hiero-result"
     $out->addHTML(Html::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLinkUrl())) . Html::element('textarea', array('id' => 'hiero-text', 'name' => 'text'), $text) . Html::element('input', array('type' => 'submit', 'id' => 'hiero-submit', 'name' => 'submit')) . Html::closeElement('form'));
     $this->hiero = new WikiHiero();
     $out->addHTML('<table><tr><td>');
     $out->addHTML('<div class="mw-hiero-list">');
     $out->addHTML($this->listHieroglyphs());
     $out->addHTML('</div></td><td>');
     $out->addHTML($this->getToc());
     $out->addHTML('</td></tr></table>');
 }
 public function showForm()
 {
     global $wgScript;
     // Text to explain level select (if there are several levels)
     if (FlaggedRevs::qualityVersions()) {
         $this->getOutput()->addWikiMsg('reviewedpages-list', $this->getLanguage()->formatNum($this->pager->getNumRows()));
     }
     $form = Html::openElement('form', array('name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get'));
     $form .= "<fieldset><legend>" . $this->msg('reviewedpages-leg')->escaped() . "</legend>\n";
     // show/hide links
     $showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped());
     $onoff = 1 - $this->hideRedirs;
     $link = Linker::link($this->getPageTitle(), $showhide[$onoff], array(), array('hideredirs' => $onoff, 'namespace' => $this->namespace));
     $showhideredirs = $this->msg('whatlinkshere-hideredirs')->rawParams($link)->escaped();
     $fields = array();
     $namespaces = FlaggedRevs::getReviewNamespaces();
     if (count($namespaces) > 1) {
         $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace) . ' ';
     }
     if (FlaggedRevs::qualityVersions()) {
         $fields[] = FlaggedRevsXML::getLevelMenu($this->type) . ' ';
     }
     $form .= implode(' ', $fields) . ' ';
     $form .= $showhideredirs;
     if (count($fields)) {
         $form .= " " . Xml::submitButton($this->msg('go')->text());
     }
     $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
     $form .= "</fieldset>";
     $form .= Html::closeElement('form ') . "\n";
     $this->getOutput()->addHTML($form);
 }
 public function getConnectForm()
 {
     if ($this->getVar('wgDBserver') == 'localhost') {
         $this->parent->setVar('wgDBserver', '');
     }
     return $this->getTextBox('wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox('config-db-host-oracle-help')) . Html::openElement('fieldset') . Html::element('legend', array(), wfMsg('config-db-wiki-settings')) . $this->getTextBox('wgDBprefix', 'config-db-prefix') . $this->getTextBox('_OracleDefTS', 'config-oracle-def-ts') . $this->getTextBox('_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox('config-db-oracle-help')) . Html::closeElement('fieldset') . $this->parent->getWarningBox(wfMsg('config-db-account-oracle-warn')) . $this->getInstallUserBox() . $this->getWebUserBox();
 }
Пример #6
0
 /**
  * Function generates Contribution Scores tables in HTML format (not wikiText)
  *
  * @param $days int Days in the past to run report for
  * @param $limit int Maximum number of users to return (default 50)
  * @param $title Title (default null)
  * @param $options array of options (default none; nosort/notools)
  * @return Html Table representing the requested Contribution Scores.
  */
 function genContributionScoreTable($days, $limit, $title = null, $options = 'none')
 {
     global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName;
     $opts = explode(',', strtolower($options));
     $dbr = wfGetDB(DB_SLAVE);
     $userTable = $dbr->tableName('user');
     $userGroupTable = $dbr->tableName('user_groups');
     $revTable = $dbr->tableName('revision');
     $ipBlocksTable = $dbr->tableName('ipblocks');
     $sqlWhere = "";
     $nextPrefix = "WHERE";
     if ($days > 0) {
         $date = time() - 60 * 60 * 24 * $days;
         $dateString = $dbr->timestamp($date);
         $sqlWhere .= " {$nextPrefix} rev_timestamp > '{$dateString}'";
         $nextPrefix = "AND";
     }
     if ($wgContribScoreIgnoreBlockedUsers) {
         $sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
         $nextPrefix = "AND";
     }
     if ($wgContribScoreIgnoreBots) {
         $sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
     }
     $sqlMostPages = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY page_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
     $sqlMostRevs = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY rev_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
     $sql = "SELECT user_id, " . "user_name, " . "user_real_name, " . "page_count, " . "rev_count, " . "page_count+SQRT(rev_count-page_count)*2 AS wiki_rank " . "FROM {$userTable} u JOIN (({$sqlMostPages}) UNION ({$sqlMostRevs})) s ON (user_id=rev_user) " . "ORDER BY wiki_rank DESC " . "LIMIT {$limit}";
     $res = $dbr->query($sql);
     $sortable = in_array('nosort', $opts) ? '' : ' sortable';
     $output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" . "<tr class='header'>\n" . Html::element('th', array(), $this->msg('contributionscores-score')->text()) . Html::element('th', array(), $this->msg('contributionscores-pages')->text()) . Html::element('th', array(), $this->msg('contributionscores-changes')->text()) . Html::element('th', array(), $this->msg('contributionscores-username')->text());
     $altrow = '';
     $lang = $this->getLanguage();
     foreach ($res as $row) {
         // Use real name if option used and real name present.
         if ($wgContribScoresUseRealName && $row->user_real_name !== '') {
             $userLink = Linker::userLink($row->user_id, $row->user_name, $row->user_real_name);
         } else {
             $userLink = Linker::userLink($row->user_id, $row->user_name);
         }
         $output .= Html::closeElement('tr');
         $output .= "<tr class='{$altrow}'>\n<td class='content'>" . $lang->formatNum(round($row->wiki_rank, 0)) . "\n</td><td class='content'>" . $lang->formatNum($row->page_count) . "\n</td><td class='content'>" . $lang->formatNum($row->rev_count) . "\n</td><td class='content'>" . $userLink;
         # Option to not display user tools
         if (!in_array('notools', $opts)) {
             $output .= Linker::userToolLinks($row->user_id, $row->user_name);
         }
         $output .= Html::closeElement('td') . "\n";
         if ($altrow == '' && empty($sortable)) {
             $altrow = 'odd ';
         } else {
             $altrow = '';
         }
     }
     $output .= Html::closeElement('tr');
     $output .= Html::closeElement('table');
     $dbr->freeResult($res);
     if (!empty($title)) {
         $output = Html::rawElement('table', array('style' => 'border-spacing: 0; padding: 0', 'class' => 'contributionscores-wrapper', 'lang' => htmlspecialchars($lang->getCode()), 'dir' => $lang->getDir()), "\n" . "<tr>\n" . "<td style='padding: 0px;'>{$title}</td>\n" . "</tr>\n" . "<tr>\n" . "<td style='padding: 0px;'>{$output}</td>\n" . "</tr>\n");
     }
     return $output;
 }
Пример #7
0
 /**
  * Input form for entering a category
  */
 function makeInputForm()
 {
     $form = '';
     $form .= Html::openElement('form', array('name' => 'ajaxtest', 'method' => 'GET', 'action' => $this->getTitle()->getLocalUrl()));
     $form .= Html::element('input', array('type' => 'text', 'name' => 'ajaxtest_text', 'id' => 'ajaxtest_text', 'value' => '', 'size' => '64')) . ' ';
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'usestring'), 'use string value');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'usestring', 'id' => 'usestring'));
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'httpcache'), 'use http cache');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'httpcache', 'id' => 'httpcache'));
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'lastmod'), 'use last modified');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'lastmod', 'id' => 'lastmod'));
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'error'), 'trigger error');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'error', 'id' => 'error'));
     $form .= Html::element('br');
     $form .= Html::openElement('select', array('name' => 'ajaxtest_target', 'id' => 'ajaxtest_target'));
     $form .= Html::element('option', array('value' => 'function'), "function");
     $form .= Html::element('option', array('value' => 'element'), "element");
     $form .= Html::element('option', array('value' => 'input'), "input");
     $form .= Html::closeElement('select');
     $form .= Html::element('input', array('type' => 'button', 'onclick' => 'doAjaxTest();', 'value' => 'TEST'));
     $form .= Html::element('input', array('type' => 'button', 'onclick' => 'clearAjaxTest();', 'value' => 'CLEAR'));
     # $form .= Html::element( 'input', array( 'type' => 'button', 'onclick' => 'getElementById("ajaxtest_out").value= getElementById("ajaxtest_text").value;', 'value' => 'DUMMY' ) );
     $form .= Html::closeElement('form');
     $form .= Html::element('hr');
     $form .= Html::element('input', array('type' => 'text', 'name' => 'ajaxtest_out', 'id' => 'ajaxtest_out', 'value' => '', 'size' => '64')) . ' ';
     $form .= Html::element('p', array('id' => 'ajaxtest_area'));
     $form .= Html::element('hr');
     $form .= Html::element('p', array('id' => 'sajax_debug'));
     return $form;
 }
 function execute($par)
 {
     $request = $this->getRequest();
     $output = $this->getOutput();
     $this->setHeaders();
     $this->checkPermissions();
     $output->addModules('ext.translate.special.pagemigration');
     $output->addModuleStyles('jquery.uls.grid');
     # Get request data from, e.g.
     $param = $request->getText('param');
     # Do stuff
     # ...
     $out = '';
     $out .= Html::openElement('div', array('class' => 'grid'));
     $out .= Html::openElement('div', array('class' => 'mw-tpm-sp-error row', 'id' => 'mw-tpm-sp-error-div'));
     $out .= Html::element('div', array('class' => 'mw-tpm-sp-error__message five columns hide'));
     $out .= Html::closeElement('div');
     $out .= Html::openElement('form', array('class' => 'mw-tpm-sp-form row', 'id' => 'mw-tpm-sp-primary-form'));
     $out .= Html::element('input', array('id' => 'pm-summary', 'type' => 'hidden', 'value' => $this->msg('pm-summary-import')->inContentLanguage()->text()));
     $out .= Html::element('input', array('id' => 'title', 'class' => 'mw-searchInput', 'placeholder' => $this->msg('pm-pagename-placeholder')->text()));
     $out .= Html::element('input', array('id' => 'language', 'type' => 'text', 'placeholder' => $this->msg('pm-langcode-placeholder')->text()));
     $out .= Html::element('input', array('id' => 'action-import', 'class' => 'mw-ui-button mw-ui-primary', 'type' => 'button', 'value' => $this->msg('pm-import-button-label')->text()));
     $out .= Html::element('input', array('id' => 'action-save', 'class' => 'mw-ui-button mw-ui-constructive hide', 'type' => 'button', 'value' => $this->msg('pm-savepages-button-label')->text()));
     $out .= Html::element('input', array('id' => 'action-cancel', 'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button', 'value' => $this->msg('pm-cancel-button-label')->text()));
     $out .= Html::closeElement('form');
     $out .= Html::openElement('div', array('class' => 'mw-tpm-sp-unit-listing'));
     $out .= Html::closeElement('div');
     $out .= Html::closeElement('div');
     $output->addHTML($out);
 }
 public function showForm()
 {
     global $wgScript;
     # Explanatory text
     $this->getOutput()->addWikiMsg('pendingchanges-list', $this->getLang()->formatNum($this->pager->getNumRows()));
     $form = Html::openElement('form', array('name' => 'pendingchanges', 'action' => $wgScript, 'method' => 'get')) . "\n";
     $form .= "<fieldset><legend>" . wfMsgHtml('pendingchanges-legend') . "</legend>\n";
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n";
     $items = array();
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getNamespaceMenu($this->namespace, '') . '</span>';
     }
     if (FlaggedRevs::qualityVersions()) {
         $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span>';
     }
     if (!FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected()) {
         $items[] = "<span style='white-space: nowrap;'>" . Xml::check('stable', $this->stable, array('id' => 'wpStable')) . Xml::label(wfMsg('pendingchanges-stable'), 'wpStable') . '</span>';
     }
     if ($items) {
         $form .= implode(' ', $items) . '<br />';
     }
     $items = array();
     $items[] = Xml::label(wfMsg("pendingchanges-category"), 'wpCategory') . '&#160;' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory'));
     if ($this->getUser()->getId()) {
         $items[] = Xml::check('watched', $this->watched, array('id' => 'wpWatched')) . Xml::label(wfMsg('pendingchanges-onwatchlist'), 'wpWatched');
     }
     $form .= implode(' ', $items) . '<br />';
     $form .= Xml::label(wfMsg('pendingchanges-size'), 'wpSize') . Xml::input('size', 4, $this->size, array('id' => 'wpSize')) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\n";
     $form .= "</fieldset>";
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
 public function execute()
 {
     global $wgRequest, $wgUser, $wgSitename, $wgSitenameshort, $wgCopyrightLink;
     global $wgCopyright, $wgBootstrap, $wgArticlePath, $wgGoogleAnalyticsID;
     global $wgSiteCSS;
     global $wgEnableUploads;
     global $wgLogo;
     global $wgTOCLocation;
     global $wgNavBarClasses;
     global $wgSubnavBarClasses;
     $this->skin = $this->data['skin'];
     $action = $wgRequest->getText('action');
     $url_prefix = str_replace('$1', '', $wgArticlePath);
     // Suppress warnings to prevent notices about missing indexes in $this->data
     wfSuppressWarnings();
     $this->html('headelement');
     ?>
   <div class="ololo-wiki">
   <?php 
     $this->header($wgUser);
     $this->body();
     $this->footer();
     $this->html('bottomscripts');
     /* JS call to runBodyOnloadHook */
     $this->html('reporttime');
     ?>
   </div>
 <?php 
     echo Html::closeElement('body');
     echo Html::closeElement('html');
     wfRestoreWarnings();
 }
 /**
  * Render message box with system messages, e.g. errors or already logged-in notices
  *
  * @param string $action The type of action the page is used for ('login' or 'signup')
  * @param bool $register Whether the user can register an account
  */
 protected function renderMessageHtml($action, $register = false)
 {
     $msgBox = '';
     // placeholder for displaying any login-related system messages (eg errors)
     $message = $this->data['message'];
     $messageType = $this->data['messagetype'];
     // FIXME: Migrate this to a server-side Mustache template
     // If there is a system message (error, warning, or success) display that
     if ($message && $messageType) {
         $msgBox .= Html::openElement('div', array('class' => $messageType . 'box'));
         $msgBox .= $message;
         $msgBox .= Html::closeElement('div');
         // Render already logged-in notice
     } elseif ($this->data['loggedin']) {
         $msg = $register ? 'mobile-frontend-userlogin-loggedin-register' : 'userlogin-loggedin';
         $msgBox .= Html::openElement('div', array('class' => 'warningbox'));
         $msgBox .= wfMessage($msg)->params($this->data['loggedinuser'])->parse();
         $msgBox .= Html::closeElement('div');
         // Show default welcome message
     } else {
         // The warningbox class is used more for informational purposes than actual warnings.
         $msgBox .= Html::openElement('div', array('class' => 'warningbox'));
         $headerMsg = wfMessage('mobile-frontend-generic-login')->parse();
         $msgBox .= Html::element('strong', array(), $headerMsg);
         $msgBox .= Html::element('br');
         $msgBox .= wfMessage("mobile-frontend-generic-{$action}-action")->plain();
         $msgBox .= Html::closeElement('div');
         $msgBox .= $this->getLogoHtml();
     }
     echo $msgBox;
 }
	protected function showToolbar() {
		$langSelector = Xml::languageSelector( $this->lang );

		$fontSelector = new XmlSelect();
		$fontSelector->setAttribute( 'id', 'webfonts-font-chooser' );

		$sizeSelector = new XmlSelect();
		$sizeSelector->setAttribute( 'id', 'webfonts-size-chooser' );
		for ( $size = 8; $size <= 28; $size += 2 ) {
			$sizeSelector->addOption( $size , $size );
		}
		$sizeSelector->setDefault( 16 );

		$bold = Html::Element( 'button', array( 'id' => 'webfonts-preview-bold' )  , 'B' );

		$italic = Html::Element( 'button', array( 'id' => 'webfonts-preview-italic' ) , 'I' );

		$underline = Html::Element( 'button', array( 'id' => 'webfonts-preview-underline' ) ,  'U' );

		$download  = Html::Element( 'a', array( 'id' => 'webfonts-preview-download', 'href' => '#' ) ,
			wfMsg( 'webfonts-preview-download' ) );

		return Html::openElement( 'div', array( 'id' => 'webfonts-preview-toolbar' ) )
			. $langSelector[1]
			. $fontSelector->getHtml()
			. $sizeSelector->getHtml()
			. $bold
			. $italic
			. $underline
			. $download
			. Html::closeElement( 'div' );
	}
 private function render($parser, $params)
 {
     if (count($params) > 1) {
         $rating = $params[1];
     } else {
         $rating = 0;
     }
     if (count($params) > 2) {
         $max = $params[2];
     } else {
         $max = $GLOBALS['SemanticRating_DefaultMax'];
     }
     $output = Html::openElement('span', array('style' => 'white-space:nowrap;'));
     if ($rating < 0) {
         $rating = 0;
     } elseif ($rating > $max) {
         $rating = $max;
     }
     $i = 1;
     while ($i <= $rating) {
         $output .= Html::element('img', array('src' => $this->imagepath . 'yellowstar.png'));
         $i++;
     }
     if ($rating - $i + 1 != 0) {
         $output .= Html::element('img', array('src' => $this->imagepath . 'halfstar.png'));
         $i++;
     }
     while ($i <= $max) {
         $output .= Html::element('img', array('src' => $this->imagepath . 'greystar.png'));
         $i++;
     }
     $output .= Html::closeElement('span');
     return $output;
 }
 protected function showForm()
 {
     global $wgScript;
     # Explanatory text
     $this->getOutput()->addWikiMsg('configuredpages-list', $this->getLang()->formatNum($this->pager->getNumRows()));
     $fields = array();
     # Namespace selector
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace, '');
     }
     # Default version selector
     $fields[] = FlaggedRevsXML::getDefaultFilterMenu($this->override);
     # Restriction level selector
     if (FlaggedRevs::getRestrictionLevels()) {
         $fields[] = FlaggedRevsXML::getRestrictionFilterMenu($this->autoreview);
     }
     $form = Html::openElement('form', array('name' => 'configuredpages', 'action' => $wgScript, 'method' => 'get'));
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey());
     $form .= "<fieldset><legend>" . wfMsg('configuredpages') . "</legend>\n";
     $form .= implode('&#160;', $fields) . '<br/>';
     $form .= Xml::submitButton(wfMsg('go'));
     $form .= "</fieldset>\n";
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
Пример #15
0
 /**
  * Show the special page
  *
  * @param $par String: name of the user to sudo into
  */
 public function execute($par)
 {
     global $wgOut, $wgExtensionAssetsPath;
     $this->mSkin = new ThemeDesignerDummySkin();
     $this->setHeaders();
     if (function_exists("OutputPage::includeJQuery")) {
         $wgOut->includeJQuery();
     }
     $wgOut->addExtensionStyle("{$wgExtensionAssetsPath}/ThemeDesigner/frame/style/main.css");
     // Yes, the following is ugly... though I still haven't decided if I want to become completely ResourceLoader dependant
     // While 1.16 is still stable.
     $varScript = array();
     foreach (array('leavewarning', 'resizertext') as $msgName) {
         $varScript[] = 'msg' . ucfirst($msgName) . ' = ' . Xml::encodeJsVar((string) wfMsg("themedesigner-{$msgName}"));
     }
     $varScript = 'var ' . implode(", ", $varScript) . ';';
     $wgOut->addInlineScript($varScript);
     $wgOut->addScriptFile("{$wgExtensionAssetsPath}/ThemeDesigner/frame/designer.js");
     echo $wgOut->headElement($this->mSkin);
     $wgOut->sendCacheControl();
     $wgOut->disable();
     // We've collected our html building into a separate file for readability
     require dirname(__FILE__) . '/frame/layout.php';
     echo $this->mSkin->bottomScripts($wgOut);
     echo Html::closeElement('body');
     echo Html::closeElement('html');
 }
 public function execute($par)
 {
     global $wgOut, $wgRequest;
     $this->setHeaders();
     $code = $wgRequest->getVal('verify');
     if ($code !== null) {
         $dbw = wfGetDB(DB_MASTER);
         $row = $dbw->selectRow('email_capture', array('ec_verified'), array('ec_code' => $code), __METHOD__);
         if ($row && !$row->ec_verified) {
             $dbw->update('email_capture', array('ec_verified' => 1), array('ec_code' => $code), __METHOD__);
             if ($dbw->affectedRows()) {
                 $wgOut->addWikiMsg('emailcapture-success');
             } else {
                 $wgOut->addWikiMsg('emailcapture-failure');
             }
         } elseif ($row && $row->ec_verified) {
             $wgOut->addWikiMsg('emailcapture-already-confirmed');
         } else {
             $wgOut->addWikiMsg('emailcapture-invalid-code');
         }
     } else {
         // Show simple form for submitting verification code
         $o = Html::openElement('form', array('action' => $this->getTitle()->getFullUrl(), 'method' => 'post'));
         $o .= Html::element('p', array(), wfMsg('emailcapture-instructions'));
         $o .= Html::openElement('blockquote');
         $o .= Html::element('label', array('for' => 'emailcapture-verify'), wfMsg('emailcapture-verify')) . ' ';
         $o .= Html::input('verify', '', 'text', array('id' => 'emailcapture-verify', 'size' => 32)) . ' ';
         $o .= Html::input('submit', wfMsg('emailcapture-submit'), 'submit');
         $o .= Html::closeElement('blockquote');
         $o .= Html::closeElement('form');
         $wgOut->addHtml($o);
     }
 }
 /**
  * Render the special page boddy
  * @param string $par The username
  */
 public function executeWhenAvailable($par = '')
 {
     $this->offset = $this->getRequest()->getVal('offset', false);
     if ($par) {
         // enter article history view
         $this->user = User::newFromName($par, false);
         if ($this->user && ($this->user->idForName() || User::isIP($par))) {
             // set page title as on desktop site - bug 66656
             $username = $this->user->getName();
             $out = $this->getOutput();
             $out->addModuleStyles(array('mobile.pagelist.styles', 'mobile.pagesummary.styles'));
             $out->setHTMLTitle($this->msg('pagetitle', $this->msg('contributions-title', $username)->plain())->inContentLanguage());
             if (User::isIP($par)) {
                 $this->renderHeaderBar($par);
             } else {
                 $this->renderHeaderBar($this->user->getUserPage());
             }
             $res = $this->doQuery();
             $out->addHtml(Html::openElement('div', array('class' => 'content-unstyled')));
             $this->showContributions($res);
             $out->addHtml(Html::closeElement('div'));
             return;
         }
     }
     $this->showPageNotFound();
 }
 /**
  * Gets the HTML fragment for a watched page.
  *
  * @param MobilePage $mp a definition of the page to be rendered.
  * @return string
  */
 protected function getLineHtml(MobilePage $mp)
 {
     $thumb = $mp->getSmallThumbnailHtml();
     $title = $mp->getTitle();
     if (!$thumb) {
         $thumb = MobilePage::getPlaceHolderThumbnailHtml('list-thumb-none', 'list-thumb-x');
     }
     $timestamp = $mp->getLatestTimestamp();
     $user = $this->getUser();
     $titleText = $title->getPrefixedText();
     if ($timestamp) {
         $lastModified = $this->msg('mobile-frontend-last-modified-date', $this->getLanguage()->userDate($timestamp, $user), $this->getLanguage()->userTime($timestamp, $user))->parse();
         $edit = $mp->getLatestEdit();
         $dataAttrs = array('data-timestamp' => $edit['timestamp'], 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender']);
         $className = 'title';
     } else {
         $className = 'title new';
         $lastModified = '';
         $dataAttrs = array();
     }
     $html = Html::openElement('li', array('class' => 'page-summary', 'title' => $titleText, 'data-id' => $title->getArticleId())) . Html::openElement('a', array('href' => $title->getLocalUrl(), 'class' => $className));
     $html .= $thumb;
     $html .= Html::element('h3', array(), $titleText);
     if ($lastModified) {
         $html .= Html::openElement('div', array('class' => 'info')) . Html::element('span', array_merge($dataAttrs, array('class' => 'modified-enhancement')), $lastModified) . Html::closeElement('div');
     }
     $html .= Html::closeElement('a') . Html::closeElement('li');
     return $html;
 }
Пример #19
0
 /**
  * Show the special page
  * @param string|null $par
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->addModuleStyles('mediawiki.special');
     $out->addHTML(\Html::openElement('table', array('class' => 'wikitable mw-listgrouprights-table')) . '<tr>' . \Html::element('th', null, $this->msg('listgrants-grant')->text()) . \Html::element('th', null, $this->msg('listgrants-rights')->text()) . '</tr>');
     foreach ($this->getConfig()->get('GrantPermissions') as $grant => $rights) {
         $descs = array();
         $rights = array_filter($rights);
         // remove ones with 'false'
         foreach ($rights as $permission => $granted) {
             $descs[] = $this->msg('listgrouprights-right-display', \User::getRightDescription($permission), '<span class="mw-listgrants-right-name">' . $permission . '</span>')->parse();
         }
         if (!count($descs)) {
             $grantCellHtml = '';
         } else {
             sort($descs);
             $grantCellHtml = '<ul><li>' . implode("</li>\n<li>", $descs) . '</li></ul>';
         }
         $id = \Sanitizer::escapeId($grant);
         $out->addHTML(\Html::rawElement('tr', array('id' => $id), "<td>" . $this->msg("grant-{$grant}")->escaped() . "</td>" . "<td>" . $grantCellHtml . '</td>'));
     }
     $out->addHTML(\Html::closeElement('table'));
 }
Пример #20
0
 /**
  * Show error message for missing or incorrect captcha on EditPage.
  * @param EditPage $editPage
  * @param OutputPage $out
  */
 function showEditFormFields(&$editPage, &$out)
 {
     $page = $editPage->getArticle()->getPage();
     if (!isset($page->ConfirmEdit_ActivateCaptcha)) {
         return;
     }
     unset($page->ConfirmEdit_ActivateCaptcha);
     $out->addHTML(Html::openElement('div', array('id' => 'mw-confirmedit-error-area', 'class' => 'errorbox')) . Html::element('strong', array(), $out->msg('errorpagetitle')->text()) . Html::element('div', array('id' => 'errorbox-body'), $out->msg('captcha-sendemail-fail')->text()) . Html::closeElement('div'));
     $this->showEditCaptcha = true;
 }
Пример #21
0
 private function showForm($err = '')
 {
     global $wgOut, $wgUser;
     $wgOut->addWikiMsg('lockdbtext');
     if ($err != '') {
         $wgOut->setSubtitle(wfMsg('formerror'));
         $wgOut->addHTML('<p class="error">' . htmlspecialchars($err) . "</p>\n");
     }
     $wgOut->addHTML(Html::openElement('form', array('id' => 'lockdb', 'method' => 'POST', 'action' => $this->getTitle()->getLocalURL('action=submit'))) . "\n" . wfMsgHtml('enterlockreason') . ":\n" . Html::textarea('wpLockReason', $this->reason, array('rows' => 4)) . "\n<table>\n\t<tr>\n\t\t" . Html::openElement('td', array('style' => 'text-align:right')) . "\n\t\t\t" . Html::input('wpLockConfirm', null, 'checkbox') . "\n\t\t</td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . wfMsgHtml('lockconfirm') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>&#160;</td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . "\n\t\t\t" . Html::input('wpLock', wfMsg('lockbtn'), 'submit') . "\n\t\t</td>\n\t</tr>\n</table>\n" . Html::hidden('wpEditToken', $wgUser->editToken()) . "\n" . Html::closeElement('form'));
 }
 /**
  * Adds HTML to render a header at the top of the feed
  * @param Title|string $title The page to link to or a string to show
  */
 protected function renderHeaderBar($title)
 {
     if ($title instanceof Title) {
         $headerTitle = $this->getHeaderBarLink($title);
     } else {
         // manually style it as a userlink
         $headerTitle = Html::element('span', array('class' => MobileUI::iconClass('user', 'before', 'mw-mf-user icon-16px')), $title);
     }
     $this->getOutput()->addHtml(Html::openElement('div', array('class' => 'content-header')) . Html::openElement('h2', array()) . $headerTitle . Html::closeElement('h2') . Html::closeElement('div'));
 }
Пример #23
0
 function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->allowClickjacking();
     $from = $this->getRequest()->getText('from', $par);
     $cap = new CategoryPager($this->getContext(), $from);
     $cap->doQuery();
     $this->getOutput()->addHTML(Html::openElement('div', array('class' => 'mw-spcontent')) . $this->msg('categoriespagetext', $cap->getNumRows())->parseAsBlock() . $cap->getStartForm($from) . $cap->getNavigationBar() . '<ul>' . $cap->getBody() . '</ul>' . $cap->getNavigationBar() . Html::closeElement('div'));
 }
Пример #24
0
 function execute($par)
 {
     global $wgOut, $wgRequest;
     $this->setHeaders();
     $this->outputHeader();
     $wgOut->allowClickjacking();
     $from = $wgRequest->getText('from', $par);
     $cap = new CategoryPager($from);
     $cap->doQuery();
     $wgOut->addHTML(Html::openElement('div', array('class' => 'mw-spcontent')) . wfMsgExt('categoriespagetext', array('parse'), $cap->getNumRows()) . $cap->getStartForm($from) . $cap->getNavigationBar() . '<ul>' . $cap->getBody() . '</ul>' . $cap->getNavigationBar() . Html::closeElement('div'));
 }
 /**
  * Render Special Page Nearby
  * @param string $par Parameter submitted as subpage
  */
 public function executeWhenAvailable($par = '')
 {
     $this->setHeaders();
     $output = $this->getOutput();
     // set config
     $output->addJsConfigVars('wgMFNearbyRange', $this->getMFConfig()->get('MFNearbyRange'));
     $output->setPageTitle(wfMessage('mobile-frontend-nearby-title')->escaped());
     $html = Html::openElement('div', array('class' => 'content-unstyled', 'id' => 'mw-mf-nearby')) . MobileUI::contentElement(MobileUI::errorBox(Html::element('h2', array(), wfMessage('mobile-frontend-nearby-requirements')) . Html::element('p', array(), wfMessage('mobile-frontend-nearby-requirements-guidance'))), 'noscript') . Html::closeElement('div');
     // #mw-mf-nearby
     $output->addHTML($html);
 }
 protected function getUpdateForm()
 {
     global $wgScript;
     $form = "<table>";
     $form .= "<tr>\n                    <td style='text-align:right; width:200px;'>\n                        <label>" . wfMessage('categorywatchlist-watch')->text() . "</label>\n                    </td>\n                    <td>\n                        <input type='text' name='watchlist-add' id='watchlist-add'>\n                    </td>\n                 </tr>";
     $form .= "<tr>\n                    <td style='text-align:right; width:200px;'>\n                        <label>" . wfMessage('categorywatchlist-del')->text() . "</label>\n                    </td>\n                    <td>\n                        <input type='text' name='watchlist-del' id='watchlist-del'>\n                    </td>\n                 </tr>";
     $form .= "</table>";
     $form .= "<tr>\n                    <td colspan='2'>\n                        <input type='submit' value='" . wfMessage('categorywatchlist-submit')->text() . "'>\n                    </td>\n                 </tr>";
     $out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'ext-categorywatchlist-form')) . Html::hidden('title', $this->getPageTitle()->getPrefixedText()) . Html::hidden('token', $this->getUser()->getEditToken()) . Html::hidden('update', 1) . $form . Html::closeElement('fieldset') . Html::closeElement('form') . "\n";
     return $out;
 }
 /**
  * Display the general contest info.
  *
  * @since 0.1
  *
  * @param Contest $contest
  */
 protected function showGeneralInfo(Contest $contest)
 {
     $out = $this->getOutput();
     $out->addHTML(Html::openElement('table', array('class' => 'wikitable contest-summary')));
     foreach ($this->getSummaryData($contest) as $stat => $value) {
         $out->addHTML('<tr>');
         $out->addHTML(Html::element('th', array('class' => 'contest-summary-name'), wfMsg('contest-contest-' . $stat)));
         $out->addHTML(Html::element('td', array('class' => 'contest-summary-value'), $value));
         $out->addHTML('</tr>');
     }
     $out->addHTML(Html::closeElement('table'));
 }
 /**
  * Reimplementation of SpecialNotifications:execute to add mobile specific stylesheet and Html
  * @param string $par Parameter submitted as subpage
  */
 public function execute($par)
 {
     $out = $this->getOutput();
     $out->addModuleStyles('mobile.special.notifications.styles');
     $title = $out->getRequest()->getText('returnto');
     $title = Title::newFromText($title);
     if ($title) {
         $out->addHtml(Html::openElement('p') . Html::element('a', array('href' => $title->getLocalUrl()), wfMessage('returnto', $title->getText())) . Html::closeElement('p'));
     }
     parent::execute($par);
     $out->addModules('mobile.special.notifications.scripts');
 }
 function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     $userGroups = $wgUser->getGroups();
     if ($wgUser->isBlocked() || !in_array('staff', $userGroups)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if ($wgRequest->wasPosted()) {
         $wgOut->setArticleBodyOnly(true);
         $urlList = $wgRequest->getVal("urls");
         $urlArray = explode("\n", $urlList);
         AdminImageRemoval::$imagesRemoved = array();
         $urlArray = array_map("urldecode", $urlArray);
         $pages = Misc::getPagesFromURLs($urlArray);
         foreach ($pages as $page) {
             if ($page['lang'] == "en") {
                 $this->removeImagesFromArticle($page['page_id']);
             }
         }
         $errors = array();
         foreach ($urlArray as $article) {
             if (!array_key_exists($article, $pages)) {
                 $errors[] = $article;
             }
         }
         if (count($errors) > 0) {
             $result['success'] = false;
             $result['errors'] = $errors;
         } else {
             $result['success'] = true;
         }
         echo json_encode($result);
         $filePath = "/tmp/images-removal-" . date('Ymd') . ".txt";
         $fo = fopen($filePath, 'a');
         foreach (AdminImageRemoval::$imagesRemoved as $fileName) {
             fwrite($fo, "Image:{$fileName}\n");
         }
         fclose($fo);
         return;
     }
     $wgOut->addJScode('airj');
     $s = Html::openElement('form', array('action' => '', 'id' => 'imageremoval')) . "\n";
     $s .= Html::element('p', array(''), 'Input full URLs (e.g. http://www.wikihow.com/Kiss) for articles that should have images removed from them.');
     $s .= Html::element('br');
     $s .= Html::element('textarea', array('id' => 'urls', 'cols' => 55, 'rows' => 5)) . "\n";
     $s .= Html::element('br');
     $s .= Html::element('input', array('type' => 'submit', 'class' => "button primary", 'value' => 'Process articles')) . "\n";
     $s .= Html::closeElement('form');
     $s .= Html::element('div', array('id' => 'imageremoval_results'));
     $wgOut->addHTML($s);
 }
 function getPageHeader()
 {
     # Do not show useless input form if special page is cached
     if ($this->isCached()) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getPageTitle();
     return Html::openElement('form', array('method' => 'get', 'action' => wfScript())) . "\n" . Html::openElement('fieldset') . "\n" . Html::element('legend', null, $this->msg('withoutinterwiki-legend')->text()) . "\n" . Html::hidden('title', $t->getPrefixedText()) . "\n" . Xml::inputLabel($this->msg('allpagesprefix')->text(), 'prefix', 'wiprefix', 20, $prefix) . "\n" . Xml::submitButton($this->msg('withoutinterwiki-submit')->text()) . "\n" . Html::closeElement('fieldset') . "\n" . Html::closeElement('form');
 }