本帖最后由 42537024 于 2014-5-11 21:34 编辑
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
//直接引用:post_reply($uid回帖用户UID, $tid帖子TID, $username回帖用户名, $dataline回帖时间, $clientip回帖IP, $message回帖内容);
//自动读取IP:$_G['clientip']
//当前时间:$_G['timestamp']
//都可以调用系统参数,$message回帖内容就需要用户填写的
function post_reply($uid, $tid, $username, $dataline, $clientip, $message,$status,$images) {
include_once libfile('function/forum');
include_once libfile('function/post');
include_once libfile('function/stat');
include_once libfile('function/cache');
$post = $thread = array();
if($tid){
$thread = get_thread_by_tid($tid);
}
$postarr = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid);
$fid = $postarr['fid'];
$pid = insertpost(array(
'fid' => $fid,
'tid' => $tid,
'author' => $username,
'authorid' => $uid,
'dateline' => $dataline,
'message' => $message,
'useip' => $clientip,
'usesig' => '1',
'status' => $status,
));
//回复消息通知
if($thread['authorid'] != $uid && getstatus($thread['status'], 6)) {
$thapost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid, 0);
notification_add($thapost['authorid'], 'post', 'reppost_noticeauthor', array(
'tid' => $thread['tid'],
'subject' => $thread['subject'],
'fid' => $fid,
'pid' => $pid,
'from_id' => $thread['tid'],
'from_idtype' => 'post',
));
}
//回复消息通知
$thread = C::t('forum_thread')->fetch($tid);
$fieldarr = array(
'lastposter' => array($username),
'replies' => 1
);
if($thread['lastpost'] < $dataline) {
$fieldarr['lastpost'] = array($dataline);
}
}
..............................................................
$pid=$_POST['pid'];
$message=$_POST['message'];//回复内容
$tid=$_POST['tid'];
post_reply($_G[uid],$tid,$_G['username'],$_G['timestamp'],$_G['clientip'],$message,'264');
}
?>
所有一切都正常,就是//回复消息通知 $thapost['authorid'] 这里无法获取参数。如果我它直接改为一个用户的UID,就可以正常发送回复通知,请问是怎么回事?
|