コード例 #1
0
ファイル: groupinbox.php プロジェクト: microcosmx/experiments
 /**
  * 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)) {
         throw new ClientException(_('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);
         return false;
     }
     $localGroup = Local_group::staticGet('nickname', $nickname);
     if (empty($localGroup)) {
         throw new ClientException(_('No such group'), 404);
     }
     $this->group = User_group::staticGet('id', $localGroup->group_id);
     if (empty($this->group)) {
         throw new ClientException(_('No such group'), 404);
     }
     if (!$cur->isMember($this->group)) {
         throw new ClientException(_('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;
 }
コード例 #2
0
ファイル: editgroup.php プロジェクト: himmelex/NTW
 function showScripts()
 {
     parent::showScripts();
     $this->autofocus('nickname');
 }
コード例 #3
0
 function handle($args)
 {
     parent::handle($args);
     $this->showPage();
 }
コード例 #4
0
ファイル: grouplogo.php プロジェクト: microcosmx/experiments
 /**
  * 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');
 }
コード例 #5
0
ファイル: showgroup.php プロジェクト: microcosmx/experiments
 /**
  * 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;
     $nickname_arg = $this->arg('nickname');
     $nickname = common_canonical_nickname($nickname_arg);
     // Permanent redirect on non-canonical nickname
     if ($nickname_arg != $nickname) {
         $args = array('nickname' => $nickname);
         if ($this->page != 1) {
             $args['page'] = $this->page;
         }
         common_redirect(common_local_url('showgroup', $args), 301);
         return false;
     }
     if (!$nickname) {
         // TRANS: Client error displayed if no nickname argument was given requesting a group page.
         $this->clientError(_('No nickname.'), 404);
         return false;
     }
     $local = Local_group::staticGet('nickname', $nickname);
     if (!$local) {
         $alias = Group_alias::staticGet('alias', $nickname);
         if ($alias) {
             $args = array('id' => $alias->group_id);
             if ($this->page != 1) {
                 $args['page'] = $this->page;
             }
             common_redirect(common_local_url('groupbyid', $args), 301);
             return false;
         } else {
             common_log(LOG_NOTICE, "Couldn't find local group for nickname '{$nickname}'");
             // TRANS: Client error displayed if no remote group with a given name was found requesting group page.
             $this->clientError(_('No such group.'), 404);
             return false;
         }
     }
     $this->group = User_group::staticGet('id', $local->group_id);
     if (!$this->group) {
         // TRANS: Client error displayed if no local group with a given name was found requesting group page.
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     common_set_returnto($this->selfUrl());
     return true;
 }