function usesubmit() { global $_G; if (empty($_G['gp_tid'])) { showmessage(lang('magic/sofa', 'sofa_info_nonexistence')); } $thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'dateline', 'subject')); $this->_check($thread); $firstsofa = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_threadmod') . " WHERE magicid='" . $this->magic['magicid'] . "' AND tid='{$_G['gp_tid']}'"); if ($firstsofa >= 1) { showmessage(lang('magic/sofa', 'sofa_info_sofaexistence'), '', array(), array('login' => 1)); } $sofamessage = lang('magic/sofa', 'sofa_text', array('actor' => $_G['member']['username'], 'time' => dgmdate(TIMESTAMP), 'magicname' => $this->magic['name'])); $dateline = $thread['dateline'] + 1; insertpost(array('fid' => $thread['fid'], 'tid' => $_G['gp_tid'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $dateline, 'message' => $sofamessage, 'useip' => $_G['clientip'], 'usesig' => '1')); DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+1, moderated='1' WHERE tid='{$_G['tid']}'", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_forum') . " SET posts=posts+1, todayposts=todayposts+1 WHERE fid='{$post['fid']}'", 'UNBUFFERED'); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']); updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid']); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/sofa', 'sofa_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/sofa', 'sofa_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1)); }
public function after_newthread() { if (!$this->tid) { return; } $this->trademessage = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->trademessage); $pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->tid, 'first' => '0', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => getglobal('timestamp'), 'message' => $this->trademessage, 'useip' => getglobal('clientip'), 'invisible' => 0, 'anonymous' => $this->param['isanonymous'], 'usesig' => $_GET['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'smileyoff' => $this->param['smileyoff'], 'parseurloff' => $this->param['parseurloff'], 'attachment' => 0, 'tags' => $this->param['tagstr'], 'status' => defined('IN_MOBILE') ? 8 : 0)); ($this->group['allowpostattach'] || $this->group['allowpostimage']) && ($_GET['attachnew'] || $_GET['tradeaid']) && updateattach($this->param['displayorder'] == -4 || $this->param['modnewthreads'], $this->tid, $pid, $_GET['attachnew']); require_once libfile('function/trade'); $author = !$this->param['isanonymous'] ? $this->member['username'] : ''; trade_create(array('tid' => $this->tid, 'pid' => $pid, 'aid' => $_GET['tradeaid'], 'item_expiration' => $_GET['item_expiration'], 'thread' => $this->thread, 'discuz_uid' => $this->member['uid'], 'author' => $author, 'seller' => empty($_GET['paymethod']) && $_GET['seller'] ? dhtmlspecialchars(trim($_GET['seller'])) : '', 'tenpayaccount' => $_GET['tenpay_account'], 'item_name' => $_GET['item_name'], 'item_price' => $_GET['item_price'], 'item_number' => $_GET['item_number'], 'item_quality' => $_GET['item_quality'], 'item_locus' => $_GET['item_locus'], 'transport' => $_GET['transport'], 'postage_mail' => $_GET['postage_mail'], 'postage_express' => $_GET['postage_express'], 'postage_ems' => $_GET['postage_ems'], 'item_type' => $_GET['item_type'], 'item_costprice' => $_GET['item_costprice'], 'item_credit' => $_GET['item_credit'], 'item_costcredit' => $_GET['item_costcredit'])); if (!empty($_GET['tradeaid'])) { convertunusedattach($_GET['tradeaid'], $this->tid, $pid); } }
function global_footer(){ global $_G; extract($_G['cache']['plugin']['pao_reply_robot']); if($switch && date('H')>=$jointime && date('H')<=$overtime && CURSCRIPT=='forum'){ $forums = dunserialize($forums); $groups = dunserialize($groups); $limits = $limits ? (intval($limits)<1 ? 1 : intval($limits)) : 10; $percent = array('trigger'=>$limits / 100,'standby'=>(100-$limits)/100); if(count($forums)>0 && count($groups)>0 && $this->percent($percent)=='trigger'){ $timestamp = TIMESTAMP; $postes = preg_split("/[\r\n]/", $posts, -1, PREG_SPLIT_NO_EMPTY); $groups = implode(',', $groups); $forums = implode(',', $forums); $indays = $indays ? strtotime("-{$indays} day") : ''; $indays = $indays ? " AND dateline>". $indays : ''; $maxpost = $maxpost ? " AND replies<".$maxpost : ''; $attach = $attach ? " AND attachment>0" : ''; $thread = DB::fetch_all("SELECT tid,fid,subject FROM ".DB::table('forum_thread')." WHERE closed=0 AND displayorder>=0 AND fid IN ($forums) {$attach} {$indays} {$maxpost} ORDER BY RAND() LIMIT {$limits}"); foreach ($thread as $td) { $member = $this->member($groups); $fid = $td['fid']; $tid = $td['tid']; $uid = $member['uid']; $username = $member['username']; $message = $postes[array_rand($postes)]; $lastpost = "{$td['tid']}\t".addslashes($td['subject'])."\t{$timestamp}\t{$username}"; //updatemembercount($uid, array($extctype => $extcnum));╗§ио $pid = insertpost(array('fid' => $fid,'tid' => $tid,'first' => '0','author' => $username,'authorid' => $uid,'dateline' => $timestamp,'message' => $message,'useip' => '','invisible' => '0','anonymous' => '0','usesig' => 1,'htmlon' => '0','bbcodeoff' => 0,'smileyoff' => '0','parseurloff' => '0','attachment' => '0')); DB::query("UPDATE ".DB::table('forum_forum')." SET lastpost='$lastpost',posts=posts+1,todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); DB::query("UPDATE ".DB::table('forum_thread')." SET lastpost='$timestamp',replies=replies+1,views=views+'$views',lastposter='$username' WHERE tid='$tid'", 'UNBUFFERED'); DB::query("UPDATE ".DB::table('common_member_status')." SET lastpost='$timestamp',lastactivity='$timestamp',lastvisit='$timestamp' WHERE uid='$uid'", 'UNBUFFERED'); DB::query("UPDATE ".DB::table('common_member_count')." SET posts=posts+1 WHERE uid='$uid'", 'UNBUFFERED'); } } return; } }
$message = preg_replace("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto):\\/\\/|www\\.)([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\()|]+\\s*)/i", '', $message); $message = str_replace(explode(' ', lang('plugin/qqconnect', 'connect_reply_filter_smiley')), '', $message); if ($message) { $newmessage = censor($message, null, true); if ($message != $newmessage) { continue; //note 有过滤词直接跳过,不入库 } } else { $message = lang('plugin/qqconnect', 'connect_tthread_broadcast'); } if ($_G['setting']['connect']['t']['reply_showauthor']) { //$message .= lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $post['username'], 'nick' => $post['nick'])); $message .= '[tthread=' . $post['username'] . ', ' . $post['nick'] . ']' . $post['head'] . '[/tthread]'; } $pid = insertpost(array('fid' => $thread['fid'], 'tid' => $thread['tid'], 'first' => '0', 'author' => '', 'authorid' => '0', 'subject' => '', 'dateline' => $_G['timestamp'] + $i, 'message' => $message, 'useip' => '', 'invisible' => $pinvisible, 'anonymous' => '0', 'usesig' => '0', 'htmlon' => '1', 'bbcodeoff' => '0', 'smileyoff' => '0', 'parseurloff' => '0', 'attachment' => '0', 'status' => 16)); if ($pid) { $pids[] = $pid; } $i++; } //note 更新回复数及最后发表人 if ($pinvisible) { updatemoderate('pid', $pids); C::t('forum_forum')->update_forum_counter($thread['fid'], 0, 0, count($pids), 1); } else { $fieldarr = array('lastposter' => array(''), 'replies' => count($pids)); if ($thread['lastpost'] < $_G['timestamp']) { $fieldarr['lastpost'] = array($_G['timestamp']); } C::t('forum_thread')->increase($tid, $fieldarr);
} else { $tags = str_replace(array(chr(0xa1) . chr(0xa1), chr(0xa1) . chr(0x40), chr(0xe3) . chr(0x80) . chr(0x80)), ' ', $tags); $tagarray = array_unique(explode(' ', $tags)); } $tagarraynew = array(); foreach ($tagarray as $k => $tagname) { if (preg_match('/^([\\x7f-\\xff_-]|\\w){3,20}$/', $tagname)) { $tagarraynew[$k] = trim($tagname); } } $tagarray = $tagarraynew; unset($tagarraynew); } $pinvisible = $modnewreplies ? -2 : 0; $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $_G['gp_usesig'], 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => $attachment, 'tags' => implode(',', $tagarray))); ($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_G['gp_attachnew'] || $_G['gp_attachdel'] || $_G['gp_tradeaid']) && updateattach($postattachcredits, $tid, $pid, $_G['gp_attachnew'], $_G['gp_attachdel']); require_once libfile('function/trade'); trade_create(array('tid' => $tid, 'pid' => $pid, 'aid' => $_G['gp_tradeaid'], 'item_expiration' => $_G['gp_item_expiration'], 'thread' => $thread, 'discuz_uid' => $_G['uid'], 'author' => $author, 'seller' => empty($_G['gp_paymethod']) && $_G['gp_seller'] ? dhtmlspecialchars(trim($_G['gp_seller'])) : '', 'tenpayaccount' => $_G['gp_tenpay_account'], 'item_name' => $_G['gp_item_name'], 'item_price' => $_G['gp_item_price'], 'item_number' => $_G['gp_item_number'], 'item_quality' => $_G['gp_item_quality'], 'item_locus' => $_G['gp_item_locus'], 'transport' => $_G['gp_transport'], 'postage_mail' => $_G['gp_postage_mail'], 'postage_express' => $_G['gp_postage_express'], 'postage_ems' => $_G['gp_postage_ems'], 'item_type' => $_G['gp_item_type'], 'item_costprice' => $_G['gp_item_costprice'], 'item_credit' => $_G['gp_item_credit'], 'item_costcredit' => $_G['gp_item_costcredit'])); if (!empty($_G['gp_tradeaid'])) { DB::query("UPDATE " . DB::table('forum_attachment') . " SET tid='{$tid}', pid='{$pid}' WHERE aid='{$_G['gp_tradeaid']}' AND uid='{$_G['uid']}'"); } $param = array($_G['fid'], $tid, $pid); if ($modnewthreads) { DB::query("UPDATE " . DB::table('forum_forum') . " SET todayposts=todayposts+1 WHERE fid='{$_G['fid']}'", 'UNBUFFERED'); showmessage('post_newthread_mod_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param); } else { $feed = array(); if (!empty($_G['gp_addfeed']) && $_G['forum']['allowfeed'] && !$isanonymous) { $feed['icon'] = 'goods'; $feed['title_template'] = 'feed_thread_goods_title';
$parseurloff = !empty($_G['gp_parseurloff']); $htmlon = $_G['group']['allowhtml'] && !empty($_G['gp_htmlon']) ? 1 : 0; $usesig = !empty($_G['gp_usesig']) && $_G['group']['maxsigsize'] ? 1 : 0; $tagstr = addthreadtag($_G['gp_tags'], $tid); if ($_G['group']['allowreplycredit']) { if ($replycredit > 0 && $replycredit_real > 0) { updatemembercount($_G['uid'], array('extcredits' . $_G['setting']['creditstransextra'][10] => -$replycredit_real), 1, 'RCT', $tid); DB::query("INSERT INTO " . DB::table('forum_replycredit') . " (tid, extcredits, extcreditstype, times, membertimes, random)VALUES('{$tid}', '{$_G['gp_replycredit_extcredits']}', '{$_G[setting][creditstransextra][10]}', '{$_G['gp_replycredit_times']}', '{$_G['gp_replycredit_membertimes']}', '{$_G['gp_replycredit_random']}')"); } } if ($_G['group']['allowpostrushreply'] && $_G['gp_rushreply']) { DB::query("INSERT INTO " . DB::table('forum_threadrush') . " (tid, stopfloor, starttimefrom, starttimeto, rewardfloor) VALUES ('{$tid}', '{$_G['gp_stopfloor']}', '{$_G['gp_rushreplyfrom']}', '{$_G['gp_rushreplyto']}', '{$_G['gp_rewardfloor']}')"); } $pinvisible = $modnewthreads ? -2 : (empty($_G['gp_save']) ? 0 : -3); $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => DB::escape_str($_G['username']), 'authorid' => $_G['uid'], 'subject' => DB::escape_str($subject), 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr, 'replycredit' => 0, 'status' => defined('IN_MOBILE') ? 8 : 0)); if ($pid && getstatus($thread['status'], 1)) { savepostposition($tid, $pid); } $threadimageaid = 0; $threadimage = array(); if ($special == 4 && $_G['gp_activityaid']) { $threadimageaid = $_G['gp_activityaid']; convertunusedattach($_G['gp_activityaid'], $tid, $pid); } if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) { foreach ($sortaids as $sortaid) { convertunusedattach($sortaid, $tid, $pid); } } if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_G['gp_attachnew'] || $sortid || !empty($_G['gp_activityaid']))) {
cpmsg(lang('plugin/wechat', 'show_input_error'), '', 'error'); } if (@strtotime($_GET['starttimefrom']) === -1 || @strtotime($_GET['starttimefrom']) === FALSE) { cpmsg(lang('message', 'activity_fromtime_error'), '', 'error'); } elseif (trim($_GET['activityexpiration']) && (@strtotime($_GET['activityexpiration']) === -1 || @strtotime($_GET['activityexpiration']) === FALSE)) { cpmsg(lang('message', 'activity_totime_error'), '', 'error'); } $activity = array(); $activity['class'] = $_GET['activityclass']; $activity['starttimefrom'] = @strtotime($_GET['starttimefrom']); $activity['starttimeto'] = $_GET['starttimeto'] ? @strtotime($_GET['starttimeto']) : 0; $activity['place'] = $_GET['activityplace']; $activity['expiration'] = @strtotime($_GET['activityexpiration']); $newthread = array('fid' => $_GET['fid'], 'posttableid' => 0, 'readperm' => 0, 'price' => 0, 'typeid' => 0, 'sortid' => 0, 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $_GET['subject'], 'dateline' => TIMESTAMP, 'lastpost' => TIMESTAMP, 'lastposter' => $_G['username'], 'displayorder' => 1, 'digest' => 0, 'special' => 4, 'attachment' => 0, 'moderated' => 0, 'status' => 0, 'isgroup' => 0, 'replycredit' => 0, 'closed' => 0); $tid = C::t('forum_thread')->insert($newthread, true); $pid = insertpost(array('fid' => $_GET['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $_GET['subject'], 'dateline' => TIMESTAMP, 'message' => $_GET['message'], 'useip' => '', 'invisible' => 0, 'anonymous' => 0, 'usesig' => 0, 'htmlon' => 0, 'bbcodeoff' => 0, 'smileyoff' => 0, 'parseurloff' => 0, 'attachment' => '0', 'tags' => '', 'replycredit' => 0, 'status' => 0)); $data = array('tid' => $tid, 'uid' => $_G['uid'], 'cost' => 0, 'starttimefrom' => $activity['starttimefrom'], 'starttimeto' => $activity['starttimeto'], 'place' => $activity['place'], 'class' => $activity['class'], 'expiration' => $activity['expiration']); C::t('forum_activity')->insert($data); $setting['showactivity']['tids'][$tid] = $tid; $settings = array('mobilewechat' => serialize($setting)); C::t('common_setting')->update_batch($settings); updatecache(array('plugin', 'setting')); require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php'; wsq::report('pubshowactivity'); cpmsg(lang('plugin/wechat', 'show_addthread_succeed'), 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=showactivity_setting', 'succeed'); } } elseif ($ac == 'export') { if (!isset($setting['showactivity']['tids'][$_GET['tid']])) { cpmsg(lang('plugin/wechat', 'show_thread_not_found')); } $thread = get_thread_by_tid($_GET['tid']);
function article_reply($arr) { global $_G; require_once libfile('function/editor'); require_once libfile('function/post'); $time_arr = create_public_time($arr, count($arr['reply']), 1); //需传入已经发布的帖子的public_start_time $uid_arr = get_rand_uid($arr, 'reply'); $subject = addslashes($arr['title']); $view_num = $arr['view_num']; $tid = $arr['tid']; $reply_arr = $arr['reply']; if ($arr['public_reply_seq'] == 1) { shuffle($reply_arr); } //打乱回帖 //print_r($reply_arr);exit(); $replys = count($reply_arr); foreach ((array) $reply_arr as $k => $v) { $message = dstripslashes($v); $message = media_htmlbbcode($message, $arr['page_url']); $message = img_htmlbbcode($message, $arr['page_url']); $message = htmlspecialchars_decode(html2bbcode($message)); $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff'])); $smileyoff = checksmilies($message, !empty($_GET['smileyoff'])); $parseurloff = !empty($_GET['parseurloff']); $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0; $usesig = !empty($_GET['usesig']) ? 1 : ($_G['uid'] && $_G['group']['maxsigsize'] ? 1 : 0); $isanonymous = $_G['group']['allowanonymous'] && !empty($_GET['isanonymous']) ? 1 : 0; if (!$message || strlen($message) < 2) { continue; } $post_setarr = array('fid' => $arr['fid'], 'tid' => $tid, 'first' => '0', 'author' => $uid_arr[$k]['username'] ? $uid_arr[$k]['username'] : $_G['username'], 'authorid' => $uid_arr[$k]['uid'] ? $uid_arr[$k]['uid'] : $_G['uid'], 'subject' => '', 'dateline' => $time_arr[$k], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => 0, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => 0, 'replycredit' => 0, 'status' => defined('IN_MOBILE') ? 8 : 0); //$new[$k] = $post_setarr; if (DISCUZ_VERSION != 'X2') { //2.5版本 $post_setarr = dstripslashes($post_setarr); } else { $post_setarr = daddslashes($post_setarr); } $lastpost = $post_setarr['dateline']; $lastposter = $post_setarr['author']; $reply_pid = insertpost($post_setarr); $forum_arr['tid'] = $tid; $forum_arr['pid'] = $reply_pid; $forum_arr['is_post'] = 1; //标识是回复 $forum_arr['cookie'] = $arr['cookie']; $forum_arr['is_water_img'] = $arr['is_water_img']; $forum_arr['is_download_img'] = $arr['is_download_img']; $forum_arr['is_download_file'] = $arr['is_download_file']; $forum_arr['content'] = $v; $re_arr = forum_downremotefile($forum_arr); DB::query("UPDATE " . DB::table('common_member_count') . " SET posts=posts+1 WHERE uid='{$post_setarr['authorid']}'"); //更新数 } //今日发帖 $todayposts = 0; foreach ((array) $time_arr as $k => $v) { if (date("Yjn", $_G['timestamp']) == date("Yjn", $v)) { $todayposts++; } } DB::update('forum_thread', array('replies' => count($reply_arr), 'lastpost' => $lastpost, 'lastposter' => $lastposter), array('tid' => $tid)); $subject = str_replace("\t", ' ', $subject); $replys = $replys ? $replys : 1; $forum_lastpost = "{$tid}\t{$subject}\t{$lastpost}\t{$lastposter}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$forum_lastpost}', posts=posts+{$replys}, todayposts=todayposts+{$todayposts} WHERE fid='{$arr['fid']}'", 'UNBUFFERED'); //更新今日发帖这些数据 return TRUE; }
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']) { updatemoderate('tid', $this->tid); C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1); manage_addnotify('verifythread'); return 'post_newthread_mod_succeed'; } else { if ($this->param['displayorder'] != -4) { if ($this->param['digest']) { updatepostcredits('+', $this->member['uid'], 'digest', $this->forum['fid']); } updatepostcredits('+', $this->member['uid'], 'post', $this->forum['fid']); if ($this->param['isgroup']) { C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 1); } $subject = str_replace("\t", ' ', $this->param['subject']); $lastpost = "{$this->tid}\t" . $subject . "\t" . TIMESTAMP . "\t{$author}"; C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($this->forum['fid'], 1, 1, 1); if ($this->forum['type'] == 'sub') { C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost)); } } if ($this->param['isgroup']) { C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP)); require_once libfile('function/grouplog'); updategroupcreditlog($this->forum['fid'], $this->member['uid']); } C::t('forum_sofa')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid'])); return 'post_newthread_succeed'; } }
updatepostcredits('+', $_G['uid'], 'post', $var['fidnumber']); $lastpost = "{$tid}\t" . addslashes($subject) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); $tidnumber = $tid; } else { $tidnumber = $stats['qdtidnumber']; $thread = DB::fetch_first("SELECT subject FROM " . DB::table('forum_thread') . " WHERE tid='{$tidnumber}'"); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($num >= 1 && $num <= 9 && $exacr && $exacz) { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } require_once libfile('function/post'); require_once libfile('function/forum'); $pid = insertpost(array('fid' => $var['fidnumber'], 'tid' => $tidnumber, 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], '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')); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$tidnumber}' AND fid='{$var['fidnumber']}'", 'UNBUFFERED'); updatepostcredits('+', $_G['uid'], 'reply', $var['fidnumber']); $lastpost = "{$tidnumber}\t" . addslashes($thread['subject']) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); } } if (memory('check')) { memory('set', 'dsu_pualsign_' . $_G['uid'], $_G['timestamp'], 86400); } if ($num == 0) { if ($stats['todayq'] > $stats['highestq']) { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET highestq='{$stats['todayq']}' WHERE id='1'"); } DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET yesterdayq='{$stats['todayq']}',todayq=1 WHERE id='1'"); } else {
function bbs_post($input) { global $_G; require_once libfile('function/post'); require_once libfile('function/forum'); $subject = $input['title']; $message = stripslashes($input['text']); $auid = $input['uid']; $au = $input['username']; $fid = $input['fid']; $dateline = TIMESTAMP; $data = array('fid' => $fid, 'subject' => $subject, 'dateline' => $dateline, 'lastpost' => $dateline, 'author' => $au, 'authorid' => $auid); $tid = DB::insert("forum_thread", $data, $tid = true); $pid = insertpost(array('tid' => $tid, 'fid' => $fid, 'first' => 1, 'subject' => $subject, 'message' => $message, 'dateline' => $dateline, 'author' => $au, 'authorid' => $auid, 'htmlon' => "1")); updatepostcredits('+', $_G['uid'], 'post', $fid); $synclastpost = "{$tid}\t" . addslashes($subject) . "\t{$_G[timestamp]}\t{$_G[username]}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$synclastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$fid}'", 'UNBUFFERED'); return $tid; }
public function getPublishPollObj() { function isdate($str, $format = "Y-m-d") { $strArr = explode("-", $str); if (empty($strArr)) { return false; } foreach ($strArr as $val) { if (strlen($val) < 2) { $val = "0" . $val; } $newArr[] = $val; } $str = implode("-", $newArr); $unixTime = strtotime($str); $checkDate = date($format, $unixTime); if ($checkDate == $str) { return true; } else { return false; } } $rPostion = $_GET['r'] ? $_GET['r'] : 0; $longitude = $_GET['longitude']; $latitude = $_GET['latitude']; $location = echo_urldecode($_GET['location']); $aid = $_REQUEST['aid']; $aid_Img = explode(',', $aid); $_G['fid'] = $_GET['boardId']; require_once '../tool/mobcentDatabase.php'; $info = new mobcentGetInfo(); $modnewposts = $info->getBoard($_G['fid']); $readperm = 0; $price = 0; $typeid = 0; $sortid = 0; $displayorder = $modnewposts['modnewposts'] > 0 ? -2 : 0; $digest = 0; $special = 1; /*tou piao tie, $special=1 */ $attachment = 0; $moderated = 0; $isgroup = 0; $replycredit = 0; $closed = 0; $publishdate = time(); $accessSecret = $_GET['accessSecret']; $accessToken = $_GET['accessToken']; $qquser = Common::get_unicode_charset('\\u6e38\\u5ba2'); $group = $info->rank_check_allow($accessSecret, $accessToken, $qquser); if (!$group['allowvisit']) { $data_post['rs'] = 0; $data_post['errcode'] = '01110001'; return $data_post; exit; } $arrAccess = $info->sel_accessTopkent($accessSecret, $accessToken); $ruid = $_G['uid'] = $arrAccess['user_id']; $space = $info->getUserInfo(intval($ruid)); if (empty($_G['uid'])) { return $info->userAccessError(); exit; } $author = $space['username']; $_G['username'] = $lastposter = $author; $_G = array_merge($_G, $space); $a = array("qq" => "a", "ff" => "b"); $b = array("ss" => "c", "dd" => "d"); $c = array(); foreach ($a as $key => $value) { $c[$key] = $value; } foreach ($b as $key => $value) { $c[$key] = $value; } /*renxing vote data and check */ $pollItem = echo_array(urldecode($_GET['pollItem'])); $pollarray = array(); foreach ($pollItem as $poll) { $pitems[] = $poll[itemName]; } if (count($pitems) > 20) { $data_post['rs'] = 0; $data_post['errcode'] = '04000020'; return $data_post; exit; } if (count($pitems) < 2) { $data_post['rs'] = 0; $data_post['errcode'] = '04000021'; return $data_post; exit; } if (!preg_match("/^\\d*\$/", trim($_GET['type']))) { $data_post['rs'] = 0; $data_post['errcode'] = '04000022'; return $data_post; exit; } if (!preg_match("/^\\d*\$/", trim($_GET['deadline']))) { $data_post['rs'] = 0; $data_post['errcode'] = '04000023'; return $data_post; exit; } $pollarray[maxchoices] = empty($_GET['type']) ? 0 : $_GET['type']; $pollarray[multiple] = empty($_GET['type']) || intval($_GET['type']) == 1 ? 0 : 1; $pollarray[options] = $pitems; $pollarray[visible] = empty($_GET['isVisible']); $pollarray[overt] = !empty($_GET['overt']); if (empty($_GET['deadline'])) { $pollarray['expiration'] = 0; } else { $pollarray['expiration'] = TIMESTAMP + 86400 * $_GET['deadline']; } /*end check */ $subject = echo_urldecode($_GET['title']); $message = ''; $i = 0; $array_message = echo_array(urldecode($_GET['content'])); foreach ($array_message as $k => $v) { switch ($v["type"]) { case 0: $message .= $v["infor"]; break; case 1: if (empty($aid_Img)) { $message .= '[attachimg]' . $aid . '[/attachimg]'; } else { $message .= '[attachimg]' . $aid_Img[$i] . '[/attachimg]'; $i = $i + 1; } $attachment = 2; break; case 3: $message .= "[audio]" . $v["infor"] . "[/audio]"; break; } } /* 判断是否发匿名与仅该作者可见贴*/ $isOnlyAuthor = $_GET['isOnlyAuthor'] ? $_GET['isOnlyAuthor'] : 0; $thread['status'] = 32; $isOnlyAuthor == 1 && ($thread['status'] = setstatus(2, 1, $thread['status'])); $isAnonymous = $_GET['isAnonymous'] ? $_GET['isAnonymous'] : 0; $author = !$isAnonymous ? $_G['username'] : ''; $newthread = array('fid' => $_G['fid'], 'posttableid' => 0, 'readperm' => $readperm, 'price' => $price, 'typeid' => $typeid, 'sortid' => $sortid, 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => $displayorder, 'digest' => $digest, 'special' => $special, 'attachment' => $attachment, 'moderated' => $moderated, 'status' => $thread['status'], 'isgroup' => $isgroup, 'replycredit' => $replycredit, 'closed' => $closed); $tid = C::t('forum_thread')->insert($newthread, true); if ($modnewposts['modnewposts'] > 0) { table_forum_thread_moderate::insert($tid, 0, time()); } if (!$tid) { echo '{"rs":0}'; exit; } useractionlog($_G['uid'], 'tid'); C::t('common_member_field_home')->update($_G['uid'], array('recentnote' => $subject)); $pinvisible = $modnewposts['modnewposts'] > 0 ? -2 : 0; $isanonymous = 0; $usesig = 1; $htmlon = 0; $bbcodeoff = -1; $smileyoff = -1; $parseurloff = false; $tagstr = null; $message = htmlspecialchars_decode($message); $_G['group']['allowat'] = substr_count($message, '@'); if ($_G['group']['allowat']) { $bbcodeoff = 0; $atlist = $atlist_tmp = array(); $res = preg_match_all("#@([^\r\n]*?)\\s#i", $message . ' ', $atlist_tmp); $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']); if (!empty($atlist_tmp)) { if (empty($_G['setting']['at_anyone'])) { foreach (C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) { $atlist[$row['followuid']] = $row['fusername']; } if (count($atlist) < $_G['group']['allowat']) { $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $atlist_tmp); foreach ($query as $row) { $atlist[$row['fuid']] = $row['fusername']; } } } else { foreach (C::t('common_member')->fetch_all_by_username($atlist_tmp) as $row) { $atlist[$row['uid']] = $row['username']; } } } if ($atlist) { foreach ($atlist as $atuid => $atusername) { $atsearch[] = "/@{$atusername} /i"; $atreplace[] = "[url=home.php?mod=space&uid={$atuid}]@{$atusername}[/url] "; } $message = preg_replace($atsearch, $atreplace, $message . ' ', 1); } } /*renxing vote insert*/ foreach ($pollarray['options'] as $polloptvalue) { $polloptvalue = dhtmlspecialchars(trim($polloptvalue)); C::t('forum_polloption')->insert(array('tid' => $tid, 'polloption' => $polloptvalue)); } $polloptionpreview = ''; $query = C::t('forum_polloption')->fetch_all_by_tid($tid, 1, 2); foreach ($query as $option) { $polloptvalue = preg_replace("/\\[url=(https?){1}:\\/\\/([^\\[\"']+?)\\](.+?)\\[\\/url\\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $option['polloption']); $polloptionpreview .= $polloptvalue . "\t"; } $polloptionpreview = daddslashes($polloptionpreview); $data = array('tid' => $tid, 'multiple' => $pollarray['multiple'], 'visible' => $pollarray['visible'], 'maxchoices' => $pollarray['maxchoices'], 'expiration' => $pollarray['expiration'], 'overt' => $pollarray['overt'], 'pollpreview' => $polloptionpreview); C::t('forum_poll')->insert($data); /*end renxing vote insert*/ $class_tag = new tag(); $tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid'); $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $message = $_GET['platType'] == 1 ? $message . "\r\n[url=/mobcent/download/down.php]" . Common::get_unicode_charset('\\u6765\\u81ea\\u5b89\\u5353\\u5ba2\\u6237\\u7aef') . '[/url]' : $message . "\r\n[url=/mobcent/download/down.php]" . Common::get_unicode_charset('\\u6765\\u81ea\\u0069\\u0070\\u0068\\u006f\\u006e\\u0065\\u5ba2\\u6237\\u7aef') . "[/url]"; $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => time(), 'message' => $message, 'useip' => get_client_ip(), 'invisible' => $pinvisible, 'anonymous' => $isAnonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => 0, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => $attachment, 'tags' => $tagstr, 'replycredit' => 0, 'status' => 0)); if ($_G['group']['allowat'] && $atlist) { foreach ($atlist as $atuid => $atusername) { mobcent_helper_notification::notification_add($_G['username'], $atuid, 'at', 'at_message', $_G['uid'], array('from_id' => $tid, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $tid, 'subject' => $subject, 'pid' => $pid, 'message' => messagecutstr($message, 150))); } set_atlist_cookie(array_keys($atlist)); } if (empty($aid_Img)) { $threadimageaid = $aid; if ($aid) { $tableid = getattachtableid($tid); $query = get_forum_attachment_unused($aid); while ($attach = DB::fetch($query)) { $aids = $attach['aid']; $data = $attach; } $uid = $_G['uid']; update_forum_attachment($tid, $tableid, $uid, $pid, $aids); $data['uid'] = 1; $data['tid'] = $tid; $data['pid'] = $pid; C::t('forum_attachment_n')->insert($tableid, $data); } $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => ''); $param = array(); if ($_G['forum']['picstyle']) { if (!setthreadcover($pid, 0, $threadimageaid)) { preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER); $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>"; $param['clean_msgforward'] = 1; $param['timeout'] = $param['refreshtime'] = 15; } } if ($threadimageaid && empty($imagearr)) { if (!$threadimage) { $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid); } $threadimage = daddslashes($threadimage); C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote'])); } } else { $isInsertForumImage = false; foreach ($aid_Img as $key => $val) { $threadimageaid = $val; if ($val) { $tableid = getattachtableid($tid); $query = DB::query("SELECT * FROM %t WHERE aid=%d", array('forum_attachment_unused', $val)); while ($attach = DB::fetch($query)) { $aids = $attach['aid']; $data = $attach; } DB::query("UPDATE %t SET tid=%d,tableid=%d,uid=%d,pid=%d WHERE aid IN (%n)", array('forum_attachment', $tid, getattachtableid($tid), $_G['uid'], $pid, $aids)); $data['uid'] = 1; $data['tid'] = $tid; $data['pid'] = $pid; C::t('forum_attachment_n')->insert($tableid, $data); } $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => ''); $param = array(); if ($_G['forum']['picstyle']) { if (!setthreadcover($pid, 0, $threadimageaid)) { preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER); $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>"; $param['clean_msgforward'] = 1; $param['timeout'] = $param['refreshtime'] = 15; } } if (!$isInsertForumImage && $threadimageaid && empty($imagearr)) { if (!$threadimage) { $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid); } $threadimage = daddslashes($threadimage); C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote'])); $isInsertForumImage = true; } } } $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array()); if (1) { $message = !$price && !$readperm ? $message : ''; if ($special == 0) { $feed['icon'] = 'thread'; $feed['title_template'] = 'feed_thread_title'; $feed['body_template'] = 'feed_thread_message'; $feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'message' => messagecutstr($message, 150)); if (!empty($_G['forum_attachexist'])) { $imgattach = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'pid', $pid); $firstaid = $imgattach['aid']; unset($imgattach); if ($firstaid) { $feed['images'] = array(getforumimg($firstaid)); $feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}"); } } } elseif ($special > 0) { if ($special == 1) { $pvs = explode("\t", messagecutstr($polloptionpreview, 150)); $s = ''; $i = 1; foreach ($pvs as $pv) { $s .= $i . '. ' . $pv . '<br />'; } $s .= ' ...'; $feed['icon'] = 'poll'; $feed['title_template'] = 'feed_thread_poll_title'; $feed['body_template'] = 'feed_thread_poll_message'; $feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'message' => $s); } elseif ($special == 3) { $feed['icon'] = 'reward'; $feed['title_template'] = 'feed_thread_reward_title'; $feed['body_template'] = 'feed_thread_reward_message'; $feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'rewardprice' => $rewardprice, 'extcredits' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title']); } elseif ($special == 4) { $feed['icon'] = 'activity'; $feed['title_template'] = 'feed_thread_activity_title'; $feed['body_template'] = 'feed_thread_activity_message'; $feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'starttimefrom' => $_GET['starttimefrom'][$activitytime], 'activityplace' => $activity['place'], 'message' => messagecutstr($message, 150)); if ($_GET['activityaid']) { $feed['images'] = array(getforumimg($_GET['activityaid'])); $feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}"); } } elseif ($special == 5) { $feed['icon'] = 'debate'; $feed['title_template'] = 'feed_thread_debate_title'; $feed['body_template'] = 'feed_thread_debate_message'; $feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'message' => messagecutstr($message, 150), 'affirmpoint' => messagecutstr($affirmpoint, 150), 'negapoint' => messagecutstr($negapoint, 150)); } } $feed['title_data']['hash_data'] = "tid{$tid}"; $feed['id'] = $tid; $feed['idtype'] = 'tid'; if ($feed['icon']) { postfeed($feed); } } if ($digest) { updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']); } updatepostcredits('+', $_G['uid'], 'post', $_G['fid']); if ($isgroup) { C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 1); } if (!$pid) { $obj->rs = SUCCESS; echo echo_json($obj); exit; } $subject = str_replace("\t", ' ', $subject); $lastpost = "{$tid}\t" . $subject . "\t{$publishdate}\t{$author}"; C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($_G['fid'], 1, 1, 1); DB::query("DELETE FROM %t WHERE uid=%d", array('forum_attachment_unused', $_G['uid'])); if (isset($rPostion) && !empty($rPostion)) { surround_user::insert_all_thread_location($longitude, $latitude, $location, $pid); } $data_post["rs"] = 1; $data_post["content"] = $modnewposts['modnewposts'] > 0 ? Common::get_unicode_charset('\\u65b0\\u4e3b\\u9898\\u9700\\u8981\\u5ba1\\u6838\\uff0c\\u60a8\\u7684\\u5e16\\u5b50\\u901a\\u8fc7\\u5ba1\\u6838\\u540e\\u624d\\u80fd\\u663e\\u793a') : ''; return $data_post; }
private function _startSign($res) { global $_G; loadcache('pluginlanguage_script'); $lang = $_G['cache']['pluginlanguage_script']['dsu_paulsign']; //获取语言包 $var = $_G['cache']['plugin']['dsu_paulsign']; // 获取插件的配置信息 if (!$var['ifopen']) { if ($var['plug_clsmsg'] == '') { $var['plug_clsmsg'] = WebUtils::t('签到插件没有开启'); } return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$var['plug_clsmsg']}"); } $htime = dgmdate($_G['timestamp'], 'H', $var['tos']); // 获取当前的时间,小时 $groups = unserialize($var['groups']); // 获取允许签到的用户组 // 本月签到的处理 $qddb = DB::fetch_first("SELECT time FROM " . DB::table('dsu_paulsign') . " ORDER BY time DESC limit 0,1"); $lastmonth = dgmdate($qddb['time'], 'm', $var['tos']); $nowmonth = dgmdate($_G['timestamp'], 'm', $var['tos']); if ($nowmonth != $lastmonth) { DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET mdays=0 WHERE uid"); } // 获取当前用户发贴总数 $post = DB::fetch_first("SELECT posts FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'"); $read_ban = explode(",", $var['ban']); //查看黑名单用户 // 用户签到的信息 $qiandaodb = DB::fetch_first("SELECT * FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'"); $tdtime = gmmktime(0, 0, 0, dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos'])) - $var['tos'] * 3600; // 心情初始化 // $emots = unserialize($_G['setting']['paulsign_emot']); $_GET['qdxq'] = 'kx'; $credit = mt_rand($var['mincredit'], $var['maxcredit']); // 奖励积分值的设置 // 客户端奖励倍数 $appbymePlug = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_sign_extcredit_base'); $appbymePlug = $appbymePlug !== false ? $appbymePlug : 100; $credit = $appbymePlug * 0.01 * $credit; $jlxgroups = unserialize($var['jlxgroups']); //奖励增倍的指定用户组选择 //前N额外奖励项自定义 $njlmain = str_replace(array("\r\n", "\n", "\r"), '/hhf/', $var['jlmain']); $extreward = explode("/hhf/", $njlmain); $extreward_num = count($extreward); $stats = DB::fetch_first("SELECT * FROM " . DB::table('dsu_paulsignset') . " WHERE id='1'"); // 判断是否开启时间段限制 if ($var['timeopen']) { if ($htime < $var['stime']) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_timeearly1']}{$var[stime]}{$lang['ts_timeearly2']}"); } elseif ($htime > $var['ftime']) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_timeov']}"); } } // 判断允许签到的用户组 if (!in_array($_G['groupid'], $groups)) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_notallow']}"); } // 判断当前用户的发帖总数是否允许签到 if ($var['mintdpost'] > $post['posts']) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_minpost1']}{$var[mintdpost]}{$lang['ts_minpost2']}"); } //判断当前用户是否在黑名单中 if (in_array($_G['uid'], $read_ban)) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_black']}"); } // 当前用户是否签到的判断 if ($qiandaodb['time'] > $tdtime) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_yq']}"); } // 心情的处理 // if (!array_key_exists($_GET['qdxq'], $emots)) { // return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT.":{$lang['ts_xqnr']}"); // } // 今日想说的话 $todaysay = WebUtils::getDzPluginAppbymeAppConfig('mobile_sign_text'); empty($todaysay) && ($todaysay = $lang['wttodaysay']); //判断签到进程锁 if ($var['lockopen']) { while (discuz_process::islocked('dsu_paulsign', 5)) { usleep(100000); } } // jlx : 指定用户组获取奖励是一般的几倍 if (in_array($_G['groupid'], $jlxgroups) && $var['jlx'] !== '0') { $credit = $credit * $var['jlx']; } // 连续签到指数开关 if ($tdtime - $qiandaodb['time'] < 86400 && $var['lastedop'] && $qiandaodb['lasted'] !== '0') { $randlastednum = mt_rand($var['lastednuml'], $var['lastednumh']); $randlastednum = sprintf("%03d", $randlastednum); $randlastednum = '0.' . $randlastednum; $randlastednum = $randlastednum * $qiandaodb['lasted']; $credit = round($credit * (1 + $randlastednum)); } $num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('dsu_paulsign') . " WHERE time >= {$tdtime} "); if (!$qiandaodb['uid']) { DB::query("INSERT INTO " . DB::table('dsu_paulsign') . " (uid,time) VALUES ('{$_G['uid']}',{$_G['timestamp']})"); } // 连续签到指数 if ($tdtime - $qiandaodb['time'] < 86400 && $var['lastedop']) { DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET days=days+1,mdays=mdays+1,time='{$_G['timestamp']}',qdxq='{$_GET['qdxq']}',todaysay='{$todaysay}',reward=reward+{$credit},lastreward='{$credit}',lasted=lasted+1 WHERE uid='{$_G['uid']}'"); } else { DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET days=days+1,mdays=mdays+1,time='{$_G['timestamp']}',qdxq='{$_GET['qdxq']}',todaysay='{$todaysay}',reward=reward+{$credit},lastreward='{$credit}',lasted='1' WHERE uid='{$_G['uid']}'"); } // 添加积分操作 updatemembercount($_G['uid'], array($var['nrcredit'] => $credit)); require_once libfile('function/post'); require_once libfile('function/forum'); // 是否同步到记录 if ($var['sync_say'] && $_GET['qdmode'] == '1') { } // 是否同步到广播大厅 if ($var['sync_follow'] && $_GET['qdmode'] == '1' && $_G['setting']['followforumid']) { } // 每日最想说是否同步到签名 if ($var['sync_sign'] && $_G['group']['maxsigsize']) { $signhtml = cutstr(strip_tags($todaysay . $lang['fromsign']), $_G['group']['maxsigsize']); DB::update('common_member_field_forum', array('sightml' => $signhtml), "uid='{$_G['uid']}'"); } // 对前N额外奖励项 if ($num <= $extreward_num - 1) { list($exacr, $exacz) = explode("|", $extreward[$num]); $psc = $num + 1; if ($exacr && $exacz) { updatemembercount($_G['uid'], array($exacr => $exacz)); } } // 获取主题和帖子要插入的状态信息 $topicStatus = $this->getClientApp('topic', $_GET['platType']); $postStatus = $this->getClientApp('post', $_GET['platType']); // 对签到自动回复的类型进行处理 // 2:指定贴自动回复 if ($var['qdtype'] == '2') { $thread = DB::fetch_first("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid='{$var['tidnumber']}'"); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($num >= 0 && $num <= $extreward_num - 1 && $exacr && $exacz) { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}.{$another_vip}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } $pid = insertpost(array('fid' => $thread['fid'], 'tid' => $var['tidnumber'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], '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', 'status' => $postStatus)); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$var['tidnumber']}' AND fid='{$thread['fid']}'", 'UNBUFFERED'); updatepostcredits('+', $_G['uid'], 'reply', $thread['fid']); $lastpost = "{$thread['tid']}\t" . addslashes($thread['subject']) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$thread['fid']}'", 'UNBUFFERED'); $tidnumber = $var['tidnumber']; // 指定板块每天一主题 } elseif ($var['qdtype'] == '3') { if ($num == '0' || $stats['qdtidnumber'] == '0') { $subject = str_replace(array('{m}', '{d}', '{y}', '{bbname}', '{author}'), array(dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos']), $_G['setting']['bbname'], $_G['username']), $var['title_thread']); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($exacr && $exacz) { $message = "[quote][size=2][color=dimgray]{$lang[tsn_10]}[/color][url={$_G[siteurl]}plugin.php?id=dsu_paulsign:sign][color=darkorange]{$lang[tsn_11]}[/color][/url][color=dimgray]{$lang[tsn_12]}[/color][/size][/quote][quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$lang[tsn_13]}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=dimgray]{$lang[tsn_10]}[/color][url={$_G[siteurl]}plugin.php?id=dsu_paulsign:sign][color=darkorange]{$lang[tsn_11]}[/color][/url][color=dimgray]{$lang[tsn_12]}[/color][/size][/quote][quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$lang[tsn_13]}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } 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, highlight, closed, status, isgroup) VALUES ('{$var['fidnumber']}', '0', '0', '0', '{$var['qdtypeid']}', '0', '{$_G['username']}', '{$_G['uid']}', '{$subject}', '{$_G['timestamp']}', '{$_G['timestamp']}', '{$_G['username']}', '0', '0', '0', '0', '1', '1', '1', '{$topicStatus}', '0')"); $tid = DB::insert_id(); DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET qdtidnumber = '{$tid}' WHERE id='1'"); $pid = insertpost(array('fid' => $var['fidnumber'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['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', 'status' => $postStatus)); $expiration = $_G['timestamp'] + 86400; DB::query("INSERT INTO " . DB::table('forum_thread') . "mod (tid, uid, username, dateline, action, expiration, status) VALUES ('{$tid}', '{$_G['uid']}', '{$_G['username']}', '{$_G['timestamp']}', 'EHL', '{$expiration}', '1')"); DB::query("INSERT INTO " . DB::table('forum_thread') . "mod (tid, uid, username, dateline, action, expiration, status) VALUES ('{$tid}', '{$_G['uid']}', '{$_G['username']}', '{$_G['timestamp']}', 'CLS', '0', '1')"); updatepostcredits('+', $_G['uid'], 'post', $var['fidnumber']); $lastpost = "{$tid}\t" . addslashes($subject) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); $tidnumber = $tid; } else { $tidnumber = $stats['qdtidnumber']; $thread = DB::fetch_first("SELECT subject FROM " . DB::table('forum_thread') . " WHERE tid='{$tidnumber}'"); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($num >= 1 && $num <= $extreward_num - 1 && $exacr && $exacz) { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } // $message = $this->getClientApp($message, $_GET['platType']); $pid = insertpost(array('fid' => $var['fidnumber'], 'tid' => $tidnumber, 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], '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', 'status' => $postStatus)); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$tidnumber}' AND fid='{$var['fidnumber']}'", 'UNBUFFERED'); updatepostcredits('+', $_G['uid'], 'reply', $var['fidnumber']); $lastpost = "{$tidnumber}\t" . addslashes($thread['subject']) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); } } if (memory('check')) { memory('set', 'dsu_pualsign_' . $_G['uid'], $_G['timestamp'], 86400); } if ($num == 0) { if ($stats['todayq'] > $stats['highestq']) { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET highestq='{$stats['todayq']}' WHERE id='1'"); } DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET yesterdayq='{$stats['todayq']}',todayq=1 WHERE id='1'"); DB::query("UPDATE " . DB::table('dsu_paulsignemot') . " SET count=0"); } else { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET todayq=todayq+1 WHERE id='1'"); } DB::query("UPDATE " . DB::table('dsu_paulsignemot') . " SET count=count+1 WHERE qdxq='{$_GET['qdxq']}'"); $lasted = DB::result_first("SELECT lasted FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'"); if ($exacr && $exacz) { $message = "{$lang[tsn_14]}{$lang[tsn_03]}{$lang[tsn_04]}{$psc}{$lang[tsn_15]}{$lang[classn_12]}{$lasted}{$lang[classn_02]}{$lang[tsn_06]}{$_G[setting][extcredits][$var[nrcredit]][title]}{$credit}{$_G[setting][extcredits][$var[nrcredit]][unit]}{$lang[tsn_16]}{$_G[setting][extcredits][$exacr][title]}{$exacz}{$_G[setting][extcredits][$exacr][unit]}"; return WebUtils::makeErrorInfo_oldVersion($res, $message, $params = array('noError' => 1)); } else { $psc = $num + 1; $message = "{$lang[tsn_14]}{$lang[tsn_03]}{$lang[tsn_04]} {$psc} {$lang[tsn_15]}{$lang[classn_12]} {$lasted} {$lang[classn_02]}{$lang[tsn_06]}{$_G[setting][extcredits][$var[nrcredit]][title]} {$credit} {$_G[setting][extcredits][$var[nrcredit]][unit]}"; return WebUtils::makeErrorInfo_oldVersion($res, $message, $params = array('noError' => 1)); } }
function instertoforum($data) { global $_G; $subject = $data['subject']; $message = $data['message']; $author = $data['username']; $authorid = $data['uid']; $publishdate = TIMESTAMP; $closed = 0; $replycredit = 0; $isgroup = 0; $moderated = 0; $special = 0; $displayorder = $data['isshow'] == 1 && $data['status'] == 1 ? 0 : -1; $newthread = array('fid' => $data['fid'], 'posttableid' => 0, 'readperm' => 0, 'price' => 0, 'typeid' => 0, 'sortid' => 0, 'author' => $author, 'authorid' => $data['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => $displayorder, 'digest' => $digest, 'special' => $special, 'attachment' => 0, 'moderated' => $moderated, 'status' => 0, 'isgroup' => $isgroup, 'replycredit' => $replycredit, 'closed' => 0); $tid = C::t('#sanree_brand#forum_thread')->insert($newthread, true); if ($displayorder != 0) { $newrow = array('tid' => $tid, 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => TIMESTAMP, 'expiration' => 0, 'action' => 'DEL', 'status' => 1, 'magicid' => 0, 'stamp' => 0, 'reason' => srlang('warningdelete')); C::t('#sanree_brand#forum_threadmod')->insert($newrow, true); } useractionlog($data['uid'], 'tid'); require_once libfile('function/forum'); require_once libfile('function/post'); $bbcodeoff = 0; //checkbbcodes($message, 0); $smileyoff = 0; //checksmilies($message, 0); $parseurloff = 1; $htmlon = 0; $usesig = 1; $tagstr = ''; $pinvisible = 0; $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $pid = insertpost(array('fid' => $data['fid'], 'tid' => $tid, 'first' => '1', 'author' => $data['username'], 'authorid' => $data['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'message' => $message, 'useip' => $data['ip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr, 'replycredit' => 0, 'status' => 0)); $subject = str_replace("\t", ' ', $subject); $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}"; C::t('#sanree_brand#forum_forum')->update($data['fid'], array('lastpost' => $lastpost)); C::t('#sanree_brand#forum_forum')->update_forum_counter($data['fid'], 1, 1, 1); return array($tid, $pid); }
<?php define('APPTYPEID', 2); define('CURSCRIPT', 'forum'); require '../source/class/class_core.php'; require '../source/function/function_forum.php'; C::app()->init(); isset($_REQUEST['tid']) ? $tid = $_REQUEST['tid'] : ($res['err'] = 1); isset($_REQUEST['author']) ? $author = $_REQUEST['author'] : ($res['err'] = 1); isset($_REQUEST['uid']) ? $uid = $_REQUEST['uid'] : ($res['err'] = 1); $message = isset($_REQUEST['message']) ? $_REQUEST['message'] : ''; $message = iconv('utf-8', 'gbk', $message); $author = iconv('utf-8', 'gbk', $author); if ($res['err'] != 1) { $pid = insertpost(array('fid' => 1004, 'tid' => $tid, 'first' => '0', 'author' => $author, 'authorid' => $uid, 'subject' => '', 'dateline' => time(), 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => 0, 'anonymous' => 0, 'usesig' => 1, 'htmlon' => 0, 'bbcodeoff' => false, 'smileyoff' => -1, 'parseurloff' => false, 'attachment' => '0', 'tags' => '', 'replycredit' => 0, 'status' => 100)); if ($pid) { updatethreadcount($tid, 0); C::t('forum_forum')->update_forum_counter(1005, 0, 1, 1); $res['tid'] = $tid; $res['pid'] = $pid; $res['err'] = 0; } } function updatethreadcount($tid, $updateattach = 0) { $replycount = C::t('forum_post')->count_visiblepost_by_tid($tid) - 1; $lastpost = C::t('forum_post')->fetch_visiblepost_by_tid('tid:' . $tid, $tid, 0, 1); $lastpost['author'] = $lastpost['anonymous'] ? lang('forum/misc', 'anonymous') : addslashes($lastpost['author']); $lastpost['dateline'] = !empty($lastpost['dateline']) ? $lastpost['dateline'] : TIMESTAMP; $data = array('replies' => $replycount, 'lastposter' => $lastpost['author'], 'lastpost' => $lastpost['dateline']); if ($updateattach) {
/** * 运行插入 */ function execInsert() { if (empty($this->_postData)) { return false; } if (version_compare(XWB_S_VERSION, 2, '>=')) { require_once libfile('function/forum'); } //写入帖子表(由于分表的存在,故只能采取DX自带函数insertpost) foreach ($this->_postData as $post) { insertpost($post); } //更新主帖表相关信息 if (false == $this->_checkPostPeriods()) { foreach ($this->_threadData as $tid => $tidInfo) { $this->_db->query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$tidInfo['lastposter']}', lastpost='{$tidInfo['lastpost']}', replies=replies+{$tidInfo['replies']} WHERE tid='{$tid}'", 'UNBUFFERED'); } } //更新个人回帖数 if ($this->_userConfig['uid'] > 0 && $this->_userReplyCount > 0) { $this->_db->query("UPDATE " . DB::table('common_member_count') . " SET posts=posts+{$this->_userReplyCount} WHERE uid='{$this->_userConfig['uid']}'", 'UNBUFFERED'); } //更新板块表相关信息 foreach ($this->_forumData as $fid => $fidInfo) { if (false == $this->_checkPostPeriods()) { $this->_db->query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$fidInfo['lastpost']}', posts=posts+{$fidInfo['posts']}, todayposts=todayposts+{$fidInfo['posts']} WHERE fid='{$fid}'", 'UNBUFFERED'); } else { $this->_db->query("UPDATE " . DB::table('forum_forum') . " SET todayposts=todayposts+{$fidInfo['todayposts']} ,modworks='1' WHERE fid='{$fid}'", 'UNBUFFERED'); } } return true; }
$thread['dateline'] = $thread['lastpost'] = TIMESTAMP; $thread['lastposter'] = $thread['author']; $thread['views'] = $thread['replies'] = $thread['highlight'] = $thread['digest'] = 0; $thread['rate'] = $thread['displayorder'] = $thread['attachment'] = 0; $posttableid = getposttableid('p'); $thread['posttableid'] = $posttableid; $threadid = DB::insert('forum_thread', $thread, true); $posttable = getposttablebytid($_G['tid']); if ($post = DB::fetch_first("SELECT * FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND first=1 LIMIT 1")) { $post['pid'] = ''; $post['tid'] = $threadid; $post['fid'] = $copyto; $post['dateline'] = TIMESTAMP; $post['attachment'] = 0; $post['invisible'] = $post['rate'] = $post['ratetimes'] = 0; $pid = insertpost($post); } updatepostcredits('+', $post['authorid'], 'post', $_G['fid']); updateforumcount($copyto); updateforumcount($_G['fid']); $modpostsnum++; $resultarray = array('redirect' => "forum.php?mod=forumdisplay&fid={$_G['fid']}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_copy') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'threadid' => $threadid), 'modtids' => $thread['tid'], 'modlog' => array($thread, $other)); } } elseif ($_G['gp_action'] == 'removereward' && $_G['group']['allowremovereward']) { if (!submitcheck('modsubmit')) { include template('forum/topicadmin_action'); } else { if (!is_array($thread) || $thread['special'] != '3') { showmessage('reward_end'); } $modaction = 'RMR';
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) { updatepostcredits('+', $this->member['uid'], 'reply', $this->forum['fid']); if ($this->forum['status'] == 3) { if ($this->forum['closed'] > 1) { C::t('forum_thread')->increase($this->forum['closed'], $fieldarr, true); } C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 0, 1); C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP)); require_once libfile('function/grouplog'); updategroupcreditlog($this->forum['fid'], $this->member['uid']); } $lastpost = $this->thread['tid'] . "\t" . $this->thread['subject'] . "\t" . getglobal('timestamp') . "\t" . $author; C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 1, 1); if ($this->forum['type'] == 'sub') { C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost)); } } $this->param['page'] = getstatus($this->thread['status'], 4) ? 1 : @ceil(($this->thread['special'] ? $this->thread['replies'] + 1 : $this->thread['replies'] + 2) / getglobal('ppp')); if ($this->param['updatethreaddata']) { C::t('forum_thread')->update($this->thread['tid'], $this->param['updatethreaddata'], false, false, 0, true); } return 'post_reply_succeed'; } }
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'); } $curpolloption = count($polloption); $pollarray['maxchoices'] = empty($_GET['maxchoices']) ? 0 : ($_GET['maxchoices'] > $curpolloption ? $curpolloption : $_GET['maxchoices']); $pollarray['multiple'] = empty($_GET['maxchoices']) || $_GET['maxchoices'] == 1 ? 0 : 1; $pollarray['options'] = $polloption; $pollarray['visible'] = empty($_GET['visibilitypoll']); $pollarray['overt'] = !empty($_GET['overt']); if (preg_match("/^\\d*\$/", trim($_GET['expiration']))) { if (empty($_GET['expiration'])) { $pollarray['expiration'] = 0; } else { $pollarray['expiration'] = TIMESTAMP + 86400 * $_GET['expiration']; } } else { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('poll_maxchoices_expiration_invalid'); } } // 分类信息有效期 $_GET['typeexpiration'] = $_GET['typeoption']['typeexpiration']; $sortid = $special && $_G['forum']['threadsorts']['types'][$sortid] ? 0 : $sortid; $typeexpiration = intval($_GET['typeexpiration']); if ($_G['forum']['threadsorts']['expiration'][$typeid] && !$typeexpiration) { return WebUtils::makeErrorInfo_oldVersion($res, 'threadtype_expiration_invalid'); } $_G['forum_optiondata'] = array(); if ($_G['forum']['threadsorts']['types'][$sortid] && !$_G['forum']['allowspecialonly']) { Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_threadsort.php'); $_G['forum_optiondata'] = mobcent_threadsort_validator($_GET['typeoption'], $pid); if ($_G['forum_optiondata']['message'] != '') { return WebUtils::makeErrorInfo_oldVersion($res, $_G['forum_optiondata']['message'], $_G['forum_optiondata']['params']); } } $author = !$isanonymous ? $_G['username'] : ''; $moderated = $digest || $displayorder > 0 ? 1 : 0; $thread['status'] = 0; $_GET['ordertype'] && ($thread['status'] = setstatus(4, 1, $thread['status'])); $_GET['hiddenreplies'] && ($thread['status'] = setstatus(2, 1, $thread['status'])); /* if($_G['group']['allowpostrushreply'] && $_GET['rushreply']) { $_GET['rushreplyfrom'] = strtotime($_GET['rushreplyfrom']); $_GET['rushreplyto'] = strtotime($_GET['rushreplyto']); $_GET['rewardfloor'] = trim($_GET['rewardfloor']); $_GET['stopfloor'] = intval($_GET['stopfloor']); $_GET['creditlimit'] = $_GET['creditlimit'] == '' ? '-996' : intval($_GET['creditlimit']); if($_GET['rushreplyfrom'] > $_GET['rushreplyto'] && !empty($_GET['rushreplyto'])) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('post_rushreply_timewrong'); } if(($_GET['rushreplyfrom'] > $_G['timestamp']) || (!empty($_GET['rushreplyto']) && $_GET['rushreplyto'] < $_G['timestamp']) || ($_GET['stopfloor'] == 1) ) { $closed = true; } if(!empty($_GET['rewardfloor']) && !empty($_GET['stopfloor'])) { $floors = explode(',', $_GET['rewardfloor']); if(!empty($floors) && is_array($floors)) { foreach($floors AS $key => $floor) { if(strpos($floor, '*') === false) { if(intval($floor) == 0) { unset($floors[$key]); } elseif($floor > $_GET['stopfloor']) { unset($floors[$key]); } } } $_GET['rewardfloor'] = implode(',', $floors); } } $thread['status'] = setstatus(3, 1, $thread['status']); $thread['status'] = setstatus(1, 1, $thread['status']); } */ $_GET['allownoticeauthor'] && ($thread['status'] = setstatus(6, 1, $thread['status'])); $isgroup = $_G['forum']['status'] == 3 ? 1 : 0; /* if($_G['group']['allowreplycredit']) { $_GET['replycredit_extcredits'] = intval($_GET['replycredit_extcredits']); $_GET['replycredit_times'] = intval($_GET['replycredit_times']); $_GET['replycredit_membertimes'] = intval($_GET['replycredit_membertimes']); $_GET['replycredit_random'] = intval($_GET['replycredit_random']); $_GET['replycredit_random'] = $_GET['replycredit_random'] < 0 || $_GET['replycredit_random'] > 99 ? 0 : $_GET['replycredit_random'] ; $replycredit = $replycredit_real = 0; if($_GET['replycredit_extcredits'] > 0 && $_GET['replycredit_times'] > 0) { $replycredit_real = ceil(($_GET['replycredit_extcredits'] * $_GET['replycredit_times']) + ($_GET['replycredit_extcredits'] * $_GET['replycredit_times'] * $_G['setting']['creditstax'])); if($replycredit_real > getuserprofile('extcredits'.$_G['setting']['creditstransextra'][10])) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('replycredit_morethan_self'); } else { $replycredit = ceil($_GET['replycredit_extcredits'] * $_GET['replycredit_times']); } } } */ $newthread = array('fid' => $_G['fid'], 'posttableid' => 0, 'readperm' => $readperm, 'price' => $price, 'typeid' => $typeid, 'sortid' => $sortid, 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => $displayorder, 'digest' => $digest, 'special' => $special, 'attachment' => 0, 'moderated' => $moderated, 'status' => $thread['status'] | $topicStatus, 'isgroup' => $isgroup, 'replycredit' => $replycredit, 'closed' => $closed ? 1 : 0); $tid = C::t('forum_thread')->insert($newthread, true); useractionlog($_G['uid'], 'tid'); if (!getuserprofile('threads') && $_G['setting']['newbie']) { C::t('forum_thread')->update($tid, array('icon' => $_G['setting']['newbie'])); } if ($publishdate != $_G['timestamp']) { loadcache('cronpublish'); $cron_publish_ids = dunserialize($_G['cache']['cronpublish']); $cron_publish_ids[$tid] = $tid; $cron_publish_ids = serialize($cron_publish_ids); savecache('cronpublish', $cron_publish_ids); } if (!$isanonymous) { C::t('common_member_field_home')->update($_G['uid'], array('recentnote' => $subject)); } if ($special == 3 && $_G['group']['allowpostreward']) { updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][2] => -$realprice), 1, 'RTC', $tid); } if ($moderated) { updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG'); updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1); } /* if($special == 1) { foreach($pollarray['options'] as $polloptvalue) { $polloptvalue = dhtmlspecialchars(trim($polloptvalue)); C::t('forum_polloption')->insert(array('tid' => $tid, 'polloption' => $polloptvalue)); } $polloptionpreview = ''; $query = C::t('forum_polloption')->fetch_all_by_tid($tid, 1, 2); foreach($query as $option) { $polloptvalue = preg_replace("/\[url=(https?){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $option['polloption']); $polloptionpreview .= $polloptvalue."\t"; } $polloptionpreview = daddslashes($polloptionpreview); $data = array('tid' => $tid, 'multiple' => $pollarray['multiple'], 'visible' => $pollarray['visible'], 'maxchoices' => $pollarray['maxchoices'], 'expiration' => $pollarray['expiration'], 'overt' => $pollarray['overt'], 'pollpreview' => $polloptionpreview); C::t('forum_poll')->insert($data); } */ if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata'])) { $filedname = $valuelist = $separator = ''; foreach ($_G['forum_optiondata'] as $optionid => $value) { if ($value) { $filedname .= $separator . $_G['forum_optionlist'][$optionid]['identifier']; $valuelist .= $separator . "'" . daddslashes($value) . "'"; $separator = ' ,'; } if ($_G['forum_optionlist'][$optionid]['type'] == 'image') { $identifier = $_G['forum_optionlist'][$optionid]['identifier']; $sortaids[] = intval($_GET['typeoption'][$identifier]['aid']); } C::t('forum_typeoptionvar')->insert(array('sortid' => $sortid, 'tid' => $tid, 'fid' => $_G['fid'], 'optionid' => $optionid, 'value' => censor($value), 'expiration' => $typeexpiration ? $publishdate + $typeexpiration : 0)); } if ($filedname && $valuelist) { C::t('forum_optionvalue')->insert($sortid, "({$filedname}, tid, fid) VALUES ({$valuelist}, '{$tid}', '{$_G['fid']}')"); } } if ($_G['group']['allowat']) { $atlist = $atlist_tmp = array(); preg_match_all("/@([^\r\n]*?)\\s/i", $message . ' ', $atlist_tmp); $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']); if (!empty($atlist_tmp)) { if (empty($_G['setting']['at_anyone'])) { foreach (C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) { $atlist[$row['followuid']] = $row['fusername']; } if (count($atlist) < $_G['group']['allowat']) { $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $atlist_tmp); foreach ($query as $row) { $atlist[$row['fuid']] = $row['fusername']; } } } else { foreach (C::t('common_member')->fetch_all_by_username($atlist_tmp) as $row) { $atlist[$row['uid']] = $row['username']; } } } if ($atlist) { foreach ($atlist as $atuid => $atusername) { $atsearch[] = "/@" . str_replace('/', '\\/', preg_quote($atusername)) . " /i"; $atreplace[] = "[url=home.php?mod=space&uid={$atuid}]@{$atusername}[/url] "; } $message = preg_replace($atsearch, $atreplace, $message . ' ', 1); } } $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff'])); $smileyoff = checksmilies($message, !empty($_GET['smileyoff'])); $parseurloff = !empty($_GET['parseurloff']); $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0; $usesig = !empty($_GET['usesig']) && $_G['group']['maxsigsize'] ? 1 : 0; $class_tag = new tag(); $tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid'); /* if($_G['group']['allowreplycredit']) { if($replycredit > 0 && $replycredit_real > 0) { updatemembercount($_G['uid'], array('extcredits'.$_G['setting']['creditstransextra'][10] => -$replycredit_real), 1, 'RCT', $tid); $insertdata = array( 'tid' => $tid, 'extcredits' => $_GET['replycredit_extcredits'], 'extcreditstype' => $_G['setting']['creditstransextra'][10], 'times' => $_GET['replycredit_times'], 'membertimes' => $_GET['replycredit_membertimes'], 'random' => $_GET['replycredit_random'] ); C::t('forum_replycredit')->insert($insertdata); } } */ if ($_G['group']['allowpostrushreply'] && $_GET['rushreply']) { $rushdata = array('tid' => $tid, 'stopfloor' => $_GET['stopfloor'], 'starttimefrom' => $_GET['rushreplyfrom'], 'starttimeto' => $_GET['rushreplyto'], 'rewardfloor' => $_GET['rewardfloor'], 'creditlimit' => $_GET['creditlimit']); C::t('forum_threadrush')->insert($rushdata); } $pinvisible = $modnewthreads ? -2 : (empty($_GET['save']) ? 0 : -3); $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr, 'replycredit' => 0, 'status' => (defined('IN_MOBILE') ? 8 : 0) | $postStatus)); if ($_G['group']['allowat'] && $atlist) { foreach ($atlist as $atuid => $atusername) { notification_add($atuid, 'at', 'at_message', array('from_id' => $tid, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $tid, 'subject' => $subject, 'pid' => $pid, 'message' => messagecutstr($message, 150))); } set_atlist_cookie(array_keys($atlist)); } $threadimageaid = 0; $threadimage = array(); if ($special == 4 && $_GET['activityaid']) { $threadimageaid = $_GET['activityaid']; convertunusedattach($_GET['activityaid'], $tid, $pid); } if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) { foreach ($sortaids as $sortaid) { convertunusedattach($sortaid, $tid, $pid); } } if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $sortid || !empty($_GET['activityaid']))) { updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']); if (!$threadimageaid) { $threadimage = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'tid', $tid); $threadimageaid = $threadimage['aid']; } } $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : ''); $param = array(); Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php'); if ($_G['forum']['picstyle']) { if (!mobcent_setthreadcover($pid, 0, $threadimageaid)) { preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER); $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>"; $param['clean_msgforward'] = 1; $param['timeout'] = $param['refreshtime'] = 15; } } if ($threadimageaid) { if (!$threadimage) { $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid); } $threadimage = daddslashes($threadimage); C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote'])); } $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread'); include_once libfile('function/stat'); updatestat($isgroup ? 'groupthread' : $statarr[$special]); if ($modnewthreads) { updatemoderate('tid', $tid); C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1); manage_addnotify('verifythread'); return WebUtils::makeErrorInfo_oldVersion($res, 'post_newthread_mod_succeed', array('noError' => 1)); //showmessage('post_newthread_mod_succeed', $returnurl, $values, $param); } else { if ($displayorder >= 0 && helper_access::check_module('follow') && !empty($_GET['adddynamic']) && !$isanonymous) { require_once libfile('function/discuzcode'); require_once libfile('function/followcode'); $feedcontent = array('tid' => $tid, 'content' => followcode($message, $tid, $pid, 1000)); C::t('forum_threadpreview')->insert($feedcontent); C::t('forum_thread')->update_status_by_tid($tid, '512'); $followfeed = array('uid' => $_G['uid'], 'username' => $_G['username'], 'tid' => $tid, 'note' => '', 'dateline' => TIMESTAMP); $values['feedid'] = C::t('home_follow_feed')->insert($followfeed, true); C::t('common_member_count')->increase($_G['uid'], array('feeds' => 1)); } $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array()); if ($displayorder != -4) { if ($digest) { updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']); } //updatepostcredits('+', $_G['uid'], 'post', $_G['fid']); Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php'); //Yii::import('application.components.discuz.source.function.function_post', true); mobcent_updatepostcredits('+', $_G['uid'], 'post', $_G['fid']); if ($isgroup) { C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 1); } $subject = str_replace("\t", ' ', $subject); $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}"; C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($_G['fid'], 1, 1, 1); if ($_G['forum']['type'] == 'sub') { C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost)); } } if ($_G['forum']['status'] == 3) { C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => TIMESTAMP)); require_once libfile('function/grouplog'); updategroupcreditlog($_G['fid'], $_G['uid']); } /*如果显示地理位置,入库到表里*/ if ($jsonInfo['isShowPostion']) { $data = DB::query('INSERT INTO %t VALUES(null,%f,%f,%d,%d,%s)', array('home_surrounding_user', $jsonInfo['longitude'], $jsonInfo['latitude'], $tid, 3, (string) $jsonInfo['location'])); } /* //客户端发表主题积分入库 $temp = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_credit_rule').' WHERE rid =%d ',array(1)); $extcredits3 = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_member_count').' WHERE uid = %d',array($_G['uid'])); $temp = $extcredits3['extcredits3'] + $temp['extcredits3']; DB::query('UPDATE '.DB::table('common_member_count').' set extcredits3 = %d WHERE uid = %d',array($temp,$_G['uid'])); */ //showmessage('post_newthread_succeed', $returnurl, $values, $param); // return array('rs'=>1,'errcode'=>WebUtils::t('发贴成功')); return $this->makeErrorInfo($res, 'mobcent_post_newthread_success', array('noError' => 1)); } }
function addnewpid($fid, $tid, $subject = '', $message) { global $_G; if ($_G['uid'] && $fid && $tid && $message) { require_once libfile('function/forum'); $message = '[b]' . $_G['username'] . '[/b],' . $message; $pid = insertpost(array('fid' => $fid, 'tid' => $tid, 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => '', 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'])); if ($pid) { DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='" . addslashes($_G['username']) . "', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$tid}' AND fid='{$fid}'", 'UNBUFFERED'); $lastpost = "{$tid}\t" . addslashes($subject) . "\t{$_G['timestamp']}\t" . addslashes($_G['username']); DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$fid}'", 'UNBUFFERED'); return $pid; } } }
$u_ip = "127.0.0.1"; } //echo $u_ip; //Get parameter: fid, forum id if (in_array($_POST["fid"], array('36', '37', '38', '39', '40', '41', '42', '43'))) { $fid = $_POST["fid"]; } else { echo "Forum id: " . $_POST["fid"] . " error!<br>"; $fid = "36"; } $publishdate = $_G['timestamp']; $author = "machine"; $authorid = "2"; $newthread = array('fid' => $fid, 'posttableid' => 0, 'readperm' => 0, 'price' => 0, 'typeid' => 0, 'sortid' => 0, 'author' => $author, 'authorid' => $authorid, 'subject' => $_POST["subject"], 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => 0, 'digest' => 0, 'special' => 0, 'attachment' => 0, 'moderated' => 0, 'status' => 32, 'isgroup' => 0, 'replycredit' => 0, 'closed' => 0); $tid = C::t('forum_thread')->insert($newthread, true); useractionlog($authorid, 'tid'); C::t('common_member_field_home')->update($authorid, array('recentnote' => $_POST["subject"])); $pid = insertpost(array('fid' => $fid, 'tid' => $tid, 'first' => '1', 'author' => $author, 'authorid' => $authorid, 'subject' => $_POST["subject"], 'dateline' => $publishdate, 'message' => $_POST["message"], 'useip' => $u_ip, 'invisible' => '0', 'anonymous' => '0', 'usesig' => '1', 'htmlon' => '0', 'bbcodeoff' => '-1', 'smileyoff' => '-1', 'parseurloff' => '0', 'attachment' => '0', 'tags' => '', 'replycredit' => '0', 'status' => '0')); include_once libfile('function/stat'); updatestat("thread"); //update user status $sql = array('extcredits2' => 2, 'threads' => 1, 'posts' => 1); C::t('common_member_count')->increase($authorid, $sql); C::t('common_member')->increase($authorid, array('credits' => 2)); $last_status = array('lastip' => $u_ip, 'lastvisit' => $publishdate, 'lastactivity' => $publishdate, 'lastpost' => TIMESTAMP); C::t('common_member_status')->update($authorid, $last_status, 'UNBUFFERED'); $subject = str_replace("\t", ' ', $_POST["subject"]); $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}"; C::t('forum_forum')->update($fid, array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($fid, 1, 1, 1); echo "OK, ID: " . $pid;