Exemplo n.º 1
0
 function view($u = null)
 {
     global $wgOut, $wgTitle, $wgUser, $wgRequest;
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $this->user = $u ? $u : User::newFromName($wgTitle->getDBKey());
     if (!$u && $this->mTitle->getNamespace() != NS_USER || !$this->user || isset($diff) || isset($rcid)) {
         return Article::view();
     }
     if ($this->user->getID() == 0) {
         header('HTTP/1.1 404 Not Found');
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchuser', 'Noarticletext_user');
         return;
     }
     $this->isPageOwner = $wgUser->getID() == $this->user->getID();
     if ($this->user->isBlocked() && $this->isPageOwner) {
         $wgOut->blockedPage();
         return;
     }
     $wgOut->setRobotpolicy('index,follow');
     $skin = $wgUser->getSkin();
     //user settings
     $checkStats = $this->user->getOption('profilebox_stats') == 1;
     $checkStartedEdited = $this->user->getOption('profilebox_startedEdited') == 1;
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('profilebox.js'), '/extensions/wikihow/profilebox/', false));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('profilebox.css'), '/extensions/wikihow/profilebox/', false));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('rcwidget.css'), '/extensions/wikihow/rcwidget/', false));
     $profileStats = new ProfileStats($this->user);
     $badgeData = $profileStats->getBadges();
     $wgOut->addHTML(ProfileBox::getDisplayBadge($badgeData));
     if (!$u) {
         $skin->addWidget($this->getRCUserWidget());
     }
     if ($checkStats || $checkStartedEdited) {
         $createdData = $profileStats->getArticlesCreated(0);
     }
     //stats
     if ($checkStats) {
         $stats = ProfileBox::fetchStats("User:"******"<div class='clearall'></div>");
     }
 }