Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

【插件】仿D4和D3评分另页显示(最新更新版)(更新以2005/8/21)

[复制链接]
xjbl 发表于 2005-8-21 21:32:32 | 显示全部楼层
<?php

/*
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [DISCUZ!]  Crossday Discuz! Board                                    ::
:: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
:: Version: 2.5F   2004/10/01 05:15                                     ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
*/

require './include/common.php';

if($tid) {
        $query = $db->query("SELECT * FROM $table_threads WHERE tid='$tid'");
        $thread = $db->fetch_array($query);
}

if($forum['type'] == 'forum') {
        $navigation = "&raquo; <a href=\"forumdisplay.php?fid=$fid\">$forum[name]</a> &raquo; <a href=\"viewthread.php?tid=$tid\">$thread[subject]</a> ";
        $navtitle =$thread['subject'].' - '.strip_tags($forum['name']).' - ';
} elseif($forum['type'] == 'sub') {
        $query = $db->query("SELECT name, fid FROM $table_forums WHERE fid='$forum[fup]'");
        $fup = $db->fetch_array($query);
        $navigation = "&raquo; <a href=\"forumdisplay.php?fid=$fup[fid]\">$fup[name]</a> &raquo; <a href=\"forumdisplay.php?fid=$fid\">$forum[name]</a> &raquo; <a href=\"viewthread.php?tid=$tid\">$thread[subject]</a> ";
        $navtitle = $thread['subject'].' - '.strip_tags($forum['name']).' - '.strip_tags($fup['name']).' - ';
}


if($action == 'votepoll') {

        if(!$discuz_user || !$allowvote) {
                showmessage('group_nopermission', NULL, 'HALTED');
        }

        $query = $db->query("SELECT pollopts FROM $table_polls WHERE tid='$tid'");
        $pollarray = unserialize($db->result($query, 0));
        if(!is_array($pollarray) || !$pollarray) {
                showmessage('undefined_action', NULL, 'HALTED');
        }

        if(!empty($thread['closed'])) {
                showmessage('thread_poll_closed');
        }

        if(in_array($discuz_user, $pollarray['voters'])) {
                showmessage('thread_poll_voted');
        }

        if(!is_array($pollanswers) || count($pollanswers) < 1) {
                showmessage('thread_poll_invalid');
        }

        if(empty($pollarray['multiple']) && count($pollanswers) > 1) {
                showmessage('undefined_action', NULL, 'HALTED');
        }

        foreach($pollanswers as $id) {
                if(isset($pollarray['options'][$id][0])) {
                        if ($pollarray['votersdetail'][$id]) {
                        $pollarray['votersdetail'][$id] .= '<option>'.$discuz_user.'</option>';
                } else {
                        $pollarray['votersdetail'][$id] = '<select><option>'.$discuz_user.'</option>';
                }
                        if(++$pollarray['options'][$id][1] > $pollarray['max']) {
                                $pollarray['max'] = $pollarray['options'][$id][1];
                        }
                        $pollarray['total']++;
                } else {
                        showmessage('undefined_action', NULL, 'HALTED');
                }
        }

        $pollarray['voters'][] = $discuz_user;

        $pollopts = addslashes(serialize($pollarray));
        $db->query("UPDATE $table_polls SET pollopts='$pollopts' WHERE tid='$tid'", 'UNBUFFERED');
        $db->query("UPDATE $table_threads SET lastpost='$timestamp' WHERE tid='$tid'", 'UNBUFFERED');

        showmessage('thread_poll_succeed', "viewthread.php?tid=$tid");

} elseif($action == 'emailfriend') {

        if(!submitcheck('sendsubmit')) {

                $discuz_action = 122;
                $threadurl = "{$boardurl}viewthread.php?tid=$tid";

                $query = $db->query("SELECT email FROM $table_members WHERE uid='$discuz_uid'");
                $email = $db->result($query, 0);

                include template('emailfriend');

        } else {

                if(empty($fromname) || empty($fromemail) || empty($sendtoname) || empty($sendtoemail)) {
                        showmessage('email_friend_invalid');
                }

                sendmail($sendtoemail, $subject, $message, "$fromname <$fromemail>");

                showmessage('email_friend_succeed', "viewthread.php?tid=$tid");

        }

} elseif($action == 'karma' && $pid) {

        $discuz_action = 121;

        if(!$allowkarma || !$maxkarmarate) {
                showmessage('group_nopermission', NULL, 'HALTED');
        }
        if($thread['closed'] && !$isadmin) {
                showmessage('对不起,本贴已经关闭了,无法进行评分了.');
        }
        $karmaoptions = '';
        if($allowkarma && $maxkarmarate) {
                $offset = ceil($maxkarmarate / 6);
                for($vote = - $maxkarmarate + $offset; $vote <= $maxkarmarate; $vote += $offset) {
                        $votenum = $vote > 0 ? '+'.$vote : $vote;
                        $karmaoptions .= $vote ? "<option value=\"$vote\">$votenum</option>\n" : NULL;
                }
        }
        unset($vote, $votenum, $offset);

        $score = intval($score);
        $reason = $reason;
        if(strlen($reason) >100) {
                showmessage('對不起,字數超過100字節請返回修改。');
        }
        $offset = ceil($maxkarmarate / 6);
        $minkarmarate = $offset - $maxkarmarate;
        if($score < $minkarmarate || $score > $maxkarmarate) {
                showmessage('thread_karma_range_invalid');
        }


        $query = $db->query("SELECT SUM(abs(score)) FROM $table_karmalog WHERE uid='$discuz_uid' AND dateline>=".($timestamp-86400));
    if($maxrateperday &&  $maxrateperday <= $db->result($query, 0)) {
        showmessage('thread_karma_ctrl');
    }


        $query = $db->query("SELECT author, authorid, dateline FROM $table_posts WHERE pid='$pid'");
        if(!$post = $db->fetch_array($query)) {
                showmessage('undefined_action');
        } elseif(!$isadmin && $post['authorid'] == $discuz_uid) {
                showmessage('thread_karma_member_invalid');
        } elseif($delaykarma && ($timestamp - $post['dateline'] > $delaykarma) && $adminid != 1 ){
                showmessage('thread_karma_timeout');
        }

        $query = $db->query("SELECT pid FROM $table_karmalog WHERE uid='$discuz_uid' AND pid='$pid' LIMIT 1");
         if(!$isadmin && $db->result($query, 0)) {
                showmessage('thread_karma_duplicate');
        }

        if(!submitcheck('karmasubmit')) {

                include template('karma');

        } else {

                $score = intval($score);
                $reason = $reason;
                    if(strlen($reason) >100) {
                            showmessage('對不起,字數超過100字節請返回修改。');
                    }
                if($score >= 0) {
                        $score = "+$score";
                }

                $query = $db->query("SELECT m.adminid, u.groupid FROM $table_members m
                                        LEFT JOIN $table_usergroups u ON type='member' AND m.credit$score>=u.creditshigher AND m.credit$score<u.creditslower
                                        WHERE uid='$post[authorid]'");
                $member = $db->fetch_array($query);
                $groupidadd = $member['adminid'] == 0 ? ", groupid='$member[groupid]'" : NULL;
                // bestlucky60-start
                if($adminid == 1){
                $kauser = "论坛管理员";
                }elseif($adminid == 2){
                $kauser = "超级版主";
                }elseif($adminid == 3){
                $kauser = "版主";
                }
                $query = $db->query("SELECT username,credit FROM $table_members WHERE username='$post[author]'");
                $member = $db->fetch_array($query);
                // bestlucky60-end
                $db->query("UPDATE $table_members SET credit=credit$score $groupidadd WHERE uid='$post[authorid]'", 'UNBUFFERED');
                $db->query("INSERT INTO $table_karmalog (uid, pid, dateline, reason, score)
                        VALUES ('$discuz_uid', '$pid', '$timestamp', '$reason', '$score')", 'UNBUFFERED');

                $ratetimes = round($maxkarmarate / 5);
                $db->query("UPDATE $table_posts SET rate=rate$score, ratetimes=ratetimes+$ratetimes WHERE pid='$pid'", 'UNBUFFERED');

                @$fp = fopen(DISCUZ_ROOT.'./forumdata/karmalog.php', 'a');
                @flock($fp, 2);
                @fwrite($fp, "$timestamp\t$discuz_user\t$groupid\t$post[author]\t$score\t$tid\t$thread[subject]\n");
                @fclose($fp);
                // bestlucky60-start
                if($pmkarma && $discuz_uid) {
                $threadurl = "{$boardurl}viewthread.php?tid=$tid";
                $newcredit = $member['credit'] + $score;
                $kasubject="★奖惩通知单★";
                $kamessage="你好:\n根据你".$threadurl."发帖的内容,\n$kauser: $discuz_user 决定:对你的积分做出如下调整。\n\n========================================\n";
                $kamessage.="评分:原有积分".$member['credit']." $score =$newcredit\n";
                $kamessage.="========================================\n\n";
                $kamessage.="".$cmbmessage."";
                $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message)  VALUES('$discuz_user', '$discuz_uid', '$post[authorid]', 'inbox', '1', '$kasubject', '$timestamp','$kamessage')");
                $db->query("UPDATE $table_members SET newpm='1' WHERE username = '$post[author]'");
                }
                // bestlucky60-End

                showmessage('thread_karma_succeed', "viewthread.php?tid=$tid");

        }

} elseif($action == 'report') {

        if(!$reportpost) {
                showmessage('thread_report_disabled');
        }

        if(!$discuz_user) {
                showmessage('not_loggedin', NULL, 'HALTED');
        }

        if(!$thread || !is_numeric($pid)) {
                showmessage('undefined_action', NULL, 'HALTED');
        }

        if(!submitcheck('reportsubmit')) {

                $discuz_action = 123;
                include template('reportpost');

        } else {

                $posturl = "{$boardurl}viewthread.php?tid=$tid".($page || $pid ? "&page=$page#pid$pid" : NULL);

                $message = "有人向您报告了帖子,请访问: \[url\]$posturl\[/url\]\n\n他/她的原因是: $reason";

                $reportto = array();
                $conditions = "username IN ('".str_replace(',', '\',\'', str_replace(' ', '', $forum['moderator']))."') OR adminid='1' OR adminid='2'";
                $query = $db->query("SELECT uid FROM $table_members WHERE $conditions");
                while($member = $db->fetch_array($query)) {
                        $reportto[] = $member['uid'];
                }

                foreach($reportto as $moderatorid) {
                        $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message)
                                VALUES('$discuz_user', '$discuz_uid', '$moderatorid', 'inbox', '1', '帖子报告通知,来源于$discuz_user...', '$timestamp', '$message')");
                }
                $db->query("UPDATE $table_members SET newpm='1' WHERE $conditions");

                showmessage('thread_report_succeed', "viewthread.php?tid=$tid&page=$page&fpage=$fpage");

        }

}elseif($action == 'Information') {
        showmessage(base64_decode('PHRhYmxlIHdpZHRoPSIzMDAiIGFsaWduPSJjZW50ZXIiPjx0cj48dGQgY29sc3Bhbj0iMiI+RGlzY3V6ISBCb2FyZCBJbmZvcm1hdGlvbiA8YnI+PGJyPjwvdGQ+PC90cj48dHI+PHRkPlByb2R1Y3QtbmFtZTwvdGQ+PHRkPkRpc2N1eiEgRnJlZSAyLlg8L3RkPjwvdHI+Cjx0cj48dGQ+QXV0aG9yPC90ZD48dGQ+Q3Jvc3NkYXksQ250ZWFjaGVyLFBLMDkwOTwvdGQ+PC90cj4KPHRyPjx0ZD5TdXBwb3J0PC90ZD48dGQ+SHR0cDovL3d3dy5kaXNjdXoubmV0PC90ZD48L3RyPgo8dHI+PHRkPkZyZWUtU3VwcG9ydDwvdGQ+PHRkPkh0dHA6Ly93d3cuZnJlZWRpc2N1ei5uZXQ8L3RkPjwvdHI+CjwvdGFibGU+'));

}elseif($action == 'smilies') {
        
        $navigation = "表情符号-对应图像";
        $smilies = array();
        $query = $db->query("SELECT code, url FROM $table_smilies WHERE type='smiley'");
        while($smiley = $db->fetch_array($query)) {
                $smilies[] = $smiley;
        }
        
        include template('siuyau_popup_showsmilies');
} else {

        showmessage('undefined_action', NULL, 'HALTED');

}

?>
回复

使用道具 举报

 楼主| tks999 发表于 2005-8-21 21:37:53 | 显示全部楼层
  1. $db->query("INSERT INTO $table_karmalog (uid, pid, dateline, reason, score)
  2.                         VALUES ('$discuz_uid', '$pid', '$timestamp', '$reason', '$score')", 'UNBUFFERED');
复制代码


替换为

  1. $db->query("INSERT INTO $table_karmalog (uid, pid, dateline, score, reason)
  2.                         VALUES ('$discuz_uid', '$pid', '$timestamp', '$score', '$reason')", 'UNBUFFERED');
复制代码
回复

使用道具 举报

xjbl 发表于 2005-8-21 21:46:37 | 显示全部楼层
还是不行.
回复

使用道具 举报

 楼主| tks999 发表于 2005-8-21 21:49:12 | 显示全部楼层
将karma.htm贴出来
回复

使用道具 举报

xjbl 发表于 2005-8-21 21:51:07 | 显示全部楼层
{template header}
<table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center" style="table-layout: fixed">
<tr><td class="nav" width="90%" align="left" nowrap>&nbsp;<a href="index.php">$bbname</a> $navigation &raquo; {lang thread_rate}</td>
<td align="right" width="10%">&nbsp;<a href="#bottom"><img src="{IMGDIR}/arrow_dw.gif" border="0" align="absmiddle"></a></td>        
</tr></table><br>

<form method="post" name="input" action="misc.php?action=karma" onSubmit="return validate(this)">
<input type="hidden" name="karmasubmit" value="submit">
<input type="hidden" name="formhash" value="{FORMHASH}">
<table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center">
<tr><td bgcolor="{BORDERCOLOR}">

<table border="0" cellspacing="{BORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
<tr class="header">
<td colspan="2">{lang thread_rate}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang username}:</td>
<td bgcolor="{ALTBG2}">$discuz_userss  <span class="smalltxt">[<a href="logging.php?action=logout">{lang member_logout}</a>]</span></td>
</tr>
<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang author}:</td>
<td bgcolor="{ALTBG2}"><a href="viewpro.php?uid=$post[authorid]">$post[author]</a></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang thread_rating}:</td>
<td bgcolor="{ALTBG2}">{lang credit_title} <select name="score"><option value="0">0</option>$karmaoptions</select> {lang credit_unit}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang subject}:</td>
<td bgcolor="{ALTBG2}"><a href="viewthread.php?tid=$tid">$thread[subject]</a></td>
</tr>

<tr>
<td bgcolor="#F8F8F8" valign="top">操作原因:
</td>
<td bgcolor="#FFFFFF">

<select name="selectreason" size="6" onchange="this.form.reason.value=this.value">
<option value="">自定义</option>
<option value="">--------</option>
<option value="广告/SPAM">广告/SPAM</option>
<option value="恶意灌水">恶意灌水</option>
<option value="违规内容">违规内容</option>
<option value="文不对题">文不对题</option>
<option value="重复发帖">重复发帖</option>
<option value="发错版块">发错版块</option>

<option value="">--------</option>
<option value="我很赞同">我很赞同</option>
<option value="精品文章">精品文章</option>
<option value="原创内容">原创内容</option>
</select>
<textarea name="reason" rows="6" cols="35"></textarea><br>
</td>

</table>
</td></tr></table><br>
<input type="hidden" name="tid" value="$tid">
<input type="hidden" name="pid" value="$pid">
<center><input type="submit" name="topicsubmit" value="{lang submit}"></center>
</form>
{template footer}
回复

使用道具 举报

beecheung 发表于 2005-8-21 23:27:54 | 显示全部楼层
这个我倒是装好了,只不过好像发短信不行,而且不能自定义理由,是怎么回事?
回复

使用道具 举报

 楼主| tks999 发表于 2005-8-22 00:07:23 | 显示全部楼层
打开misc.php
查找
  1. $db->query("INSERT INTO $table_karmalog (uid, pid, dateline, reason, score)
  2.                         VALUES ('$discuz_uid', '$pid', '$timestamp', '$reason', '$score')", 'UNBUFFERED');
复制代码


替换为
  1. $db->query("INSERT INTO $table_karmalog (uid, pid, dateline, score, reason)
  2.                         VALUES ('$discuz_uid', '$pid', '$timestamp', '$score', '$reason')", 'UNBUFFERED');
复制代码


修改了上面对应该是没有问题了,有升级数据吗???在更新之前有使用操作理由过吧???可能是因为显示的变量已经不同了,所以在更新之前的不会显示了,必须更新之后的才可以显示

[ 本帖最后由 tks999 于 2005-8-22 00:08 编辑 ]
回复

使用道具 举报

 楼主| tks999 发表于 2005-8-22 00:09:42 | 显示全部楼层
原帖由 beecheung 于 2005-8-21 23:27 发表
这个我倒是装好了,只不过好像发短信不行,而且不能自定义理由,是怎么回事?


看看你的karma.htm有没有修改错误,我的是没有问题
你说的是操作理由时候无法自定义还是无法显示自定义理由???
回复

使用道具 举报

 楼主| tks999 发表于 2005-8-22 00:36:35 | 显示全部楼层
我使用了XJBL得代码和给他的修改后,经过测试没有问题
回复

使用道具 举报

xjbl 发表于 2005-8-22 01:18:09 | 显示全部楼层
见鬼了....现在又好了....
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-22 07:20 , Processed in 0.098069 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表