public function _initialize()
 {
     $this->base();
     if (isset($_GET['gid']) && intval($_GET['gid']) > 0) {
         $this->gid = intval($_GET['gid']);
     } elseif (isset($_POST['gid']) && intval($_POST['gid']) > 0) {
         $this->gid = intval($_POST['gid']);
     } else {
         $this->error('gid 错误');
     }
     $groupinfo = D('Group')->where('id=' . $this->gid . " AND is_del=0")->find();
     if (!$groupinfo) {
         $this->error('该群组不存在,或者被删除');
     }
     //判读权限  成员权限
     if ($groupinfo['brower_level'] == 1 && !isJoinGroup($this->uid, $this->gid)) {
         $this->error('只有成员可见');
     } elseif ($groupinfo['brower_level'] == 0 && !$this->mid) {
         $this->error('登陆会员可见');
     }
     $this->groupinfo = $groupinfo;
     $this->assign('groupinfo', $groupinfo);
     $this->assign('gid', $this->gid);
     //记录访问时间
     D('Member')->where('gid=' . $this->gid . " AND uid={$this->mid}")->setField('mtime', time());
     //判读是否是管理员
     $this->isadmin = isadmin($this->mid, $this->gid);
     $this->assign('isadmin', $this->isadmin);
     $this->setTitle($this->groupinfo['name'] . '群-');
 }
 function createAlbum()
 {
     //判读权限
     //dump($this->config);
     if (!isJoinGroup($this->mid, $this->gid)) {
         $this->alert();
     }
     $this->display();
 }
 function add()
 {
     //权限判读 用户没有加入过
     if ($this->groupinfo['actor_level'] == 1 && !isJoinGroup($this->mid, $this->gid) || !$this->mid) {
         $this->alert();
     }
     $this->assign('smileList', $this->getSmile($this->opts['ico_type']));
     $this->assign('smilePath', $this->getSmilePath($this->opts['ico_type']));
     $this->setTitle($this->siteTitle['add_topic']);
     $this->display();
 }
Example #4
0
function checkPriv($op, $value, $mid, $gid)
{
    if ($op == 'invite') {
        //邀请
        if ($value == 0 && iscreater($mid, $gid)) {
            return true;
            //关闭邀请
        } elseif ($value == 1) {
            if (isadmin($mid, $gid)) {
                return true;
            }
            //管理者邀请
        } elseif ($value == 2) {
            if (isJoinGroup($mid, $gid)) {
                return true;
            }
        }
    }
    if ($op == 'review') {
        //审核
        if ($value == 0) {
            return true;
        }
        if ($value == 1) {
            if (isadmin($mid, $gid)) {
                return true;
            }
            //管理者审核
        }
    }
    if ($op == 'say') {
        //什么人可以发言
        if ($value == 1 && isJoinGroup($mid, $gid)) {
            return true;
        }
        //成员
        if ($value == 0) {
            return true;
        }
    }
    if ($op == 'browse') {
        //什么人可以浏览
        if ($value == -1) {
            return true;
        }
        if ($value == 1 && isJoinGroup($mid, $gid)) {
            return true;
        }
        if ($value == 0) {
            return true;
        }
    }
    return false;
}
 function upload()
 {
     if (!isJoinGroup($this->mid, $this->gid)) {
         $this->alert();
     }
     if ($this->groupinfo['whoUploadPic'] == 1 && !$this->isadmin) {
         $this->error('仅管理员可以上传图片');
     }
     $this->setTitle($this->siteTitle['upload_pic']);
     $this->display();
 }
 function download()
 {
     //权限判读 用户没有加入过
     if (!isJoinGroup($this->mid, $this->gid)) {
         $this->alert();
     }
     $fid = intval($_POST['fid']) > 0 ? intval($_POST['fid']) : 0;
     if ($fid == 0) {
         exit;
     }
     //下载函数
     import("ORG.Net.Http");
     //调用下载类
     $fileInfo = $this->dir->where('id=' . $fid . ' AND is_del=0')->find();
     if ($fileInfo['fileurl'] && file_exists('../../data/uploads/' . $fileInfo['fileurl'])) {
         $this->dir->setInc('totaldowns', 'id=' . $fid);
         //增加下载次数
         //header("content-type:text/html; charset=utf-8");
         //echo $fileInfo['name'];
         //exit;
         $fileInfo['name'] = iconv("utf-8", 'gb2312', $fileInfo['name']);
         Http::download('../../data/uploads/' . $fileInfo['fileurl'], $fileInfo['name']);
     }
     $this->error('文件不存在');
 }
 function quitgroup()
 {
     if (iscreater($this->mid, $this->gid) || !isJoinGroup($this->mid, $this->gid)) {
         echo '0';
         exit;
     }
     //$this->error('你没有权限'); //管理员不可以退出
     $ret = D('Member')->where("uid={$this->mid} AND gid={$this->gid}")->delete();
     //用户退出
     D('Group')->where("id=" . $this->gid)->setDec('membercount');
     //用户数量减少1
     if ($ret) {
         echo '1';
         exit;
     }
 }