Example #1
0
 function view()
 {
     global $wgOut, $wgShowEXIF;
     $this->img = new Image($this->mTitle);
     if ($this->mTitle->getNamespace() == NS_IMAGE) {
         if ($wgShowEXIF && $this->img->exists()) {
             $exif = $this->img->getExifData();
             $showmeta = count($exif) ? true : false;
         } else {
             $exif = false;
             $showmeta = false;
         }
         if ($this->img->exists()) {
             $wgOut->addHTML($this->showTOC($showmeta));
         }
         $this->openShowImage();
         # No need to display noarticletext, we use our own message, output in openShowImage()
         if ($this->getID()) {
             Article::view();
         } else {
             # Just need to set the right headers
             $wgOut->setArticleFlag(true);
             $wgOut->setRobotpolicy('index,follow');
             $wgOut->setPageTitle($this->mTitle->getPrefixedText());
             $this->viewUpdates();
         }
         # Show shared description, if needed
         if ($this->mExtraDescription) {
             $fol = wfMsg('shareddescriptionfollows');
             if ($fol != '-') {
                 $wgOut->addWikiText($fol);
             }
             $wgOut->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>');
         }
         $this->closeShowImage();
         $this->imageHistory();
         $this->imageLinks();
         if ($exif) {
             global $wgStylePath;
             $expand = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-expand')));
             $collapse = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-collapse')));
             $wgOut->addHTML("<h2 id=\"metadata\">" . wfMsgHtml('metadata') . "</h2>\n");
             $wgOut->addWikiText($this->makeMetadataTable($exif));
             $wgOut->addHTML("<script type=\"text/javascript\" src=\"{$wgStylePath}/common/metadata.js\"></script>\n" . "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '{$expand}', '{$collapse}');</script>\n");
         }
     } else {
         Article::view();
     }
 }
Example #2
0
 function view()
 {
     global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
     $diff = $wgRequest->getVal('diff');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
     if ($this->mTitle->getNamespace() != NS_VIDEO || isset($diff) && $diffOnly) {
         return Article::view();
     }
     # No need to display noarticletext, we use our own message, output in openShowImage()
     if ($this->getID()) {
         Article::view();
     } else {
         # Just need to set the right headers
         $wgOut->setStatusCode(404);
         $wgOut->setArticleFlag(true);
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->setPageTitle($this->mTitle->getPrefixedText());
         $this->viewUpdates();
     }
     # Show shared description, if needed
     if ($this->mExtraDescription) {
         $fol = wfMsgNoTrans('shareddescriptionfollows');
         if ($fol != '-' && !wfEmptyMsg('shareddescriptionfollows', $fol)) {
             $wgOut->addWikiText($fol);
         }
         $wgOut->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>');
     }
     $this->videoLinks();
     $this->videoHistory();
     if ($showmeta) {
         global $wgStylePath, $wgStyleVersion;
         $expand = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-expand')));
         $collapse = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-collapse')));
         $wgOut->addHTML(Xml::element('h2', array('id' => 'metadata'), wfMsg('metadata')) . "\n");
         $wgOut->addWikiText($this->makeMetadataTable($formattedMetadata));
         $wgOut->addHTML("<script type=\"text/javascript\" src=\"{$wgStylePath}/common/metadata.js?{$wgStyleVersion}\"></script>\n" . "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '{$expand}', '{$collapse}');</script>\n");
     }
 }
Example #3
0
 /**
  * Shows a bulletin board style toolbar for common editing functions.
  * It can be disabled in the user preferences.
  * The necessary JavaScript code can be found in style/wikibits.js.
  */
 function getEditToolbar()
 {
     global $wgStylePath, $wgLang, $wgMimeType, $wgJsMimeType;
     /**
      * toolarray an array of arrays which each include the filename of
      * the button image (without path), the opening tag, the closing tag,
      * and optionally a sample text that is inserted between the two when no
      * selection is highlighted.
      * The tip text is shown when the user moves the mouse over the button.
      *
      * Already here are accesskeys (key), which are not used yet until someone
      * can figure out a way to make them work in IE. However, we should make
      * sure these keys are not defined on the edit page.
      */
     $toolarray = array(array('image' => 'button_bold.png', 'open' => "\\'\\'\\'", 'close' => "\\'\\'\\'", 'sample' => wfMsg('bold_sample'), 'tip' => wfMsg('bold_tip'), 'key' => 'B'), array('image' => 'button_italic.png', 'open' => "\\'\\'", 'close' => "\\'\\'", 'sample' => wfMsg('italic_sample'), 'tip' => wfMsg('italic_tip'), 'key' => 'I'), array('image' => 'button_link.png', 'open' => '[[', 'close' => ']]', 'sample' => wfMsg('link_sample'), 'tip' => wfMsg('link_tip'), 'key' => 'L'), array('image' => 'button_extlink.png', 'open' => '[', 'close' => ']', 'sample' => wfMsg('extlink_sample'), 'tip' => wfMsg('extlink_tip'), 'key' => 'X'), array('image' => 'button_headline.png', 'open' => "\\n== ", 'close' => " ==\\n", 'sample' => wfMsg('headline_sample'), 'tip' => wfMsg('headline_tip'), 'key' => 'H'), array('image' => 'button_image.png', 'open' => '[[' . $wgLang->getNsText(NS_IMAGE) . ":", 'close' => ']]', 'sample' => wfMsg('image_sample'), 'tip' => wfMsg('image_tip'), 'key' => 'D'), array('image' => 'button_media.png', 'open' => '[[' . $wgLang->getNsText(NS_MEDIA) . ':', 'close' => ']]', 'sample' => wfMsg('media_sample'), 'tip' => wfMsg('media_tip'), 'key' => 'M'), array('image' => 'button_math.png', 'open' => "\\<math\\>", 'close' => "\\</math\\>", 'sample' => wfMsg('math_sample'), 'tip' => wfMsg('math_tip'), 'key' => 'C'), array('image' => 'button_nowiki.png', 'open' => "\\<nowiki\\>", 'close' => "\\</nowiki\\>", 'sample' => wfMsg('nowiki_sample'), 'tip' => wfMsg('nowiki_tip'), 'key' => 'N'), array('image' => 'button_sig.png', 'open' => '--~~~~', 'close' => '', 'sample' => '', 'tip' => wfMsg('sig_tip'), 'key' => 'Y'), array('image' => 'button_hr.png', 'open' => "\\n----\\n", 'close' => '', 'sample' => '', 'tip' => wfMsg('hr_tip'), 'key' => 'R'));
     $toolbar = "<script type='{$wgJsMimeType}'>\n/*<![CDATA[*/\n";
     $toolbar .= "document.writeln(\"<div id='toolbar'>\");\n";
     foreach ($toolarray as $tool) {
         $image = $wgStylePath . '/common/images/' . $tool['image'];
         $open = $tool['open'];
         $close = $tool['close'];
         $sample = wfEscapeJsString($tool['sample']);
         // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
         // Older browsers show a "speedtip" type message only for ALT.
         // Ideally these should be different, realistically they
         // probably don't need to be.
         $tip = wfEscapeJsString($tool['tip']);
         #$key = $tool["key"];
         $toolbar .= "addButton('{$image}','{$tip}','{$open}','{$close}','{$sample}');\n";
     }
     $toolbar .= "addInfobox('" . wfEscapeJsString(wfMsg("infobox")) . "','" . wfEscapeJsString(wfMsg("infobox_alert")) . "');\n";
     $toolbar .= "document.writeln(\"</div>\");\n";
     $toolbar .= "/*]]>*/\n</script>";
     return $toolbar;
 }
Example #4
0
 function view()
 {
     global $wgOut, $wgShowEXIF;
     $this->img = new Image($this->mTitle);
     if ($this->mTitle->getNamespace() == NS_IMAGE) {
         if ($wgShowEXIF && $this->img->exists()) {
             $exif = $this->img->getExifData();
             $showmeta = count($exif) ? true : false;
         } else {
             $exif = false;
             $showmeta = false;
         }
         // WERELATE - removed
         //			if ($this->img->exists())
         //				$wgOut->addHTML($this->showTOC($showmeta));
         // WERELATE - if there image_data, that will show the image
         //			$imageData = preg_match('#<image_data>(.*?)</image_data>#s', $this->getContent());
         //			if (!$imageData) {
         $this->openShowImage();
         //			}
         # No need to display noarticletext, we use our own message, output in openShowImage()
         if ($this->getID()) {
             Article::view();
         } else {
             # Just need to set the right headers
             $wgOut->setArticleFlag(true);
             $wgOut->setRobotpolicy('index,follow');
             $wgOut->setPageTitle($this->mTitle->getPrefixedText());
             $this->viewUpdates();
         }
         # Show shared description, if needed
         if ($this->mExtraDescription) {
             $fol = wfMsg('shareddescriptionfollows');
             if ($fol != '-') {
                 $wgOut->addWikiText($fol);
             }
             $wgOut->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>');
         }
         // WERELATE - if there is image data, that will show the image
         //			if (!$imageData) {
         $this->closeShowImage();
         //			}
         $this->imageHistory();
         $this->imageLinks();
         if ($exif) {
             global $wgStylePath;
             $expand = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-expand')));
             $collapse = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-collapse')));
             $wgOut->addHTML("<h2 id=\"metadata\">" . wfMsgHtml('metadata') . "</h2>\n");
             $wgOut->addWikiText($this->makeMetadataTable($exif));
             $wgOut->addHTML("<script type=\"text/javascript\" src=\"{$wgStylePath}/common/metadata.js\"></script>\n" . "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '{$expand}', '{$collapse}');</script>\n");
         }
         // WERELATE - show license
         $text = $this->getContent();
         $matches = array();
         if (preg_match('#<license>(.*?)</license>#', $text, $matches)) {
             $wgOut->addHTML('<div id="imglicense">');
             $wgOut->addWikiText("'''" . wfMsg('license') . ":''' {{" . $matches[1] . '}}');
             $wgOut->addHTML('</div>');
         }
     } else {
         Article::view();
     }
 }
Example #5
0
 function buildCleanupScript()
 {
     return '<script type="text/javascript">protectInitialize("mwProtectSet","' . wfEscapeJsString(wfMsg('protect-unchain')) . '")</script>';
 }
 function buildCleanupScript()
 {
     global $wgRestrictionLevels, $wgGroupPermissions;
     $script = 'var wgCascadeableLevels=';
     $CascadeableLevels = array();
     foreach ($wgRestrictionLevels as $key) {
         if (isset($wgGroupPermissions[$key]['protect']) && $wgGroupPermissions[$key]['protect'] || $key == 'protect') {
             $CascadeableLevels[] = "'" . wfEscapeJsString($key) . "'";
         }
     }
     $script .= "[" . implode(',', $CascadeableLevels) . "];\n";
     $script .= 'protectInitialize("mwProtectSet","' . wfEscapeJsString(wfMsg('protect-unchain')) . '","' . count($this->mApplicableTypes) . '")';
     return '<script type="text/javascript">' . $script . '</script>';
 }
<?php
/*
cortado_embed.php
all file checks and conditions should be checked prior to loading this page.
this page serves as a wrapper for the cortado java applet
*/
//load the http GETS:

// set the parent domain if provided
// needed before error_out can be called
$parent_domain = isset( $_GET['parent_domain'] ) ? wfEscapeJsString( $_GET['parent_domain'] ) : false;

$error='';
if(!function_exists('filter_input')){
	error_out('you version of php lacks <b>filter_input()</b> function</br>');
}
//default to null media in not provided:
$media_url = isset( $_GET['media_url'] ) ? htmlspecialchars( $_GET['media_url'] ) : false;
if( is_null($media_url) || $media_url===false || $media_url==''){
	error_out('not valid or missing media url');
}
//default duration to 30 seconds if not provided. (ideally cortado would read this from the video file)
//$duration = (isset($_GET['duration']))?$_GET['duration']:0;
$duration = filter_input(INPUT_GET, 'duration', FILTER_SANITIZE_NUMBER_INT);
if( is_null($duration) || $duration===false){
	$duration=0;
}

//id (set to random if none provided)
//$id = (isset($_GET['id']))?$_GET['id']:'vid_'.rand('10000000');
$id = isset($_GET['id']) ? htmlspecialchars( $_GET['id'] ) : false;
Example #8
0
 function view()
 {
     global $wgOut, $wgShowEXIF, $wgRequest, $wgUser, $wgTitle;
     $startTime = strtotime('November 5, 2013');
     $oneWeek = 7 * 24 * 60 * 60;
     $rolloutArticle = Misc::percentileRollout($startTime, $oneWeek);
     $ua = @$_SERVER['HTTP_USER_AGENT'];
     if (!$rolloutArticle && preg_match('@msnbot@', $ua)) {
         header('HTTP/1.1 503 Service Temporarily Unavailable');
         echo "Sorry, not now MSNBOT!";
         exit;
     }
     $sk = $wgUser->getSkin();
     $diff = $wgRequest->getVal('diff');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
     if ($this->mTitle->getNamespace() != NS_IMAGE || isset($diff) && $diffOnly) {
         return Article::view();
     }
     if ($wgShowEXIF && $this->img->exists()) {
         // FIXME: bad interface, see note on MediaHandler::formatMetadata().
         $formattedMetadata = $this->img->formatMetadata();
         $showmeta = $formattedMetadata !== false;
     } else {
         $showmeta = false;
     }
     //NEW
     //if ($this->img->exists())
     //$wgOut->addHTML($this->showTOC($showmeta));
     $this->openShowImage();
     ImageHelper::showDescription($this->mTitle);
     $lastUser = $this->current->getUser();
     $userLink = $sk->makeLinkObj(Title::makeTitle(NS_USER, $lastUser), $lastUser);
     $wgOut->addHTML("<div style='margin-bottom:20px'></div>");
     //ImageHelper::getSummaryInfo($this->img);
     # Show shared description, if needed
     if ($this->mExtraDescription) {
         $fol = wfMsgNoTrans('shareddescriptionfollows');
         if ($fol != '-' && !wfEmptyMsg('shareddescriptionfollows', $fol)) {
             $wgOut->addWikiText($fol);
         }
         $wgOut->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>');
     }
     $this->closeShowImage();
     $currentHTML = $wgOut->getHTML();
     $wgOut->clearHTML();
     Article::view();
     $articleContent = $wgOut->getHTML();
     $wgOut->clearHTML();
     $wgOut->addHTML($currentHTML);
     $diffSeparator = "<h2>" . wfMsg('currentrev') . "</h2>";
     $articleParts = explode($diffSeparator, $articleContent);
     if (count($articleParts) > 1) {
         $wgOut->addHTML($articleParts[0]);
     }
     $articles = ImageHelper::getLinkedArticles($this->mTitle);
     if (ImageHelper::IMAGES_ON) {
         ImageHelper::getConnectedImages($articles, $this->mTitle);
         ImageHelper::getRelatedWikiHows($this->mTitle);
     }
     ImageHelper::addSideWidgets($this->mTitle);
     # No need to display noarticletext, we use our own message, output in openShowImage()
     if ($this->getID()) {
     } else {
         # Just need to set the right headers
         $wgOut->setArticleFlag(true);
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->setPageTitle($this->mTitle->getPrefixedText());
         $this->viewUpdates();
     }
     if ($wgUser && !$wgUser->isAnon()) {
         $this->imageHistory();
     }
     ImageHelper::displayBottomAds();
     if ($showmeta) {
         global $wgStylePath, $wgStyleVersion;
         $expand = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-expand')));
         $collapse = htmlspecialchars(wfEscapeJsString(wfMsg('metadata-collapse')));
         $wgOut->addHTML(Xml::element('h2', array('id' => 'metadata'), wfMsg('metadata')) . "\n");
         $wgOut->addWikiText($this->makeMetadataTable($formattedMetadata));
         $wgOut->addHTML("<script type=\"text/javascript\" src=\"{$wgStylePath}/common/metadata.js?{$wgStyleVersion}\"></script>\n" . "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '{$expand}', '{$collapse}');</script>\n");
     }
 }
Example #9
0
 /** @todo document */
 function tocList($toc)
 {
     global $wgJsMimeType;
     return "<table id='toc' class='toc'><tr><td>" . "<div id='toctitle'><h2>" . wfMsgForContent('toc') . "</h2></div>\n" . $toc . "</ul>\n</td></tr></table>\n" . '<script type="' . $wgJsMimeType . '">' . ' if (window.showTocToggle) {' . ' var tocShowText = "' . wfEscapeJsString(wfMsgForContent('showtoc')) . '";' . ' var tocHideText = "' . wfEscapeJsString(wfMsgForContent('hidetoc')) . '";' . ' showTocToggle();' . ' } ' . "</script>\n";
 }
Example #10
0
 /** @todo document */
 function tocList($toc)
 {
     global $wgJsMimeType;
     $title = wfMsgHtml('toc');
     return '<h2><span>' . $title . "</span></h2>" . '<table id="toc" class="toc" summary="' . $title . '"><tr><td>' . $toc . "</ul>\n</td></tr></table>" . '<script type="' . $wgJsMimeType . '">' . ' if (window.showTocToggle) {' . ' var tocShowText = "' . wfEscapeJsString(wfMsg('showtoc')) . '";' . ' var tocHideText = "' . wfEscapeJsString(wfMsg('hidetoc')) . '";' . ' showTocToggle();' . ' } ' . "</script>\n";
 }
Example #11
0
 /** @todo document */
 function tocList($toc)
 {
     // WERELATE: use topics instead of toc for talk pages
     global $wgJsMimeType, $wgTitle;
     $title = wfMsgForContent($wgTitle && get_class($wgTitle) != 'FakeTitle' && $wgTitle->isTalkPage() ? 'topics' : 'toc');
     return '<table id="toc" class="toc" summary="' . $title . '"><tr><td>' . '<div id="toctitle"><h2>' . $title . "</h2></div>\n" . $toc . "</ul>\n</td></tr></table>" . '<script type="' . $wgJsMimeType . '">' . ' if (window.showTocToggle) {' . ' var tocShowText = "' . wfEscapeJsString(wfMsgForContent('showtoc')) . '";' . ' var tocHideText = "' . wfEscapeJsString(wfMsgForContent('hidetoc')) . '";' . ' showTocToggle();' . ' } ' . "</script>\n";
 }
Example #12
0
 /**
  * initialize various variables and generate the template
  *
  * @param OutputPage $out
  * @public
  */
 function outputPage(&$out)
 {
     global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
     global $wgScript, $wgStylePath, $wgContLanguageCode;
     global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
     global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks;
     global $wgMaxCredits, $wgShowCreditsIfMax;
     global $wgPageShowWatchingUsers;
     global $wgUseTrackbacks;
     global $wgArticlePath, $wgScriptPath, $wgServer, $wgLang, $wgCanonicalNamespaceNames;
     $fname = 'SkinTemplate::outputPage';
     wfProfileIn($fname);
     // Hook that allows last minute changes to the output page, e.g.
     // adding of CSS or Javascript by extensions.
     wfRunHooks('BeforePageDisplay', array(&$out));
     $oldid = $wgRequest->getVal('oldid');
     $diff = $wgRequest->getVal('diff');
     wfProfileIn("{$fname}-init");
     $this->initPage($out);
     $this->mTitle =& $wgTitle;
     $this->mUser =& $wgUser;
     $tpl = $this->setupTemplate($this->template, 'skins');
     #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
     $tpl->setTranslator(new MediaWiki_I18N());
     #}
     wfProfileOut("{$fname}-init");
     wfProfileIn("{$fname}-stuff");
     $this->thispage = $this->mTitle->getPrefixedDbKey();
     $this->thisurl = $this->mTitle->getPrefixedURL();
     $this->loggedin = $wgUser->isLoggedIn();
     $this->iscontent = $this->mTitle->getNamespace() != NS_SPECIAL;
     $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
     $this->username = $wgUser->getName();
     $userPage = $wgUser->getUserPage();
     $this->userpage = $userPage->getPrefixedText();
     if ($wgUser->isLoggedIn() || $this->showIPinHeader()) {
         $this->userpageUrlDetails = self::makeUrlDetails($this->userpage);
     } else {
         # This won't be used in the standard skins, but we define it to preserve the interface
         # To save time, we check for existence
         $this->userpageUrlDetails = self::makeKnownUrlDetails($this->userpage);
     }
     $this->usercss = $this->userjs = $this->userjsprev = false;
     $this->setupUserCss();
     $this->setupUserJs($out->isUserJsAllowed());
     $this->titletxt = $this->mTitle->getPrefixedText();
     wfProfileOut("{$fname}-stuff");
     wfProfileIn("{$fname}-stuff2");
     $tpl->set('title', $wgOut->getPageTitle());
     $tpl->set('pagetitle', $wgOut->getHTMLTitle());
     $tpl->set('displaytitle', $wgOut->mPageLinkTitle);
     $tpl->set('pageclass', Sanitizer::escapeClass('page-' . $this->mTitle->getPrefixedText()));
     $nsname = isset($wgCanonicalNamespaceNames[$this->mTitle->getNamespace()]) ? $wgCanonicalNamespaceNames[$this->mTitle->getNamespace()] : $this->mTitle->getNsText();
     $tpl->set('nscanonical', $nsname);
     $tpl->set('nsnumber', $this->mTitle->getNamespace());
     $tpl->set('titleprefixeddbkey', $this->mTitle->getPrefixedDBKey());
     $tpl->set('titletext', $this->mTitle->getText());
     $tpl->set('articleid', $this->mTitle->getArticleId());
     $tpl->set('currevisionid', isset($wgArticle) ? $wgArticle->getLatest() : 0);
     $tpl->set('isarticle', $wgOut->isArticle());
     $tpl->setRef("thispage", $this->thispage);
     $subpagestr = $this->subPageSubtitle();
     $tpl->set('subtitle', !empty($subpagestr) ? '<span class="subpages">' . $subpagestr . '</span>' . $out->getSubtitle() : $out->getSubtitle());
     $undelete = $this->getUndeleteLink();
     $tpl->set("undelete", !empty($undelete) ? '<span class="subpages">' . $undelete . '</span>' : '');
     $tpl->set('catlinks', $this->getCategories());
     if ($wgOut->isSyndicated()) {
         $feeds = array();
         foreach ($wgOut->getSyndicationLinks() as $format => $link) {
             $feeds[$format] = array('text' => wfMsg("feed-{$format}"), 'href' => $link);
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
     if ($wgUseTrackbacks && $out->isArticleRelated()) {
         $tpl->set('trackbackhtml', $wgTitle->trackbackRDF());
     } else {
         $tpl->set('trackbackhtml', null);
     }
     $tpl->setRef('xhtmldefaultnamespace', $wgXhtmlDefaultNamespace);
     $tpl->set('xhtmlnamespaces', $wgXhtmlNamespaces);
     $tpl->setRef('mimetype', $wgMimeType);
     $tpl->setRef('jsmimetype', $wgJsMimeType);
     $tpl->setRef('charset', $wgOutputEncoding);
     $tpl->set('headlinks', $out->getHeadLinks());
     $tpl->set('headscripts', $out->getScript());
     $tpl->setRef('wgScript', $wgScript);
     $tpl->setRef('skinname', $this->skinname);
     $tpl->set('skinclass', get_class($this));
     $tpl->setRef('stylename', $this->stylename);
     $tpl->set('printable', $wgRequest->getBool('printable'));
     $tpl->setRef('loggedin', $this->loggedin);
     $tpl->set('nsclass', 'ns-' . $this->mTitle->getNamespace());
     $tpl->set('notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL);
     /* XXX currently unused, might get useful later
     		$tpl->set( "editable", ($this->mTitle->getNamespace() != NS_SPECIAL ) );
     		$tpl->set( "exists", $this->mTitle->getArticleID() != 0 );
     		$tpl->set( "watch", $this->mTitle->userIsWatching() ? "unwatch" : "watch" );
     		$tpl->set( "protect", count($this->mTitle->isProtected()) ? "unprotect" : "protect" );
     		$tpl->set( "helppage", wfMsg('helppage'));
     		*/
     $tpl->set('searchaction', $this->escapeSearchLink());
     $tpl->set('search', trim($wgRequest->getVal('search')));
     $tpl->setRef('stylepath', $wgStylePath);
     $tpl->setRef('articlepath', $wgArticlePath);
     $tpl->setRef('scriptpath', $wgScriptPath);
     $tpl->setRef('serverurl', $wgServer);
     $tpl->setRef('logopath', $wgLogo);
     $tpl->setRef("lang", $wgContLanguageCode);
     $tpl->set('dir', $wgContLang->isRTL() ? "rtl" : "ltr");
     $tpl->set('rtl', $wgContLang->isRTL());
     $tpl->set('langname', $wgContLang->getLanguageName($wgContLanguageCode));
     $tpl->set('showjumplinks', $wgUser->getOption('showjumplinks'));
     $tpl->set('username', $wgUser->isAnon() ? NULL : $this->username);
     $tpl->setRef('userpage', $this->userpage);
     $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']);
     $tpl->set('userlang', $wgLang->getCode());
     $tpl->set('pagecss', $this->setupPageCss());
     $tpl->setRef('usercss', $this->usercss);
     $tpl->setRef('userjs', $this->userjs);
     $tpl->setRef('userjsprev', $this->userjsprev);
     global $wgUseSiteJs;
     if ($wgUseSiteJs) {
         $jsCache = $this->loggedin ? '&smaxage=0' : '';
         $tpl->set('jsvarurl', self::makeUrl('-', "action=raw{$jsCache}&gen=js&useskin=" . urlencode($this->getSkinName())));
     } else {
         $tpl->set('jsvarurl', false);
     }
     $newtalks = $wgUser->getNewMessageLinks();
     if (count($newtalks) == 1 && $newtalks[0]["wiki"] === wfWikiID()) {
         $usertitle = $this->mUser->getUserPage();
         $usertalktitle = $usertitle->getTalkPage();
         if (!$usertalktitle->equals($this->mTitle)) {
             $ntl = wfMsg('youhavenewmessages', $this->makeKnownLinkObj($usertalktitle, wfMsgHtml('newmessageslink'), 'redirect=no'), $this->makeKnownLinkObj($usertalktitle, wfMsgHtml('newmessagesdifflink'), 'diff=cur'));
             # Disable Cache
             $wgOut->setSquidMaxage(0);
         }
     } else {
         if (count($newtalks)) {
             $sep = str_replace("_", " ", wfMsgHtml("newtalkseperator"));
             $msgs = array();
             foreach ($newtalks as $newtalk) {
                 $msgs[] = wfElement("a", array('href' => $newtalk["link"]), $newtalk["wiki"]);
             }
             $parts = implode($sep, $msgs);
             $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts);
             $wgOut->setSquidMaxage(0);
         } else {
             $ntl = '';
         }
     }
     wfProfileOut("{$fname}-stuff2");
     wfProfileIn("{$fname}-stuff3");
     $tpl->setRef('newtalk', $ntl);
     $tpl->setRef('skin', $this);
     $tpl->set('logo', $this->logoText());
     if ($wgOut->isArticle() and (!isset($oldid) or isset($diff)) and $wgArticle and 0 != $wgArticle->getID()) {
         if (!$wgDisableCounters) {
             $viewcount = $wgLang->formatNum($wgArticle->getCount());
             if ($viewcount) {
                 $tpl->set('viewcount', wfMsgExt('viewcount', array('parseinline'), $viewcount));
             } else {
                 $tpl->set('viewcount', false);
             }
         } else {
             $tpl->set('viewcount', false);
         }
         if ($wgPageShowWatchingUsers) {
             $dbr = wfGetDB(DB_SLAVE);
             $watchlist = $dbr->tableName('watchlist');
             $sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\t\tWHERE wl_title='" . $dbr->strencode($this->mTitle->getDBkey()) . "' AND  wl_namespace=" . $this->mTitle->getNamespace();
             $res = $dbr->query($sql, 'SkinTemplate::outputPage');
             $x = $dbr->fetchObject($res);
             $numberofwatchingusers = $x->n;
             if ($numberofwatchingusers > 0) {
                 $tpl->set('numberofwatchingusers', wfMsgExt('number_of_watching_users_pageview', array('parseinline'), $wgLang->formatNum($numberofwatchingusers)));
             } else {
                 $tpl->set('numberofwatchingusers', false);
             }
         } else {
             $tpl->set('numberofwatchingusers', false);
         }
         $tpl->set('copyright', $this->getCopyright());
         $this->credits = false;
         if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
             require_once "Credits.php";
             $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
         } else {
             $tpl->set('lastmod', $this->lastModified());
         }
         $tpl->setRef('credits', $this->credits);
     } elseif (isset($oldid) && !isset($diff)) {
         $tpl->set('copyright', $this->getCopyright());
         $tpl->set('viewcount', false);
         $tpl->set('lastmod', false);
         $tpl->set('credits', false);
         $tpl->set('numberofwatchingusers', false);
     } else {
         $tpl->set('copyright', false);
         $tpl->set('viewcount', false);
         $tpl->set('lastmod', false);
         $tpl->set('credits', false);
         $tpl->set('numberofwatchingusers', false);
     }
     wfProfileOut("{$fname}-stuff3");
     wfProfileIn("{$fname}-stuff4");
     $tpl->set('copyrightico', $this->getCopyrightIcon());
     $tpl->set('poweredbyico', $this->getPoweredBy());
     $tpl->set('disclaimer', $this->disclaimerLink());
     $tpl->set('privacy', $this->privacyLink());
     $tpl->set('about', $this->aboutLink());
     $tpl->setRef('debug', $out->mDebugtext);
     $tpl->set('reporttime', $out->reportTime());
     $tpl->set('sitenotice', wfGetSiteNotice());
     $tpl->set('bottomscripts', $this->bottomScripts());
     $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
     $out->mBodytext .= $printfooter;
     $tpl->setRef('bodytext', $out->mBodytext);
     # Language links
     $language_urls = array();
     if (!$wgHideInterlanguageLinks) {
         foreach ($wgOut->getLanguageLinks() as $l) {
             $tmp = explode(':', $l, 2);
             $class = 'interwiki-' . $tmp[0];
             unset($tmp);
             $nt = Title::newFromText($l);
             $language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class);
         }
     }
     if (count($language_urls)) {
         $tpl->setRef('language_urls', $language_urls);
     } else {
         $tpl->set('language_urls', false);
     }
     wfProfileOut("{$fname}-stuff4");
     # Personal toolbar
     $tpl->set('personal_urls', $this->buildPersonalUrls());
     $content_actions = $this->buildContentActionUrls();
     $tpl->setRef('content_actions', $content_actions);
     // XXX: attach this from javascript, same with section editing
     if ($this->iseditable && $wgUser->getOption("editondblclick")) {
         $encEditUrl = wfEscapeJsString($this->mTitle->getLocalUrl($this->editUrlOptions()));
         $tpl->set('body_ondblclick', 'document.location = "' . $encEditUrl . '";');
     } else {
         $tpl->set('body_ondblclick', false);
     }
     if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) {
         $tpl->set('body_onload', 'setupRightClickEdit()');
     } else {
         $tpl->set('body_onload', false);
     }
     $tpl->set('sidebar', $this->buildSidebar());
     $tpl->set('nav_urls', $this->buildNavUrls());
     // original version by hansm
     if (!wfRunHooks('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
         wfDebug(__METHOD__ . ': Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!');
     }
     // execute template
     wfProfileIn("{$fname}-execute");
     $res = $tpl->execute();
     wfProfileOut("{$fname}-execute");
     // result may be an error
     $this->printOrError($res);
     wfProfileOut($fname);
 }