function qpuserchoice(Parser &$parser, PPFrame $frame, array $args) { $this->frame = $frame; $this->args =& $args; if (isset($args[0])) { # args[0] is a poll address $this->pollAddr = trim($this->frame->expand($this->args[0])); $this->pollStore = qp_PollStore::newFromAddr($this->pollAddr); if ($this->pollStore instanceof qp_PollStore && $this->pollStore->pid !== null) { $this->error_message = 'missing_question_id'; if (isset($args[1])) { # args[1] is question_id $qdata = $this->getQuestionData(trim($frame->expand($args[1]))); if ($qdata instanceof qp_QuestionData) { $this->error_message = 'missing_proposal_id'; if (isset($args[2])) { # get poll's proposal choice $this->proposal_id = trim($frame->expand($args[2])); $this->error_message = 'invalid_proposal_id'; if (preg_match(qp_Setup::PREG_NON_NEGATIVE_INT4_MATCH, $this->proposal_id)) { $this->defaultProposalText = isset($args[3]) ? trim($frame->expand($args[3])) : ''; $this->proposal_id = intval($this->proposal_id); $this->error_message = 'missing_proposal_id'; if (array_key_exists($this->proposal_id, $qdata->ProposalText)) { return $this->qpuserchoiceValidResult($qdata); } } } } } } } return '<strong class="error">qpuserchoice: ' . wfMsgHTML('qp_func_' . $this->error_message, qp_Setup::specialchars($this->pollAddr), qp_Setup::specialchars($this->question_id), qp_Setup::specialchars($this->proposal_id)) . '</strong>'; }
/** * Main execution function * @param $par Parameters passed to the page */ function execute($par) { global $wgOut, $wgUser; wfLoadExtensionMessages('Gadgets'); $skin = $wgUser->getSkin(); $this->setHeaders(); $wgOut->setPagetitle(wfMsg("gadgets-title")); $wgOut->addWikiText(wfMsg("gadgets-pagetext")); $gadgets = wfLoadGadgetsStructured(); if (!$gadgets) { return; } $listOpen = false; $msgOpt = array('parseinline', 'parsemag'); foreach ($gadgets as $section => $entries) { if ($section !== false && $section !== '') { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-section-{$section}"); $lnk = $t ? $skin->makeLinkObj($t, wfMsgHTML("edit")) : htmlspecialchars($section); $ttext = wfMsgExt("gadget-section-{$section}", $msgOpt); if ($listOpen) { $wgOut->addHTML('</ul>'); $listOpen = false; } $wgOut->addHTML("\n<h2>{$ttext} [{$lnk}]</h2>\n"); } foreach ($entries as $gname => $code) { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$gname}"); if (!$t) { continue; } $lnk = $skin->makeLinkObj($t, wfMsgHTML("edit")); $ttext = wfMsgExt("gadget-{$gname}", $msgOpt); if (!$listOpen) { $listOpen = true; $wgOut->addHTML('<ul>'); } $wgOut->addHTML("<li>"); $wgOut->addHTML("{$ttext} [{$lnk}]<br/>"); $wgOut->addHTML(wfMsgHTML("gadgets-uses") . ": "); $first = true; foreach ($code as $codePage) { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$codePage}"); if (!$t) { continue; } if ($first) { $first = false; } else { $wgOut->addHTML(", "); } $lnk = $skin->makeLinkObj($t, htmlspecialchars($t->getText())); $wgOut->addHTML($lnk); } $wgOut->addHtml("</li>"); } } if ($listOpen) { $wgOut->addHTML('</ul>'); } }
function insertTab($skin, &$content_actions) { if (!$skin->getTitle()->exists()) { return true; } $linkParam = "page=" . $skin->getTitle()->getPrefixedURL(); $special = SpecialPage::getTitleFor('FlagPage'); $content_actions['flagpage'] = array('class' => false, 'text' => wfMsgHTML('flagpage-tab'), 'href' => $special->getLocalUrl($linkParam)); return true; }
function showSiteSelectForm($invalid = false) { global $wgOut, $wgScript; $legend = wfMsgHtml('configurewmf-selectsite'); $wgOut->addHTML("<fieldset><legend>{$legend}</legend>"); if ($invalid) { $wgOut->addHTML('<p><strong class="error">' . htmlspecialchars(wfMsg('configurewmf-invalidwiki', $invalid)) . '</strong></p>'); } $wgOut->addHTML('<strong id="cfgwmf-attention" style="color: red; font-size: 12pt">' . wfMsgHTML('configurewmf-attentionnotice') . '</strong>'); $wgOut->addWikiMsg('configurewmf-selectsite-help'); $wgOut->addHTML("<form action='{$wgScript}' method='get'>"); $wgOut->addHTML('<p>' . Html::Hidden('title', $this->getTitle()->getFullText()) . '</p><table><tr>'); $wgOut->addHTML('<td class="mw-label">' . Xml::label(wfMsg('configurewmf-site'), 'cfg-site') . '</td>'); $wgOut->addHTML('<td class="mw-input">' . Xml::input('wiki', false, false, array('id' => 'cfg-site')) . '</td>'); $wgOut->addHTML('</tr><tr><td></td><td class="mw-input">' . Xml::submitButton(wfMsg('configurewmf-select')) . '</td>'); $wgOut->addHTML("</tr></table></form></fieldset>"); }
/** * This is the actual workhorse. It does everything needed to make a * real, honest-to-gosh query page. * Alas, we need to overwrite the whole beast since we do not assume * an SQL-based storage backend. * * @param $offset database query offset * @param $limit database query limit */ function doQuery($offset = false, $limit = false) { global $wgOut, $wgContLang; $options = new SMWRequestOptions(); $options->limit = $limit; $options->offset = $offset; $options->sort = true; $res = $this->getResults($options); $num = count($res); $sk = $this->getSkin(); $sname = $this->getName(); $wgOut->addHTML($this->getPageHeader()); // if list is empty, show it if ($num == 0) { $wgOut->addHTML('<p>' . wfMsgHTML('specialpage-empty') . '</p>'); return; } $top = wfShowingResults($offset, $num); $wgOut->addHTML("<p>{$top}\n"); // often disable 'next' link when we reach the end $atend = $num < $limit; $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $atend); $wgOut->addHTML("<br />{$sl}</p>\n"); if ($num > 0) { $s = array(); if (!$this->listoutput) { $s[] = $this->openList($offset); } foreach ($res as $r) { $format = $this->formatResult($sk, $r); if ($format) { $s[] = $this->listoutput ? $format : "<li>{$format}</li>\n"; } } if (!$this->listoutput) { $s[] = $this->closeList(); } $str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s); $wgOut->addHTML($str); } $wgOut->addHTML("<p>{$sl}</p>\n"); return $num; }
function doQuery($offset, $limit, $shownavigation = true) { global $wgOut, $wgContLang; $res = $this->getIntervalResults($offset, $limit); $num = count($res); if ($shownavigation) { $wgOut->addHTML($this->getPageHeader()); // if list is empty, display a warning if ($num == 0) { $wgOut->addHTML('<p>' . wfMsgHTML('specialpage-empty') . '</p>'); return; } $top = wfShowingResults($offset, $num); $wgOut->addHTML("<p>{$top}\n"); // often disable 'next' link when we reach the end $atend = $num < $limit; $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($this->queryPageName()), wfArrayToCGI($this->linkParameters()), $atend); $wgOut->addHTML("<br />{$sl}</p>\n"); } if ($num > 0) { $s = array(); if (!$this->listoutput) { $s[] = $this->openList($offset); } foreach ($res as $r) { $format = $this->formatResult($r); if ($format) { $s[] = $this->listoutput ? $format : "<li>{$format}</li>\n"; } } if (!$this->listoutput) { $s[] = $this->closeList(); } $str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s); $wgOut->addHTML($str); } if ($shownavigation) { $wgOut->addHTML("<p>{$sl}</p>\n"); } return $num; }
/** * Executes special page rendering and data processing * * @param $sub Mixed: MediaWiki supplied sub-page path */ public function execute($sub) { global $wgRequest, $wgOut, $wgUser; // Begin output $this->setHeaders(); // Make sure the user is logged in if (!$wgUser->isLoggedIn()) { // If not, let them know they need to $wgOut->loginToUse(); // Continue return true; } // Handle discarding $draft = Draft::newFromID($wgRequest->getIntOrNull('discard')); if ($draft->exists()) { // Discard draft $draft->discard(); // Redirect to the article editor or view if returnto was set $section = $wgRequest->getIntOrNull('section'); $urlSection = $section !== null ? "§ion={$section}" : ''; switch ($wgRequest->getText('returnto')) { case 'edit': $title = Title::newFromDBKey($draft->getTitle()); $wgOut->redirect(wfExpandURL($title->getEditURL() . $urlSection)); break; case 'view': $title = Title::newFromDBKey($draft->getTitle()); $wgOut->redirect(wfExpandURL($title->getFullURL() . $urlSection)); break; } } // Show list of drafts, or a message that there are none if (Drafts::display() == 0) { $wgOut->addHTML(wfMsgHTML('drafts-view-nonesaved')); } }
function execute($par) { global $wgOut, $wgRequest; $format = $wgRequest->getVal("format", false); if ($format === "xml" || $format === "csv") { $this->generateList($format); } else { $wgOut->setPageTitle(wfMsg('newwikis')); $up = new NewWikisPage($par); # getBody() first to check, if empty $usersbody = $up->getBody(); $s = Xml::openElement('div', array('class' => 'mw-spcontent')); $s .= $up->getPageHeader(); if ($usersbody) { $s .= $up->getNavigationBar(); $s .= '<ul>' . $usersbody . '</ul>'; $s .= $up->getNavigationBar(); } else { $s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>'; } $s .= Xml::closeElement('div'); $wgOut->addHTML($s); } }
/** * Load revision metadata for the specified articles. If newid is 0, then compare * the old article in oldid to the current article; if oldid is 0, then * compare the current article to the immediately previous one (ignoring the * value of newid). * * If oldid is false, leave the corresponding revision object set * to false. This is impossible via ordinary user input, and is provided for * API convenience. */ function loadRevisionData() { global $wgLang, $wgTitle, $wgLanguageCode, $wgRequest; if ($this->mRevisionsLoaded) { return true; } else { // Whether it succeeds or fails, we don't want to try again $this->mRevisionsLoaded = true; } // Load the new revision object $this->mNewRev = $this->mNewid ? Revision::newFromId($this->mNewid) : Revision::newFromTitle($this->mTitle); if (!$this->mNewRev instanceof Revision) { return false; } // Update the new revision ID in case it was 0 (makes life easier doing UI stuff) $this->mNewid = $this->mNewRev->getId(); // Set assorted variables $timestamp = wfTimeAgo($this->mNewRev->getTimestamp()); $this->mNewDate = $timestamp; $this->mNewPage = $this->mNewRev->getTitle(); if ($this->mNewRev->isCurrent()) { $newLink = $this->mNewPage->escapeLocalUrl(); $this->mPagetitle = htmlspecialchars(wfMsg('currentrev')); $newEdit = $this->mNewPage->escapeLocalUrl('action=edit'); //XXADDED for quick edit if ($wgTitle->getNamespace() != NS_SPECIAL && $wgLanguageCode == 'en') { $editURL = $wgServer . '/Special:Newarticleboost?type=editform&target=' . urlencode($wgTitle->getFullText()); //$this->mNewtitle .= " <a href=\"#\" onclick=\"initPopupEdit('".$editURL."') ;\">" . htmlspecialchars( wfMsg( 'editold-quick' ) ) . "</a> | "; } $this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>" . " (<a href='{$newEdit}'>" . wfMsg('diff_edit') . "</a>)"; } else { $newLink = $this->mNewPage->escapeLocalUrl('oldid=' . $this->mNewid); $newEdit = $this->mNewPage->escapeLocalUrl('action=edit&oldid=' . $this->mNewid); $this->mPagetitle = wfMsgHTML('revisionasof', $timestamp); //XXADDED for quick edit if ($wgTitle->getNamespace() != NS_SPECIAL && $wgLanguageCode == 'en' && $wgRequest->getVal("rcid", "") != "") { $editURL = $wgServer . '/Special:Newarticleboost?type=editform&target=' . urlencode($wgTitle->getFullText()); $this->mNewtitle .= " <a href=\"#\" onclick=\"initPopupEdit('" . $editURL . "') ;\">" . htmlspecialchars(wfMsg('editold-quick')) . "</a> | "; } $this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>" . " (<a href='{$newEdit}'>" . wfMsg('diff_edit') . "</a>) "; } if (!$this->mNewRev->userCan(Revision::DELETED_TEXT)) { $this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>"; } else { if ($this->mNewRev->isDeleted(Revision::DELETED_TEXT)) { $this->mNewtitle = '<span class="history-deleted">' . $this->mNewtitle . '</span>'; } } // Load the old revision object $this->mOldRev = false; if ($this->mOldid) { $this->mOldRev = Revision::newFromId($this->mOldid); } elseif ($this->mOldid === 0) { $rev = $this->mNewRev->getPrevious(); if ($rev) { $this->mOldid = $rev->getId(); $this->mOldRev = $rev; } else { // No previous revision; mark to show as first-version only. $this->mOldid = false; $this->mOldRev = false; } } /* elseif ( $this->mOldid === false ) leave mOldRev false; */ if (is_null($this->mOldRev)) { return false; } if ($this->mOldRev) { $this->mOldPage = $this->mOldRev->getTitle(); $t = wfTimeAgo($this->mOldRev->getTimestamp()); $oldLink = $this->mOldPage->escapeLocalUrl('oldid=' . $this->mOldid); $oldEdit = $this->mOldPage->escapeLocalUrl('action=edit&oldid=' . $this->mOldid); //$this->mOldPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t ) ); $oldTitle = "<a href='{$oldLink}'>" . wfMsg('diff_oldrev') . "</a> "; $this->mOldtitle = $oldTitle . " (<a href='{$oldEdit}'>" . wfMsg('diff_edit') . "</a>)"; $this->mOldDate = $t; // Add an "undo" link $newUndo = $this->mNewPage->escapeLocalUrl('action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid); if ($this->mNewRev->userCan(Revision::DELETED_TEXT)) { //$this->mNewtitle .= "<span id='undolink'>(<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)</span>"; if (!$this->mOldRev->userCan(Revision::DELETED_TEXT)) { $this->mOldtitle = "<span class='history-deleted'>{$this->mOldPagetitle}</span>"; } else { if ($this->mOldRev->isDeleted(Revision::DELETED_TEXT)) { $this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>'; } } } } return true; }
/** * Shamelessly stolen bits from ReverseChronologicalPager, * didn't want to do class magic as may be still revamped */ function getNavigationBar() { global $wgLang; if (isset($this->mNavigationBar)) { return $this->mNavigationBar; } $opts = array('parsemag', 'escapenoentities'); $linkTexts = array('prev' => wfMsgExt('prevn', $opts, $wgLang->formatNum($this->mLimit)), 'next' => wfMsgExt('nextn', $opts, $wgLang->formatNum($this->mLimit)), 'first' => wfMsgExt('page_first', $opts), 'last' => wfMsgExt('page_last', $opts)); $pagingLinks = $this->getPagingLinks($linkTexts); $limitLinks = $this->getLimitLinks(); $limits = $wgLang->pipeList($limitLinks); $this->mNavigationBar = "(" . $wgLang->pipeList(array($pagingLinks['first'], $pagingLinks['last'])) . ") " . wfMsgHtml('viewprevnext', $pagingLinks['prev'], $pagingLinks['next'], $limits); if (!is_array($this->getIndexField())) { # Early return to avoid undue nesting return $this->mNavigationBar; } $extra = ''; $first = true; $msgs = $this->getOrderTypeMessages(); foreach (array_keys($msgs) as $order) { if ($first) { $first = false; } else { $extra .= wfMsgExt('pipe-separator', 'escapenoentities'); } if ($order == $this->mOrderType) { $extra .= wfMsgHTML($msgs[$order]); } else { $extra .= $this->makeLink(wfMsgHTML($msgs[$order]), array('order' => $order)); } } if ($extra !== '') { $this->mNavigationBar .= " ({$extra})"; } return $this->mNavigationBar; }
function showDiff($revision) { global $wgOut; $dbr = wfGetDB(DB_SLAVE); $result = $this->getRevisions($dbr, array('hidden_rev_id' => $revision)); while ($row = $dbr->fetchObject($result)) { $info = $this->listRow($row); $list = $this->revisionInfo($row); $rev = new Revision($row); $rev->mTitle = Title::makeTitle($row->page_namespace, $row->page_title); $prevId = $rev->mTitle->getPreviousRevisionID($row->rev_id); if ($prevId) { $prev = Revision::newFromTitle($rev->mTitle, $prevId); $otext = strval($prev->getText()); } else { $wgOut->addHtml("<ul>" . $info . "</ul>\n" . $list); $wgOut->addWikiText(wfMsgNoTrans('oversight-nodiff')); return; } $ntext = strval($rev->getText()); $diffEngine = new DifferenceEngine(); $diffEngine->showDiffStyle(); $wgOut->addHtml("<ul>" . $info . "</ul>\n" . $list . "<p><strong>" . wfMsgHTML('oversight-difference') . "</strong>" . "</p>" . "<div>" . "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" . "<col class='diff-marker' />" . "<col class='diff-content' />" . "<col class='diff-marker' />" . "<col class='diff-content' />" . "<tr>" . "<td colspan='2' width='50%' align='center' class='diff-otitle'>" . wfMsgHTML('oversight-prev') . " (#{$prevId})" . "</td>" . "<td colspan='2' width='50%' align='center' class='diff-ntitle'>" . wfMsgHTML('oversight-hidden') . "</td>" . "</tr>" . $diffEngine->generateDiffBody($otext, $ntext) . "</table>" . "</div>\n"); } $dbr->freeResult($result); }
/** * Outputs a table of existing drafts * * @param $title Object: [optional] Title of article, defaults to all articles * @param $userID Integer: [optional] ID of user, defaults to current user * @return Number of drafts in the table */ public static function display($title = null, $userID = null) { global $wgOut, $wgRequest, $wgUser, $wgLang; // Gets draftID $currentDraft = Draft::newFromID($wgRequest->getIntOrNull('draft')); // Output HTML for list of drafts $drafts = Drafts::get($title, $userID); if (count($drafts) > 0) { global $egDraftsLifeSpan; // Internationalization // Add a summary, on Special:Drafts only if (!$title || $title->getNamespace() == NS_SPECIAL) { $wgOut->wrapWikiMsg('<div class="mw-drafts-summary">$1</div>', array('drafts-view-summary', $wgLang->formatNum($egDraftsLifeSpan))); } // Build XML $wgOut->addHTML(Xml::openElement('table', array('cellpadding' => 5, 'cellspacing' => 0, 'width' => '100%', 'border' => 0, 'id' => 'drafts-list-table'))); $wgOut->addHTML(Xml::openElement('tr')); $wgOut->addHTML(Xml::element('th', array('width' => '75%', 'nowrap' => 'nowrap'), wfMsg('drafts-view-article'))); $wgOut->addHTML(Xml::element('th', null, wfMsg('drafts-view-saved'))); $wgOut->addHTML(Xml::element('th')); $wgOut->addHTML(Xml::closeElement('tr')); // Add existing drafts for this page and user foreach ($drafts as $draft) { // Get article title text $htmlTitle = $draft->getTitle()->getEscapedText(); // Build Article Load link $urlLoad = $draft->getTitle()->getFullURL('action=edit&draft=' . urlencode($draft->getID())); // Build discard link $urlDiscard = SpecialPage::getTitleFor('Drafts')->getFullURL(sprintf('discard=%s&token=%s', urlencode($draft->getID()), urlencode($wgUser->editToken()))); // If in edit mode, return to editor if ($wgRequest->getText('action') == 'edit' || $wgRequest->getText('action') == 'submit') { $urlDiscard .= '&returnto=' . urlencode('edit'); } // Append section to titles and links if ($draft->getSection() !== null) { // Detect section name $lines = explode("\n", $draft->getText()); // If there is any content in the section if (count($lines) > 0) { $htmlTitle .= '#' . htmlspecialchars(trim(trim(substr($lines[0], 0, 255), '='))); } // Modify article link and title $urlLoad .= '§ion=' . urlencode($draft->getSection()); $urlDiscard .= '§ion=' . urlencode($draft->getSection()); } // Build XML $wgOut->addHTML(Xml::openElement('tr')); $wgOut->addHTML(Xml::openElement('td')); $wgOut->addHTML(Xml::element('a', array('href' => $urlLoad, 'style' => 'font-weight:' . ($currentDraft->getID() == $draft->getID() ? 'bold' : 'normal')), $htmlTitle)); $wgOut->addHTML(Xml::closeElement('td')); $wgOut->addHTML(Xml::element('td', null, $wgLang->timeanddate($draft->getSaveTime(), true))); $wgOut->addHTML(Xml::openElement('td')); $jsClick = "if( wgDraft.getState() !== 'unchanged' )" . "return confirm('" . Xml::escapeJsString(wfMsgHTML('drafts-view-warn')) . "')"; $wgOut->addHTML(Xml::element('a', array('href' => $urlDiscard, 'onclick' => $jsClick), wfMsg('drafts-view-discard'))); $wgOut->addHTML(Xml::closeElement('td')); $wgOut->addHTML(Xml::closeElement('tr')); } $wgOut->addHTML(Xml::closeElement('table')); // Return number of drafts return count($drafts); } return 0; }
/** * Display in sidebar * @param $tpl The used template */ function wfReviewExtensionAfterToolbox(&$tpl) { global $wgTitle, $wgUser, $wgReviewExtensionTopics, $wgArticle, $action, $wgRequest; # Do we care? if (!wfReviewExtensionDoesNamespaceApply($wgTitle->getNamespace()) or $wgUser->isBlocked() or $action != "view") { return true; } # Initialize $do_merge = $wgRequest->getBool('do_merge', false); $skin =& $wgUser->getSkin(); $revision = $wgArticle->getRevIdFetched(); wfReviewExtensionInitMessages(); $ratings = wfReviewExtensionGetUserRatingsForPage($wgTitle, $wgUser); $did_update_review = wfReviewExtensionReadLastForm($ratings, $wgTitle, $do_merge); if (!isset($ratings[$revision])) { # Construct blank dummy, if necessary $ratings[$revision] = array(); } wfReviewExtensionPresetForm($wgReviewExtensionTopics, $ratings[$revision]); ?> </ul> </div> </div> <div class="portlet" id="p-tasks"> <h5> <?php $tpl->msg('review_sidebar_title'); ?> </h5> <div class="pBody"> <form method='post' id="review_sidebar"> <?php if ($did_update_review) { print '<span id="review_has_been_stored">' . wfMsgForContent('review_has_been_stored') . '</span><br />'; } print wfMsgForContent('review_your_review') . "<br />"; foreach ($wgReviewExtensionTopics as $topic) { ?> <a id="review_sidebar_link" href=" <?php $topic_title = Title::makeTitleSafe(NS_MEDIAWIKI, wfMsgForContent('review_topic_page') . '#' . $topic['name']); print $topic_title->escapeLocalURL(); ?> "> <?php echo $topic['name']; ?> </a> <?php if ($topic['range'] > 2) { print "<small> (" . $topic['left'] . "→" . $topic['right'] . ")</small><br />"; } echo "<div id='review_sidebar_range'>" . wfReviewExtensionGetTopicForm($topic) . "</div>"; } print "<input type='hidden' name='review_oldid' value='{$revision}'/>\n"; if (count($ratings) > 1) { # "Merge" CHECKBOX print "<div id='review_sidebar_range'><input type='checkbox' checked name='do_merge' value='1'/>" . wfMsgForContent('review_do_merge') . "</div>\n"; } else { # Hidden field "don't merge" print "<input type='hidden' name='do_merge' value='0'/>\n"; } print "<input style='width:100%' type='submit' name='save_review' value='" . wfMsgForContent('review_save') . "'/>"; print "<div id='review_sidebar_note'>"; print wfMsgForContent('review_sidebar_explanation'); if (count($ratings) > 1) { print " " . wfMsgForContent('review_sidebar_you_have_other_reviews_for_this_article'); } print "<br />"; $stat_title = Title::makeTitleSafe(NS_SPECIAL, "Review"); $link = $skin->makeLinkObj($stat_title, wfMsgHTML('review_page_link'), "mode=view_page_statistics&page_id=" . $wgTitle->getArticleID()); $out = str_replace("\$1", $link, wfMsg('review_sidebar_final')); print $out; ?> </div></form> <ul> <?php return true; }
/** * @param $skin * @param $content_actions * @return bool */ function insertTab($skin, &$content_actions) { $special = SpecialPage::getTitleFor('HideRevision'); $content_actions['hiderevision'] = array('class' => false, 'text' => wfMsgHTML('hiderevision-tab'), 'href' => $special->getLocalUrl($this->mLinkParam)); return true; }
/** * Load revision metadata for the specified articles. If newid is 0, then compare * the old article in oldid to the current article; if oldid is 0, then * compare the current article to the immediately previous one (ignoring the * value of newid). * * If oldid is false, leave the corresponding revision object set * to false. This is impossible via ordinary user input, and is provided for * API convenience. */ function loadRevisionData() { global $wgLang, $wgUser; if ($this->mRevisionsLoaded) { return true; } else { // Whether it succeeds or fails, we don't want to try again $this->mRevisionsLoaded = true; } // Load the new revision object $this->mNewRev = $this->mNewid ? Revision::newFromId($this->mNewid) : Revision::newFromTitle($this->mTitle); if (!$this->mNewRev instanceof Revision) { return false; } // Update the new revision ID in case it was 0 (makes life easier doing UI stuff) $this->mNewid = $this->mNewRev->getId(); // Check if page is editable $editable = $this->mNewRev->getTitle()->userCan('edit'); // Set assorted variables $timestamp = $wgLang->timeanddate($this->mNewRev->getTimestamp(), true); $this->mNewPage = $this->mNewRev->getTitle(); if ($this->mNewRev->isCurrent()) { $newLink = $this->mNewPage->escapeLocalUrl('oldid=' . $this->mNewid); $this->mPagetitle = wfMsgHTML('currentrev-asof', $timestamp); $newEdit = $this->mNewPage->escapeLocalUrl('action=edit'); $this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>"; $this->mNewtitle .= " (<a href='{$newEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)"; } else { $newLink = $this->mNewPage->escapeLocalUrl('oldid=' . $this->mNewid); $newEdit = $this->mNewPage->escapeLocalUrl('action=edit&oldid=' . $this->mNewid); $this->mPagetitle = wfMsgHTML('revisionasof', $timestamp); $this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>"; $this->mNewtitle .= " (<a href='{$newEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)"; } if (!$this->mNewRev->userCan(Revision::DELETED_TEXT)) { $this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>"; } else { if ($this->mNewRev->isDeleted(Revision::DELETED_TEXT)) { $this->mNewtitle = '<span class="history-deleted">' . $this->mNewtitle . '</span>'; } } // Load the old revision object $this->mOldRev = false; if ($this->mOldid) { $this->mOldRev = Revision::newFromId($this->mOldid); } elseif ($this->mOldid === 0) { $rev = $this->mNewRev->getPrevious(); if ($rev) { $this->mOldid = $rev->getId(); $this->mOldRev = $rev; } else { // No previous revision; mark to show as first-version only. $this->mOldid = false; $this->mOldRev = false; } } /* elseif ( $this->mOldid === false ) leave mOldRev false; */ if (is_null($this->mOldRev)) { return false; } if ($this->mOldRev) { $this->mOldPage = $this->mOldRev->getTitle(); $t = $wgLang->timeanddate($this->mOldRev->getTimestamp(), true); $oldLink = $this->mOldPage->escapeLocalUrl('oldid=' . $this->mOldid); $oldEdit = $this->mOldPage->escapeLocalUrl('action=edit&oldid=' . $this->mOldid); $this->mOldPagetitle = htmlspecialchars(wfMsg('revisionasof', $t)); $this->mOldtitle = "<a href='{$oldLink}'>{$this->mOldPagetitle}</a>" . " (<a href='{$oldEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)"; // Add an "undo" link $newUndo = $this->mNewPage->escapeLocalUrl('action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid); $htmlLink = htmlspecialchars(wfMsg('editundo')); $htmlTitle = $wgUser->getSkin()->tooltip('undo'); if ($editable && !$this->mOldRev->isDeleted(Revision::DELETED_TEXT) && !$this->mNewRev->isDeleted(Revision::DELETED_TEXT)) { $this->mNewtitle .= " (<a href='{$newUndo}' {$htmlTitle}>" . $htmlLink . "</a>)"; } if (!$this->mOldRev->userCan(Revision::DELETED_TEXT)) { $this->mOldtitle = '<span class="history-deleted">' . $this->mOldPagetitle . '</span>'; } else { if ($this->mOldRev->isDeleted(Revision::DELETED_TEXT)) { $this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>'; } } } return true; }
/** * constructor * $par string (optional) A group to list users from */ function wfSpecialListusers($par = null) { global $wgRequest, $wgOut; $up = new UsersPager($par); # getBody() first to check, if empty $usersbody = $up->getBody(); $s = $up->getPageHeader(); if ($usersbody) { $s .= $up->getNavigationBar(); $s .= '<ul>' . $usersbody . '</ul>'; $s .= $up->getNavigationBar(); } else { $s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>'; } $wgOut->addHTML($s); }
function showList($msg) { global $wgOut; $wgOut->setPagetitle(wfMsg("ipblocklist")); if ("" != $msg) { $wgOut->setSubtitle($msg); } // Purge expired entries on one in every 10 queries if (!mt_rand(0, 10)) { Block::purgeExpired(); } $conds = array(); if ($this->ip == '') { // No extra conditions } elseif (substr($this->ip, 0, 1) == '#') { $conds['ipb_id'] = substr($this->ip, 1); } elseif (IP::toUnsigned($this->ip) !== false) { $conds['ipb_address'] = $this->ip; $conds['ipb_auto'] = 0; } elseif (preg_match("/^(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\/(\\d{1,2})\$/", $this->ip, $matches)) { $conds['ipb_address'] = Block::normaliseRange($this->ip); $conds['ipb_auto'] = 0; } else { $user = User::newFromName($this->ip); if ($user && ($id = $user->getID()) != 0) { $conds['ipb_user'] = $id; } else { // Uh...? $conds['ipb_address'] = $this->ip; $conds['ipb_auto'] = 0; } } $pager = new IPBlocklistPager($this, $conds); $s = $pager->getNavigationBar() . $this->searchForm(); if ($pager->getNumRows()) { $s .= "<ul>" . $pager->getBody() . "</ul>"; } else { $s .= '<p>' . wfMsgHTML('ipblocklistempty') . '</p>'; } $s .= $pager->getNavigationBar(); $wgOut->addHTML($s); }
/** * constructor * $par string (optional) A group to list users from */ function wfSpecialListusers($par = null) { global $wgOut; $up = new UsersPager($par); # getBody() first to check, if empty $usersbody = $up->getBody(); $s = Xml::openElement('div', array('class' => 'mw-spcontent')); $s .= $up->getPageHeader(); if ($usersbody) { $s .= $up->getNavigationBar(); $s .= '<ul>' . $usersbody . '</ul>'; $s .= $up->getNavigationBar(); } else { $s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>'; } $s .= Xml::closeElement('div'); $wgOut->addHTML($s); }
/** * Main execution function * @param $par Parameters passed to the page */ function execute( $par ) { global $wgOut, $wgUser; $skin = $wgUser->getSkin(); $this->setHeaders(); $wgOut->setPagetitle( wfMsg( "plotters-title" ) ); $wgOut->addWikiText( wfMsg( "plotters-pagetext" ) ); $plotters = wfLoadPlottersStructured(); if ( !$plotters ) return; $listOpen = false; $msgOpt = array( 'parseinline', 'parsemag' ); foreach ( $plotters as $section => $entries ) { if ( $section !== false && $section !== '' ) { $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Plotter-section-$section" ); $lnk = $t ? $skin->makeLinkObj( $t, wfMsgHTML( "edit" ), 'action=edit' ) : htmlspecialchars( $section ); $ttext = wfMsgExt( "plotter-section-$section", $msgOpt ); if ( $listOpen ) { $wgOut->addHTML( '</ul>' ); $listOpen = false; } $wgOut->addHTML( "\n<h2>$ttext     [$lnk]</h2>\n" ); } foreach ( $entries as $pname => $code ) { $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Plotter-$pname" ); if ( !$t ) continue; $lnk = $skin->makeLinkObj( $t, wfMsgHTML( "edit" ), 'action=edit' ); $ttext = wfMsgExt( "plotter-$pname", $msgOpt ); if ( !$listOpen ) { $listOpen = true; $wgOut->addHTML( '<ul>' ); } $wgOut->addHTML( "<li>" ); $wgOut->addHTML( "$ttext     [$lnk]<br />" ); $wgOut->addHTML( wfMsgHTML( "plotters-uses" ) . ": " ); $first = true; foreach ( $code as $codePage ) { $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Plotters-$codePage" ); if ( !$t ) continue; if ( $first ) $first = false; else $wgOut->addHTML( ", " ); $lnk = $skin->makeLinkObj( $t, htmlspecialchars( $t->getText() ) ); $wgOut->addHTML( $lnk ); } $wgOut->addHtml( "</li>" ); } } if ( $listOpen ) { $wgOut->addHTML( '</ul>' ); } }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser; global $wgUseCopyrightUpload; global $wgRequest, $wgAllowCopyUploads; if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } $cols = intval($wgUser->getOption('cols')); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiText(wfMsg('uploadtext')); $wgOut->addHTML('</div>'); $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsgWikiHtml('fileuploadsummary'); $licenses = new Licenses(); $license = wfMsgHtml('license'); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Upload'); $action = $titleObj->escapeLocalURL(); $encDestFile = htmlspecialchars($this->mDestFile); $watchChecked = $wgUser->getOption('watchdefault') || $wgUser->getOption('watchcreations') && $this->mDestFile == '' ? 'checked="checked"' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' onfocus='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFileURL\")' ") . "size='40' DISABLED />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } $wgOut->addHTML("\n\t<form id='upload' method='post' enctype='multipart/form-data' action=\"{$action}\">\n\t\t<table border='0'>\n\t\t<tr>\n\t {$this->uploadFormTextTop}\n\t\t\t<td align='right' valign='top'><label for='wpUploadFile'>{$sourcefilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t{$filename_form}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpDestFile'>{$destfilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadDescription'>{$summary}</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='6' cols='{$cols}'{$ew}>" . htmlspecialchars($this->mUploadDescription) . "</textarea>\n\t {$this->uploadFormTextAfterSummary}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<script type='text/javascript' src=\"{$wgStylePath}/common/upload.js\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mUploadCopyStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mUploadSource); $wgOut->addHTML("\n\t\t\t <td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='right'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t <td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>"); }
function mainUploadForm($msg = '') { global $wgOut, $wgUser, $wgLang, $wgMaxUploadSize; global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; global $wgRequest, $wgAllowCopyUploads; global $wgStylePath, $wgStyleVersion; $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; $adc = wfBoolToStr($useAjaxDestCheck); $alp = wfBoolToStr($useAjaxLicensePreview); $autofill = wfBoolToStr($this->mDesiredDestName == ''); $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\nwgUploadAutoFill = {$autofill};\n</script>\n<script type=\"text/javascript\" src=\"{$wgStylePath}/common/upload.js?{$wgStyleVersion}\"></script>\n\t\t"); if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } if ($this->mDesiredDestName) { $title = Title::makeTitleSafe(NS_IMAGE, $this->mDesiredDestName); // Show a subtitle link to deleted revisions (to sysops et al only) if ($title instanceof Title && ($count = $title->isDeleted()) > 0 && $wgUser->isAllowed('deletedhistory')) { $link = wfMsgExt($wgUser->isAllowed('delete') ? 'thisisdeleted' : 'viewdeleted', array('parse', 'replaceafter'), $wgUser->getSkin()->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete', $title->getPrefixedText()), wfMsgExt('restorelink', array('parsemag', 'escape'), $count))); $wgOut->addHtml("<div id=\"contentSub2\">{$link}</div>"); } // Show the relevant lines from deletion log (for still deleted files only) if ($title instanceof Title && $title->isDeleted() > 0 && !$title->exists()) { $this->showDeletionLog($wgOut, $title->getPrefixedText()); } } $cols = intval($wgUser->getOption('cols')); if ($wgUser->getOption('editwidth')) { $width = " style=\"width:100%\""; } else { $width = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } //$wgOut->addHTML( '<div id="uploadtext">' ); //$wgOut->addWikiMsg( 'uploadtext', $this->mDesiredDestName ); //$wgOut->addHTML( "</div>\n" ); # Print a list of allowed file extensions, if so configured. We ignore # MIME type here, it's incomprehensible to most people and too long. global $wgCheckFileExtensions, $wgStrictFileExtensions, $wgFileExtensions, $wgFileBlacklist; $allowedExtensions = ''; if ($wgCheckFileExtensions) { $delim = wfMsgExt('comma-separator', array('escapenoentities')); if ($wgStrictFileExtensions) { # Everything not permitted is banned $extensionsList = '<div id="mw-upload-permitted">' . wfMsgWikiHtml('upload-permitted', implode($wgFileExtensions, $delim)) . "</div>\n"; } else { # We have to list both preferred and prohibited $extensionsList = '<div id="mw-upload-preferred">' . wfMsgWikiHtml('upload-preferred', implode($wgFileExtensions, $delim)) . "</div>\n" . '<div id="mw-upload-prohibited">' . wfMsgWikiHtml('upload-prohibited', implode($wgFileBlacklist, $delim)) . "</div>\n"; } } # Get the maximum file size from php.ini as $wgMaxUploadSize works for uploads from URL via CURL only # See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize for possible values of upload_max_filesize $val = trim(ini_get('upload_max_filesize')); $last = strtoupper(substr($val, -1)); switch ($last) { case 'G': $val2 = substr($val, 0, -1) * 1024 * 1024 * 1024; break; case 'M': $val2 = substr($val, 0, -1) * 1024 * 1024; break; case 'K': $val2 = substr($val, 0, -1) * 1024; break; default: $val2 = $val; } $val2 = $wgAllowCopyUploads ? min($wgMaxUploadSize, $val2) : $val2; $maxUploadSize = wfMsgExt('upload-maxfilesize', array('parseinline', 'escapenoentities'), $wgLang->formatSize($val2)); $sourcefilename = wfMsgExt('sourcefilename', 'escapenoentities'); $destfilename = wfMsgExt('destfilename', 'escapenoentities'); $summary = wfMsgExt('fileuploadsummary', 'parseinline'); $licenses = new Licenses(); $license = wfMsgExt('license', array('parseinline')); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Mv_special_upload'); $encDestName = htmlspecialchars($this->mDesiredDestName); $watchChecked = $this->watchCheck() ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' " . "onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked='checked' />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . "onfocus='" . "toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");" . "toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")' " . "onchange='fillDestFilename(\"wpUploadFile\")' size='60' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' " . "onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' " . "onfocus='" . "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" . "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")' " . "onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' disabled='disabled' />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='60' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } if ($useAjaxDestCheck) { $warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>"; $destOnkeyup = 'onkeyup="wgUploadWarningObj.keypress();"'; } else { $warningRow = ''; $destOnkeyup = ''; } $encComment = htmlspecialchars($this->mComment); $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $titleObj->getLocalURL(), 'enctype' => 'multipart/form-data', 'id' => 'mw-upload-form')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('upload')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-upload-table')) . "<tr>\n\t\t\t \t{$this->uploadFormTextTop}\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpUploadFile'>{$sourcefilename}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t{$filename_form}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t{$maxUploadSize}\n\t\t\t\t\t{$extensionsList}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpDestFile'>{$destfilename}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'\n\t\t\t\t\t\tvalue=\"{$encDestName}\" onchange='toggleFilenameFiller()' {$destOnkeyup} />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='file_desc_msg'>stream desc msg</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<input tabindex='3' type='text' name='file_desc_msg' id='file_desc_msg' size='60'\n\t\t\t\t\t\tvalue=\"mv_ogg_low_quality\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpUploadDescription'>{$summary}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<textarea tabindex='4' name='wpUploadDescription' id='wpUploadDescription' rows='6'\n\t\t\t\t\t\tcols='{$cols}'{$width}>{$encComment}</textarea>\n\t\t\t\t\t{$this->uploadFormTextAfterSummary}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t<label for='wpLicense'>{$license}</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t\t\t{$licenseshtml}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); if ($useAjaxLicensePreview) { $wgOut->addHtml("\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td id=\"mw-license-preview\"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>"); } } if ($wgUseCopyrightUpload) { $filestatus = wfMsgExt('filestatus', 'escapenoentities'); $copystatus = htmlspecialchars($this->mCopyrightStatus); $filesource = wfMsgExt('filesource', 'escapenoentities'); $uploadsource = htmlspecialchars($this->mCopyrightSource); $wgOut->addHTML("\n\t\t\t\t\t<td class='mw-label' style='white-space: nowrap;'>\n\t\t\t\t\t\t<label for='wpUploadCopyStatus'>{$filestatus}</label></td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus'\n\t\t\t\t\t\t\tvalue=\"{$copystatus}\" size='60' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t<label for='wpUploadCopyStatus'>{$filesource}</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus'\n\t\t\t\t\t\t\tvalue=\"{$uploadsource}\" size='60' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); } $wgOut->addHtml("\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' {$warningChecked}/>\n\t\t\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t{$warningRow}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" . $wgUser->getSkin()->tooltipAndAccesskey('upload') . " />\n\t\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>"); //undesa $stream_id = $wgRequest->getVal('stream_id'); $wgOut->addHTML("<input type=hidden name=stream_id value={$stream_id}></input>"); //undesa $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t\t\t</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::hidden('wpDestFileWarningAck', '', array('id' => 'wpDestFileWarningAck')) . Xml::closeElement('fieldset') . Xml::closeElement('form')); $uploadfooter = wfMsgNoTrans('uploadfooter'); if ($uploadfooter != '-' && !wfEmptyMsg('uploadfooter', $uploadfooter)) { $wgOut->addWikiText(Xml::tags('div', array('id' => 'mw-upload-footer-message'), $uploadfooter)); } }
function showThreadToolbar($thread) { $html = ''; $headerParts = array(); foreach ($this->threadMajorCommands($thread) as $key => $cmd) { $content = $this->contentForCommand($cmd, false); $headerParts[] = Xml::tags('li', array('class' => "lqt-command lqt-command-{$key}"), $content); } // Drop-down menu $commands = $this->threadCommands($thread); $menuHTML = Xml::tags('ul', array('class' => 'lqt-thread-toolbar-command-list'), $this->listItemsForCommands($commands)); $triggerText = Xml::tags('a', array('class' => 'lqt-thread-actions-icon', 'href' => '#'), wfMsgHTML('lqt-menu-trigger')); $dropDownTrigger = Xml::tags('div', array('class' => 'lqt-thread-actions-trigger ' . 'lqt-command-icon', 'style' => 'display: none;'), $triggerText); if (count($commands)) { $headerParts[] = Xml::tags('li', array('class' => 'lqt-thread-toolbar-menu'), $dropDownTrigger); } $html .= implode(' ', $headerParts); $html = Xml::tags('ul', array('class' => 'lqt-thread-toolbar-commands'), $html); $html = Xml::tags('div', array('class' => 'lqt-thread-toolbar'), $html) . $menuHTML; return $html; }
/** * @access private */ function mainPrefsForm($status, $message = '') { global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth; global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; global $wgDisableLangConversion, $wgDisableTitleConversion; global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits; global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress; global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication; global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration; global $wgEmailConfirmToEdit, $wgEnableMWSuggest, $wgLocalTZoffset; $wgOut->setPageTitle(wfMsg('preferences')); $wgOut->setArticleRelated(false); $wgOut->setRobotPolicy('noindex,nofollow'); $wgOut->addScriptFile('prefs.js'); $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc. if ($this->mSuccess || 'success' == $status) { $wgOut->wrapWikiMsg('<div class="successbox"><strong>$1</strong></div>', 'savedprefs'); } else { if ('error' == $status) { $wgOut->addWikiText('<div class="errorbox"><strong>' . $message . '</strong></div>'); } else { if ('' != $status) { $wgOut->addWikiText($message . "\n----"); } } } $qbs = $wgLang->getQuickbarSettings(); $mathopts = $wgLang->getMathNames(); $dateopts = $wgLang->getDatePreferences(); $togs = User::getToggles(); $titleObj = SpecialPage::getTitleFor('Preferences'); # Pre-expire some toggles so they won't show if disabled $this->mUsedToggles['shownumberswatching'] = true; $this->mUsedToggles['showupdated'] = true; $this->mUsedToggles['enotifwatchlistpages'] = true; $this->mUsedToggles['enotifusertalkpages'] = true; $this->mUsedToggles['enotifminoredits'] = true; $this->mUsedToggles['enotifrevealaddr'] = true; $this->mUsedToggles['ccmeonemails'] = true; $this->mUsedToggles['uselivepreview'] = true; $this->mUsedToggles['noconvertlink'] = true; if (!$this->mEmailFlag) { $emfc = 'checked="checked"'; } else { $emfc = ''; } if ($wgEmailAuthentication && $this->mUserEmail != '') { if ($wgUser->getEmailAuthenticationTimestamp()) { // date and time are separate parameters to facilitate localisation. // $time is kept for backward compat reasons. // 'emailauthenticated' is also used in SpecialConfirmemail.php $time = $wgLang->timeAndDate($wgUser->getEmailAuthenticationTimestamp(), true); $d = $wgLang->date($wgUser->getEmailAuthenticationTimestamp(), true); $t = $wgLang->time($wgUser->getEmailAuthenticationTimestamp(), true); $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t) . '<br />'; $disableEmailPrefs = false; } else { $disableEmailPrefs = true; $skin = $wgUser->getSkin(); $emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Confirmemail'), wfMsg('emailconfirmlink')) . '<br />'; } } else { $emailauthenticated = ''; $disableEmailPrefs = false; } if ($this->mUserEmail == '') { $emailauthenticated = wfMsg('noemailprefs') . '<br />'; } $ps = $this->namespacesCheckboxes(); $enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : ''; $enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : ''; $enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : ''; $enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : ''; # </FIXME> $wgOut->addHTML(Xml::openElement('form', array('action' => $titleObj->getLocalUrl(), 'method' => 'post', 'id' => 'mw-preferences-form')) . Xml::openElement('div', array('id' => 'preferences'))); # User data $wgOut->addHTML(Xml::fieldset(wfMsg('prefs-personal')) . Xml::openElement('table') . $this->tableRow(Xml::element('h2', null, wfMsg('prefs-personal')))); # Get groups to which the user belongs $userEffectiveGroups = $wgUser->getEffectiveGroups(); $userEffectiveGroupsArray = array(); foreach ($userEffectiveGroups as $ueg) { if ($ueg == '*') { // Skip the default * group, seems useless here continue; } $userEffectiveGroupsArray[] = User::makeGroupLinkHTML($ueg); } asort($userEffectiveGroupsArray); $sk = $wgUser->getSkin(); $toolLinks = array(); $toolLinks[] = $sk->makeKnownLinkObj(SpecialPage::getTitleFor('ListGroupRights'), wfMsg('listgrouprights')); # At the moment one tool link only but be prepared for the future... # FIXME: Add a link to Special:Userrights for users who are allowed to use it. # $wgUser->isAllowed( 'userrights' ) seems to strict in some cases $userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), $wgLang->formatNum(htmlspecialchars($wgUser->getId()))) . $this->tableRow(wfMsgExt('prefs-memberingroups', array('parseinline'), count($userEffectiveGroupsArray)), $wgLang->commaList($userEffectiveGroupsArray) . '<br />(' . implode(' | ', $toolLinks) . ')') . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum($wgUser->getEditCount())); if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) { $wgOut->addHTML($userInformationHtml); } if ($wgAllowRealName) { $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline')))); } if ($wgEnableEmail) { $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('id' => 'wpUserEmail')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt($wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline')))); } global $wgParser, $wgMaxSigChars; if (mb_strlen($this->mNick) > $wgMaxSigChars) { $invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsgExt('badsiglength', 'parsemag', $wgLang->formatNum($wgMaxSigChars)))); } elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) { $invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsg('badsig'))); } else { $invalidSig = ''; } $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow(' ', $this->getToggle('fancysig'))); list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage); $wgOut->addHTML($this->tableRow($lsLabel, $lsSelect)); /* see if there are multiple language variants to choose from*/ if (!$wgDisableLangConversion) { $variants = $wgContLang->getVariants(); $variantArray = array(); $languages = Language::getLanguageNames(true); foreach ($variants as $v) { $v = str_replace('_', '-', strtolower($v)); if (array_key_exists($v, $languages)) { // If it doesn't have a name, we'll pretend it doesn't exist $variantArray[$v] = $languages[$v]; } } $options = "\n"; foreach ($variantArray as $code => $name) { $selected = $code == $this->mUserVariant; $options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n"; } if (count($variantArray) > 1) { $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourvariant'), 'wpUserVariant'), Xml::tags('select', array('name' => 'wpUserVariant', 'id' => 'wpUserVariant'), $options))); } if (count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) { $wgOut->addHTML(Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("noconvertlink")))); } } # Password if ($wgAuth->allowPasswordChange()) { $link = $wgUser->getSkin()->link(SpecialPage::getTitleFor('ResetPass'), wfMsgHtml('prefs-resetpass'), array(), array('returnto' => SpecialPage::getTitleFor('Preferences'))); $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('changepassword'))) . $this->tableRow('<ul><li>' . $link . '</li></ul>')); } # <FIXME> # Enotif if ($wgEnableEmail) { $moreEmail = ''; if ($wgEnableUserEmail) { // fixme -- the "allowemail" pseudotoggle is a hacked-together // inversion for the "disableemail" preference. $emf = wfMsg('allowemail'); $disabled = $disableEmailPrefs ? ' disabled="disabled"' : ''; $moreEmail = "<input type='checkbox' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>{$emf}</label>" . $this->getToggle('ccmeonemails', '', $disableEmailPrefs); } $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('email'))) . $this->tableRow($emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail)); } # </FIXME> $wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('fieldset')); # Quickbar # if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') { $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('qbsettings') . "</legend>\n"); for ($i = 0; $i < count($qbs); ++$i) { if ($i == $this->mQuickbar) { $checked = ' checked="checked"'; } else { $checked = ""; } $wgOut->addHTML("<div><label><input type='radio' name='wpQuickbar' value=\"{$i}\"{$checked} />{$qbs[$i]}</label></div>\n"); } $wgOut->addHTML("</fieldset>\n\n"); } else { # Need to output a hidden option even if the relevant skin is not in use, # otherwise the preference will get reset to 0 on submit $wgOut->addHTML(Xml::hidden('wpQuickbar', $this->mQuickbar)); } # Skin # global $wgAllowUserSkin; if ($wgAllowUserSkin) { $wgOut->addHTML("<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n"); $mptitle = Title::newMainPage(); $previewtext = wfMsg('skin-preview'); # Only show members of Skin::getSkinNames() rather than # $skinNames (skins is all skin names from Language.php) $validSkinNames = Skin::getUsableSkins(); # Sort by UI skin name. First though need to update validSkinNames as sometimes # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI). foreach ($validSkinNames as $skinkey => &$skinname) { $msgName = "skinname-{$skinkey}"; $localisedSkinName = wfMsg($msgName); if (!wfEmptyMsg($msgName, $localisedSkinName)) { $skinname = $localisedSkinName; } } asort($validSkinNames); foreach ($validSkinNames as $skinkey => $sn) { $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; $mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}")); $previewlink = "(<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>)"; if ($skinkey == $wgDefaultSkin) { $sn .= ' (' . wfMsg('default') . ')'; } $wgOut->addHTML("<input type='radio' name='wpSkin' id=\"wpSkin{$skinkey}\" value=\"{$skinkey}\"{$checked} /> <label for=\"wpSkin{$skinkey}\">{$sn}</label> {$previewlink}<br />\n"); } $wgOut->addHTML("</fieldset>\n\n"); } # Math # global $wgUseTeX; if ($wgUseTeX) { $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('math') . '</legend>'); foreach ($mathopts as $k => $v) { $checked = $k == $this->mMath; $wgOut->addHTML(Xml::openElement('div') . Xml::radioLabel(wfMsg($v), 'wpMath', $k, "mw-sp-math-{$k}", $checked) . Xml::closeElement('div') . "\n"); } $wgOut->addHTML("</fieldset>\n\n"); } # Files # $imageLimitOptions = null; foreach ($wgImageLimits as $index => $limits) { $selected = $index == $this->mImageSize; $imageLimitOptions .= Xml::option("{$limits[0]}×{$limits[1]}" . wfMsg('unit-pixel'), $index, $selected); } $imageThumbOptions = null; foreach ($wgThumbLimits as $index => $size) { $selected = $index == $this->mThumbSize; $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index, $selected); } $imageSizeId = 'wpImageSize'; $thumbSizeId = 'wpThumbSize'; $wgOut->addHTML(Xml::fieldset(wfMsg('files')) . "\n" . Xml::openElement('table') . '<tr> <td class="mw-label">' . Xml::label(wfMsg('imagemaxsize'), $imageSizeId) . '</td> <td class="mw-input">' . Xml::openElement('select', array('name' => $imageSizeId, 'id' => $imageSizeId)) . $imageLimitOptions . Xml::closeElement('select') . '</td> </tr><tr> <td class="mw-label">' . Xml::label(wfMsg('thumbsize'), $thumbSizeId) . '</td> <td class="mw-input">' . Xml::openElement('select', array('name' => $thumbSizeId, 'id' => $thumbSizeId)) . $imageThumbOptions . Xml::closeElement('select') . '</td> </tr>' . Xml::closeElement('table') . Xml::closeElement('fieldset')); # Date format # # Date/Time # $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('datetime')) . "\n"); if ($dateopts) { $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('dateformat')) . "\n"); $idCnt = 0; $epoch = '20010115161234'; # Wikipedia day foreach ($dateopts as $key) { if ($key == 'default') { $formatted = wfMsg('datedefault'); } else { $formatted = $wgLang->timeanddate($epoch, false, $key); } $wgOut->addHTML(Xml::tags('div', null, Xml::radioLabel($formatted, 'wpDate', $key, "wpDate{$idCnt}", $key == $this->mDate)) . "\n"); $idCnt++; } $wgOut->addHTML(Xml::closeElement('fieldset') . "\n"); } $nowlocal = Xml::openElement('span', array('id' => 'wpLocalTime')) . $wgLang->time($now = wfTimestampNow(), true) . Xml::closeElement('span'); $nowserver = $wgLang->time($now, false) . Xml::hidden('wpServerTime', substr($now, 8, 2) * 60 + substr($now, 10, 2)); $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('timezonelegend')) . Xml::openElement('table') . $this->addRow(wfMsg('servertime'), $nowserver) . $this->addRow(wfMsg('localtime'), $nowlocal)); $opt = Xml::openElement('select', array('name' => 'wpTimeZone', 'id' => 'wpTimeZone', 'onchange' => 'javascript:updateTimezoneSelection(false)')); $opt .= Xml::option(wfMsg('timezoneuseserverdefault'), "System|{$wgLocalTZoffset}", $this->mTimeZone === "System|{$wgLocalTZoffset}"); $opt .= Xml::option(wfMsg('timezoneuseoffset'), 'Offset', $this->mTimeZone === 'Offset'); if (function_exists('timezone_identifiers_list')) { $optgroup = ''; $tzs = timezone_identifiers_list(); sort($tzs); $selZone = explode('|', $this->mTimeZone, 3); $selZone = $selZone[0] == 'ZoneInfo' ? $selZone[2] : null; $now = date_create('now'); foreach ($tzs as $tz) { $z = explode('/', $tz, 2); # timezone_identifiers_list() returns a number of # backwards-compatibility entries. This filters them out of the # list presented to the user. if (count($z) != 2 || !in_array($z[0], array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'))) { continue; } if ($optgroup != $z[0]) { if ($optgroup !== '') { $opt .= Xml::closeElement('optgroup'); } $optgroup = $z[0]; $opt .= Xml::openElement('optgroup', array('label' => $z[0])); } $minDiff = floor(timezone_offset_get(timezone_open($tz), $now) / 60); $opt .= Xml::option(str_replace('_', ' ', $tz), "ZoneInfo|{$minDiff}|{$tz}", $selZone === $tz, array('label' => $z[1])); } if ($optgroup !== '') { $opt .= Xml::closeElement('optgroup'); } } $opt .= Xml::closeElement('select'); $wgOut->addHTML($this->addRow(Xml::label(wfMsg('timezoneselect'), 'wpTimeZone'), $opt)); $wgOut->addHTML($this->addRow(Xml::label(wfMsg('timezoneoffset'), 'wpHourDiff'), Xml::input('wpHourDiff', 6, $this->mHourDiff, array('id' => 'wpHourDiff', 'onfocus' => 'javascript:updateTimezoneSelection(true)', 'onblur' => 'javascript:updateTimezoneSelection(false)'))) . "<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-submit'>" . Xml::element('input', array('type' => 'button', 'value' => wfMsg('guesstimezone'), 'onclick' => 'javascript:guessTimezone()', 'id' => 'guesstimezonebutton', 'style' => 'display:none;')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('timezonetext', 'parseinline')) . Xml::closeElement('fieldset') . Xml::closeElement('fieldset') . "\n\n"); # Editing # global $wgLivePreview; $wgOut->addHTML(Xml::fieldset(wfMsg('textboxsize')) . wfMsgHTML('prefs-edit-boxsize') . ' ' . Xml::inputLabel(wfMsg('rows'), 'wpRows', 'wpRows', 3, $this->mRows) . ' ' . Xml::inputLabel(wfMsg('columns'), 'wpCols', 'wpCols', 3, $this->mCols) . $this->getToggles(array('editsection', 'editsectiononrightclick', 'editondblclick', 'editwidth', 'showtoolbar', 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, 'forceeditsummary'))); $wgOut->addHTML(Xml::closeElement('fieldset')); # Recent changes global $wgRCMaxAge; $wgOut->addHTML(Xml::fieldset(wfMsg('prefs-rc')) . Xml::openElement('table') . '<tr> <td class="mw-label">' . Xml::label(wfMsg('recentchangesdays'), 'wpRecentDays') . '</td> <td class="mw-input">' . Xml::input('wpRecentDays', 3, $this->mRecentDays, array('id' => 'wpRecentDays')) . ' ' . wfMsgExt('recentchangesdays-max', 'parsemag', $wgLang->formatNum(ceil($wgRCMaxAge / (3600 * 24)))) . '</td> </tr><tr> <td class="mw-label">' . Xml::label(wfMsg('recentchangescount'), 'wpRecent') . '</td> <td class="mw-input">' . Xml::input('wpRecent', 3, $this->mRecent, array('id' => 'wpRecent')) . '</td> </tr>' . Xml::closeElement('table') . '<br />'); $toggles[] = 'hideminor'; if ($wgRCShowWatchingUsers) { $toggles[] = 'shownumberswatching'; } $toggles[] = 'usenewrc'; $wgOut->addHTML($this->getToggles($toggles) . Xml::closeElement('fieldset')); # Watchlist $wgOut->addHTML(Xml::fieldset(wfMsg('prefs-watchlist')) . Xml::inputLabel(wfMsg('prefs-watchlist-days'), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays) . ' ' . wfMsgHTML('prefs-watchlist-days-max') . '<br /><br />' . $this->getToggle('extendwatchlist') . Xml::inputLabel(wfMsg('prefs-watchlist-edits'), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits) . ' ' . wfMsgHTML('prefs-watchlist-edits-max') . '<br /><br />' . $this->getToggles(array('watchlisthideminor', 'watchlisthidebots', 'watchlisthideown', 'watchlisthideanons', 'watchlisthideliu'))); if ($wgUser->isAllowed('createpage') || $wgUser->isAllowed('createtalk')) { $wgOut->addHTML($this->getToggle('watchcreations')); } foreach (array('edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion') as $action => $toggle) { if ($wgUser->isAllowed($action)) { $wgOut->addHTML($this->getToggle($toggle)); } } $this->mUsedToggles['watchcreations'] = true; $this->mUsedToggles['watchdefault'] = true; $this->mUsedToggles['watchmoves'] = true; $this->mUsedToggles['watchdeletion'] = true; $wgOut->addHTML(Xml::closeElement('fieldset')); # Search $mwsuggest = $wgEnableMWSuggest ? $this->addRow(Xml::label(wfMsg('mwsuggest-disable'), 'wpDisableMWSuggest'), Xml::check('wpDisableMWSuggest', $this->mDisableMWSuggest, array('id' => 'wpDisableMWSuggest'))) : ''; $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('searchresultshead')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('prefs-searchoptions')) . Xml::openElement('table') . $this->addRow(Xml::label(wfMsg('resultsperpage'), 'wpSearch'), Xml::input('wpSearch', 4, $this->mSearch, array('id' => 'wpSearch'))) . $this->addRow(Xml::label(wfMsg('contextlines'), 'wpSearchLines'), Xml::input('wpSearchLines', 4, $this->mSearchLines, array('id' => 'wpSearchLines'))) . $this->addRow(Xml::label(wfMsg('contextchars'), 'wpSearchChars'), Xml::input('wpSearchChars', 4, $this->mSearchChars, array('id' => 'wpSearchChars'))) . $mwsuggest . Xml::closeElement('table') . Xml::closeElement('fieldset') . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('prefs-namespaces')) . wfMsgExt('defaultns', array('parse')) . $ps . Xml::closeElement('fieldset') . Xml::closeElement('fieldset')); # Misc # $wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>'); $wgOut->addHTML('<label for="wpStubs">' . wfMsg('stub-threshold') . '</label> '); $wgOut->addHTML(Xml::input('wpStubs', 6, $this->mStubs, array('id' => 'wpStubs'))); $msgUnderline = htmlspecialchars(wfMsg('tog-underline')); $msgUnderlinenever = htmlspecialchars(wfMsg('underline-never')); $msgUnderlinealways = htmlspecialchars(wfMsg('underline-always')); $msgUnderlinedefault = htmlspecialchars(wfMsg('underline-default')); $uopt = $wgUser->getOption("underline"); $s0 = $uopt == 0 ? ' selected="selected"' : ''; $s1 = $uopt == 1 ? ' selected="selected"' : ''; $s2 = $uopt == 2 ? ' selected="selected"' : ''; $wgOut->addHTML("\n<div class='toggle'><p><label for='wpOpunderline'>{$msgUnderline}</label>\n<select name='wpOpunderline' id='wpOpunderline'>\n<option value=\"0\"{$s0}>{$msgUnderlinenever}</option>\n<option value=\"1\"{$s1}>{$msgUnderlinealways}</option>\n<option value=\"2\"{$s2}>{$msgUnderlinedefault}</option>\n</select></p></div>"); foreach ($togs as $tname) { if (!array_key_exists($tname, $this->mUsedToggles)) { if ($tname == 'norollbackdiff' && $wgUser->isAllowed('rollback')) { $wgOut->addHTML($this->getToggle($tname)); } else { $wgOut->addHTML($this->getToggle($tname)); } } } $wgOut->addHTML('</fieldset>'); wfRunHooks('RenderPreferencesForm', array($this, $wgOut)); $token = htmlspecialchars($wgUser->editToken()); $skin = $wgUser->getSkin(); $wgOut->addHTML("\n\t<div id='prefsubmit'>\n\t<div>\n\t\t<input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml('saveprefs') . '"' . $skin->tooltipAndAccesskey('save') . " />\n\t\t<input type='submit' name='wpReset' value=\"" . wfMsgHtml('resetprefs') . "\" />\n\t</div>\n\n\t</div>\n\n\t<input type='hidden' name='wpEditToken' value=\"{$token}\" />\n\t</div></form>\n"); $wgOut->addHTML(Xml::tags('div', array('class' => "prefcache"), wfMsgExt('clearyourcache', 'parseinline'))); }
/** * Displays form showing the list of installed gadgets */ public function showMainForm() { global $wgOut, $wgUser, $wgLang, $wgContLang; $skin = $wgUser->getSkin(); $this->setHeaders(); $wgOut->setPagetitle(wfMsg("gadgets-title")); $wgOut->addWikiMsg('gadgets-pagetext'); $gadgets = Gadget::loadStructuredList(); if (!$gadgets) { return; } $lang = ""; if ($wgLang->getCode() != $wgContLang->getCode()) { $lang = "/" . $wgLang->getCode(); } $listOpen = false; $msgOpt = array('parseinline', 'parsemag'); $editInterfaceAllowed = $wgUser->isAllowed('editinterface'); foreach ($gadgets as $section => $entries) { if ($section !== false && $section !== '') { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-section-{$section}{$lang}"); if ($editInterfaceAllowed) { $lnkTarget = $t ? $skin->link($t, wfMsgHTML('edit'), array(), array('action' => 'edit')) : htmlspecialchars($section); $lnk = "    [{$lnkTarget}]"; } else { $lnk = ''; } $ttext = wfMsgExt("gadget-section-{$section}", $msgOpt); if ($listOpen) { $wgOut->addHTML(Xml::closeElement('ul') . "\n"); $listOpen = false; } $wgOut->addHTML(Html::rawElement('h2', array(), $ttext . $lnk) . "\n"); } foreach ($entries as $gadget) { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$gadget->getName()}{$lang}"); if (!$t) { continue; } $links = array(); if ($editInterfaceAllowed) { $links[] = $skin->link($t, wfMsgHTML('edit'), array(), array('action' => 'edit')); } $links[] = $skin->link($this->getTitle("export/{$gadget->getName()}"), wfMsgHtml('gadgets-export')); $ttext = wfMsgExt("gadget-{$gadget->getName()}", $msgOpt); if (!$listOpen) { $listOpen = true; $wgOut->addHTML(Xml::openElement('ul')); } $lnk = '  ' . wfMsg('parentheses', $wgLang->pipeList($links)); $wgOut->addHTML(Xml::openElement('li') . $ttext . $lnk . "<br />" . wfMsgHTML('gadgets-uses') . wfMsg('colon-separator')); $lnk = array(); foreach ($gadget->getScriptsAndStyles() as $codePage) { $t = Title::makeTitleSafe(NS_MEDIAWIKI, $codePage); if (!$t) { continue; } $lnk[] = $skin->link($t, htmlspecialchars($t->getText())); } $wgOut->addHTML($wgLang->commaList($lnk)); $rights = array(); foreach ($gadget->getRequiredRights() as $right) { $rights[] = '* ' . wfMessage("right-{$right}")->plain(); } if (count($rights)) { $wgOut->addHTML('<br />' . wfMessage('gadgets-required-rights', implode("\n", $rights), count($rights))->parse()); } $skins = array(); $validskins = Skin::getSkinNames(); foreach ($gadget->getRequiredSkins() as $skinid) { if (isset($validskins[$skinid])) { $skins[] = wfMessage("skinname-{$skinid}")->plain(); } else { $skins[] = $skinid; } } if (count($skins)) { $wgOut->addHTML('<br />' . wfMessage('gadgets-required-skins', $wgLang->commaList($skins), count($skins))->parse()); } if ($gadget->isOnByDefault()) { $wgOut->addHTML('<br />' . wfMessage('gadgets-default')->parse()); } $wgOut->addHTML(Xml::closeElement('li') . "\n"); } } if ($listOpen) { $wgOut->addHTML(Xml::closeElement('ul') . "\n"); } }
public static function listDrafts(&$title = null, $user = null) { global $wgOut, $wgRequest, $wgUser, $wgLang; //added twice? $wgOut->addScript('<style type="text/css" media="all">/*<![CDATA[*/ @import "' . wfGetPad('/extensions/min/f/extensions/Drafts/Drafts.css?rev=') . WH_SITEREV . '"; /*]]>*/</style>'); // Get draftID $currentDraft = Draft::newFromID($wgRequest->getIntOrNull('draft')); //based on user preference $adv = $wgUser->getOption('defaulteditor', '') == 'advanced' ? '&advanced=true' : ''; // Output HTML for list of drafts $drafts = Draft::getDrafts($title, $user); if (count($drafts) > 0) { global $egDraftsLifeSpan; // Internationalization wfLoadExtensionMessages('Drafts'); // Add a summary, on Special:Drafts only if (!$title || $title->getNamespace() == NS_SPECIAL) { $wgOut->wrapWikiMsg('<div class="mw-drafts-summary">$1</div>', array('drafts-view-summary', $wgLang->formatNum($egDraftsLifeSpan))); } // Build XML $wgOut->addHTML(Xml::openElement('table', array('cellpadding' => 5, 'cellspacing' => 0, 'border' => 0, 'id' => 'drafts-list-table', 'class' => 'section_text', 'style' => 'margin-top:15px'))); $wgOut->addHTML(Xml::openElement('tr')); $wgOut->addHTML(Xml::element('th', array('align' => 'left', 'nowrap' => 'nowrap', 'style' => 'text-align:center;'), wfMsg('drafts-view-article'))); $wgOut->addHTML(Xml::element('th', array('align' => 'left', 'nowrap' => 'nowrap', 'style' => 'text-align:center;'), wfMsg('drafts-view-saved'))); $wgOut->addHTML(Xml::element('th', array(), wfMsg('edit'))); $wgOut->addHTML(Xml::element('th', array(), wfMsg('discard'))); $wgOut->addHTML(Xml::closeElement('tr')); // Add existing drafts for this page and user $index = 0; foreach ($drafts as $draft) { // Get article title text $htmlTitle = $draft->getTitle()->getEscapedText(); // Build Article Load link if ($draft->getHTML5()) { $params = 'h5e=true&draft=' . urlencode($draft->getID()); if ($draft->getTitle()->getArticleID() == 0) { $params .= "&create-new-article=true"; } $urlLoad = $draft->getTitle()->getFullUrl($params); } else { $urlLoad = $draft->getTitle()->getFullUrl('action=edit' . $adv . '&draft=' . urlencode($draft->getID())); } // Build discard link $urlDiscard = sprintf('%s?discard=%s&token=%s', SpecialPage::getTitleFor('Drafts')->getFullUrl(), urlencode($draft->getID()), urlencode($wgUser->editToken())); // If in edit mode, return to editor if ($wgRequest->getText('action') == 'edit' || $wgRequest->getText('action') == 'submit') { $urlDiscard .= '&returnto=' . urlencode('edit'); } // Append section to titles and links if ($draft->getSection() !== null) { // Detect section name $lines = explode("\n", $draft->getText()); // If there is any content in the section if (count($lines) > 0) { $htmlTitle .= '#' . htmlspecialchars(trim(trim(substr($lines[0], 0, 255), '='))); } // Modify article link and title $urlLoad .= '§ion=' . urlencode($draft->getSection()); $urlDiscard .= '§ion=' . urlencode($draft->getSection()); } // Build XML if ($index % 2 == 1) { $wgOut->addHTML(Xml::openElement('tr', array('style' => 'background: #eee;'))); } else { $wgOut->addHTML(Xml::openElement('tr', array('style' => ''))); } $wgOut->addHTML(Xml::openElement('td', array('align' => 'left', 'class' => 'draftpage'))); $wgOut->addHTML(Xml::element('a', array('href' => $urlLoad, 'style' => 'font-weight:' . ($currentDraft->getID() == $draft->getID() ? 'bold' : 'normal')), $htmlTitle)); $wgOut->addHTML(Xml::closeElement('td')); $wgOut->addHTML(Xml::element('td', array('align' => 'left', 'nowrap' => 'nowrap', 'class' => 'draftsaved'), $wgLang->timeanddate($draft->getSaveTime(), true))); // edit link $wgOut->addHTML(Xml::openElement('td', array('align' => 'left', 'nowrap' => 'nowrap', 'class' => 'draftedit'))); $wgOut->addHTML(Xml::element('a', array('href' => $urlLoad), wfMsg('edit'))); $wgOut->addHTML(Xml::closeElement('td')); $wgOut->addHTML(Xml::openElement('td', array('align' => 'left', 'nowrap' => 'nowrap', 'class' => 'draftdiscard'))); $wgOut->addHTML(Xml::element('a', array('href' => $urlDiscard, 'onclick' => "if( true || !wgAjaxSaveDraft.insync ) return confirm('" . Xml::escapeJsString(wfMsgHTML('drafts-discard-warn', $draft->getTitle()->getText())) . "')"), wfMsg('drafts-view-discard'))); $wgOut->addHTML(Xml::closeElement('td')); $wgOut->addHTML(Xml::closeElement('tr')); $index++; } $wgOut->addHTML(Xml::closeElement('table')); // Return number of drafts return count($drafts); } return 0; }
function getNavigationBar() { global $wgLang; if (!$this->isNavigationBarShown()) { return ''; } if (isset($this->mNavigationBar)) { return $this->mNavigationBar; } $nicenumber = $wgLang->formatNum($this->mLimit); $linkTexts = array('prev' => wfMsgExt('pager-newer-n', array('parsemag', 'escape'), $nicenumber), 'next' => wfMsgExt('pager-older-n', array('parsemag', 'escape'), $nicenumber), 'first' => wfMsgHtml('histlast'), 'last' => wfMsgHtml('histfirst')); $pagingLinks = $this->getPagingLinks($linkTexts); $limitLinks = $this->getLimitLinks(); $limits = $wgLang->pipeList($limitLinks); $this->mNavigationBar = "({$pagingLinks['first']}" . wfMsgExt('pipe-separator', 'escapenoentities') . "{$pagingLinks['last']}) " . wfMsgHTML('viewprevnext', $pagingLinks['prev'], $pagingLinks['next'], $limits); return $this->mNavigationBar; }
/** * @param integer $namespace (Default NS_MAIN) * @param string $from list all pages from this name (default FALSE) */ function showChunk($namespace = NS_MAIN, $from, $including = false) { global $wgOut, $wgUser, $wgContLang; $sk = $wgUser->getSkin(); $fromList = $this->getNamespaceKeyAndText($namespace, $from); $namespaces = $wgContLang->getNamespaces(); $align = $wgContLang->isRtl() ? 'left' : 'right'; $n = 0; if (!$fromList) { $out = wfMsgWikiHtml('allpagesbadtitle'); } elseif (!in_array($namespace, array_keys($namespaces))) { // Show errormessage and reset to NS_MAIN $out = wfMsgExt('allpages-bad-ns', array('parseinline'), $namespace); $namespace = NS_MAIN; } else { list($namespace, $fromKey, $from) = $fromList; $dbr = wfGetDB(DB_SLAVE); $res = $dbr->select('page', array('page_namespace', 'page_title', 'page_is_redirect'), array('page_namespace' => $namespace, 'page_title >= ' . $dbr->addQuotes($fromKey)), __METHOD__, array('ORDER BY' => 'page_title', 'LIMIT' => $this->maxPerPage + 1, 'USE INDEX' => 'name_title')); $out = '<table style="background: inherit;" border="0" width="100%">'; while ($n < $this->maxPerPage && ($s = $dbr->fetchObject($res))) { $t = Title::makeTitle($s->page_namespace, $s->page_title); if ($t) { $link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '') . $sk->makeKnownLinkObj($t, htmlspecialchars($t->getText()), false, false) . ($s->page_is_redirect ? '</div>' : ''); } else { $link = '[[' . htmlspecialchars($s->page_title) . ']]'; } if ($n % 3 == 0) { $out .= '<tr>'; } $out .= "<td width=\"33%\">{$link}</td>"; $n++; if ($n % 3 == 0) { $out .= '</tr>'; } } if ($n % 3 != 0) { $out .= '</tr>'; } $out .= '</table>'; } if ($including) { $out2 = ''; } else { if ($from == '') { // First chunk; no previous link. $prevTitle = null; } else { # Get the last title from previous chunk $dbr = wfGetDB(DB_SLAVE); $res_prev = $dbr->select('page', 'page_title', array('page_namespace' => $namespace, 'page_title < ' . $dbr->addQuotes($from)), __METHOD__, array('ORDER BY' => 'page_title DESC', 'LIMIT' => $this->maxPerPage, 'OFFSET' => $this->maxPerPage - 1)); # Get first title of previous complete chunk if ($dbr->numrows($res_prev) >= $this->maxPerPage) { $pt = $dbr->fetchObject($res_prev); $prevTitle = Title::makeTitle($namespace, $pt->page_title); } else { # The previous chunk is not complete, need to link to the very first title # available in the database $options = array('LIMIT' => 1); if (!$dbr->implicitOrderby()) { $options['ORDER BY'] = 'page_title'; } $reallyFirstPage_title = $dbr->selectField('page', 'page_title', array('page_namespace' => $namespace), __METHOD__, $options); # Show the previous link if it s not the current requested chunk if ($from != $reallyFirstPage_title) { $prevTitle = Title::makeTitle($namespace, $reallyFirstPage_title); } else { $prevTitle = null; } } } $nsForm = $this->namespaceForm($namespace, $from); $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; $out2 .= '<tr valign="top"><td>' . $nsForm; $out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">' . $sk->makeKnownLink($wgContLang->specialPage("Allpages"), wfMsgHtml('allpages')); $self = SpecialPage::getTitleFor('Allpages'); # Do we put a previous link ? if (isset($prevTitle) && ($pt = $prevTitle->getText())) { $q = 'from=' . $prevTitle->getPartialUrl() . ($namespace ? '&namespace=' . $namespace : ''); $prevLink = $sk->makeKnownLinkObj($self, wfMsgHTML('prevpage', $pt), $q); $out2 .= ' | ' . $prevLink; } if ($n == $this->maxPerPage && ($s = $dbr->fetchObject($res))) { # $s is the first link of the next chunk $t = Title::MakeTitle($namespace, $s->page_title); $q = 'from=' . $t->getPartialUrl() . ($namespace ? '&namespace=' . $namespace : ''); $nextLink = $sk->makeKnownLinkObj($self, wfMsgHtml('nextpage', $t->getText()), $q); $out2 .= ' | ' . $nextLink; } $out2 .= "</td></tr></table><hr />"; } $wgOut->addHtml($out2 . $out); if (isset($prevLink) or isset($nextLink)) { $wgOut->addHtml('<hr /><p style="font-size: smaller; float: ' . $align . '">'); if (isset($prevLink)) { $wgOut->addHTML($prevLink); } if (isset($prevLink) && isset($nextLink)) { $wgOut->addHTML(' | '); } if (isset($nextLink)) { $wgOut->addHTML($nextLink); } $wgOut->addHTML('</p>'); } }
function onDifferenceEngineGetRevisionHeader($differenceEngine, &$header, $state, $rev) { if ($state == 'new') { if ($rev->isCurrent()) { $header = htmlspecialchars(wfMsg('currentrev')); } else { $header = wfMsgHTML('revisionasof', wfTimeAgo($differenceEngine->mNewRev->getTimestamp())); } } elseif ($state == 'old') { $header = "Old Revision"; } return true; }
/** * Displays form to create wiki */ protected function _executeCreate($wgFarmer, $wiki) { global $wgOut, $wgUser, $wgRequest; if (!$wgFarmer->getActiveWiki()->isDefaultWiki()) { $wgOut->wrapWikiMsg('== $1 ==', 'farmer-notavailable'); $wgOut->addWikiMsg('farmer-notavailable-text'); return; } if (!MediaWikiFarmer::userCanCreateWiki($wgUser, $wiki)) { $wgOut->addWikiMsg('farmercantcreatewikis'); return; } $name = MediaWikiFarmer_Wiki::sanitizeName($wgRequest->getVal('wpName', $wiki)); $title = MediaWikiFarmer_Wiki::sanitizeTitle($wgRequest->getVal('wpTitle')); $description = $wgRequest->getVal('wpDescription', ''); $reason = $wgRequest->getVal('wpReason'); $action = $this->getTitle('create')->escapeLocalURL(); // if something was POST'd if ($wgRequest->wasPosted()) { // we create the wiki if the user pressed 'Confirm' if ($wgRequest->getCheck('wpConfirm')) { $wikiObj = MediaWikiFarmer_Wiki::newFromParams($name, $title, $description, $wgUser->getName()); $wikiObj->create(); $log = new LogPage('farmer'); $log->addEntry('create', $this->getTitle(), $reason, array($name)); $wgOut->wrapWikiMsg('== $1 ==', 'farmer-wikicreated'); $wgOut->addWikiMsg('farmer-wikicreated-text', $wikiObj->getUrl(wfUrlencode(wfMessage('mainpage')->inContentLanguage()->useDatabase(false)->plain()))); $wgOut->addWikiMsg('farmer-default', '[[' . $title . ':Special:Farmer|Special:Farmer]]'); return; } if ($name && $title && $description) { $wiki = new MediaWikiFarmer_Wiki($name); if ($wiki->exists() || $wiki->databaseExists()) { $wgOut->wrapWikiMsg("== \$1 ==\n\n\$2", 'farmer-wikiexists', array('farmer-wikiexists-text', $name)); return; } $url = $wiki->getUrl(''); $wgOut->wrapWikiMsg('== $1 ==', 'farmer-confirmsetting'); $wgOut->addHtml(Xml::openElement('table', array('class' => 'wikitable')) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-name', 'parseinline')) . Xml::element('td', array(), $name)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-title', 'parseinline')) . Xml::element('td', array(), $title)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-description', 'parseinline')) . Xml::element('td', array(), $description)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-reason', 'parseinline')) . Xml::element('td', array(), $reason)) . "\n" . Xml::closeElement('table')); $wgOut->addWikiMsg('farmer-confirmsetting-text', $name, $title, $url); $nameaccount = htmlspecialchars($name); $nametitle = htmlspecialchars($title); $namedescript = htmlspecialchars($description); $confirmaccount = wfMsgHtml('farmer-button-confirm'); $wgOut->addHTML("\n\n<form id=\"farmercreate2\" method=\"post\" action=\"{$action}\">\n<input type=\"hidden\" name=\"wpName\" value=\"{$nameaccount}\" />\n<input type=\"hidden\" name=\"wpTitle\" value=\"{$nametitle}\" />\n<input type=\"hidden\" name=\"wpDescription\" value=\"{$namedescript}\" />\n<input type=\"hidden\" name=\"wpReason\" value=\"{$reason}\" />\n<input type=\"submit\" name=\"wpConfirm\" value=\"{$confirmaccount}\" />\n</form>"); return; } } if ($wiki && !$name) { $name = $wiki; } $wgOut->wrapWikiMsg("== \$1 ==\n\$2\n== \$3 ==\n\$4\n\$5\n\$6", 'farmer-createwiki-form-title', 'farmer-createwiki-form-text1', 'farmer-createwiki-form-help', 'farmer-createwiki-form-text2', 'farmer-createwiki-form-text3', 'farmer-createwiki-form-text4'); $formURL = wfMsgHTML('farmercreateurl'); $formSitename = wfMsgHTML('farmercreatesitename'); $formNextStep = wfMsgHTML('farmercreatenextstep'); $token = htmlspecialchars($wgUser->editToken()); $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $action)) . "\n" . Xml::buildForm(array('farmer-createwiki-user' => Xml::element('b', array(), $wgUser->getName()), 'farmer-createwiki-name' => Xml::input('wpName', 20, $name), 'farmer-createwiki-title' => Xml::input('wpTitle', 20, $title), 'farmer-createwiki-description' => Xml::textarea('wpDescription', $description), 'farmer-createwiki-reason' => Xml::input('wpReason', 20, $reason)), 'farmer-button-submit') . "\n" . Html::Hidden('token', $token) . "\n" . Xml::closeElement('form')); }
function initSyncDirectionTpl() { global $wgServer, $wgScriptPath; return array( array( '__tag'=>'div', 'style'=>'width:100%; font-weight:bold; text-align:center; ', wfMsgHTML( 'wikisync_direction' ) ), array( '__tag'=>'table', 'style'=>'margin:0 auto 0 auto; ', array( '__tag'=>'tr', array( '__tag'=>'td', 'style'=>'text-align:right; ', wfMsgHTML( 'wikisync_local_root' ) ), array( '__tag'=>'td', 'rowspan'=>'2', 'style'=>'vertical-align:middle; ', array( '__tag'=>'input', 'id'=>'wikisync_direction_button', 'type'=>'button', 'value'=>'<=', 'onclick'=>'return WikiSync.switchDirection(this)' ) ), array( '__tag'=>'td', wfMsgHTML( 'wikisync_remote_root' ) ) ), array( '__tag'=>'tr', array( '__tag'=>'td', 'style'=>'text-align:right; ', $wgServer . $wgScriptPath ), array( '__tag'=>'td', 'id'=>'wikisync_remote_root', WikiSyncSetup::$remote_wiki_root ) ) ) ); }