本文整理汇总了PHP中checkflood函数的典型用法代码示例。如果您正苦于以下问题:PHP checkflood函数的具体用法?PHP checkflood怎么用?PHP checkflood使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkflood函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wapmsg
if ($post_autoclose = checkautoclose()) {
wapmsg($post_autoclose);
}
if (empty($message)) {
echo "<p>{$lang['message']}<input type=\"text\" name=\"message\" value=\"\" format=\"M*m\" /><br />\n" . "<anchor title=\"{$lang['submit']}\">{$lang['submit']}" . "<go method=\"post\" href=\"index.php?action=post&do=reply&fid={$fid}&tid={$tid}&sid={$sid}\">\n" . "<postfield name=\"subject\" value=\"\$(subject)\" />\n" . "<postfield name=\"message\" value=\"\$(message)\" />\n" . "<postfield name=\"formhash\" value=\"" . formhash() . "\" />\n" . "</go></anchor><br /><br />\n" . "<a href=\"index.php?action=thread&tid={$tid}\">{$lang['return_thread']}</a><br />\n" . "<a href=\"index.php?action=forum&fid={$fid}\">{$lang['return_forum']}</a></p>\n";
} else {
if ($message == '') {
wapmsg('post_sm_isnull');
}
if ($post_invalid = checkpost()) {
wapmsg($post_invalid);
}
if ($formhash != formhash()) {
wapmsg('wap_submit_invalid');
}
if (checkflood()) {
wapmsg('post_flood_ctrl');
}
$pinvisible = $modnewreplies ? -2 : 0;
$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, dateline, message, useip, invisible, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)\r\n\t\t\t\tVALUES ('{$fid}', '{$tid}', '0', '{$discuz_user}', '{$discuz_uid}', '{$timestamp}', '{$message}', '{$onlineip}', '{$pinvisible}', '1', '0', '0', '0', '0', '0')");
$pid = $db->insert_id();
$db->query("REPLACE INTO {$tablepre}myposts (uid, tid, pid, position, dateline) VALUES ('{$discuz_uid}', '{$tid}', '{$pid}', '" . ($thread['replies'] + 1) . "', '{$timestamp}')", 'UNBUFFERED');
if ($modnewreplies) {
wapmsg('post_mod_succeed', array('title' => 'post_mod_forward', 'link' => "index.php?action=forum&fid={$fid}"));
} else {
$db->query("UPDATE {$tablepre}threads SET lastposter='{$discuz_user}', lastpost='{$timestamp}', replies=replies+1 WHERE tid='{$tid}' AND fid='{$fid}'", 'UNBUFFERED');
updatepostcredits('+', $discuz_uid, $replycredits);
$lastpost = "{$thread['tid']}\t" . addslashes($thread['subject']) . "\t{$timestamp}\t{$discuz_user}";
$db->query("UPDATE {$tablepre}forums SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$fid}'", 'UNBUFFERED');
if ($forum['type'] == 'sub') {
$db->query("UPDATE {$tablepre}forums SET lastpost='{$lastpost}' WHERE fid='{$forum['fup']}'", 'UNBUFFERED');
示例2: newthread
public function newthread($parameters)
{
require_once libfile('function/post');
$this->tid = $this->pid = 0;
$this->_init_parameters($parameters);
if (trim($this->param['subject']) == '') {
return $this->showmessage('post_sm_isnull');
}
if (!$this->param['sortid'] && !$this->param['special'] && trim($this->param['message']) == '') {
return $this->showmessage('post_sm_isnull');
}
list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] || $this->param['sortid'])) {
return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
}
if (checkflood()) {
return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
} elseif (checkmaxperhour('tid')) {
return $this->showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' => $this->group['maxthreadsperhour']));
}
$this->param['save'] = $this->member['uid'] ? $this->param['save'] : 0;
$this->param['typeid'] = isset($this->param['typeid']) && isset($this->forum['threadtypes']['types'][$this->param['typeid']]) && (!$this->forum['threadtypes']['moderators'][$this->param['typeid']] || $this->forum['ismoderator']) ? $this->param['typeid'] : 0;
$this->param['displayorder'] = $this->param['modnewthreads'] ? -2 : ($this->forum['ismoderator'] && $this->group['allowstickthread'] && !empty($this->param['sticktopic']) ? 1 : (empty($this->param['save']) ? 0 : -4));
if ($this->param['displayorder'] == -2) {
C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
}
$this->param['digest'] = $this->forum['ismoderator'] && $this->group['allowdigestthread'] && !empty($this->param['digest']) ? 1 : 0;
$this->param['readperm'] = $this->group['allowsetreadperm'] ? $this->param['readperm'] : 0;
$this->param['isanonymous'] = $this->group['allowanonymous'] && $this->param['isanonymous'] ? 1 : 0;
$this->param['price'] = intval($this->param['price']);
if (!$this->param['special']) {
$this->param['price'] = $this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] : $this->group['maxprice'] : 0;
}
if (!$this->param['typeid'] && $this->forum['threadtypes']['required'] && !$this->param['special']) {
return $this->showmessage('post_type_isnull');
}
if (!$this->param['sortid'] && $this->forum['threadsorts']['required'] && !$this->param['special']) {
return $this->showmessage('post_sort_isnull');
}
if (!$this->param['special'] && $this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
return $this->showmessage('post_net_price_iszero');
}
$this->param['sortid'] = $this->param['special'] && $this->forum['threadsorts']['types'][$this->param['sortid']] ? 0 : $this->param['sortid'];
$this->param['typeexpiration'] = intval($this->param['typeexpiration']);
if ($this->forum['threadsorts']['expiration'][$this->param['typeid']] && !$this->param['typeexpiration']) {
return $this->showmessage('threadtype_expiration_invalid');
}
$author = !$this->param['isanonymous'] ? $this->member['username'] : '';
$this->param['moderated'] = $this->param['digest'] || $this->param['displayorder'] > 0 ? 1 : 0;
$this->param['ordertype'] && ($this->param['tstatus'] = setstatus(4, 1, $this->param['tstatus']));
$this->param['imgcontent'] && ($this->param['tstatus'] = setstatus(15, $this->param['imgcontent'], $this->param['tstatus']));
$this->param['hiddenreplies'] && ($this->param['tstatus'] = setstatus(2, 1, $this->param['tstatus']));
$this->param['allownoticeauthor'] && ($this->param['tstatus'] = setstatus(6, 1, $this->param['tstatus']));
$this->param['isgroup'] = $this->forum['status'] == 3 ? 1 : 0;
$this->param['publishdate'] = !$this->param['modnewthreads'] ? $this->param['publishdate'] : TIMESTAMP;
$newthread = array('fid' => $this->forum['fid'], 'posttableid' => 0, 'readperm' => $this->param['readperm'], 'price' => $this->param['price'], 'typeid' => $this->param['typeid'], 'sortid' => $this->param['sortid'], 'author' => $author, 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'lastpost' => $this->param['publishdate'], 'lastposter' => $author, 'displayorder' => $this->param['displayorder'], 'digest' => $this->param['digest'], 'special' => $this->param['special'], 'attachment' => 0, 'moderated' => $this->param['moderated'], 'status' => $this->param['tstatus'], 'isgroup' => $this->param['isgroup'], 'replycredit' => $this->param['replycredit'], 'closed' => $this->param['closed'] ? 1 : 0);
$this->tid = C::t('forum_thread')->insert($newthread, true);
C::t('forum_newthread')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid'], 'dateline' => $this->param['publishdate']));
useractionlog($this->member['uid'], 'tid');
if (!getuserprofile('threads') && $this->setting['newbie']) {
C::t('forum_thread')->update($this->tid, array('icon' => $this->setting['newbie']));
}
if ($this->param['publishdate'] != TIMESTAMP) {
$cron_publish_ids = dunserialize($this->cache('cronpublish'));
$cron_publish_ids[$this->tid] = $this->tid;
$cron_publish_ids = serialize($cron_publish_ids);
savecache('cronpublish', $cron_publish_ids);
}
if (!$this->param['isanonymous']) {
C::t('common_member_field_home')->update($this->member['uid'], array('recentnote' => $this->param['subject']));
}
if ($this->param['moderated']) {
updatemodlog($this->tid, $this->param['displayorder'] > 0 ? 'STK' : 'DIG');
updatemodworks($this->param['displayorder'] > 0 ? 'STK' : 'DIG', 1);
}
$this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
$this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
$this->param['parseurloff'] = !empty($this->param['parseurloff']);
$this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
$this->param['usesig'] = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
$class_tag = new tag();
$this->param['tagstr'] = $class_tag->add_tag($this->param['tags'], $this->tid, 'tid');
$this->param['pinvisible'] = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
$this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
$this->param['pstatus'] = intval($this->param['pstatus']);
defined('IN_MOBILE') && ($this->param['pstatus'] = setstatus(4, 1, $this->param['pstatus']));
if ($this->param['imgcontent']) {
stringtopic($this->param['message'], $this->tid, true, $this->param['imgcontentwidth']);
}
$this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->tid, 'first' => '1', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $this->param['pinvisible'], 'anonymous' => $this->param['isanonymous'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'smileyoff' => $this->param['smileyoff'], 'parseurloff' => $this->param['parseurloff'], 'attachment' => '0', 'tags' => $this->param['tagstr'], 'replycredit' => 0, 'status' => $this->param['pstatus']));
$statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
include_once libfile('function/stat');
updatestat($this->param['isgroup'] ? 'groupthread' : $statarr[$this->param['special']]);
if ($this->param['geoloc'] && IN_MOBILE == 2) {
list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
if ($mapx && $mapy && $location) {
C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->tid, 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
}
}
if ($this->param['modnewthreads']) {
//.........这里部分代码省略.........
示例3: showmessage
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
checklowerlimit('reply', 0, 1, $_G['forum']['fid']);
if ($_G['setting']['commentnumber'] && !empty($_GET['comment'])) {
if (!submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
showmessage('submitcheck_error', NULL);
}
$post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['pid']);
if (!$post) {
showmessage('post_nonexistence', NULL);
}
if ($thread['closed'] && !$_G['forum']['ismoderator'] && !$thread['isgroup']) {
showmessage('post_thread_closed');
} elseif (!$thread['isgroup'] && ($post_autoclose = checkautoclose($thread))) {
showmessage($post_autoclose, '', array('autoclose' => $_G['forum']['autoclose']));
} elseif (checkflood()) {
showmessage('post_flood_ctrl', '', array('floodctrl' => $_G['setting']['floodctrl']));
} elseif (checkmaxperhour('pid')) {
showmessage('post_flood_ctrl_posts_per_hour', '', array('posts_per_hour' => $_G['group']['maxpostsperhour']));
}
$commentscore = '';
if (!empty($_GET['commentitem']) && !empty($_G['uid']) && $post['authorid'] != $_G['uid']) {
foreach ($_GET['commentitem'] as $itemk => $itemv) {
if ($itemv !== '') {
$commentscore .= strip_tags(trim($itemk)) . ': <i>' . intval($itemv) . '</i> ';
}
}
}
$comment = cutstr(($commentscore ? $commentscore . '<br />' : '') . censor(trim(dhtmlspecialchars($_GET['message'])), '***'), 200, ' ');
if (!$comment) {
showmessage('post_sm_isnull');
示例4: sendPost
private function sendPost($extract)
{
global $_G;
extract($extract);
// 获取主题和帖子要插入的状态信息
$topicStatus = ForumUtils::getPostSendStatus('topic', $_GET['platType']);
$postStatus = ForumUtils::getPostSendStatus('post', $_GET['platType']);
//copy from dz source/include/post/post_newthread.php
if (empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') {
return WebUtils::makeErrorInfo_oldVersion($res, 'forum_nonexistence');
}
if ($special == 1 && !$_G['group']['allowpostpoll'] || $special == 2 && !$_G['group']['allowposttrade'] || $special == 3 && !$_G['group']['allowpostreward'] || $special == 4 && !$_G['group']['allowpostactivity'] || $special == 5 && !$_G['group']['allowpostdebate']) {
return WebUtils::makeErrorInfo_oldVersion($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']));
}
if (!$_G['uid'] && !(!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']))) {
if (!defined('IN_MOBILE')) {
return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission', array('{login}' => 1));
} else {
return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission_mobile', array('{login}' => 1));
}
} elseif (empty($_G['forum']['allowpost'])) {
if (!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_none_nopermission');
} elseif ($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
$msg = mobcent_showmessagenoperm('postperm', $_G['fid'], $_G['forum']['formulaperm']);
return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']);
}
} elseif ($_G['forum']['allowpost'] == -1) {
return WebUtils::makeErrorInfo_oldVersion($res, 'post_forum_newthread_nopermission');
}
if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission');
}
if (trim($subject) == '') {
return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
}
if (!$sortid && !$special && trim($message) == '') {
return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
}
if ($post_invalid = checkpost($subject, $message, $special || $sortid)) {
return WebUtils::makeErrorInfo_oldVersion($res, $post_invalid, array('{minpostsize}' => $_G['setting']['minpostsize'], '{maxpostsize}' => $_G['setting']['maxpostsize']));
//showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
}
if (checkflood()) {
return WebUtils::makeErrorInfo_oldVersion($res, 'post_flood_ctrl', array('{floodctrl}' => $_G['setting']['floodctrl']));
} elseif (checkmaxperhour('tid')) {
return WebUtils::makeErrorInfo_oldVersion($res, 'thread_flood_ctrl_threads_per_hour', array('{threads_per_hour}' => $_G['group']['maxthreadsperhour']));
}
$_GET['save'] = $_G['uid'] ? $_GET['save'] : 0;
if ($_G['group']['allowsetpublishdate'] && $_GET['cronpublish'] && $_GET['cronpublishdate']) {
$publishdate = strtotime($_GET['cronpublishdate']);
if ($publishdate > $_G['timestamp']) {
$_GET['save'] = 1;
} else {
$publishdate = $_G['timestamp'];
}
} else {
$publishdate = $_G['timestamp'];
}
$typeid = isset($typeid) && isset($_G['forum']['threadtypes']['types'][$typeid]) && (empty($_G['forum']['threadtypes']['moderators'][$typeid]) || $_G['forum']['ismoderator']) ? $typeid : 0;
$displayorder = $modnewthreads ? -2 : ($_G['forum']['ismoderator'] && $_G['group']['allowstickthread'] && !empty($_GET['sticktopic']) ? 1 : (empty($_GET['save']) ? 0 : -4));
if ($displayorder == -2) {
C::t('forum_forum')->update($_G['fid'], array('modworks' => '1'));
} elseif ($displayorder == -4) {
$_GET['addfeed'] = 0;
}
$digest = $_G['forum']['ismoderator'] && $_G['group']['allowdigestthread'] && !empty($_GET['addtodigest']) ? 1 : 0;
$readperm = $_G['group']['allowsetreadperm'] ? $readperm : 0;
$isanonymous = $_G['group']['allowanonymous'] && $_GET['isanonymous'] ? 1 : 0;
$price = intval($price);
$price = $_G['group']['maxprice'] && !$special ? $price <= $_G['group']['maxprice'] ? $price : $_G['group']['maxprice'] : 0;
//强制主题类别判断
if (!$typeid && $_G['forum']['threadtypes']['required'] && !$special) {
return WebUtils::makeErrorInfo_oldVersion($res, 'post_type_isnull');
}
//强制主题分类判断
if (!$sortid && $_G['forum']['threadsorts']['required'] && !$special) {
return WebUtils::makeErrorInfo_oldVersion($res, 'post_sort_isnull');
}
//主题售价 客户端暂不支持
if ($price > 0 && floor($price * (1 - $_G['setting']['creditstax'])) == 0) {
return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
showmessage('post_net_price_iszero');
}
//投票贴相关
if ($special == 1) {
$polloption = $_GET['tpolloption'] == 2 ? explode("\n", $_GET['polloptions']) : $_GET['polloption'];
$pollarray = array();
foreach ($polloption as $key => $value) {
$polloption[$key] = censor($polloption[$key]);
if (trim($value) === '') {
unset($polloption[$key]);
}
}
if (count($polloption) > $_G['setting']['maxpolloptions']) {
return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
showmessage('post_poll_option_toomany', '', array('maxpolloptions' => $_G['setting']['maxpolloptions']));
} elseif (count($polloption) < 2) {
return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
showmessage('post_poll_inputmore');
//.........这里部分代码省略.........
示例5: showmessage
if (!$_G['uid'] && !(!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']))) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
} elseif (empty($_G['forum']['allowpost'])) {
if (!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
} elseif ($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
showmessage('post_forum_newthread_nopermission', NULL);
}
} elseif ($_G['forum']['allowpost'] == -1) {
showmessage('post_forum_newthread_nopermission', NULL);
}
checklowerlimit('post', 0, 1, $_G['forum']['fid']);
if ($post_invalid = checkpost($subject, $message, 1)) {
showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
}
if ($time_left = checkflood()) {
showmessage('post_flood_ctrl', '', array('floodctrl' => $_G['setting']['floodctrl'], 'time_left' => $time_left));
} elseif (checkmaxperhour('tid')) {
showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' => $_G['group']['maxthreadsperhour']));
}
$item_price = floatval($_GET['item_price']);
$item_credit = intval($_GET['item_credit']);
$_GET['item_name'] = censor($_GET['item_name']);
if (!trim($_GET['item_name'])) {
showmessage('trade_please_name');
} elseif ($_G['group']['maxtradeprice'] && $item_price > 0 && ($_G['group']['mintradeprice'] > $item_price || $_G['group']['maxtradeprice'] < $item_price)) {
showmessage('trade_price_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
} elseif ($_G['group']['maxtradeprice'] && $item_credit > 0 && ($_G['group']['mintradeprice'] > $item_credit || $_G['group']['maxtradeprice'] < $item_credit)) {
showmessage('trade_credit_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
} elseif (!$_G['group']['maxtradeprice'] && $item_price > 0 && $_G['group']['mintradeprice'] > $item_price) {
showmessage('trade_price_more_than', '', array('mintradeprice' => $_G['group']['mintradeprice']));
示例6: newreply
public function newreply($parameters)
{
$this->_init_parameters($parameters);
if ($this->thread['closed'] && !$this->forum['ismoderator'] && !$this->thread['isgroup']) {
return $this->showmessage('post_thread_closed');
} elseif (!$this->thread['isgroup'] && ($post_autoclose = checkautoclose($this->thread))) {
return $this->showmessage($post_autoclose, '', array('autoclose' => $this->forum['autoclose']));
}
if (trim($this->param['subject']) == '' && trim($this->param['message']) == '' && $this->thread['special'] != 2) {
return $this->showmessage('post_sm_isnull');
} elseif ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] == 2 && $this->group['allowposttrade'])) {
return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
} elseif (checkflood()) {
return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
} elseif (checkmaxperhour('pid')) {
return $this->showmessage('post_flood_ctrl_posts_per_hour', '', array('posts_per_hour' => $this->group['maxpostsperhour']));
}
$heatthreadset = update_threadpartake($this->thread['tid'], true);
$bbcodeoff = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
$smileyoff = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
$parseurloff = !empty($this->param['parseurloff']);
$htmlon = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
$usesig = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
$this->param['isanonymous'] = $this->group['allowanonymous'] && !empty($this->param['isanonymous']) ? 1 : 0;
$author = empty($this->param['isanonymous']) ? $this->member['username'] : '';
list(, $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
if ($this->thread['displayorder'] == -4) {
$this->param['modnewreplies'] = 0;
}
$pinvisible = $this->param['modnewreplies'] ? -2 : ($this->thread['displayorder'] == -4 ? -3 : 0);
$this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
if (!empty($this->param['noticetrimstr'])) {
$this->param['message'] = $this->param['noticetrimstr'] . "\n\n" . $this->param['message'];
$bbcodeoff = false;
}
$status = defined('IN_MOBILE') ? 8 : 0;
if ($this->param['modstatus']) {
foreach ($this->param['modstatus'] as $modbit => $modvalue) {
$status = setstatus($modbit, $modvalue, $status);
}
}
$this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->thread['tid'], 'first' => '0', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['timestamp'] ? $this->param['timestamp'] : getglobal('timestamp'), 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $pinvisible, 'anonymous' => $this->param['isanonymous'], 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'status' => $status));
$this->param['updatethreaddata'] = $heatthreadset ? $heatthreadset : array();
$this->param['maxposition'] = C::t('forum_post')->fetch_maxposition_by_tid($this->thread['posttableid'], $this->thread['tid']);
$this->param['updatethreaddata'][] = DB::field('maxposition', $this->param['maxposition']);
useractionlog($this->member['uid'], 'pid');
if ($this->param['geoloc'] && IN_MOBILE == 2) {
list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
if ($mapx && $mapy && $location) {
C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->thread['tid'], 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
}
}
$nauthorid = 0;
if (!empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
list($ac, $nauthorid) = explode('|', authcode($this->param['noticeauthor'], 'DECODE'));
if ($nauthorid != $this->member['uid']) {
if ($ac == 'q') {
notification_add($nauthorid, 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->pid, 'from_idtype' => 'quote'));
} elseif ($ac == 'r') {
notification_add($nauthorid, 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->thread['tid'], 'from_idtype' => 'post'));
}
}
}
if ($this->thread['authorid'] != $this->member['uid'] && getstatus($this->thread['status'], 6) && empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
$thapost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($this->thread['tid'], 0);
notification_add($thapost['authorid'], 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->thread['tid'], 'from_idtype' => 'post'));
}
$this->forum['threadcaches'] && deletethreadcaches($this->thread['tid']);
include_once libfile('function/stat');
updatestat($this->thread['isgroup'] ? 'grouppost' : 'post');
$this->param['showmsgparam']['fid'] = $this->forum['fid'];
$this->param['showmsgparam']['tid'] = $this->thread['tid'];
$this->param['showmsgparam']['pid'] = $this->pid;
$this->param['showmsgparam']['from'] = $this->param['from'];
$this->param['showmsgparam']['sechash'] = !empty($this->param['sechash']) ? $this->param['sechash'] : '';
dsetcookie('clearUserdata', 'forum');
if ($this->thread['replies'] <= 0) {
C::t('forum_sofa')->delete($this->thread['tid']);
}
if ($this->param['modnewreplies']) {
updatemoderate('pid', $this->pid);
unset($this->param['showmsgparam']['pid']);
if ($this->param['updatethreaddata']) {
C::t('forum_thread')->update($this->thread['tid'], $this->param['updatethreaddata'], false, false, 0, true);
}
C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1, 1);
manage_addnotify('verifypost');
return 'post_reply_mod_succeed';
} else {
$fieldarr = array('lastposter' => array($author), 'replies' => 1);
if ($this->thread['lastpost'] < getglobal('timestamp')) {
$fieldarr['lastpost'] = array(getglobal('timestamp'));
}
$row = C::t('forum_threadaddviews')->fetch($this->thread['tid']);
if (!empty($row)) {
C::t('forum_threadaddviews')->update($this->thread['tid'], array('addviews' => 0));
$fieldarr['views'] = $row['addviews'];
}
$this->param['updatethreaddata'] = array_merge($this->param['updatethreaddata'], C::t('forum_thread')->increase($this->thread['tid'], $fieldarr, false, 0, true));
if ($this->thread['displayorder'] != -4) {
//.........这里部分代码省略.........