function returnHtml($s){ $s = strip_tags($s,""); $s = stripslashes($s); $s = ubbCode($s); return utf8_encode($s); }
function space_comment() { global $user_arr; $message = trim(MooGetGPC('message', 'string', 'P')); if (empty($message)) { echo 'emptymessage'; exit; } $type = MooGetGPC('type', 'string', 'P'); if (in_array($type, array('video', 'lifetimes'))) { $type == 'video' ? $c_type = 1 : ($c_type = 2); } else { echo 'no'; exit; } $gender_value = MooGetGPC('gender_value', 'integer', 'P'); //得到评论包含的配置文件 $cache_file = getCacheFile($gender_value . $c_type); if (!file_exists($cache_file)) { echo 'no'; exit; } //视频 if ($type == 'video') { $vid = MooGetGPC('vid', 'integer', 'P'); if (empty($vid)) { echo 'no'; exit; } $commentid = MooGetGPC('commentid', 'integer', 'P'); $uid = MooGetGPC('uid', 'integer', 'P'); $param['comment_type'] = 1; //评论类型1为视频介绍 $param['vid'] = $vid; //评论的视频 $param['comment'] = ubbCode($message); //提交的评论 $param['cid'] = $uid; //被评论人的uid $param['uid'] = $user_arr['uid']; //评论人uid $param['nickname'] = $user_arr['nickname']; //评论人的昵称 $param['dateline'] = time(); inserttable('diamond_comment', $param); echo json_encode($param); exit; } //人生经历 if ($type == 'lifetimes') { $commentid = MooGetGPC('commentid', 'integer', 'P'); $uid = MooGetGPC('uid', 'integer', 'P'); $param['comment_type'] = 2; //评论类型2为人生经历 $param['comment'] = ubbCode($message); //提交的评论 $param['cid'] = $uid; //被评论人的uid $param['uid'] = $user_arr['uid']; //评论人uid $param['nickname'] = $user_arr['nickname']; //评论人的昵称 $param['dateline'] = time(); inserttable('diamond_comment', $param); echo json_encode($param); exit; } }