在viewcomment.php中增加以下代码:
//回复词语屏蔽
$_POST['message'] = censor($_POST['message']);
if(!empty($_POST['nickname'])) {
$author = addslashes(cutstr(shtmlspecialchars(stripslashes($_POST['nickname'])), 15));
}
if(empty($_SGLOBAL['supe_uid'])) {
$setsqlarr = array(
'itemid' => $itemid,
'type' => 'news',
'uid' => '0',
'authorid' => $_SGLOBAL['supe_uid'],
'author' => $author,
'ip' => $_SGLOBAL['onlineip'],
'dateline' => $_SGLOBAL['timestamp'],
'rates' => $_POST['rates'],
'message' => $_POST['message']
);
} else {
$setsqlarr = array(
'itemid' => $itemid,
'type' => 'news',
'uid' => '0',
'authorid' => $_SGLOBAL['supe_uid'],
'author' => $_SGLOBAL['supe_username'],
'ip' => $_SGLOBAL['onlineip'],
'dateline' => $_SGLOBAL['timestamp'],
'rates' => $_POST['rates'],
'message' => $_POST['message'],
'canshow' => '1'
);
if(!empty($_SGET['op']) && $_SGET['op'] == 'canshow') {
$cid = empty($_SGET['cid'])?0:intval($_SGET['cid']);
if(empty($cid)) messagebox('error', 'not_found', S_URL);
$itemid = empty($_SGET['itemid'])?0:intval($_SGET['itemid']);
if(empty($itemid)) messagebox('error', 'not_found', S_URL);
$canshowflag = false;
getcookie(1);
if(empty($_SGLOBAL['group'])) {
messagebox('error', 'no_permission');
}
if($cid && $itemid && $_SGLOBAL['supe_uid']) {
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('spacecomments').' WHERE cid=\''.$cid.'\'');
if($comment = $_SGLOBAL['db']->fetch_array($query)) {
if($_SGLOBAL['group']['groupid'] == 1 ) {
$_SGLOBAL['db']->query('UPDATE '.tname('spacecomments').' SET canshow=1 WHERE cid=\''.$cid.'\'');
$canshowflag = true;
}
}
}
if($canshowflag) {
messagebox('ok', 'succeed', geturl('action/viewcomment/itemid/'.$itemid));
} else {
messagebox('error', 'no_permission');
}
}
if(!empty($_SGET['op']) && $_SGET['op'] == 'notshow') {
$cid = empty($_SGET['cid'])?0:intval($_SGET['cid']);
if(empty($cid)) messagebox('error', 'not_found', S_URL);
$itemid = empty($_SGET['itemid'])?0:intval($_SGET['itemid']);
if(empty($itemid)) messagebox('error', 'not_found', S_URL);
$canshowflag = false;
getcookie(1);
if(empty($_SGLOBAL['group'])) {
messagebox('error', 'no_permission');
}
if($cid && $itemid && $_SGLOBAL['supe_uid']) {
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('spacecomments').' WHERE cid=\''.$cid.'\'');
if($comment = $_SGLOBAL['db']->fetch_array($query)) {
if($_SGLOBAL['group']['groupid'] == 1 ) {
$_SGLOBAL['db']->query('UPDATE '.tname('spacecomments').' SET canshow=0 WHERE cid=\''.$cid.'\'');
$canshowflag = true;
}
}
}
if($canshowflag) {
messagebox('ok', 'succeed', geturl('action/viewcomment/itemid/'.$itemid));
} else {
messagebox('error', 'no_permission');
}
}
if($listcount) {
$i = ($page-1)*$perpage + 1;
getcookie(1);
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('spacecomments').' WHERE itemid=\''.$itemid.'\' ORDER BY dateline DESC LIMIT '.$start.','.$perpage);
if($_SGLOBAL['group']['groupid'] == 1 ){
while ($comment = $_SGLOBAL['db']->fetch_array($query)) {
$comment['message'] = snl2br($comment['message']);
$comment['num'] = $i;
$i++;
$iarr[] = $comment;
}
} else {
while ($comment = $_SGLOBAL['db']->fetch_array($query)) {
if($comment['canshow'] == 0){
$comment['message'] = '经审核后才能显示' ;
$comment['rates'] = '' ;
} else {
$comment['message'] = snl2br($comment['message']);
}
$comment['num'] = $i;
$i++;
$iarr[] = $comment;
}
}
$urlarr = array('action'=>'viewcomment', 'itemid' => $itemid);
$multipage = multi($listcount, $perpage, $page, $urlarr, 0);
}
红色是增加的,这个文件改动比较多 |