|
DZ 7.2自带的热度评价只对主题有效,而无法对回复进行评价。
这里的修改可以让论坛对回复也进行热度评价
后台数据库管理里面运行SQL语句- ALTER TABLE `cdb_posts` ADD `recommends` smallint(6) DEFAULT '0' NOT NULL;
- ALTER TABLE `cdb_posts` ADD `recommend_add` smallint(6) DEFAULT '0' NOT NULL;
- ALTER TABLE `cdb_posts` ADD `recommend_sub` smallint(6) DEFAULT '0' NOT NULL;
- CREATE TABLE `cdb_postrecommend` (
- `pid` mediumint(8) unsigned NOT NULL,
- `recommenduid` mediumint(8) unsigned NOT NULL default '0',
- `dateline` int(10) unsigned NOT NULL default '0',
- KEY `pid` (`pid`),
- KEY `uid` (`recommenduid`)
- ) ENGINE=MyISAM;
复制代码 打开templates/default/css_script.htm
找到:- .editpost { background: url({IMGDIR}/edit.gif) no-repeat 0 50%; }
复制代码 在下面加:- .ding { background: url({IMGDIR}/ding.gif) no-repeat 0 50%; }
- .cai { background: url({IMGDIR}/cai.gif) no-repeat 0 50%; }
复制代码 打开misc.php
找到:- } elseif($action == 'removeindexheats') {
复制代码 在上面加:- } elseif($action == 'postrecommend') {
- if(!$recommendthread['status'] || !$allowrecommend) {
- showmessage('undefined_action', NULL, 'HALTED');
- }
-
-
- if($query = $db->query("SELECT authorid, first,recommend_add ,recommend_sub FROM {$tablepre}posts WHERE pid='$pid' Limit 1")){
- $postinfo = $db->fetch_array($query);
- }else{
- showmessage('对不起,指定的帖子不存在', NULL, 'HALTED');
- }
-
- if($postinfo['first'])showmessage('对不起,不能对楼主帖进行评价');
- if($db->fetch_first("SELECT * FROM {$tablepre}postrecommend WHERE recommenduid='$Discuz_uid' AND pid='$pid'")) {
- showmessage('你已经评价过这个帖子了', NULL, 'HALTED');
- }
- $recommendcount = $db->result_first("SELECT COUNT(*) FROM {$tablepre}postrecommend WHERE recommenduid='$discuz_uid' AND dateline>$timestamp-86400");
- if($recommendthread['daycount'] && $recommendcount >= $recommendthread['daycount']) {
- showmessage('recommend_outoftimes', NULL, 'HALTED');
- }
- if($postinfo['authorid'] == $discuz_uid && !$recommendthread['ownthread']) {
- showmessage('不允许评价自己发表的主题', NULL, 'HALTED');
- }
-
- $allowrecommend = intval($do == 'add' ? $allowrecommend : -$allowrecommend);
- if($do == 'add') {
- $heatadd = 'recommend_add=recommend_add+1';
- } else {
- $heatadd = 'recommend_sub=recommend_sub+1';
- }
- $db->query("UPDATE {$tablepre}threads SET heats=heats+'$allowrecommend' WHERE tid='$tid'");
- $db->query("UPDATE {$tablepre}posts SET recommends=recommends+'$allowrecommend', $heatadd WHERE pid='$pid'");
- $db->query("INSERT INTO {$tablepre}postrecommend (pid, recommenduid, dateline) VALUES ('$pid', '$discuz_uid', '$timestamp')");
- if($do == 'add') {
- showmessage($postinfo['recommend_add']+1);
- }else{
- showmessage($postinfo['recommend_sub']+1);
- }
复制代码 打开templates/default/viewthread_node.htm
找到:- {$pluginhooks[viewthread_postfooter][$postcount]}
复制代码 在上面加:- <!--{if !$post['first']}-->
- <a class="ding" id="ajax_flows_{$post[pid]}" {if $discuz_uid}href="misc.php?action=postrecommend&do=add&tid=$tid&pid=$post[pid]" onclick="ajaxget('misc.php?action=postrecommend&do=add&tid=$tid&pid=$post[pid]', 'postding_{$post[pid]}', '');doane(event);"{else}href="logging.php?action=login" onclick="showWindow('login', this.href);return false;"{/if}>$recommendthread[addtext](<span class="smalltxt" id="postding_{$post[pid]}">$post[recommend_add]</span>)</a>
- <a class="cai" id="ajax_flows_{$post[pid]}" {if $discuz_uid}href="misc.php?action=postrecommend&do=subtract&tid=$tid&pid=$post[pid]" onclick="ajaxget('misc.php?action=postrecommend&do=subtract&tid=$tid&pid=$post[pid]', 'postcai_{$post[pid]}', '');doane(event);"{else}href="logging.php?action=login" onclick="showWindow('login', this.href);return false;"{/if}>$recommendthread[subtracttext](<span class="smalltxt" id="postcai_{$post[pid]}">$post[recommend_sub]</span>)</a>
- <!--{/if}-->
复制代码 图片请上传到images/default中
|
|