当前位置: 首页>>代码示例>>PHP>>正文


PHP User_group::staticGet方法代码示例

本文整理汇总了PHP中User_group::staticGet方法的典型用法代码示例。如果您正苦于以下问题:PHP User_group::staticGet方法的具体用法?PHP User_group::staticGet怎么用?PHP User_group::staticGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User_group的用法示例。


在下文中一共展示了User_group::staticGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateGroupUri

function updateGroupUri($group)
{
    if (!have_option('q', 'quiet')) {
        print "Updating URI for group '" . $group->nickname . "' (" . $group->id . ")...";
    }
    if (empty($group->uri)) {
        // Using clone here was screwing up the group->find() iteration
        $orig = User_group::staticGet('id', $group->id);
        $group->uri = $group->getUri();
        if (have_option('dry_run')) {
            echo " would have set {$group->uri} ";
        } else {
            if (!$group->update($orig)) {
                throw new Exception("Can't update uri for group " . $group->nickname . ".");
            }
            echo " set {$group->uri} ";
        }
    } else {
        print " already set, keeping {$group->uri} ";
    }
    if (have_option('v', 'verbose')) {
        print "DONE.";
    }
    if (!have_option('q', 'quiet') || have_option('v', 'verbose')) {
        print "\n";
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:27,代码来源:fixup_group_uri.php

示例2: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $this->user = common_current_user();
     if (empty($this->user)) {
         throw new ClientException(_('Must be logged in.'), 403);
     }
     if (!$this->user->hasRight(Right::NEWMESSAGE)) {
         throw new Exception(sprintf(_('User %s not allowed to send private messages.'), $this->user->nickname));
     }
     $nicknameArg = $this->trimmed('nickname');
     $nickname = common_canonical_nickname($nicknameArg);
     if ($nickname != $nicknameArg) {
         $url = common_local_url('newgroupmessage', array('nickname' => $nickname));
         common_redirect($url, 301);
         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);
     }
     // This throws an exception on error
     Group_privacy_settings::ensurePost($this->user, $this->group);
     // If we're posted to, check session token and get text
     if ($this->isPost()) {
         $this->checkSessionToken();
         $this->text = $this->trimmed('content');
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:41,代码来源:newgroupmessage.php

示例3: handle

 /**
  * Handle input, produce output
  *
  * Switches based on GET or POST method. On GET, shows a form
  * for posting a notice. On POST, saves the results of that form.
  *
  * Results may be a full page, or just a single notice list item,
  * depending on whether AJAX was requested.
  *
  * @param array $args $_REQUEST contents
  *
  * @return void
  */
 function handle($args)
 {
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             // check for this before token since all POST and FILES data
             // is losts when size is exceeded
             if (empty($_POST) && $_SERVER['CONTENT_LENGTH']) {
                 // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
                 // TRANS: %s is the number of bytes of the CONTENT_LENGTH.
                 $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', intval($_SERVER['CONTENT_LENGTH']));
                 $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
             }
             parent::handle($args);
             $user = common_current_user();
             $group = User_group::staticGet('id', $this->trimmed('groupid'));
             $taskid = $this->trimmed('taskid');
             try {
                 $this->saveNewNotice();
                 Task::completeTask($user->id, $taskid);
             } catch (Exception $e) {
                 $this->ajaxErrorMsg($e->getMessage(), $taskid, $group);
                 return;
             }
         }
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:42,代码来源:NewnoticetaskAction.php

示例4: prepare

 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('groupmembers', $args), 301);
         return false;
     }
     if (!$nickname) {
         // TRANS: Client error displayed when trying to view group members without providing a group nickname.
         $this->clientError(_('No nickname.'), 404);
         return false;
     }
     $local = Local_group::staticGet('nickname', $nickname);
     if (!$local) {
         // TRANS: Client error displayed when trying to view group members for a non-existing group.
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     $this->group = User_group::staticGet('id', $local->group_id);
     if (!$this->group) {
         // TRANS: Client error displayed when trying to view group members for an object that is not a group.
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:34,代码来源:groupmembers.php

示例5: prepare

 function prepare($args)
 {
     parent::prepare($args);
     $nickname_arg = $this->arg('nickname');
     if (empty($nickname_arg)) {
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     $this->nickname = common_canonical_nickname($nickname_arg);
     // Permanent redirect on non-canonical nickname
     if ($nickname_arg != $this->nickname) {
         common_redirect(common_local_url('foafgroup', array('nickname' => $this->nickname)), 301);
         return false;
     }
     $local = Local_group::staticGet('nickname', $this->nickname);
     if (!$local) {
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     $this->group = User_group::staticGet('id', $local->group_id);
     if (!$this->group) {
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     common_set_returnto($this->selfUrl());
     return true;
 }
开发者ID:himmelex,项目名称:NTW,代码行数:27,代码来源:foafgroup.php

示例6: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $this->user = common_current_user();
     if (empty($this->user)) {
         // TRANS: Client exception thrown when trying to view group private messages without being logged in.
         throw new ClientException(_m('Only logged-in users can view private messages.'), 403);
     }
     $id = $this->trimmed('id');
     $this->gm = Group_message::staticGet('id', $id);
     if (empty($this->gm)) {
         // TRANS: Client exception thrown when trying to view a non-existing group private message.
         throw new ClientException(_m('No such message.'), 404);
     }
     $this->group = User_group::staticGet('id', $this->gm->to_group);
     if (empty($this->group)) {
         // TRANS: Server exception thrown when trying to view group private messages for a non-exsting group.
         throw new ServerException(_m('Group not found.'));
     }
     if (!$this->user->isMember($this->group)) {
         // TRANS: Client exception thrown when trying to view a group private message without being a group member.
         throw new ClientException(_m('Cannot read message.'), 403);
     }
     $this->sender = Profile::staticGet('id', $this->gm->from_profile);
     if (empty($this->sender)) {
         // TRANS: Server exception thrown when trying to view a group private message without a sender.
         throw new ServerException(_m('No sender found.'));
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:37,代码来源:showgroupmessage.php

示例7: prepare

 /**
  * 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;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:39,代码来源:groupinbox.php

示例8: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $this->user = common_current_user();
     if (empty($this->user)) {
         throw new ClientException(_('Only logged-in users can view private messages.'), 403);
     }
     $id = $this->trimmed('id');
     $this->gm = Group_message::staticGet('id', $id);
     if (empty($this->gm)) {
         throw new ClientException(_('No such message'), 404);
     }
     $this->group = User_group::staticGet('id', $this->gm->to_group);
     if (empty($this->group)) {
         throw new ServerException(_('Group not found.'));
     }
     if (!$this->user->isMember($this->group)) {
         throw new ClientException(_('Cannot read message.'), 403);
     }
     $this->sender = Profile::staticGet('id', $this->gm->from_profile);
     if (empty($this->sender)) {
         throw new ServerException(_('No sender found.'));
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:32,代码来源:showgroupmessage.php

示例9: prepare

 /**
  * Prepare to run
  */
 function prepare($args)
 {
     parent::prepare($args);
     if (!common_config('inboxes', 'enabled')) {
         $this->serverError(_('Inboxes must be enabled for groups to work.'));
         return false;
     }
     if (!common_logged_in()) {
         $this->clientError(_('You must be logged in to leave a group.'));
         return false;
     }
     $nickname_arg = $this->trimmed('nickname');
     $nickname = common_canonical_nickname($nickname_arg);
     // Permanent redirect on non-canonical nickname
     if ($nickname_arg != $nickname) {
         $args = array('nickname' => $nickname);
         common_redirect(common_local_url('leavegroup', $args), 301);
         return false;
     }
     if (!$nickname) {
         $this->clientError(_('No nickname.'), 404);
         return false;
     }
     $this->group = User_group::staticGet('nickname', $nickname);
     if (!$this->group) {
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     $cur = common_current_user();
     if (!$cur->isMember($this->group)) {
         $this->clientError(_('You are not a member of that group.'), 403);
         return false;
     }
     return true;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:38,代码来源:leavegroup.php

示例10: updateGroupAvatars

function updateGroupAvatars($group)
{
    if (!have_option('q', 'quiet')) {
        print "Updating avatars for group '" . $group->nickname . "' (" . $group->id . ")...";
    }
    if (empty($group->original_logo)) {
        print "(none found)...";
    } else {
        // Using clone here was screwing up the group->find() iteration
        $orig = User_group::staticGet('id', $group->id);
        $group->original_logo = Avatar::url(basename($group->original_logo));
        $group->homepage_logo = Avatar::url(basename($group->homepage_logo));
        $group->stream_logo = Avatar::url(basename($group->stream_logo));
        $group->mini_logo = Avatar::url(basename($group->mini_logo));
        if (!$group->update($orig)) {
            throw new Exception("Can't update avatars for group " . $group->nickname . ".");
        }
    }
    if (have_option('v', 'verbose')) {
        print "DONE.";
    }
    if (!have_option('q', 'quiet') || have_option('v', 'verbose')) {
        print "\n";
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:25,代码来源:updateavatarurl_group.php

示例11: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
         return false;
     }
     $token = $this->trimmed('token');
     if (empty($token) || $token != common_session_token()) {
         // TRANS: Client error displayed when the session token does not match or is not given.
         $this->clientError(_('There was a problem with your session token. Try again, please.'));
         return;
     }
     $id = $this->trimmed('blockto');
     if (empty($id)) {
         // TRANS: Client error displayed trying to block a user from a group while not specifying a to be blocked user profile.
         $this->clientError(_('No profile specified.'));
         return false;
     }
     $this->profile = Profile::staticGet('id', $id);
     if (empty($this->profile)) {
         // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile.
         $this->clientError(_('No profile with that ID.'));
         return false;
     }
     $group_id = $this->trimmed('blockgroup');
     if (empty($group_id)) {
         // TRANS: Client error displayed trying to block a user from a group while not specifying a group to block a profile from.
         $this->clientError(_('No group specified.'));
         return false;
     }
     $this->group = User_group::staticGet('id', $group_id);
     if (empty($this->group)) {
         // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group.
         $this->clientError(_('No such group.'));
         return false;
     }
     $user = common_current_user();
     if (!$user->isAdmin($this->group)) {
         // TRANS: Client error displayed trying to block a user from a group while not being an admin user.
         $this->clientError(_('Only an admin can block group members.'), 401);
         return false;
     }
     if (Group_block::isBlocked($this->group, $this->profile)) {
         // TRANS: Client error displayed trying to block a user from a group while user is already blocked from the given group.
         $this->clientError(_('User is already blocked from group.'));
         return false;
     }
     // XXX: could have proactive blocks, but we don't have UI for it.
     if (!$this->profile->isMember($this->group)) {
         // TRANS: Client error displayed trying to block a user from a group while user is not a member of given group.
         $this->clientError(_('User is not a member of group.'));
         return false;
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:64,代码来源:groupblock.php

示例12: getGroup

 function getGroup()
 {
     $group = User_group::staticGet('id', $this->group_id);
     if (empty($group)) {
         // TRANS: Exception thrown providing an invalid group ID.
         // TRANS: %s is the invalid group ID.
         throw new Exception(sprintf(_("Group ID %s is invalid."), $this->group_id));
     }
     return $group;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:10,代码来源:Group_member.php

示例13: prepare

 /**
  * Prepare to run
  */
 function prepare($args)
 {
     parent::prepare($args);
     if (!common_logged_in()) {
         // TRANS: Client error displayed when trying to join a group while not logged in.
         $this->clientError(_('You must be logged in to join a group.'));
         return false;
     }
     $nickname_arg = $this->trimmed('nickname');
     $id = intval($this->arg('id'));
     if ($id) {
         $this->group = User_group::staticGet('id', $id);
     } else {
         if ($nickname_arg) {
             $nickname = common_canonical_nickname($nickname_arg);
             // Permanent redirect on non-canonical nickname
             if ($nickname_arg != $nickname) {
                 $args = array('nickname' => $nickname);
                 common_redirect(common_local_url('leavegroup', $args), 301);
                 return false;
             }
             $local = Local_group::staticGet('nickname', $nickname);
             if (!$local) {
                 // TRANS: Client error displayed when trying to join a non-local group.
                 $this->clientError(_('No such group.'), 404);
                 return false;
             }
             $this->group = User_group::staticGet('id', $local->group_id);
         } else {
             // TRANS: Client error displayed when trying to join a group without providing a group name or group ID.
             $this->clientError(_('No nickname or ID.'), 404);
             return false;
         }
     }
     if (!$this->group) {
         // TRANS: Client error displayed when trying to join a non-existing group.
         $this->clientError(_('No such group.'), 404);
         return false;
     }
     $cur = common_current_user();
     if ($cur->isMember($this->group)) {
         // TRANS: Client error displayed when trying to join a group while already a member.
         $this->clientError(_('You are already a member of that group.'), 403);
         return false;
     }
     if (Group_block::isBlocked($this->group, $cur->getProfile())) {
         // TRANS: Client error displayed when trying to join a group while being blocked form joining it.
         $this->clientError(_('You have been blocked from that group by the admin.'), 403);
         return false;
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:55,代码来源:joingroup.php

示例14: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
         return false;
     }
     $token = $this->trimmed('token');
     if (empty($token) || $token != common_session_token()) {
         // TRANS: Client error displayed when the session token does not match or is not given.
         $this->clientError(_('There was a problem with your session token. Try again, please.'));
         return;
     }
     $id = $this->trimmed('profileid');
     if (empty($id)) {
         // TRANS: Client error displayed when not providing a profile ID on the Make Admin page.
         $this->clientError(_('No profile specified.'));
         return false;
     }
     $this->profile = Profile::staticGet('id', $id);
     if (empty($this->profile)) {
         // TRANS: Client error displayed when specifying an invalid profile ID on the Make Admin page.
         $this->clientError(_('No profile with that ID.'));
         return false;
     }
     $group_id = $this->trimmed('groupid');
     if (empty($group_id)) {
         // TRANS: Client error displayed when not providing a group ID on the Make Admin page.
         $this->clientError(_('No group specified.'));
         return false;
     }
     $this->group = User_group::staticGet('id', $group_id);
     if (empty($this->group)) {
         // TRANS: Client error displayed when providing an invalid group ID on the Make Admin page.
         $this->clientError(_('No such group.'));
         return false;
     }
     $user = common_current_user();
     if (!$user->isAdmin($this->group) && !$user->hasRight(Right::MAKEGROUPADMIN)) {
         // TRANS: Client error displayed when trying to make another user admin on the Make Admin page while not an admin.
         $this->clientError(_('Only an admin can make another user an admin.'), 401);
         return false;
     }
     if ($this->profile->isAdmin($this->group)) {
         // TRANS: Client error displayed when trying to make another user admin on the Make Admin page who already is admin.
         // TRANS: %1$s is the user that is already admin, %2$s is the group user is already admin for.
         $this->clientError(sprintf(_('%1$s is already an admin for group "%2$s".'), $this->profile->getBestName(), $this->group->getBestName()), 401);
         return false;
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:59,代码来源:makeadmin.php

示例15: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
         return false;
     }
     $token = $this->trimmed('token');
     if (empty($token) || $token != common_session_token()) {
         // TRANS: Client error displayed when the session token does not match or is not given.
         $this->clientError(_('There was a problem with your session token. Try again, please.'));
         return;
     }
     $id = $this->trimmed('unblockto');
     if (empty($id)) {
         // TRANS: Client error displayed when trying to unblock a user from a group without providing a profile.
         $this->clientError(_('No profile specified.'));
         return false;
     }
     $this->profile = Profile::staticGet('id', $id);
     if (empty($this->profile)) {
         // TRANS: Client error displayed when trying to unblock a user from a group without providing an existing profile.
         $this->clientError(_('No profile with that ID.'));
         return false;
     }
     $group_id = $this->trimmed('unblockgroup');
     if (empty($group_id)) {
         // TRANS: Client error displayed when trying to unblock a user from a group without providing a group.
         $this->clientError(_('No group specified.'));
         return false;
     }
     $this->group = User_group::staticGet('id', $group_id);
     if (empty($this->group)) {
         // TRANS: Client error displayed when trying to unblock a user from a non-existing group.
         $this->clientError(_('No such group.'));
         return false;
     }
     $user = common_current_user();
     if (!$user->isAdmin($this->group)) {
         // TRANS: Client error displayed when trying to unblock a user from a group without being an administrator for the group.
         $this->clientError(_('Only an admin can unblock group members.'), 401);
         return false;
     }
     if (!Group_block::isBlocked($this->group, $this->profile)) {
         // TRANS: Client error displayed when trying to unblock a non-blocked user from a group.
         $this->clientError(_('User is not blocked from group.'));
         return false;
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:58,代码来源:groupunblock.php


注:本文中的User_group::staticGet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。