public function feed() { if ($this->forum('allowfeed') && !$this->param['isanonymous']) { if (empty($this->feed)) { $this->feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array()); $message = !$this->param['price'] && !$this->param['readperm'] ? $this->param['message'] : ''; $message = messagesafeclear($message); $this->feed['icon'] = 'thread'; $this->feed['title_template'] = 'feed_thread_title'; $this->feed['body_template'] = 'feed_thread_message'; $this->feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$this->tid}\">{$this->param['subject']}</a>", 'message' => messagecutstr($message, 150)); if (getglobal('forum_attachexist')) { // $firstaid = DB::result_first("SELECT aid FROM ".DB::table(getattachtablebytid($tid))." WHERE pid='$pid' AND dateline>'0' AND isimage='1' ORDER BY dateline LIMIT 1"); $imgattach = C::t('forum_attachment_n')->fetch_max_image('tid:' . $this->tid, 'pid', $this->pid); $firstaid = $imgattach['aid']; unset($imgattach); if ($firstaid) { $this->feed['images'] = array(getforumimg($firstaid)); $this->feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$this->tid}&pid={$this->pid}"); } } } $this->feed['title_data']['hash_data'] = 'tid' . $this->tid; $this->feed['id'] = $this->tid; $this->feed['idtype'] = 'tid'; if ($this->feed['icon']) { postfeed($this->feed); } } }
/** * 模型在线投稿提交处理函数 */ function modelpost($cacheinfo, $cp = 1) { global $_SGLOBAL, $theurl, $_SCONFIG; include_once S_ROOT . './function/upload.func.php'; $_POST['mid'] = !empty($_POST['mid']) ? intval($_POST['mid']) : 0; $itemid = !empty($_POST['itemid']) ? intval($_POST['itemid']) : 0; $hash = ''; $op = 'add'; $resultitems = $resultmessage = array(); $modelsinfoarr = $cacheinfo['models']; $columnsinfoarr = $cacheinfo['columns']; //获取等级信息 if ($cacheinfo['models']['modelname'] == 'defect') { switch ($_POST['grade']) { case 1: $_POST['grade'] = '64'; break; case 2: $_POST['grade'] = '32'; break; case 3: $_POST['grade'] = '16'; break; case 4: $_POST['grade'] = '9'; break; case 5: $_POST['grade'] = '4'; break; case 6: $_POST['grade'] = '1'; break; case 7: $_POST['grade'] = '-1'; break; case 8: $_POST['grade'] = '-2'; break; case 9: $_POST['grade'] = '-3'; break; } $gradearr = array('0' => $alang['general_state'], '64' => $alang['check_grade_1'], '32' => $alang['check_grade_2'], '16' => $alang['check_grade_3_1'], '9' => $alang['check_grade_3_2'], '4' => $alang['check_grade_3_3'], '1' => $alang['check_grade_4'], '-1' => $alang['check_grade_5'], '-2' => $alang['check_grade_6'], '-3' => $alang['check_grade_7']); if (!empty($_SCONFIG['checkgrade'])) { $newgradearr = explode("\t", $_SCONFIG['checkgrade']); $gradearr['64'] = $newgradearr[0]; $gradearr['32'] = $newgradearr[1]; $gradearr['16'] = $newgradearr[2]; $gradearr['9'] = $newgradearr[3]; $gradearr['4'] = $newgradearr[4]; $gradearr['1'] = $newgradearr[5]; $gradearr['-1'] = $newgradearr[6]; $gradearr['-2'] = $newgradearr[7]; $gradearr['-3'] = $newgradearr[8]; } } else { $gradearr = array('0' => $alang['general_state'], '1' => $alang['check_grade_1'], '2' => $alang['check_grade_2'], '3' => $alang['check_grade_3'], '4' => $alang['check_grade_4'], '5' => $alang['check_grade_5'], '6' => $alang['check_grade_6'], '7' => $alang['check_grade_7']); if (!empty($_SCONFIG['checkgrade'])) { $newgradearr = explode("\t", $_SCONFIG['checkgrade']); for ($i = 0; $i < count($newgradearr); $i++) { if (!empty($newgradearr[$i])) { $gradearr[$i + 1] = $newgradearr[$i]; } } } } if (empty($_POST['mid']) || $_POST['mid'] != $modelsinfoarr['mid']) { showmessage('parameter_error'); } $feedcolum = array(); foreach ($columnsinfoarr as $result) { if ($result['isfixed'] == 1) { $resultitems[] = $result; } else { $resultmessage[] = $result; } if ($result['formtype'] == 'linkage') { if (!empty($_POST[$result['fieldname']])) { $_POST[$result['fieldname']] = $cacheinfo['linkage']['info'][$result['fieldname']][$_POST[$result['fieldname']]]; } } elseif ($result['formtype'] == 'timestamp') { if (empty($_POST[$result['fieldname']])) { $_POST[$result['fieldname']] = $_SGLOBAL['timestamp']; } else { $_POST[$result['fieldname']] = sstrtotime($_POST[$result['fieldname']]); } } } //更新用户最新更新时间 if (empty($itemid) && $_SGLOBAL['supe_uid']) { updatetable('members', array('updatetime' => $_SGLOBAL['timestamp']), array('uid' => $_SGLOBAL['supe_uid'])); } //输入检查 $_POST['catid'] = intval($_POST['catid']); $_POST['allowreply'] = isset($_POST['allowreply']) ? intval($_POST['allowreply']) : checkperm('allowcomment') ? 1 : 0; $_POST['subject'] = shtmlspecialchars(trim($_POST['subject'])); //检查输入 if (strlen($_POST['subject']) < 2 || strlen($_POST['subject']) > 80) { showmessage('space_suject_length_error'); } if (empty($_POST['catid'])) { showmessage('admin_func_catid_error'); } if (!empty($_FILES['subjectimage']['name'])) { $fileext = fileext($_FILES['subjectimage']['name']); if (!in_array($fileext, array('jpg', 'jpeg', 'gif', 'png'))) { showmessage('document_types_can_only_upload_pictures'); } } //数据检查 checkvalues(array_merge($resultitems, $resultmessage), 0, 1); //修改时检验标题图片是否修改 $defaultmessage = array(); if (!empty($itemid)) { if (empty($_POST['subjectimage_value']) || !empty($_FILES['subjectimage']['name'])) { //当file删除时,或修改时执行删除操作 $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelsinfoarr['modelname'] . 'items') . ' WHERE itemid = \'' . $itemid . '\''); $defaultmessage = $_SGLOBAL['db']->fetch_array($query); $hash = getmodelhash($_GET['mid'], $itemid); deletetable('attachments', array('hash' => $hash, 'subject' => 'subjectimage')); //删除附件表 updatetable($modelsinfoarr['modelname'] . 'items', array('subjectimage' => ''), array('itemid' => $itemid)); $ext = fileext($defaultmessage['subjectimage']); if (in_array($ext, array('jpg', 'jpeg', 'png'))) { @unlink(A_DIR . '/' . substr($defaultmessage['subjectimage'], 0, strrpos($defaultmessage['subjectimage'], '.')) . '.thumb.jpg'); } @unlink(A_DIR . '/' . $defaultmessage['subjectimage']); } } //构建数据 $setsqlarr = $setitemsqlarr = array(); $setsqlarr = getsetsqlarr($resultitems); $setsqlarr['catid'] = $_POST['catid']; $setsqlarr['subject'] = $_POST['subject']; $setsqlarr['allowreply'] = $_POST['allowreply']; $setsqlarr['grade'] = intval($_POST['grade']); //modify by jyf,没权限的用户不能改审核等级 if ($setsqlarr['grade'] > 0) { if (!checkperm('manageeditpost')) { showmessage('no_permission'); } } //end $setsqlarr['dateline'] = $_SGLOBAL['timestamp']; $setsqlarr['uid'] = $_SGLOBAL['supe_uid']; $setsqlarr['username'] = $_SGLOBAL['supe_username']; $setsqlarr['lastpost'] = $setsqlarr['dateline']; $modelsinfoarr['subjectimagewidth'] = 400; $modelsinfoarr['subjectimageheight'] = 300; if (!empty($modelsinfoarr['thumbsize'])) { $modelsinfoarr['thumbsize'] = explode(',', trim($modelsinfoarr['thumbsize'])); $modelsinfoarr['subjectimagewidth'] = $modelsinfoarr['thumbsize'][0]; $modelsinfoarr['subjectimageheight'] = $modelsinfoarr['thumbsize'][1]; } $uploadfilearr = $ids = array(); $subjectimageid = ''; $uploadfilearr = uploadfile(array(array('fieldname' => 'subjectimage', 'fieldcomment' => modelmsg('photo_title'), 'formtype' => 'img')), $_POST['mid'], 0, 1, $modelsinfoarr['subjectimagewidth'], $modelsinfoarr['subjectimageheight']); if (!empty($uploadfilearr)) { $feedsubjectimg = $uploadfilearr; foreach ($uploadfilearr as $tmpkey => $tmpvalue) { if (empty($tmpvalue['error'])) { $setsqlarr[$tmpkey] = $tmpvalue['filepath']; } if (!empty($tmpvalue['aid'])) { $ids[] = $tmpvalue['aid']; } } } //词语过滤 if (!empty($modelsinfoarr['allowfilter'])) { $setsqlarr = scensor($setsqlarr, 1); } //发布时间 if (empty($_POST['dateline'])) { $setsqlarr['dateline'] = $_SGLOBAL['timestamp']; } else { $setsqlarr['dateline'] = sstrtotime($_POST['dateline']); if ($setsqlarr['dateline'] > $_SGLOBAL['timestamp'] || $setsqlarr['dateline'] < $_SGLOBAL['timestamp'] - 3600 * 24 * 365 * 2) { //不能早于2年 $setsqlarr['dateline'] = $_SGLOBAL['timestamp']; } } //附件处理-by jyf if (!empty($_POST['divupload']) && is_array($_POST['divupload'])) { $setsqlarr['attaches'] = implode(',', $_POST['divupload']); } //创新园地新增两个字段-------89184 if ($cacheinfo['models']['modelname'] == 'creative') { if (empty($_POST['creative_value'])) { showmessage('请输入创新价值说明'); } if (empty($_POST['creative_days'])) { showmessage('本创新所耗的工作量'); } $setsqlarr['value'] = $_POST['creative_value']; $setsqlarr['days'] = $_POST['creative_days']; } if (!checkperm('allowdirectpost') || checkperm('managemodpost')) { //不需要审核时入item表 if (empty($itemid)) { //插入数据 $itemid = inserttable($modelsinfoarr['modelname'] . 'items', $setsqlarr, 1); //取消邮件通知 --89184 $email = get_cate_mail($_POST['catid']); $url1 = geturl('action/model/name/' . $modelsinfoarr['modelname'] . '/itemid/' . $itemid); if ($_POST['modelname'] == 'creative') { if ($_POST['creative_type'] == '流程建议') { $email = $email . ',' . get_cate_process_mail($setsqlarr['catid']); } } $emails = explode(',', $email); if (count($emails) > 0) { include S_ROOT . './function/sendmail.fun.php'; $url1 = geturl('action/model/name/' . $modelsinfoarr['modelname'] . '/itemid/' . $itemid); if ($cacheinfo['models']['modelname'] == 'creative') { $msg1 = '用户 ' . $setsqlarr['username'] . ' 提交了新的创新:<br />' . $url1; sendmail($emails, '用户 ' . $setsqlarr['username'] . ' 提交了新的创新《' . $_POST['subject'] . "》", $msg1); } else { if ($cacheinfo['models']['modelname'] == 'defect') { $msg1 = '用户 ' . $setsqlarr['username'] . ' 提交了新的缺陷预防案例:<br />' . $url1; sendmail($emails, '用户 ' . $setsqlarr['username'] . ' 提交了新的缺陷预防案例《' . $_POST['subject'] . "》", $msg1); } } } } else { //更新 $op = 'update'; unset($setsqlarr['uid']); unset($setsqlarr['username']); unset($setsqlarr['lastpost']); if ($setsqlarr['grade'] > 0) { $setsqlarr['shenhezhe'] = $_SGLOBAL['supe_username']; if ($_POST['modelname'] == 'creative') { if ($_POST['creative_type'] == '主管月度创新') { if (!check_cate_director($setsqlarr['catid'])) { showmessage('no_permission'); } } } } updatetable($modelsinfoarr['modelname'] . 'items', $setsqlarr, array('itemid' => $itemid)); $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelsinfoarr['modelname'] . 'message') . ' WHERE nid = \'' . $_POST['nid'] . '\''); $defaultmessage = $_SGLOBAL['db']->fetch_array($query); //邮件通知--等级审核 if ($setsqlarr['grade'] > 0) { $sqlstr = 'SELECT u.*, s.* FROM ' . tname($modelsinfoarr['modelname'] . 'items') . ' s LEFT JOIN ' . tname('members') . ' u ON u.uid=s.uid WHERE s.itemid=\'' . $itemid . '\''; $query = $_SGLOBAL['db']->query($sqlstr); $value = $_SGLOBAL['db']->fetch_array($query); $email = $value['email']; if (!empty($email)) { include S_ROOT . './function/sendmail.fun.php'; $url = geturl('action/model/name/' . $modelsinfoarr['modelname'] . '/itemid/' . $itemid); $emails = explode(',', $email); if ($_POST['modelname'] == 'creative') { $msg = '你的创新已被审核,等级:' . $gradearr[$setsqlarr[grade]] . '(' . $setsqlarr['grade'] . ')<br />' . $url; } else { $msg = '你的缺陷预防案例已被审核,等级:' . $gradearr[$setsqlarr[grade]] . '(' . $setsqlarr['grade'] . ')<br />' . $url; } sendmail($emails, $setsqlarr['subject'], $msg); } } } if (!empty($_POST['divupload']) && is_array($_POST['divupload'])) { $_SGLOBAL['db']->query('UPDATE ' . tname('attachments') . ' SET isavailable=1, type=\'' . $modelsinfoarr['modelname'] . '\', itemid=' . $itemid . ', catid=\'' . $_POST['catid'] . '\' WHERE hash=\'' . $_POST['hash'] . '\''); } $hash = getmodelhash($_POST['mid'], $itemid); if (!empty($ids)) { $ids = simplode($ids); $_SGLOBAL['db']->query('UPDATE ' . tname('attachments') . ' SET hash=\'' . $hash . '\' WHERE aid IN (' . $ids . ')'); } $do = 'pass'; } else { if (!empty($uploadfilearr['subjectimage']['aid'])) { $subjectimageid = $uploadfilearr['subjectimage']['aid']; } $setitemsqlarr = $setsqlarr; $do = 'me'; } if ($op == 'update') { if (!empty($resultmessage)) { foreach ($resultmessage as $value) { if (preg_match("/^(img|flash|file)\$/i", $value['formtype']) && !empty($defaultmessage[$value['fieldname']])) { if (empty($_POST[$value['fieldname'] . '_value']) || !empty($_FILES[$value['fieldname']]['name'])) { //当file删除时,或修改时执行删除操作 deletetable('attachments', array('hash' => $hash, 'subject' => $value['fieldname'])); //删除附件表 updatetable($modelsinfoarr['modelname'] . 'message', array($value['fieldname'] => ''), array('nid' => $_POST['nid'])); $ext = fileext($defaultmessage[$value['fieldname']]); if (in_array($ext, array('jpg', 'jpeg', 'png'))) { @unlink(A_DIR . '/' . substr($defaultmessage[$value['fieldname']], 0, strrpos($defaultmessage[$value['fieldname']], '.')) . '.thumb.jpg'); } @unlink(A_DIR . '/' . $defaultmessage[$value['fieldname']]); } } } } } //内容 $setsqlarr = $uploadfilearr = $ids = array(); $setsqlarr = getsetsqlarr($resultmessage); $uploadfilearr = $feedcolum = uploadfile($resultmessage, $_POST['mid'], $itemid, 0); $setsqlarr['message'] = trim($_POST['message']); $setsqlarr['postip'] = $_SGLOBAL['onlineip']; if (!empty($uploadfilearr)) { foreach ($uploadfilearr as $tmpkey => $tmpvalue) { if (empty($tmpvalue['error'])) { $setsqlarr[$tmpkey] = $tmpvalue['filepath']; } if (!empty($tmpvalue['aid'])) { $ids[] = $tmpvalue['aid']; } } } //添加内容 if (!empty($modelsinfoarr['allowfilter'])) { $setsqlarr = scensor($setsqlarr, 1); } if (!checkperm('allowdirectpost') || checkperm('managemodpost') || checkperm('allowdirectpost') && $op == 'update') { //不需要审核时入message表 if ($op == 'add') { $setsqlarr['itemid'] = $itemid; //添加内容 inserttable($modelsinfoarr['modelname'] . 'message', $setsqlarr); getreward('postinfo'); if (allowfeed() && !empty($_POST['addfeed']) && !empty($_SGLOBAL['supe_uid'])) { $feed['icon'] = 'comment'; $feed['title_template'] = 'feed_model_title'; $murl = geturl('action/model/name/' . $modelsinfoarr['modelname'] . '/itemid/' . $itemid); $aurl = A_URL; if (empty($_SCONFIG['siteurl'])) { $siteurl = getsiteurl(); $murl = $siteurl . $murl; $aurl = $siteurl . $aurl; } else { $siteurl = S_URL_ALL; } $feed['title_data'] = array('modelname' => '<a href="' . $siteurl . '/m.php?name=' . $modelsinfoarr['modelname'] . '">' . $modelsinfoarr['modelalias'] . '</a>'); $feed['body_template'] = 'feed_model_message'; $feed['body_data'] = array('subject' => '<a href="' . $murl . '">' . $_POST['subject'] . '</a>', 'message' => cutstr(strip_tags(preg_replace("/\\[.+?\\]/is", '', $_POST['message'])), 150)); if (!empty($feedsubjectimg)) { $feed['images'][] = array('url' => $aurl . '/' . $feedsubjectimg['subjectimage']['filepath'], 'link' => $murl); } else { foreach ($feedcolum as $feedimgvalue) { if ($feedimgvalue['filepath']) { $feed['images'][] = array('url' => $aurl . '/' . $feedimgvalue['filepath'], 'link' => $murl); break; } } if (empty($feed['images'])) { $picurl = getmessagepic(stripslashes($_POST['message'])); if ($picurl && strpos($picurl, '://') === false) { $picurl = $siteurl . '/' . $picurl; } if (!empty($picurl)) { $feed['images'][] = array('url' => $picurl, 'link' => $murl); } } } postfeed($feed); } } else { //更新内容 updatetable($modelsinfoarr['modelname'] . 'message', $setsqlarr, array('nid' => $_POST['nid'], 'itemid' => $itemid)); } updatetable('attachments', array('isavailable' => '1', 'type' => 'model'), array('hash' => $hash)); if (checkperm('allowdirectpost') && $op == 'update') { deletemodelitems($modelsinfoarr['modelname'], array($itemid), $_POST['mid'], 1, 1); } if (checkperm('allowdirectpost') && $op == 'update') { $jpurl = $cp ? empty($setsqlarr['uid']) ? S_URL . "/admincp.php?action=modelmanages&op=add&mid={$modelsinfoarr['mid']}" : S_URL . '/' . $theurl . '&mid=' . $modelsinfoarr['mid'] : S_URL . "/cp.php?ac=models&op=list&do={$do}&nameid={$modelsinfoarr['modelname']}"; showmessage('writing_success_online_please_wait_for_audit', $jpurl); } else { $jpurl = $cp ? S_URL . '/' . $theurl . '&mid=' . $modelsinfoarr['mid'] : S_URL . "/cp.php?ac=models&op=list&do={$do}&nameid={$modelsinfoarr['modelname']}"; showmessage('online_contributions_success', $jpurl); } } else { $setsqlarr = array_merge($setitemsqlarr, $setsqlarr); $setsqlarr['addfeed'] = $_POST['addfeed']; $setsqlarr = array('subject' => $setitemsqlarr['subject'], 'mid' => $modelsinfoarr['mid'], 'uid' => $setsqlarr['uid'], 'message' => saddslashes(serialize($setsqlarr)), 'dateline' => $_SGLOBAL['timestamp'], 'folder' => 1); if (!empty($_POST['itemid'])) { $itemid = intval($_POST['itemid']); updatetable('modelfolders', $setsqlarr, array('itemid' => $itemid)); } else { $itemid = inserttable('modelfolders', $setsqlarr, 1); } if (!empty($subjectimageid)) { $ids[] = $subjectimageid; } if (!empty($ids)) { $ids = simplode($ids); $hash = 'm' . str_pad($_POST['mid'], 6, 0, STR_PAD_LEFT) . 'f' . str_pad($itemid, 8, 0, STR_PAD_LEFT); $_SGLOBAL['db']->query('UPDATE ' . tname('attachments') . ' SET isavailable=\'1\', type=\'model\', hash=\'' . $hash . '\' WHERE aid IN (' . $ids . ')'); } $jpurl = $cp ? empty($setsqlarr['uid']) ? S_URL . "/admincp.php?action=modelmanages&op=add&mid={$modelsinfoarr['mid']}" : S_URL . "/admincp.php?action=modelfolders&mid={$modelsinfoarr['mid']}" : S_URL . "/cp.php?ac=models&op=list&do={$do}&nameid={$modelsinfoarr['modelname']}"; showmessage('writing_success_online_please_wait_for_audit', $jpurl); } }
$data = array('tid' => $_G['tid'], 'username' => $_G['username'], 'uid' => $_G['uid'], 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata); C::t('forum_activityapply')->insert($data); } $applynumber = C::t('forum_activityapply')->fetch_count_for_thread($_G['tid']); C::t('forum_activity')->update($_G['tid'], array('applynumber' => $applynumber)); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'activity', 'activity_notice', array('tid' => $_G['tid'], 'subject' => $thread['subject'])); $space = array(); space_merge($space, 'field_home'); if (!empty($space['privacy']['feed']['newreply'])) { $feed['icon'] = 'activity'; $feed['title_template'] = 'feed_reply_activity_title'; $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$_G['tid']}\">{$thread['subject']}</a>", 'hash_data' => "tid{$_G[tid]}"); $feed['id'] = $_G['tid']; $feed['idtype'] = 'tid'; postfeed($feed); } } showmessage('activity_completion', "forum.php?mod=viewthread&tid={$_G['tid']}" . ($_GET['from'] ? '&from=' . $_GET['from'] : ''), array(), array('showdialog' => 1, 'showmsg' => true, 'locationtime' => true, 'alert' => 'right')); } elseif (submitcheck('activitycancel')) { C::t('forum_activityapply')->delete_for_user($_G['uid'], $_G['tid']); $applynumber = C::t('forum_activityapply')->fetch_count_for_thread($_G['tid']); C::t('forum_activity')->update($_G['tid'], array('applynumber' => $applynumber)); $message = cutstr(dhtmlspecialchars($_GET['message']), 200); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'activity', 'activity_cancel', array('tid' => $_G['tid'], 'subject' => $thread['subject'], 'reason' => $message)); } showmessage('activity_cancel_success', "forum.php?mod=viewthread&tid={$_G['tid']}&do=viewapplylist" . ($_GET['from'] ? '&from=' . $_GET['from'] : ''), array(), array('showdialog' => 1, 'closetime' => true)); } } elseif ($_GET['action'] == 'getactivityapplylist') { $pp = $_G['setting']['activitypp'];
/** * 模型在线投稿提交处理函数 */ function modelpost($cacheinfo, $cp = 1) { global $_SGLOBAL, $theurl, $_SCONFIG; include_once S_ROOT . './function/upload.func.php'; $_POST['mid'] = !empty($_POST['mid']) ? intval($_POST['mid']) : 0; $itemid = !empty($_POST['itemid']) ? intval($_POST['itemid']) : 0; $hash = ''; $op = 'add'; $resultitems = $resultmessage = array(); $modelsinfoarr = $cacheinfo['models']; $columnsinfoarr = $cacheinfo['columns']; if (empty($_POST['mid']) || $_POST['mid'] != $modelsinfoarr['mid']) { showmessage('parameter_error'); } $feedcolum = array(); foreach ($columnsinfoarr as $result) { if ($result['isfixed'] == 1) { $resultitems[] = $result; } else { $resultmessage[] = $result; } if ($result['formtype'] == 'linkage') { if (!empty($_POST[$result['fieldname']])) { $_POST[$result['fieldname']] = $cacheinfo['linkage']['info'][$result['fieldname']][$_POST[$result['fieldname']]]; } } elseif ($result['formtype'] == 'timestamp') { if (empty($_POST[$result['fieldname']])) { $_POST[$result['fieldname']] = $_SGLOBAL['timestamp']; } else { $_POST[$result['fieldname']] = sstrtotime($_POST[$result['fieldname']]); } } } //更新用户最新更新时间 if (empty($itemid) && $_SGLOBAL['supe_uid']) { updatetable('members', array('updatetime' => $_SGLOBAL['timestamp']), array('uid' => $_SGLOBAL['supe_uid'])); } //输入检查 $_POST['catid'] = intval($_POST['catid']); $_POST['allowreply'] = isset($_POST['allowreply']) ? intval($_POST['allowreply']) : checkperm('allowcomment') ? 1 : 0; $_POST['subject'] = shtmlspecialchars(trim($_POST['subject'])); //检查输入 if (strlen($_POST['subject']) < 2 || strlen($_POST['subject']) > 80) { showmessage('space_suject_length_error'); } if (empty($_POST['catid'])) { showmessage('admin_func_catid_error'); } if (!empty($_FILES['subjectimage']['name'])) { $fileext = fileext($_FILES['subjectimage']['name']); if (!in_array($fileext, array('jpg', 'jpeg', 'gif', 'png'))) { showmessage('document_types_can_only_upload_pictures'); } } //数据检查 checkvalues(array_merge($resultitems, $resultmessage), 0, 1); //修改时检验标题图片是否修改 $defaultmessage = array(); if (!empty($itemid)) { if (empty($_POST['subjectimage_value']) || !empty($_FILES['subjectimage']['name'])) { //当file删除时,或修改时执行删除操作 $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelsinfoarr['modelname'] . 'items') . ' WHERE itemid = \'' . $itemid . '\''); $defaultmessage = $_SGLOBAL['db']->fetch_array($query); $hash = getmodelhash($_GET['mid'], $itemid); deletetable('attachments', array('hash' => $hash, 'subject' => 'subjectimage')); //删除附件表 updatetable($modelsinfoarr['modelname'] . 'items', array('subjectimage' => ''), array('itemid' => $itemid)); $ext = fileext($defaultmessage['subjectimage']); if (in_array($ext, array('jpg', 'jpeg', 'png'))) { @unlink(A_DIR . '/' . substr($defaultmessage['subjectimage'], 0, strrpos($defaultmessage['subjectimage'], '.')) . '.thumb.jpg'); } @unlink(A_DIR . '/' . $defaultmessage['subjectimage']); } } //构建数据 $setsqlarr = $setitemsqlarr = array(); $setsqlarr = getsetsqlarr($resultitems); $setsqlarr['catid'] = $_POST['catid']; $setsqlarr['subject'] = $_POST['subject']; $setsqlarr['allowreply'] = $_POST['allowreply']; if (checkperm('managefolder') || checkperm('managemodpost')) { $setsqlarr['grade'] = intval($_POST['grade']); } else { $setsqlarr['grade'] = 0; } $setsqlarr['dateline'] = $_SGLOBAL['timestamp']; $setsqlarr['uid'] = $_SGLOBAL['supe_uid']; $setsqlarr['username'] = $_SGLOBAL['supe_username']; $setsqlarr['lastpost'] = $setsqlarr['dateline']; $modelsinfoarr['subjectimagewidth'] = 400; $modelsinfoarr['subjectimageheight'] = 300; if (!empty($modelsinfoarr['thumbsize'])) { $modelsinfoarr['thumbsize'] = explode(',', trim($modelsinfoarr['thumbsize'])); $modelsinfoarr['subjectimagewidth'] = $modelsinfoarr['thumbsize'][0]; $modelsinfoarr['subjectimageheight'] = $modelsinfoarr['thumbsize'][1]; } $uploadfilearr = $ids = array(); $subjectimageid = ''; $uploadfilearr = uploadfile(array(array('fieldname' => 'subjectimage', 'fieldcomment' => modelmsg('photo_title'), 'formtype' => 'img')), $_POST['mid'], 0, 1, $modelsinfoarr['subjectimagewidth'], $modelsinfoarr['subjectimageheight']); if (!empty($uploadfilearr)) { $feedsubjectimg = $uploadfilearr; foreach ($uploadfilearr as $tmpkey => $tmpvalue) { if (empty($tmpvalue['error'])) { $setsqlarr[$tmpkey] = $tmpvalue['filepath']; } if (!empty($tmpvalue['aid'])) { $ids[] = $tmpvalue['aid']; } } } //词语过滤 if (!empty($modelsinfoarr['allowfilter'])) { $setsqlarr = scensor($setsqlarr, 1); } //发布时间 if (empty($_POST['dateline'])) { $setsqlarr['dateline'] = $_SGLOBAL['timestamp']; } else { $setsqlarr['dateline'] = sstrtotime($_POST['dateline']); if ($setsqlarr['dateline'] > $_SGLOBAL['timestamp'] || $setsqlarr['dateline'] < $_SGLOBAL['timestamp'] - 3600 * 24 * 365 * 2) { //不能早于2年 $setsqlarr['dateline'] = $_SGLOBAL['timestamp']; } } if (!checkperm('allowdirectpost') || checkperm('managemodpost')) { //不需要审核时入item表 if (empty($itemid)) { //插入数据 $itemid = inserttable($modelsinfoarr['modelname'] . 'items', $setsqlarr, 1); } else { //更新 $op = 'update'; unset($setsqlarr['uid']); unset($setsqlarr['username']); unset($setsqlarr['lastpost']); updatetable($modelsinfoarr['modelname'] . 'items', $setsqlarr, array('itemid' => $itemid)); $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelsinfoarr['modelname'] . 'message') . ' WHERE nid = \'' . $_POST['nid'] . '\''); $defaultmessage = $_SGLOBAL['db']->fetch_array($query); } $hash = getmodelhash($_POST['mid'], $itemid); if (!empty($ids)) { $ids = simplode($ids); $_SGLOBAL['db']->query('UPDATE ' . tname('attachments') . ' SET hash=\'' . $hash . '\' WHERE aid IN (' . $ids . ')'); } $do = 'pass'; } else { if (!empty($uploadfilearr['subjectimage']['aid'])) { $subjectimageid = $uploadfilearr['subjectimage']['aid']; } $setitemsqlarr = $setsqlarr; $do = 'me'; } if ($op == 'update') { if (!empty($resultmessage)) { foreach ($resultmessage as $value) { if (preg_match("/^(img|flash|file)\$/i", $value['formtype']) && !empty($defaultmessage[$value['fieldname']])) { if (empty($_POST[$value['fieldname'] . '_value']) || !empty($_FILES[$value['fieldname']]['name'])) { //当file删除时,或修改时执行删除操作 deletetable('attachments', array('hash' => $hash, 'subject' => $value['fieldname'])); //删除附件表 updatetable($modelsinfoarr['modelname'] . 'message', array($value['fieldname'] => ''), array('nid' => $_POST['nid'])); $ext = fileext($defaultmessage[$value['fieldname']]); if (in_array($ext, array('jpg', 'jpeg', 'png'))) { @unlink(A_DIR . '/' . substr($defaultmessage[$value['fieldname']], 0, strrpos($defaultmessage[$value['fieldname']], '.')) . '.thumb.jpg'); } @unlink(A_DIR . '/' . $defaultmessage[$value['fieldname']]); } } } } } //内容 $setsqlarr = $uploadfilearr = $ids = array(); $setsqlarr = getsetsqlarr($resultmessage); $uploadfilearr = $feedcolum = uploadfile($resultmessage, $_POST['mid'], $itemid, 0); $setsqlarr['message'] = trim($_POST['message']); $setsqlarr['postip'] = $_SGLOBAL['onlineip']; if (!empty($uploadfilearr)) { foreach ($uploadfilearr as $tmpkey => $tmpvalue) { if (empty($tmpvalue['error'])) { $setsqlarr[$tmpkey] = $tmpvalue['filepath']; } if (!empty($tmpvalue['aid'])) { $ids[] = $tmpvalue['aid']; } } } //添加内容 if (!empty($modelsinfoarr['allowfilter'])) { $setsqlarr = scensor($setsqlarr, 1); } if (!checkperm('allowdirectpost') || checkperm('managemodpost') || checkperm('allowdirectpost') && $op == 'update') { //不需要审核时入message表 if ($op == 'add') { $setsqlarr['itemid'] = $itemid; //添加内容 inserttable($modelsinfoarr['modelname'] . 'message', $setsqlarr); if (allowfeed() && !empty($_POST['addfeed']) && !empty($_SGLOBAL['supe_uid'])) { $feed['icon'] = 'comment'; $feed['title_template'] = 'feed_model_title'; $murl = geturl('action/model/name/' . $modelsinfoarr['modelname'] . '/itemid/' . $itemid); $aurl = A_URL; if (empty($_SCONFIG['siteurl'])) { $siteurl = getsiteurl(); $murl = $siteurl . $murl; $aurl = $siteurl . $aurl; } else { $siteurl = S_URL_ALL; } $feed['title_data'] = array('modelname' => '<a href="' . $siteurl . '/m.php?name=' . $modelsinfoarr['modelname'] . '">' . $modelsinfoarr['modelalias'] . '</a>'); $feed['body_template'] = 'feed_model_message'; $feed['body_data'] = array('subject' => '<a href="' . $murl . '">' . $_POST['subject'] . '</a>', 'message' => cutstr(strip_tags(preg_replace("/\\[.+?\\]/is", '', $_POST['message'])), 150)); if (!empty($feedsubjectimg)) { $feed['images'][] = array('url' => $aurl . '/' . $feedsubjectimg['subjectimage']['filepath'], 'link' => $murl); } else { foreach ($feedcolum as $feedimgvalue) { if ($feedimgvalue['filepath']) { $feed['images'][] = array('url' => $aurl . '/' . $feedimgvalue['filepath'], 'link' => $murl); break; } } if (empty($feed['images'])) { $picurl = getmessagepic(stripslashes($_POST['message'])); if ($picurl && strpos($picurl, '://') === false) { $picurl = $siteurl . '/' . $picurl; } if (!empty($picurl)) { $feed['images'][] = array('url' => $picurl, 'link' => $murl); } } } postfeed($feed); } } else { //更新内容 updatetable($modelsinfoarr['modelname'] . 'message', $setsqlarr, array('nid' => $_POST['nid'], 'itemid' => $itemid)); } updatetable('attachments', array('isavailable' => '1', 'type' => 'model'), array('hash' => $hash)); if (checkperm('allowdirectpost') && $op == 'update') { deletemodelitems($modelsinfoarr['modelname'], array($itemid), $_POST['mid'], 1, 1); } if (checkperm('allowdirectpost') && $op == 'update') { $jpurl = $cp ? empty($setsqlarr['uid']) ? S_URL . "/admincp.php?action=modelmanages&op=add&mid={$modelsinfoarr['mid']}" : S_URL . '/' . $theurl . '&mid=' . $modelsinfoarr['mid'] : S_URL . "/cp.php?ac=models&op=list&do={$do}&nameid={$modelsinfoarr['modelname']}"; showmessage('writing_success_online_please_wait_for_audit', $jpurl); } else { $jpurl = $cp ? S_URL . '/' . $theurl . '&mid=' . $modelsinfoarr['mid'] : S_URL . "/cp.php?ac=models&op=list&do={$do}&nameid={$modelsinfoarr['modelname']}"; showmessage('online_contributions_success', $jpurl); } } else { $setsqlarr = array_merge($setitemsqlarr, $setsqlarr); $setsqlarr['addfeed'] = $_POST['addfeed']; $setsqlarr = array('subject' => $setitemsqlarr['subject'], 'mid' => $modelsinfoarr['mid'], 'uid' => $setsqlarr['uid'], 'message' => saddslashes(serialize($setsqlarr)), 'dateline' => $_SGLOBAL['timestamp'], 'folder' => 1); $itemid = inserttable('modelfolders', $setsqlarr, 1); if (!empty($subjectimageid)) { $ids[] = $subjectimageid; } if (!empty($ids)) { $ids = simplode($ids); $hash = 'm' . str_pad($_POST['mid'], 6, 0, STR_PAD_LEFT) . 'f' . str_pad($itemid, 8, 0, STR_PAD_LEFT); $_SGLOBAL['db']->query('UPDATE ' . tname('attachments') . ' SET isavailable=\'1\', type=\'model\', hash=\'' . $hash . '\' WHERE aid IN (' . $ids . ')'); } $jpurl = $cp ? empty($setsqlarr['uid']) ? S_URL . "/admincp.php?action=modelmanages&op=add&mid={$modelsinfoarr['mid']}" : S_URL . "/admincp.php?action=modelfolders&mid={$modelsinfoarr['mid']}" : S_URL . "/cp.php?ac=models&op=list&do={$do}&nameid={$modelsinfoarr['modelname']}"; showmessage('writing_success_online_please_wait_for_audit', $jpurl); } }
private function _applyActivityTopic($res, $tid, $uid, $data) { // from forum_misc.php require_once libfile('function/post'); $activity = DzForumActivity::getActivityByTid($tid); if ($activity['expiration'] && $activity['expiration'] < TIMESTAMP) { return $this->_makeErrorInfo($res, 'activity_stop'); } $applyinfo = DzForumActivityApply::getApplyByTidUid($tid, $uid); if ($applyinfo && $applyinfo['verified'] < DzForumActivityApply::STATUS_VERIFIED_IMPROVE) { return $this->_makeErrorInfo($res, 'activity_repeat_apply'); } global $_G; $_GET = $data; $thread = ForumUtils::getTopicInfo($tid); $payvalue = intval($_GET['payvalue']); $payment = $_GET['payment'] ? $payvalue : -1; $message = cutstr(dhtmlspecialchars($_GET['message']), 200); $verified = $thread['authorid'] == $uid ? 1 : 0; $ufielddata = ''; if ($activity['ufield']) { $ufielddata = array(); $version = MobcentDiscuz::getMobcentDiscuzVersion(); $activity['ufield'] = $version != MobcentDiscuz::VERSION_X20 ? dunserialize($activity['ufield']) : unserialize($activity['ufield']); if (!empty($activity['ufield']['userfield'])) { if ($version == MobcentDiscuz::VERSION_X20) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } } $censor = discuz_censor::instance(); loadcache('profilesetting'); foreach ($data as $key => $value) { if (empty($_G['cache']['profilesetting'][$key])) { continue; } if (is_array($value)) { $value = implode(',', $value); } $value = cutstr(dhtmlspecialchars(trim($value)), 100, '.'); // if ($_G['cache']['profilesetting'][$key]['formtype'] == 'file' && !preg_match("/^https?:\/\/(.*)?\.(jpg|png|gif|jpeg|bmp)$/i", $value)) { // showmessage('activity_imgurl_error'); // } if (empty($value) && $key != 'residedist' && $key != 'residecommunity') { return $this->_makeErrorInfo($res, 'activity_exile_field'); } $ufielddata['userfield'][$key] = $value; } } if (!empty($activity['ufield']['extfield'])) { foreach ($activity['ufield']['extfield'] as $fieldid) { $value = cutstr(dhtmlspecialchars(trim($_GET['' . $fieldid])), 50, '.'); $ufielddata['extfield'][$fieldid] = $value; } } $ufielddata = !empty($ufielddata) ? serialize($ufielddata) : ''; } if ($_G['setting']['activitycredit'] && $activity['credit'] && empty($applyinfo['verified'])) { checklowerlimit(array('extcredits' . $_G['setting']['activitycredit'] => '-' . $activity['credit'])); updatemembercount($uid, array($_G['setting']['activitycredit'] => '-' . $activity['credit']), true, 'ACC', $tid); } $data = array('tid' => $tid, 'username' => $_G['username'], 'uid' => $uid, 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata); if ($applyinfo && $applyinfo['verified'] == DzForumActivityApply::STATUS_VERIFIED_IMPROVE) { DzForumActivityApply::updateApplyById($data, $applyinfo['applyid']); } else { DzForumActivityApply::insertApply($data); } DzForumActivity::updateApplyNumberByTid($tid); if ($thread['authorid'] != $uid) { notification_add($thread['authorid'], 'activity', 'activity_notice', array('tid' => $tid, 'subject' => $thread['subject'])); $space = array(); space_merge($space, 'field_home'); if (!empty($space['privacy']['feed']['newreply'])) { $feed['icon'] = 'activity'; $feed['title_template'] = 'feed_reply_activity_title'; $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$thread['subject']}</a>", 'hash_data' => "tid{$tid}"); $feed['id'] = $tid; $feed['idtype'] = 'tid'; postfeed($feed); } } $res = $this->_makeErrorInfo($res, 'activity_completion'); $res['rs'] = 1; return $res; }
public function replyfeed() { if (!$this->feed) { if ($this->forum['allowfeed'] && !$this->param['isanonymous']) { if ($this->thread['authorid'] != $this->member['uid']) { $post_url = "forum.php?mod=redirect&goto=findpost&pid=" . $this->pid . "&ptid=" . $this->thread['tid']; $this->feed['icon'] = 'post'; $this->feed['title_template'] = !empty($this->thread['author']) ? 'feed_reply_title' : 'feed_reply_title_anonymous'; $this->feed['title_data'] = array('subject' => "<a href=\"{$post_url}\">" . $this->thread['subject'] . "</a>", 'author' => "<a href=\"home.php?mod=space&uid=" . $this->thread['authorid'] . "\">" . $this->thread['author'] . "</a>"); $forum_attachexist = getglobal('forum_attachexist'); if (!empty($forum_attachexist)) { $imgattach = C::t('forum_attachment_n')->fetch_max_image('tid:' . $this->thread['tid'], 'pid', $this->pid); $firstaid = $imgattach['aid']; unset($imgattach); if ($firstaid) { $this->feed['images'] = array(getforumimg($firstaid)); $this->feed['image_links'] = array($post_url); } } } } } $this->feed['title_data']['hash_data'] = "tid" . $this->thread['tid']; $this->feed['id'] = $this->pid; $this->feed['idtype'] = 'pid'; if ($this->feed['icon']) { postfeed($this->feed); } }
private function _setToVote($res, $tid, $options) { global $_G; $_G['tid'] = $tid; require_once libfile('function/post'); $options = rawurldecode($options); $_GET['pollanswers'] = $options; if (!$_G['group']['allowvote']) { return $this->makeErrorInfo($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle'])); } elseif (!empty($thread['closed'])) { return $this->makeErrorInfo($res, 'thread_poll_closed'); } elseif (empty($_GET['pollanswers'])) { return $this->makeErrorInfo($res, 'thread_poll_invalid'); } $pollarray = C::t('forum_poll')->fetch($_G['tid']); $overt = $pollarray['overt']; if (!$pollarray) { return $this->makeErrorInfo($res, 'poll_not_found'); } elseif ($pollarray['expiration'] && $pollarray['expiration'] < TIMESTAMP) { return $this->makeErrorInfo($res, 'poll_overdue'); } elseif ($pollarray['maxchoices'] && $pollarray['maxchoices'] < count($_GET['pollanswers'])) { return $this->makeErrorInfo($res, 'poll_choose_most', array('{maxchoices}' => $pollarray['maxchoices'])); } $voterids = $_G['uid'] ? $_G['uid'] : $_G['clientip']; $polloptionid = array(); $pollarray = ''; $query = C::t('forum_polloption')->fetch_all_by_tid($_G['tid']); foreach ($query as $pollarray) { if (strexists("\t" . $pollarray['voterids'] . "\t", "\t" . $voterids . "\t")) { return $this->makeErrorInfo($res, 'thread_poll_voted'); } $polloptionid[] = $pollarray['polloptionid']; } $polloptionids = ''; foreach ($_GET['pollanswers'] as $key => $id) { if (!in_array($id, $polloptionid)) { return $this->makeErrorInfo($res, 'parameters_error'); } unset($polloptionid[$key]); $polloptionids[] = $id; } // $_GET['pollanswers'] = str_replace(',', ' ', $options); $_GET['pollanswers'] = explode(',', $options); // DB::query("UPDATE ".DB::table('forum_poll')." SET voters=voters+1 where tid=".$_G['tid']); // DB::query("UPDATE ".DB::table('forum_polloption')." SET votes=votes+1,voterids=CONCAT(voterids,'".$_G['uid']."') where polloptionid in (".$_GET['pollanswers'].")"); foreach ($_GET['pollanswers'] as $key => $value) { // DzUserVote::updateUserVoteByTid($_G['tid']); // DzUserVote::updateUserVotePolloption($_G['uid'], $value); C::t('forum_polloption')->update_vote($value, $voterids . "\t", 1); C::t('forum_thread')->update($_G['tid'], array('lastpost' => $_G['timestamp']), true); C::t('forum_poll')->update_vote($_G['tid']); C::t('forum_pollvoter')->insert(array('tid' => $_G['tid'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'options' => $value, 'dateline' => $_G['timestamp'])); updatecreditbyaction('joinpoll'); $space = array(); space_merge($space, 'field_home'); if ($overt && !empty($space['privacy']['feed']['newreply'])) { $feed['icon'] = 'poll'; $feed['title_template'] = 'feed_thread_votepoll_title'; $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$_G['tid']}\">{$thread['subject']}</a>", 'author' => "<a href=\"home.php?mod=space&uid={$thread['authorid']}\">{$thread['author']}</a>", 'hash_data' => "tid{$_G[tid]}"); $feed['id'] = $_G['tid']; $feed['idtype'] = 'tid'; postfeed($feed); } } // $userVoteInfo = DzUserVote::getUserVoteTotalNum($tid); $polloption_query = DB::query("SELECT polloption as name,polloptionid as pollItemId,votes as totalNum FROM " . DB::table('forum_polloption') . " where tid=" . $tid); while ($polloption_rst = DB::fetch($polloption_query)) { $polloption_arr[] = $polloption_rst; } for ($di = 0; $di < count($polloption_arr); $di++) { $polloption_arr[$di][pollItemId] = (int) $polloption_arr[$di][pollItemId]; $polloption_arr[$di][totalNum] = (int) $polloption_arr[$di][totalNum]; } $res['vote_rs'] = $polloption_arr; $params['noError'] = 1; $res = $this->makeErrorInfo($res, 'thread_poll_succeed', $params); return $res; }
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; }
public function massSend($mob,$content,$time) { $http = 'http://119.145.9.12/services/emsServices?wsdl'; $data = array ( 'enterpriseID'=>"15440", 'loginName'=>"admin", 'password'=>strtolower(md5("kouyan1559")), 'smsId'=>"", 'subPort'=>"", 'Phone'=>"", 'mobiles'=>$mob, 'content'=>iconv("gbk", "utf-8//IGNORE", $content), 'sendTime'=>$time ); $re = postfeed($http,$data); //POST return $re; }
function article_move_forums($arr, $old_arr) { global $_G; $arr['content'] = preg_replace(array('/<center>([\\s\\S]*?)<\\/center>/', '/\\s(?=\\s)/'), array("[align=center]\\1[/align]", ''), $arr['content']); $subject = addslashes(trim($arr['title'])); if ($arr['check']) { if (!strlen($subject)) { return FALSE; } $num = DB::result_first('SELECT COUNT(*) FROM ' . DB::table('forum_thread') . " WHERE subject='{$subject}' AND displayorder > '-1'"); if ($num) { return FALSE; } } if ($arr['contents'] > 1 && $arr['is_content_reply'] != 1) { $arr['reply'] = array(); } $time_arr = create_public_time($arr, count($arr['reply']) + 1, 1); if ($arr['contents'] == 1) { $uid_arr = get_rand_uid($arr, 'reply'); } else { if ($arr['is_content_reply'] != 1) { if ($arr['content_arr']) { $arr['content'] = content_merge($arr['content_arr']); } $uid_arr = get_rand_uid($arr); } } $arr['public_time'] = $arr['public_time'] ? $arr['public_time'] : array_shift($time_arr); require_once libfile('function/editor'); require_once libfile('function/forum'); $subject = htmlspecialchars_decode(format_html($subject)); $subject = htmlspecialchars_decode(format_html($subject)); $arr['content'] = dstripslashes($arr['content']); $arr['content'] = img_htmlbbcode($arr['content'], $arr['page_url']); $arr['content'] = media_htmlbbcode($arr['content'], $arr['page_url']); $arr['content'] = audio_htmlbbcode($arr['content'], $arr['page_url']); $message = htmlspecialchars_decode(html2bbcode($arr['content'])); $message = dstripslashes(format_html($message)); $arr['fid'] = $_G['fid'] = $_GET['forums'] ? $_GET['forums'] : $arr['forum_fid']; $_G['uid'] = $arr['uid'] ? $arr['uid'] : $_G['uid']; $view_num = $arr['view_num']; require_once libfile('function/post'); $special = 0; if (trim($subject) == '' || trim($message) == '') { return -1; } if (!$sortid && !$special && trim($message) == '') { return -1; } $_GET['save'] = $arr['uid'] ? $arr['uid'] : $_G['uid']; $uid = $_GET['save']; $typeid = intval($_GET['threadtypeid']) ? intval($_GET['threadtypeid']) : $arr['forum_typeid']; $displayorder = 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 -2; } if (!$sortid && $_G['forum']['threadsorts']['required'] && !$special) { return -3; } if ($price > 0 && floor($price * (1 - $_G['setting']['creditstax'])) == 0) { return -4; } $_G['forum'] = DB::fetch_first("SELECT * FROM " . DB::table('forum_forum') . " WHERE fid = '{$arr['fid']}'"); //查询版块信息 if (!$_G['forum']) { return -5; } $sortid = $special && $_G['forum']['threadsorts']['types'][$sortid] ? 0 : $sortid; $typeexpiration = intval($_GET['typeexpiration']); if ($_G['forum']['threadsorts']['expiration'][$typeid] && !$typeexpiration) { return -5; } $_G['forum_optiondata'] = array(); if ($_G['forum']['threadsorts']['types'][$sortid] && !$_G['forum']['allowspecialonly']) { $_G['forum_optiondata'] = threadsort_validator($_GET['typeoption'], $pid); } $author = !$arr['username'] ? $_G['username'] : $arr['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'])); $_GET['allownoticeauthor'] && ($thread['status'] = setstatus(6, 1, $thread['status'])); $isgroup = $_G['forum']['status'] == 3 ? 1 : 0; //检查各项设置 $bbcodeoff = checkbbcodes($message, FALSE); $smileyoff = checksmilies($message, FALSE); $parseurloff = FALSE; $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 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 ($old_arr['forum_id']) { $info = DB::fetch_first("SELECT p.pid,p.tid,t.tid,p.first FROM " . DB::table('forum_post') . " p Inner Join " . DB::table('forum_thread') . " t ON p.tid = t.tid WHERE p.first = '1' AND t.tid='" . $old_arr['forum_id'] . "' AND t.displayorder > '-1'"); } $reply_count = count($arr['reply']); $view_num = $view_num < $reply_count - 1 ? rand($reply_count * 2, $reply_count * 10) : $view_num; if ($info['tid']) { //更新 DB::query("UPDATE " . DB::table('forum_thread') . " SET typeid='{$typeid}', author='{$author}', authorid='{$uid}', subject='{$subject}', dateline='{$arr['public_time']}', lastpost='{$arr['public_time']}', fid='{$arr['fid']}', lastposter='{$author}', views='{$view_num}', attachment='0' WHERE tid='{$info['tid']}'", 'UNBUFFERED'); $tid = $info['tid']; } else { //添加 DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, posttableid, readperm, price, typeid, sortid, author, authorid, subject, dateline, lastpost, lastposter, views, displayorder, digest, special, attachment, moderated, status, isgroup, replycredit, closed)\r\n\t\t\tVALUES ('{$_G['fid']}', '0', '{$readperm}', '{$price}', '{$typeid}', '{$sortid}', '{$author}', '{$_G['uid']}', '{$subject}', '{$arr['public_time']}', '{$arr['public_time']}', '{$author}', '{$view_num}', '{$displayorder}', '{$digest}', '{$special}', '0', '{$moderated}', '32', '{$isgroup}', '{$replycredit}', '" . ($closed ? "1" : '0') . "')"); $tid = DB::insert_id(); useractionlog($uid, 'tid'); } DB::update('common_member_field_home', array('recentnote' => $subject), array('uid' => $uid)); if ($moderated) { updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG'); updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1); } if (DISCUZ_VERSION == 'X2') { //2.0版本 $tagstr = addthreadtag($arr['article_tag'], $tid); } else { $class_tag = new tag(); $tagstr = $class_tag->add_tag($arr['article_tag'], $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); 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'] && $_GET['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']}')"); } $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $post_setarr = array('fid' => $arr['fid'], 'tid' => $tid, 'first' => '1', 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $arr['public_time'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => 0, 'anonymous' => $isanonymous, 'usesig' => 1, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'replycredit' => 0, 'status' => defined('IN_MOBILE') ? 8 : 0); if (DISCUZ_VERSION != 'X2') { //2.5版本 2.5版本多了一个position字段 $post_setarr['position'] = 1; $post_setarr = dstripslashes($post_setarr); } else { $post_setarr = daddslashes($post_setarr); } $post_setarr['tags'] = $tagstr; $replys = 0; if ($info['tid']) { //更新 //发布时间要做更改 $new_post_arr = DB::fetch_first("SELECT dateline FROM " . DB::table('forum_post') . " WHERE tid='{$tid}' ORDER BY dateline ASC limit 1"); $post_setarr['dateline'] = $new_post_arr['dateline'] - 3600; DB::update('forum_post', $post_setarr, array('pid' => $info['pid'])); $pid = $info['pid']; } else { $pid = insertpost($post_setarr); $post_setarr = array(); //发布回复 if ($arr['is_public_reply'] == 1 && $arr['reply'] || $arr['is_content_reply'] == 1) { //是否开启发布回复 if ($arr['is_content_reply'] == 1) { $uid_arr = $time_arr = array(); } $reply_arr = $arr['reply']; $replys = count($reply_arr); if ($arr['public_reply_seq'] == 1) { shuffle($reply_arr); } foreach ((array) $reply_arr as $k => $v) { $message = dstripslashes($v['content']); $message = media_htmlbbcode($message, $arr['page_url']); $message = img_htmlbbcode($message, $arr['page_url']); $message = htmlspecialchars_decode(html2bbcode($message)); //print_r($v['content']);exit(); 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'] : $arr['username'], 'authorid' => $uid_arr[$k]['uid'] ? $uid_arr[$k]['uid'] : $arr['uid'], 'subject' => '', 'dateline' => $time_arr[$k] ? $time_arr[$k] : $arr['public_time'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => 0, 'anonymous' => $_G['group']['allowanonymous'] && !empty($_GET['isanonymous']) ? 1 : 0, 'usesig' => 1, 'htmlon' => $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0, 'bbcodeoff' => checkbbcodes($message, !empty($_GET['bbcodeoff'])), 'smileyoff' => checksmilies($message, !empty($_GET['smileyoff'])), 'parseurloff' => !empty($_GET['parseurloff']), 'attachment' => '0', 'tags' => 0, 'replycredit' => 0, 'status' => defined('IN_MOBILE') ? 8 : 0); $lastpost = $post_setarr['dateline']; $lastposter = $post_setarr['author']; if (DISCUZ_VERSION != 'X2') { //2.5版本 2.5版本多了一个position字段 $post_setarr['position'] = $k + 2; $post_setarr = dstripslashes($post_setarr); } else { $post_setarr = daddslashes($post_setarr); } $reply_pid = insertpost($post_setarr); $v['tid'] = $tid; $v['pid'] = $reply_pid; $v['is_post'] = 1; //标识是回复 $v['cookie'] = $arr['cookie']; $v['is_water_img'] = $arr['is_water_img']; $v['is_download_img'] = $arr['is_download_img']; $v['is_download_file'] = $arr['is_download_file']; $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['content'] = $v['content']; //$re_arr = forum_downremotefile($forum_arr); if ($arr['is_download_img'] == 1) { $re_arr = forum_downremotefile($v); } DB::query("UPDATE " . DB::table('common_member_count') . " SET posts=posts+1 WHERE uid='{$post_setarr['authorid']}'"); //更新数 $new[$k] = $post_setarr; } unset($post_setarr); DB::update('forum_thread', array('replies' => count($reply_arr), 'lastpost' => $lastpost, 'lastposter' => $lastposter), array('tid' => $tid)); } } //exit(); $re = $arr; $re['fid'] = $fid; $re['tid'] = $tid; $re['fid'] = $fid; $re['uid'] = $arr['uid']; $re['username'] = $author; $re['pid'] = $pid; $re['message'] = $message; if ($pid && getstatus($thread['status'], 1)) { savepostposition($tid, $pid); } $threadimageaid = 0; $threadimage = array(); //print_r($message);exit(); 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 = DB::fetch_first("SELECT aid, attachment, remote FROM " . DB::table(getattachtablebytid($tid)) . " WHERE tid='{$tid}' AND isimage IN ('1', '-1') ORDER BY width DESC LIMIT 1"); $threadimageaid = $threadimage['aid']; } if ($_G['forum']['picstyle']) { setthreadcover($pid, 0, $threadimageaid); } } /*删除附件*/ if ($old_arr['forum_id']) { $query = DB::query("SELECT attachment, thumb, remote, aid FROM " . DB::table(getattachtablebytid($old_arr['forum_id'])) . " WHERE tid='{$old_arr['forum_id']}'"); while ($v = DB::fetch($query)) { $attach[] = $v; } dunlink($attach); DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE tid='{$old_arr['forum_id']}'"); DB::query("DELETE FROM " . DB::table(getattachtablebytid($old_arr['forum_id'])) . " WHERE tid='{$old_arr['forum_id']}'"); DB::delete('forum_threadimage', "tid='{$old_arr['forum_id']}'"); //图片表 } $param = array('fid' => $arr['fid'], 'tid' => $tid, 'pid' => $pid); $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]); dsetcookie('clearUserdata', 'forum'); if ($specialextra) { $classname = 'threadplugin_' . $specialextra; if (class_exists($classname) && method_exists($threadpluginclass = new $classname(), 'newthread_submit_end')) { $threadpluginclass->newthread_submit_end($_G['fid'], $tid); } } $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array()); if (!empty($_GET['addfeed']) && $_G['forum']['allowfeed'] && !$isanonymous) { $message = !$price ? $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'])) { $firstaid = DB::result_first("SELECT aid FROM " . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}' AND dateline>'0' AND isimage='1' ORDER BY dateline LIMIT 1"); if ($firstaid) { $feed['images'] = array(getforumimg($firstaid)); $feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}"); } } } } $feed['title_data']['hash_data'] = "tid{$tid}"; $feed['id'] = $tid; $feed['idtype'] = 'tid'; if ($feed['icon']) { postfeed($feed); } if ($displayorder != -4) { if ($digest) { updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']); } updatepostcredits('+', $_G['uid'], 'post', $_G['fid']); if ($isgroup) { DB::query("UPDATE " . DB::table('forum_groupuser') . " SET threads=threads+1, lastupdate='" . $arr['public_time'] . "' WHERE uid='{$_G['uid']}' AND fid='{$_G['fid']}'"); } $subject = str_replace("\t", ' ', $subject); $f_lastpost = "{$tid}\t{$subject}\t" . $arr['public_time'] . "\t{$author}"; if ($_G['forum']['type'] == 'sub') { DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$f_lastpost}' WHERE fid='" . $_G['forum'][fup] . "'", 'UNBUFFERED'); } } $subject = str_replace("\t", ' ', $subject); $replys = $replys ? $replys : 1; //今日发帖 $todayposts = date("Yjn", $arr['public_time']) == date("Yjn", $v) ? 1 : 0; foreach ((array) $time_arr as $k => $v) { if (date("Yjn", $_G['timestamp']) == date("Yjn", $v)) { $todayposts++; } } DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$f_lastpost}', threads=threads+1, posts=posts+{$replys}, todayposts=todayposts+{$todayposts} WHERE fid='{$arr['fid']}'", 'UNBUFFERED'); //更新今日发帖这些数据 if ($_G['forum']['status'] == 3) { require_once libfile('function/group'); updateactivity($_G['fid'], 0); require_once libfile('function/grouplog'); updategroupcreditlog($_G['fid'], $_G['uid']); } return $re; }