本文整理汇总了PHP中convertunusedattach函数的典型用法代码示例。如果您正苦于以下问题:PHP convertunusedattach函数的具体用法?PHP convertunusedattach怎么用?PHP convertunusedattach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertunusedattach函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: after_newthread
public function after_newthread()
{
$threadimageaid = 0;
$threadimage = array();
$tid = $this->tid;
$pid = $this->pid;
$fid = $this->forum['fid'];
if ($this->param['special'] == 4 && $_GET['activityaid']) {
$threadimageaid = $_GET['activityaid'];
convertunusedattach($_GET['activityaid'], $tid, $pid);
}
$this->mobile_upload();
if (($this->group['allowpostattach'] || $this->group['allowpostimage']) && ($_GET['attachnew'] || $this->param['sortid'] || !empty($_GET['activityaid']))) {
updateattach($this->param['displayorder'] == -4 || $this->param['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' => $fid, 'tid' => $tid, 'pid' => $pid, 'coverimg' => '');
$param = array();
if ($this->forum['picstyle']) {
if (!setthreadcover($pid, 0, $threadimageaid) && !defined('IN_MOBILE')) {
$imglist = array();
preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $this->param['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={$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']));
}
$this->param['values'] = array_merge((array) $this->param['values'], $values);
$this->param['param'] = array_merge((array) $this->param['param'], $param);
}
示例2: before_editpost
public function before_editpost($parameters)
{
global $_G;
$sortid = $parameters['sortid'];
$isfirstpost = $this->post['first'] ? 1 : 0;
if ($isfirstpost) {
$parameters['typeid'] = isset($this->forum['threadtypes']['types'][$parameters['typeid']]) ? $parameters['typeid'] : 0;
if (!$this->forum['ismoderator'] && !empty($this->forum['threadtypes']['moderators'][$this->thread['typeid']])) {
$parameters['typeid'] = $this->thread['typeid'];
}
$parameters['sortid'] = isset($this->forum['threadsorts']['types'][$parameters['sortid']]) ? $parameters['sortid'] : 0;
$typeexpiration = intval($_GET['typeexpiration']);
if (!$parameters['typeid'] && $this->forum['threadtypes']['required'] && !$this->thread['special']) {
showmessage('post_type_isnull');
}
if ($this->forum['threadsorts']['types'][$sortid] && $_G['forum_checkoption']) {
$_G['forum_optiondata'] = threadsort_validator($_GET['typeoption'], $this->post['pid']);
}
$this->param['threadimageaid'] = 0;
$this->param['threadimage'] = array();
if ($this->forum['threadsorts']['types'][$parameters['sortid']] && $_G['forum_optiondata'] && is_array($_G['forum_optiondata'])) {
$sql = $separator = $filedname = $valuelist = '';
foreach ($_G['forum_optiondata'] as $optionid => $value) {
$value = censor(daddslashes($value));
if ($_G['forum_optionlist'][$optionid]['type'] == 'image') {
$identifier = $_G['forum_optionlist'][$optionid]['identifier'];
$newsortaid = intval($_GET['typeoption'][$identifier]['aid']);
if ($newsortaid && $_GET['oldsortaid'][$identifier] && $newsortaid != $_GET['oldsortaid'][$identifier]) {
$attach = C::t('forum_attachment_n')->fetch('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
C::t('forum_attachment')->delete($_GET['oldsortaid'][$identifier]);
C::t('forum_attachment_n')->delete('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
dunlink($attach);
$this->param['threadimageaid'] = $newsortaid;
convertunusedattach($newsortaid, $this->thread['tid'], $this->post['pid']);
}
} else {
if ($_G['forum_optionlist'][$optionid]['type'] == 'face') {
$identifier = $_G['forum_optionlist'][$optionid]['identifier'];
$newsortaid = intval($_GET['typeoption'][$identifier]['aid']);
if ($newsortaid && $_GET['oldsortaid'][$identifier] && $newsortaid != $_GET['oldsortaid'][$identifier]) {
$attach = C::t('forum_attachment_n')->fetch('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
C::t('forum_attachment')->delete($_GET['oldsortaid'][$identifier]);
C::t('forum_attachment_n')->delete('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
dunlink($attach);
$this->param['threadimageaid'] = $newsortaid;
convertunusedattach($newsortaid, $this->thread['tid'], $this->post['pid']);
}
}
}
if ($_G['forum_optionlist'][$optionid]['unchangeable']) {
continue;
}
if (($_G['forum_optionlist'][$optionid]['search'] || in_array($_G['forum_optionlist'][$optionid]['type'], array('radio', 'select', 'number'))) && $value) {
$filedname .= $separator . $_G['forum_optionlist'][$optionid]['identifier'];
$valuelist .= $separator . "'{$value}'";
$sql .= $separator . $_G['forum_optionlist'][$optionid]['identifier'] . "='{$value}'";
$separator = ' ,';
}
C::t('forum_typeoptionvar')->update_by_tid($this->thread['tid'], array('value' => $value, 'sortid' => $parameters['sortid']), false, false, $optionid);
}
if ($typeexpiration) {
C::t('forum_typeoptionvar')->update_by_tid($this->thread['tid'], array('expiration' => TIMESTAMP + $typeexpiration), false, false, null, $parameters['sortid']);
}
if ($sql || $filedname && $valuelist) {
if (C::t('forum_optionvalue')->fetch_all_tid($parameters['sortid'], "WHERE tid='" . $this->thread['tid'] . "'")) {
if ($sql) {
C::t('forum_optionvalue')->update($parameters['sortid'], $this->thread['tid'], $this->forum['fid'], $sql);
}
} elseif ($filedname && $valuelist) {
C::t('forum_optionvalue')->insert($parameters['sortid'], "({$filedname}, tid, fid) VALUES ({$valuelist}, '" . $this->thread['tid'] . "', '" . $this->forum['fid'] . "')");
}
}
}
}
}
示例3: dunlink
} else {
$redirecturl = "forum.php?mod=viewthread&do=tradeinfo&tid={$_G['tid']}&pid={$pid}";
}
}
}
if ($special == 4 && $isfirstpost && $_G['group']['allowpostactivity']) {
$activityaid = DB::result_first("SELECT aid FROM " . DB::table('forum_activity') . " WHERE tid='{$_G['tid']}'");
if ($activityaid && $activityaid != $_G['gp_activityaid']) {
$attach = DB::fetch_first("SELECT attachment, thumb, remote, aid FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE aid='{$activityaid}'");
DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE aid='{$activityaid}'");
DB::query("DELETE FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE aid='{$activityaid}'");
dunlink($attach);
}
if ($_G['gp_activityaid']) {
$threadimageaid = $_G['gp_activityaid'];
convertunusedattach($_G['gp_activityaid'], $_G['tid'], $pid);
DB::query("UPDATE " . DB::table('forum_activity') . " SET aid='{$_G['gp_activityaid']}' WHERE tid='{$_G['tid']}'");
}
}
if ($isfirstpost && $attachupdate) {
if (!$threadimageaid) {
$threadimage = DB::fetch_first("SELECT aid, attachment, remote FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1') ORDER BY width DESC LIMIT 1");
$threadimageaid = $threadimage['aid'];
}
if ($_G['forum']['picstyle']) {
if (empty($thread['cover'])) {
setthreadcover($pid, 0, $threadimageaid);
} else {
setthreadcover($pid, $_G['tid'], 0);
}
}
示例4: preg_replace
}
$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']))) {
updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_G['gp_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 ($threadimageaid) {
if (!$threadimage) {
$threadimage = DB::fetch_first("SELECT attachment, remote FROM " . DB::table(getattachtablebytid($tid)) . " WHERE aid='{$threadimageaid}'");
示例5: sendPost
//.........这里部分代码省略.........
$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');
示例6: checkbbcodes
$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;
$attentionon = empty($_GET['attention_add']) ? 0 : 1;
$pinvisible = $modnewthreads ? -2 : (empty($_GET['save']) ? 0 : -3);
$class_tag = new tag();
$tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid');
insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $_G['timestamp'], 'message' => '', 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $_GET['usesig'], 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr));
$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' => 0, 'anonymous' => $isanonymous, 'usesig' => $_GET['usesig'], 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => $attachment, 'tags' => $tagstr, 'status' => defined('IN_MOBILE') ? 8 : 0));
($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $_GET['tradeaid']) && updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']);
require_once libfile('function/trade');
trade_create(array('tid' => $tid, 'pid' => $pid, 'aid' => $_GET['tradeaid'], 'item_expiration' => $_GET['item_expiration'], 'thread' => $thread, 'discuz_uid' => $_G['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'], $tid, $pid);
}
if ($_G['forum']['picstyle']) {
setthreadcover($pid);
}
$param = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '');
include_once libfile('function/stat');
updatestat($isgroup ? 'groupthread' : 'trade');
dsetcookie('clearUserdata', 'forum');
if ($modnewthreads) {
updatemoderate('tid', $tid);
C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1);
manage_addnotify('verifythread');
showmessage('post_newthread_mod_succeed', "forum.php?mod=viewthread&tid={$tid}&extra={$extra}", $param);
} else {
$feed = array();
示例7: before_editpost
public function before_editpost($parameters)
{
$isfirstpost = $this->post['first'] ? 1 : 0;
if ($isfirstpost) {
if ($this->thread['special'] == 4 && $this->group['allowpostactivity']) {
$activitytime = intval($_GET['activitytime']);
if (empty($_GET['starttimefrom'][$activitytime])) {
showmessage('activity_fromtime_please');
} elseif (strtotime($_GET['starttimefrom'][$activitytime]) === -1 || @strtotime($_GET['starttimefrom'][$activitytime]) === FALSE) {
showmessage('activity_fromtime_error');
} elseif ($activitytime && (@strtotime($_GET['starttimefrom']) > @strtotime($_GET['starttimeto']) || !$_GET['starttimeto'])) {
showmessage('activity_fromtime_error');
} elseif (!trim($_GET['activityclass'])) {
showmessage('activity_sort_please');
} elseif (!trim($_GET['activityplace'])) {
showmessage('activity_address_please');
} elseif (trim($_GET['activityexpiration']) && (@strtotime($_GET['activityexpiration']) === -1 || @strtotime($_GET['activityexpiration']) === FALSE)) {
showmessage('activity_totime_error');
}
$activity = array();
$activity['class'] = censor(dhtmlspecialchars(trim($_GET['activityclass'])));
$activity['starttimefrom'] = @strtotime($_GET['starttimefrom'][$activitytime]);
$activity['starttimeto'] = $activitytime ? @strtotime($_GET['starttimeto']) : 0;
$activity['place'] = censor(dhtmlspecialchars(trim($_GET['activityplace'])));
$activity['cost'] = intval($_GET['cost']);
$activity['gender'] = intval($_GET['gender']);
$activity['number'] = intval($_GET['activitynumber']);
if ($_GET['activityexpiration']) {
$activity['expiration'] = @strtotime($_GET['activityexpiration']);
} else {
$activity['expiration'] = 0;
}
$extfield = $_GET['extfield'];
$extfield = explode("\n", $_GET['extfield']);
foreach ($extfield as $key => $value) {
$extfield[$key] = censor(trim($value));
if ($extfield[$key] === '' || is_numeric($extfield[$key])) {
unset($extfield[$key]);
}
}
$extfield = array_unique($extfield);
if (count($extfield) > $this->setting['activityextnum']) {
showmessage('post_activity_extfield_toomany', '', array('maxextfield' => $this->setting['activityextnum']));
}
$activity['ufield'] = array('userfield' => $_GET['userfield'], 'extfield' => $extfield);
$activity['ufield'] = serialize($activity['ufield']);
if (intval($_GET['activitycredit']) > 0) {
$activity['credit'] = intval($_GET['activitycredit']);
}
$data = array('cost' => $activity['cost'], 'starttimefrom' => $activity['starttimefrom'], 'starttimeto' => $activity['starttimeto'], 'place' => $activity['place'], 'class' => $activity['class'], 'gender' => $activity['gender'], 'number' => $activity['number'], 'expiration' => $activity['expiration'], 'ufield' => $activity['ufield'], 'credit' => $activity['credit']);
C::t('forum_activity')->update($this->thread['tid'], $data);
}
}
if ($parameters['special'] == 4 && $isfirstpost && $this->group['allowpostactivity']) {
$activity = C::t('forum_activity')->fetch($this->thread['tid']);
$activityaid = $activity['aid'];
if ($activityaid && $activityaid != $_GET['activityaid']) {
$attach = C::t('forum_attachment_n')->fetch('tid:' . $this->thread['tid'], $activityaid);
C::t('forum_attachment')->delete($activityaid);
C::t('forum_attachment_n')->delete('tid:' . $this->thread['tid'], $activityaid);
dunlink($attach);
}
if ($_GET['activityaid']) {
$threadimageaid = $_GET['activityaid'];
convertunusedattach($_GET['activityaid'], $this->thread['tid'], $this->post['pid']);
C::t('forum_activity')->update($this->thread['tid'], array('aid' => $_GET['activityaid']));
}
}
}
示例8: elseif
}
if ($stand == 1) {
DB::query("UPDATE " . DB::table('forum_debate') . " SET affirmreplies=affirmreplies+1 WHERE tid='{$_G['tid']}'");
} elseif ($stand == 2) {
DB::query("UPDATE " . DB::table('forum_debate') . " SET negareplies=negareplies+1 WHERE tid='{$_G['tid']}'");
}
DB::query("INSERT INTO " . DB::table('forum_debatepost') . " (tid, pid, uid, dateline, stand, voters, voterids) VALUES ('{$_G['tid']}', '{$pid}', '{$_G['uid']}', '{$_G['timestamp']}', '{$stand}', '0', '')");
}
($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_G['gp_attachnew'] || $special == 2 && $_G['gp_tradeaid']) && updateattach($thread['displayorder'] == -4 || $modnewreplies, $_G['tid'], $pid, $_G['gp_attachnew']);
$replymessage = 'post_reply_succeed';
if ($special == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid'] && !empty($_G['gp_trade']) && !empty($_G['gp_item_name'])) {
require_once libfile('function/trade');
trade_create(array('tid' => $_G['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'])) : '', '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']));
$replymessage = 'trade_add_succeed';
if (!empty($_G['gp_tradeaid'])) {
convertunusedattach($_G['gp_tradeaid'], $_G['tid'], $pid);
}
}
if ($specialextra) {
@(include_once DISCUZ_ROOT . './source/plugin/' . $_G['setting']['threadplugins'][$specialextra]['module'] . '.class.php');
$classname = 'threadplugin_' . $specialextra;
if (class_exists($classname) && method_exists($threadpluginclass = new $classname(), 'newreply_submit_end')) {
$threadpluginclass->newreply_submit_end($_G['fid'], $_G['tid']);
}
}
$_G['forum']['threadcaches'] && deletethreadcaches($_G['tid']);
include_once libfile('function/stat');
updatestat($thread['isgroup'] ? 'grouppost' : 'post');
$param = array('fid' => $_G['fid'], 'tid' => $_G['tid'], 'pid' => $pid, 'from' => $_G['gp_from'], 'sechash' => !empty($_G['gp_sechash']) ? $_G['gp_sechash'] : '');
dsetcookie('clearUserdata', 'forum');
if ($modnewreplies) {
示例9: before_editpost
public function before_editpost($parameters)
{
global $closed;
if ($parameters['special'] == 2 && $this->group['allowposttrade']) {
if ($trade = C::t('forum_trade')->fetch_goods($this->thread['tid'], $this->post['pid'])) {
$seller = empty($_GET['paymethod']) && $_GET['seller'] ? censor(dhtmlspecialchars(trim($_GET['seller']))) : '';
$item_name = censor(dhtmlspecialchars(trim($_GET['item_name'])));
$item_price = floatval($_GET['item_price']);
$item_credit = intval($_GET['item_credit']);
$item_locus = censor(dhtmlspecialchars(trim($_GET['item_locus'])));
$item_number = intval($_GET['item_number']);
$item_quality = intval($_GET['item_quality']);
$item_transport = intval($_GET['item_transport']);
$postage_mail = intval($_GET['postage_mail']);
$postage_express = intval(trim($_GET['postage_express']));
$postage_ems = intval($_GET['postage_ems']);
$item_type = intval($_GET['item_type']);
$item_costprice = floatval($_GET['item_costprice']);
if (!trim($item_name)) {
showmessage('trade_please_name');
} elseif ($this->group['maxtradeprice'] && $item_price > 0 && ($this->group['mintradeprice'] > $item_price || $this->group['maxtradeprice'] < $item_price)) {
showmessage('trade_price_between', '', array('mintradeprice' => $this->group['mintradeprice'], 'maxtradeprice' => $this->group['maxtradeprice']));
} elseif ($this->group['maxtradeprice'] && $item_credit > 0 && ($this->group['mintradeprice'] > $item_credit || $this->group['maxtradeprice'] < $item_credit)) {
showmessage('trade_credit_between', '', array('mintradeprice' => $this->group['mintradeprice'], 'maxtradeprice' => $this->group['maxtradeprice']));
} elseif (!$this->group['maxtradeprice'] && $item_price > 0 && $this->group['mintradeprice'] > $item_price) {
showmessage('trade_price_more_than', '', array('mintradeprice' => $this->group['mintradeprice']));
} elseif (!$this->group['maxtradeprice'] && $item_credit > 0 && $this->group['mintradeprice'] > $item_credit) {
showmessage('trade_credit_more_than', '', array('mintradeprice' => $this->group['mintradeprice']));
} elseif ($item_price <= 0 && $item_credit <= 0) {
showmessage('trade_pricecredit_need');
} elseif ($item_number < 1) {
showmessage('tread_please_number');
}
if ($trade['aid'] && $_GET['tradeaid'] && $trade['aid'] != $_GET['tradeaid']) {
$attach = C::t('forum_attachment_n')->fetch('tid:' . $this->thread['tid'], $trade['aid']);
C::t('forum_attachment')->delete($trade['aid']);
C::t('forum_attachment_n')->delete('tid:' . $this->thread['tid'], $trade['aid']);
dunlink($attach);
$this->param['threadimageaid'] = $_GET['tradeaid'];
convertunusedattach($_GET['tradeaid'], $this->thread['tid'], $this->post['pid']);
}
$expiration = $_GET['item_expiration'] ? @strtotime($_GET['item_expiration']) : 0;
$closed = $expiration > 0 && @strtotime($_GET['item_expiration']) < TIMESTAMP ? 1 : $closed;
switch ($_GET['transport']) {
case 'seller':
$item_transport = 1;
break;
case 'buyer':
$item_transport = 2;
break;
case 'virtual':
$item_transport = 3;
break;
case 'logistics':
$item_transport = 4;
break;
}
if (!$item_price || $item_price <= 0) {
$item_price = $postage_mail = $postage_express = $postage_ems = '';
}
$data = array('aid' => $_GET['tradeaid'], 'account' => $seller, 'tenpayaccount' => $_GET['tenpay_account'], 'subject' => $item_name, 'price' => $item_price, 'amount' => $item_number, 'quality' => $item_quality, 'locus' => $item_locus, 'transport' => $item_transport, 'ordinaryfee' => $postage_mail, 'expressfee' => $postage_express, 'emsfee' => $postage_ems, 'itemtype' => $item_type, 'expiration' => $expiration, 'closed' => $closed, 'costprice' => $item_costprice, 'credit' => $item_credit, 'costcredit' => $_GET['item_costcredit']);
C::t('forum_trade')->update($this->thread['tid'], $this->post['pid'], $data);
if (!empty($_GET['infloat'])) {
$viewpid = C::t('forum_post')->fetch_threadpost_by_tid_invisible($this->thread['tid']);
$viewpid = $viewpid['pid'];
$this->param['redirecturl'] = "forum.php?mod=viewthread&tid=" . $this->thread['tid'] . "&viewpid={$viewpid}#pid{$viewpid}";
} else {
$this->param['redirecturl'] = "forum.php?mod=viewthread&do=tradeinfo&tid=" . $this->thread['tid'] . "&pid=" . $this->post['pid'];
}
}
}
}
示例10: article_move_forums
//.........这里部分代码省略.........
$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')) {