/**
  * Move thread (TODO: Should this be in Forums?)
  */
 public function moveModal()
 {
     $id = $this->getVal('id');
     $wm = WallMessage::newFromId($id);
     if (empty($wm)) {
         return true;
     }
     /** @var $mainWall WallMessage */
     $mainWall = $wm->getWall();
     if (!$this->wg->User->isAllowed('wallmessagemove')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $forum = new Forum();
     $list = $forum->getListTitles(DB_SLAVE, NS_WIKIA_FORUM_BOARD);
     $this->destinationBoards = array(array('value' => '', 'content' => wfMsg('forum-board-destination-empty')));
     /** @var $title Title */
     foreach ($list as $title) {
         $value = $title->getArticleID();
         if ($mainWall->getId() != $value) {
             $wall = Wall::newFromTitle($title);
             $this->destinationBoards[$value] = array('value' => $value, 'content' => htmlspecialchars($wall->getTitle()->getText()));
         }
     }
 }
예제 #2
0
 public function getUser()
 {
     $title = F::app()->wg->Title;
     $ns = $title->getNamespace();
     $user = null;
     if ($ns == NS_USER_WALL) {
         /**
          * @var $w Wall
          */
         $w = Wall::newFromTitle($title);
         $user = $w->getUser();
     } else {
         if ($ns == NS_USER_WALL_MESSAGE) {
             // title to wall thread is Thread:dddd, which does not exist in the db. this will
             // result in articleId being 0, which will break the logic later. So we need
             // to fetch the existing title here (Username/@comment-...)
             if (intval($title->getText()) > 0) {
                 $mainTitle = Title::newFromId($title->getText());
                 if (empty($mainTitle)) {
                     $mainTitle = Title::newFromId($title->getText(), Title::GAID_FOR_UPDATE);
                 }
                 if (!empty($mainTitle)) {
                     $title = $mainTitle;
                 }
             }
             /**
              * @var $wm WallMessage
              */
             $wm = WallMessage::newFromTitle($title);
             $user = $wm->getWallOwner();
         }
     }
     if (is_null($user)) {
         return UserProfilePageHelper::getUserFromTitle($title);
     }
     return $user;
 }
예제 #3
0
 /**
  * @brief Hook to change tabs on user wall page
  *
  * @param $template
  * @param $contentActions
  * @return bool
  *
  * @author Andrzej 'nAndy' Łukaszewski
  */
 public static function onSkinTemplateTabs($template, &$contentActions)
 {
     $app = F::App();
     if (!empty($app->wg->EnableWallExt)) {
         $helper = new WallHelper();
         $title = $app->wg->Title;
         if ($title->getNamespace() === NS_USER) {
             if (!empty($contentActions['namespaces']) && !empty($contentActions['namespaces']['user_talk'])) {
                 $contentActions['namespaces']['user_talk']['text'] = wfMessage('wall-message-wall')->text();
                 $userWallTitle = static::getWallTitle();
                 if ($userWallTitle instanceof Title) {
                     $contentActions['namespaces']['user_talk']['href'] = $userWallTitle->getLocalUrl();
                 }
                 // BugId:23000 Remove the class="new" to prevent the link from being displayed as a redlink in monobook.
                 if ($app->wg->User->getSkin() instanceof SkinMonoBook) {
                     unset($contentActions['namespaces']['user_talk']['class']);
                 }
             }
         }
         if ($title->getNamespace() === NS_USER_WALL || $title->getNamespace() === NS_USER_WALL_MESSAGE) {
             if ($title->getNamespace() === NS_USER_WALL_MESSAGE) {
                 $text = $title->getText();
                 $id = intval($text);
                 if ($id > 0) {
                     $wm = WallMessage::newFromId($id);
                 } else {
                     // sometimes (I found it on a revision diff page) $id here isn't a number from (in example) Thread:1234 link
                     // it's a text similar to this: AndLuk/@comment-38.127.199.123-20120111182821
                     // then we need to use WallMessage constructor method
                     $wm = new WallMessage($title);
                 }
                 if (empty($wm)) {
                     // FB#19394
                     return true;
                 }
                 /* @var $wm WallMessage */
                 $wall = $wm->getWall();
                 $user = $wall->getUser();
             } else {
                 $wall = Wall::newFromTitle($title);
                 $user = $wall->getUser();
             }
             $contentActions['namespaces'] = array();
             if ($user instanceof User) {
                 $contentActions['namespaces']['user-profile'] = array('class' => false, 'href' => $user->getUserPage()->getFullUrl(), 'text' => wfMessage('nstab-user')->text());
             }
             $contentActions['namespaces']['message-wall'] = array('class' => 'selected', 'href' => $wall->getUrl(), 'text' => wfMessage('wall-message-wall')->text());
         }
         if ($title->getNamespace() === NS_USER_WALL && $title->isSubpage()) {
             $userTalkPageTitle = $helper->getTitle(NS_USER_TALK);
             $contentActions = array();
             $contentActions['namespaces'] = array();
             $contentActions['namespaces']['view-source'] = array('class' => false, 'href' => $userTalkPageTitle->getLocalUrl(array('action' => 'edit')), 'text' => wfMessage('user-action-menu-view-source')->text());
             $contentActions['namespaces']['history'] = array('class' => false, 'href' => $userTalkPageTitle->getLocalUrl(array('action' => 'history')), 'text' => wfMessage('user-action-menu-history')->text());
         }
     }
     return true;
 }
 public function getWallForIndexPage($title)
 {
     $wall = Wall::newFromTitle($title);
     return $wall;
 }
예제 #5
0
 /**
  * @return Wall
  */
 public function getWall()
 {
     $wall = Wall::newFromTitle($this->getArticleTitle());
     return $wall;
 }
예제 #6
0
 public function getWallForIndexPage($title)
 {
     if ($title->getNamespace() == NS_WIKIA_FORUM_TOPIC_BOARD) {
         $topicTitle = $this->getTopicTitle();
         if (!empty($topicTitle)) {
             $wall = Wall::newFromRelatedPages($title, $topicTitle->getArticleId());
             $this->response->setVal('topicText', $topicTitle->getPrefixedText());
             $wall->disableCache();
         } else {
             $wall = Wall::newFromTitle($title);
         }
     } else {
         $wall = Wall::newFromTitle($title);
     }
     return $wall;
 }