Example #1
0
 function writeLog($gid, $uid, $content, $type = 'topic')
 {
     $map['gid'] = $gid;
     $map['uid'] = $uid;
     $map['type'] = $type;
     $map['content'] = getUserSpace($uid, 'fn', '_blank', '@' . getUserName($uid)) . ' ' . $content;
     $map['ctime'] = time();
     $this->add($map);
 }
Example #2
0
	function callback($module, $method, $params) {
		if(isset($params['uId'])) {
			$member = getUserSpace($params['uId']);
			if($this->_needCheckUserId($module, $method)) {
				if(!$member['uid']) {
					$errCode = 1;
					$errMessage = "User($params[uId]) Not Exists";
					return new APIErrorResponse($errCode, $errMessage);
				}
			}
		}
		$GLOBALS['discuz_uid'] = $member['uid'];
		$GLOBALS['discuz_user'] = $member['username'];

		@include_once DISCUZ_ROOT.'./manyou/api/class/'.$module.'.php';
		if(!class_exists($module)) {
			$errCode = 3;
			$errMessage = "Class($module) Not Exists";
			return new APIErrorResponse($errCode, $errMessage);
		}

		$class = new $module();
		$response = @call_user_func_array(array(&$class, $method), $params);

		return $response;
	}
 public function showSpaceCard()
 {
     $uid = intval($_GET['uid']);
     if ($uid) {
         $data = getUserInfo($uid);
         $usertags = D('UserTag')->getUserTagList($this->uid);
         foreach ($usertags as $v) {
             $tags[] = '<a href="' . U('home/User/searchtag', array('k' => $v['tag_name'])) . '">' . $v['tag_name'] . '</a>';
         }
         $data['location'] = getLocation($data['province'], $data['city']);
         if (!$data['location']) {
             $data['location'] = '<br />';
         }
         $data['tags'] = !$tags ? 'None' : implode(' ', $tags);
         $data['following_url'] = U('home/Space/follow', array('type' => 'following', 'uid' => $uid));
         $data['follower_url'] = U('home/Space/follow', array('type' => 'follower', 'uid' => $uid));
         $data['space_url'] = U('home/Space/index', array('uid' => $uid));
         $data['space_link'] = getUserSpace($uid, 'nocard', '_blank');
         $data['follow_state'] = $this->mid == $uid ? 'self' : D('Follow', 'weibo')->getState($this->mid, $uid, 0);
         $this->ajaxReturn($data, L('get_success'), 1);
     } else {
         $this->ajaxReturn('', L('get_success'), 0);
     }
 }
Example #4
0
/**
 * 根据用户昵称获取用户ID [格式化微博与格式化评论专用]
 *
 * @param array $name
 * @see format()
 * @see formatComment()
 */
function getUserId($name)
{
    $info = D('User', 'home')->getUserByIdentifier($name[1], 'uname');
    if ($info) {
        return getUserSpace($info['uid'], 'null', '_blank', "{$name['0']}", false);
    } else {
        return "<a href=" . U('home/user/searchuser', array('k' => urlencode($name[1]))) . " target=\"_blank\">" . $name[0] . "</a>";
    }
}
Example #5
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));
 }
 public function loadMoreShowTalk()
 {
     $type = t($_GET['type']);
     $id = intval($_GET['id']);
     $sinceId = intval($_GET['since_id']);
     $toUid = intval($_GET['to_uid']);
     $maxId = intval($_GET['max_id']);
     $status = 0;
     $sinceId = 0;
     $html = '';
     $count = 0;
     switch ($type) {
         case 'at':
         case 'com':
             $feed = model('Feed')->getFeedInfo($id);
             $cmap['app'] = $feed['app'];
             $cmap['table'] = 'feed';
             $cmap['row_id'] = $id;
             // $cmap['comment_id'] = array('ELT', $sinceId);
             $cmap['comment_id'] = array('EGT', $sinceId);
             $cmap['_string'] = '( (uid = ' . $this->mid . ' AND to_comment_id = 0) OR (uid = ' . $toUid . ' AND to_comment_id = 0) OR (uid = ' . $this->mid . ' AND to_uid = ' . $toUid . ') OR (uid = ' . $toUid . ' AND to_uid = ' . $this->mid . ') )';
             $list = model('Comment')->getCommentList($cmap, 'comment_id ASC', 10);
             if (!empty($list['data'])) {
                 $status = 1;
                 $sinceId = end($list['data']);
                 $sinceId = $sinceId['comment_id'] + 1;
                 foreach ($list['data'] as $vo) {
                     $html .= '<dl class="msg-dialog" model-node="comment_list">';
                     $class = $this->mid == $vo['uid'] ? 'right' : 'left';
                     $html .= '<dt class="' . $class . '">';
                     $html .= '<a target="_self" href="' . U('public/Profile/index', array('uid' => $vo['uid'])) . '"><img src="' . $vo['user_info']['avatar_tiny'] . '" /></a>';
                     $html .= '</dt>';
                     if ($class == 'right') {
                         $html .= '<dd class="dialog-r">';
                         $html .= '<i class="arrow-mes-r"></i>';
                     } else {
                         if ($class == 'left') {
                             $html .= '<dd class="dialog-l">';
                             $html .= '<i class="arrow-mes-l"></i>';
                         }
                     }
                     if ($vo['is_audit'] == 0 && $vo['uid'] != $this->mid) {
                         $content = '内容正在审核';
                     } else {
                         $content = str_replace('__THEME__', THEME_PUBLIC_URL, parse_html($vo['content']));
                     }
                     $html .= '<p class="info">' . getUserSpace($vo['user_info']['uid'], '', $vo['user_info']['uname']) . ':' . $content . '</p>';
                     $html .= '<p class="date">';
                     $html .= '<span class="right">';
                     if ($this->mid == $vo['uid'] && CheckPermission('core_normal', 'comment_del') || CheckPermission('core_admin', 'comment_del')) {
                         $style = '';
                         if ($vo['uid'] != $this->mid && CheckPermission('core_admin', 'comment_del')) {
                             $style = 'style="color:red;"';
                         }
                         $html .= '<a href="javascript:;" event-node="comment_del" event-args="comment_id=' . $vo['comment_id'] . '" ' . $style . '>' . L('PUBLIC_STREAM_DELETE') . '</a>';
                     }
                     if (($vo['uid'] == $mid && CheckPermission('core_normal', 'comment_del') || CheckPermission('core_admin', 'comment_del')) && CheckPermission('core_normal', 'feed_comment')) {
                         $html .= '<i class="vline">|</i>';
                     }
                     if (CheckPermission('core_normal', 'feed_comment')) {
                         $args = array();
                         $args[] = 'row_id=' . $vo['row_id'];
                         $args[] = 'app_uid=' . $vo['app_uid'];
                         $args[] = 'to_comment_id=' . $vo['comment_id'];
                         $args[] = 'to_uid=' . $vo['uid'];
                         $args[] = 'to_comment_uname=' . $vo['user_info']['uname'];
                         $args[] = 'app_name=public';
                         $args[] = 'table=feed';
                         $html .= '<a href="javascript:;" event-args="' . implode('&', $args) . '" event-node="reply_comment" >回复</a>';
                     }
                     $html .= '</span>' . friendlyDate($vo['ctime']) . '</p>';
                     $html .= '</dd>';
                     $html .= '</dl>';
                 }
             }
             break;
         case 'pmsg':
             $list = model('Message')->getMessageByListId($id, $this->mid, $sinceId, $maxId, 10);
             if (!empty($list['data'])) {
                 $status = 1;
                 $sinceId = $list['since_id'];
                 $maxId = $list['max_id'];
                 foreach ($list['data'] as $vo) {
                     $html .= '<dl class="msg-dialog" model-node="comment_list">';
                     $class = $this->mid == $vo['from_uid'] ? 'right' : 'left';
                     $html .= '<dt class="' . $class . '">';
                     $html .= '<a target="_self" href="' . U('public/Profile/index', array('uid' => $vo['from_uid'])) . '"><img src="' . $vo['user_info']['avatar_tiny'] . '" /></a>';
                     $html .= '</dt>';
                     if ($class == 'right') {
                         $html .= '<dd class="dialog-r">';
                         $html .= '<i class="arrow-mes-r"></i>';
                     } else {
                         if ($class == 'left') {
                             $html .= '<dd class="dialog-l">';
                             $html .= '<i class="arrow-mes-l"></i>';
                         }
                     }
                     $content = str_replace('__THEME__', THEME_PUBLIC_URL, parse_html($vo['content']));
                     $html .= '<p class="info mb5">' . getUserSpace($vo['user_info']['uid'], '', $vo['user_info']['uname']) . ':' . $content . '</p>';
                     if ($vo['attach_type'] == 'message_image') {
                         $html .= '<div class="feed_img_lists">';
                         $html .= '<ul class="small">';
                         foreach ($vo['attach_infos'] as $v) {
                             $html .= '<li class="left"><a><img src="' . getImageUrl($v['file'], 100, 100, true) . '" width="100" height="100" /></a></li>';
                         }
                         $html .= '</ul>';
                         $html .= '</div>';
                     } else {
                         if ($vo['attach_type'] == 'message_file') {
                             $html .= '<div class="input-content attach-file">';
                             $html .= '<ul class="feed_file_list">';
                             foreach ($vo['attach_infos'] as $v) {
                                 $html .= '<li><a href="' . U('widget/Upload/down', array('attach_id' => $v['attach_id'])) . '" class="current right" title="下载"><i class="ico-down"></i></a><i class="ico-' . $v['extension'] . '-small"></i><a href="' . U('widget/Upload/down', array('attach_id' => $v['attach_id'])) . '">' . $v['attach_name'] . '</a><span class="tips">(' . byte_format($v['size']) . ')</span></li>';
                             }
                             $html .= '</ul>';
                             $html .= '</div>';
                         }
                     }
                     $html .= '<p class="date">' . friendlyDate($vo['mtime']) . '</p>';
                     $html .= '</dd>';
                     $html .= '</dl>';
                 }
             }
             $count = $list['count'];
             break;
     }
     $result['status'] = $status;
     $result['since_id'] = $sinceId;
     $result['max_id'] = $maxId;
     $result['count'] = $count;
     $result['html'] = $html;
     exit(json_encode($result));
 }
 /**
  * 解析模板
  */
 private function _parseTemplate($i_data)
 {
     if (false == ($i_data['data'] = unserialize($i_data['data']))) {
         $i_data['data'] = unserialize(stripslashes($i_data['data']));
     }
     $replace["{actor}"] = getUserSpace($i_data['from'], 'fn', '_blank', '{uname}') . getUserGroupIcon($i_data['from']);
     if ($i_data) {
         extract($i_data['data'], EXTR_OVERWRITE);
     }
     unset($i_data['data']);
     extract($i_data, EXTR_OVERWRITE);
     $template_type = explode('_', $i_data['type']);
     $template = (require SITE_PATH . '/apps/' . $template_type[0] . '/Language/cn/notify.php');
     $return['title'] = str_replace(array_keys($replace), array_values($replace), $template[$i_data['type']]['title']);
     $return['body'] = str_replace(array_keys($replace), array_values($replace), $template[$i_data['type']]['body']);
     $return['other'] = str_replace(array_keys($replace), array_values($replace), $template[$i_data['type']]['other']);
     return $return;
 }
 public 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'] = t(getShort($post['content'], $GLOBALS['ts']['site']['length']));
     $data['ctime'] = time();
     $miniInfo = D('Weibo', 'weibo')->where('weibo_id=' . $data['weibo_id'] . ' AND isdel=0')->find();
     if ($data['reply_comment_id']) {
         $replyInfo = $this->where('comment_id=' . $data['reply_comment_id'] . ' AND isdel=0')->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">' . getUserSpace($uid, 'fn', '', '{uname}') . getUserGroupIcon($uid) . ' : ' . formatComment($data['content'], true) . ' (刚刚)</p>
                   <div class="alR clear"><a href="javascript:void(0)" onclick="ui.confirm(this,\'确认要删除此评论?\')" callback="delComment(' . $comment_id . ')">Xóa</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="reply(\'' . getUserName($uid) . '\',' . $data['weibo_id'] . ')">Trả lời</a></div>
                 </div>';
         if ($post['transpond'] != 0) {
             if ($miniInfo['transpond_id'] != 0) {
                 $transpondData['content'] = $data['content'] . ($data['reply_comment_id'] ? " //@" . getUserName($replyInfo['uid']) . " :" . $replyInfo['content'] : '') . " //@" . getUserName($miniInfo['uid']) . ":" . $miniInfo['content'];
                 $transpondData['transpond_id'] = $miniInfo['transpond_id'];
                 $transpondInfo = M('weibo')->where('weibo_id=' . $miniInfo['transpond_id'] . ' AND isdel=0')->find();
                 $transpondData['transpond_uid'] = $transpondInfo['uid'];
             } else {
                 $transpondData['content'] = $data['content'] . ($data['reply_comment_id'] ? " //@" . getUserName($replyInfo['uid']) . " :" . $replyInfo['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($uid, $id, $transpondData['content'], $transpondData['transpond_uid']);
                 } else {
                     D('Weibo', 'weibo')->notifyToAtme($uid, $id, $transpondData['content'], $transpondData['transpond_uid'], false);
                 }
             }
         }
         //添加统计
         if ($api) {
             if ($data['reply_uid'] != $miniInfo['uid']) {
                 Model('UserCount')->addCount($miniInfo['uid'], 'comment');
             }
         } else {
             Model('UserCount')->addCount($data['reply_uid'], 'comment');
             if ($data['reply_uid'] != $miniInfo['uid']) {
                 Model('UserCount')->addCount($miniInfo['uid'], 'comment');
             }
         }
         Addons::hook('weibo_comment_publish', array($comment_id, $data));
         if ($api) {
             return true;
         } else {
             return json_encode($return);
         }
     } else {
         return '0';
     }
 }
Example #9
0
 protected function _setOperationLog($operation, &$post_info)
 {
     $content = '把 ' . getUserSpace($post_info['uid'], 'fn', '_blank', '@' . getUserName($post_info['uid'])) . ' 的帖子“<a href="' . U('group/Topic/topic', array('gid' => $this->gid, 'tid' => $post_info['id'])) . '" target="_blank">' . $post_info['title'] . '</a>” ' . $operation;
     D('Log')->writeLog($this->gid, $this->mid, $content, 'topic');
     /*
     			//设置日志
     			if (!is_array($post_info[0])) {
     				$post_info[] = $post_info;
     			}
     			foreach ($post_info as $v) {
     				if (!$v['uid'] || !$v['title']) {
     					continue;
     				}
     				$content =  '把 ' . getUserSpace($v['uid'], 'fn', '_blank', '@' . getUserName($v['uid']))
     						 . ' 的帖子“<a href="' . U('group/Topic/topic', array('gid'=>$this->gid, 'tid'=>$v['id'])) . '" target="_blank">'
     						 . $v['title'] . '</a>” ' . $operation;
     				D('Log')->writeLog($this->gid, $this->mid, $content, 'topic');
     			}
     */
 }
 public function fetchNew()
 {
     $map['weibo_id'] = array('gt', intval($_POST['since_id']));
     $map['transpond_id'] = 0;
     $map['type'] = 0;
     $data = D('Operate', 'weibo')->doSearchTopic('`weibo_id` > ' . intval($_POST['since_id']) . ' AND transpond_id =0 AND `type` = 0', 'weibo_id DESC', 0, false);
     $res = $data['data'][0];
     if ($res) {
         $res['uname'] = getUserSpace($res['uid'], '', '_blank', '{uname}');
         $res['user_pic'] = getUserSpace($res['uid'], '', '_blank', '{uavatar=m}');
         $res['friendly_date'] = friendlyDate($res['ctime']);
         $res['content'] = format($res['content'], true);
         echo json_encode($res);
     } else {
         echo 0;
     }
 }
Example #11
0
 public function sendToWeibo()
 {
     $_REQUEST['with_new_weibo'] = intval($_REQUEST['with_new_weibo']);
     $_REQUEST['type'] = t($_REQUEST['type']);
     $_REQUEST['appid'] = intval($_REQUEST['appid']);
     $_REQUEST['comment'] = $_REQUEST['comment'];
     $_REQUEST['to_id'] = intval($_REQUEST['to_id']);
     $_REQUEST['author_uid'] = intval($_REQUEST['author_uid']);
     $_REQUEST['title'] = t(html_entity_decode($_REQUEST['title'], ENT_QUOTES));
     $_REQUEST['url'] = urldecode($_REQUEST['url']);
     $_REQUEST['table'] = t($_REQUEST['table']);
     $_REQUEST['id_field'] = t($_REQUEST['id_field']);
     $_REQUEST['comment_count_field'] = t($_REQUEST['comment_count_field']);
     $app_alias = getAppAlias($_REQUEST['type']);
     // 被回复内容
     $former_comment = array();
     if ($_REQUEST['to_id'] > 0) {
         $former_comment = M('comment')->where("`id`='{$_REQUEST['to_id']}'")->find();
     }
     // 插入新数据
     $map['type'] = $_REQUEST['type'];
     // 应用名
     $map['appid'] = $_REQUEST['appid'];
     $map['appuid'] = $_REQUEST['author_uid'];
     $map['uid'] = $this->mid;
     $map['comment'] = t(getShort($_REQUEST['comment'], $GLOBALS['ts']['site']['length']));
     $map['cTime'] = time();
     $map['toId'] = $_REQUEST['to_id'];
     $map['status'] = 0;
     // 0: 未读 1:已读
     $map['quietly'] = 0;
     $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $_REQUEST['author_uid'];
     $map['data'] = serialize(array('title' => keyWordFilter($_REQUEST['title']), 'url' => $_REQUEST['url'], 'table' => $_REQUEST['table'], 'id_field' => $_REQUEST['id_field'], 'comment_count_field' => $_REQUEST['comment_count_field']));
     $res = M('comment')->add($map);
     // 避免命名冲突
     unset($map['data']);
     if ($res) {
         // 发表分享
         if ($_REQUEST['with_new_weibo']) {
             $from_data = array('app_type' => 'local_app', 'app_name' => $_REQUEST['type'], 'title' => $_REQUEST['title'], 'url' => $_REQUEST['url']);
             $from_data = serialize($from_data);
             D('Weibo', 'weibo')->publish($this->mid, array('content' => html_entity_decode($_REQUEST['comment'] . ($_REQUEST['to_id'] > 0 ? ' //@' . getUserName($former_comment['uid']) . ' :' . $former_comment['comment'] : ''), ENT_QUOTES)), 0, 0, '', '', $from_data);
         }
         // 组装结果集
         $result = $map;
         $result['data']['uavatar'] = getUserSpace($this->mid, 'null', '_blank', '{uavatar}');
         $result['data']['uspace'] = getUserSpace($this->mid, 'null', '_blank', '{uname}');
         //$result['data']['comment']        = $_REQUEST['comment'];
         $result['data']['ctime'] = L('just_now');
         $result['data']['uname'] = getUserName($this->mid);
         $result['data']['comment'] = formatComment(t($_REQUEST['comment']));
         $result['data']['id'] = $res;
         $result['data']['userGroupIcon'] = getUserGroupIcon($this->mid);
         $result['data']['del_state'] = 1;
         return json_encode($result);
     } else {
         echo -1;
     }
 }
if ($body == "") {
    ?>
分享分享<?php 
}
?>
 
<?php 
echo replaceurl(t($body));
?>
<dl class="comment">
	<?php 
if ($sourceInfo['is_del'] == 0 && $sourceInfo['source_user_info'] != false) {
    ?>
	<!--<dd class="name">
		<span class="f9"><i class="ico-rep"></i>转载自1</span><?php 
    echo getUserSpace($sourceInfo["source_user_info"]["uid"], '', '', '{uname}');
    ?>
        <span>1<a href="<?php 
    echo U('public/Profile/feed', array('uid' => $sourceInfo['uid'], 'feed_id' => $sourceInfo['feed_id']));
    ?>
" class="date" date="<?php 
    echo $sourceInfo['publish_time'];
    ?>
"><?php 
    echo friendlydate($sourceInfo['publish_time']);
    ?>
</a><span><?php 
    echo getFromClient($sourceInfo['from']);
    ?>
</span></span>
	</dd>-->
 public function doAddComment()
 {
     $_POST['with_new_weibo'] = intval($_POST['with_new_weibo']);
     $_POST['type'] = t($_POST['type']);
     $_POST['appid'] = intval($_POST['appid']);
     $_POST['comment'] = $_POST['comment'];
     $_POST['to_id'] = intval($_POST['to_id']);
     $_POST['author_uid'] = intval($_POST['author_uid']);
     $_POST['title'] = t(html_entity_decode($_POST['title'], ENT_QUOTES));
     $_POST['url'] = urldecode($_POST['url']);
     $_POST['table'] = t($_POST['table']);
     $_POST['id_field'] = t($_POST['id_field']);
     $_POST['comment_count_field'] = t($_POST['comment_count_field']);
     $app_alias = getAppAlias($_POST['type']);
     // 被回复内容
     $former_comment = array();
     if ($_POST['to_id'] > 0) {
         $former_comment = M('comment')->where("`id`='{$_POST['to_id']}'")->find();
     }
     // 插入新数据
     $map['type'] = $_POST['type'];
     // 应用名
     $map['appid'] = $_POST['appid'];
     $map['appuid'] = $_POST['author_uid'];
     $map['uid'] = $this->mid;
     $map['comment'] = t(getShort($_POST['comment'], $GLOBALS['ts']['site']['length']));
     $map['cTime'] = time();
     $map['toId'] = $_POST['to_id'];
     $map['status'] = 0;
     // 0: 未读 1:已读
     $map['quietly'] = 0;
     $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $_POST['author_uid'];
     $map['data'] = serialize(array('title' => $_POST['title'], 'url' => $_POST['url'], 'table' => $_POST['table'], 'id_field' => $_POST['id_field'], 'comment_count_field' => $_POST['comment_count_field']));
     $res = M('comment')->add($map);
     // 避免命名冲突
     unset($map['data']);
     if ($res) {
         // 应用回调: 增加应用的评论计数
         $this->__doAddCallBack($_POST['appid'], $_POST['table'], $_POST['id_field'], $_POST['comment_count_field']);
         //积分处理
         $setCredit = X('Credit');
         if ($map['toId'] > 0 && $this->mid != $map['to_uid']) {
             $setCredit->setUserCredit($this->mid, 'reply_comment')->setUserCredit($map['to_uid'], 'replied_comment');
         } else {
             if ($this->mid != $map['to_uid']) {
                 $setCredit->setUserCredit($this->mid, 'add_comment')->setUserCredit($map['to_uid'], 'is_commented');
             }
         }
         // 发表微博
         if ($_POST['with_new_weibo']) {
             $from_data = array('app_type' => 'local_app', 'app_name' => $_POST['type'], 'title' => $_POST['title'], 'url' => $_POST['url']);
             $from_data = serialize($from_data);
             D('Weibo', 'weibo')->publish($this->mid, array('content' => html_entity_decode($_POST['comment'] . ($_POST['to_id'] > 0 ? ' //@' . getUserName($former_comment['uid']) . ' :' . $former_comment['comment'] : ''), ENT_QUOTES)), 0, 0, '', '', $from_data);
         }
         /*        		
         	        	// 给被回复人发送通知
         				if ($former_comment['uid']) {
         					$data = array(
         						'app_alias'	=> $app_alias,
         						'url'		=> $_POST['url'],
         						'title'		=> $_POST['title'],
         						'content'	=> $_POST['comment'],
         						'my_content'=> $former_comment['comment'],
         					);
         					service('Notify')->send($former_comment['uid'], 'home_replyComment', $data, $this->mid);
         					unset($data);
         				}
         				// 给作者发送通知 ( 当被回复人和作者为同一人时, 只发一个通知. 优先被回复. )
         				if ($_POST['author_uid'] > 0 && $_POST['author_uid'] != $former_comment['uid']) {
         					$data = array(
         						'app_alias'	=> $app_alias,
         						'url'		=> $_POST['url'],
         						'title'		=> $_POST['title'],
         						'content'	=> $_POST['comment'],
         					);
         					service('Notify')->send($_POST['author_uid'], 'home_addComment', $data, $this->mid);
         					unset($data);
         				}
         */
         // 组装结果集
         $result = $map;
         $result['data']['uavatar'] = getUserSpace($this->mid, 'null', '_blank', '{uavatar}');
         $result['data']['uspace'] = getUserSpace($this->mid, 'null', '_blank', '{uname}');
         //$result['data']['comment']  		= $_POST['comment'];
         $result['data']['ctime'] = L('just_now');
         $result['data']['uname'] = getUserName($this->mid);
         $result['data']['comment'] = formatComment(t($_POST['comment']));
         $result['data']['id'] = $res;
         $result['data']['userGroupIcon'] = getUserGroupIcon($this->mid);
         $result['data']['del_state'] = 1;
         echo json_encode($result);
     } else {
         echo -1;
     }
 }