Пример #1
0
 /**
  * 取消关注
  */
 public function destroy()
 {
     include_once ROOT_PATH . 'lib/class/friendships.class.php';
     $id = $this->input['id'];
     $add_obj = new friendShips();
     $rets = $add_obj->destroy($id);
     $user_id = $this->user['id'];
     //当前用户ID
     $ret = $this->get_relation($user_id, $id);
     $info['relation'] = $ret;
     if ($rets && is_array($rets)) {
         $info['cid'] = $rets[0]['sid'];
     }
     echo json_encode($info);
 }
Пример #2
0
 /**
  * 获取两个用户的关系
  */
 private function get_relation($user_id, $id)
 {
     include_once ROOT_PATH . 'lib/class/friendships.class.php';
     $add_obj = new friendShips();
     $result = $add_obj->show($user_id, $id);
     return $result;
 }
Пример #3
0
 /**
  * 取消关注
  */
 public function destroy()
 {
     include_once ROOT_PATH . 'lib/class/friendships.class.php';
     $id = $this->input['id'];
     $add_obj = new friendShips();
     $add_obj->destroy($id);
     $user_id = $this->user['id'];
     //当前用户ID
     echo $this->get_relation($user_id, $id);
 }
Пример #4
0
 /**
  * 取消关注
  */
 public function delete()
 {
     include_once ROOT_PATH . 'lib/class/friendships.class.php';
     $user_id = $this->input['user_id'];
     //用户ID
     $id = $this->input['id'];
     //操作ID
     $add_obj = new friendShips();
     $result = $add_obj->destroy($id);
 }
Пример #5
0
 /**
  * 移除粉丝
  */
 public function move()
 {
     include_once ROOT_PATH . 'lib/class/friendships.class.php';
     $user_id = $this->input['id'];
     //粉丝ID
     $add_obj = new friendShips();
     $add_obj->move($user_id);
     if ($this->input['is_block'] == 1) {
         $this->addBlock($user_id);
     }
 }
Пример #6
0
 public function comment()
 {
     /*include_once(ROOT_DIR . 'lib/class/settings.class.php');
     		$setting = new settings();
     		$result_setttings = $setting->getMark('mblog_comment');
     		if(!empty($result_setttings) && $result_setttings['state'])
     		{
     			$this->errorOutput('评论已关闭');
     		}
     		*/
     if (!$this->user['user_id']) {
         $this->errorOutput(USENAME_NOLOGIN);
     }
     $id = $this->input['id'];
     $content = urldecode($this->input['content']);
     include_once ROOT_DIR . 'lib/class/banword.class.php';
     $banword = new banword();
     $status = 0;
     $banwords = $banword->banword(urlencode($content));
     if ($banwords && $banwords != 'null') {
         $status = 1;
         $banwords = implode(',', $banwords);
     } else {
         $banwords = '';
     }
     //此ID没有用处
     $cid = intval($this->input['cid']);
     $time = time();
     !$cid ? $and = '' : ($and = ' , reply_comment_id = ' . $cid);
     $sql = 'INSERT INTO ' . DB_PREFIX . 'status_comments SET status_id = ' . $id . ', flag = ' . $status . ',member_id = ' . $this->user['user_id'] . ',content = "' . $content . '",comment_time = "' . $time . '",ip = "' . hg_getip() . '"';
     $sql .= $and;
     $this->setXmlNode('comments', 'comment');
     /**
      * 获取该条点滴的用户ID
      */
     $user_id = $this->mStatus->getUserIdByStatusId($id);
     /**
      * 获取该用户的权限
      */
     $authority = $this->member->get_authority($user_id);
     //评论权限
     $comment_authority = intval($authority[18]);
     /**
      * 获取与该用户的关系
      */
     include_once ROOT_DIR . 'lib/class/friendships.class.php';
     $friendShips = new friendShips();
     $relation = $friendShips->show($this->user['user_id'], $user_id);
     //任何人可评论
     if ($comment_authority == 0) {
         $this->db->query($sql);
     }
     //关注的人可评论
     if ($comment_authority == 1) {
         //关注
         if ($relation == 3 || $relation == 1) {
             $this->db->query($sql);
         } else {
             $this->errorOutput(NO_AUTHORITY);
         }
     }
     //任何人不可评论
     if ($comment_authority == 2) {
         $this->errorOutput(NO_AUTHORITY);
     }
     //		$this->db->query($sql);
     $insert_id = $this->db->insert_id();
     $members = $this->member->getMemberById($this->user['user_id']);
     //评论者的信息数组
     $members = $members[0][$this->user['user_id']];
     //将点滴的评论次数加1
     $sql_str = 'UPDATE ' . DB_PREFIX . 'status_extra SET comment_count = comment_count + 1 WHERE status_id = ' . $id;
     $this->db->query($sql_str);
     $status_info = $this->mStatus->show($id);
     $return_array = array('id' => $insert_id, 'content' => $content, 'create_at' => $time, 'user' => $members, 'status' => $status_info[0]);
     $this->addItem($return_array);
     $this->output();
 }