Browse Source

完善评论功能

tags/6.0.0
tianya 3 years ago
parent
commit
e898f10e24
16 changed files with 45 additions and 841 deletions
  1. +7
    -0
      src/dede/feedback_edit.php
  2. +1
    -1
      src/dede/inc/inc_menu.php
  3. +1
    -1
      src/dede/inc/inc_menu_map.php
  4. +3
    -192
      src/dede/index_body.php
  5. +1
    -1
      src/dede/sys_payment.php
  6. +2
    -1
      src/dede/templets/catalog_edit.htm
  7. +6
    -4
      src/dede/templets/feedback_main.htm
  8. +7
    -3
      src/dede/templets/index_body.htm
  9. +3
    -3
      src/dede/templets/makehtml_taglist.htm
  10. +1
    -0
      src/index.php
  11. +10
    -24
      src/plus/feedback.php
  12. +0
    -352
      src/plus/feedback_ajax.php
  13. +1
    -0
      src/static/css/member.css
  14. +0
    -258
      src/templets/default/ajaxfeedback2.htm
  15. +1
    -1
      src/templets/default/widget_article_digg.htm
  16. +1
    -0
      src/templets/default/widget_article_feedback.htm

+ 7
- 0
src/dede/feedback_edit.php View File

@@ -31,6 +31,13 @@ if($dopost=='edit')
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功回复一则留言!",$ENV_GOBACK_URL);
exit();
} elseif ($dopost === 'makehtml') {
require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
$query = "SELECT * FROM `#@__feedback` WHERE id=$id";
$row = $dsql->GetOne($query);
MakeArt($row['aid']);
ShowMsg("成功更新评论所在的文档内容",$ENV_GOBACK_URL);
exit();
}
$query = "SELECT * FROM `#@__feedback` WHERE id=$id";
$row = $dsql->GetOne($query);

+ 1
- 1
src/dede/inc/inc_menu.php View File

@@ -127,7 +127,7 @@ $adminMenu1
<m:item name='文档关键词维护' link='article_keywords_main.php' rank='sys_Keyword' target='main' />
<m:item name='重复文档检测' link='article_test_same.php' rank='sys_ArcBatch' target='main' />
<m:item name='自动摘要|分页' link='article_description_main.php' rank='sys_Keyword' target='main' />
<m:item name='TAG标签管理' link='tags_main.php' rank='sys_Keyword' target='main' />
<m:item name='Tag标签管理' link='tags_main.php' rank='sys_Keyword' target='main' />
<m:item name='数据库内容替换' link='sys_data_replace.php' rank='sys_ArcBatch' target='main' />
</m:top>


+ 1
- 1
src/dede/inc/inc_menu_map.php View File

@@ -78,7 +78,7 @@ $menusMain = "
<m:item name='搜索关键词维护' link='search_keywords_main.php' rank='sys_Keyword' target='main' />
<m:item name='文档关键词维护' link='article_keywords_main.php' rank='sys_Keyword' target='main' />
<m:item name='自动摘要|分页' link='article_description_main.php' rank='sys_Keyword' target='main' />
<m:item name='TAG标签管理' link='tags_main.php' rank='sys_Keyword' target='main' />
<m:item name='Tag标签管理' link='tags_main.php' rank='sys_Keyword' target='main' />
<m:item name='数据库内容替换' link='sys_data_replace.php' rank='sys_ArcBatch' target='main' />
</m:top>


+ 3
- 192
src/dede/index_body.php View File

@@ -154,7 +154,7 @@ function _getRightSide() { }
$chArr[] = $row;
}
?>
<table width="100%" class="dboxtable">
<table width="100%" class="table table-borderless">
<tr>
<td width='50%' class='nline' style="text-align:left"> 会员数: </td>
<td class='nline' style="text-align:left"> <?php echo $row1['dd']; ?> </td>
@@ -191,7 +191,7 @@ function _getRightSide() { }
}
AjaxHead();
?>
<table width="100%" class="dboxtable">
<table width="100%" class="table table-borderless">
<?php
foreach ($arcArr as $row) {
if (trim($row['editcon']) == '') {
@@ -223,196 +223,7 @@ function _getRightSide() { }
$skinconfig = DEDEDATA . '/admin/skin.txt';
PutFile($skinconfig, $skin);
} elseif ($dopost == 'get_seo') {
if (!function_exists('fsocketopen') && !function_exists('curl_init')) {
echo '没有支持的curl或fsocketopen组件';
exit;
}
function dedeseo_http_send($url, $limit = 0, $post = '', $cookie = '', $timeout = 5)
{
$return = '';
$matches = parse_url($url);
$scheme = $matches['scheme'];
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'] . (@$matches['query'] ? '?' . $matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
if (function_exists('curl_init') && function_exists('curl_exec')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $scheme . '://' . $host . ':' . $port . $path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, @$_SERVER['HTTP_USER_AGENT']);
if ($post) {
curl_setopt($ch, CURLOPT_POST, 1);
$content = is_array($port) ? http_build_query($post) : $post;
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
}
if ($cookie) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$data = curl_exec($ch);
$status = curl_getinfo($ch);
$errno = curl_errno($ch);
curl_close($ch);
if ($errno || $status['http_code'] != 200) {
return;
} else {
return !$limit ? $data : substr($data, 0, $limit);
}
}
if ($post) {
$content = is_array($port) ? http_build_query($post) : $post;
$out = "POST $path HTTP/1.0\r\n";
$header = "Accept: */*\r\n";
$header .= "Accept-Language: zh-cn\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "User-Agent: " . @$_SERVER['HTTP_USER_AGENT'] . "\r\n";
$header .= "Host: $host:$port\r\n";
$header .= 'Content-Length: ' . strlen($content) . "\r\n";
$header .= "Connection: Close\r\n";
$header .= "Cache-Control: no-cache\r\n";
$header .= "Cookie: $cookie\r\n\r\n";
$out .= $header . $content;
} else {
$out = "GET $path HTTP/1.0\r\n";
$header = "Accept: */*\r\n";
$header .= "Accept-Language: zh-cn\r\n";
$header .= "User-Agent: " . @$_SERVER['HTTP_USER_AGENT'] . "\r\n";
$header .= "Host: $host:$port\r\n";
$header .= "Connection: Close\r\n";
$header .= "Cookie: $cookie\r\n\r\n";
$out .= $header;
}
$fpflag = 0;
$fp = false;
if (function_exists('fsocketopen')) {
$fp = fsocketopen($host, $port, $errno, $errstr, $timeout);
}
if (!$fp) {
$context = stream_context_create(array(
'http' => array(
'method' => $post ? 'POST' : 'GET',
'header' => $header,
'content' => $content,
'timeout' => $timeout,
),
));
$fp = @fopen($scheme . '://' . $host . ':' . $port . $path, 'b', false, $context);
$fpflag = 1;
}
if (!$fp) {
return '';
} else {
stream_set_blocking($fp, true);
stream_set_timeout($fp, $timeout);
@fwrite($fp, $out);
$status = stream_get_meta_data($fp);
if (!$status['timed_out']) {
while (!feof($fp) && !$fpflag) {
if (($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) {
break;
}
}
if ($limit) {
$return = stream_get_contents($fp, $limit);
} else {
$return = stream_get_contents($fp);
}
}
@fclose($fp);
return $return;
}
}
$seo_info = array();
$seo_info = $dsql->GetOne("SELECT * FROM `#@__plus_seoinfo` ORDER BY id DESC");
$now = time();
if (empty($seo_info) or $now - $seo_info['create_time'] > 60 * 60 * 6) {
$site = str_replace(array("http://", '/'), '', $cfg_basehost);
$url = "http://www.alexa.com/siteinfo/{$site}";
$html = dedeseo_http_send($url);
//var_dump($html);exit;
if (preg_match("#API at http://aws.amazon.com/awis -->(.*)</strong>#isU", $html, $matches)) {
$seo_info['alexa_num'] = isset($matches[1]) ? trim($matches[1]) : 0;
}
$seo_info['alexa_num'] = empty($seo_info['alexa_num']) ? 0 : $seo_info['alexa_num'];
if (preg_match("#Flag'><strong class=\"metrics-data align-vmiddle\">(.*)</strong>#isU", $html, $matches)) {
$seo_info['alexa_area_num'] = isset($matches[1]) ? trim($matches[1]) : 0;
}
$seo_info['alexa_area_num'] = empty($seo_info['alexa_area_num']) ? 0 : $seo_info['alexa_area_num'];
$url = "http://www.baidu.com/s?wd=site:{$site}";
$html = Html2Text(dedeseo_http_send($url));
if (preg_match("#结果数约([\d]+)个#", $html, $matches)) {
$seo_info['baidu_count'] = isset($matches[1]) ? $matches[1] : 0;
}
if (empty($seo_info['baidu_count']) and preg_match("#网站共有([\d, ]+)个#", $html, $matches)) {
$seo_info['baidu_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
}
$seo_info['baidu_count'] = empty($seo_info['baidu_count']) ? 0 : $seo_info['baidu_count'];
$url = "http://www.sogou.com/web?query=site:{$site}";
$html = Html2Text(dedeseo_http_send($url));
if (preg_match("#结果数约([\d]+)个#", $html, $matches)) {
$seo_info['sogou_count'] = isset($matches[1]) ? $matches[1] : 0;
}
if (empty($seo_info['sogou_count']) and preg_match("#找到约([\d, ]+)条结果#", $html, $matches)) {
$seo_info['sogou_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
}
$seo_info['sogou_count'] = empty($seo_info['sogou_count']) ? 0 : $seo_info['sogou_count'];
$url = "http://www.haosou.com/s?q=site%3A{$site}";
$html = Html2Text(dedeseo_http_send($url));
if (preg_match("#结果数约([\d]+)个#", $html, $matches)) {
$seo_info['haosou360_count'] = isset($matches[1]) ? $matches[1] : 0;
}
if (empty($seo_info['haosou360_count']) and preg_match("#结果约([\d, ]+)个#", $html, $matches)) {
$seo_info['haosou360_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
}
$seo_info['haosou360_count'] = empty($seo_info['haosou360_count']) ? 0 : $seo_info['haosou360_count'];
$in_query = "INSERT INTO `#@__plus_seoinfo` (`create_time`, `alexa_num`, `alexa_area_num`, `baidu_count`, `sogou_count`, `haosou360_count`) VALUES ({$now}, '{$seo_info['alexa_num']}', '{$seo_info['alexa_area_num']}', '{$seo_info['baidu_count']}', '{$seo_info['sogou_count']}', '{$seo_info['haosou360_count']}');";
$dsql->ExecuteNoneQuery($in_query);
}
$inff = array(
'alexa_num' => 'Alexa全球排名',
'alexa_area_num' => 'Alexa地区排名',
'baidu_count' => '百度收录',
'sogou_count' => '搜狗收录',
'haosou360_count' => '360收录',
);
?>
<table width="100%" class="dboxtable">
<tbody>
<?php
foreach ($seo_info as $key => $value) {
if ($key == 'id' or $key == 'create_time') continue;
?>
<tr>
<td width="50%" class="nline" style="text-align:left"> <?php
echo $inff[$key];
?>
: </td>
<td class="nline" style="text-align:left"> <?php
echo $value;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
// 直接采用DedeBIZ重写方法
exit;
}
?>

+ 1
- 1
src/dede/sys_payment.php View File

@@ -13,7 +13,7 @@ require_once(DEDEINC.'/datalistcp.class.php');
CheckPurview('sys_Data');
$dopost = (empty($dopost))? '' : $dopost;
$pid = (empty($pid))? 0 : preg_replace('/[^0-9]/','',$pid);
$pid = (empty($pid))? 0 : intval($pid);
/*
下面数数组格式的例子:
*/


+ 2
- 1
src/dede/templets/catalog_edit.htm View File

@@ -5,6 +5,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>栏目管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/base.css" rel="stylesheet" type="text/css">
@@ -328,7 +329,7 @@ $i = 0;
<tr id='smclass' style='<?php echo ($channelid<0 ? '' : 'display:none'); ?>'>
<td class='bline' style="padding-left:10px;">绑定小分类: <br />仅适用[分类信息模型]</td>
<td class='bline' style="padding:3px 0px 3px 0px">
<select name='smalltype[]' size='5' style='width:120px' multiple='yes'>
<select name='smalltype[]' size='5' style='width:120px;height: auto;' multiple='yes'>
<?php
$smtypes = explode(',',trim($myrow['smalltypes']));
$sql = "Select * From `#@__sys_enum` where egroup like 'infotype' order by disorder asc, id desc ";


+ 6
- 4
src/dede/templets/feedback_main.htm View File

@@ -106,10 +106,10 @@
<td width="12%">
用户:{dede:field.username/}
</td>
<td width="30%">
<td width="20%">
文档:<a href='feedback_main.php?aid={dede:field.aid/}'><u>{dede:field.arctitle
function="RemoveXSS(@me)"/}</u></a> (<a
href="{dede:global.cfg_phpurl /}/view.php?aid={dede:field.aid/}"
href="archives_do.php?aid={dede:field.aid/}&dopost=viewArchives"
target="_blank"><u>浏览</u></a>)
<?php if($fields['replycount'] > 0) { ?><a
href='feedback_main.php?fid={dede:field.id/}'>({dede:field.replycount/}条回复)</a>
@@ -119,13 +119,15 @@
IP地址:<a
href='feedback_main.php?ip={dede:field.ip/}'><u>{dede:field.ip/}</u></a>
</td>
<td width="21%">
<td width="15%">
时间:{dede:field.dtime function="GetDateTimeMK(@me)" /}
</td>
<td width="10%" align="center">
<td width="20%" align="center">
<a class="btn btn-secondary btn-sm"
href='feedback_edit.php?id={dede:field.id/}'><i
class="fa fa-pencil-square-o" aria-hidden="true"></i> 编辑</a>
<a class="btn btn-secondary btn-sm"
href='feedback_edit.php?id={dede:field.id/}&dopost=makehtml'>更新文档</a>
</td>
</tr>
<tr align="center" bgcolor="#FFFFFF">


+ 7
- 3
src/dede/templets/index_body.htm View File

@@ -5,6 +5,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>DedeCMS Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<base target="_self">
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
@@ -43,12 +44,15 @@
display: flex;
flex-direction: column;
}
.footer {
padding: 10px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="mt-3">
<div class="mt-3 mb-3">
欢迎使用专业的PHP网站管理系统,轻松建站的首选利器 -- <?php echo $cfg_softname; ?>
</div>
<div class="row">
@@ -222,7 +226,7 @@
</div>
<!--/.card-header-->
<div class="card-body">
<table width="98%" class="dboxtable">
<table width="98%" class="table table-borderless">
<tr>
<td width='25%' height='36' class='nline' style="text-align:right"> 主程序研发: </td>
<td class='nline' style="text-align:left"><a href="https://github.com/dedetech"
@@ -291,7 +295,7 @@
$arcArr[] = $row;
}
?>
<table width="100%" class="dboxtable">
<table width="100%" class="table table-borderless">
<?php
if(count($arcArr) > 1)
{


+ 3
- 3
src/dede/templets/makehtml_taglist.htm View File

@@ -51,9 +51,9 @@
<td height="20" valign="top" bgcolor="#FFFFFF">说明:</td>
<td height="20" valign="top" bgcolor="#FFFFFF">
仅更新文档数多于<?php echo $dd['tt'];?>的关键词<br>
更新所有TAG将会智能更新在[TAG标签管理]中重新获取更新的内容<br>
TAG首页模板文件:<?php echo $cfg_templets_dir;?>/<?php echo $cfg_df_style?>/tag.htm<br>
TAG列表页模板文件:<?php echo $cfg_templets_dir;?>/<?php echo $cfg_df_style?>/taglist.htm<br>
更新所有Tag将会智能更新在[Tag标签管理]中重新获取更新的内容<br>
Tag首页模板文件:<?php echo $cfg_templets_dir;?>/<?php echo $cfg_df_style?>/tag.htm<br>
Tag列表页模板文件:<?php echo $cfg_templets_dir;?>/<?php echo $cfg_df_style?>/taglist.htm<br>
生成静态文件后,访问动态文件则直接跳转到静态文件,如果需要动态访问,删除对应文件即可。
</td>
</tr>


+ 1
- 0
src/index.php View File

@@ -3,6 +3,7 @@
* @version $Id: index.php 1 9:23 2010-11-11 tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/


+ 10
- 24
src/plus/feedback.php View File

@@ -27,6 +27,7 @@ if (!isset($action)) {
}

$msg = isset($msg) ? $msg : "";
$feedbacktype = isset($feedbacktype) ? $feedbacktype : "";
$validate = isset($validate) ? $validate : "";
$pwd = isset($pwd) ? $pwd : "";
$comtype = isset($comtype) ? $comtype : "";
@@ -34,8 +35,8 @@ $good = isset($good) ? intval($good) : 0;

$cfg_formmember = isset($cfg_formmember) ? true : false;
$ischeck = $cfg_feedbackcheck == 'Y' ? 0 : 1;
$aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
$fid = (isset($fid) && is_numeric($fid)) ? $fid : 0; // 用来标记回复评论的变量
$aid = isset($aid) ? intval($aid) : 0;
$fid = isset($fid) ? intval($fid) : 0; // 用来标记回复评论的变量

if (empty($aid) && empty($fid)) {
echo json_encode(array(
@@ -97,23 +98,6 @@ if ($action == '' || $action == 'show') {
));
exit;
}

//引用评论
//------------------------------------
/*
function __Quote(){ }
*/ else if ($action == 'quote') {
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();
}
//发表评论
//------------------------------------
/*
@@ -223,18 +207,20 @@ function __SendFeedback(){ }
extract($arcRow, EXTR_SKIP);
$msg = cn_substrR(TrimMsg($msg), $cfg_feedback_msglen);
$username = cn_substrR(HtmlReplace($username, 2), 20);
if (empty($feedbacktype) || ($feedbacktype != 'good' && $feedbacktype != 'bad')) {

if (empty($feedbacktype) || !in_array($feedbacktype, array('good', 'bad'))) {
$feedbacktype = 'feedback';
}

//保存评论内容
if ($comtype == 'comments') {
$arctitle = addslashes($title);
if ($comtype == 'comments' || $comtype == 'reply') {
$arctitle = empty($title)? "" : 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'); ";
$inquery = "INSERT INTO `#@__feedback`(`aid`,`typeid`,`fid`, `username`,`arctitle`,`ip`,`ischeck`,`dtime`, `mid`,`bad`,`good`,`ftype`,`face`,`msg`)
VALUES ('$aid','$typeid','$fid','$username','$arctitle','$ip','$ischeck','$dtime', '{$cfg_ml->M_ID}','0','0','$feedbacktype','$face','$msg'); ";
$rs = $dsql->ExecuteNoneQuery($inquery);
if (!$rs) {
echo json_encode(array(


+ 0
- 352
src/plus/feedback_ajax.php View File

@@ -1,352 +0,0 @@
<?php
/**
*
* Ajax评论
*
* @version $Id: feedback_ajax.php 1 15:38 2010年7月8日Z tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
require_once(dirname(__FILE__).'/../include/common.inc.php');
require_once(DEDEINC.'/channelunit.func.php');
AjaxHead();
if($cfg_feedback_forbid=='Y') exit('系统已经禁止评论功能!');
$aid = intval($aid);
if(empty($aid)) exit('没指定评论文档的ID,不能进行操作!');
include_once(DEDEINC.'/memberlogin.class.php');
$cfg_ml = new MemberLogin();
if(empty($dopost)) $dopost = '';
$page = empty($page) || $page<1 ? 1 : intval($page);
$pagesize = 10;
/*----------------------
获得指定页的评论内容
function getlist(){ }
----------------------*/
if($dopost=='getlist')
{
$totalcount = GetList($page);
GetPageList($pagesize, $totalcount);
exit();
}
/*----------------------
发送评论
function send(){ }
----------------------*/
else if($dopost=='send')
{
require_once(DEDEINC.'/charset.func.php');
//检查验证码
if($cfg_feedback_ck=='Y')
{
$svali = strtolower(trim(GetCkVdValue()));
if(strtolower($validate) != $svali || $svali=='')
{
ResetVdValue();
echo '<font color="red">验证码错误,请点击验证码图片更新验证码!</font>';
exit();
}
}
$arcRow = GetOneArchive($aid);
if(empty($arcRow['aid']))
{
echo '<font color="red">无法查看未知文档的评论!</font>';
exit();
}
if(isset($arcRow['notpost']) && $arcRow['notpost']==1)
{
echo '<font color="red">这篇文档禁止评论!</font>';
exit();
}
if( $cfg_soft_lang != 'utf8' )
{
$msg = UnicodeUrl2Gbk($msg);
if(!empty($username)) $username = UnicodeUrl2Gbk($username);
}
//词汇过滤检查
if( $cfg_notallowstr != '' )
{
if(preg_match("#".$cfg_notallowstr."#i", $msg))
{
echo "<font color='red'>评论内容含有禁用词汇!</font>";
exit();
}
}
if( $cfg_replacestr != '' )
{
$msg = preg_replace("#".$cfg_replacestr."#i", '***', $msg);
}
if( empty($msg) )
{
echo "<font color='red'>评论内容可能不合法或为空!</font>";
exit();
}
if($cfg_feedback_guest == 'N' && $cfg_ml->M_ID < 1)
{
echo "<font color='red'>管理员禁用了游客评论!<a href='{$cfg_cmspath}/member/login.php'>点击登录</a></font>";
exit();
}
//检查用户
$username = empty($username) ? '游客' : $username;
if(empty($notuser)) $notuser = 0;
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}'; ");
}
$cfg_ml = new MemberLogin();
}
//检查评论间隔时间
$ip = GetIP();
$dtime = time();
if(!empty($cfg_feedback_time))
{
//检查最后发表评论时间,如果未登录判断当前IP最后评论时间
$where = ($cfg_ml->M_ID > 0 ? "WHERE `mid` = '$cfg_ml->M_ID' " : "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();
echo '<font color="red">管理员设置了评论间隔时间,请稍等休息一下!</font>';
exit();
}
}
$face = 1;
extract($arcRow, EXTR_SKIP);
$msg = cn_substrR(TrimMsg($msg), 500);
$username = cn_substrR(HtmlReplace($username,2), 20);
if(empty($feedbacktype) || ($feedbacktype!='good' && $feedbacktype!='bad'))
{
$feedbacktype = 'feedback';
}
//保存评论内容
if(!empty($fid))
{
$row = $dsql->GetOne("SELECT username,msg from `#@__feedback` WHERE id ='$fid' ");
$qmsg = '{quote}{content}'.$row['msg'].'{/content}{title}'.$row['username'].' 的原帖:{/title}{/quote}';
$msg = addslashes($qmsg).$msg;
}
$ischeck = ($cfg_feedbackcheck=='Y' ? 0 : 1);
$arctitle = addslashes(RemoveXSS($title));
$typeid = intval($typeid);
$feedbacktype = preg_replace("#[^0-9a-z]#i", "", $feedbacktype);
$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 )
{
echo "<font color='red'>发表评论出错了!</font>";
//echo $dslq->GetError();
exit();
}
$newid = $dsql->GetLastID();
//给文章评分
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}' ");
$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."'");
}
$_SESSION['sedtime'] = time();
if($ischeck==0)
{
echo '<font color="red">成功发表评论,但需审核后才会显示你的评论!</font>';
exit();
}
else
{
$spaceurl = '#';
if($cfg_ml->M_ID > 0) $spaceurl = "{$cfg_memberurl}/index.php?uid=".urlencode($cfg_ml->M_LoginID);
$id = $newid;
$msg = stripslashes($msg);
$msg = str_replace('<', '&lt;', $msg);
$msg = str_replace('>', '&gt;', $msg);
helper('smiley');
$msg = RemoveXSS(Quote_replace(parseSmileys($msg, $cfg_cmspath.'/images/smiley')));
//$msg = RemoveXSS(Quote_replace($msg));
if($feedbacktype=='bad') $bgimg = 'cmt-bad.gif';
else if($feedbacktype=='good') $bgimg = 'cmt-good.gif';
else $bgimg = 'cmt-neu.gif';
global $dsql, $aid, $pagesize, $cfg_templeturl;
if($cfg_ml->M_ID==""){
$mface=$cfg_cmspath."/member/templets/images/dfboy.png";
} else {
$row = $dsql->GetOne("SELECT face,sex FROM `#@__member` WHERE mid={$cfg_ml->M_ID} ");
if(empty($row['face']))
{
if($row['sex']=="女") $mface=$cfg_cmspath."/member/templets/images/dfgirl.png";
else $mface=$cfg_cmspath."/member/templets/images/dfboy.png";
}
}
?>
<div class='decmt-box2'>
<ul>
<li> <a href='<?php echo $spaceurl; ?>' class='plpic'><img src='<?php echo $mface;?>' height='40' width='40'/></a> <span class="title"><a href="<?php echo $spaceurl; ?>"><?php echo $username; ?></a></span>
<div class="comment_act"><span class="fl"><?php echo GetDateMk($dtime); ?>发表</span></div>
<div style="clear:both"><?php echo ubb($msg); ?></div>
<div class="newcomment_act"><span class="fr"><span id='goodfb<?php echo $id; ?>'> <a href='#goodfb<?php echo $id; ?>' onclick="postBadGood('goodfb',<?php echo $id; ?>);">支持</a>[0] </span> <span id='badfb<?php echo $id; ?>'> <a href='#badfb<?php echo $id; ?>' onclick="postBadGood('badfb',<?php echo $id; ?>);">反对</a>[0] </span> <span class='quote'>
<!--<a href='/plus/feedback.php?aid=<?php echo $id; ?>&fid=<?php echo $id; ?>&action=quote'>[引用]</a>-->
<a href='javascript:ajaxFeedback(<?php echo $id; ?>,<?php echo $id; ?>,"quote");'>[引用]</a> </span></span></div>
</li>
<div id="ajaxfeedback_<?php echo $id; ?>"></div>
</ul>
</div>
<br style='clear:both' />
<?php
}
exit();
}
/**
* 读取列表内容
*
* @param int $page 页码
* @return string
*/
function GetList($page=1)
{
global $dsql, $aid, $pagesize, $cfg_templeturl,$cfg_cmspath;
$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' ORDER BY fb.id DESC";
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__feedback` WHERE aid='$aid' AND ischeck='1' ");
$totalcount = (empty($row['dd']) ? 0 : $row['dd']);
$startNum = $pagesize * ($page-1);
if($startNum > $totalcount)
{
echo "参数错误!";
return $totalcount;
}
$dsql->Execute('fb', $querystring." LIMIT $startNum, $pagesize ");
while($fields = $dsql->GetArray('fb'))
{
if($fields['userid']!='') $spaceurl = $GLOBALS['cfg_memberurl'].'/index.php?uid='.$fields['userid'];
else $spaceurl = '#';
if($fields['username']=='匿名') $spaceurl = '#';
$fields['bgimg'] = 'cmt-neu.gif';
$fields['ftypetitle'] = '该用户表示中立';
if($fields['ftype']=='bad')
{
$fields['bgimg'] = 'cmt-bad.gif';
$fields['ftypetitle'] = '该用户表示差评';
}
else if($fields['ftype']=='good')
{
$fields['bgimg'] = 'cmt-good.gif';
$fields['ftypetitle'] = '该用户表示好评';
}
if(empty($fields['mface']))
{
if($fields['sex']=="女") $fields['mface']=$cfg_cmspath."/member/templets/images/dfgirl.png";
else $fields['mface']=$cfg_cmspath."/member/templets/images/dfboy.png";
}
$fields['face'] = empty($fields['face']) ? 6 : $fields['face'];
$fields['msg'] = str_replace('<', '&lt;', $fields['msg']);
$fields['msg'] = str_replace('>', '&gt;', $fields['msg']);
helper('smiley');
$fields['msg'] = RemoveXSS(Quote_replace(parseSmileys($fields['msg'], $cfg_cmspath.'/images/smiley')));
extract($fields, EXTR_OVERWRITE);
?>
<div class="decmt-box2">
<ul>
<li> <a href='<?php echo $spaceurl; ?>' class='plpic'><img src='<?php echo $mface;?>' height='40' width='40'/></a> <span class="title"><a href="<?php echo $spaceurl; ?>"><?php echo $username; ?></a></span>
<div class="comment_act"><span class="fl"><?php echo GetDateMk($dtime); ?>发表</span></div>
<div style="clear:both"><?php echo ubb($msg); ?></div>
<div class="newcomment_act"><span class="fr"><span id='goodfb<?php echo $id; ?>'> <a href='#goodfb<?php echo $id; ?>' onclick="postBadGood('goodfb',<?php echo $id; ?>);">支持</a>[<?php echo $good; ?>] </span> <span id='badfb<?php echo $id; ?>'> <a href='#badfb<?php echo $id; ?>' onclick="postBadGood('badfb',<?php echo $id; ?>);">反对</a>[<?php echo $bad; ?>] </span> <span class='quote'>
<!--<a href='/plus/feedback.php?aid=<?php echo $id; ?>&fid=<?php echo $id; ?>&action=quote'>[引用]</a>-->
<a href='javascript:ajaxFeedback(<?php echo $id; ?>,<?php echo $id; ?>,"quote");'>[引用]</a> </span></span></div>
</li>
</ul>
<div id="ajaxfeedback_<?php echo $id; ?>"></div>
</div>
<?php
}
return $totalcount;
}
/**
* 获取分页列表
*
* @param int $pagesize 显示条数
* @param int $totalcount 总数
* @return string
*/
function GetPageList($pagesize, $totalcount)
{
global $page;
$curpage = empty($page) ? 1 : intval($page);
$allpage = ceil($totalcount / $pagesize);
if($allpage < 2)
{
echo '';
return ;
}
echo "
<div id='commetpages'>";
echo "<span>总: {$allpage} 页/{$totalcount} 条评论</span> ";
$listsize = 5;
$total_list = $listsize * 2 + 1;
$totalpage = $allpage;
$listdd = '';
if($curpage-1 > 0 )
{
echo "<a href='#commettop' onclick='LoadCommets(".($curpage-1).");'>上一页</a> ";
}
if($curpage >= $total_list)
{
$j = $curpage - $listsize;
$total_list = $curpage + $listsize;
if($total_list > $totalpage)
{
$total_list = $totalpage;
}
}
else
{
$j = 1;
if($total_list > $totalpage) $total_list = $totalpage;
}
for($j; $j <= $total_list; $j++)
{
echo ($j==$curpage ? "<strong>$j</strong> " : "<a href='#commettop' onclick='LoadCommets($j);'>{$j}</a> ");
}
if($curpage+1 <= $totalpage )
{
echo "<a href='#commettop' onclick='LoadCommets(".($curpage+1).");'>下一页</a> ";
}
echo "</div>
";
}

+ 1
- 0
src/static/css/member.css View File

@@ -55,6 +55,7 @@ main.login-from {

.member .member-logo {
border-radius: 50%;
max-width: 72px;
}

.member-actions a {


+ 0
- 258
src/templets/default/ajaxfeedback2.htm View File

@@ -1,258 +0,0 @@
<!-- //主模板必须要引入{dede:global.cfg_cmsurl/}/static/js/dedeajax2.js -->
<a name='postform'></a>
<div class="mt1">
<dl class="tbox">
<dt> <strong>发表评论</strong> <span class="more"></span> </dt>
<dd>
<div class="dede_comment_post">
<form action="#" method="post" name="feedback" onsubmit="return false;">
<input type="hidden" name="dopost" value="send" />
<input type="hidden" name="comtype" value="comments">
<input type="hidden" name="aid" value="{dede:field name="id"/}" />
<input type="hidden" name="fid" id='feedbackfid' value="0" />
<div class="dcmp-title"> <small>请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。</small> </div>
<!-- /dcmp-title -->
<div class="dcmp-stand"> <strong>评价:</strong>
<input type="radio" name="feedbacktype" checked="1" value="feedback" id="dcmp-stand-neu" />
<label for="dcmp-stand-neu"><img src="{dede:global.cfg_templets_skin/}/images/cmt-neu.gif" />中立</label>
<input type="radio" name="feedbacktype" value="good" id="dcmp-stand-good" />
<label for="dcmp-stand-good"><img src="{dede:global.cfg_templets_skin/}/images/cmt-good.gif" />好评</label>
<input type="radio" name="feedbacktype" value="bad" id="dcmp-stand-bad" />
<label for="dcmp-stand-bad"><img src="{dede:global.cfg_templets_skin/}/images/cmt-bad.gif" />差评</label>
</div>
<!-- /dcmp-stand -->
<div class="clr"></div>
<div class="dcmp-content">
<script type="text/javascript">
//<![CDATA[
window.CKEDITOR_BASEPATH='{dede:global.cfg_cmsurl/}/static/js/ckeditor/';
//]]>
</script>
<script type="text/javascript" src="{dede:global.cfg_cmsurl/}/static/js/ckeditor/ckeditor.js?t=B8DJ5M3"></script>
{dede:php}
GetEditor('msg','',100,'Feedback','print','false',true);
{/dede:php} </div>
<!-- /dcmp-content -->
<div class="dcmp-post">
<!--未登录-->
<div class="dcmp-userinfo" id="_ajax_feedback"> {dede:php}
if($cfg_mb_open=='Y') {
echo '用户名:
<input type="text" name="username" size="16" class="ipt-txt" style="text-transform: uppercase;"/>
';
}
{/dede:php}
{dede:php}
if(preg_match("/4/",$safe_gdopen)){
echo '验证码:
<input type="text" name="validate" size="4" class="ipt-txt" style="text-transform:uppercase;"/>
<img src= "'.$cfg_cmspath.'/plus/vdimgck.php" id="validateimg" style="cursor:pointer" onclick="this.src=this.src+\'?\'" title="点击我更换图片" alt="点击我更换图片" class="vdimg"/>';
}
{/dede:php}
<input type="checkbox" name="notuser" id="dcmp-submit-guest" />
<label for="dcmp-submit-guest" />
匿名?
</label>
</div>
{dede:php}
if($cfg_mb_open=='Y') {
echo '
<script language="javascript" type="text/javascript">CheckLogin();</script>
';
}
{/dede:php}
<div class="dcmp-submit">
<button type="button" onClick='PostComment()'>发表评论</button>
</div>
</div>
</form>
</div>
</dd>
</dl>
</div>
<!-- //评论表单区结束 -->
<!-- //评论内容区 -->
<a name='commettop'></a>
<div class="mt1">
<dl class="tbox">
<dt> <strong>最新评论</strong> <span class="more"><a href="{dede:field name='phpurl'/}/feedback.php?aid={dede:field.id/}">进入详细评论页&gt;&gt;</a></span> </dt>
<!-- //这两个ID的区块必须存在,否则JS会出错 -->
<dd id='commetcontentNew'></dd>
<dd id='commetcontent'></dd>
</dl>
</div>
<!--
//由于评论载入时使用异步传输,因此必须在最后一步加载(DIGG和评论框须放在评论内容前面)
//如果一定需要提前的把myajax.SendGet改为myajax.SendGet2,但可能会引起页面阻滞
-->
<script language='javascript'>
function LoadCommets(page)
{
var taget_obj = document.getElementById('commetcontent');
var waithtml = "<div style='line-height:50px'><img src='{dede:global.cfg_cmsurl/}/images/loadinglit.gif' />评论加载中...</div>";
var myajax = new DedeAjax(taget_obj, true, true, '', 'x', waithtml);
myajax.SendGet2("{dede:global.cfg_phpurl /}/feedback_ajax.php?dopost=getlist&aid={dede:field.id/}&page="+page);
DedeXHTTP = null;
}
function PostComment()
{
var f = document.feedback;
var msg = CKEDITOR.instances.msg.getData();
var nface = '6';
var nfeedbacktype = 'feedback';
var nvalidate = '';
var nnotuser = '';
var nusername = '';
var npwd = '';
var taget_obj = $DE('commetcontentNew');
var waithtml = "<div style='line-height:30px'><img src='{dede:global.cfg_cmsurl/}/images/loadinglit.gif' />正在发送中...</div>";
if(msg=='')
{
alert("评论内容不能为空!");
return;
}
if(f.validate)
{
if(f.validate.value=='') {
alert("请填写验证码!");
return;
}
else {
nvalidate = f.validate.value;
}
}
if(msg.length > 500)
{
alert("你的评论是不是太长了?请填写500字以内的评论。");
return;
}
if(f.feedbacktype) {
for(var i=0; i < f.feedbacktype.length; i++)
if(f.feedbacktype[i].checked) nfeedbacktype = f.feedbacktype[i].value;
}
/*
if(f.face) {
for(var j=0; j < f.face.length; j++)
if(f.face[j].checked) nface = f.face[j].value;
}
*/
if(f.notuser.checked) nnotuser = '1';
if(f.username) nusername = f.username.value;
if(f.pwd) npwd = f.pwd.value;
var myajax = new DedeAjax(taget_obj, false, true, '', '', waithtml);
myajax.sendlang = '{dede:global.cfg_soft_lang/}';
myajax.AddKeyN('dopost', 'send');
myajax.AddKeyN('aid', '{dede:field.id/}');
myajax.AddKeyN('fid', f.fid.value);
myajax.AddKeyN('face', nface);
myajax.AddKeyN('feedbacktype', nfeedbacktype);
myajax.AddKeyN('validate', nvalidate);
myajax.AddKeyN('notuser', nnotuser);
myajax.AddKeyN('username', nusername);
myajax.AddKeyN('pwd', npwd);
myajax.AddKeyN('msg', msg);
myajax.SendPost2('{dede:global.cfg_phpurl/}/feedback_ajax.php');
//msg = '';
CKEDITOR.instances.msg.setData('');
//taget_obj.removeAttribute('id');
f.fid.value = 0;
if(f.validate)
{
if($DE('validateimg')) $DE('validateimg').src = "{dede:global.cfg_cmsurl/}/plus/vdimgck.php?"+f.validate.value;
f.validate.value = '';
}
}
function quoteCommet(fid)
{
document.feedback.fid.value = fid;
}
function ajaxFeedback(aid, fid, type)
{
var taget_obj = $DE('ajaxfeedback_'+fid);
if(taget_obj.innerHTML == '')
{
var myajax = new DedeAjax(taget_obj, true, true, '', 'x');
myajax.SendGet2("{dede:global.cfg_phpurl /}/feedback.php?aid="+aid+"&fid="+fid+"&action=quote&type=ajax");
eval('var result = typeof CKEDITOR.instances.msg_'+fid);
if(result != 'undefined')
{
// 删除实例
eval('var edit = CKEDITOR.instances.msg_'+fid);
CKEDITOR.remove(edit);
}
CKEDITOR.replace(document.getElementById('msg_'+fid) , CKEDITOR.instances.msg.config);
scroll(0, taget_obj.offsetTop - 120);
var formname = 'f = document.ajaxfeedback_'+fid;
eval(formname);
if(f.validate)
{
if($DE('vdimg_'+fid)) $DE('vdimg_'+fid).src = "{dede:global.cfg_cmsurl/}/plus/vdimgck.php?"+f.validate.value;
f.validate.value = '';
}
DedeXHTTP = null;
}
}
function ajaxQuotePost(fid)
{
var formname = 'f = document.ajaxfeedback_'+fid;
eval(formname);
//var f = document.formname;
//var f = f[0];
var nvalidate = '';
var nnotuser = '';
var nusername = '';
var npwd = '';
var taget_obj = $DE('commetcontentNew');
var waithtml = "<div style='line-height:30px'><img src='{dede:global.cfg_cmsurl/}/images/loadinglit.gif' />正在发送中...</div>";
eval('var msg = CKEDITOR.instances.msg_'+fid+'.getData()');
if(f.validate)
{
if(f.validate.value=='') {
alert("请填写验证码!");
return;
}
else {
nvalidate = f.validate.value;
}
}
var myajax = new DedeAjax(taget_obj, false, true, '', '', waithtml);
if(f.notuser.checked) nnotuser = '1';
if(f.username) nusername = f.username.value;
if(f.pwd) npwd = f.pwd.value;
myajax.sendlang = '{dede:global.cfg_soft_lang/}';
myajax.AddKeyN('dopost', 'send');
myajax.AddKeyN('aid', '{dede:field.id/}');
myajax.AddKeyN('fid', f.fid.value);
myajax.AddKeyN('type', 'ajax');
myajax.AddKeyN('comtype', f.comtype.value);
myajax.AddKeyN('isconfirm','yes');
myajax.AddKeyN('typeid', f.typeid.value);
myajax.AddKeyN('quotemsg', f.quotemsg.value);
myajax.AddKeyN('validate', nvalidate);
myajax.AddKeyN('notuser', nnotuser);
myajax.AddKeyN('username', nusername);
myajax.AddKeyN('pwd', npwd);
myajax.AddKeyN('msg', msg);
myajax.SendPost2('{dede:global.cfg_phpurl/}/feedback_ajax.php');
//alert(f.quotemsg.value);
if($DE('ajaxfeedback_'+fid).innerHTML != null)
{
$DE('ajaxfeedback_'+fid).innerHTML = '';
}
scroll(0, taget_obj.offsetTop);
}
LoadCommets(1);
</script>
<!-- //评论内容区结束 -->

+ 1
- 1
src/templets/default/widget_article_digg.htm View File

@@ -54,7 +54,7 @@
if (j == 19 && !hasid) break;
}
}
if (hasid) { alert("您已经顶过该帖,请不要重复顶帖 !"); return; }
if (hasid) { ShowMsg("您已经顶过该帖,请不要重复顶帖 !"); return; }
else saveid += ',' + aid;
SetCookie('diggid', saveid, 1);
}


+ 1
- 0
src/templets/default/widget_article_feedback.htm View File

@@ -142,6 +142,7 @@
action : "send",
comtype : "reply",
fid : fid,
aid : "{dede:field name='id'/}",
msg : content,
}
$.post("{dede:field name='phpurl'/}/feedback.php", reply, function (data) {


Loading…
Cancel
Save