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"); } }
function view() { global $wgShowEXIF, $wgRequest, $wgUser; $out = $this->getContext()->getOutput(); $sk = $this->getContext()->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->getDisplayedFile()->exists()) { // FIXME: bad interface, see note on MediaHandler::formatMetadata(). $formattedMetadata = $this->getDisplayedFile()->formatMetadata(); $showmeta = $formattedMetadata !== false; } else { $showmeta = false; } $this->openShowImage(); ImageHelper::showDescription($this->mTitle); $lastUser = $this->getDisplayedFile()->getUser(); $userLink = Linker::makeLinkObj(Title::makeTitle(NS_USER, $lastUser), $lastUser); $out->addHTML("<div style='margin-bottom:20px'></div>"); # Show shared description, if needed if ($this->mExtraDescription) { $fol = wfMsgNoTrans('shareddescriptionfollows'); if ($fol != '-' && !wfEmptyMsg('shareddescriptionfollows', $fol)) { $out->addWikiText($fol); } $out->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>'); } $this->closeShowImage(); $currentHTML = $out->getHTML(); $out->clearHTML(); Article::view(); $articleContent = $out->getHTML(); $out->clearHTML(); $out->addHTML($currentHTML); $diffSeparator = "<h2>" . wfMessage('currentrev')->text() . "</h2>"; $articleParts = explode($diffSeparator, $articleContent); if (count($articleParts) > 1) { $out->addHTML($articleParts[0]); } $ih = new ImageHelper(); $articles = $ih->getLinkedArticles($this->mTitle); if (ImageHelper::IMAGES_ON) { $ih->getConnectedImages($articles, $this->mTitle); $ih->getRelatedWikiHows($this->mTitle, $sk); } $ih->addSideWidgets($this, $this->mTitle, $this->getDisplayedFile()); # No need to display noarticletext, we use our own message, output in openShowImage() if ($this->getID()) { } else { # Just need to set the right headers $out->setArticleFlag(true); $out->setRobotpolicy('noindex,nofollow'); $out->setPageTitle($this->mTitle->getPrefixedText()); //$this->viewUpdates(); } if ($wgUser && !$wgUser->isAnon()) { $this->imageHistory(); } ImageHelper::displayBottomAds(); if ($showmeta) { $out->addHTML(Xml::element('h2', array('id' => 'metadata'), wfMessage('metadata')->text()) . "\n"); $out->addWikiText($this->makeMetadataTable($formattedMetadata)); $out->addModules(array('mediawiki.action.view.metadata')); } }