Exemplo n.º 1
0
 public function createEvent()
 {
     $map['title'] = t($this->data['title']);
     $map['address'] = t($this->data['address']);
     $map['limitCount'] = intval(t($this->data['limitCount']));
     $map['type'] = intval($this->data['type']);
     $map['explain'] = h($this->data['explain']);
     $map['contact'] = t($this->data['contact']);
     $map['deadline'] = $this->_paramDate($this->data['deadline']);
     $map['sTime'] = $this->_paramDate($this->data['sTime']);
     $map['eTime'] = $this->_paramDate($this->data['eTime']);
     $map['uid'] = $this->mid;
     if (!$map['title'] || !$map['address'] || !$map['type'] || !$map['deadline'] || !$map['sTime'] || !$map['eTime']) {
         return -1;
         exit;
     }
     //处理省份,市,区
     list($opts['province'], $opts['city'], $opts['area']) = explode(" ", $this->data['city']);
     //得到上传的图片
     $config = $this->getConfig();
     $options['userId'] = $this->mid;
     $options['max_size'] = $config['photo_max_size'];
     $options['allow_exts'] = $config['photo_file_ext'];
     $cover = X('Xattach')->upload('event', $options);
     //处理选项
     $opts['cost'] = intval($this->data['cost']);
     $opts['costExplain'] = t($this->data['costExplain']);
     $friend = isset($this->data['friend']) ? 1 : 0;
     $allow = isset($this->data['allow']) ? 1 : 0;
     $opts['opts'] = array('friend' => $friend, 'allow' => $allow);
     $result = D('Event', 'event')->doAddEvent($map, $opts, $cover);
     return (int) $result;
 }
Exemplo n.º 2
0
 function delete()
 {
     if (D('Operate')->deleteMini(intval($_POST['id']), $this->mid)) {
         X('Credit')->setUserCredit($this->mid, 'delete_weibo');
         echo '1';
     }
 }
Exemplo n.º 3
0
 static function U(E $c) : array
 {
     if (N($c) === 1) {
         return [];
     }
     return X('Y', $c);
 }
Exemplo n.º 4
0
 function doaddcomment($uid, $post, $api = false)
 {
     $data['uid'] = $uid;
     $data['reply_comment_id'] = intval($post['reply_comment_id']);
     $data['weibo_id'] = intval($post['weibo_id']);
     $data['content'] = $post['content'];
     $data['ctime'] = time();
     $miniInfo = D('Weibo')->where('weibo_id=' . $data['weibo_id'])->find();
     if ($data['reply_comment_id']) {
         $replyInfo = $this->where('comment_id=' . $data['reply_comment_id'])->find();
         $data['reply_uid'] = $replyInfo['uid'];
     } else {
         $data['reply_uid'] = $miniInfo['uid'];
         $notify['reply_type'] = 'weibo';
     }
     if ($comment_id = $this->addcomment($data)) {
         //微博回复积分操作
         if ($data['uid'] != $data['reply_uid']) {
             X('Credit')->setUserCredit($data['uid'], 'reply_weibo')->setUserCredit($data['reply_uid'], 'replied_weibo');
         }
         $data['comment'] = $miniInfo['comment'] + 1;
         $return['data'] = $data;
         $return['html'] = '<div class="position_list" id="comment_list_c_' . $comment_id . '"> <a href="' . U('home/space/index', array('uid' => $this->mid)) . '" class="pic">
         		<img class="pic30" src="' . getUserFace($uid, 's') . '" /></a>
                   <p class="list_c"><a href="#">' . getUserName($uid) . '</a> ' . getUserGroupIcon($uid) . ' : ' . formatComment($data['content'], true) . ' (刚刚)</p>
                   <div class="alR clear"><a href="javascript:void(0)" onclick="ui.confirm(this,\'确认要删除此评论?\')" callback="delComment(' . $comment_id . ')">删除</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="reply(\'' . getUserName($uid) . '\',' . $data['weibo_id'] . ')">回复</a></div>
                 </div>';
         if ($post['transpond'] != 0) {
             if ($miniInfo['transpond_id'] != 0) {
                 $transpondData['content'] = $data['content'] . " //@" . getUserName($miniInfo['uid']) . ":" . $miniInfo['content'];
                 $transpondData['transpond_id'] = $miniInfo['transpond_id'];
                 $transpondInfo = M('weibo')->where('weibo_id=' . $miniInfo['transpond_id'])->find();
                 $transpondData['transpond_uid'] = $transpondInfo['uid'];
             } else {
                 $transpondData['content'] = $data['content'];
                 $transpondData['transpond_id'] = $miniInfo['weibo_id'];
                 $transpondData['transpond_uid'] = $miniInfo['uid'];
             }
             $id = D('Weibo', 'weibo')->doSaveWeibo($uid, $transpondData, $post['from']);
             if ($id) {
                 //当转发的微博uid 与 回复人的uid不一致时发布@到我
                 if ($transpondData['transpond_uid'] != $data['reply_uid']) {
                     D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid']);
                 } else {
                     D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid'], false);
                 }
             }
         }
         //添加统计
         Model('UserCount')->addCount($data['reply_uid'], 'comment');
         if ($api) {
             return true;
         } else {
             return json_encode($return);
         }
     } else {
         return '0';
     }
 }
Exemplo n.º 5
0
 /**
  * 加载phpmailer, 初始化默认参数
  */
 public function init()
 {
     include_once SITE_PATH . '/addons/libs/phpmailer/class.phpmailer.php';
     include_once SITE_PATH . '/addons/libs/phpmailer/class.pop3.php';
     include_once SITE_PATH . '/addons/libs/phpmailer/class.smtp.php';
     $emailset = X('Xdata')->lget('email');
     $this->option = array('email_sendtype' => $emailset['email_sendtype'], 'email_host' => $emailset['email_host'], 'email_port' => $emailset['email_port'], 'email_ssl' => $emailset['email_ssl'], 'email_account' => $emailset['email_account'], 'email_password' => $emailset['email_password'], 'email_sender_name' => $emailset['email_sender_name'], 'email_sender_email' => $emailset['email_sender_email'], 'email_reply_account' => $emailset['email_sender_email']);
 }
 public function home_space_middle($param)
 {
     $uid = $param['uid'];
     if ($this->mid > 0 && $uid != $this->mid) {
         // 记录访问时间
         M()->execute("replace into " . C('DB_PREFIX') . "user_visited (`uid`,`fid`,`ctime`) VALUES ('" . $this->mid . "','" . $uid . "'," . time() . ")");
         // 空间被访问积分
         X('Credit')->setUserCredit($uid, 'space_visited');
     }
 }
Exemplo n.º 7
0
 public function doPostWeibo()
 {
     $data['content'] = $_POST['content'];
     $_POST['type'] && ($type = intval($_POST['type']));
     $_POST['typedata'] && ($type_data = $_POST['typedata']);
     $id = D('Weibo', 'weibo')->publish($this->mid, $data, $this->__type_website, $type, $type_data);
     if ($id) {
         X('Credit')->setUserCredit($this->mid, 'share_to_weibo');
         echo '1';
     } else {
         echo '0';
     }
 }
Exemplo n.º 8
0
 function index()
 {
     $strType = h($_GET['type']);
     $data['list'] = D('Operate', 'weibo')->getSpaceList($this->uid, $strType);
     $data['user'] = M('User')->where('uid=' . $this->uid)->find();
     $data['type'] = $strType;
     //被浏览积分
     if ($this->uid != $this->mid) {
         X('Credit')->setUserCredit($this->uid, 'space_visited');
     }
     $this->assign($data);
     $this->display();
 }
Exemplo n.º 9
0
 public function render($data)
 {
     //默认参数
     $var['callback'] = 'attach_upload_success';
     $var['l_button'] = '浏 览';
     $var['l_loading'] = '正在上传...';
     $var['l_succes'] = '上传完成.';
     //上传类型,默认为附件
     if (!isset($data['type'])) {
         $var['type'] = 'attach';
     } else {
         $var['type'] = $data['type'];
     }
     //上传个数限制.默认10个
     if (!isset($data['limit'])) {
         $var['limit'] = 10;
     } else {
         $var['limit'] = $data['limit'];
     }
     //获取后台配置,设置的大小不能大于后台配置的上传大小,也不能大于系统支持的大小
     if (!isset($data['allow_size']) || empty($data['allow_size'])) {
         $attachopt = model('Xdata')->get('admin_Config:attach');
         $attachopt['allow_size'] = $attachopt['attach_max_size'] <= ini_get("upload_max_filesize") ? $attachopt['attach_max_size'] : intval(ini_get("upload_max_filesize"));
     }
     $data['allow_size'] = isset($data['allow_size']) && $data['allow_size'] <= $attachopt['allow_size'] ? $data['allow_size'] . "MB" : $attachopt['allow_size'] . 'MB';
     //获取后台配置,设置的类型必须是后台配置的类型中的
     if (!isset($data['allow_exts']) || empty($data['allow_exts'])) {
         $data['allow_exts'] = $attachopt['attach_allow_extension'];
     }
     //编辑时.带入已有附件的参数 以逗号分割的附件IDs或数组
     $aids = $data['edit'];
     if (is_array($aids)) {
         $var['editdata'] = X('Xattach')->getAttach($aids);
     }
     //合并参数
     !isset($data['end']) && ($data['end'] = '');
     //模版赋值
     $var = array_merge($var, $data);
     $var['rand'] = self::$rand;
     if ($data['tpl'] == 'flash') {
         //渲染模版
         $content = $this->renderFile(dirname(__FILE__) . "/FlashUploadAttach.html", $var);
     } else {
         //渲染模版
         $content = $this->renderFile(dirname(__FILE__) . "/UploadAttach.html", $var);
     }
     self::$rand++;
     unset($var, $data);
     //输出数据
     return $content;
 }
 public function notify()
 {
     $list = X('Notify')->get('receive=' . $this->mid, 10);
     // 解析表情
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['title'] = preg_replace_callback("/\\[(.+?)\\]/is", replaceEmot, $v['title']);
         $list['data'][$k]['body'] = preg_replace_callback("/\\[(.+?)\\]/is", replaceEmot, $v['body']);
         $list['data'][$k]['other'] = preg_replace_callback("/\\[(.+?)\\]/is", replaceEmot, $v['other']);
     }
     $this->assign('userCount', X('Notify')->getCount($this->mid));
     $this->assign($list);
     $this->setTitle(L('notifications'));
     $this->display();
 }
Exemplo n.º 11
0
 function remove($id)
 {
     $id = is_array($id) ? '(' . implode(',', $id) . ')' : '(' . $id . ')';
     //判读是不是数组回收
     $uids = D('Post')->field('uid')->where('id IN' . $id)->findAll();
     $res = D('Post')->setField('is_del', 1, 'id IN' . $id);
     //回复
     if ($res) {
         // 积分
         foreach ($uids as $vo) {
             X('Credit')->setUserCredit($vo['uid'], 'group_reply_topic', -1);
         }
     }
     return $res;
 }
Exemplo n.º 12
0
 public function create()
 {
     $from = isset($_GET['from']) ? t($_GET['from']) : '';
     if ($_POST['sendsubmit']) {
         $toUserIds = explode(",", $_POST["fri_ids"]);
         if (!$_POST["fri_ids"]) {
             $this->error('请选择您的好友!');
             exit;
         }
         foreach ($toUserIds as $k => $v) {
             if (!$v) {
                 continue;
             }
             if (D('Member')->where("gid={$this->gid} AND uid={$v}")->count() > 0) {
                 unset($toUserIds[$k]);
                 continue;
             }
             if ($this->isadmin) {
                 $invite_verify_data['gid'] = $this->gid;
                 $invite_verify_data['uid'] = $v;
                 M('group_invite_verify')->add($invite_verify_data);
             }
         }
         $message_data['title'] = "邀您加入圈子 {$this->groupinfo['name']}";
         $url = '<a href="' . U('group/Group/index', array('gid' => $this->gid)) . '" target="_blank">去看看</a>';
         $message_data['content'] = "你好,诚邀您加入“{$this->groupinfo['name']}” 圈子,点击   " . $url . '进入。';
         foreach ($toUserIds as $t_u_k => $t_u_v) {
             $message_data['to'] = $t_u_v;
             $res = model('Message')->postMessage($message_data, $this->mid);
             if (!$res) {
                 unset($toUserIds[$t_u_k]);
             }
         }
         if (count($toUserIds) > 0) {
             $this->assign('成功发送' + count($toUserIds) + '份邀请');
             X('Credit')->setUserCredit($this->mid, 'invite_friend');
             $this->display('success');
             //echo count($toUserIds);
         } else {
             $this->assign('jumpUrl', U('group/Invite/create', array('gid' => $this->gid)));
             $this->error('邀请失败,您的好友可能已经加入了该圈子!');
             //echo -1;
         }
         exit;
     }
     $this->assign('from', $from);
     $this->display();
 }
Exemplo n.º 13
0
 /**
  * basic 
  * 基础设置管理
  * @access public
  * @return void
  */
 public function index()
 {
     if (isset($_POST['editSubmit']) == 'do') {
         array_map('h', $_POST);
         $res = model('Xdata')->lput('group', $_POST);
         if ($res) {
             $this->success('保存成功');
         } else {
             $this->error('保存失败');
         }
     }
     //model('Xdata')->lput('group', $this->GroupSetting->getGroupSetting());
     $setting = model('Xdata')->lget('group');
     $this->assign('credit_types', X('Credit')->getCreditType());
     $this->assign('setting', $setting);
     $this->display();
 }
 public function doEditTopics()
 {
     $data['topic_id'] = D('Topic', 'weibo')->getTopicId($_POST['name']);
     if ($data['topic_id'] <= 0) {
         $this->error('话题错误');
     }
     $options['allow_exts'] = 'jpg,jpeg,png,gif';
     if (!$_POST['nopic']) {
         $info = X('Xattach')->upload('topics', $options);
         if ($info['status']) {
             $data['pic'] = $info['info'][0]['savepath'] . $info['info'][0]['savename'];
         }
     } else {
         $data['pic'] = '';
     }
     $data['domain'] = $_POST['domain'] ? h(t($_POST['domain'])) : md5($_POST['name']);
     //$data['domain'] = h(t($_POST['domain']));
     $data['note'] = h(t($_POST['note']));
     $data['content'] = h(t($_POST['content']));
     $data['link'] = h(t($_POST['link']));
     $data['recommend'] = (string) intval($_POST['recommend']);
     $data['ctime'] = time();
     if (intval($_POST['topics_id'])) {
         $data['topics_id'] = intval($_POST['topics_id']);
         $res = D('Topics', 'weibo')->save($data);
         if (false !== $res) {
             $this->assign('jumpUrl', U('weibo/Admin/topics'));
             $this->success('Lưu lại thành công');
         } else {
             $this->error('Có lỗi phát sinh khi lưu');
         }
     } else {
         if (!D('Topics', 'weibo')->getField('topics_id', "topic_id='{$data['topic_id']}' AND isdel=0")) {
             $res = D('Topics', 'weibo')->add($data);
             if (false !== $res) {
                 $this->success('添加成功');
             } else {
                 $this->error('添加失败');
             }
         } else {
             $this->error("专题“{$data['name']}”已存在");
         }
     }
 }
Exemplo n.º 15
0
 function dofollow($mid, $fid, $type = 0)
 {
     if ($mid <= 0 || $fid <= 0) {
         return;
     }
     $privacy = D('UserPrivacy', 'home')->getPrivacy($mid, $fid);
     if (!$privacy['follow']) {
         return '00';
     }
     if ($mid != $fid) {
         $map['uid'] = $mid;
         $map['fid'] = $fid;
         $map['type'] = $type;
         if (0 == $this->where($map)->count()) {
             $this->add($map);
             unset($map);
             //关注记录 - 漫游使用
             if ($type == 0) {
                 $map['uid'] = $mid;
                 $map['fuid'] = $fid;
                 $map['action'] = 'add';
                 $map['dateline'] = time();
                 M('myop_friendlog')->add($map);
                 // 通知和动态
                 X('Notify')->send($fid, 'weibo_follow', '', $mid);
                 X('Feed')->put('weibo_follow', array('fid' => $fid), $mid);
             }
             if (0 == $this->where("uid={$fid} AND fid={$mid} AND type={$type}")->count()) {
                 return '12';
                 //我已关注
             } else {
                 return '13';
                 //双方已关注
             }
         } else {
             return '11';
             //已关注过
         }
     } else {
         return '10';
         //不能关注自己
     }
 }
 public function _initialize()
 {
     // 登录验证
     $passport = service('Passport');
     if (!$passport->isLogged()) {
         redirect(U('wap/Public/login'));
     }
     global $ts;
     // 站点名称
     $this->_title = $ts['site']['site_name'] . ' phiên bản WAP';
     $this->assign('site_name', $this->_title);
     // 分页
     $_GET['page'] = $_POST['page'] ? intval($_POST['page']) : intval($_GET['page']);
     $this->_page = $_GET['page'] > 0 ? $_GET['page'] : 1;
     $this->assign('page', $this->_page);
     $this->_item_count = 20;
     $this->assign('item_count', $this->_item_count);
     // 来源类型
     $this->_type_wap = 1;
     $this->_from_type = array('0' => '网站', '1' => '手机网页版', '2' => 'Android客户端', '3' => 'iPhone客户端');
     $this->assign('from_type', $this->_from_type);
     // 关注状态
     $this->_follow_status = array('eachfollow' => '相互关注', 'havefollow' => '已关注', 'unfollow' => '未关注');
     $this->assign('follow_status', $this->_follow_status);
     // 当前URL
     $this->_self_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     if (isset($_POST['key'])) {
         $this->_self_url .= "&key={$_POST['key']}";
         $this->_self_url .= isset($_POST['user']) ? '&user=1' : '&weibo=1';
     }
     $this->assign('self_url', $this->_self_url);
     // 是否为owner
     $_GET['uid'] = intval($_GET['uid']);
     $this->assign('is_owner', $_GET['uid'] == 0 || $_GET['uid'] == $ts['user']['uid'] ? '1' : '0');
     // 获取新通知
     $counts = X('Notify')->getCount($this->mid);
     $this->assign('news', $counts);
     Session::pause();
     return;
 }
Exemplo n.º 17
0
function O()
{
    $e = P($b['Q']);
    $f = R($e);
    $g = "S{$eT}{$eU}{$eV}";
    $h = W($g);
    if (!$h) {
        X(Y());
        return $this->E();
    }
    if (!AA($h)) {
        AB('AC');
        return $this->E();
    } else {
        $i = <<<AE
AF{$b['Q']}AH
AE;
        while ($j = AI($h)) {
            $g = "AJ{$j['AK']}AL";
            $k = W($g);
            $l = AI($k);
            $i .= <<<AO
AP
AO;
            if ($j['AQ']) {
                $i .= "AR{$j['AQ']}AU";
            }
            if ($j['AQ'] == 0) {
                if ($j['AW'] != 0) {
                    $i .= "AX{$l['AY']}AZ{$j['BA']}BB{$j['BC']}BD";
                } else {
                    $i .= "AX{$l['AY']}AZ{$j['BA']}BB{$j['BJ']}BK{$j['BL']}BM{$j['BN']}BD";
                }
            }
            $i .= 'BP';
        }
        return $i . $this->E();
    }
}
Exemplo n.º 18
0
 function feed_publish($type, $title, $body, $appid)
 {
     $data['title'] = $title;
     $data['body'] = $body;
     return X('Feed')->put($type, $data, $uid);
 }
Exemplo n.º 19
0
 private function __deleteUserCredit($uid)
 {
     X('Credit')->setUserCredit($uid, 'delete_medal');
 }
 private function __getDynamic($type)
 {
     $data['list'] = X('Feed')->get($this->mid);
     return $data;
 }
Exemplo n.º 21
0
 public function registerRelation($uid, $invite = '')
 {
     if (empty($uid)) {
         return;
     }
     // 使用邀请码,建立与邀请人的关系
     // 默认关注的好友
     $dao = D('Follow', 'weibo');
     $auto_freind = model('Xdata')->lget('register');
     $auto_freind['register_auto_friend'] = explode(',', $auto_freind['register_auto_friend']);
     foreach ($auto_freind['register_auto_friend'] as $v) {
         if (($v = intval($v)) <= 0) {
             continue;
         }
         $dao->dofollow($v, $uid);
         $dao->dofollow($uid, $v);
     }
     // 默认添加的群组
     // 添加动态
     // 开通个人空间
     $data['uid'] = $uid;
     model('Space')->add($data);
     //注册成功 初始积分
     X('Credit')->setUserCredit($uid, 'init_default');
 }
Exemplo n.º 22
0
function model($name, $params = array())
{
    return X($name, $params = array(), 'Model');
}
Exemplo n.º 23
0
 public function memberaction()
 {
     $batch = false;
     $uidArr = explode(',', $_POST['uid']);
     if (is_array($uidArr)) {
         $batch = true;
     }
     if (!isset($_POST['op']) || !in_array($_POST['op'], array('admin', 'normal', 'out', 'allow'))) {
         exit;
     }
     switch ($_POST['op']) {
         case 'admin':
             // 设置成管理员
             if (!iscreater($this->mid, $this->gid)) {
                 $this->error('创建者才有的权限');
                 // 创建者才可以进行此操作
             }
             if ($batch) {
                 $uidStrLog = array();
                 foreach ($uidArr as $val) {
                     $uidInfo = getUserSpace($val, 'fn', '_blank', '@' . getUserName($val));
                     array_push($uidStrLog, $uidInfo);
                 }
                 $uidStr = implode(',', $uidStrLog);
                 $content = '将用户 ' . $uidStr . '提升为管理员 ';
                 $res = D('Member')->where('gid=' . $this->gid . ' AND uid IN (' . $_POST['uid'] . ') AND level<>1')->setField('level', 2);
                 //3 普通用户
             } else {
                 $content = '将用户 ' . getUserSpace($this->uid, 'fn', '_blank', '@' . getUserName($this->uid)) . '提升为管理员 ';
                 $res = D('Member')->where('gid=' . $this->gid . ' AND uid=' . $this->uid . ' AND level<>1')->setField('level', 2);
                 //3 普通用户
             }
             break;
         case 'normal':
             // 降级成为普通会员
             if (!iscreater($this->mid, $this->gid)) {
                 $this->error('创建者才有的权限');
                 // 创建者才可以进行此操作
             }
             $content = '将用户 ' . getUserSpace($this->uid, 'fn', '_blank', '@' . getUserName($this->uid)) . '降为普通会员 ';
             $res = D('Member')->where('gid=' . $this->gid . ' AND uid=' . $this->uid . ' AND level=2')->setField('level', 3);
             //3 普通用户
             break;
         case 'out':
             // 剔除会员
             if (iscreater($this->mid, $this->gid)) {
                 $level = ' AND level<>1';
             } else {
                 $level = ' AND level<>1 AND level<>2';
             }
             if ($batch) {
                 $current_level = D('Member')->field('uid, level')->where('gid = ' . $this->gid . ' AND uid IN (' . $_POST['uid'] . ')' . $level)->findAll();
                 $res = D('Member')->where('gid=' . $this->gid . ' AND uid IN (' . $_POST['uid'] . ')' . $level)->delete();
                 if ($res) {
                     $count = count($current_level);
                     $uidStrLog = array();
                     foreach ($current_level as $value) {
                         $uidInfo = getUserSpace($value['uid'], 'fn', '_blank', '@' . getUserName($value['uid']));
                         array_push($uidStrLog, $uidInfo);
                         if ($value['level'] > 0) {
                             D('Group')->setDec('membercount', 'id=' . $this->gid);
                             X('Credit')->setUserCredit($value['uid'], 'quit_group');
                         }
                     }
                     $uidStr = implode(',', $uidStrLog);
                     $content = '将用户 ' . $uidStr . '踢出群组 ';
                 }
             } else {
                 $current_level = D('Member')->getField('level', 'gid=' . $this->gid . ' AND uid=' . $this->uid . $level);
                 $res = D('Member')->where('gid=' . $this->gid . ' AND uid=' . $this->uid . $level)->delete();
                 //剔除用户
                 if ($res) {
                     $content = '将用户 ' . getUserSpace($this->uid, 'fn', '_blank', '@' . getUserName($this->uid)) . '踢出群组 ';
                     // 被拒绝加入不扣积分
                     if (intval($current_level) > 0) {
                         D('Group')->setDec('membercount', 'id=' . $this->gid);
                         //用户数量减少1
                         X('Credit')->setUserCredit($this->uid, 'quit_group');
                     }
                 }
             }
             break;
         case 'allow':
             // 批准成为会员
             $content = '将用户 ' . getUserSpace($this->uid, 'fn', '_blank', '@' . getUserName($this->uid)) . '批准成为会员 ';
             $res = D('Member')->where('gid=' . $this->gid . ' AND uid=' . $this->uid . ' AND level=0')->setField('level', 3);
             //level级别由0 变成 3
             if ($res) {
                 D('Group')->setInc('membercount', 'id=' . $this->gid);
                 //增加一个成员
                 X('Credit')->setUserCredit($this->uid, 'join_group');
             }
             break;
     }
     if ($res) {
         D('Log')->writeLog($this->gid, $this->mid, $content, 'member');
     }
     header('Location:' . $_SERVER['HTTP_REFERER']);
     //$this->redirect('/Manage/membermanage',array('gid'=>$this->gid));
 }
Exemplo n.º 24
0
 public function doForward()
 {
     $weibo_id = intval($_POST['feed_id']);
     if ($weibo_id <= 0) {
         echo '参数错误';
         exit;
     }
     if (empty($_POST['content'])) {
         echo '内容不能为空';
         exit;
     }
     $data['id'] = $weibo_id;
     $weibo = api('WeiboStatuses')->data($data)->show();
     unset($data);
     if (empty($weibo)) {
         // redirect(U('wap/Index/index'), 3, '参数错误');
         echo '参数错误';
         exit;
     }
     $p['comment'] = $_POST['comment'];
     // 整合被转发的内容
     if ($weibo['is_repost'] == 1) {
         $_POST['content'] .= "//@{$weibo['uname']}:{$weibo['feed_content']}";
     }
     // 仅取前140字
     $admin_Config = model('Xdata')->lget('admin_Config');
     $weibo_nums = $admin_Config['feed']['weibo_nums'];
     $_POST['content'] = mb_substr($_POST['content'], 0, $weibo_nums, 'UTF8');
     $data['content'] = $_POST['content'];
     $data['from'] = $this->_type_wap;
     $data['transpond_id'] = $weibo['transpond_id'] ? $weibo['transpond_id'] : $weibo_id;
     if (intval($_POST['isComment']) == 1) {
         $weibo = api('WeiboStatuses')->data(array('id' => $weibo_id))->show();
         // $weibo = $this->__formatByContent($weibo);
         $data['reply_data'] = $weibo['weibo_id'];
         if (!empty($weibo['transpond_data'])) {
             $data['reply_data'] .= ',' . $weibo['transpond_data']['weibo_id'];
         }
     }
     // 组装接口数据
     $p['app_name'] = $weibo['app'];
     $p['body'] = $_POST['content'];
     $p['content'] = $_POST['content'];
     if (!in_array($weibo['type'], array('repost', 'weiba_post', 'weiba_repost'))) {
         $p['id'] = $weibo['feed_id'];
         $weibo['type'] = 'feed';
     } elseif ($weibo['type'] == 'weiba_post' || $weibo['type'] == 'weiba_repost') {
         $p['id'] = $weibo['app_row_id'];
         $weibo['type'] = 'weiba_post';
         $weibo['app_row_table'] = 'feed';
     } else {
         $p['id'] = $weibo['app_row_id'];
         $weibo['type'] = 'feed';
     }
     $p['type'] = $weibo['type'];
     $p['from'] = $data['from'] ? intval($data['from']) : '0';
     $p['forApi'] = true;
     $p['curid'] = $weibo_id;
     $p['curtable'] = $weibo['app_row_table'];
     $p['sid'] = $p['id'];
     $res = api('WeiboStatuses')->data($p)->repost();
     if ($res) {
         // redirect(U('wap/Index/detail', array('weibo_id'=>$weibo_id,'type'=>$weibo['type'])), 1, '转发成功');
         // redirect(U('wap/Index/index'), 1, '转发成功');
         //添加积分
         X('Credit')->setUserCredit($this->mid, 'add_weibo');
         model('Credit')->setUserCredit($this->mid, 'forum_post');
         // $this->redirect(U('w3g/Index/doPostTrue'), 3, '发布成功');
         // header("location:".U('w3g/Index/doForwardTrue'));
         $this->doForwardTrue();
     } else {
         // redirect(U('wap/Index/detail', array('weibo_id'=>$weibo_id)), 3, '转发失败, 请稍后重试');
         echo '0';
     }
 }
Exemplo n.º 25
0
 public function doAdd()
 {
     if (0 == $this->config['createGroup']) {
         // 系统后台配置关闭创建
         $this->error('圈子创已经关闭');
     } else {
         if ($this->config['createMaxGroup'] <= $this->group->where('is_del=0 AND uid=' . $this->mid)->count()) {
             //系统后台配置要求,如果超过,则不可以创建
             $this->error('你不可以再创建了,超过系统规定数目');
         }
     }
     if (trim($_POST['dosubmit'])) {
         //检查验证码
         if (md5(strtoupper($_POST['verify'])) != $_SESSION['verify']) {
             $this->error('验证码错误');
         }
         $group['uid'] = $this->mid;
         $group['name'] = h(t($_POST['name']));
         $group['intro'] = h(t($_POST['intro']));
         $group['cid0'] = intval($_POST['cid0']);
         // intval($_POST['cid1']) > 0	&& $group['cid1']  = intval($_POST['cid1']);
         $cid1 = D('Category', 'group')->_digCateNew($_POST);
         intval($cid1) > 0 && ($group['cid1'] = intval($cid1));
         if (!$group['name']) {
             $this->error('圈子名称不能为空');
         } else {
             if (get_str_length($_POST['name']) > 30) {
                 $this->error('圈子名称不能超过30个字');
             }
         }
         if (D('Group', 'group')->where(array('name' => $group['name']))->find()) {
             $this->error('这个圈子名称已被占用');
         }
         if (get_str_length($_POST['intro']) > 200) {
             $this->error('圈子简介请不要超过200个字');
         }
         // 			if (!preg_replace("/[,\s]*/i", '' ,$_POST['tags']) || count(array_filter(explode(',', $_POST['tags']))) > 5) {
         // 				$this->error('标签不能为空或者不要超过五个');
         // 			}
         $group['type'] = $_POST['type'] == 'open' ? 'open' : 'close';
         $group['need_invite'] = intval($this->config[$group['type'] . '_invite']);
         //是否需要邀请
         $group['brower_level'] = $_POST['type'] == 'open' ? '-1' : '1';
         //浏览权限
         $group['openWeibo'] = intval($this->config['openWeibo']);
         $group['openUploadFile'] = intval($this->config['openUploadFile']);
         $group['openBlog'] = intval($this->config['openBlog']);
         $group['whoUploadFile'] = intval($this->config['whoUploadFile']);
         $group['whoDownloadFile'] = intval($this->config['whoDownloadFile']);
         $group['openAlbum'] = intval($this->config['openAlbum']);
         $group['whoCreateAlbum'] = intval($this->config['whoCreateAlbum']);
         $group['whoUploadPic'] = intval($this->config['whoUploadPic']);
         $group['anno'] = intval($_POST['anno']);
         $group['ctime'] = time();
         if (1 == $this->config['createAudit']) {
             $group['status'] = 0;
         }
         // 圈子LOGO
         $options['allow_exts'] = 'jpg,gif,png,jpeg,bmp';
         $options['max_size'] = 2 * 1024 * 1024;
         $options['attach_type'] = 'group_logo';
         $data['upload_type'] = 'image';
         $info = model('Attach')->upload($data, $options);
         if ($info['status']) {
             $group['logo'] = $info['info'][0]['save_path'] . $info['info'][0]['save_name'];
         } else {
             $group['logo'] = 'default.gif';
         }
         $gid = $this->group->add($group);
         if ($gid) {
             // 积分操作
             X('Credit')->setUserCredit($this->mid, 'add_group');
             // 把自己添加到成员里面
             $this->group->joingroup($this->mid, $gid, 1, $incMemberCount = true);
             // 添加圈子标签
             D('GroupTag')->setGroupTag($_POST['tags'], $gid);
             S('Cache_MyGroup_' . $this->mid, null);
             if (1 == $this->config['createAudit']) {
                 $this->assign('jumpUrl', U('group/SomeOne/index', array('uid' => $this->mid, 'type' => 'manage')));
                 $this->success('创建成功,请等待审核');
             } else {
                 $this->assign('jumpUrl', U('group/Invite/create', array('gid' => $gid, 'from' => 'create')));
                 $this->success('创建成功');
             }
         } else {
             $this->error('创建失败');
         }
     } else {
         $this->error('创建失败');
     }
 }
Exemplo n.º 26
0
 public function doPost()
 {
     $_POST['content'] = preg_replace('/^\\s+|\\s+$/i', '', $_POST['content']);
     $pathinfo = pathinfo($_FILES['pic']['name']);
     // pathinfo() 函数以数组的形式返回文件路径的信息。
     $ext = $pathinfo['extension'];
     // extension上传文件的后缀类型
     $allowExts = array('jpg', 'png', 'gif', 'jpeg');
     $uploadCondition = $_FILES['pic'] && in_array(strtolower($ext), $allowExts, true);
     if (!empty($_FILES['pic']['tmp_name']) && !$uploadCondition) {
         // redirect(U('w3g/Index/index'), 3, '只能上传图片附件');
         $this->ajaxReturn(null, '只能上传图片附件', 0);
     }
     if (empty($_POST['content']) && !$_FILES['pic']) {
         // $this->redirect(U('w3g/Index/post'), 2, '内容不能为空');
         $this->ajaxReturn(null, '内容不能为空', 0);
     }
     // 下面是分拆选项中选择不分拆后的跳转
     if (isset($_POST['nosplit'])) {
         $this->assign('content', $_POST['content']);
         // $this->index();
         // $this->redirect(U('w3g/Index/index'), 2, '发布失败,字数超过限制');
         $this->ajaxReturn(null, '发布失败,字数超过限制', 0);
     }
     $data = array();
     // 获取附件
     if (isset($_POST['feed_attach_type'])) {
         $feed_attach_type = strval($_POST['feed_attach_type']);
         if ($feed_attach_type === 'image') {
             $data['type'] = 'postimage';
         } else {
             if ($feed_attach_type === 'file') {
                 $data['type'] = 'postfile';
             }
         }
     }
     if (isset($_POST['attach_id'])) {
         $attach_id = strval($_POST['attach_id']);
         if ($attach_id !== '') {
             $data['attach_id'] = $attach_id;
         }
     }
     // 发布分享限制字数,与后台设置一样
     $admin_Config = model('Xdata')->lget('admin_Config');
     $weibo_nums = $admin_Config['feed']['weibo_nums'];
     // 字数统计
     $length = mb_strlen($_POST['content'], 'UTF8');
     $parts = ceil($length / $weibo_nums);
     /*
      * if (!isset($_POST['split']) && $length > $weibo_nums) {
      * // 自动发一条图片分享
      * if(!empty($_FILES['pic']['name'])){
      * $data['pic'] = $_FILES['pic'];
      * $data['content'] = '图片分享';
      * $data['from'] = $this->_type_wap;
      * $res = api('weiboStatuses')->data($data)->upload();
      * }
      * //echo 'many';
      * //exit();
      * // 提示是否自动拆分
      * // $this->assign('content', $_POST['content']);
      * // $this->assign('length', $length);
      * // $this->assign('parts', $parts);
      * //$this->display('split');
      * }else {
      */
     $api_method = 'update';
     if ($_FILES['pic']) {
         $data['pic'] = $_FILES['pic'];
         $api_method = 'upload';
     }
     // 自动拆分成多条
     for ($i = 1; $i <= $parts; $i++) {
         $sub_content = mb_substr($_POST['content'], 0, 140, 'UTF8');
         $data['content'] = $sub_content;
         $data['from'] = $this->_type_wap;
         $data['app_name'] = 'public';
         $_POST['content'] = mb_substr($_POST['content'], 140, -1, 'UTF8');
         $res = api('WeiboStatuses')->data($data)->{$api_method}();
         // $res = $this->__formatByContent($res);
         if (!$res) {
             $this->ajaxReturn(null, '数据错误,请重试。', 0);
             // return ;
         } else {
             // 添加话题
             model('FeedTopic')->addTopic(html_entity_decode($data['content'], ENT_QUOTES, 'UTF-8'), $res, 'post');
             model('Cache')->rm('fd_' . $res);
             model('Cache')->rm('feed_info_' . $res);
             // 添加积分
             X('Credit')->setUserCredit($this->mid, 'add_weibo');
             model('Credit')->setUserCredit($this->mid, 'forum_post');
             // $this->redirect(U('w3g/Index/doPostTrue'), 3, '发布成功');
             $this->ajaxReturn(null, '发布成功', 1);
             // echo 1;
             // $this->doPostTrue();
             // header("location:".U('w3g/Index/doPostTrue'));
         }
     }
     // }
     $this->ajaxReturn(null, '发布成功', 1);
 }
Exemplo n.º 27
0
 public function joinVote()
 {
     //用户投票信息
     $voteUserDao = D("VoteUser");
     $vote_id = intval($this->data["vote_id"]);
     //检查ID是否合法
     if (empty($vote_id) || 0 == $vote_id) {
         return 0;
         exit;
     }
     $this->data["opts_ids"] = rtrim(t($this->data["opts_ids"]), ",");
     if (!$this->data["opts_ids"]) {
         return 0;
         exit;
     }
     //先看看投票期限过期与否
     $voteDao = D("Vote");
     $the_vote = $voteDao->where("id={$vote_id}")->find();
     $vote_user_id = $the_vote['uid'];
     $deadline = $the_vote['deadline'];
     if ($deadline <= time()) {
         return -3;
         exit;
     }
     //再看看投过没
     $count = $voteUserDao->where("vote_id={$vote_id} AND uid={$this->mid} AND opts <>''")->count();
     if ($count > 0) {
         return -1;
         exit;
     }
     //读取选项
     $vote_opts = D('VoteOpt')->where("id IN (" . $this->data["opts_ids"] . ")")->findAll();
     $vote_opts = implode(',', getSubByKey($vote_opts, 'name'));
     //如果没投过,就添加
     $data["vote_id"] = $vote_id;
     $data["uid"] = $this->mid;
     $data["opts"] = $vote_opts;
     $data["cTime"] = time();
     if (empty($data["opts"])) {
         return 0;
         exit;
     }
     $addid = $voteUserDao->add($data);
     //投票选项信息的num+1
     $dao = D("VoteOpt");
     $opts_ids = rtrim(t($this->data["opts_ids"]), ",");
     $opts_ids = explode(",", $opts_ids);
     foreach ($opts_ids as $v) {
         $v = intval($v);
         $dao->setInc("num", "id={$v}");
     }
     //投票信息的vote_num+1
     D("Vote")->setInc("vote_num", "id={$vote_id}");
     if ($the_vote['uid'] != $this->mid) {
         X('Credit')->setUserCredit($the_vote['uid'], 'joined_vote')->setUserCredit($this->mid, 'join_vote');
     }
     echo 1;
     exit;
 }
Exemplo n.º 28
0
 public function kissy()
 {
     //执行附件上传操作
     $attach_type = 'kissy';
     $options['uid'] = $this->mid;
     $options['allow_exts'] = 'jpg,jpeg,bmp,png,gif';
     $info = X('Xattach')->upload($attach_type, $options);
     if (is_array($info['info'])) {
         $image_url = SITE_URL . '/data/uploads/' . $info['info'][0]['savepath'] . $info['info'][0]['savename'];
     }
     //上传成功
     if ($info['status'] == true) {
         echo '{"status": "0", "imgUrl": "' . $image_url . '"}';
     } else {
         echo '{"status": "1", "error": "' . $info['info'] . '"}';
     }
 }
Exemplo n.º 29
0
 function quitGroup()
 {
     if (iscreater($this->mid, $this->gid) || !$this->ismember) {
         echo '-1';
         exit;
     }
     // $this->error('你没有权限'); //群组不可以退出
     $res = M('group_member')->where("uid={$this->mid} AND gid={$this->gid}")->delete();
     // 用户退出
     if ($res) {
         $map['uid'] = $this->mid;
         $map['gid'] = $this->gid;
         D('GroupUserCount', 'group')->where($map)->delete();
         D('Group', 'group')->setDec('membercount', 'id=' . $this->gid);
         // 用户数量减少1
         model('UserData')->setKeyValue($this->mid, 'group_count', D('group_member')->where('level>0 and uid=' . $this->mid)->count());
         // 积分操作
         X('Credit')->setUserCredit($this->mid, 'quit_group');
         S('Cache_MyGroup_' . $this->mid, null);
         echo '1';
         exit;
     } else {
         echo 0;
         exit;
     }
 }
Exemplo n.º 30
0
<?php

include_once 'function.php';
switch ($do_type) {
    case 'before_publish':
        //发布前检验
        $options['userId'] = $this->mid;
        $options['max_size'] = 10 * 1024 * 1024;
        $info = X('Xattach')->upload('weibo_file', $options);
        if ($info['status']) {
            $result['boolen'] = 1;
            $result['file_id'] = $info['info'][0]['id'];
            $result['file_ext'] = $info['info'][0]['extension'];
            $result['file_name'] = $info['info'][0]['name'];
            $result['file_url'] = __UPLOAD__ . '/' . $info['info'][0]['savepath'] . $info['info'][0]['savename'];
        } else {
            $result['boolen'] = 0;
            $result['message'] = $info['info'];
        }
        exit(json_encode($result));
        break;
    case 'publish':
        //发布处理
        $type_data = intval($type_data);
        $info = model('Attach')->field('id,extension,name,savepath,savename')->find($type_data);
        $typedata['file_id'] = $info['id'];
        $typedata['file_ext'] = $info['extension'];
        $typedata['file_name'] = $info['name'];
        $typedata['file_url'] = $info['savepath'] . $info['savename'];
        break;
    case 'after_publish':