Пример #1
0
 function reject()
 {
     global $wgOut, $wgUser;
     $dbw = wfGetDB(DB_MASTER);
     $dbw->insert('rejected_email_links', array('rel_text' => "REJECTED\nuserid: " . $wgUser->getID() . "\n" . wfReportTime() . "\nReferer:" . $_SERVER["HTTP_REFERER"] . "\n" . wfGetIP() . "\n" . print_r($_POST, true)), __METHOD__);
     //be coy
     $this->thanks();
 }
Пример #2
0
 /**
  * initialize various variables and generate the template
  *
  * @since 1.23
  * @return QuickTemplate The template to be executed by outputPage
  */
 protected function prepareQuickTemplate()
 {
     global $wgContLang, $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType, $wgSitename, $wgLogo, $wgMaxCredits, $wgShowCreditsIfMax, $wgArticlePath, $wgScriptPath, $wgServer;
     $title = $this->getTitle();
     $request = $this->getRequest();
     $out = $this->getOutput();
     $tpl = $this->setupTemplateForOutput();
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->setRef('thispage', $this->thispage);
     $tpl->setRef('titleprefixeddbkey', $this->thispage);
     $tpl->set('titletext', $title->getText());
     $tpl->set('articleid', $title->getArticleID());
     $tpl->set('isarticle', $out->isArticle());
     $subpagestr = $this->subPageSubtitle();
     if ($subpagestr !== '') {
         $subpagestr = '<span class="subpages">' . $subpagestr . '</span>';
     }
     $tpl->set('subtitle', $subpagestr . $out->getSubtitle());
     $undelete = $this->getUndeleteLink();
     if ($undelete === '') {
         $tpl->set('undelete', '');
     } else {
         $tpl->set('undelete', '<span class="subpages">' . $undelete . '</span>');
     }
     $tpl->set('catlinks', $this->getCategories());
     if ($out->isSyndicated()) {
         $feeds = array();
         foreach ($out->getSyndicationLinks() as $format => $link) {
             $feeds[$format] = array('text' => $this->msg("feed-{$format}")->text(), 'href' => $link);
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
     $tpl->setRef('mimetype', $wgMimeType);
     $tpl->setRef('jsmimetype', $wgJsMimeType);
     $tpl->set('charset', 'UTF-8');
     $tpl->setRef('wgScript', $wgScript);
     $tpl->setRef('skinname', $this->skinname);
     $tpl->set('skinclass', get_class($this));
     $tpl->setRef('skin', $this);
     $tpl->setRef('stylename', $this->stylename);
     $tpl->set('printable', $out->isPrintable());
     $tpl->set('handheld', $request->getBool('handheld'));
     $tpl->setRef('loggedin', $this->loggedin);
     $tpl->set('notspecialpage', !$title->isSpecialPage());
     $tpl->set('searchaction', $this->escapeSearchLink());
     $tpl->set('searchtitle', SpecialPage::getTitleFor('Search')->getPrefixedDBkey());
     $tpl->set('search', trim($request->getVal('search')));
     $tpl->setRef('stylepath', $wgStylePath);
     $tpl->setRef('articlepath', $wgArticlePath);
     $tpl->setRef('scriptpath', $wgScriptPath);
     $tpl->setRef('serverurl', $wgServer);
     $tpl->setRef('logopath', $wgLogo);
     $tpl->setRef('sitename', $wgSitename);
     $userLang = $this->getLanguage();
     $userLangCode = $userLang->getHtmlCode();
     $userLangDir = $userLang->getDir();
     $tpl->set('lang', $userLangCode);
     $tpl->set('dir', $userLangDir);
     $tpl->set('rtl', $userLang->isRTL());
     $tpl->set('capitalizeallnouns', $userLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '');
     $tpl->set('showjumplinks', true);
     // showjumplinks preference has been removed
     $tpl->set('username', $this->loggedin ? $this->username : null);
     $tpl->setRef('userpage', $this->userpage);
     $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']);
     $tpl->set('userlang', $userLangCode);
     // Users can have their language set differently than the
     // content of the wiki. For these users, tell the web browser
     // that interface elements are in a different language.
     $tpl->set('userlangattributes', '');
     $tpl->set('specialpageattributes', '');
     # obsolete
     // Used by VectorBeta to insert HTML before content but after the
     // heading for the page title. Defaults to empty string.
     $tpl->set('prebodyhtml', '');
     if ($userLangCode !== $wgContLang->getHtmlCode() || $userLangDir !== $wgContLang->getDir()) {
         $escUserlang = htmlspecialchars($userLangCode);
         $escUserdir = htmlspecialchars($userLangDir);
         // Attributes must be in double quotes because htmlspecialchars() doesn't
         // escape single quotes
         $attrs = " lang=\"{$escUserlang}\" dir=\"{$escUserdir}\"";
         $tpl->set('userlangattributes', $attrs);
     }
     $tpl->set('newtalk', $this->getNewtalks());
     $tpl->set('logo', $this->logoText());
     $tpl->set('copyright', false);
     // No longer used
     $tpl->set('viewcount', false);
     $tpl->set('lastmod', false);
     $tpl->set('credits', false);
     $tpl->set('numberofwatchingusers', false);
     if ($out->isArticle() && $title->exists()) {
         if ($this->isRevisionCurrent()) {
             if ($wgMaxCredits != 0) {
                 $tpl->set('credits', Action::factory('credits', $this->getWikiPage(), $this->getContext())->getCredits($wgMaxCredits, $wgShowCreditsIfMax));
             } else {
                 $tpl->set('lastmod', $this->lastModified());
             }
         }
         $tpl->set('copyright', $this->getCopyright());
     }
     $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->set('footerlinks', array('info' => array('lastmod', 'numberofwatchingusers', 'credits', 'copyright'), 'places' => array('privacy', 'about', 'disclaimer')));
     global $wgFooterIcons;
     $tpl->set('footericons', $wgFooterIcons);
     foreach ($tpl->data['footericons'] as $footerIconsKey => &$footerIconsBlock) {
         if (count($footerIconsBlock) > 0) {
             foreach ($footerIconsBlock as &$footerIcon) {
                 if (isset($footerIcon['src'])) {
                     if (!isset($footerIcon['width'])) {
                         $footerIcon['width'] = 88;
                     }
                     if (!isset($footerIcon['height'])) {
                         $footerIcon['height'] = 31;
                     }
                 }
             }
         } else {
             unset($tpl->data['footericons'][$footerIconsKey]);
         }
     }
     $tpl->set('indicators', $out->getIndicators());
     $tpl->set('sitenotice', $this->getSiteNotice());
     $tpl->set('bottomscripts', $this->bottomScripts());
     $tpl->set('printfooter', $this->printSource());
     # An ID that includes the actual body text; without categories, contentSub, ...
     $realBodyAttribs = array('id' => 'mw-content-text');
     # Add a mw-content-ltr/rtl class to be able to style based on text direction
     # when the content is different from the UI language, i.e.:
     # not for special pages or file pages AND only when viewing AND if the page exists
     # (or is in MW namespace, because that has default content)
     if (!in_array($title->getNamespace(), array(NS_SPECIAL, NS_FILE)) && Action::getActionName($this) === 'view' && ($title->exists() || $title->getNamespace() == NS_MEDIAWIKI)) {
         $pageLang = $title->getPageViewLanguage();
         $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
         $realBodyAttribs['dir'] = $pageLang->getDir();
         $realBodyAttribs['class'] = 'mw-content-' . $pageLang->getDir();
     }
     $out->mBodytext = Html::rawElement('div', $realBodyAttribs, $out->mBodytext);
     $tpl->setRef('bodytext', $out->mBodytext);
     $language_urls = $this->getLanguages();
     if (count($language_urls)) {
         $tpl->setRef('language_urls', $language_urls);
     } else {
         $tpl->set('language_urls', false);
     }
     # Personal toolbar
     $tpl->set('personal_urls', $this->buildPersonalUrls());
     $content_navigation = $this->buildContentNavigationUrls();
     $content_actions = $this->buildContentActionUrls($content_navigation);
     $tpl->setRef('content_navigation', $content_navigation);
     $tpl->setRef('content_actions', $content_actions);
     $tpl->set('sidebar', $this->buildSidebar());
     $tpl->set('nav_urls', $this->buildNavUrls());
     // Set the head scripts near the end, in case the above actions resulted in added scripts
     $tpl->set('headelement', $out->headElement($this));
     $tpl->set('debug', '');
     $tpl->set('debughtml', $this->generateDebugHTML());
     $tpl->set('reporttime', wfReportTime());
     // original version by hansm
     if (!Hooks::run('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
         wfDebug(__METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n");
     }
     // Set the bodytext to another key so that skins can just output it on its own
     // and output printfooter and debughtml separately
     $tpl->set('bodycontent', $tpl->data['bodytext']);
     // Append printfooter and debughtml onto bodytext so that skins that
     // were already using bodytext before they were split out don't suddenly
     // start not outputting information.
     $tpl->data['bodytext'] .= Html::rawElement('div', array('class' => 'printfooter'), "\n{$tpl->data['printfooter']}") . "\n";
     $tpl->data['bodytext'] .= $tpl->data['debughtml'];
     // allow extensions adding stuff after the page content.
     // See Skin::afterContentHook() for further documentation.
     $tpl->set('dataAfterContent', $this->afterContentHook());
     return $tpl;
 }
Пример #3
0
 /**
  * Deprecated, use wfReportTime() instead.
  * @return string
  * @deprecated
  */
 public function reportTime()
 {
     wfDeprecated(__METHOD__);
     $time = wfReportTime();
     return $time;
 }
Пример #4
0
 /**
  * Execute an action, and in case of an error, erase whatever partial results
  * have been accumulated, and replace it with an error message and a help screen.
  */
 protected function executeActionWithErrorHandling()
 {
     // In case an error occurs during data output,
     // clear the output buffer and print just the error information
     ob_start();
     try {
         $this->executeAction();
     } catch (Exception $e) {
         // Log it
         if ($e instanceof MWException) {
             wfDebugLog('exception', $e->getLogMessage());
         }
         //
         // Handle any kind of exception by outputing properly formatted error message.
         // If this fails, an unhandled exception should be thrown so that global error
         // handler will process and log it.
         //
         $errCode = $this->substituteResultWithError($e);
         // Error results should not be cached
         $this->setCacheMaxAge(0);
         $headerStr = 'MediaWiki-API-Error: ' . $errCode;
         if ($e->getCode() === 0) {
             header($headerStr);
         } else {
             header($headerStr, true, $e->getCode());
         }
         // Reset and print just the error message
         ob_clean();
         // If the error occured during printing, do a printer->profileOut()
         $this->mPrinter->safeProfileOut();
         $this->printResult(true);
     }
     if ($this->mSquidMaxage == -1) {
         # Nobody called setCacheMaxAge(), use the (s)maxage parameters
         $smaxage = $this->getParameter('smaxage');
         $maxage = $this->getParameter('maxage');
     } else {
         $smaxage = $maxage = $this->mSquidMaxage;
     }
     // Set the cache expiration at the last moment, as any errors may change the expiration.
     // if $this->mSquidMaxage == 0, the expiry time is set to the first second of unix epoch
     $exp = min($smaxage, $maxage);
     $expires = $exp == 0 ? 1 : time() + $exp;
     header('Expires: ' . wfTimestamp(TS_RFC2822, $expires));
     header('Cache-Control: s-maxage=' . $smaxage . ', must-revalidate, max-age=' . $maxage);
     if ($this->mPrinter->getIsHtml()) {
         echo wfReportTime();
     }
     ob_end_flush();
 }
Пример #5
0
 /**
  * initialize various variables and generate the template
  *
  * @param $out OutputPage
  */
 function outputPage(OutputPage $out = null)
 {
     global $wgContLang;
     global $wgScript, $wgStylePath;
     global $wgMimeType, $wgJsMimeType;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
     global $wgDisableCounters, $wgSitename, $wgLogo, $wgHideInterlanguageLinks;
     global $wgMaxCredits, $wgShowCreditsIfMax;
     global $wgPageShowWatchingUsers;
     global $wgDebugComments;
     global $wgArticlePath, $wgScriptPath, $wgServer;
     wfProfileIn(__METHOD__);
     Profiler::instance()->setTemplated(true);
     $oldContext = null;
     if ($out !== null) {
         // @todo Add wfDeprecated in 1.20
         $oldContext = $this->getContext();
         $this->setContext($out->getContext());
     }
     $out = $this->getOutput();
     $request = $this->getRequest();
     $user = $this->getUser();
     $title = $this->getTitle();
     wfProfileIn(__METHOD__ . '-init');
     $this->initPage($out);
     $tpl = $this->setupTemplate($this->template, 'skins');
     wfProfileOut(__METHOD__ . '-init');
     wfProfileIn(__METHOD__ . '-stuff');
     $this->thispage = $title->getPrefixedDBkey();
     $this->titletxt = $title->getPrefixedText();
     $this->userpage = $user->getUserPage()->getPrefixedText();
     $query = array();
     if (!$request->wasPosted()) {
         $query = $request->getValues();
         unset($query['title']);
         unset($query['returnto']);
         unset($query['returntoquery']);
     }
     $this->thisquery = wfArrayToCGI($query);
     $this->loggedin = $user->isLoggedIn();
     $this->username = $user->getName();
     if ($this->loggedin || $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);
     }
     wfProfileOut(__METHOD__ . '-stuff');
     wfProfileIn(__METHOD__ . '-stuff-head');
     if (!$this->useHeadElement) {
         $tpl->set('pagecss', false);
         $tpl->set('usercss', false);
         $tpl->set('userjs', false);
         $tpl->set('userjsprev', false);
         $tpl->set('jsvarurl', false);
         $tpl->setRef('xhtmldefaultnamespace', $wgXhtmlDefaultNamespace);
         $tpl->set('xhtmlnamespaces', $wgXhtmlNamespaces);
         $tpl->set('html5version', $wgHtml5Version);
         $tpl->set('headlinks', $out->getHeadLinks());
         $tpl->set('csslinks', $out->buildCssLinks());
         $tpl->set('pageclass', $this->getPageClasses($title));
         $tpl->set('skinnameclass', 'skin-' . Sanitizer::escapeClass($this->getSkinName()));
     }
     wfProfileOut(__METHOD__ . '-stuff-head');
     wfProfileIn(__METHOD__ . '-stuff2');
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->setRef('thispage', $this->thispage);
     $tpl->setRef('titleprefixeddbkey', $this->thispage);
     $tpl->set('titletext', $title->getText());
     $tpl->set('articleid', $title->getArticleId());
     $tpl->set('isarticle', $out->isArticle());
     $subpagestr = $this->subPageSubtitle();
     if ($subpagestr !== '') {
         $subpagestr = '<span class="subpages">' . $subpagestr . '</span>';
     }
     $tpl->set('subtitle', $subpagestr . $out->getSubtitle());
     $undelete = $this->getUndeleteLink();
     if ($undelete === '') {
         $tpl->set('undelete', '');
     } else {
         $tpl->set('undelete', '<span class="subpages">' . $undelete . '</span>');
     }
     $tpl->set('catlinks', $this->getCategories());
     if ($out->isSyndicated()) {
         $feeds = array();
         foreach ($out->getSyndicationLinks() as $format => $link) {
             $feeds[$format] = array('text' => $this->msg("feed-{$format}")->text(), 'href' => $link);
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
     $tpl->setRef('mimetype', $wgMimeType);
     $tpl->setRef('jsmimetype', $wgJsMimeType);
     $tpl->set('charset', 'UTF-8');
     $tpl->setRef('wgScript', $wgScript);
     $tpl->setRef('skinname', $this->skinname);
     $tpl->set('skinclass', get_class($this));
     $tpl->setRef('skin', $this);
     $tpl->setRef('stylename', $this->stylename);
     $tpl->set('printable', $out->isPrintable());
     $tpl->set('handheld', $request->getBool('handheld'));
     $tpl->setRef('loggedin', $this->loggedin);
     $tpl->set('notspecialpage', !$title->isSpecialPage());
     /* XXX currently unused, might get useful later
     		$tpl->set( 'editable', ( !$title->isSpecialPage() ) );
     		$tpl->set( 'exists', $title->getArticleID() != 0 );
     		$tpl->set( 'watch', $title->userIsWatching() ? 'unwatch' : 'watch' );
     		$tpl->set( 'protect', count( $title->isProtected() ) ? 'unprotect' : 'protect' );
     		$tpl->set( 'helppage', $this->msg( 'helppage' )->text() );
     		*/
     $tpl->set('searchaction', $this->escapeSearchLink());
     $tpl->set('searchtitle', SpecialPage::getTitleFor('Search')->getPrefixedDBKey());
     $tpl->set('search', trim($request->getVal('search')));
     $tpl->setRef('stylepath', $wgStylePath);
     $tpl->setRef('articlepath', $wgArticlePath);
     $tpl->setRef('scriptpath', $wgScriptPath);
     $tpl->setRef('serverurl', $wgServer);
     $tpl->setRef('logopath', $wgLogo);
     $tpl->setRef('sitename', $wgSitename);
     $lang = $this->getLanguage();
     $userlang = $lang->getHtmlCode();
     $userdir = $lang->getDir();
     $tpl->set('lang', $userlang);
     $tpl->set('dir', $userdir);
     $tpl->set('rtl', $lang->isRTL());
     $tpl->set('capitalizeallnouns', $lang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '');
     $tpl->set('showjumplinks', $user->getOption('showjumplinks'));
     $tpl->set('username', $this->loggedin ? $this->username : null);
     $tpl->setRef('userpage', $this->userpage);
     $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']);
     $tpl->set('userlang', $userlang);
     // Users can have their language set differently than the
     // content of the wiki. For these users, tell the web browser
     // that interface elements are in a different language.
     $tpl->set('userlangattributes', '');
     $tpl->set('specialpageattributes', '');
     # obsolete
     if ($userlang !== $wgContLang->getHtmlCode() || $userdir !== $wgContLang->getDir()) {
         $escUserlang = htmlspecialchars($userlang);
         $escUserdir = htmlspecialchars($userdir);
         // Attributes must be in double quotes because htmlspecialchars() doesn't
         // escape single quotes
         $attrs = " lang=\"{$escUserlang}\" dir=\"{$escUserdir}\"";
         $tpl->set('userlangattributes', $attrs);
     }
     wfProfileOut(__METHOD__ . '-stuff2');
     wfProfileIn(__METHOD__ . '-stuff3');
     $tpl->set('newtalk', $this->getNewtalks());
     $tpl->set('logo', $this->logoText());
     $tpl->set('copyright', false);
     $tpl->set('viewcount', false);
     $tpl->set('lastmod', false);
     $tpl->set('credits', false);
     $tpl->set('numberofwatchingusers', false);
     if ($out->isArticle() && $title->exists()) {
         if ($this->isRevisionCurrent()) {
             if (!$wgDisableCounters) {
                 $viewcount = $this->getWikiPage()->getCount();
                 if ($viewcount) {
                     $tpl->set('viewcount', $this->msg('viewcount')->numParams($viewcount)->parse());
                 }
             }
             if ($wgPageShowWatchingUsers) {
                 $dbr = wfGetDB(DB_SLAVE);
                 $num = $dbr->selectField('watchlist', 'COUNT(*)', array('wl_title' => $title->getDBkey(), 'wl_namespace' => $title->getNamespace()), __METHOD__);
                 if ($num > 0) {
                     $tpl->set('numberofwatchingusers', $this->msg('number_of_watching_users_pageview')->numParams($num)->parse());
                 }
             }
             if ($wgMaxCredits != 0) {
                 $tpl->set('credits', Action::factory('credits', $this->getWikiPage(), $this->getContext())->getCredits($wgMaxCredits, $wgShowCreditsIfMax));
             } else {
                 $tpl->set('lastmod', $this->lastModified());
             }
         }
         $tpl->set('copyright', $this->getCopyright());
     }
     wfProfileOut(__METHOD__ . '-stuff3');
     wfProfileIn(__METHOD__ . '-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->set('footerlinks', array('info' => array('lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright'), 'places' => array('privacy', 'about', 'disclaimer')));
     global $wgFooterIcons;
     $tpl->set('footericons', $wgFooterIcons);
     foreach ($tpl->data['footericons'] as $footerIconsKey => &$footerIconsBlock) {
         if (count($footerIconsBlock) > 0) {
             foreach ($footerIconsBlock as &$footerIcon) {
                 if (isset($footerIcon['src'])) {
                     if (!isset($footerIcon['width'])) {
                         $footerIcon['width'] = 88;
                     }
                     if (!isset($footerIcon['height'])) {
                         $footerIcon['height'] = 31;
                     }
                 }
             }
         } else {
             unset($tpl->data['footericons'][$footerIconsKey]);
         }
     }
     if ($wgDebugComments) {
         $tpl->setRef('debug', $out->mDebugtext);
     } else {
         $tpl->set('debug', '');
     }
     $tpl->set('sitenotice', $this->getSiteNotice());
     $tpl->set('bottomscripts', $this->bottomScripts());
     $tpl->set('printfooter', $this->printSource());
     # An ID that includes the actual body text; without categories, contentSub, ...
     $realBodyAttribs = array('id' => 'mw-content-text');
     # Add a mw-content-ltr/rtl class to be able to style based on text direction
     # when the content is different from the UI language, i.e.:
     # not for special pages or file pages AND only when viewing AND if the page exists
     # (or is in MW namespace, because that has default content)
     if (!in_array($title->getNamespace(), array(NS_SPECIAL, NS_FILE)) && in_array($request->getVal('action', 'view'), array('view', 'historysubmit')) && ($title->exists() || $title->getNamespace() == NS_MEDIAWIKI)) {
         $pageLang = $title->getPageLanguage();
         $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
         $realBodyAttribs['dir'] = $pageLang->getDir();
         $realBodyAttribs['class'] = 'mw-content-' . $pageLang->getDir();
     }
     $out->mBodytext = Html::rawElement('div', $realBodyAttribs, $out->mBodytext);
     $tpl->setRef('bodytext', $out->mBodytext);
     # Language links
     $language_urls = array();
     if (!$wgHideInterlanguageLinks) {
         foreach ($out->getLanguageLinks() as $l) {
             $tmp = explode(':', $l, 2);
             $class = 'interwiki-' . $tmp[0];
             unset($tmp);
             $nt = Title::newFromText($l);
             if ($nt) {
                 $language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'title' => $nt->getText(), 'class' => $class, 'lang' => $nt->getInterwiki(), 'hreflang' => $nt->getInterwiki());
             }
         }
     }
     if (count($language_urls)) {
         $tpl->setRef('language_urls', $language_urls);
     } else {
         $tpl->set('language_urls', false);
     }
     wfProfileOut(__METHOD__ . '-stuff4');
     wfProfileIn(__METHOD__ . '-stuff5');
     # Personal toolbar
     $tpl->set('personal_urls', $this->buildPersonalUrls());
     $content_navigation = $this->buildContentNavigationUrls();
     $content_actions = $this->buildContentActionUrls($content_navigation);
     $tpl->setRef('content_navigation', $content_navigation);
     $tpl->setRef('content_actions', $content_actions);
     $tpl->set('sidebar', $this->buildSidebar());
     $tpl->set('nav_urls', $this->buildNavUrls());
     // Set the head scripts near the end, in case the above actions resulted in added scripts
     if ($this->useHeadElement) {
         $tpl->set('headelement', $out->headElement($this));
     } else {
         $tpl->set('headscripts', $out->getHeadScripts() . $out->getHeadItems());
     }
     $tpl->set('debughtml', $this->generateDebugHTML());
     $tpl->set('reporttime', wfReportTime());
     // original version by hansm
     if (!wfRunHooks('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
         wfDebug(__METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n");
     }
     // Set the bodytext to another key so that skins can just output it on it's own
     // and output printfooter and debughtml separately
     $tpl->set('bodycontent', $tpl->data['bodytext']);
     // Append printfooter and debughtml onto bodytext so that skins that were already
     // using bodytext before they were split out don't suddenly start not outputting information
     $tpl->data['bodytext'] .= Html::rawElement('div', array('class' => 'printfooter'), "\n{$tpl->data['printfooter']}") . "\n";
     $tpl->data['bodytext'] .= $tpl->data['debughtml'];
     // allow extensions adding stuff after the page content.
     // See Skin::afterContentHook() for further documentation.
     $tpl->set('dataAfterContent', $this->afterContentHook());
     wfProfileOut(__METHOD__ . '-stuff5');
     // execute template
     wfProfileIn(__METHOD__ . '-execute');
     $res = $tpl->execute();
     wfProfileOut(__METHOD__ . '-execute');
     // result may be an error
     $this->printOrError($res);
     if ($oldContext) {
         $this->setContext($oldContext);
     }
     wfProfileOut(__METHOD__);
 }
Пример #6
0
<?php

echo wfReportTime();
Пример #7
0
 /**
  * Returns a HTML comment with the elapsed time since request.
  * This method has no side effects.
  * Use wfReportTime() instead.
  * @return string
  * @deprecated
  */
 function reportTime()
 {
     $time = wfReportTime();
     return $time;
 }
Пример #8
0
 /**
  * initialize various variables and generate the template
  *
  * @param $out OutputPage
  */
 function outputPage(OutputPage $out)
 {
     global $wgArticle, $wgUser, $wgLang, $wgContLang;
     global $wgScript, $wgStylePath, $wgContLanguageCode;
     global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
     global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
     global $wgMaxCredits, $wgShowCreditsIfMax;
     global $wgPageShowWatchingUsers;
     global $wgUseTrackbacks, $wgUseSiteJs, $wgDebugComments;
     global $wgArticlePath, $wgScriptPath, $wgServer;
     wfProfileIn(__METHOD__);
     $oldid = $wgRequest->getVal('oldid');
     $diff = $wgRequest->getVal('diff');
     $action = $wgRequest->getVal('action', 'view');
     wfProfileIn(__METHOD__ . '-init');
     $this->initPage($out);
     $this->setMembers();
     $tpl = $this->setupTemplate($this->template, 'skins');
     #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
     $tpl->setTranslator(new MediaWiki_I18N());
     #}
     wfProfileOut(__METHOD__ . '-init');
     wfProfileIn(__METHOD__ . '-stuff');
     $this->thispage = $this->mTitle->getPrefixedDBkey();
     $this->thisurl = $this->mTitle->getPrefixedURL();
     $query = array();
     if (!$wgRequest->wasPosted()) {
         $query = $wgRequest->getValues();
         unset($query['title']);
         unset($query['returnto']);
         unset($query['returntoquery']);
     }
     $this->thisquery = wfUrlencode(wfArrayToCGI($query));
     $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();
     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->titletxt = $this->mTitle->getPrefixedText();
     wfProfileOut(__METHOD__ . '-stuff');
     wfProfileIn(__METHOD__ . '-stuff-head');
     if ($this->useHeadElement) {
         $pagecss = $this->setupPageCss();
         if ($pagecss) {
             $out->addInlineStyle($pagecss);
         }
     } else {
         $this->setupUserCss($out);
         $tpl->set('pagecss', $this->setupPageCss());
         $tpl->setRef('usercss', $this->usercss);
         $this->userjs = $this->userjsprev = false;
         $this->setupUserJs($out->isUserJsAllowed());
         $tpl->setRef('userjs', $this->userjs);
         $tpl->setRef('userjsprev', $this->userjsprev);
         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);
         }
         $tpl->setRef('xhtmldefaultnamespace', $wgXhtmlDefaultNamespace);
         $tpl->set('xhtmlnamespaces', $wgXhtmlNamespaces);
         $tpl->set('html5version', $wgHtml5Version);
         $tpl->set('headlinks', $out->getHeadLinks());
         $tpl->set('csslinks', $out->buildCssLinks());
         if ($wgUseTrackbacks && $out->isArticleRelated()) {
             $tpl->set('trackbackhtml', $out->getTitle()->trackbackRDF());
         } else {
             $tpl->set('trackbackhtml', null);
         }
     }
     wfProfileOut(__METHOD__ . '-stuff-head');
     wfProfileIn(__METHOD__ . '-stuff2');
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->set('pageclass', $this->getPageClasses($this->mTitle));
     $tpl->set('skinnameclass', 'skin-' . Sanitizer::escapeClass($this->getSkinName()));
     $nsname = MWNamespace::exists($this->mTitle->getNamespace()) ? MWNamespace::getCanonicalName($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', $out->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 ($out->isSyndicated()) {
         $feeds = array();
         foreach ($out->getSyndicationLinks() as $format => $link) {
             $feeds[$format] = array('text' => wfMsg("feed-{$format}"), 'href' => $link);
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
     $tpl->setRef('mimetype', $wgMimeType);
     $tpl->setRef('jsmimetype', $wgJsMimeType);
     $tpl->setRef('charset', $wgOutputEncoding);
     $tpl->setRef('wgScript', $wgScript);
     $tpl->setRef('skinname', $this->skinname);
     $tpl->set('skinclass', get_class($this));
     $tpl->setRef('stylename', $this->stylename);
     $tpl->set('printable', $out->isPrintable());
     $tpl->set('handheld', $wgRequest->getBool('handheld'));
     $tpl->setRef('loggedin', $this->loggedin);
     $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('searchtitle', SpecialPage::getTitleFor('Search')->getPrefixedDBKey());
     $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->getDir());
     $tpl->set('rtl', $wgContLang->isRTL());
     $tpl->set('capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '');
     $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());
     // Users can have their language set differently than the
     // content of the wiki. For these users, tell the web browser
     // that interface elements are in a different language.
     $tpl->set('userlangattributes', '');
     $tpl->set('specialpageattributes', '');
     $lang = $wgLang->getCode();
     $dir = $wgLang->getDir();
     if ($lang !== $wgContLang->getCode() || $dir !== $wgContLang->getDir()) {
         $attrs = " lang='{$lang}' dir='{$dir}'";
         $tpl->set('userlangattributes', $attrs);
         // The content of SpecialPages should be presented in the
         // user's language. Content of regular pages should not be touched.
         if ($this->mTitle->isSpecialPage()) {
             $tpl->set('specialpageattributes', $attrs);
         }
     }
     $newtalks = $wgUser->getNewMessageLinks();
     $ntl = '';
     if (count($newtalks) == 1 && $newtalks[0]['wiki'] === wfWikiID()) {
         $usertitle = $this->mUser->getUserPage();
         $usertalktitle = $usertitle->getTalkPage();
         if (!$usertalktitle->equals($this->mTitle)) {
             $newmessageslink = $this->link($usertalktitle, wfMsgHtml('newmessageslink'), array(), array('redirect' => 'no'), array('known', 'noclasses'));
             $newmessagesdifflink = $this->link($usertalktitle, wfMsgHtml('newmessagesdifflink'), array(), array('diff' => 'cur'), array('known', 'noclasses'));
             $ntl = wfMsg('youhavenewmessages', $newmessageslink, $newmessagesdifflink);
             # Disable Cache
             $out->setSquidMaxage(0);
         }
     } else {
         if (count($newtalks)) {
             // _>" " for BC <= 1.16
             $sep = str_replace('_', ' ', wfMsgHtml('newtalkseparator'));
             $msgs = array();
             foreach ($newtalks as $newtalk) {
                 $msgs[] = Xml::element('a', array('href' => $newtalk['link']), $newtalk['wiki']);
             }
             $parts = implode($sep, $msgs);
             $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts);
             $out->setSquidMaxage(0);
         }
     }
     wfProfileOut(__METHOD__ . '-stuff2');
     wfProfileIn(__METHOD__ . '-stuff3');
     $tpl->setRef('newtalk', $ntl);
     $tpl->setRef('skin', $this);
     $tpl->set('logo', $this->logoText());
     if ($out->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');
             $res = $dbr->select('watchlist', array('COUNT(*) AS n'), array('wl_title' => $dbr->strencode($this->mTitle->getDBkey()), 'wl_namespace' => $this->mTitle->getNamespace()), __METHOD__);
             $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 ($wgMaxCredits != 0) {
             $this->credits = 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(__METHOD__ . '-stuff3');
     wfProfileIn(__METHOD__ . '-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());
     if ($wgDebugComments) {
         $tpl->setRef('debug', $out->mDebugtext);
     } else {
         $tpl->set('debug', '');
     }
     $tpl->set('reporttime', wfReportTime());
     $tpl->set('sitenotice', wfGetSiteNotice());
     $tpl->set('bottomscripts', $this->bottomScripts());
     $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
     $out->mBodytext .= $printfooter . $this->generateDebugHTML();
     $tpl->setRef('bodytext', $out->mBodytext);
     # Language links
     $language_urls = array();
     if (!$wgHideInterlanguageLinks) {
         foreach ($out->getLanguageLinks() as $l) {
             $tmp = explode(':', $l, 2);
             $class = 'interwiki-' . $tmp[0];
             unset($tmp);
             $nt = Title::newFromText($l);
             if ($nt) {
                 $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(__METHOD__ . '-stuff4');
     wfProfileIn(__METHOD__ . '-stuff5');
     # Personal toolbar
     $tpl->set('personal_urls', $this->buildPersonalUrls());
     $content_actions = $this->buildContentActionUrls();
     $tpl->setRef('content_actions', $content_actions);
     $tpl->set('sidebar', $this->buildSidebar());
     $tpl->set('nav_urls', $this->buildNavUrls());
     // Set the head scripts near the end, in case the above actions resulted in added scripts
     if ($this->useHeadElement) {
         $tpl->set('headelement', $out->headElement($this));
     } else {
         $tpl->set('headscripts', $out->getScript());
     }
     // original version by hansm
     if (!wfRunHooks('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
         wfDebug(__METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n");
     }
     // allow extensions adding stuff after the page content.
     // See Skin::afterContentHook() for further documentation.
     $tpl->set('dataAfterContent', $this->afterContentHook());
     wfProfileOut(__METHOD__ . '-stuff5');
     // execute template
     wfProfileIn(__METHOD__ . '-execute');
     $res = $tpl->execute();
     wfProfileOut(__METHOD__ . '-execute');
     // result may be an error
     $this->printOrError($res);
     wfProfileOut(__METHOD__);
 }
Пример #9
0
 /**
  * initialize various variables and generate the template
  *
  * @param $out OutputPage
  */
 function outputPage(OutputPage $out)
 {
     global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang;
     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, $wgUseSiteJs;
     global $wgArticlePath, $wgScriptPath, $wgServer, $wgLang, $wgCanonicalNamespaceNames;
     wfProfileIn(__METHOD__);
     $oldid = $wgRequest->getVal('oldid');
     $diff = $wgRequest->getVal('diff');
     wfProfileIn(__METHOD__ . "-init");
     $this->initPage($out);
     $this->setMembers();
     $tpl = $this->setupTemplate($this->template, 'skins');
     #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
     $tpl->setTranslator(new MediaWiki_I18N());
     #}
     wfProfileOut(__METHOD__ . "-init");
     wfProfileIn(__METHOD__ . "-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();
     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->userjs = $this->userjsprev = false;
     $this->setupUserCss($out);
     $this->setupUserJs($out->isUserJsAllowed());
     $this->titletxt = $this->mTitle->getPrefixedText();
     wfProfileOut(__METHOD__ . "-stuff");
     wfProfileIn(__METHOD__ . "-stuff2");
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->set('pageclass', $this->getPageClasses($this->mTitle));
     $tpl->set('skinnameclass', "skin-" . Sanitizer::escapeClass($this->getSkinName()));
     $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', $out->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 ($out->isSyndicated()) {
         $feeds = array();
         foreach ($out->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->set('csslinks', $out->buildCssLinks());
     $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->set('handheld', $wgRequest->getBool('handheld'));
     $tpl->setRef('loggedin', $this->loggedin);
     $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);
     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
             $out->setSquidMaxage(0);
         }
     } else {
         if (count($newtalks)) {
             $sep = str_replace("_", " ", wfMsgHtml("newtalkseparator"));
             $msgs = array();
             foreach ($newtalks as $newtalk) {
                 $msgs[] = Xml::element("a", array('href' => $newtalk["link"]), $newtalk["wiki"]);
             }
             $parts = implode($sep, $msgs);
             $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts);
             $out->setSquidMaxage(0);
         } else {
             $ntl = '';
         }
     }
     wfProfileOut(__METHOD__ . "-stuff2");
     wfProfileIn(__METHOD__ . "-stuff3");
     $tpl->setRef('newtalk', $ntl);
     $tpl->setRef('skin', $this);
     $tpl->set('logo', $this->logoText());
     if ($out->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 ($wgMaxCredits != 0) {
             $this->credits = 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(__METHOD__ . "-stuff3");
     wfProfileIn(__METHOD__ . "-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', wfReportTime());
     $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 ($out->getLanguageLinks() as $l) {
             $tmp = explode(':', $l, 2);
             $class = 'interwiki-' . $tmp[0];
             unset($tmp);
             $nt = Title::newFromText($l);
             if ($nt) {
                 $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(__METHOD__ . "-stuff4");
     wfProfileIn(__METHOD__ . "-stuff5");
     # 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 = Xml::escapeJsString($this->mTitle->getLocalUrl($this->editUrlOptions()));
         $tpl->set('body_ondblclick', 'document.location = "' . $encEditUrl . '";');
     } else {
         $tpl->set('body_ondblclick', false);
     }
     $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!');
     }
     // allow extensions adding stuff after the page content.
     // See Skin::afterContentHook() for further documentation.
     $tpl->set('dataAfterContent', $this->afterContentHook());
     wfProfileOut(__METHOD__ . "-stuff5");
     // execute template
     wfProfileIn(__METHOD__ . "-execute");
     $res = $tpl->execute();
     wfProfileOut(__METHOD__ . "-execute");
     // result may be an error
     $this->printOrError($res);
     wfProfileOut(__METHOD__);
 }
Пример #10
0
    /**
     * Template filter callback for wikiHow skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    public function execute()
    {
        global $wgUser, $wgLang, $wgTitle, $wgRequest, $wgParser, $wgGoogleSiteVerification;
        global $wgOut, $wgScript, $wgStylePath, $wgLanguageCode, $wgForumLink;
        global $wgContLang, $wgXhtmlDefaultNamespace, $wgContLanguageCode;
        global $wgWikiHowSections, $IP, $wgServer, $wgServerName, $wgIsDomainTest;
        global $wgSSLsite, $wgSpecialPages;
        $prefix = "";
        if (class_exists('MobileWikihow')) {
            $mobileWikihow = new MobileWikihow();
            $result = $mobileWikihow->controller();
            // false means we stop processing template
            if (!$result) {
                return;
            }
        }
        $action = $wgRequest->getVal('action', 'view');
        if (count($wgRequest->getVal('diff')) > 0) {
            $action = 'diff';
        }
        $isMainPage = $wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgTitle->getText() == wfMessage('mainpage')->inContentLanguage()->text() && $action == 'view';
        $isArticlePage = $wgTitle && !$isMainPage && $wgTitle->getNamespace() == NS_MAIN && $action == 'view';
        $isDocViewer = $wgTitle->getText() == "DocViewer";
        $isBehindHttpAuth = !empty($_SERVER['HTTP_AUTHORIZATION']);
        // determine whether or not the user is logged in
        $isLoggedIn = $wgUser->getID() > 0;
        $isTool = false;
        wfRunHooks('getToolStatus', array(&$isTool));
        $sk = $this->getSkin();
        wikihowAds::setCategories();
        if (!$isLoggedIn && $action == "view") {
            wikihowAds::getGlobalChannels();
        }
        $showAds = wikihowAds::isEligibleForAds();
        $isIndexed = RobotPolicy::isIndexable($wgTitle);
        $pageTitle = SkinWikihowSkin::getHTMLTitle($wgOut->getHTMLTitle(), $this->data['title'], $isMainPage);
        // set the title and what not
        $avatar = '';
        $namespace = $wgTitle->getNamespace();
        if ($namespace == NS_USER || $namespace == NS_USER_TALK) {
            $username = $wgTitle->getText();
            $usernameKey = $wgTitle->getDBKey();
            $avatar = $wgLanguageCode == 'en' ? Avatar::getPicture($usernameKey) : "";
            $h1 = $username;
            if ($wgTitle->getNamespace() == NS_USER_TALK) {
                $h1 = $wgLang->getNsText(NS_USER_TALK) . ": {$username}";
            } elseif ($username == $wgUser->getName()) {
                //user's own page
                $profileBoxName = wfMessage('profilebox-name')->text();
                $h1 .= "<div id='gatEditRemoveButtons'>\n\t\t\t\t\t\t\t\t<a href='/Special:Profilebox' id='gatProfileEditButton'>Edit</a>\n\t\t\t\t\t\t\t\t | <a href='#' onclick='removeUserPage(\"{$profileBoxName}\");'>Remove {$profileBoxName}</a>\n\t\t\t\t\t\t\t\t </div>";
            }
            $this->set("title", $h1);
        }
        $logoutPage = $wgLang->specialPage("Userlogout");
        $returnTarget = $wgTitle->getPrefixedURL();
        $returnto = strcasecmp(urlencode($logoutPage), $returnTarget) ? "returnto={$returnTarget}" : "";
        $login = "";
        if (!$wgUser->isAnon()) {
            $uname = $wgUser->getName();
            if (strlen($uname) > 16) {
                $uname = substr($uname, 0, 16) . "...";
            }
            $login = wfMessage('welcome_back', $wgUser->getUserPage()->getFullURL(), $uname)->text();
            if ($wgLanguageCode == 'en' && $wgUser->isFacebookUser()) {
                $login = wfMessage('welcome_back_fb', $wgUser->getUserPage()->getFullURL(), $wgUser->getName())->text();
            } elseif ($wgLanguageCode == 'en' && $wgUser->isGPlusUser()) {
                $gname = $wgUser->getName();
                if (substr($gname, 0, 3) == 'GP_') {
                    $gname = substr($gname, 0, 12) . '...';
                }
                $login = wfMessage('welcome_back_gp', $wgUser->getUserPage()->getFullURL(), $gname)->text();
            }
        } else {
            if ($wgLanguageCode == "en") {
                $login = wfMessage('signup_or_login', $returnto)->text() . " " . wfMessage('social_connect_header')->text();
            } else {
                $login = wfMessage('signup_or_login', $returnto)->text();
            }
        }
        //XX PROFILE EDIT/CREAT/DEL BOX DATE - need to check for pb flag in order to display this.
        $pbDate = "";
        $pbDateFlag = 0;
        $profilebox_name = wfMessage('profilebox-name')->text();
        if ($wgTitle->getNamespace() == NS_USER) {
            if ($u = User::newFromName($wgTitle->getDBKey())) {
                if (UserPagePolicy::isGoodUserPage($wgTitle->getDBKey())) {
                    $pbDate = ProfileBox::getPageTop($u);
                    $pbDateFlag = true;
                }
            }
        }
        $heading = '';
        if (!$sk->suppressH1Tag()) {
            if ($wgTitle->getNamespace() == NS_MAIN && $wgTitle->exists() && $action == "view") {
                if (Microdata::showRecipeTags() && Microdata::showhRecipeTags()) {
                    $itemprop_name1 = " fn'";
                    $itemprop_name2 = "";
                } else {
                    $itemprop_name1 = "' itemprop='name'";
                    $itemprop_name2 = " itemprop='url'";
                }
                $heading = "<h1 class='firstHeading" . $itemprop_name1 . "><a href=\"" . $wgTitle->getFullURL() . "\"" . $itemprop_name2 . ">" . wfMessage('howto', $this->data['title'])->text() . "</a></h1>";
            } else {
                if ($wgTitle->getNamespace() == NS_USER && UserPagePolicy::isGoodUserPage($wgTitle->getDBKey()) || $wgTitle->getNamespace() == NS_USER_TALK) {
                    $heading = "<h1 class=\"firstHeading\" >" . $this->data['title'] . "</h1>  " . $pbDate;
                    if ($avatar) {
                        $heading = $avatar . "<div id='avatarNameWrap'>" . $heading . "</div><div style='clear: both;'> </div>";
                    }
                } else {
                    if ($this->data['title'] && strtolower(substr($wgTitle->getText(), 0, 9)) != 'userlogin') {
                        $heading = "<h1 class='firstHeading'>" . $this->data['title'] . "</h1>";
                    }
                }
            }
        }
        // get the breadcrumbs / category links at the top of the page
        $catLinksTop = $sk->getCategoryLinks(true);
        wfRunHooks('getBreadCrumbs', array(&$catLinksTop));
        $mainPageObj = Title::newMainPage();
        $isPrintable = false;
        if (MWNamespace::isTalk($wgTitle->getNamespace()) && $action == "view") {
            $isPrintable = $wgRequest->getVal("printable") == "yes";
        }
        // QWER links for everyone on all pages
        //$helplink = Linker::link(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMessage('help')->text());
        $logoutlink = Linker::link(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMessage('logout')->text());
        $rsslink = "<a href='" . $wgServer . "/feed.rss'>" . wfMessage('rss')->text() . "</a>";
        $rplink = Linker::link(Title::makeTitle(NS_SPECIAL, "Randompage"), wfMessage('randompage')->text());
        if ($wgTitle->getNamespace() == NS_MAIN && !$isMainPage && $wgTitle->userCan('edit')) {
            $links[] = array(Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL(), wfMessage('recentchangeslinked')->text());
        }
        //Editing Tools
        $uploadlink = "";
        $freephotoslink = "";
        $uploadlink = Linker::link(Title::makeTitle(NS_SPECIAL, "Upload"), wfMessage('upload')->text());
        $freephotoslink = Linker::link(Title::makeTitle(NS_SPECIAL, "ImportFreeImages"), wfMessage('imageimport')->text());
        $relatedchangeslink = "";
        if ($isArticlePage) {
            $relatedchangeslink = "<li> <a href='" . Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMessage('recentchangeslinked')->text() . "</a></li>";
        }
        //search
        $searchTitle = Title::makeTitle(NS_SPECIAL, "LSearch");
        $otherLanguageLinks = array();
        $translationData = array();
        if ($this->data['language_urls']) {
            foreach ($this->data['language_urls'] as $lang) {
                if ($lang['code'] == $wgLanguageCode) {
                    continue;
                }
                $otherLanguageLinks[$lang['code']] = $lang['href'];
                $langMsg = $sk->getInterWikiCTA($lang['code'], $lang['text'], $lang['href']);
                if (!$langMsg) {
                    continue;
                }
                $encLangMsg = json_encode($langMsg);
                $translationData[] = "'{$lang['code']}': {'msg':{$encLangMsg}}";
            }
        }
        if (!$isMainPage && !$isDocViewer && (!isset($_COOKIE['sitenoticebox']) || !$_COOKIE['sitenoticebox'])) {
            $siteNotice = $sk->getSiteNotice();
        } else {
            $siteNotice = '';
        }
        // Right-to-left languages
        $dir = $wgContLang->isRTL() ? "rtl" : "ltr";
        $head_element = "<html xmlns:fb=\"https://www.facebook.com/2008/fbml\" xmlns=\"{$wgXhtmlDefaultNamespace}\" xml:lang=\"{$wgContLanguageCode}\" lang=\"{$wgContLanguageCode}\" dir='{$dir}'>\n";
        $rtl_css = "";
        if ($wgContLang->isRTL()) {
            $rtl_css = "<style type=\"text/css\" media=\"all\">/*<![CDATA[*/ @import \\a" . wfGetPad("/extensions/min/f/skins/WikiHow/rtl.css") . "\"; /*]]>*/</style>";
            $rtl_css .= "\n   <!--[if IE]>\n   <style type=\"text/css\">\n   BODY { margin: 25px; }\n   </style>\n   <![endif]-->";
        }
        $printable_media = "print";
        if ($wgRequest->getVal('printable') == 'yes') {
            $printable_media = "all";
        }
        $top_search = "";
        $footer_search = "";
        if ($wgLanguageCode == 'en') {
            //INTL: Search options for the english site are a bit more complex
            if (!$isLoggedIn) {
                $top_search = GoogSearch::getSearchBox("cse-search-box");
            } else {
                $top_search = '
				   <form id="bubble_search" name="search_site" action="' . $searchTitle->getFullURL() . '" method="get">
				   <input type="text" class="search_box" name="search" x-webkit-speech />
				   <input type="submit" value="Search" id="search_site_bubble" class="search_button" />
				   </form>';
            }
        } else {
            //INTL: International search just uses Google custom search
            $top_search = GoogSearch::getSearchBox("cse-search-box");
        }
        $text = $this->data['bodytext'];
        // Remove stray table under video section. Probably should eventually do it at
        // the source, but then have to go through all articles.
        if (strpos($text, '<a name="Video">') !== false) {
            $vidpattern = "<p><br /></p>\n<center>\n<table width=\"375px\">\n<tr>\n<td><br /></td>\n<td align=\"left\"></td>\n</tr>\n</table>\n</center>\n<p><br /></p>";
            $text = str_replace($vidpattern, "", $text);
        }
        $this->data['bodytext'] = $text;
        // hack to get the FA template working, remove after we go live
        $fa = '';
        if ($wgLanguageCode != "nl" && strpos($this->data['bodytext'], 'featurestar') !== false) {
            $fa = '<p id="feature_star">' . wfMessage('featured_article')->text() . '</p>';
            //$this->data['bodytext'] = preg_replace("@<div id=\"featurestar\">(.|\n)*<div style=\"clear:both\"></div>@mU", '', $this->data['bodytext']);
        }
        $body = '';
        if ($wgTitle->userCan('edit') && $action != 'edit' && $action != 'diff' && $action != 'history' && ($isLoggedIn && !in_array($wgTitle->getNamespace(), array(NS_USER, NS_USER_TALK, NS_IMAGE, NS_CATEGORY)) || !in_array($wgTitle->getNamespace(), array(NS_USER, NS_USER_TALK, NS_IMAGE, NS_CATEGORY)))) {
            //INTL: Need bigger buttons for non-english sites
            $editlink_text = $wgTitle->getNamespace() == NS_MAIN ? wfMessage('editarticle')->text() : wfMessage('edit')->text();
            $heading = '<a href="' . $wgTitle->getLocalURL($sk->editUrlOptions()) . '" class="editsection">' . $editlink_text . '</a>' . $heading;
        }
        if ($isArticlePage || $wgTitle->getNamespace() == NS_PROJECT && $action == 'view' || $wgTitle->getNamespace() == NS_CATEGORY && !$wgTitle->exists()) {
            if ($wgTitle->getNamespace() == NS_PROJECT && ($wgTitle->getDbKey() == 'RSS-feed' || $wgTitle->getDbKey() == 'Rising-star-feed')) {
                $list_page = true;
                $sticky = false;
            } else {
                $list_page = false;
                $sticky = true;
            }
            $body .= $heading . ArticleAuthors::getAuthorHeader() . $this->data['bodytext'];
            $body = '<div id="bodycontents">' . $body . '</div>';
            $wikitext = ContentHandler::getContentText($this->getSkin()->getContext()->getWikiPage()->getContent(Revision::RAW));
            $magic = WikihowArticleHTML::grabTheMagic($wikitext);
            $this->data['bodytext'] = WikihowArticleHTML::processArticleHTML($body, array('sticky-headers' => $sticky, 'ns' => $wgTitle->getNamespace(), 'list-page' => $list_page, 'magic-word' => $magic));
        } else {
            if ($action == 'edit') {
                $heading .= WikihowArticleEditor::grabArticleEditLinks($wgRequest->getVal("guidededitor"));
            }
            $this->data['bodyheading'] = $heading;
            $body = '<div id="bodycontents">' . $this->data['bodytext'] . '</div>';
            if (!$isTool) {
                $this->data['bodytext'] = WikihowArticleHTML::processHTML($body, $action, array('show-gray-container' => $sk->showGrayContainer()));
            } else {
                // a little hack to style the no such special page messages for special pages that actually
                // exist
                if (false !== strpos($body, 'You have arrived at a "special page"')) {
                    $body = "<div class='minor_section'>{$body}</div>";
                }
                $this->data['bodytext'] = $body;
            }
        }
        // post-process the Steps section HTML to get the numbers working
        if ($wgTitle->getNamespace() == NS_MAIN && !$isMainPage && ($action == 'view' || $action == 'purge')) {
            // for preview article after edit, you have to munge the
            // steps of the previewHTML manually
            $body = $this->data['bodytext'];
            $opts = array();
            if (!$showAds) {
                $opts['no-ads'] = true;
            }
            //$this->data['bodytext'] = WikihowArticleHTML::postProcess($body, $opts);
        }
        // insert avatars into discussion, talk, and kudos pages
        if (MWNamespace::isTalk($wgTitle->getNamespace()) || $wgTitle->getNamespace() == NS_USER_KUDOS) {
            $this->data['bodytext'] = Avatar::insertAvatarIntoDiscussion($this->data['bodytext']);
        }
        //$navMenu = $sk->genNavigationMenu();
        $navTabs = $sk->genNavigationTabs();
        // set up the main page
        $mpActions = "";
        $mpWorldwide = '

		';
        $profileBoxIsUser = false;
        if ($isLoggedIn && $wgTitle && $wgTitle->getNamespace() == NS_USER) {
            $name = $wgTitle->getDBKey();
            $profileBoxUser = User::newFromName($name);
            if ($profileBoxUser && $wgUser->getID() == $profileBoxUser->getID()) {
                $profileBoxIsUser = true;
            }
        }
        // Reuben (11/2013): Micro-customization as a test for BR
        //$slowSpeedUsers = array('BR');
        $slowSpeedUsers = array();
        $isSlowSpeedUser = $wgUser && in_array($wgUser->getName(), $slowSpeedUsers);
        $optimizelyJS = false;
        if (class_exists('OptimizelyPageSelector') && $wgTitle) {
            if (OptimizelyPageSelector::isArticleEnabled($wgTitle) && OptimizelyPageSelector::isUserEnabled($wgUser)) {
                $optimizelyJS = OptimizelyPageSelector::getOptimizelyTag();
            }
        }
        $showSpotlightRotate = $isMainPage && $wgLanguageCode == 'en';
        $showBreadCrumbs = $sk->showBreadCrumbs();
        $showSideBar = $sk->showSideBar();
        $showHeadSection = $sk->showHeadSection();
        $showArticleTabs = $wgTitle->getNamespace() != NS_SPECIAL && !$isMainPage;
        if (in_array($wgTitle->getNamespace(), array(NS_IMAGE)) && (empty($action) || $action == 'view') && !$isLoggedIn) {
            $showArticleTabs = false;
        }
        $showWikiTextWidget = false;
        if (class_exists('WikitextDownloader')) {
            $showWikiTextWidget = WikitextDownloader::isAuthorized() && !$isDocViewer;
        }
        $showRCWidget = class_exists('RCWidget') && $wgTitle->getNamespace() != NS_USER && (!$isLoggedIn || $wgUser->getOption('recent_changes_widget_show', true) == 1) && ($isLoggedIn || $isMainPage) && !in_array($wgTitle->getPrefixedText(), array('Special:Avatar', 'Special:ProfileBox', 'Special:IntroImageAdder')) && strpos($wgTitle->getPrefixedText(), 'Special:Userlog') === false && !$isDocViewer && $action != 'edit';
        $showFollowWidget = class_exists('FollowWidget') && !$isDocViewer && in_array($wgLanguageCode, array('en', 'de', 'es', 'pt'));
        $showSocialSharing = $wgTitle && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isSlowSpeedUser && $action == 'view' && class_exists('WikihowShare');
        $showSliderWidget = class_exists('Slider') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$wgTitle->isProtected() && !$isPrintable && !$isMainPage && $isIndexed && $wgLanguageCode == 'en' && $wgRequest->getVal('oldid') == '' && ($wgRequest->getVal('action') == '' || $wgRequest->getVal('action') == 'view');
        $showTopTenTips = $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && $wgLanguageCode == 'en' && !$isPrintable && !$isMainPage && $wgRequest->getVal('oldid') == '' && ($wgRequest->getVal('action') == '' || $wgRequest->getVal('action') == 'view');
        $showAltMethod = false;
        if (class_exists('AltMethodAdder')) {
            $showAltMethod = true;
        }
        $showExitTimer = $wgLanguageCode == 'en' && class_exists('BounceTimeLogger') && !$isSlowSpeedUser;
        $showRUM = false;
        //($isArticlePage || $isMainPage) && !$isBehindHttpAuth && !$isSlowSpeedUser;
        $showGoSquared = ($isArticlePage || $isMainPage) && !$isLoggedIn && !$isBehindHttpAuth && mt_rand(1, 100) <= 30;
        // 30% chance
        $showClickIgniter = !$isLoggedIn && !$isBehindHttpAuth && !$wgSSLsite;
        $showGA = !$isSlowSpeedUser;
        $showGAevents = $wgLanguageCode == 'en' && $isMainPage && !$isSlowSpeedUser;
        $isLiquid = false;
        //!$isMainPage && ( $wgTitle->getNameSpace() == NS_CATEGORY );
        $showFeaturedArticlesSidebar = $action == 'view' && !$isMainPage && !$isDocViewer && !$wgSSLsite && $wgTitle->getNamespace() != NS_USER;
        $isSpecialPage = $wgTitle->getNamespace() == NS_SPECIAL || $wgTitle->getNamespace() == NS_MAIN && $wgRequest->getVal('action') == 'protect' || $wgTitle->getNamespace() == NS_MAIN && $wgRequest->getVal('action') == 'delete';
        $showTextScroller = class_exists('TextScroller') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isPrintable && !$isMainPage && strpos($this->data['bodytext'], 'textscroller_outer') !== false;
        $showUserCompletedImages = class_exists('UCIPatrol') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isMainPage && UCIPatrol::showUCI($this->getSkin()->getContext()->getTitle());
        $showImageFeedback = class_exists('ImageFeedback') && ImageFeedback::isValidPage();
        $showWikivideo = class_exists('WHVid') && ($wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && strpos($this->data['bodytext'], 'whvid_cont') !== false || $wgTitle->getNamespace() == NS_SPECIAL) && !$isPrintable && !$isMainPage;
        $showStaffStats = !$isMainPage && $isLoggedIn && (in_array('staff', $wgUser->getGroups()) || in_array('staff_widget', $wgUser->getGroups())) && $wgTitle->getNamespace() == NS_MAIN && class_exists('Pagestats');
        $showThumbsUp = class_exists('ThumbsNotifications');
        $postLoadJS = $isArticlePage;
        // add present JS files to extensions/min/groupsConfig.php
        $fullJSuri = '/extensions/min/g/whjs' . (!$isArticlePage ? ',jqui' : '') . ($showExitTimer ? ',stu' : '') . ($showRCWidget ? ',rcw' : '') . ($showSpotlightRotate ? ',sp' : '') . ($showFollowWidget ? ',fl' : '') . ($showSliderWidget ? ',slj' : '') . ($showThumbsUp ? ',thm' : '') . ($showWikiTextWidget ? ',wkt' : '') . ($showAltMethod ? ',altj' : '') . ($showTopTenTips ? ',tpt' : '') . ($isMainPage ? ',hp' : '') . ($showWikivideo ? ',whv' : '') . ($showImageFeedback ? ',ii' : '') . ($showUserCompletedImages ? ',uci' : '') . ($showTextScroller ? ',ts' : '');
        if ($wgOut->mJSminCodes) {
            $fullJSuri .= ',' . join(',', $wgOut->mJSminCodes);
        }
        $cachedParam = $wgRequest && $wgRequest->getVal('c') == 't' ? '&c=t' : '';
        $fullJSuri .= '&r=' . WH_SITEREV . $cachedParam . '&e=.js';
        $fullCSSuri = '/extensions/min/g/whcss' . (!$isArticlePage ? ',jquic,nona' : '') . ($isLoggedIn ? ',li' : '') . ($showSliderWidget ? ',slc' : '') . ($showAltMethod ? ',altc' : '') . ($showTopTenTips ? ',tptc' : '') . ($showWikivideo ? ',whvc' : '') . ($showTextScroller ? ',tsc' : '') . ($isMainPage ? ',hpc' : '') . ($showImageFeedback ? ',iic' : '') . ($showUserCompletedImages ? ',ucic' : '') . ($isSpecialPage ? ',spc' : '');
        if ($wgOut->mCSSminCodes) {
            $fullCSSuri .= ',' . join(',', $wgOut->mCSSminCodes);
        }
        $fullCSSuri .= '&r=' . WH_SITEREV . $cachedParam . '&e=.css';
        $tabsArray = $sk->getTabsArray($showArticleTabs);
        wfRunHooks('JustBeforeOutputHTML', array(&$this));
        ?>
<!DOCTYPE html>
<?php 
        echo $head_element;
        ?>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
	<title><?php 
        echo $pageTitle;
        ?>
</title>
	<?php 
        /*Hack to add variable WH as a global variable before loading script. This is need because load.php creates a closure when loading wikibits.js 
        		Add by Gershon Bialer on 12/2/2013*/
        ?>
<script>
<!--
var WH = WH || {};
//-->
</script>

	<?php 
        if ($showRUM) {
            ?>
<script>
<!--
window.UVPERF = {};
UVPERF.authtoken = 'b473c3f9-a845-4dc3-9432-7ad0441e00c3';
UVPERF.start = new Date().getTime();
//-->
</script>
	<?php 
        }
        ?>
	<?php 
        if ($wgIsDomainTest) {
            ?>
	<base href="http://www.wikihow.com/" />
	<?php 
        }
        ?>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta name="verify-v1" content="/Ur0RE4/QGQIq9F46KZyKIyL0ZnS96N5x1DwQJa7bR8=" />
	<meta name="google-site-verification" content="Jb3uMWyKPQ3B9lzp5hZvJjITDKG8xI8mnEpWifGXUb0" />
	<meta name="msvalidate.01" content="CFD80128CAD3E726220D4C2420D539BE" />
	<meta name="y_key" content="1b3ab4fc6fba3ab3" />
	<meta name="p:domain_verify" content="bb366527fa38aa5bc27356b728a2ec6f" />
	<?php 
        if ($isArticlePage || $isMainPage) {
            ?>
	<link rel="alternate" media="only screen and (max-width: 640px)" href="http://<?php 
            if ($wgLanguageCode != 'en') {
                echo $wgLanguageCode . ".";
            }
            ?>
m.wikihow.com/<?php 
            echo $wgTitle->getPartialUrl();
            ?>
">
	<?php 
        }
        ?>
	<?php 
        // add CSS files to extensions/min/groupsConfig.php
        ?>
	<style type="text/css" media="all">/*<![CDATA[*/ @import "<?php 
        echo $fullCSSuri;
        ?>
"; /*]]>*/</style>
	<?php 
        // below is the minified http://www.wikihow.com/extensions/min/f/skins/owl/printable.css
        ?>
	<style type="text/css" media="<?php 
        echo $printable_media;
        ?>
">/*<![CDATA[*/ body{background-color:#FFF;font-size:1.2em}#header_outer{background:0 0;position:relative}#header{text-align:center;height:63px!important;width:242px!important;background:url(/skins/owl/images/logo_lightbg_242.jpg) no-repeat center center;margin-top:15px}#article_shell{margin:0 auto;float:none;padding-bottom:2em}.sticking{position:absolute!important;top:0!important}#actions,#article_rating,#article_tabs,#breadcrumb,#bubble_search,#cse-search-box,#end_options,#footer_outer,#header_space,#logo_link,#notification_count,#originators,#sidebar,#sliderbox,.edit,.editsection,.mwimg,.section.relatedwikihows,.section.video,.whvid_cont,.altadder_section{display:none!important} /*]]>*/</style>	
		<?php 
        // Bootstapping certain javascript functions:
        // A function to merge one object with another; stub funcs
        // for button swapping (this should be done in CSS anyway);
        // initialize the timer for bounce stats tracking.
        ?>
		<script>
			<!--
			var WH = WH || {};
			WH.lang = WH.lang || {};
			button_swap = button_unswap = function(){};
			WH.exitTimerStartTime = (new Date()).getTime();
			WH.mergeLang = function(A){for(i in A){v=A[i];if(typeof v==='string'){WH.lang[i]=v;}}};
			//-->
		</script>
		<?php 
        if (!$postLoadJS) {
            ?>
			<?php 
            echo $this->html('headscripts');
            ?>
			<script type="text/javascript" src="<?php 
            echo $fullJSuri;
            ?>
"></script>
		<?php 
        }
        ?>

		<?php 
        $this->html('headlinks');
        ?>
		
	<?php 
        if (!$wgIsDomainTest) {
            ?>
			<link rel='canonical' href='<?php 
            echo $wgTitle->getFullURL();
            ?>
'/>
			<link href="https://plus.google.com/102818024478962731382" rel="publisher" />
		<?php 
        }
        ?>
	<?php 
        if ($sk->isUserAgentMobile()) {
            ?>
			<link media="only screen and (max-device-width: 480px)" href="<?php 
            echo wfGetPad('/extensions/min/f/skins/WikiHow/iphone.css');
            ?>
" type="text/css" rel="stylesheet" />
		<?php 
        } else {
            ?>
			<!-- not mobile -->
		<?php 
        }
        ?>
	<!--<![endif]-->
	<?php 
        echo $rtl_css;
        ?>
	<link rel="alternate" type="application/rss+xml" title="wikiHow: How-to of the Day" href="http://www.wikihow.com/feed.rss"/>
	<link rel="apple-touch-icon" href="<?php 
        echo wfGetPad('/skins/WikiHow/safari-large-icon.png');
        ?>
" />
	<?php 
        //= wfMessage('Test_setup')->text()
        ?>
	<?php 
        if (class_exists('CTALinks') && trim(wfMessage('cta_feature')->inContentLanguage()->text()) == "on") {
            echo CTALinks::getGoogleControlScript();
        }
        ?>
	<?php 
        echo $wgOut->getHeadItems();
        ?>
			
	<?php 
        if ($wgTitle && $wgTitle->getText() == "Get Caramel off Pots and Pans") {
            echo wfMessage('Adunit_test_top')->text();
        }
        ?>

	<?php 
        $userdir = $wgLang->getDir();
        $sitedir = $wgContLang->getDir();
        ?>
	<?php 
        foreach ($otherLanguageLinks as $lang => $url) {
            ?>
			<link rel="alternate" hreflang="<?php 
            echo $lang;
            ?>
" href="<?php 
            echo htmlspecialchars($url);
            ?>
" />
		<?php 
        }
        ?>
		</head>
		<body <?php 
        if (isset($this->data['body_ondblclick']) && $this->data['body_ondblclick']) {
            ?>
ondblclick="<?php 
            $this->text('body_ondblclick');
            ?>
"<?php 
        }
        ?>
			  <?php 
        if (isset($this->data['body_onload']) && $this->data['body_onload']) {
            ?>
onload="<?php 
            $this->text('body_onload');
            ?>
"<?php 
        }
        ?>
 
			  class="mediawiki <?php 
        echo $userdir;
        ?>
  sitedir-<?php 
        echo $sitedir;
        ?>
"
			>
		<?php 
        wfRunHooks('PageHeaderDisplay', array($sk->isUserAgentMobile()));
        ?>

		<?php 
        if (!$isLoggedIn) {
            echo wikihowAds::getSetup();
        }
        ?>
		<div id="header_outer"><div id="header">
			<ul id="actions">
				<?php 
        foreach ($navTabs as $tabid => $tab) {
            ?>
					<li id="<?php 
            echo $tabid;
            ?>
_li">
						<div class="nav_icon"></div>
						<a id='<?php 
            echo $tabid;
            ?>
' class='nav' href='<?php 
            echo $tab['link'];
            ?>
'><?php 
            echo $tab['text'];
            ?>
</a>
						<?php 
            echo $tab['menu'];
            ?>
					</li>
				<?php 
        }
        ?>
			</ul><!--end actions-->
			<?php 
        if (isset($sk->notifications_count) && (int) $sk->notifications_count > 0) {
            ?>
				<div id="notification_count" class="notice"><?php 
            echo $sk->notifications_count;
            ?>
</div>
			<?php 
        }
        ?>
			<?php 
        $holidayLogo = SkinWikihowskin::getHolidayLogo();
        $logoPath = $holidayLogo ? $holidayLogo : '/skins/owl/images/wikihow_logo.png';
        if ($wgLanguageCode != "en") {
            $logoPath = "/skins/owl/images/wikihow_logo_intl.png";
        }
        ?>
			<a href='<?php 
        echo $mainPageObj->getLocalURL();
        ?>
' id='logo_link'><img src="<?php 
        echo wfGetPad($logoPath);
        ?>
" class="logo" /></a>
			<?php 
        echo $top_search;
        ?>
			<?php 
        wfRunHooks('EndOfHeader', array(&$wgOut));
        ?>
		</div></div><!--end header-->
		<?php 
        wfRunHooks('AfterHeader', array(&$wgOut));
        ?>
		<div id="main_container" class="<?php 
        echo $isMainPage ? 'mainpage' : '';
        ?>
">
			<div id="header_space"></div>
		
		<div id="main">
		<?php 
        wfRunHooks('BeforeActionbar', array(&$wgOut));
        ?>
		<div id="actionbar" class="<?php 
        echo $isTool ? 'isTool' : '';
        ?>
">
			<?php 
        if ($showBreadCrumbs) {
            ?>
				<div id="gatBreadCrumb">
					<ul id="breadcrumb" class="Breadcrumbs">
						<?php 
            echo $catLinksTop;
            ?>
					</ul>
				</div>
			<?php 
        }
        ?>
			<?php 
        if (count($tabsArray) > 0) {
            echo $sk->getTabsHtml($tabsArray);
        }
        ?>

		</div><!--end actionbar-->
		<script>
		<!--
		WH.translationData = {<?php 
        echo join(',', $translationData);
        ?>
};
		//-->
		</script>
		<?php 
        echo $mpActions;
        ?>
		<?php 
        $sidebar = !$showSideBar ? 'no_sidebar' : '';
        // INTL: load mediawiki messages for sidebar expand and collapse for later use in sidebar boxes
        $langKeys = array('navlist_collapse', 'navlist_expand', 'usernameoremail', 'password');
        print Wikihow_i18n::genJSMsgs($langKeys);
        ?>
		<div id="container" class="<?php 
        echo $sidebar;
        ?>
">
		<div id="article_shell">
		<div id="article"<?php 
        echo Microdata::genSchemaHeader();
        ?>
>

			<?php 
        wfRunHooks('BeforeTabsLine', array(&$wgOut));
        ?>
			<?php 
        if (!$isArticlePage && !$isMainPage && $this->data['bodyheading']) {
            echo '<div class="wh_block">' . $this->data['bodyheading'] . '</div>';
        }
        echo $this->html('bodytext');
        $showingArticleInfo = 0;
        if (in_array($wgTitle->getNamespace(), array(NS_MAIN, NS_PROJECT)) && $action == 'view' && !$isMainPage) {
            $catLinks = $sk->getCategoryLinks(false);
            $authors = ArticleAuthors::getAuthorFooter();
            if ($authors || is_array($this->data['language_urls']) || $catLinks) {
                $showingArticleInfo = 1;
            }
            ?>

				<div class="section">
					<?php 
            if ($showingArticleInfo) {
                ?>
						<h2 class="section_head" id="article_info_header"><span><?php 
                echo wfMessage('article_info')->text();
                ?>
</span></h2>
						<div id="article_info" class="section_text">
					<?php 
            } else {
                ?>
						<h2 class="section_head" id="article_tools_header"><span><?php 
                echo wfMessage('article_tools')->text();
                ?>
</span></h2>
						<div id="article_tools" class="section_text">
					<?php 
            }
            ?>
						<?php 
            echo $fa;
            ?>
						<?php 
            if ($catLinks) {
                ?>
							<p class="info"> <?php 
                echo wfMessage('categories')->text();
                ?>
: <?php 
                echo $catLinks;
                ?>
</p>
						<?php 
            }
            ?>
						<p><?php 
            echo $authors;
            ?>
</p>
						<?php 
            if (is_array($this->data['language_urls'])) {
                ?>
							<p class="info"><?php 
                $this->msg('otherlanguages');
                ?>
:</p>
							<p class="info"><?php 
                $links = array();
                $sk = $this->getSkin();
                foreach ($this->data['language_urls'] as $langlink) {
                    $linkText = $langlink['text'];
                    preg_match("@interwiki-(..)@", $langlink['class'], $langCode);
                    if (!empty($langCode[1])) {
                        $linkText = $sk->getInterWikiLinkText($linkText, $langCode[1]);
                    }
                    $links[] = htmlspecialchars(trim($langlink['language'])) . '&nbsp;<span><a href="' . htmlspecialchars($langlink['href']) . '">' . $linkText . "</a><span>";
                }
                echo implode("&#44;&nbsp;", $links);
                ?>
							</p>
						<?php 
            }
            //talk link
            if ($action == 'view' && MWNamespace::isTalk($wgTitle->getNamespace())) {
                $talk_link = '#postcomment';
            } else {
                $talk_link = $wgTitle->getTalkPage()->getLocalURL();
            }
            ?>
						<ul id="end_options">
							<li class="endop_discuss"><span></span><a href="<?php 
            echo $talk_link;
            ?>
" id="gatDiscussionFooter"><?php 
            echo wfMessage('at_discuss')->text();
            ?>
</a></li>
							<li class="endop_print"><span></span><a href="<?php 
            echo $wgTitle->getLocalUrl('printable=yes');
            ?>
" id="gatPrintView"><?php 
            echo wfMessage('print')->text();
            ?>
</a></li>
							<li class="endop_email"><span></span><a href="#" onclick="return emailLink();" id="gatSharingEmail"><?php 
            echo wfMessage('at_email')->text();
            ?>
</a></li>
							<?php 
            if ($isLoggedIn) {
                ?>
								<?php 
                if ($wgTitle->userIsWatching()) {
                    ?>
									<li class="endop_watch"><span></span><a href="<?php 
                    echo $wgTitle->getLocalURL('action=unwatch');
                    ?>
"><?php 
                    echo wfMessage('at_remove_watch')->text();
                    ?>
</a></li>
								<?php 
                } else {
                    ?>
									<li class="endop_watch"><span></span><a href="<?php 
                    echo $wgTitle->getLocalURL('action=watch');
                    ?>
"><?php 
                    echo wfMessage('at_watch')->text();
                    ?>
</a></li>
								<?php 
                }
                ?>
							<?php 
            }
            ?>
							<li class="endop_edit"><span></span><a href="<?php 
            echo $wgTitle->getEditUrl();
            ?>
" id="gatEditFooter"><?php 
            echo wfMessage('edit')->text();
            ?>
</a></li>
							<?php 
            if ($wgTitle->getNamespace() == NS_MAIN) {
                ?>
								<li class="endop_fanmail"><span></span><a href="/Special:ThankAuthors?target=<?php 
                echo $wgTitle->getPrefixedURL();
                ?>
" id="gatThankAuthors"><?php 
                echo wfMessage('at_fanmail')->text();
                ?>
</a></li>
							<?php 
            }
            ?>
						</ul> <!--end end_options -->
							<?php 
            if (!in_array($wgTitle->getNamespace(), array(NS_USER, NS_CATEGORY))) {
                ?>

							<?php 
            }
            ?>
							<?php 
            if ($showAds && $wgTitle->getNamespace() == NS_MAIN) {
                //only show this ad on article pages
                echo wikihowAds::getAdUnitPlaceholder(7);
            }
            ?>
						<div class="clearall"></div>
					</div><!--end article_info section_text-->
						<p class='page_stats'><?php 
            echo $sk->pageStats();
            ?>
</p>

						<div id='article_rating'>
							<?php 
            echo RateItem::showForm('article');
            ?>
						</div>
				</div><!--end section-->

			<?php 
        }
        if ($showUserCompletedImages) {
            ?>
				<div class="section">
					<h2 class="section_head" id="uci_header"><span><?php 
            echo wfMessage('user_completed_images')->text();
            ?>
</span></h2>
					<div id="uci_images" class="section_text">
						<?php 
            echo UCIPatrol::getHTMLForArticle($this->getSkin()->getContext());
            ?>
					</div> <!-- end section_text-->
				</div><!--end section-->
			<?php 
        }
        if (in_array($wgTitle->getNamespace(), array(NS_USER, NS_MAIN, NS_PROJECT)) && $action == 'view' && !$isMainPage) {
            ?>

		</div> <!-- article -->
		<div id="">

			<?php 
        }
        ?>
		</div>  <!--end last_question-->
		<div class="clearall"></div>

		</div>  <!--end article_shell-->


		<?php 
        if ($showSideBar) {
            $loggedOutClass = "";
            if ($showAds && $wgTitle->getText() != 'Userlogin' && $wgTitle->getNamespace() == NS_MAIN) {
                $loggedOutClass = ' logged_out';
            }
            ?>
			<div id="sidebar">		
				<?php 
            echo $siteNotice;
            ?>

				<!-- Sidebar Top Widgets -->
				<?php 
            foreach ($sk->mSidebarTopWidgets as $sbWidget) {
                ?>
					<?php 
                echo $sbWidget;
                ?>
				<?php 
            }
            ?>
				<!-- END Sidebar Top Widgets -->

				<?php 
            if (!$isDocViewer) {
                ?>
				<div id="top_links" class="sidebox<?php 
                echo $loggedOutClass;
                ?>
" <?php 
                echo is_numeric(wfMessage('top_links_padding')->text()) ? ' style="padding-left:' . wfMessage('top_links_padding')->text() . 'px;padding-right:' . wfMessage('top_links_padding')->text() . 'px;"' : '';
                ?>
>
					<a href="/Special:Randomizer" id="gatRandom" accesskey='x' class="button secondary"><?php 
                echo wfMessage('randompage')->text();
                ?>
</a>
					<a href="/Special:Createpage" id="gatWriteAnArticle" class="button secondary"><?php 
                echo wfMessage('writearticle')->text();
                ?>
</a>
					<?php 
                if (class_exists('Randomizer') && Randomizer::DEBUG && $wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgTitle->getArticleId()) {
                    ?>
						<?php 
                    echo Randomizer::getReason($wgTitle);
                    ?>
					<?php 
                }
                ?>
				</div><!--end top_links-->
				<?php 
            }
            ?>
				<?php 
            if ($showStaffStats) {
                ?>
					<div class="sidebox" style="padding-top:10px" id="staff_stats_box"></div>
				<?php 
            }
            ?>

				<?php 
            if ($showWikiTextWidget) {
                ?>
					<div class="sidebox" id="side_rc_widget">
						<a id='wikitext_downloader' href='#'>Download WikiText</a>
					</div><!--end sidebox-->
				<?php 
            }
            ?>


				<?php 
            if ($showAds && $wgTitle->getText() != 'Userlogin' && $wgTitle->getNamespace() == NS_MAIN) {
                // temporary ad code for amazon ad loading, added by Reuben 3/13, disabled 4/23, and re-enabled 5/28
                if ($wgLanguageCode == 'en') {
                    ?>
					<script>
						<!--
						var aax_src='3003';
						var amzn_targs = '';
						var url = encodeURIComponent(document.location);
						try { url = encodeURIComponent("" + window.top.location); } catch(e) {}
						document.write("<scr"+"ipt src='//aax-us-east.amazon-Adsystem.com/e/dtb/bid?src=" + aax_src + "&u="+url+"&cb=" + Math.round(Math.random()*10000000) + "'></scr"+"ipt>");
						document.close();
						//-->
					</script>
						<?php 
                }
                ?>
					<?php 
                //only show this ad on article pages
                //comment out next line to turn off HHM ad
                if (wikihowAds::isHHM() && $wgLanguageCode == 'en') {
                    echo wikihowAds::getHhmAd();
                } else {
                    echo wikihowAds::getCategoryAd();
                }
                //Temporairily taking down Jane
                /*if (class_exists('StarterTool')) {
                			//spellchecker test "ad"
                			echo "<a href='/Special:StarterTool?ref=1' style='display:none' id='starter_ad'><img src='" . wfGetPad('/skins/WikiHow/images/sidebar_spelling3.png') . "' nopin='nopin' /></a>";
                		}*/
            }
            //<!-- <a href="#"><img src="/skins/WikiHow/images/imgad.jpg" /></a> -->
            ?>

				<?php 
            $userLinks = $sk->getUserLinks();
            ?>
				<?php 
            if ($userLinks) {
                ?>
				<div class='sidebox'>
					<?php 
                echo $userLinks;
                ?>
				</div>
				<?php 
            }
            ?>

				<?php 
            $related_articles = $sk->getRelatedArticlesBox($this);
            //disable custom link units
            //  if (!$isLoggedIn && $wgTitle->getNamespace() == NS_MAIN && !$isMainPage)
            //if ($related_articles != "")
            //$related_articles .= WikiHowTemplate::getAdUnitPlaceholder(2, true);
            if ($action == 'view' && $related_articles != "") {
                $related_articles = '<div id="side_related_articles" class="sidebox">' . $related_articles . '</div><!--end side_related_articles-->';
                echo $related_articles;
            }
            ?>

				<?php 
            if ($showSocialSharing) {
                ?>
					<div class="sidebox<?php 
                echo $loggedOutClass;
                ?>
" id="sidebar_share">
						<h3><?php 
                echo wfMessage('social_share')->text();
                ?>
</h3>
						<?php 
                if ($isMainPage) {
                    echo WikihowShare::getMainPageShareButtons();
                } else {
                    echo WikihowShare::getTopShareButtons($isIndexed);
                }
                ?>
						<div style="clear:both; float:none;"></div>
					</div>
				<?php 
            }
            ?>

				<?php 
            if ($mpWorldwide !== "") {
                ?>
					<?php 
                echo $mpWorldwide;
                ?>
				<?php 
            }
            ?>

				<?php 
            /*
            <!--
            <div class="sidebox_shell">
            	<div class='sidebar_top'></div>
            	<div id="side_fb_timeline" class="sidebox">
            	</div>
            	<div class='sidebar_bottom_fold'></div>
            </div>
            -->
            <!--end sidebox_shell-->
            */
            ?>

				<!-- Sidebar Widgets -->
				<?php 
            foreach ($sk->mSidebarWidgets as $sbWidget) {
                ?>
					<?php 
                echo $sbWidget;
                ?>
				<?php 
            }
            ?>
				<!-- END Sidebar Widgets -->

				<?php 
            //if ($isLoggedIn) echo $navMenu;
            ?>


				<?php 
            if ($showFeaturedArticlesSidebar) {
                ?>
					<div id="side_featured_articles" class="sidebox">
						<?php 
                echo $sk->getFeaturedArticlesBox(4, 4);
                ?>
					</div>
				<?php 
            }
            ?>

				<?php 
            if ($showRCWidget) {
                ?>
					<div class="sidebox" id="side_rc_widget">
						<?php 
                RCWidget::showWidget();
                ?>
						<p class="bottom_link">
							<?php 
                if ($isLoggedIn) {
                    ?>
								<?php 
                    echo wfMessage('welcome', $wgUser->getName(), $wgUser->getUserPage()->getLocalURL())->text();
                    ?>
							<?php 
                } else {
                    ?>
								<a href="/Special:Userlogin" id="gatWidgetBottom"><?php 
                    echo wfMessage('rcwidget_join_in')->text();
                    ?>
</a>
							<?php 
                }
                ?>
							<a href="" id="play_pause_button" onclick="rcTransport(this); return false;" ></a>
						</p>
					</div><!--end side_recent_changes-->
				<?php 
            }
            ?>

				<?php 
            if (class_exists('FeaturedContributor') && ($wgTitle->getNamespace() == NS_MAIN || $wgTitle->getNamespace() == NS_USER) && !$isMainPage && !$isDocViewer) {
                ?>
					<div id="side_featured_contributor" class="sidebox">
						<?php 
                FeaturedContributor::showWidget();
                ?>
						<?php 
                if (!$isLoggedIn) {
                    ?>
							<p class="bottom_button">
								<a href="/Special:Userlogin" class="button secondary" id="gatFCWidgetBottom" onclick='gatTrack("Browsing","Feat_contrib_cta","Feat_contrib_wgt");'><?php 
                    echo wfMessage('fc_action')->text();
                    ?>
</a>
							</p>
						<?php 
                }
                ?>
					</div><!--end side_featured_contributor-->
				<?php 
            }
            ?>

				<?php 
            //if (!$isLoggedIn) echo $navMenu;
            ?>

				<?php 
            if ($showFollowWidget) {
                ?>
					<div class="sidebox">
						<?php 
                FollowWidget::showWidget();
                ?>
					</div>
				<?php 
            }
            ?>
			</div><!--end sidebar-->
		<?php 
        }
        // end if $showSideBar
        ?>
		<div class="clearall" ></div>
		</div> <!--end container -->
		</div><!--end main-->
			<div id="clear_footer"></div>
		</div><!--end main_container-->
		<div id="footer_outer">
			<div id="footer">
				<div id="footer_side">
					<?php 
        if ($isLoggedIn) {
            ?>
						<?php 
            echo wfMessage('site_footer_owl')->parse();
            ?>
					<?php 
        } else {
            ?>
						<?php 
            echo wfMessage('site_footer_owl_anon')->parse();
            ?>
					<?php 
        }
        ?>
				</div><!--end footer_side-->

				<div id="footer_main">

					<div id="sub_footer">
						<?php 
        if ($isLoggedIn || $isMainPage) {
            ?>
							<?php 
            echo wfMessage('sub_footer_new', wfGetPad(), wfGetPad())->text();
            ?>
						<?php 
        } else {
            ?>
							<?php 
            echo wfMessage('sub_footer_new_anon', wfGetPad(), wfGetPad())->text();
            ?>
						<?php 
        }
        ?>
					</div>
				</div><!--end footer_main-->
			</div>
				<br class="clearall" />
		</div><!--end footer-->
		<div id="dialog-box" title=""></div>

		<?php 
        // Quick note/edit popup
        if ($action == 'diff' && $wgLanguageCode == 'en') {
            echo QuickNoteEdit::displayQuicknote();
            echo QuickNoteEdit::displayQuickedit();
        }
        // Slider box -- for non-logged in users on articles only
        if ($showSliderWidget) {
            echo Slider::getBox();
            echo '<div id="slideshowdetect"></div>';
        }
        ?>

		<div id="fb-root" ></div>

		<?php 
        if ($postLoadJS) {
            ?>
			<?php 
            echo $this->html('headscripts');
            ?>
			<script type="text/javascript" src="<?php 
            echo $fullJSuri;
            ?>
"></script>
		<?php 
        }
        ?>
		<?php 
        if ($optimizelyJS) {
            print $optimizelyJS;
        }
        ?>

		<?php 
        if ($showExitTimer) {
            ?>
			<script>
				<!--
				if (WH.ExitTimer) {
					WH.ExitTimer.start();
				}
				//-->
			</script>
		<?php 
        }
        ?>

		<?php 
        if ($showRCWidget) {
            ?>
			<?php 
            RCWidget::showWidgetJS();
            ?>
		<?php 
        }
        ?>

		<script type="text/javascript">
			<!--
			var _gaq = _gaq || [];
	<?php 
        if ($showGA) {
            ?>
			_gaq.push(['_setAccount', 'UA-2375655-1']);
			_gaq.push(['_setDomainName', '.wikihow.com']);
			_gaq.push(['_trackPageview']);
			(function() {
				var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
				ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
			})();
	<?php 
        }
        ?>
			//-->
		</script>

	<?php 
        if ($showGA) {
            ?>
		<?php 
            // Google Analytics Event Track
            ?>
		<script type="text/javascript">
			<!--
			if (typeof Event =='undefined' || typeof Event.observe == 'undefined') {
				jQuery(window).load(gatStartObservers);
			} else {
				Event.observe(window, 'load', gatStartObservers);
			}
			//-->
		</script>
		<?php 
            // END Google Analytics Event Track
            ?>
		<?php 
            if (class_exists('CTALinks') && trim(wfMessage('cta_feature')->inContentLanguage()->text()) == "on") {
                echo CTALinks::getGoogleControlTrackingScript();
                echo CTALinks::getGoogleConversionScript();
            }
            ?>
		<?php 
            // Load event listeners
            ?>
		<?php 
            if ($showGAevents) {
                ?>
			<script type="text/javascript">
				<!--
				if (typeof Event =='undefined' || typeof Event.observe == 'undefined') {
					jQuery(window).load(initSA);
				} else {
					Event.observe(window, 'load', initSA);
				}
				//-->
			</script>
		<?php 
            }
            ?>
	<?php 
        }
        // $showGA
        ?>

		<?php 
        // Load event listeners all pages
        ?>
		<?php 
        if (class_exists('CTALinks') && trim(wfMessage('cta_feature')->inContentLanguage()->text()) == "on") {
            echo CTALinks::getBlankCTA();
        }
        ?>

		<?php 
        if ($showClickIgniter) {
            ?>
			<script type="text/javascript">
			(function() {
				var ci = document.createElement('script'); ci.type = 'text/javascript'; ci.async = true;
				ci.src = 'http://cdn.clickigniter.io/ci.js';
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ci, s);
			})();
			</script>
		<?php 
        }
        ?>
		<?php 
        if ($showGoSquared) {
            ?>
			<script type="text/javascript">
				var GoSquared = {};
				GoSquared.acct = "GSN-491441-Y";
				(function(w){
					function gs(){
						w._gstc_lt = +new Date;
						var d = document, g = d.createElement("script");
						g.type = "text/javascript";
						g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
						g.async = true;
						var s = d.getElementsByTagName("script")[0];
						s.parentNode.insertBefore(g, s);
					}
					w.addEventListener ?
						w.addEventListener("load", gs, false) :
						w.attachEvent("onload", gs);
				})(window);
			</script>
		<?php 
        }
        ?>
		<?php 
        if ($showRUM) {
            ?>
		<script>
			(function(){
				var a=document.createElement('script'); a.type='text/javascript'; a.async=true;
				a.src='//yxjj4c.rumanalytics.com/sampler/basic2';
				var b=document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a,b);
			})();
		</script>
		<?php 
        }
        ?>
		<?php 
        wfRunHooks('ArticleJustBeforeBodyClose', array());
        ?>
		<?php 
        if (($wgRequest->getVal("action") == "edit" || $wgRequest->getVal("action") == "submit2") && $wgRequest->getVal('advanced', null) != 'true') {
            ?>
			<script type="text/javascript">
				if (document.getElementById('steps') && document.getElementById('wpTextbox1') == null) {
					InstallAC(document.editform,document.editform.q,document.editform.btnG,"./<?php 
            echo $wgLang->getNsText(NS_SPECIAL) . ":TitleSearch";
            ?>
","en");
				}
			</script>
		<?php 
        }
        ?>

		<?php 
        if ($wgLanguageCode == 'en' && !$isLoggedIn && class_exists('GoogSearch')) {
            ?>
			<?php 
            echo GoogSearch::getSearchBoxJS();
            ?>
		<?php 
        }
        ?>

<script type="text/javascript">
	(function ($) {
		$(document).ready(function() {
			WH.addScrollEffectToTOC();
		});

		$(window).load(function() {
			if ($('.twitter-share-button').length && (!$.browser.msie || $.browser.version > 7)) {

				$.getScript("https://platform.twitter.com/widgets.js", function() {
					twttr.events.bind('tweet', function(event) {
						if (event) {
							var targetUrl;
							if (event.target && event.target.nodeName == 'IFRAME') {
								targetUrl = extractParamFromUri(event.target.src, 'url');
							}
							_gaq.push(['_trackSocial', 'twitter', 'tweet', targetUrl]);
						}
					});

				});
			}

			if (isiPhone < 0 && isiPad < 0 && $('.gplus1_button').length) {
				WH.setGooglePlusOneLangCode();
				var node2 = document.createElement('script');
				node2.type = 'text/javascript';
				node2.async = true;
				node2.src = 'http://apis.google.com/js/plusone.js';
				$('body').append(node2);
			}
			if (typeof WH.FB != 'undefined') WH.FB.init('new');
			if (typeof WH.GP != 'undefined') WH.GP.init();

			if ($('#pinterest').length) {
				var node3 = document.createElement('script');
				node3.type = 'text/javascript';
				node3.async = true;
				node3.src = 'http://assets.pinterest.com/js/pinit.js';
				$('body').append(node3);
			}

			if (typeof WH.imageFeedback != 'undefined') {
				WH.imageFeedback();
			}
			if (typeof WH.uciFeedback != 'undefined') {
				WH.uciFeedback();
			}
		});
	})(jQuery);
</script>
<?php 
        //Temporarily taking down Jane
        /*
        			var r = Math.random();
        			if(r <= .05) {
        				$('#starter_ad').show();
        			}*/
        if ($showStaffStats) {
            ?>
	<?php 
            echo Pagestats::getJSsnippet("article");
        }
        echo $wgOut->getBottomScripts();
        ?>

<?php 
        if (class_exists('GoodRevision')) {
            ?>
	<?php 
            $grevid = $wgTitle ? GoodRevision::getUsedRev($wgTitle->getArticleID()) : '';
            $title = $this->getSkin()->getContext()->getTitle();
            $latestRev = $title->getNamespace() == NS_MAIN ? $title->getLatestRevID() : '';
            ?>
	<!-- shown patrolled revid=<?php 
            echo $grevid;
            ?>
, latest=<?php 
            echo $latestRev;
            ?>
 -->
<?php 
        }
        echo wfReportTime();
        $this->printTrail();
        ?>
</body>
</html>
<?php 
    }
Пример #11
0
 /**
  * Execute an action, and in case of an error, erase whatever partial results
  * have been accumulated, and replace it with an error message and a help screen.
  */
 protected function executeActionWithErrorHandling()
 {
     // Verify the CORS header before executing the action
     if (!$this->handleCORS()) {
         // handleCORS() has sent a 403, abort
         return;
     }
     // Exit here if the request method was OPTIONS
     // (assume there will be a followup GET or POST)
     if ($this->getRequest()->getMethod() === 'OPTIONS') {
         return;
     }
     // In case an error occurs during data output,
     // clear the output buffer and print just the error information
     ob_start();
     $t = microtime(true);
     try {
         $this->executeAction();
     } catch (Exception $e) {
         $this->handleException($e);
     }
     // Log the request whether or not there was an error
     $this->logRequest(microtime(true) - $t);
     // Send cache headers after any code which might generate an error, to
     // avoid sending public cache headers for errors.
     $this->sendCacheHeaders();
     if ($this->mPrinter->getIsHtml() && !$this->mPrinter->isDisabled()) {
         echo wfReportTime();
     }
     ob_end_flush();
 }
Пример #12
0
		<script src="<?php 
    echo $wg->ResourceBasePath;
    ?>
/resources/wikia/libraries/html5/html5.min.js"></script>
	<![endif]-->

	<!-- Combined JS files and head scripts -->
	<?php 
    echo $jsFiles;
}
?>

<script type="text/javascript">/*<![CDATA[*/ Wikia.LazyQueue.makeQueue(wgAfterContentAndJS, function(fn) {fn();}); wgAfterContentAndJS.start(); /*]]>*/</script>
<?php 
if ($wg->EnableAdEngineExt) {
    ?>
<script type="text/javascript">/*<![CDATA[*/ if (typeof AdEngine_trackPageInteractive === 'function') {wgAfterContentAndJS.push(AdEngine_trackPageInteractive);} /*]]>*/</script>
<?php 
}
echo $bottomScripts;
?>

</body>

<?php 
echo wfReportTime() . "\n";
echo F::app()->renderView('Ad', 'Config');
?>

</html>
Пример #13
0
 /**
  * initialize various variables and generate the template
  *
  * @param $out OutputPage
  */
 function outputPage(OutputPage $out)
 {
     global $wgUser, $wgLang, $wgContLang;
     global $wgScript, $wgStylePath;
     global $wgMimeType, $wgJsMimeType, $wgRequest;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
     global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
     global $wgMaxCredits, $wgShowCreditsIfMax;
     global $wgPageShowWatchingUsers;
     global $wgUseTrackbacks, $wgUseSiteJs, $wgDebugComments;
     global $wgArticlePath, $wgScriptPath, $wgServer;
     wfProfileIn(__METHOD__);
     Profiler::instance()->setTemplated(true);
     $oldid = $wgRequest->getVal('oldid');
     $diff = $wgRequest->getVal('diff');
     $action = $wgRequest->getVal('action', 'view');
     wfProfileIn(__METHOD__ . '-init');
     $this->initPage($out);
     $tpl = $this->setupTemplate($this->template, 'skins');
     wfProfileOut(__METHOD__ . '-init');
     wfProfileIn(__METHOD__ . '-stuff');
     $this->thispage = $this->getTitle()->getPrefixedDBkey();
     $this->userpage = $wgUser->getUserPage()->getPrefixedText();
     $query = array();
     if (!$wgRequest->wasPosted()) {
         $query = $wgRequest->getValues();
         unset($query['title']);
         unset($query['returnto']);
         unset($query['returntoquery']);
     }
     $this->thisquery = wfArrayToCGI($query);
     $this->loggedin = $wgUser->isLoggedIn();
     $this->iscontent = $this->getTitle()->getNamespace() != NS_SPECIAL;
     $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
     $this->username = $wgUser->getName();
     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->titletxt = $this->getTitle()->getPrefixedText();
     wfProfileOut(__METHOD__ . '-stuff');
     wfProfileIn(__METHOD__ . '-stuff-head');
     if ($this->useHeadElement) {
         $pagecss = $this->setupPageCss();
         if ($pagecss) {
             $out->addInlineStyle($pagecss);
         }
     } else {
         $this->setupUserCss($out);
         $tpl->set('pagecss', $this->setupPageCss());
         $tpl->set('usercss', false);
         $this->userjs = $this->userjsprev = false;
         # @todo FIXME: This is the only use of OutputPage::isUserJsAllowed() anywhere; can we
         # get rid of it?  For that matter, why is any of this here at all?
         $this->setupUserJs($out->isUserJsAllowed());
         $tpl->setRef('userjs', $this->userjs);
         $tpl->setRef('userjsprev', $this->userjsprev);
         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);
         }
         $tpl->setRef('xhtmldefaultnamespace', $wgXhtmlDefaultNamespace);
         $tpl->set('xhtmlnamespaces', $wgXhtmlNamespaces);
         $tpl->set('html5version', $wgHtml5Version);
         $tpl->set('headlinks', $out->getHeadLinks($this));
         $tpl->set('csslinks', $out->buildCssLinks($this));
         if ($wgUseTrackbacks && $out->isArticleRelated()) {
             $tpl->set('trackbackhtml', $out->getTitle()->trackbackRDF());
         } else {
             $tpl->set('trackbackhtml', null);
         }
     }
     wfProfileOut(__METHOD__ . '-stuff-head');
     wfProfileIn(__METHOD__ . '-stuff2');
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->set('pageclass', $this->getPageClasses($this->getTitle()));
     $tpl->set('skinnameclass', 'skin-' . Sanitizer::escapeClass($this->getSkinName()));
     $nsname = MWNamespace::exists($this->getTitle()->getNamespace()) ? MWNamespace::getCanonicalName($this->getTitle()->getNamespace()) : $this->getTitle()->getNsText();
     $tpl->set('nscanonical', $nsname);
     $tpl->set('nsnumber', $this->getTitle()->getNamespace());
     $tpl->set('titleprefixeddbkey', $this->getTitle()->getPrefixedDBKey());
     $tpl->set('titletext', $this->getTitle()->getText());
     $tpl->set('articleid', $this->getTitle()->getArticleId());
     $tpl->set('currevisionid', $this->getTitle()->getLatestRevID());
     $tpl->set('isarticle', $out->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 ($out->isSyndicated()) {
         $feeds = array();
         foreach ($out->getSyndicationLinks() as $format => $link) {
             $feeds[$format] = array('text' => wfMsg("feed-{$format}"), 'href' => $link);
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
     $tpl->setRef('mimetype', $wgMimeType);
     $tpl->setRef('jsmimetype', $wgJsMimeType);
     $tpl->set('charset', 'UTF-8');
     $tpl->setRef('wgScript', $wgScript);
     $tpl->setRef('skinname', $this->skinname);
     $tpl->set('skinclass', get_class($this));
     $tpl->setRef('stylename', $this->stylename);
     $tpl->set('printable', $out->isPrintable());
     $tpl->set('handheld', $wgRequest->getBool('handheld'));
     $tpl->setRef('loggedin', $this->loggedin);
     $tpl->set('notspecialpage', $this->getTitle()->getNamespace() != NS_SPECIAL);
     /* XXX currently unused, might get useful later
     		$tpl->set( 'editable', ( $this->getTitle()->getNamespace() != NS_SPECIAL ) );
     		$tpl->set( 'exists', $this->getTitle()->getArticleID() != 0 );
     		$tpl->set( 'watch', $this->getTitle()->userIsWatching() ? 'unwatch' : 'watch' );
     		$tpl->set( 'protect', count( $this->getTitle()->isProtected() ) ? 'unprotect' : 'protect' );
     		$tpl->set( 'helppage', wfMsg( 'helppage' ) );
     		*/
     $tpl->set('searchaction', $this->escapeSearchLink());
     $tpl->set('searchtitle', SpecialPage::getTitleFor('Search')->getPrefixedDBKey());
     $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);
     $contentlang = $wgContLang->getCode();
     $contentdir = $wgContLang->getDir();
     $userlang = $wgLang->getCode();
     $userdir = $wgLang->getDir();
     $tpl->set('lang', $userlang);
     $tpl->set('dir', $userdir);
     $tpl->set('rtl', $wgLang->isRTL());
     $tpl->set('capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '');
     $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', $userlang);
     // Users can have their language set differently than the
     // content of the wiki. For these users, tell the web browser
     // that interface elements are in a different language.
     $tpl->set('userlangattributes', '');
     $tpl->set('specialpageattributes', '');
     # obsolete
     if ($userlang !== $contentlang || $userdir !== $contentdir) {
         $attrs = " lang='{$userlang}' dir='{$userdir}'";
         $tpl->set('userlangattributes', $attrs);
     }
     $newtalks = $this->getNewtalks($out);
     wfProfileOut(__METHOD__ . '-stuff2');
     wfProfileIn(__METHOD__ . '-stuff3');
     $tpl->setRef('newtalk', $newtalks);
     $tpl->setRef('skin', $this);
     $tpl->set('logo', $this->logoText());
     if ($out->isArticle() && (!isset($oldid) || isset($diff)) && $this->getTitle()->exists()) {
         $article = new Article($this->getTitle(), 0);
         if (!$wgDisableCounters) {
             $viewcount = $wgLang->formatNum($article->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);
             $res = $dbr->select('watchlist', array('COUNT(*) AS n'), array('wl_title' => $dbr->strencode($this->getTitle()->getDBkey()), 'wl_namespace' => $this->getTitle()->getNamespace()), __METHOD__);
             $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 ($wgMaxCredits != 0) {
             $this->credits = Action::factory('credits', $article)->getCredits($wgMaxCredits, $wgShowCreditsIfMax);
         } else {
             $tpl->set('lastmod', $this->lastModified($article));
         }
         $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(__METHOD__ . '-stuff3');
     wfProfileIn(__METHOD__ . '-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->set('footerlinks', array('info' => array('lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright'), 'places' => array('privacy', 'about', 'disclaimer')));
     global $wgFooterIcons;
     $tpl->set('footericons', $wgFooterIcons);
     foreach ($tpl->data['footericons'] as $footerIconsKey => &$footerIconsBlock) {
         if (count($footerIconsBlock) > 0) {
             foreach ($footerIconsBlock as &$footerIcon) {
                 if (isset($footerIcon['src'])) {
                     if (!isset($footerIcon['width'])) {
                         $footerIcon['width'] = 88;
                     }
                     if (!isset($footerIcon['height'])) {
                         $footerIcon['height'] = 31;
                     }
                 }
             }
         } else {
             unset($tpl->data['footericons'][$footerIconsKey]);
         }
     }
     if ($wgDebugComments) {
         $tpl->setRef('debug', $out->mDebugtext);
     } else {
         $tpl->set('debug', '');
     }
     $tpl->set('reporttime', wfReportTime());
     $tpl->set('sitenotice', $this->getSiteNotice());
     $tpl->set('bottomscripts', $this->bottomScripts($out));
     $tpl->set('printfooter', $this->printSource());
     # Add a <div class="mw-content-ltr/rtl"> around the body text
     # not for special pages or file pages AND only when viewing AND if the page exists
     # (or is in MW namespace, because that has default content)
     if (!in_array($this->getTitle()->getNamespace(), array(NS_SPECIAL, NS_FILE)) && in_array($action, array('view', 'historysubmit')) && ($this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI)) {
         $pageLang = $this->getTitle()->getPageLanguage();
         $realBodyAttribs = array('lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), 'class' => 'mw-content-' . $pageLang->getDir());
         $out->mBodytext = Html::rawElement('div', $realBodyAttribs, $out->mBodytext);
     }
     $tpl->setRef('bodytext', $out->mBodytext);
     # Language links
     $language_urls = array();
     if (!$wgHideInterlanguageLinks) {
         foreach ($out->getLanguageLinks() as $l) {
             $tmp = explode(':', $l, 2);
             $class = 'interwiki-' . $tmp[0];
             unset($tmp);
             $nt = Title::newFromText($l);
             if ($nt) {
                 $language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'title' => $nt->getText(), 'class' => $class, 'lang' => $nt->getInterwiki(), 'hreflang' => $nt->getInterwiki());
             }
         }
     }
     if (count($language_urls)) {
         $tpl->setRef('language_urls', $language_urls);
     } else {
         $tpl->set('language_urls', false);
     }
     wfProfileOut(__METHOD__ . '-stuff4');
     wfProfileIn(__METHOD__ . '-stuff5');
     # Personal toolbar
     $tpl->set('personal_urls', $this->buildPersonalUrls($out));
     $content_navigation = $this->buildContentNavigationUrls($out);
     $content_actions = $this->buildContentActionUrls($content_navigation);
     $tpl->setRef('content_navigation', $content_navigation);
     $tpl->setRef('content_actions', $content_actions);
     $tpl->set('sidebar', $this->buildSidebar());
     $tpl->set('nav_urls', $this->buildNavUrls($out));
     // Set the head scripts near the end, in case the above actions resulted in added scripts
     if ($this->useHeadElement) {
         $tpl->set('headelement', $out->headElement($this));
     } else {
         $tpl->set('headscripts', $out->getScript());
     }
     $tpl->set('debughtml', $this->generateDebugHTML());
     // original version by hansm
     if (!wfRunHooks('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
         wfDebug(__METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n");
     }
     // Set the bodytext to another key so that skins can just output it on it's own
     // and output printfooter and debughtml separately
     $tpl->set('bodycontent', $tpl->data['bodytext']);
     // Append printfooter and debughtml onto bodytext so that skins that were already
     // using bodytext before they were split out don't suddenly start not outputting information
     $tpl->data['bodytext'] .= Html::rawElement('div', array('class' => 'printfooter'), "\n{$tpl->data['printfooter']}") . "\n";
     $tpl->data['bodytext'] .= $tpl->data['debughtml'];
     // allow extensions adding stuff after the page content.
     // See Skin::afterContentHook() for further documentation.
     $tpl->set('dataAfterContent', $this->afterContentHook());
     wfProfileOut(__METHOD__ . '-stuff5');
     // execute template
     wfProfileIn(__METHOD__ . '-execute');
     $res = $tpl->execute();
     wfProfileOut(__METHOD__ . '-execute');
     // result may be an error
     $this->printOrError($res);
     wfProfileOut(__METHOD__);
 }
Пример #14
0
 function outputPage(OutputPage $out)
 {
     global $wgDebugComments;
     wfProfileIn(__METHOD__);
     $this->setMembers();
     $this->initPage($out);
     // See self::afterContentHook() for documentation
     $afterContent = $this->afterContentHook();
     $out->out($out->headElement($this));
     $out->out("\n<body");
     $ops = $this->getBodyOptions();
     foreach ($ops as $name => $val) {
         $out->out(" {$name}='{$val}'");
     }
     $out->out(">\n");
     if ($wgDebugComments) {
         $out->out("<!-- Wiki debugging output:\n" . $out->mDebugtext . "-->\n");
     }
     $out->out($this->beforeContent());
     $out->out($out->mBodytext . "\n");
     $out->out($this->afterContent());
     $out->out($afterContent);
     $out->out($this->bottomScripts());
     $out->out(wfReportTime());
     $out->out("\n</body></html>");
     wfProfileOut(__METHOD__);
 }
Пример #15
0
 /**
  * Execute an action, and in case of an error, erase whatever partial results
  * have been accumulated, and replace it with an error message and a help screen.
  */
 protected function executeActionWithErrorHandling()
 {
     // Verify the CORS header before executing the action
     if (!$this->handleCORS()) {
         // handleCORS() has sent a 403, abort
         return;
     }
     // Exit here if the request method was OPTIONS
     // (assume there will be a followup GET or POST)
     if ($this->getRequest()->getMethod() === 'OPTIONS') {
         return;
     }
     // In case an error occurs during data output,
     // clear the output buffer and print just the error information
     ob_start();
     $t = microtime(true);
     try {
         $this->executeAction();
     } catch (Exception $e) {
         // Allow extra cleanup and logging
         wfRunHooks('ApiMain::onException', array($this, $e));
         // Log it
         if ($e instanceof MWException && !$e instanceof UsageException) {
             global $wgLogExceptionBacktrace;
             if ($wgLogExceptionBacktrace) {
                 wfDebugLog('exception', $e->getLogMessage() . "\n" . $e->getTraceAsString() . "\n");
             } else {
                 wfDebugLog('exception', $e->getLogMessage());
             }
         }
         // Handle any kind of exception by outputting properly formatted error message.
         // If this fails, an unhandled exception should be thrown so that global error
         // handler will process and log it.
         $errCode = $this->substituteResultWithError($e);
         // Error results should not be cached
         $this->setCacheMode('private');
         $response = $this->getRequest()->response();
         $headerStr = 'MediaWiki-API-Error: ' . $errCode;
         if ($e->getCode() === 0) {
             $response->header($headerStr);
         } else {
             $response->header($headerStr, true, $e->getCode());
         }
         // Reset and print just the error message
         ob_clean();
         // If the error occurred during printing, do a printer->profileOut()
         $this->mPrinter->safeProfileOut();
         $this->printResult(true);
     }
     // Log the request whether or not there was an error
     $this->logRequest(microtime(true) - $t);
     // Send cache headers after any code which might generate an error, to
     // avoid sending public cache headers for errors.
     $this->sendCacheHeaders();
     if ($this->mPrinter->getIsHtml() && !$this->mPrinter->isDisabled()) {
         echo wfReportTime();
     }
     ob_end_flush();
 }
Пример #16
0
 /**
  * Execute an action, and in case of an error, erase whatever partial results
  * have been accumulated, and replace it with an error message and a help screen.
  */
 protected function executeActionWithErrorHandling()
 {
     // In case an error occurs during data output,
     // clear the output buffer and print just the error information
     ob_start();
     try {
         $this->executeAction();
     } catch (Exception $e) {
         // Log it
         if ($e instanceof MWException) {
             wfDebugLog('exception', $e->getLogMessage());
         }
         // Handle any kind of exception by outputing properly formatted error message.
         // If this fails, an unhandled exception should be thrown so that global error
         // handler will process and log it.
         $errCode = $this->substituteResultWithError($e);
         // Error results should not be cached
         $this->setCacheMode('private');
         $response = $this->getRequest()->response();
         $headerStr = 'MediaWiki-API-Error: ' . $errCode;
         if ($e->getCode() === 0) {
             $response->header($headerStr);
         } else {
             $response->header($headerStr, true, $e->getCode());
         }
         // Reset and print just the error message
         ob_clean();
         // If the error occured during printing, do a printer->profileOut()
         $this->mPrinter->safeProfileOut();
         $this->printResult(true);
     }
     // Send cache headers after any code which might generate an error, to
     // avoid sending public cache headers for errors.
     $this->sendCacheHeaders();
     if ($this->mPrinter->getIsHtml() && !$this->mPrinter->isDisabled()) {
         echo wfReportTime();
     }
     ob_end_flush();
 }
Пример #17
0
<?= $body ?>

<!-- comScore -->
<?= $comScore ?>

<!-- googleAnalytics -->
<?= $googleAnalytics ?>

<?php
	if($jsAtBottom) {
		print $wikiaScriptLoader; // needed for jsLoader and for the async loading of CSS files.
		print "\n\n\t<!-- Combined JS files and head scripts -->\n";
		print $jsFiles . "\n";
	}
?>

<!-- quantServe -->
<?= $quantServe ?>

<?php
	print '<script type="text/javascript">/*<![CDATA[*/for(var i=0;i<wgAfterContentAndJS.length;i++){wgAfterContentAndJS[i]();}/*]]>*/</script>' . "\n";

	print "<!-- BottomScripts -->\n";
	print $bottomscripts;
	print "<!-- end Bottomscripts -->\n";
?>

<?= wfReportTime()."\n" ?>
</body>
</html>