Ejemplo n.º 1
0
function get_lzl_admin($lzl_id)
{
    $lzl = D('GroupLzlReply')->getLzlReply($lzl_id);
    $post = D('GroupPost')->getPost($lzl['post_id']);
    $uids = get_group_admin($post['group_id']);
    $uids[] = $lzl['uid'];
    return array_unique($uids);
}
Ejemplo n.º 2
0
 public function _initialize()
 {
     $aGroupId = I('group_id', 0, 'intval');
     $this->groupId = $aGroupId;
     parent::_initialize();
     //判断是否有权限编辑
     if (!is_login()) {
         $this->error('请先登陆。');
     }
     $this->checkAuth('Group/Manager/*', get_group_admin($this->groupId), '您没有管理群组的权限。');
     $this->assignNotice($this->groupId);
     $this->assign('group_id', $this->groupId);
     unset($e);
     $myInfo = query_user(array('avatar128', 'avatar64', 'nickname', 'uid', 'space_url'), is_login());
     $this->assign('myInfo', $myInfo);
     //赋予贴吧列表
     $this->assign('current', 'mygroup');
 }
 /**
  * @param $id
  * 群组ID
  *渲染  编辑  创建群组
  */
 public function addGroup()
 {
     if (IS_POST) {
         $aGroupId = I('post.group_id', 0, 'intval');
         $aGroupType = I('post.group_type', 0, 'intval');
         $aTitle = I('post.title', '', 'text');
         $aDetail = I('post.detail', '', 'text');
         $aLogo = I('post.logo', 0, 'intval');
         $aType = I('post.type', 0, 'intval');
         $aBackground = I('post.background', 0, 'intval');
         $aMemberAlias = I('post.member_alias', '成员', 'text');
         if (empty($aTitle)) {
             $this->error('请填写群组名称');
         }
         if (utf8_strlen($aTitle) > 20) {
             $this->error('群组名称最多20个字');
         }
         if ($aGroupType == -1) {
             $this->error('请选择群组分类');
         }
         if (empty($aDetail)) {
             $this->error('请填写群组介绍');
         }
         $model = M('Group');
         $isEdit = $aGroupId ? true : false;
         if ($isEdit) {
             $this->requireLogin();
             $this->requireGroupExists($aGroupId);
             $this->checkActionLimit('edit_group', 'Group', $aGroupId, is_login(), true);
             $this->checkAuth('Group/Index/editGroup', get_group_admin($aGroupId), '您无编辑群组权限');
         } else {
             $this->requireLimit();
             $this->checkActionLimit('add_group', 'Group', 0, is_login(), true);
             $this->checkAuth('Group/Index/addGroup', -1, '您无添加群组权限');
         }
         $need_verify = modC('GROUP_NEED_VERIFY', 0, 'GROUP');
         if ($isEdit) {
             $data = array('id' => $aGroupId, 'type_id' => $aGroupType, 'title' => $aTitle, 'detail' => $aDetail, 'logo' => $aLogo, 'type' => $aType, 'background' => $aBackground, 'member_alias' => $aMemberAlias);
             $data['status'] = $need_verify ? 0 : 1;
             $result = $model->editGroup($data);
             $group_id = $aGroupId;
         } else {
             $data = array('type_id' => $aGroupType, 'title' => $aTitle, 'detail' => $aDetail, 'logo' => $aLogo, 'type' => $aType, 'uid' => is_login(), 'background' => $aBackground, 'member_alias' => $aMemberAlias);
             $data['status'] = $need_verify ? 0 : 1;
             $result = $model->createGroup($data);
             if (!$result) {
                 $this->error('创建群组失败:' . $model->getError());
             }
             $group_id = $result;
             //向GroupMember表添加创建者成员
             M('GroupMember')->addMember(array('uid' => is_login(), 'group_id' => $group_id, 'status' => 1, 'position' => 3));
         }
         if ($need_verify) {
             $message = '创建成功,请耐心等候管理员审核。';
             // 发送消息
             M('Message')->sendMessage(1, '群组创建审核', get_nickname(is_login()) . "创建了群组【{$aTitle}】,快去审核吧。", 'admin/group/unverify');
             $data['status'] = 1;
             $data['info'] = $message;
             $this->ajaxReturn($data);
         }
         // 发送轻博客
         if (M('Module')->checkInstalled('Weibo')) {
             $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('group', array('id' => $group_id));
             if ($isEdit && check_is_in_config('edit_group', modC('GROUP_SEND_WEIBO', 'add_group,edit_group', 'GROUP'))) {
                 M('Weibo')->addWeibo(is_login(), "我修改了群组【" . $aTitle . "】:" . $postUrl);
             }
             if (!$isEdit && check_is_in_config('add_group', modC('GROUP_SEND_WEIBO', 'add_group,edit_group', 'GROUP'))) {
                 M('Weibo')->addWeibo(is_login(), "我创建了一个新的群组【" . $aTitle . "】:" . $postUrl);
             }
         }
         //显示成功消息
         $message = $isEdit ? '编辑成功。' : '发表成功。';
         $url = $isEdit ? 'refresh' : U('group/index/group', array('id' => $group_id));
         $this->success($message, $url);
     }
     $groupType = $this->assignGroupTypes();
     //分类信息内容
     foreach ($groupType['parent'] as $k => $v) {
         $child = $groupType['child'][$v['id']];
         //获取数组中第一父级的位置
         $key_name = array_search($v, $groupType['parent']);
         foreach ($child as $key => $val) {
             $val['title'] = '------' . $val['title'];
             //在父级后面添加数组
             array_splice($groupType['parent'], $key_name + 1, 0, array($val));
         }
     }
     $this->setMobTitle('创建群组');
     $this->setTopTitle('创建群组');
     $this->assign('groupTypeAll', $groupType['parent']);
     $this->display();
 }
Ejemplo n.º 4
0
 public function recommend()
 {
     $aPostId = I('get.post_id', 0, 'intval');
     $aTop = I('get.top', 1, 'intval');
     $aTop && ($aTop = 1);
     $group_id = $this->getGroupIdByPost($aPostId);
     $this->requirePostExists($aPostId);
     $this->checkAuth(null, get_group_admin($group_id), '您无置顶权限');
     $res = D('GroupPost')->where(array('id' => $aPostId, 'status' => 1))->setField('is_top', $aTop);
     if ($res) {
         S('group_post_' . $aPostId, null);
         $this->success('操作成功');
     } else {
         $this->error('操作失败');
     }
 }
Ejemplo n.º 5
0
 public function createGroup()
 {
     $aGroupId = I('post.group_id', 0, 'intval');
     $aGroupType = I('post.group_type', 0, 'intval');
     $aTitle = I('post.title', '', 'text');
     $aDetail = I('post.detail', '', 'text');
     $aLogo = I('post.logo', 0, 'intval');
     $aType = I('post.type', 0, 'intval');
     $aBackground = I('post.background', 0, 'intval');
     $aMemberAlias = I('post.member_alias', '成员', 'text');
     if (empty($aTitle)) {
         $this->error('请填写群组名称');
     }
     if (utf8_strlen($aTitle) > 20) {
         $this->error('群组名称最多20个字');
     }
     if ($aGroupType == -1) {
         $this->error('请选择群组分类');
     }
     if (empty($aDetail)) {
         $this->error('请填写群组介绍');
     }
     $isEdit = $aGroupId ? true : false;
     if ($isEdit) {
         $this->requireLogin();
         $this->requireGroupExists($aGroupId);
         $this->checkActionLimit('edit_group', 'Group', $aGroupId, is_login(), true);
         $this->checkAuth('Group/Index/editGroup', get_group_admin($aGroupId), '您无编辑群组权限');
     } else {
         $this->checkActionLimit('add_group', 'Group', 0, is_login(), true);
         $this->checkAuth('Group/Index/addGroup', -1, '您无添加群组权限');
     }
     $need_verify = modC('GROUP_NEED_VERIFY', 0, 'GROUP');
     $model = D('Group/Group');
     if ($isEdit) {
         $data = array('id' => $aGroupId, 'type_id' => $aGroupType, 'title' => $aTitle, 'detail' => $aDetail, 'logo' => $aLogo, 'type' => $aType, 'background' => $aBackground, 'member_alias' => $aMemberAlias);
         $data['status'] = $need_verify ? 0 : 1;
         $result = $model->editGroup($data);
         $group_id = $aGroupId;
     } else {
         $data = array('type_id' => $aGroupType, 'title' => $aTitle, 'detail' => $aDetail, 'logo' => $aLogo, 'type' => $aType, 'uid' => is_login(), 'background' => $aBackground, 'member_alias' => $aMemberAlias);
         $data['status'] = $need_verify ? 0 : 1;
         $result = $model->createGroup($data);
         if (!$result) {
             $this->error('创建群组失败:' . $model->getError());
         }
         $group_id = $result;
         //向GroupMember表添加创建者成员
         D('GroupMember')->addMember(array('uid' => is_login(), 'group_id' => $group_id, 'status' => 1, 'position' => 3));
     }
     if ($need_verify) {
         $message = '创建成功,请耐心等候管理员审核。';
         // 发送消息
         D('Message')->sendMessage(1, get_nickname(is_login()) . "创建了群组【{$aTitle}】,快去审核吧。", '群组创建审核', U('admin/group/unverify'), is_login());
         $this->success($message, U('group/index/index'));
     }
     // 发送微博
     if (D('Module')->checkInstalled('Weibo')) {
         $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Group/Index/group', array('id' => $group_id));
         if ($isEdit && check_is_in_config('edit_group', modC('GROUP_SEND_WEIBO', 'add_group,edit_group', 'GROUP'))) {
             D('Weibo')->addWeibo(is_login(), "我修改了群组【" . $aTitle . "】:" . $postUrl);
         }
         if (!$isEdit && check_is_in_config('add_group', modC('GROUP_SEND_WEIBO', 'add_group,edit_group', 'GROUP'))) {
             D('Weibo')->addWeibo(is_login(), "我创建了一个新的群组【" . $aTitle . "】:" . $postUrl);
         }
     }
     //显示成功消息
     $message = $isEdit ? '编辑成功。' : '发表成功。';
     $url = $isEdit ? 'refresh' : U('group/index/group', array('id' => $group_id));
     $this->success($message, $url);
 }