discuz!X2插入主题帖子所需运行的代码和SQL语句
直接贴代码:$subject = $news_subject;
$message = $news_message;
DB::query("INSERT INTO ".DB::table('forum_thread')." (fid, posttableid, readperm, price, typeid, sortid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, moderated, status, isgroup, replycredit, closed) VALUES ('$cmt_fid', '0', '0', '0', '0', '0', '$cmt_author', '$cmt_uid', '$subject', '$_G[timestamp]', '$_G[timestamp]', '$cmt_author', '0', '0', '0', '0', '0', '0', '0', '0', '0')");
$tid = DB::insert_id();
$pid = insertpost(array(
'fid' => $cmt_fid,
'tid' => $tid,
'first' => '1',
'author' => $cmt_author,
'authorid' => $cmt_uid,
'subject' => $subject,
'dateline' => $_G['timestamp'],
'message' => $message,
'useip' => $_G['clientip'],
'invisible' => 0,
'anonymous' => 0,
'usesig' => 0,
'htmlon' => 0,
'bbcodeoff' => 0,
'smileyoff' => 0,
'parseurloff' => 0,
'attachment' => 0,
'tags' => '',
'replycredit' => 0,
'status' => 0
));
$subject = str_replace("\t", ' ', $subject);
$lastpost = "$tid\t$subject\t$_G[timestamp]\t$cmt_author";
DB::query("UPDATE ".DB::table('forum_forum')." SET lastpost='$lastpost', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='$cmt_fid'", 'UNBUFFERED');
查看完整版本: discuz!X2插入主题帖子所需运行的代码和SQL语句
Tags: