Inheritance: extends Action
 protected function handle()
 {
     // Post from the tag dropdown; redirect to a GET
     if ($this->isPost()) {
         common_redirect($this->selfUrl(), 303);
     }
     parent::handle();
 }
Example #2
0
 function handle($args)
 {
     parent::handle($args);
     if (!$this->user) {
         $this->clientError(_('No such user.'));
         return;
     }
     $this->showPage();
 }
Example #3
0
 function handle($args)
 {
     parent::handle($args);
     if (!$this->user) {
         $this->clientError(_('用户不存在'), 404);
         return;
     }
     $this->showPage();
 }
Example #4
0
 function handle($args)
 {
     parent::handle($args);
     if (!$this->user) {
         // TRANS: Client error when user not found for an action.
         $this->clientError(_('No such user.'));
         return;
     }
     $this->showPage();
 }
Example #5
0
 function handle($args)
 {
     parent::handle($args);
     // Post from the tag dropdown; redirect to a GET
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         common_redirect($this->selfUrl(), 303);
         return;
     }
     $this->showPage();
 }
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     // fetch the actual stream stuff
     $stream = $this->getStream();
     $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     if ($this->page > 1 && $this->notice->N == 0) {
         // TRANS: Client error when page not found (404).
         $this->clientError(_('No such page.'), 404);
     }
     return true;
 }
Example #7
0
 function handle($args)
 {
     parent::handle($args);
     if (!$this->user) {
         $this->clientError(_('用户不存在'));
         return;
     }
     $cur = common_current_user();
     if (empty($cur) || $cur->id != $this->user->id) {
         $this->clientError(_('无法访问此用户的个人页面'));
         return;
     }
     $this->showPage();
 }
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     // In case we need more info than ProfileAction->doPreparation() gives us
     $this->doStreamPreparation();
     // fetch the actual stream stuff
     try {
         $stream = $this->getStream();
         $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     } catch (PrivateStreamException $e) {
         $this->notice = new Notice();
         $this->notice->whereAdd('FALSE');
     }
     if ($this->page > 1 && $this->notice->N == 0) {
         // TRANS: Client error when page not found (404).
         $this->clientError(_('No such page.'), 404);
     }
     return true;
 }
Example #9
0
 function noticeFormOptions()
 {
     $options = parent::noticeFormOptions();
     $cur = common_current_user();
     if (empty($cur) || $cur->id != $this->profile->id) {
         $options['to_profile'] = $this->profile;
     }
     return $options;
 }
 function showSections()
 {
     ProfileAction::showSections();
     // skip tag cloud
 }
 public function index()
 {
     $wid = (int) $_GET['wid'];
     $page = (int) $_GET['page'];
     $type = $_GET['type'];
     if ($type == 'u') {
         if ($this->userId) {
             $user = new ProfileAction();
             $userRelation = $user->getFriendRelation($wid);
             if ($userRelation == ('me' || 'friend' || 'request')) {
                 $info = getUserBasicInfo($wid);
                 $title = $info['name'];
                 $pic = $info['pic_square'];
             } else {
                 $this->redirect('', '', 'home');
             }
         } else {
             $this->redirect('', '', 'index');
         }
     } else {
         if ($type == 'g') {
             $map = array();
             $map['id'] = $wid;
             $group = D('Group')->find($map);
             if (empty($group)) {
                 $this->redirect('', '', 'home');
             } else {
                 if (empty($this->userId)) {
                     if ($group['privacy'] == 'OPEN') {
                         $title = $group['name'];
                         $groupAccess = 'GUEST';
                     } else {
                         $this->redirect('', '', 'index');
                     }
                 } else {
                     $map = array();
                     $map['uid'] = $this->userId;
                     $map['gid'] = $wid;
                     $member = D('GroupMember')->findAll($map);
                     if (empty($member) && $group['privacy'] != 'OPEN') {
                         $this->redirect('', '', 'home');
                     } else {
                         if (empty($member) && $group['privacy'] == 'OPEN') {
                             $title = $group['name'];
                             $groupAccess = 'USER_GUEST';
                         } else {
                             $title = $group['name'];
                             $groupAccess = strtoupper($member['title']);
                         }
                     }
                 }
             }
         } else {
             $this->redirect('', '', 'home');
         }
     }
     $listRows = 10;
     $Wall = $this->getWall($wid, $type, $listRows, $page);
     $this->assign('wall', $Wall);
     $this->assign('type', $type);
     $this->assign('title', $title);
     $this->assign('pic', $pic);
     $this->assign('groupAccess', $groupAccess);
     $this->assign('userRelation', $userRelation);
     $this->display();
 }
Example #12
0
 function showSections()
 {
     parent::showSections();
     $cloud = new PersonalTagCloudSection($this, $this->user);
     $cloud->show();
 }
 public function index()
 {
     $uid = (int) $_GET['id'];
     if (empty($uid)) {
         if (empty($this->userId)) {
             $this->redirect('', '', 'index');
         } else {
             $uid = $this->userId;
             $Profile = $this->userInfo;
         }
     } else {
         if (empty($this->userId)) {
             $this->redirect('', '', 'index');
         } else {
             if ($uid == $this->userId) {
                 $uid = $this->userId;
                 $Profile = $this->userInfo;
             } else {
                 $user = new ProfileAction();
                 $userRelation = $user->getFriendRelation($uid);
                 if ($userRelation == 'stranger') {
                     $this->redirect('', '', 'profile', '', array('id' => $uid));
                 }
             }
         }
     }
     $dao = D('User');
     $Profile = $dao->find($uid);
     $this->assign('profile', $Profile);
     /*
      * get current user's friends
      */
     $currentUserFriend = getFriend($uid);
     $i = 0;
     $j = 1;
     foreach ($currentUserFriend as &$key) {
         $key = array('uid' => current(array_diff($key, array($uid))));
         $key += array('userInfo' => getUserBasicInfo($key['uid']));
         $key += array('key' => $i);
         $key += array('id' => $j);
         $j++;
         if ($i == 9) {
             $i = 0;
         } else {
             $i++;
         }
     }
     $this->assign('currentUserFriend', $currentUserFriend);
     /*
      * get user count
      */
     $friendCount = count($currentUserFriend);
     $this->assign('friendCount', $friendCount);
     /*
      * get header
      */
     $name = '<a href="' . url('', '', 'profile', '', array('id' => $uid)) . '">' . $Profile['name'] . '</a>';
     $pageHeader = sprintf(L('_friends_header'), $name);
     if ($currentUserFriend) {
         $pageSubheader = sprintf(L('_friends_subheader1'), $name, $friendCount);
     } else {
         $pageSubheader = sprintf(L('_friends_subheader2'), $name);
     }
     $this->assign('pageHeader', $pageHeader);
     $this->assign('pageSubheader', $pageSubheader);
     $this->display();
 }
 function showStylesheets()
 {
     parent::showStylesheets();
     $this->cssLink('plugins/ExtendedProfile/profiledetail.css');
     return true;
 }
Example #15
0
 function handle($args)
 {
     parent::handle($args);
     $this->showPage();
 }