ExecuteNoneQuery("UPDATE `#@__feedback` SET good = good+1 WHERE id='$fid' ");
$row = $dsql->GetOne("SELECT good FROM `#@__feedback` WHERE id='$fid' ");
echo "鏀寔[{$row['good']}]";
exit();
}
else if($action=='badfb')
{
AjaxHead();
$fid = intval($fid);
$dsql->ExecuteNoneQuery("UPDATE `#@__feedback` SET bad = bad+1 WHERE id='$fid' ");
$row = $dsql->GetOne("SELECT bad FROM `#@__feedback` WHERE id='$fid' ");
echo "鍙嶅[{$row['bad']}]";
exit();
}
//鏌ョ湅璇勮
/*
function __ViewFeedback(){ }
*/
//-----------------------------------
else if($action=='' || $action=='show')
{
//璇诲彇鏂囨。淇℃伅
$arcRow = GetOneArchive($aid);
if(empty($arcRow['aid']))
{
ShowMsg('鏃犳硶鏌ョ湅鏈煡鏂囨。鐨勮瘎璁�!','-1');
exit();
}
extract($arcRow, EXTR_SKIP);
include_once(DEDEINC.'/datalistcp.class.php');
$dlist = new DataListCP();
$dlist->pageSize = 20;
if(empty($ftype) || ($ftype!='good' && $ftype!='bad' && $ftype!='feedback'))
{
$ftype = '';
}
$wquery = $ftype!='' ? " And ftype like '$ftype' " : '';
helper('smiley');
//璇勮鍐呭鍒楄〃
$querystring = "SELECT fb.*,mb.userid,mb.face as mface,mb.spacesta,mb.scores,mb.sex FROM `#@__feedback` fb
LEFT JOIN `#@__member` mb on mb.mid = fb.mid
WHERE fb.aid='$aid' AND fb.ischeck='1' $wquery ORDER BY fb.id desc";
$dlist->SetParameter('aid',$aid);
$dlist->SetParameter('action','show');
$dlist->SetTemplate(DEDETEMPLATE.'/plus/feedback_templet.htm');
$dlist->SetSource($querystring);
$dlist->Display();
exit();
}
//寮曠敤璇勮
//------------------------------------
/*
function __Quote(){ }
*/
else if($action=='quote')
{
$type = empty($type)? '' : 'ajax';
if($type == 'ajax')
{
AjaxHead();
}
$row = $dsql->GetOne("SELECT * FROM `#@__feedback` WHERE id ='$fid'");
require_once(DEDEINC.'/dedetemplate.class.php');
$dtp = new DedeTemplate();
$tplfile = $type == ''? DEDETEMPLATE.'/plus/feedback_quote.htm' : DEDETEMPLATE.'/plus/feedback_quote_ajax.htm';
$dtp->LoadTemplate($tplfile);
$dtp->Display();
exit();
}
//鍙戣〃璇勮
//------------------------------------
/*
function __SendFeedback(){ }
*/
else if($action=='send')
{
//璇诲彇鏂囨。淇℃伅
$arcRow = GetOneArchive($aid);
if((empty($arcRow['aid']) || $arcRow['notpost']=='1') && empty($fid))
{
ShowMsg('鏃犳硶瀵硅鏂囨。鍙戣〃璇勮!','-1');
exit();
}
//鏄惁鍔犻獙璇佺爜閲嶇‘璁�
if(empty($isconfirm))
{
$isconfirm = '';
}
if($isconfirm!='yes' && $cfg_feedback_ck=='Y')
{
extract($arcRow, EXTR_SKIP);
require_once(DEDEINC.'/dedetemplate.class.php');
$dtp = new DedeTemplate();
$dtp->LoadTemplate(DEDETEMPLATE.'/plus/feedback_confirm.htm');
$dtp->Display();
exit();
}
//妫€鏌ラ獙璇佺爜
if(preg_match("/4/",$safe_gdopen)){
$validate = isset($validate) ? strtolower(trim($validate)) : '';
$svali = GetCkVdValue();
if(strtolower($validate)!=$svali || $svali=='')
{
ResetVdValue();
ShowMsg('楠岃瘉鐮侀敊璇紒', '-1');
exit();
}
}
//妫€鏌ョ敤鎴风櫥褰�
if(empty($notuser))
{
$notuser=0;
}
if($cfg_feedback_guest == 'N' && $cfg_ml->M_ID < 1)
{
ShowMsg('绠$悊鍛樼鐢ㄤ簡娓稿璇勮锛�','-1');
exit();
}
//鍖垮悕鍙戣〃璇勮
if($notuser==1)
{
$username = $cfg_ml->M_ID > 0 ? '鍖垮悕' : '娓稿';
}
//宸茬櫥褰曠殑鐢ㄦ埛
else if($cfg_ml->M_ID > 0)
{
$username = $cfg_ml->M_UserName;
}
//鐢ㄦ埛韬唤楠岃瘉
else
{
if($username!='' && $pwd!='')
{
$rs = $cfg_ml->CheckUser($username,$pwd);
if($rs==1)
{
$dsql->ExecuteNoneQuery("UPDATE `#@__member` SET logintime='".time()."',loginip='".GetIP()."' WHERE mid='{$cfg_ml->M_ID}'; ");
}
else
{
$username = '娓稿';
}
}
else
{
$username = '娓稿';
}
}
$ip = GetIP();
$dtime = time();
//妫€鏌ヨ瘎璁洪棿闅旀椂闂达紱
if(!empty($cfg_feedback_time))
{
//妫€鏌ユ渶鍚庡彂琛ㄨ瘎璁烘椂闂达紝濡傛灉鏈櫥闄嗗垽鏂綋鍓岻P鏈€鍚庤瘎璁烘椂闂�
if($cfg_ml->M_ID > 0)
{
$where = "WHERE `mid` = '$cfg_ml->M_ID'";
}
else
{
$where = "WHERE `ip` = '$ip'";
}
$row = $dsql->GetOne("SELECT dtime FROM `#@__feedback` $where ORDER BY `id` DESC ");
if(is_array($row) && $dtime - $row['dtime'] < $cfg_feedback_time)
{
ResetVdValue();
ShowMsg('绠$悊鍛樿缃簡璇勮闂撮殧鏃堕棿锛岃绋嶇瓑浼戞伅涓€涓嬶紒','-1');
exit();
}
}
if(empty($face))
{
$face = 0;
}
$face = intval($face);
$typeid = (isset($typeid) && is_numeric($typeid)) ? intval($typeid) : 0;
extract($arcRow, EXTR_SKIP);
$msg = cn_substrR(TrimMsg($msg), 1000);
$username = cn_substrR(HtmlReplace($username, 2), 20);
if(empty($feedbacktype) || ($feedbacktype!='good' && $feedbacktype!='bad'))
{
$feedbacktype = 'feedback';
}
//淇濆瓨璇勮鍐呭
if($comtype == 'comments')
{
$arctitle = addslashes($title);
$typeid = intval($typeid);
$ischeck = intval($ischeck);
$feedbacktype = preg_replace("#[^0-9a-z]#i", "", $feedbacktype);
if($msg!='')
{
$inquery = "INSERT INTO `#@__feedback`(`aid`,`typeid`,`username`,`arctitle`,`ip`,`ischeck`,`dtime`, `mid`,`bad`,`good`,`ftype`,`face`,`msg`)
VALUES ('$aid','$typeid','$username','$arctitle','$ip','$ischeck','$dtime', '{$cfg_ml->M_ID}','0','0','$feedbacktype','$face','$msg'); ";
$rs = $dsql->ExecuteNoneQuery($inquery);
if(!$rs)
{
ShowMsg(' 鍙戣〃璇勮閿欒! ', '-1');
//echo $dsql->GetError();
exit();
}
}
}
//寮曠敤鍥炲
elseif ($comtype == 'reply')
{
$row = $dsql->GetOne("SELECT * FROM `#@__feedback` WHERE id ='$fid'");
$arctitle = addslashes($row['arctitle']);
$aid =$row['aid'];
$msg = $quotemsg.$msg;
$msg = HtmlReplace($msg, 2);
$inquery = "INSERT INTO `#@__feedback`(`aid`,`typeid`,`username`,`arctitle`,`ip`,`ischeck`,`dtime`,`mid`,`bad`,`good`,`ftype`,`face`,`msg`)
VALUES ('$aid','$typeid','$username','$arctitle','$ip','$ischeck','$dtime','{$cfg_ml->M_ID}','0','0','$feedbacktype','$face','$msg')";
$dsql->ExecuteNoneQuery($inquery);
}
if($feedbacktype=='bad')
{
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET scores=scores-{cfg_feedback_sub},badpost=badpost+1,lastpost='$dtime' WHERE id='$aid' ");
}
else if($feedbacktype=='good')
{
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET scores=scores+{$cfg_feedback_add},goodpost=goodpost+1,lastpost='$dtime' WHERE id='$aid' ");
}
else
{
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET scores=scores+1,lastpost='$dtime' WHERE id='$aid' ");
}
if($cfg_ml->M_ID > 0)
{
$dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_sendfb_scores} WHERE mid='{$cfg_ml->M_ID}' ");
}
//缁熻鐢ㄦ埛鍙戝嚭鐨勮瘎璁�
if($cfg_ml->M_ID > 0)
{
#api{{
if(defined('UC_API') && @include_once DEDEROOT.'/api/uc.func.php')
{
//鍚屾绉垎
uc_credit_note($cfg_ml->M_LoginID, $cfg_sendfb_scores);
//鎺ㄩ€佷簨浠�
$arcRow = GetOneArchive($aid);
$feed['icon'] = 'thread';
$feed['title_template'] = '{username} 鍦ㄧ綉绔欏彂琛ㄤ簡璇勮';
$feed['title_data'] = array('username' => $cfg_ml->M_UserName);
$feed['body_template'] = '{subject}
{message}';
$url = !strstr($arcRow['arcurl'],'http://') ? ($cfg_basehost.$arcRow['arcurl']) : $arcRow['arcurl'];
$feed['body_data'] = array('subject' => "$arcRow[arctitle]", 'message' => cn_substr(strip_tags(preg_replace("/\[.+?\]/is", '', $msg)), 150));
$feed['images'][] = array('url' => $cfg_basehost.'/images/scores.gif', 'link'=> $cfg_basehost);
uc_feed_note($cfg_ml->M_LoginID,$feed); unset($arcRow);
}
#/aip}}
$row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM `#@__feedback` WHERE `mid`='".$cfg_ml->M_ID."'");
$dsql->ExecuteNoneQuery("UPDATE `#@__member_tj` SET `feedback`='$row[nums]' WHERE `mid`='".$cfg_ml->M_ID."'");
}
//浼氬憳鍔ㄦ€佽褰�
$cfg_ml->RecordFeeds('feedback', $arctitle, $msg, $aid);
$_SESSION['sedtime'] = time();
if(empty($uid) && isset($cmtuser)) $uid = $cmtuser;
$backurl = $cfg_formmember ? "index.php?uid={$uid}&action=viewarchives&aid={$aid}" : "feedback.php?aid={$aid}";
if($ischeck==0)
{
ShowMsg('鎴愬姛鍙戣〃璇勮锛屼絾闇€瀹℃牳鍚庢墠浼氭樉绀轰綘鐨勮瘎璁�!', $backurl);
}
else
{
ShowMsg('鎴愬姛鍙戣〃璇勮锛岀幇鍦ㄨ浆鍒拌瘎璁洪〉闈�!', $backurl);
}
exit();
}