以下是我的viewkarma.php,太谢谢你了,tks999.
<?
/*
[DISCUZ!] viewkarma.php - karma utilities
This is not a freeware, use is subject to license terms
And only for the VipUsers in BBS.CN18.NET
Version: 1.0.0
Author: Cnteacher (admin@tfbx.net)
Copyright: Cnteacher (http://bbs.cn18.net)
Last Modified: 2003/7/17 09:00
*/
require './include/common.php';
$discuz_action = 221;
$navtitle = '- 察看贴子评分';
//是否开放评分察看,如果开放设置为1,如果关闭设置为0
$cnteacher_karma_view = 1;
//斑竹评分察看,如果设置为1,在关闭察看功能的时候,版主仍然可以观看。
//如果设置为0,在关闭察看功能的时候,版主无法察看,只有管理员可以察看。
$cnteacher_karma_adminview = 1;
if(!$discuz_user) {
showmessage('not_loggedin');
}
if(!$cnteacher_karma_view && !$isadmin && !($ismoderator && $cnteacher_karma_adminview)) {
showmessage('管理员关闭了此功能!请返回。');
}
$query = $db->query("SELECT * FROM $table_posts WHERE pid='$pid'");
if(!$postinfo = $db->fetch_array($query)) {
showmessage('指定的帖子不存在,请返回。');
}
$query = $db->query("SELECT * FROM $table_posts WHERE tid='$tid'");
if(!$thread = $db->fetch_array($query)) {
showmessage('指定的帖子不存在,请返回。');
}
$query = $db->query("SELECT COUNT(*) FROM $table_karmalog where pid='$pid'");
if (!$num = $db->result($query, 0)) {
showmessage('没有找到该贴子的评分记录!请返回。');
}
require DISCUZ_ROOT.'./include/discuzcode.php';
$postinfo['dateline'] = gmdate("$dateformat $timeformat", $postinfo['dateline'] + $timeoffset * 3600);
$postinfo['message'] = postify($postinfo['message'], $postinfo['smileyoff'], $postinfo['bbcodeoff'], $forum['allowsmilies'], $forum['allowhtml'], $forum['allowbbcode'], $forum['allowimgcode']);
$karmalist = array();
$query = $db->query("SELECT k.*, m.username FROM $table_karmalog k LEFT JOIN $table_members m ON k.uid = m.uid where pid='$pid'");
while($karma = $db->fetch_array($query)){
$karmanum++;
$karma['id'] = $karmanum;
$karma['dateline'] = gmdate("$dateformat $timeformat", $karma['dateline'] + ($timeoffset * 3600));
$karma['karma'] = AddSlashes($karma['username']);
if($karma['score'] > 0) $karma['score'] = '+'.$karma['score'];
if($karma['money_rate'] > 0) $karma['money_rate'] = '+'.$karma['money_rate'];
$karmalist[] = $karma;
}
include template('viewkarma');
?> |