示例#1
0
文件: feed.php 项目: vazahat/dudex
 public function feed()
 {
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $write = !empty($_GET["write"]);
     $viewDir = OW::getPluginManager()->getPlugin("newsfeed")->getMobileCtrlViewDir();
     $this->setTemplate($viewDir . "feed_feed.html");
     $feed = new NEWSFEED_MCMP_Feed(new NEWSFEED_CLASS_UserDriver(), 'my', OW::getUser()->getId());
     $feed->setDisplayType(NEWSFEED_CMP_Feed::DISPLAY_TYPE_ACTIVITY);
     if (OW::getUser()->isAuthorized('newsfeed', 'allow_status_update')) {
         $feed->addStatusForm('user', OW::getUser()->getId());
     }
     $feed->setup(array("displayCount" => 20, "customizeMode" => false, "viewMore" => true));
     $feed->focusOnInput(isset($_GET["write"]));
     $this->addComponent("feed", $feed);
 }
示例#2
0
 public function onProfileBottomContentCollect(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     $userId = $params["userId"];
     // privacy check
     $viewerId = OW::getUser()->getId();
     $ownerMode = $userId == $viewerId;
     $modPermissions = OW::getUser()->isAuthorized('newsfeed');
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => NEWSFEED_BOL_Service::PRIVACY_ACTION_VIEW_MY_FEED, 'ownerId' => $userId, 'viewerId' => $viewerId);
         try {
             OW::getEventManager()->trigger(new OW_Event('privacy_check_permission', $privacyParams));
         } catch (RedirectException $e) {
             return;
         }
     }
     $feed = new NEWSFEED_MCMP_Feed(new NEWSFEED_CLASS_FeedDriver(), "user", $userId);
     $isBloacked = BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $userId);
     if (OW::getUser()->isAuthenticated() && OW::getUser()->isAuthorized('base', 'add_comment')) {
         if ($isBloacked) {
             $feed->addStatusMessage(OW::getLanguage()->text("base", "user_block_message"));
         } else {
             $visibility = NEWSFEED_BOL_Service::VISIBILITY_FULL;
             $feed->addStatusForm('user', $userId, $visibility);
         }
     }
     $feed->setDisplayType(NEWSFEED_CMP_Feed::DISPLAY_TYPE_ACTIVITY);
     $feed->setup(array("displayCount" => 20, "customizeMode" => false, "viewMore" => true));
     $event->add($feed->render());
 }