Exemplo n.º 1
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $cur = common_current_user();
     if (empty($cur)) {
         // TRANS: Client exception thrown when trying to view group inbox while not logged in.
         throw new ClientException(_m('Only for logged-in users.'), 403);
     }
     $nicknameArg = $this->trimmed('nickname');
     $nickname = common_canonical_nickname($nicknameArg);
     if ($nickname != $nicknameArg) {
         $url = common_local_url('groupinbox', array('nickname' => $nickname));
         common_redirect($url);
     }
     $localGroup = Local_group::getKV('nickname', $nickname);
     if (empty($localGroup)) {
         // TRANS: Client exception thrown when trying to view group inbox for non-existing group.
         throw new ClientException(_m('No such group.'), 404);
     }
     $this->group = User_group::getKV('id', $localGroup->group_id);
     if (empty($this->group)) {
         // TRANS: Client exception thrown when trying to view group inbox for non-existing group.
         throw new ClientException(_m('No such group.'), 404);
     }
     if (!$cur->isMember($this->group)) {
         // TRANS: Client exception thrown when trying to view group inbox while not a member.
         throw new ClientException(_m('Only for members.'), 403);
     }
     $this->page = $this->trimmed('page');
     if (!$this->page) {
         $this->page = 1;
     }
     $this->gm = Group_message::forGroup($this->group, ($this->page - 1) * MESSAGES_PER_PAGE, MESSAGES_PER_PAGE + 1);
     return true;
 }
Exemplo n.º 2
0
 /**
  * Add the jCrop scripts
  *
  * @return void
  */
 function showScripts()
 {
     parent::showScripts();
     if ($this->mode == 'crop') {
         $this->script('jcrop/jquery.Jcrop.min.js');
         $this->script('jcrop/jquery.Jcrop.go.js');
     }
     $this->autofocus('avatarfile');
 }
Exemplo n.º 3
0
 function showScripts()
 {
     parent::showScripts();
     $this->autofocus('newnickname');
 }
Exemplo n.º 4
0
 function handle($args)
 {
     parent::handle($args);
     $this->showPage();
 }
Exemplo n.º 5
0
 function showScripts()
 {
     parent::showScripts();
     $this->autofocus('fullname');
 }
Exemplo n.º 6
0
 /**
  * Prepare the action
  *
  * Reads and validates arguments and instantiates the attributes.
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->page = $this->arg('page') ? $this->arg('page') + 0 : 1;
     $this->userProfile = Profile::current();
     $user = common_current_user();
     if (!empty($user) && $user->streamModeOnly()) {
         $stream = new GroupNoticeStream($this->group, $this->userProfile);
     } else {
         $stream = new ThreadingGroupNoticeStream($this->group, $this->userProfile);
     }
     $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     common_set_returnto($this->selfUrl());
     return true;
 }
Exemplo n.º 7
0
 /**
  * Handle the request
  *
  * Shows a profile for the group, some controls, and a list of
  * group notices.
  *
  * @return void
  */
 protected function handle()
 {
     parent::handle();
     $this->showPage();
 }
Exemplo n.º 8
0
 public function group_del()
 {
     if ($this->inGroup(13, true)) {
         require_once dirname(__FILE__) . '/resources/group.php';
         $group = new GroupAction($this->parent);
         return $group->del();
     } else {
         return new ActionResult($this, '/admin/user/group_view', 1, 'You are not allowed to do that', B_T_FAIL);
     }
 }