/**
  * Implement by redirecting through Special:Redirect/file.
  *
  * @param string|null $subpage
  * @return Title
  */
 public function getRedirect($par)
 {
     $file = $par ?: $this->getRequest()->getText('file');
     if ($file) {
         $argument = "file/{$file}";
     } else {
         $argument = 'file';
     }
     return SpecialPage::getSafeTitleFor('Redirect', $argument);
 }
 function formatValue($name, $value)
 {
     switch ($name) {
         case 'cc_rev_id':
             return $this->mView->skin->link(SpecialPage::getSafeTitleFor('Code', $this->mRepo->getName() . '/' . $value . '#code-comments'), htmlspecialchars($value));
         case 'cr_status':
             return $this->mView->skin->link(SpecialPage::getTitleFor('Code', $this->mRepo->getName() . '/status/' . $value), htmlspecialchars($this->mView->statusDesc($value)));
         case 'cc_user_text':
             return $this->mView->skin->userLink(-1, $value);
         case 'cr_message':
             return $this->mView->messageFragment($value);
         case 'cc_text':
             return $this->mView->messageFragment($value);
         case 'cc_timestamp':
             global $wgLang;
             return $wgLang->timeanddate($value, true);
     }
 }
Exemple #3
0
 function topLinks()
 {
     global $wgOut, $wgUser, $wgEnableUploads;
     $sep = " |\n";
     $s = $this->mainPageLink() . $sep . $this->specialLink('recentchanges');
     if ($wgOut->isArticle()) {
         $s .= $sep . '<strong>' . $this->editThisPage() . '</strong>' . $sep . $this->historyLink();
     }
     /* show links to different language variants */
     $s .= $this->variantLinks();
     $s .= $this->extensionTabLinks();
     if ($wgUser->isAnon()) {
         $s .= $sep . $this->specialLink('userlogin');
     } else {
         $name = $wgUser->getName();
         /* show user page and user talk links */
         $s .= $sep . $this->link($wgUser->getUserPage(), wfMsgHtml('mypage'));
         $s .= $sep . $this->link($wgUser->getTalkPage(), wfMsgHtml('mytalk'));
         if ($wgUser->getNewtalk()) {
             $s .= ' *';
         }
         /* show watchlist link */
         $s .= $sep . $this->specialLink('watchlist');
         /* show my contributions link */
         $s .= $sep . $this->link(SpecialPage::getSafeTitleFor('Contributions', $wgUser->getName()), wfMsgHtml('mycontris'));
         /* show my preferences link */
         $s .= $sep . $this->specialLink('preferences');
         /* show upload file link */
         if ($wgEnableUploads) {
             $s .= $sep . $this->specialLink('upload');
         }
         /* show log out link */
         $s .= $sep . $this->specialLink('userlogout');
     }
     $s .= $sep . $this->specialPagesList();
     return $s;
 }
 /**
  * @return string
  */
 function topLinks()
 {
     $sep = " |\n";
     $s = $this->getSkin()->mainPageLink() . $sep . Linker::specialLink('Recentchanges');
     if ($this->data['isarticle']) {
         $s .= $sep . '<strong>' . $this->editThisPage() . '</strong>' . $sep . $this->talkLink() . $sep . $this->historyLink();
     }
     /* show links to different language variants */
     $s .= $this->variantLinks();
     $s .= $this->extensionTabLinks();
     if (!$this->data['loggedin']) {
         $s .= $sep . Linker::specialLink('Userlogin');
     } else {
         /* show user page and user talk links */
         $user = $this->getSkin()->getUser();
         $s .= $sep . Linker::link($user->getUserPage(), wfMsgHtml('mypage'));
         $s .= $sep . Linker::link($user->getTalkPage(), wfMsgHtml('mytalk'));
         if ($user->getNewtalk()) {
             $s .= ' *';
         }
         /* show watchlist link */
         $s .= $sep . Linker::specialLink('Watchlist');
         /* show my contributions link */
         $s .= $sep . Linker::link(SpecialPage::getSafeTitleFor('Contributions', $this->data['username']), wfMsgHtml('mycontris'));
         /* show my preferences link */
         $s .= $sep . Linker::specialLink('Preferences');
         /* show upload file link */
         if (UploadBase::isEnabled() && UploadBase::isAllowed($user) === true) {
             $s .= $sep . $this->getUploadLink();
         }
         /* show log out link */
         $s .= $sep . Linker::specialLink('Userlogout');
     }
     $s .= $sep . $this->specialPagesList();
     return $s;
 }
Exemple #5
0
 /**
  * Compute the sidebar
  * @access private
  *
  * @return string
  */
 function quickBar()
 {
     $s = "\n<div id='quickbar'>";
     $sep = '<br />';
     $s .= $this->menuHead('qbfind');
     $s .= $this->searchForm();
     $s .= $this->menuHead('qbbrowse');
     # Use the first heading from the Monobook sidebar as the "browse" section
     $bar = $this->getSkin()->buildSidebar();
     unset($bar['SEARCH']);
     unset($bar['LANGUAGES']);
     unset($bar['TOOLBOX']);
     $barnumber = 1;
     foreach ($bar as $heading => $browseLinks) {
         if ($barnumber > 1) {
             $headingMsg = wfMessage($heading);
             if ($headingMsg->exists()) {
                 $h = $headingMsg->text();
             } else {
                 $h = $heading;
             }
             $s .= "\n<h6>" . htmlspecialchars($h) . "</h6>";
         }
         if (is_array($browseLinks)) {
             foreach ($browseLinks as $link) {
                 if ($link['text'] != '-') {
                     $s .= "<a href=\"{$link['href']}\">" . htmlspecialchars($link['text']) . '</a>' . $sep;
                 }
             }
         }
         $barnumber++;
     }
     $user = $this->getSkin()->getUser();
     if ($this->data['isarticle']) {
         $s .= $this->menuHead('qbedit');
         $s .= '<strong>' . $this->editThisPage() . '</strong>';
         $s .= $sep . Linker::linkKnown(Title::newFromText(wfMsgForContent('edithelppage')), wfMsg('edithelp'));
         if ($this->data['loggedin']) {
             $s .= $sep . $this->moveThisPage();
         }
         if ($user->isAllowed('delete')) {
             $dtp = $this->deleteThisPage();
             if ($dtp != '') {
                 $s .= $sep . $dtp;
             }
         }
         if ($user->isAllowed('protect')) {
             $ptp = $this->protectThisPage();
             if ($ptp != '') {
                 $s .= $sep . $ptp;
             }
         }
         $s .= $sep;
         $s .= $this->menuHead('qbpageoptions');
         $s .= $this->talkLink() . $sep . $this->commentLink() . $sep . $this->printableLink();
         if ($this->data['loggedin']) {
             $s .= $sep . $this->watchThisPage();
         }
         $s .= $sep;
         $s .= $this->menuHead('qbpageinfo') . $this->historyLink() . $sep . $this->whatLinksHere() . $sep . $this->watchPageLinksLink();
         $title = $this->getSkin()->getTitle();
         $tns = $title->getNamespace();
         if ($tns == NS_USER || $tns == NS_USER_TALK) {
             $id = User::idFromName($title->getText());
             if ($id != 0) {
                 $s .= $sep . $this->userContribsLink();
                 if ($this->getSkin()->showEmailUser($id)) {
                     $s .= $sep . $this->emailUserLink();
                 }
             }
         }
         $s .= $sep;
     }
     $s .= $this->menuHead('qbmyoptions');
     if ($this->data['loggedin']) {
         $tl = Linker::link($user->getTalkPage(), wfMsg('mytalk'), array(), array(), array('known', 'noclasses'));
         if ($user->getNewtalk()) {
             $tl .= ' *';
         }
         $s .= Linker::link($user->getUserPage(), wfMsg('mypage'), array(), array(), array('known', 'noclasses')) . $sep . $tl . $sep . Linker::specialLink('Watchlist') . $sep . Linker::link(SpecialPage::getSafeTitleFor('Contributions', $user->getName()), wfMsg('mycontris'), array(), array(), array('known', 'noclasses')) . $sep . Linker::specialLink('Preferences') . $sep . Linker::specialLink('Userlogout');
     } else {
         $s .= Linker::specialLink('Userlogin');
     }
     $s .= $this->menuHead('qbspecialpages') . Linker::specialLink('Newpages') . $sep . Linker::specialLink('Listfiles') . $sep . Linker::specialLink('Statistics');
     if (UploadBase::isEnabled() && UploadBase::isAllowed($user) === true) {
         $s .= $sep . $this->getUploadLink();
     }
     global $wgSiteSupportPage;
     if ($wgSiteSupportPage) {
         $s .= $sep . '<a href="' . htmlspecialchars($wgSiteSupportPage) . '" class="internal">' . wfMsg('sitesupport') . '</a>';
     }
     $s .= $sep . Linker::link(SpecialPage::getTitleFor('Specialpages'), wfMsg('moredotdotdot'), array(), array(), array('known', 'noclasses'));
     $s .= $sep . "\n</div>\n";
     return $s;
 }
 /**
  * Creates the HTML for a navigation bar to show long lists of results.
  * Most of the parameters are taken from the object members.
  *
  * @todo I18N: message patchworking
  *
  * @param integer $count How many results are currently displayed?
  * @return string  HTML with the navigation bar
  */
 protected function getNavigationBar($count)
 {
     global $smwgQMaxInlineLimit;
     if ($this->offset > 0) {
         $navigation = Html::element('a', array('href' => SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('offset' => max(0, $this->offset - $this->limit), 'limit' => $this->limit, 'property' => $this->property->getWikiValue(), 'value' => $this->value->getWikiValue()))), wfMessage('smw_result_prev')->text());
     } else {
         $navigation = wfMessage('smw_result_prev')->text();
     }
     // TODO i18n: patchwork messages
     $navigation .= '&#160;&#160;&#160;&#160; <b>' . wfMessage('smw_result_results')->text() . ' ' . ($this->offset + 1) . '– ' . ($this->offset + min($count, $this->limit)) . '</b>&#160;&#160;&#160;&#160;';
     if ($count > $this->limit) {
         $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('offset' => $this->offset + $this->limit, 'limit' => $this->limit, 'property' => $this->property->getWikiValue(), 'value' => $this->value->getWikiValue()))), wfMessage('smw_result_next')->text());
     } else {
         $navigation .= wfMessage('smw_result_next')->text();
     }
     // Find out which limit values to offer for navigation
     $limits = array();
     foreach (array(20, 50, 100, 250, 500) as $l) {
         if ($l < $smwgQMaxInlineLimit) {
             $limits[] = $l;
         } else {
             $limits[] = $smwgQMaxInlineLimit;
             break;
         }
     }
     $first = true;
     foreach ($limits as $l) {
         if ($first) {
             $navigation .= '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(';
             $first = false;
         } else {
             $navigation .= ' ' . wfMessage('pipe-separator')->escaped() . ' ';
         }
         if ($this->limit != $l) {
             $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('offset' => $this->offset, 'limit' => $l, 'property' => $this->property->getWikiValue(), 'value' => $this->value->getWikiValue()))), $l);
         } else {
             $navigation .= '<b>' . $l . '</b>';
         }
     }
     $navigation .= ')';
     return $navigation;
 }
 /**
  * Callback function to output a block
  */
 function formatRow($block)
 {
     global $wgUser, $wgLang;
     wfProfileIn(__METHOD__);
     static $sk = null, $msg = null;
     if (is_null($sk)) {
         $sk = $wgUser->getSkin();
     }
     if (is_null($msg)) {
         $msg = array();
         $keys = array('infiniteblock', 'expiringblock', 'contribslink', 'unblocklink', 'anononlyblock', 'createaccountblock', 'noautoblockblock');
         foreach ($keys as $key) {
             $msg[$key] = wfMsgHtml($key);
         }
         $msg['blocklistline'] = wfMsg('blocklistline');
         $msg['contribslink'] = wfMsg('contribslink');
     }
     # Prepare links to the blocker's user and talk pages
     $blocker_id = $block->getBy();
     $blocker_name = $block->getByName();
     $blocker = $sk->userLink($blocker_id, $blocker_name);
     $blocker .= $sk->userToolLinks($blocker_id, $blocker_name);
     # Prepare links to the block target's user and contribs. pages (as applicable, don't do it for autoblocks)
     if ($block->mAuto) {
         $target = $block->getRedactedName();
         # Hide the IP addresses of auto-blocks; privacy
     } else {
         $target = $sk->makeLinkObj(Title::makeTitle(NS_USER, $block->mAddress), $block->mAddress);
         $target .= ' (' . $sk->makeKnownLinkObj(SpecialPage::getSafeTitleFor('Contributions', $block->mAddress), $msg['contribslink']) . ')';
     }
     $formattedTime = $wgLang->timeanddate($block->mTimestamp, true);
     $properties = array();
     if ($block->mExpiry === "" || $block->mExpiry === Block::infinity()) {
         $properties[] = $msg['infiniteblock'];
     } else {
         $properties[] = wfMsgReplaceArgs($msg['expiringblock'], array($wgLang->timeanddate($block->mExpiry, true)));
     }
     if ($block->mAnonOnly) {
         $properties[] = $msg['anononlyblock'];
     }
     if ($block->mCreateAccount) {
         $properties[] = $msg['createaccountblock'];
     }
     if (!$block->mEnableAutoblock && $block->mUser) {
         $properties[] = $msg['noautoblockblock'];
     }
     $properties = implode(', ', $properties);
     $line = wfMsgReplaceArgs($msg['blocklistline'], array($formattedTime, $blocker, $target, $properties));
     $s = "<li>{$line}";
     if ($wgUser->isAllowed('block')) {
         $titleObj = SpecialPage::getTitleFor("Ipblocklist");
         $s .= ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode($block->mId)) . ')';
     }
     $s .= $sk->commentBlock($block->mReason);
     $s .= "</li>\n";
     wfProfileOut(__METHOD__);
     return $s;
 }
Exemple #8
0
 /**
  * Compute the sidebar
  * @access private
  */
 function quickBar()
 {
     global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
     $tns = $wgTitle->getNamespace();
     $s = "\n<div id='quickbar'>";
     $sep = "<br />";
     $s .= $this->menuHead("qbfind");
     $s .= $this->searchForm();
     $s .= $this->menuHead("qbbrowse");
     # Use the first heading from the Monobook sidebar as the "browse" section
     $bar = $this->buildSidebar();
     unset($bar['SEARCH']);
     unset($bar['LANGUAGES']);
     unset($bar['TOOLBOX']);
     $browseLinks = reset($bar);
     foreach ($browseLinks as $link) {
         if ($link['text'] != '-') {
             $s .= "<a href=\"{$link['href']}\">" . htmlspecialchars($link['text']) . '</a>' . $sep;
         }
     }
     if ($wgOut->isArticle()) {
         $s .= $this->menuHead("qbedit");
         $s .= "<strong>" . $this->editThisPage() . "</strong>";
         $s .= $sep . $this->makeKnownLink(wfMsgForContent("edithelppage"), wfMsg("edithelp"));
         if ($wgUser->isLoggedIn()) {
             $s .= $sep . $this->moveThisPage();
         }
         if ($wgUser->isAllowed('delete')) {
             $dtp = $this->deleteThisPage();
             if ("" != $dtp) {
                 $s .= $sep . $dtp;
             }
         }
         if ($wgUser->isAllowed('protect')) {
             $ptp = $this->protectThisPage();
             if ("" != $ptp) {
                 $s .= $sep . $ptp;
             }
         }
         $s .= $sep;
         $s .= $this->menuHead("qbpageoptions");
         $s .= $this->talkLink() . $sep . $this->commentLink() . $sep . $this->printableLink();
         if ($wgUser->isLoggedIn()) {
             $s .= $sep . $this->watchThisPage();
         }
         $s .= $sep;
         $s .= $this->menuHead("qbpageinfo") . $this->historyLink() . $sep . $this->whatLinksHere() . $sep . $this->watchPageLinksLink();
         if ($tns == NS_USER || $tns == NS_USER_TALK) {
             $id = User::idFromName($wgTitle->getText());
             if ($id != 0) {
                 $s .= $sep . $this->userContribsLink();
                 if ($this->showEmailUser($id)) {
                     $s .= $sep . $this->emailUserLink();
                 }
             }
         }
         $s .= $sep;
     }
     $s .= $this->menuHead("qbmyoptions");
     if ($wgUser->isLoggedIn()) {
         $name = $wgUser->getName();
         $tl = $this->makeKnownLinkObj($wgUser->getTalkPage(), wfMsg('mytalk'));
         if ($wgUser->getNewtalk()) {
             $tl .= " *";
         }
         $s .= $this->makeKnownLinkObj($wgUser->getUserPage(), wfMsg("mypage")) . $sep . $tl . $sep . $this->specialLink("watchlist") . $sep . $this->makeKnownLinkObj(SpecialPage::getSafeTitleFor("Contributions", $wgUser->getName()), wfMsg("mycontris")) . $sep . $this->specialLink("preferences") . $sep . $this->specialLink("userlogout");
     } else {
         $s .= $this->specialLink("userlogin");
     }
     $s .= $this->menuHead("qbspecialpages") . $this->specialLink("newpages") . $sep . $this->specialLink("imagelist") . $sep . $this->specialLink("statistics") . $sep . $this->bugReportsLink();
     if ($wgUser->isLoggedIn() && $wgEnableUploads) {
         $s .= $sep . $this->specialLink("upload");
     }
     global $wgSiteSupportPage;
     if ($wgSiteSupportPage) {
         $s .= $sep . "<a href=\"" . htmlspecialchars($wgSiteSupportPage) . "\" class =\"internal\">" . wfMsg("sitesupport") . "</a>";
     }
     $s .= $sep . $this->makeKnownLinkObj(SpecialPage::getTitleFor('Specialpages'), wfMsg('moredotdotdot'));
     $s .= $sep . "\n</div>\n";
     return $s;
 }
 /**
  * Generate the generic "this page has been changed" e-mail text.
  */
 private function composeCommonMailtext()
 {
     global $wgPasswordSender, $wgNoReplyAddress;
     global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
     global $wgEnotifImpersonal, $wgEnotifUseRealName;
     $this->composed_common = true;
     # You as the WikiAdmin and Sysops can make use of plenty of
     # named variables when composing your notification emails while
     # simply editing the Meta pages
     $keys = array();
     $postTransformKeys = array();
     $pageTitleUrl = $this->title->getCanonicalURL();
     $pageTitle = $this->title->getPrefixedText();
     if ($this->oldid) {
         // Always show a link to the diff which triggered the mail. See bug 32210.
         $keys['$NEWPAGE'] = "\n\n" . wfMessage('enotif_lastdiff', $this->title->getCanonicalURL(array('diff' => 'next', 'oldid' => $this->oldid)))->inContentLanguage()->text();
         if (!$wgEnotifImpersonal) {
             // For personal mail, also show a link to the diff of all changes
             // since last visited.
             $keys['$NEWPAGE'] .= "\n\n" . wfMessage('enotif_lastvisited', $this->title->getCanonicalURL(array('diff' => '0', 'oldid' => $this->oldid)))->inContentLanguage()->text();
         }
         $keys['$OLDID'] = $this->oldid;
         // Deprecated since MediaWiki 1.21, not used by default. Kept for backwards-compatibility.
         $keys['$CHANGEDORCREATED'] = wfMessage('changed')->inContentLanguage()->text();
     } else {
         # clear $OLDID placeholder in the message template
         $keys['$OLDID'] = '';
         $keys['$NEWPAGE'] = '';
         // Deprecated since MediaWiki 1.21, not used by default. Kept for backwards-compatibility.
         $keys['$CHANGEDORCREATED'] = wfMessage('created')->inContentLanguage()->text();
     }
     $keys['$PAGETITLE'] = $this->title->getPrefixedText();
     $keys['$PAGETITLE_URL'] = $this->title->getCanonicalURL();
     $keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMessage('minoredit')->inContentLanguage()->text() : '';
     $keys['$UNWATCHURL'] = $this->title->getCanonicalURL('action=unwatch');
     if ($this->editor->isAnon()) {
         # real anon (user:xxx.xxx.xxx.xxx)
         $keys['$PAGEEDITOR'] = wfMessage('enotif_anon_editor', $this->editor->getName())->inContentLanguage()->text();
         $keys['$PAGEEDITOR_EMAIL'] = wfMessage('noemailtitle')->inContentLanguage()->text();
     } else {
         $keys['$PAGEEDITOR'] = $wgEnotifUseRealName && $this->editor->getRealName() !== '' ? $this->editor->getRealName() : $this->editor->getName();
         $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $this->editor->getName());
         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalURL();
     }
     $keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalURL();
     $keys['$HELPPAGE'] = wfExpandUrl(Skin::makeInternalOrExternalUrl(wfMessage('helppage')->inContentLanguage()->text()));
     # Replace this after transforming the message, bug 35019
     $postTransformKeys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary;
     // Now build message's subject and body
     // Messages:
     // enotif_subject_deleted, enotif_subject_created, enotif_subject_moved,
     // enotif_subject_restored, enotif_subject_changed
     $this->subject = wfMessage('enotif_subject_' . $this->pageStatus)->inContentLanguage()->params($pageTitle, $keys['$PAGEEDITOR'])->text();
     // Messages:
     // enotif_body_intro_deleted, enotif_body_intro_created, enotif_body_intro_moved,
     // enotif_body_intro_restored, enotif_body_intro_changed
     $keys['$PAGEINTRO'] = wfMessage('enotif_body_intro_' . $this->pageStatus)->inContentLanguage()->params($pageTitle, $keys['$PAGEEDITOR'], $pageTitleUrl)->text();
     $body = wfMessage('enotif_body')->inContentLanguage()->plain();
     $body = strtr($body, $keys);
     $body = MessageCache::singleton()->transform($body, false, null, $this->title);
     $this->body = wordwrap(strtr($body, $postTransformKeys), 72);
     # Reveal the page editor's address as REPLY-TO address only if
     # the user has not opted-out and the option is enabled at the
     # global configuration level.
     $adminAddress = new MailAddress($wgPasswordSender, wfMessage('emailsender')->inContentLanguage()->text());
     if ($wgEnotifRevealEditorAddress && $this->editor->getEmail() != '' && $this->editor->getOption('enotifrevealaddr')) {
         $editorAddress = MailAddress::newFromUser($this->editor);
         if ($wgEnotifFromEditor) {
             $this->from = $editorAddress;
         } else {
             $this->from = $adminAddress;
             $this->replyto = $editorAddress;
         }
     } else {
         $this->from = $adminAddress;
         $this->replyto = new MailAddress($wgNoReplyAddress);
     }
 }
 /**
  * Creates the HTML for a link to this page, with some parameters set.
  *
  * @param[in] $text string  The anchor text for the link
  * @param[in] $out bool  Should the linked to page include outgoing properties?
  * @param[in] $in bool  Should the linked to page include incoming properties?
  * @param[in] $offset int  What is the offset for the incoming properties?
  *
  * @return string  HTML with the link to this page
  */
 private function linkHere($text, $out, $in, $offset)
 {
     $frag = $text == wfMessage('smw_browse_show_incoming')->text() ? '#smw_browse_incoming' : '';
     return Html::element('a', array('href' => \SpecialPage::getSafeTitleFor('Browse')->getLocalURL(array('offset' => $offset, 'dir' => $out ? $in ? 'both' : 'out' : 'in', 'article' => $this->subject->getLongWikiText())) . $frag), $text);
 }
    private function printFooterThings()
    {
        // prepare login token:
        $loginToken = MWCryptRand::generateHex(32);
        if ($this->getSkin()->getTitle()->getText() != 'UserLogin') {
            // Skin userlogin page to avoid collision
            if (session_id() == '') {
                wfSetupSession();
            }
            $this->getSkin()->getRequest()->setSessionData('wsLoginToken', $loginToken);
        }
        ?>

<div class="why-sign-up-popup mobile-form-popup">
    <h3>
        <?php 
        echo wfMessage('settlein-skin-modal-whysignup-title')->plain();
        ?>
    </h3>

    <?php 
        echo wfMessage('settlein-skin-modal-whysignup-text')->plain();
        ?>

</div>

<!-- Login popup form & wrapper -->
<div id="login-popup-wrapper">
</div>

<div class="login-popup-form mobile-form-popup">
    <h3>
        <?php 
        echo wfMessage('settlein-skin-modal-login-title')->plain();
        ?>
    </h3>

    <p>
        <?php 
        echo wfMessage('settlein-skin-modal-login-subtitle')->plain();
        ?>
    </p>

    <form class="" method="post" action="<?php 
        echo SpecialPage::getSafeTitleFor('UserLogin')->getFullURL('action=submitlogin&type=login');
        ?>
">
        <div class="form-group">
            <input type="text" class="form-control" placeholder="<?php 
        echo wfMessage('settlein-skin-modal-login-email-placeholder')->plain();
        ?>
" name="wpName" />
        </div>
        <div class="form-group">
            <input type="password" class="form-control" placeholder="<?php 
        echo wfMessage('settlein-skin-modal-login-password-placeholder')->plain();
        ?>
" name="wpPassword" />
        </div>
        <input type="hidden" name="wpLoginToken" value="<?php 
        echo $loginToken;
        ?>
" />
        <input type="hidden" name="wpRemember" value="1" />
        <div class="form-group">
            <input type="submit" name="wpLoginAttempt" class="btn btn-primary" value="<?php 
        echo wfMessage('settlein-skin-modal-login-login-button')->plain();
        ?>
"/>
            <a href="<?php 
        echo SpecialPage::getSafeTitleFor('Userlogin')->getFullURL('type=signup');
        ?>
" class="btn btn-cyanide">
                <?php 
        echo wfMessage('settlein-skin-modal-login-signup-button')->plain();
        ?>
            </a>
            <a href="<?php 
        echo SpecialPage::getSafeTitleFor('PasswordReset')->getFullURL();
        ?>
" class="pull-right">
                <?php 
        echo wfMessage('settlein-skin-modal-login-reset-password')->plain();
        ?>
            </a>
        </div>
    </form>
</div>

<!-- Add new article popup form & wrapper -->
<div id="add-new-article-popup-wrapper">
</div>

<div class="add-new-article-popup-form">
    <h3>
	    <?php 
        echo wfMessage('settlein-skin-add-new-article-window-title')->plain();
        ?>
    </h3>
	<p>
		<?php 
        echo wfMessage('settlein-skin-add-new-article-window-description')->plain();
        ?>
	</p>
	<form class="" method="post" action="" >
		<div class="form-group">
			<label for="new_pageTitle"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-field-title')->plain();
        ?>
</label>
			<input type="text" class="form-control" placeholder="" name="Card[Title]" id="new_pageTitle" />
		</div>
		<div class="form-group">
			<label for="new_pageCategory"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-field-category')->plain();
        ?>
</label>
			<select class="form-control" name="Card[Tags]" id="new_pageCategory">
                <option></option>
				<?php 
        foreach ($this->categoriesList as $category) {
            ?>
                    <option value="<?php 
            echo $category;
            ?>
"><?php 
            echo $category;
            ?>
</option>
                <?php 
        }
        ?>
			</select>
		</div>
		<div class="form-group settle-geo-input" data-geo-type="country" data-state-input-name="new_pageState" data-city-input-name="new_pageCity">
			<label for="new_pageCountry"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-field-country')->plain();
        ?>
</label>
			<select class="form-control" name="Card[Country]" id="new_pageCountry">
                <option></option>
				<?php 
        foreach ($this->countriesList as $val) {
            ?>
					<option data-geo-id="<?php 
            echo $val['geonamesCode'];
            ?>
" value="<?php 
            echo $val['name'];
            ?>
"><?php 
            echo $val['name'];
            ?>
</option>
					<?php 
        }
        ?>
			</select>
		</div>
        <div class="form-group settle-geo-input" data-geo-type="state" data-city-input-name="new_pageCity">
            <label for="new_pageState"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-field-state')->plain();
        ?>
</label>
            <select class="form-control" name="Card[State]" id="new_pageState"></select>
        </div>
        <div class="form-group settle-geo-input" data-geo-type="city">
            <label for="new_pageCity"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-field-city')->plain();
        ?>
</label>
            <select class="form-control" name="Card[City]" id="new_pageCity"></select>
        </div>
		<div class="form-group">
			<label for="new_pageLanguage"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-field-language')->plain();
        ?>
</label>
            <select class="form-control" name="pageLanguage" id="new_pageLanguage" style="display: none;">
	            <?php 
        foreach ($this->connectedLanguagesList as $langCode => $langText) {
            ?>
		            <option value="<?php 
            echo $langCode;
            ?>
"><?php 
            echo $langText;
            ?>
</option>
		            <?php 
        }
        ?>
            </select>
            <span style="display: block;">
				<?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-other-languages')->plain();
        ?>
                <?php 
        global $wgSettleTranslateDomains;
        $shiftedLangs = array_splice($this->connectedLanguagesList, 1);
        ?>
                <?php 
        foreach ($shiftedLangs as $langCode => $langText) {
            ?>
                    <a target="_blank" href="//<?php 
            echo $wgSettleTranslateDomains[$langCode];
            ?>
"><?php 
            echo $langText;
            ?>
</a>&nbsp;
                <?php 
        }
        ?>
            </span>
		</div>
		<div class="new_page_suggestions">
			<p></p>
			<ul>

			</ul>
		</div>
		<div class="form-group pull-right">
			<a id="newpage_btn_cancel" href="#" class="btn btn-concrete"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-btn-cancel')->plain();
        ?>
</a>
			<a href="#" id="newpage_btn_submit" class="disabled btn btn-primary"><?php 
        echo wfMessage('settlein-skin-add-new-article-window-form-btn-submit')->plain();
        ?>
</a>
		</div>
	</form>
</div>

<?php 
    }
Exemple #12
0
 /**
  * Generate the generic "this page has been changed" e-mail text.
  */
 private function composeCommonMailtext()
 {
     global $wgPasswordSender, $wgPasswordSenderName, $wgNoReplyAddress;
     global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
     global $wgEnotifImpersonal, $wgEnotifUseRealName;
     $this->composed_common = true;
     # You as the WikiAdmin and Sysops can make use of plenty of
     # named variables when composing your notification emails while
     # simply editing the Meta pages
     $keys = array();
     if ($this->oldid) {
         $difflink = $this->title->getCanonicalUrl('diff=0&oldid=' . $this->oldid);
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_lastvisited', $difflink);
         $keys['$OLDID'] = $this->oldid;
         $keys['$CHANGEDORCREATED'] = wfMsgForContent('changed');
     } else {
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_newpagetext');
         # clear $OLDID placeholder in the message template
         $keys['$OLDID'] = '';
         $keys['$CHANGEDORCREATED'] = wfMsgForContent('created');
     }
     $keys['$PAGETITLE'] = $this->title->getPrefixedText();
     $keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl();
     $keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMsgForContent('minoredit') : '';
     $keys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary;
     $keys['$UNWATCHURL'] = $this->title->getCanonicalUrl('action=unwatch');
     if ($this->editor->isAnon()) {
         # real anon (user:xxx.xxx.xxx.xxx)
         $keys['$PAGEEDITOR'] = wfMsgForContent('enotif_anon_editor', $this->editor->getName());
         $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent('noemailtitle');
     } else {
         $keys['$PAGEEDITOR'] = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName();
         $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $this->editor->getName());
         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl();
     }
     $keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalUrl();
     # Now build message's subject and body
     $subject = wfMsgExt('enotif_subject', 'content');
     $subject = strtr($subject, $keys);
     $this->subject = MessageCache::singleton()->transform($subject, false, null, $this->title);
     $body = wfMsgExt('enotif_body', 'content');
     $body = strtr($body, $keys);
     $body = MessageCache::singleton()->transform($body, false, null, $this->title);
     $this->body = wordwrap($body, 72);
     # Reveal the page editor's address as REPLY-TO address only if
     # the user has not opted-out and the option is enabled at the
     # global configuration level.
     $adminAddress = new MailAddress($wgPasswordSender, $wgPasswordSenderName);
     if ($wgEnotifRevealEditorAddress && $this->editor->getEmail() != '' && $this->editor->getOption('enotifrevealaddr')) {
         $editorAddress = new MailAddress($this->editor);
         if ($wgEnotifFromEditor) {
             $this->from = $editorAddress;
         } else {
             $this->from = $adminAddress;
             $this->replyto = $editorAddress;
         }
     } else {
         $this->from = $adminAddress;
         $this->replyto = new MailAddress($wgNoReplyAddress);
     }
 }
 /**
  * renderUserProfile -- return mashead tab for fallowed pages
  *
  * @static
  * @access public
  *
  *
  * @return  array
  */
 public static function renderUserProfile(&$out)
 {
     global $wgTitle, $wgRequest, $wgOut, $wgExtensionsPath, $wgJsMimeType, $wgUser;
     wfProfileIn(__METHOD__);
     if (F::app()->checkSkin('wikiamobile')) {
         return true;
     }
     if ($wgUser->getId() != 0 && $wgRequest->getVal("hide_followed", 0) == 1) {
         $wgUser->setOption("hidefollowedpages", true);
         $wgUser->saveSettings();
     }
     $key = $wgTitle->getDBKey();
     if (strlen($key) > 0) {
         $user = User::newFromName($key);
         if ($user == null) {
             return true;
         }
         if ($user->getId() == 0) {
             //not a real user
             return true;
         }
     } else {
         $user = $wgUser;
     }
     // do not show Followed box on diffs
     if ($wgRequest->getVal('diff', null) != null) {
         return true;
     }
     if ($user->getOption("hidefollowedpages")) {
         return true;
     }
     $data = FollowModel::getUserPageWatchList($user->getId());
     $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/Follow/css/userpage.css");
     $template = new EasyTemplate(dirname(__FILE__) . '/templates/');
     if (count($data) == 0) {
         $data = null;
     }
     /*
     		if ( count($data) > 5 ) {
     			$data2 = array_slice($data, 5 );
     			$data = array_slice($data, 0, 5);
     		} */
     // BugId:2643
     $moreUrl = null;
     if ($wgUser->getId() == $user->getId()) {
         $specialPage = SpecialPage::getSafeTitleFor('Following', $user->getName());
         if (!empty($specialPage)) {
             $moreUrl = $specialPage->getLocalUrl();
         }
     }
     $template->set_vars(array("isLogin" => $wgUser->getId() == $user->getId(), "hideUrl" => $wgTitle->getFullUrl("hide_followed=1"), "data" => $data, "moreUrl" => $moreUrl));
     wfProfileOut(__METHOD__);
     $out['followedPages'] = $template->render("followedUserPage");
     return true;
 }
Exemple #14
0
 /**
  * @private
  */
 function composeCommonMailtext()
 {
     global $wgPasswordSender, $wgNoReplyAddress;
     global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
     global $wgEnotifImpersonal, $wgEnotifUseRealName;
     $this->composed_common = true;
     $summary = $this->summary == '' ? ' - ' : $this->summary;
     $medit = $this->minorEdit ? wfMsg('minoredit') : '';
     # You as the WikiAdmin and Sysops can make use of plenty of
     # named variables when composing your notification emails while
     # simply editing the Meta pages
     $subject = wfMsgForContent('enotif_subject');
     $body = wfMsgForContent('enotif_body');
     $from = '';
     /* fail safe */
     $replyto = '';
     /* fail safe */
     $keys = array();
     if ($this->oldid) {
         $difflink = $this->title->getFullUrl('diff=0&oldid=' . $this->oldid);
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_lastvisited', $difflink);
         $keys['$OLDID'] = $this->oldid;
         $keys['$CHANGEDORCREATED'] = wfMsgForContent('changed');
     } else {
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_newpagetext');
         # clear $OLDID placeholder in the message template
         $keys['$OLDID'] = '';
         $keys['$CHANGEDORCREATED'] = wfMsgForContent('created');
     }
     if ($wgEnotifImpersonal && $this->oldid) {
         /*
          * For impersonal mail, show a diff link to the last
          * revision.
          */
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_lastdiff', $this->title->getFullURL("oldid={$this->oldid}&diff=prev"));
     }
     $body = strtr($body, $keys);
     $pagetitle = $this->title->getPrefixedText();
     $keys['$PAGETITLE'] = $pagetitle;
     $keys['$PAGETITLE_URL'] = $this->title->getFullUrl();
     $keys['$PAGEMINOREDIT'] = $medit;
     $keys['$PAGESUMMARY'] = $summary;
     $subject = strtr($subject, $keys);
     # Reveal the page editor's address as REPLY-TO address only if
     # the user has not opted-out and the option is enabled at the
     # global configuration level.
     $editor = $this->editor;
     $name = $wgEnotifUseRealName ? $editor->getRealName() : $editor->getName();
     $adminAddress = new MailAddress($wgPasswordSender, 'WikiAdmin');
     $editorAddress = new MailAddress($editor);
     if ($wgEnotifRevealEditorAddress && $editor->getEmail() != '' && $editor->getOption('enotifrevealaddr')) {
         if ($wgEnotifFromEditor) {
             $from = $editorAddress;
         } else {
             $from = $adminAddress;
             $replyto = $editorAddress;
         }
     } else {
         $from = $adminAddress;
         $replyto = new MailAddress($wgNoReplyAddress);
     }
     if ($editor->isIP($name)) {
         #real anon (user:xxx.xxx.xxx.xxx)
         $utext = wfMsgForContent('enotif_anon_editor', $name);
         $subject = str_replace('$PAGEEDITOR', $utext, $subject);
         $keys['$PAGEEDITOR'] = $utext;
         $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent('noemailtitle');
     } else {
         $subject = str_replace('$PAGEEDITOR', $name, $subject);
         $keys['$PAGEEDITOR'] = $name;
         $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $name);
         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
     }
     $userPage = $editor->getUserPage();
     $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
     $body = strtr($body, $keys);
     $body = wordwrap($body, 72);
     # now save this as the constant user-independent part of the message
     $this->from = $from;
     $this->replyto = $replyto;
     $this->subject = $subject;
     $this->body = $body;
 }
        echo $wf->Msg('userlogin-login-heading');
    }
    ?>
		</header>
	<?php 
    if ($loggedIn) {
        ?>
		<ul class=wkLst>
			<li><a class=chg href="<?php 
        echo AvatarService::getUrl($userName);
        ?>
"><?php 
        echo $wf->Msg('wikiamobile-profile');
        ?>
</a></li>
			<li><a class=logout href="<?php 
        echo str_replace("\$1", SpecialPage::getSafeTitleFor('UserLogout')->getPrefixedText() . '?returnto=' . $wg->Title->getPrefixedURL(), $wg->ArticlePath);
        ?>
"><?php 
        echo $wf->Msg('logout');
        ?>
</a></li>
		</ul>
	<?php 
    }
    ?>
	</div>
	<?php 
}
?>
</section>
Exemple #16
0
 function getRedirect($par)
 {
     return SpecialPage::getSafeTitleFor('Redirect', 'file/' . $par);
 }
Exemple #17
0
 /**
  * Compute the sidebar
  * @access private
  */
 function quickBar()
 {
     global $wgOut, $wgUser, $wgEnableUploads;
     $tns = $this->mTitle->getNamespace();
     $s = "\n<div id='quickbar'>";
     $sep = '<br />';
     $s .= $this->menuHead('qbfind');
     $s .= $this->searchForm();
     $s .= $this->menuHead('qbbrowse');
     # Use the first heading from the Monobook sidebar as the "browse" section
     $bar = $this->buildSidebar();
     unset($bar['SEARCH']);
     unset($bar['LANGUAGES']);
     unset($bar['TOOLBOX']);
     $browseLinks = reset($bar);
     foreach ($browseLinks as $link) {
         if ($link['text'] != '-') {
             $s .= "<a href=\"{$link['href']}\">" . htmlspecialchars($link['text']) . '</a>' . $sep;
         }
     }
     if ($wgOut->isArticle()) {
         $s .= $this->menuHead('qbedit');
         $s .= '<strong>' . $this->editThisPage() . '</strong>';
         $s .= $sep . $this->linkKnown(Title::newFromText(wfMsgForContent('edithelppage')), wfMsg('edithelp'));
         if ($wgUser->isLoggedIn()) {
             $s .= $sep . $this->moveThisPage();
         }
         if ($wgUser->isAllowed('delete')) {
             $dtp = $this->deleteThisPage();
             if ($dtp != '') {
                 $s .= $sep . $dtp;
             }
         }
         if ($wgUser->isAllowed('protect')) {
             $ptp = $this->protectThisPage();
             if ($ptp != '') {
                 $s .= $sep . $ptp;
             }
         }
         $s .= $sep;
         $s .= $this->menuHead('qbpageoptions');
         $s .= $this->talkLink() . $sep . $this->commentLink() . $sep . $this->printableLink();
         if ($wgUser->isLoggedIn()) {
             $s .= $sep . $this->watchThisPage();
         }
         $s .= $sep;
         $s .= $this->menuHead('qbpageinfo') . $this->historyLink() . $sep . $this->whatLinksHere() . $sep . $this->watchPageLinksLink();
         if ($tns == NS_USER || $tns == NS_USER_TALK) {
             $id = User::idFromName($this->mTitle->getText());
             if ($id != 0) {
                 $s .= $sep . $this->userContribsLink();
                 if ($this->showEmailUser($id)) {
                     $s .= $sep . $this->emailUserLink();
                 }
             }
         }
         $s .= $sep;
     }
     $s .= $this->menuHead('qbmyoptions');
     if ($wgUser->isLoggedIn()) {
         $name = $wgUser->getName();
         $tl = $this->link($wgUser->getTalkPage(), wfMsg('mytalk'), array(), array(), array('known', 'noclasses'));
         if ($wgUser->getNewtalk()) {
             $tl .= ' *';
         }
         $s .= $this->link($wgUser->getUserPage(), wfMsg('mypage'), array(), array(), array('known', 'noclasses')) . $sep . $tl . $sep . $this->specialLink('watchlist') . $sep . $this->link(SpecialPage::getSafeTitleFor('Contributions', $wgUser->getName()), wfMsg('mycontris'), array(), array(), array('known', 'noclasses')) . $sep . $this->specialLink('preferences') . $sep . $this->specialLink('userlogout');
     } else {
         $s .= $this->specialLink('userlogin');
     }
     $s .= $this->menuHead('qbspecialpages') . $this->specialLink('newpages') . $sep . $this->specialLink('listfiles') . $sep . $this->specialLink('statistics');
     if ($wgUser->isLoggedIn() && $wgEnableUploads) {
         $s .= $sep . $this->specialLink('upload');
     }
     global $wgSiteSupportPage;
     if ($wgSiteSupportPage) {
         $s .= $sep . '<a href="' . htmlspecialchars($wgSiteSupportPage) . '" class="internal">' . wfMsg('sitesupport') . '</a>';
     }
     $s .= $sep . $this->link(SpecialPage::getTitleFor('Specialpages'), wfMsg('moredotdotdot'), array(), array(), array('known', 'noclasses'));
     $s .= $sep . "\n</div>\n";
     return $s;
 }
 function notifyWatchers(&$title, &$editor, &$message, &$summary, &$medit)
 {
     global $wgLang, $wgEmergencyContact, $wgNoReplyAddress, $wgCategoryWatchNotifyEditor, $wgEnotifRevealEditorAddress, $wgEnotifUseRealName, $wgPasswordSender, $wgEnotifFromEditor;
     # Get list of users watching this category
     $dbr = wfGetDB(DB_SLAVE);
     $conds = array('wl_title' => $title->getDBkey(), 'wl_namespace' => $title->getNamespace());
     if (!$wgCategoryWatchNotifyEditor) {
         $conds[] = 'wl_user <> ' . intval($editor->getId());
     }
     $res = $dbr->select('watchlist', array('wl_user'), $conds, __METHOD__);
     # Wrap message with common body and send to each watcher
     $page = $title->getPrefixedText();
     # $wgPasswordSenderName was introduced only in MW 1.17
     global $wgPasswordSenderName;
     $adminAddress = new MailAddress($wgPasswordSender, isset($wgPasswordSenderName) ? $wgPasswordSenderName : 'WikiAdmin');
     $editorAddress = new MailAddress($editor);
     $summary = $summary ? $summary : ' - ';
     $medit = $medit ? wfMsg('minoredit') : '';
     while ($row = $dbr->fetchRow($res)) {
         $watchingUser = User::newFromId($row[0]);
         $timecorrection = $watchingUser->getOption('timecorrection');
         $editdate = $wgLang->timeanddate(wfTimestampNow(), true, false, $timecorrection);
         if ($watchingUser->getOption('enotifwatchlistpages') && $watchingUser->isEmailConfirmed()) {
             $to = new MailAddress($watchingUser);
             $subject = wfMsg('categorywatch-emailsubject', $page);
             $body = wfMsgForContent('enotif_body');
             # Reveal the page editor's address as REPLY-TO address only if
             # the user has not opted-out and the option is enabled at the
             # global configuration level.
             $name = $wgEnotifUseRealName ? $watchingUser->getRealName() : $watchingUser->getName();
             if ($wgEnotifRevealEditorAddress && $editor->getEmail() != '' && $editor->getOption('enotifrevealaddr')) {
                 if ($wgEnotifFromEditor) {
                     $from = $editorAddress;
                 } else {
                     $from = $adminAddress;
                     $replyto = $editorAddress;
                 }
             } else {
                 $from = $adminAddress;
                 $replyto = new MailAddress($wgNoReplyAddress);
             }
             # Define keys for body message
             $userPage = $editor->getUserPage();
             $keys = array('$WATCHINGUSERNAME' => $name, '$NEWPAGE' => $message, '$PAGETITLE' => $page, '$PAGEEDITDATE' => $editdate, '$CHANGEDORCREATED' => wfMsgForContent('changed'), '$PAGETITLE_URL' => $title->getFullUrl(), '$PAGEEDITOR_WIKI' => $userPage->getFullUrl(), '$PAGESUMMARY' => $summary, '$PAGEMINOREDIT' => $medit, '$OLDID' => '');
             if ($editor->isIP($name)) {
                 $utext = wfMsgForContent('enotif_anon_editor', $name);
                 $subject = str_replace('$PAGEEDITOR', $utext, $subject);
                 $keys['$PAGEEDITOR'] = $utext;
                 $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent('noemailtitle');
             } else {
                 $subject = str_replace('$PAGEEDITOR', $name, $subject);
                 $keys['$PAGEEDITOR'] = $name;
                 $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $name);
                 $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
             }
             $keys['$PAGESUMMARY'] = $summary;
             # Replace keys, wrap text and send
             $body = strtr($body, $keys);
             $body = wordwrap($body, 72);
             UserMailer::send($to, $from, $subject, $body, $replyto);
         }
     }
     $dbr->freeResult($res);
 }
 /**
  * Creates the HTML for a Navigation bar for too many results.
  * Most of the parameters are taken from the object members.
  *
  * @param[in] $count int  How many results are currently displayed?
  * @return string  HTML with the navigation bar
  */
 private function getNavigationBar($count)
 {
     global $smwgQMaxInlineLimit;
     if ($this->offset > 0) {
         $navigation = Html::element('a', array('href' => SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('offset' => max(0, $this->offset - $this->limit), 'limit' => $this->limit, 'property' => $this->property->getWikiValue(), 'value' => $this->value->getWikiValue()))), wfMsg('smw_result_prev'));
     } else {
         $navigation = wfMsg('smw_result_prev');
     }
     $navigation .= '&#160;&#160;&#160;&#160; <b>' . wfMsg('smw_result_results') . ' ' . ($this->offset + 1) . '– ' . ($this->offset + min($count, $this->limit)) . '</b>&#160;&#160;&#160;&#160;';
     if ($count > $this->limit) {
         $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('offset' => $this->offset + $this->limit, 'limit' => $this->limit, 'property' => $this->property->getWikiValue(), 'value' => $this->value->getWikiValue()))), wfMsg('smw_result_next'));
     } else {
         $navigation .= wfMsg('smw_result_next');
     }
     $max = false;
     $first = true;
     foreach (array(20, 50, 100, 250, 500) as $l) {
         if ($max) {
             continue;
         }
         if ($first) {
             $navigation .= '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(';
             $first = false;
         } else {
             $navigation .= ' ' . wfMsgExt('pipe-separator', 'escapenoentities') . ' ';
         }
         if ($l > $smwgQMaxInlineLimit) {
             $l = $smwgQMaxInlineLimit;
             $max = true;
         }
         if ($this->limit != $l) {
             $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('offset' => $this->offset, 'limit' => $l, 'property' => $this->property->getWikiValue(), 'value' => $this->value->getWikiValue()))), $l);
         } else {
             $navigation .= '<b>' . $l . '</b>';
         }
     }
     $navigation .= ')';
     return $navigation;
 }
Exemple #20
0
	/**
	 * Compute the sidebar
	 * @access private
	 */
	function quickBar()
	{
		global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;

		$tns=$wgTitle->getNamespace();

        $s = "";
		//$s = "\n<div id='quickbar'>";

        $s .= '<table border="0" cellpadding="0" cellspacing="0" align="right" width="758">';
        $s .= '<tr><td width="7" rowspan="3"><img src="/images/pixel.gif" height="1" width="7" /><br /></td>';
        $s .= '<td height="25" class="toolbar" width="751" colspan="2">Page editing toolbox</td></tr>';
        $s .= '<tr><td bgcolor="#20292E"><img src="/images/pixel.gif" height="15" width="1" /><br /></td>'; 
        $s .= '<td bgcolor="#38474E" class="bottom">';
        
                $s .= '<table border="0" cellpadding="0" cellspacing="4" width="750"><tr valign="top"><td>';

		$sep = "<br />";
		//$s .= $this->menuHead( "qbfind" );
		//$s .= $this->searchForm();

		$s .= $this->menuHead( "qbbrowse" );

		# Use the first heading from the Monobook sidebar as the "browse" section
		$bar = $this->buildSidebar();
		$browseLinks = reset( $bar );

		foreach ( $browseLinks as $link ) {
			if ( $link['text'] != '-' ) {
				$s .= "<a href=\"{$link['href']}\">" .
					htmlspecialchars( $link['text'] ) . '</a>' . $sep;
			}
		}

		if ( $wgOut->isArticle() ) {
            $s .= '</td><td>';

			$s .= $this->menuHead( "qbedit" );
			$s .= "<strong>" . $this->editThisPage() . "</strong>";

			$s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );

			if( $wgUser->isLoggedIn() ) {
				$s .= $sep . $this->moveThisPage();
			}
			if ( $wgUser->isAllowed('delete') ) {
				$dtp = $this->deleteThisPage();
				if ( "" != $dtp ) {
					$s .= $sep . $dtp;
				}
			}
			if ( $wgUser->isAllowed('protect') ) {
				$ptp = $this->protectThisPage();
				if ( "" != $ptp ) {
					$s .= $sep . $ptp;
				}
			}
			$s .= $sep;
            $s .= '</td><td>';

			$s .= $this->menuHead( "qbpageoptions" );
			$s .= $this->talkLink()
			  . $sep . $this->commentLink()
			  . $sep . $this->printableLink();
			if ( $wgUser->isLoggedIn() ) {
				$s .= $sep . $this->watchThisPage();
			}

			$s .= $sep;
            $s .= '</td><td>';

			$s .= $this->menuHead("qbpageinfo")
			  . $this->historyLink()
			  . $sep . $this->whatLinksHere()
			  . $sep . $this->watchPageLinksLink();

			if( $tns == NS_USER || $tns == NS_USER_TALK ) {
				$id=User::idFromName($wgTitle->getText());
				if ($id != 0) {
					$s .= $sep . $this->userContribsLink();
					if( $this->showEmailUser( $id ) ) {
						$s .= $sep . $this->emailUserLink();
					}
				}
			}
			$s .= $sep;
		}
        $s .= '</td><td>';

		$s .= $this->menuHead( "qbmyoptions" );
		if ( $wgUser->isLoggedIn() ) {
			$name = $wgUser->getName();
			$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
				wfMsg( 'mytalk' ) );
			if ( $wgUser->getNewtalk() ) {
				$tl .= " *";
			}

			$s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
				wfMsg( "mypage" ) )
			  . $sep . $tl
			  . $sep . $this->specialLink( "watchlist" )
			  . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
			  	wfMsg( "mycontris" ) )
		  	  . $sep . $this->specialLink( "preferences" )
		  	  . $sep . $this->specialLink( "userlogout" );
		} else {
			$s .= $this->specialLink( "userlogin" );
		}

        $s .= '</td><td>';

		$s .= $this->menuHead( "qbspecialpages" )
		  . $this->specialLink( "newpages" )
		  . $sep . $this->specialLink( "imagelist" )
		  . $sep . $this->specialLink( "statistics" )
		  . $sep . $this->bugReportsLink();
		if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
			$s .= $sep . $this->specialLink( "upload" );
		}
		global $wgSiteSupportPage;
		if( $wgSiteSupportPage) {
			$s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
			      .wfMsg( "sitesupport" )."</a>";
		}

		$s .= $sep . $this->makeKnownLinkObj(
			SpecialPage::getTitleFor( 'Specialpages' ),
			wfMsg( 'moredotdotdot' ) );

        $s .= '</td></tr></table>';
            
        $s .= '</td></tr>';
        $s .= '<tr height="1"><td bgcolor="#20292E" colspan="2"><img src="/images/pixel.gif" height="1" width="10" /></td>';
        $s .= '</tr></table>';
                
		//$s .= $sep . "\n</div>\n";
		return $s;
	}
 function perform($bPerformEdits = true)
 {
     global $wgRequest, $wgOut, $wgUser, $wgTitle, $wgLang;
     $iMaxPerCriterion = $bPerformEdits ? MER_MAX_EXECUTE_PAGES : MER_MAX_PREVIEW_DIFFS;
     $aErrors = array();
     $aPages = $this->getPages($aErrors, $iMaxPerCriterion);
     if ($aPages === null) {
         $this->showForm(wfMsg('masseditregex-err-nopages'));
         return;
     }
     // Show the form again ready for further editing if we're just previewing
     if (!$bPerformEdits) {
         $this->showForm();
     }
     $diff = new DifferenceEngine();
     $diff->showDiffStyle();
     // send CSS link to the browser for diff colours
     $wgOut->addHTML('<ul>');
     if (count($aErrors)) {
         $wgOut->addHTML('<li>' . join('</li><li> ', $aErrors) . '</li>');
     }
     $htmlDiff = '';
     $editToken = $wgUser->editToken();
     $iArticleCount = 0;
     foreach ($aPages as $p) {
         $iArticleCount++;
         if (!isset($p['revisions'])) {
             $wgOut->addHTML('<li>' . wfMsg('masseditregex-page-not-exists', $p['title']) . '</li>');
             continue;
             // empty page
         }
         $curContent = $p['revisions'][0]['*'];
         $iCount = 0;
         $newContent = $curContent;
         foreach ($this->aMatch as $i => $strMatch) {
             $this->strNextReplace = $this->aReplace[$i];
             $result = @preg_replace_callback($strMatch, array($this, 'regexCallback'), $newContent, -1, $iCount);
             if ($result !== null) {
                 $newContent = $result;
             } else {
                 $strErrorMsg = '<li>' . wfMsg('masseditregex-badregex') . ' <b>' . htmlspecialchars($strMatch) . '</b></li>';
                 $wgOut->addHTML($strErrorMsg);
                 unset($this->aMatch[$i]);
             }
         }
         if ($bPerformEdits) {
             // Not in preview mode, make the edits
             $wgOut->addHTML('<li>' . wfMsg('masseditregex-num-changes', $p['title'], $iCount) . '</li>');
             $req = new DerivativeRequest($wgRequest, array('action' => 'edit', 'bot' => true, 'title' => $p['title'], 'summary' => $this->strSummary, 'text' => $newContent, 'basetimestamp' => $p['starttimestamp'], 'watchlist' => 'nochange', 'nocreate' => 1, 'token' => $editToken), true);
             $processor = new ApiMain($req, true);
             try {
                 $processor->execute();
             } catch (UsageException $e) {
                 $wgOut->addHTML('<li><ul><li>' . wfMsg('masseditregex-editfailed') . ' ' . $e . '</li></ul></li>');
             }
         } else {
             // In preview mode, display the first few diffs
             $diff->setText($curContent, $newContent);
             $htmlDiff .= $diff->getDiff('<b>' . $p['title'] . ' - ' . wfMsg('masseditregex-before') . '</b>', '<b>' . wfMsg('masseditregex-after') . '</b>');
             if ($iArticleCount >= MER_MAX_PREVIEW_DIFFS) {
                 $htmlDiff .= Xml::element('p', null, wfMsg('masseditregex-max-preview-diffs', $wgLang->formatNum(MER_MAX_PREVIEW_DIFFS)));
                 break;
             }
         }
     }
     $wgOut->addHTML('</ul>');
     if ($bPerformEdits) {
         $wgOut->addWikiMsg('masseditregex-num-articles-changed', $iArticleCount);
         $wgOut->addHTML($this->sk->makeKnownLinkObj(SpecialPage::getSafeTitleFor('Contributions', $wgUser->getName()), wfMsgHtml('masseditregex-view-full-summary')));
     } else {
         // Only previewing, show the diffs now (after any errors)
         $wgOut->addHTML($htmlDiff);
     }
 }
Exemple #22
0
 public static function onContributionsToolLinks($id, $nt, &$tools)
 {
     global $wgOut, $wgCityId, $wgUser, $wgCityId;
     wfProfileIn(__METHOD__);
     $user = User::newFromId($id);
     if (!empty($user)) {
         $tools[] = Linker::link(SpecialPage::getSafeTitleFor('Log', 'chatban'), wfMessage('chat-chatban-log')->escaped(), array('class' => 'chat-ban-log'), array('page' => $user->getUserPage()->getPrefixedText()));
         # Add chat ban log link (@author: Sactage)
         if (Chat::getBanInformation($wgCityId, $user) !== false) {
             $dir = "change";
             LogEventsList::showLogExtract($wgOut, 'chatban', $nt->getPrefixedText(), '', array('lim' => 1, 'showIfEmpty' => false, 'msgKey' => array('chat-contributions-ban-notice', $nt->getText()), 'offset' => ''));
         } else {
             if ($wgUser->isAllowed('chatmoderator') && !$user->isAllowed('chatmoderator')) {
                 $tools[] = "<a class='chat-change-ban' data-user-id='{$id}' href='#'>" . wfMsg('chat-ban-contributions-heading') . "</a>";
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
Exemple #23
0
 /**
  * Build the navigation for some given query result, reuse url-tail parameters.
  *
  * @param SMWQueryResult $res
  * @param array $urlArgs
  *
  * @return string
  */
 protected function getNavigationBar(SMWQueryResult $res, array $urlArgs)
 {
     global $smwgQMaxInlineLimit, $wgLang;
     $offset = $this->m_params['offset'];
     $limit = $this->params['limit']->getValue();
     // Prepare navigation bar.
     if ($offset > 0) {
         $navigation = Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => max(0, $offset - $limit), 'limit' => $limit) + $urlArgs), 'rel' => 'nofollow'), wfMessage('smw_result_prev')->text());
     } else {
         $navigation = wfMessage('smw_result_prev')->text();
     }
     // @todo FIXME: i18n: Patchwork text.
     $navigation .= '&#160;&#160;&#160;&#160; <b>' . wfMessage('smw_result_results')->text() . ' ' . $wgLang->formatNum($offset + 1) . ' &#150; ' . $wgLang->formatNum($offset + $res->getCount()) . '</b>&#160;&#160;&#160;&#160;';
     if ($res->hasFurtherResults()) {
         $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => $offset + $limit, 'limit' => $limit) + $urlArgs), 'rel' => 'nofollow'), wfMessage('smw_result_next')->text());
     } else {
         $navigation .= wfMessage('smw_result_next')->text();
     }
     $first = true;
     foreach (array(20, 50, 100, 250, 500) as $l) {
         if ($l > $smwgQMaxInlineLimit) {
             break;
         }
         if ($first) {
             $navigation .= '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(';
             $first = false;
         } else {
             $navigation .= ' | ';
         }
         if ($limit != $l) {
             $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => $offset, 'limit' => $l) + $urlArgs), 'rel' => 'nofollow'), $l);
         } else {
             $navigation .= '<b>' . $l . '</b>';
         }
     }
     $navigation .= ')';
     return $navigation;
 }
Exemple #24
0
 static function makeSpecialUrlSubpage($name, $subpage, $urlaction = '')
 {
     $title = SpecialPage::getSafeTitleFor($name, $subpage);
     return $title->getLocalURL($urlaction);
 }
 /**
  * Add user links to toolbar in Monobook for Message Wall
  *
  * @access public
  * @author Sactage
  *
  * @param SkinTemplate $monobook
  * @return boolean
  */
 public static function onBuildMonobookToolbox(&$monobook)
 {
     $app = F::app();
     $title = $app->wg->Title;
     $curUser = $app->wg->User;
     if ($title->getNamespace() === NS_USER_WALL) {
         $user = User::newFromName($title->getText(), false);
     } else {
         return true;
     }
     echo '<li id="t-contributions">' . Linker::link(SpecialPage::getSafeTitleFor('Contributions', $user->getName()), wfMessage('contributions')->escaped()) . '</li>';
     if ($curUser->isAllowed('block')) {
         echo '<li id="t-blockip">' . Linker::link(SpecialPage::getSafeTitleFor('Block', $user->getName()), wfMessage('block')->escaped()) . '</li>';
     }
     if ($monobook->getSkin()->showEmailUser($user)) {
         echo '<li id="t-emailuser">' . Linker::link(SpecialPage::getSafeTitleFor('EmailUser', $user->getName()), wfMessage('emailuser')->escaped()) . '</li>';
     }
     echo '<li id="t-log">' . Linker::link(SpecialPage::getTitleFor('Log'), wfMessage('log')->escaped(), array(), array('user' => $user->getName())) . '</li>';
     return true;
 }
	/**
	 * Creates the HTML for a link to this page, with some parameters set.
	 *
	 * @param[in] $text string  The anchor text for the link
	 * @param[in] $out bool  Should the linked to page include outgoing properties?
	 * @param[in] $in bool  Should the linked to page include incoming properties?
	 * @param[in] $offset int  What is the offset for the incoming properties?
	 *
	 * @return string  HTML with the link to this page
	 */
	private function linkHere( $text, $out, $in, $offset ) {
		$dir = $out ? ( $in ? 'both' : 'out' ) : 'in';
		$frag = ( $text == wfMsg( 'smw_browse_show_incoming' ) ) ? '#smw_browse_incoming' : '';

		return Html::element(
			'a',
		array(
				'href' => SpecialPage::getSafeTitleFor( 'BrowseWiki' )->getLocalURL( array(
					'offset' => "{$offset}&dir={$dir}",
					'article' => $this->subject->getLongWikiText() . $frag
		) )
		),
		$text
		);
	}
    echo $userName;
} else {
    echo wfMessage('userlogin-login-heading')->text();
}
?>
		</header>
	<?php 
if ($loggedIn) {
    ?>
		<ul class=wkLst>
			<li><a class=chg href="<?php 
    echo Sanitizer::encodeAttribute(AvatarService::getUrl($userName));
    ?>
"><?php 
    echo wfMessage('wikiamobile-profile')->escaped();
    ?>
</a></li>
			<li><a class=logout href="<?php 
    echo Sanitizer::encodeAttribute(str_replace("\$1", SpecialPage::getSafeTitleFor('UserLogout')->getPrefixedText() . '?returnto=' . $wg->Title->getPrefixedURL(), $wg->ArticlePath));
    ?>
"><?php 
    echo wfMessage('logout')->escaped();
    ?>
</a></li>
		</ul>
	<?php 
}
?>
	</div>
</section>
Exemple #28
0
 /**
  * Generate the generic "this page has been changed" e-mail text.
  */
 private function composeCommonMailtext()
 {
     $this->composedCommon = true;
     $action = strtolower($this->action);
     $subject = wfMessage('enotif_subject_' . $action)->inContentLanguage()->text();
     if (wfEmptyMsg('enotif_subject_' . $action, $subject)) {
         $subject = wfMessage('enotif_subject')->inContentLanguage()->text();
     }
     list($body, $bodyHTML) = wfMsgHTMLwithLanguageAndAlternative('enotif_body' . ($action == '' ? '' : '_' . $action), 'enotif_body', F::app()->wg->LanguageCode);
     # You as the WikiAdmin and Sysops can make use of plenty of
     # named variables when composing your notification emails while
     # simply editing the Meta pages
     $keys = [];
     $postTransformKeys = [];
     if ($this->isNewPage()) {
         // watchlist link tracking
         list($keys['$NEWPAGE'], $keys['$NEWPAGEHTML']) = wfMsgHTMLwithLanguageAndAlternative('enotif_lastvisited', 'enotif_lastvisited', F::app()->wg->LanguageCode, [], $this->title->getFullUrl('s=wldiff&diff=0&previousRevId=' . $this->previousRevId));
         $keys['$OLDID'] = $this->previousRevId;
         $keys['$CHANGEDORCREATED'] = wfMessage('changed')->inContentLanguage()->plain();
     } else {
         if ($action == '') {
             // no previousRevId + empty action = create edit, ok to use newpagetext
             $keys['$NEWPAGEHTML'] = $keys['$NEWPAGE'] = wfMessage('enotif_newpagetext')->inContentLanguage()->plain();
         } else {
             // no previousRevId + action = event, dont show anything, confuses users
             $keys['$NEWPAGEHTML'] = $keys['$NEWPAGE'] = '';
         }
         # clear $OLDID placeholder in the message template
         $keys['$OLDID'] = '';
         $keys['$CHANGEDORCREATED'] = wfMessage('created')->inContentLanguage()->plain();
     }
     $keys['$PAGETITLE'] = $this->title->getPrefixedText();
     $keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl('s=wl');
     $keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMessage('minoredit')->inContentLanguage()->plain() : '';
     $keys['$UNWATCHURL'] = $this->title->getCanonicalUrl('action=unwatch');
     $keys['$ACTION'] = $this->action;
     // Hook registered in FollowHelper -- used for blogposts and categoryAdd
     wfRunHooks('MailNotifyBuildKeys', [&$keys, $this->action, $this->otherParam]);
     if ($this->editor->isAnon()) {
         # real anon (user:xxx.xxx.xxx.xxx)
         $keys['$PAGEEDITOR'] = wfMessage('enotif_anon_editor', $this->editor->getName())->inContentLanguage()->plain();
         $keys['$PAGEEDITOR_EMAIL'] = wfMessage('noemailtitle')->inContentLanguage()->plain();
     } else {
         $keys['$PAGEEDITOR'] = F::app()->wg->EnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName();
         $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $this->editor->getName());
         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl();
     }
     $keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalUrl();
     $summary = $this->summary == '' ? wfMessage('enotif_no_summary')->inContentLanguage()->plain() : '"' . $this->summary . '"';
     $postTransformKeys['$PAGESUMMARY'] = $summary;
     // Now build message's subject and body
     // ArticleComment -- updates subject and $keys['$PAGEEDITOR'] if anon editor
     // EmailTemplatesHooksHelper -- updates subject if blogpost
     // TopListHelper -- updates subject if title is toplist
     wfRunHooks('ComposeCommonSubjectMail', [$this->title, &$keys, &$subject, $this->editor]);
     $subject = strtr($subject, $keys);
     $subject = MessageCache::singleton()->transform($subject, false, null, $this->title);
     $this->subject = strtr($subject, $postTransformKeys);
     // ArticleComment -- updates body and $keys['$PAGEEDITOR'] if anon editor
     // EmailTemplatesHooksHelper -- changes body to blog post. EmailTemplates only enabled on community and messaging so this tranforms
     //     any watched page email coming from Community to a blog post (I think)
     // TopListHelper -- updates body if title is toplist
     wfRunHooks('ComposeCommonBodyMail', [$this->title, &$keys, &$body, $this->editor, &$bodyHTML, &$postTransformKeys]);
     $body = strtr($body, $keys);
     $body = MessageCache::singleton()->transform($body, false, null, $this->title);
     $this->body = wordwrap(strtr($body, $postTransformKeys), 72);
     if ($bodyHTML) {
         $bodyHTML = strtr($bodyHTML, $keys);
         $bodyHTML = MessageCache::singleton()->transform($bodyHTML, false, null, $this->title);
         $this->bodyHTML = strtr($bodyHTML, $postTransformKeys);
     }
 }
Exemple #29
0
 /**
  * @private
  */
 function composeCommonMailtext()
 {
     global $wgUser, $wgEmergencyContact, $wgNoReplyAddress;
     global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
     $summary = $this->summary == '' ? ' - ' : $this->summary;
     $medit = $this->minorEdit ? wfMsg('minoredit') : '';
     # You as the WikiAdmin and Sysops can make use of plenty of
     # named variables when composing your notification emails while
     # simply editing the Meta pages
     $subject = wfMsgForContent('enotif_subject');
     $body = wfMsgForContent('enotif_body');
     $from = '';
     /* fail safe */
     $replyto = '';
     /* fail safe */
     $keys = array();
     # regarding the use of oldid as an indicator for the last visited version, see also
     # http://bugzilla.wikipeda.org/show_bug.cgi?id=603 "Delete + undelete cycle doesn't preserve old_id"
     # However, in the case of a new page which is already watched, we have no previous version to compare
     if ($this->oldid) {
         $difflink = $this->title->getFullUrl('diff=0&oldid=' . $this->oldid);
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_lastvisited', $difflink);
         $keys['$OLDID'] = $this->oldid;
         $keys['$CHANGEDORCREATED'] = wfMsgForContent('changed');
     } else {
         $keys['$NEWPAGE'] = wfMsgForContent('enotif_newpagetext');
         # clear $OLDID placeholder in the message template
         $keys['$OLDID'] = '';
         $keys['$CHANGEDORCREATED'] = wfMsgForContent('created');
     }
     $body = strtr($body, $keys);
     $pagetitle = $this->title->getPrefixedText();
     $keys['$PAGETITLE'] = $pagetitle;
     $keys['$PAGETITLE_URL'] = $this->title->getFullUrl();
     $keys['$PAGEMINOREDIT'] = $medit;
     $keys['$PAGESUMMARY'] = $summary;
     $subject = strtr($subject, $keys);
     # Reveal the page editor's address as REPLY-TO address only if
     # the user has not opted-out and the option is enabled at the
     # global configuration level.
     $name = $wgUser->getName();
     $adminAddress = new MailAddress($wgEmergencyContact, 'WikiAdmin');
     $editorAddress = new MailAddress($wgUser);
     if ($wgEnotifRevealEditorAddress && $wgUser->getEmail() != '' && $wgUser->getOption('enotifrevealaddr')) {
         if ($wgEnotifFromEditor) {
             $from = $editorAddress;
         } else {
             $from = $adminAddress;
             $replyto = $editorAddress;
         }
     } else {
         $from = $adminAddress;
         $replyto = $wgNoReplyAddress;
     }
     if ($wgUser->isIP($name)) {
         #real anon (user:xxx.xxx.xxx.xxx)
         $subject = str_replace('$PAGEEDITOR', 'anonymous user ' . $name, $subject);
         $keys['$PAGEEDITOR'] = 'anonymous user ' . $name;
         $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent('noemailtitle');
     } else {
         $subject = str_replace('$PAGEEDITOR', $name, $subject);
         $keys['$PAGEEDITOR'] = $name;
         $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $name);
         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
     }
     $userPage = $wgUser->getUserPage();
     $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
     $body = strtr($body, $keys);
     $body = wordwrap($body, 72);
     # now save this as the constant user-independent part of the message
     $this->from = $from;
     $this->replyto = $replyto;
     $this->subject = $subject;
     $this->body = $body;
 }
 function getRedirect($par)
 {
     $file = $par ?: $this->getRequest()->getText('file');
     return SpecialPage::getSafeTitleFor('Redirect', 'file/' . $file);
 }