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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] 猪头诅咒术V1.0 For DZ5.5.0 发布

[复制链接]
itotti 发表于 2007-3-25 17:51:45 | 显示全部楼层
我的是
  1. <?php

  2. /*
  3.         [Discuz!] (C)2001-2006 Comsenz Inc.
  4.         This is NOT a freeware, use is subject to license terms

  5.         $RCSfile: viewthread.php,v $
  6.         $Revision: 1.166.2.7 $
  7.         $Date: 2007/03/08 20:17:03 $
  8. */

  9. define('CURSCRIPT', 'viewthread');
  10. define('SQL_ADD_THREAD', ' t.dateline, t.special, t.lastpost AS lastthreadpost,');

  11. require_once './include/common.inc.php';
  12. require_once DISCUZ_ROOT.'./include/forum.func.php';
  13. supe_dbconnect();


  14. $page = max(1, intval($page));

  15. if($cachethreadlife && $forum['threadcaches'] && !$discuz_uid && $page == 1 && !$forum['special']) {

  16.         $forum['livedays'] = ceil(($timestamp - $forum['dateline']) / 86400);
  17.         $forum['lastpostdays'] = ceil(($timestamp - $forum['lastthreadpost']) / 86400);

  18.         $threadcachemark = 100 - (
  19.                 $forum['displayorder'] * 15 +
  20.                 $forum['digest'] * 10 +
  21.                 min($forum['views'] / max($forum['livedays'], 10) * 2, 50) +
  22.                 max(-10, (15 - $forum['lastpostdays'])) +
  23.                 min($forum['replies'] / $_DCACHE['settings']['postperpage'] * 1.5, 15));

  24.         if($threadcachemark < $forum['threadcaches']) {

  25.                 $threadcache = getcacheinfo($tid);

  26.                 if($timestamp - $threadcache['filemtime'] > $cachethreadlife) {
  27.                         @unlink($threadcache['filename']);
  28.                         define('CACHE_FILE', $threadcache['filename']);

  29.                 } else {
  30.                         readfile($threadcache['filename']);

  31.                         $supe_pushstatusadd = '';
  32.                         viewthread_updateviews();

  33.                         $debug && debuginfo();
  34.                         die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " '.($debug ? 'Update at '.gmdate("H:i:s", $threadcache['filemtime'] + 3600 * 8).', Processed in '.$debuginfo['time'].' second(s), '.$debuginfo['queries'].' Queries'.($gzipcompress ? ', Gzip enabled' : '') : '').'";</script>');
  35.                 }
  36.         }
  37. }

  38. require_once DISCUZ_ROOT.'./include/discuzcode.func.php';
  39. require("./include/add_function.php");

  40. $discuz_action = 3;

  41. $query = $db->query("SELECT * FROM {$tablepre}threads t WHERE tid='$tid' AND displayorder>='0'");

  42. $lastmod = array();

  43. if(!$thread = $db->fetch_array($query)) {

  44.         $tid = $_GET['tid'];
  45.         if(is_numeric($tid) && $supe['status'] && !empty($supe_fromsupesite) && md5("$discuz_auth_key-$tid") == $supe_fromsupesite) {
  46.                 supe_dbconnect();
  47.                 $supe['db']->query("UPDATE {$supe[tablepre]}spaceitems SET tid='0' WHERE tid='$tid'");
  48.         }

  49.         showmessage('thread_nonexistence');

  50. } elseif($thread['moderated']) {
  51.         $query = $db->query("SELECT uid AS moduid, username AS modusername, dateline AS moddateline, action AS modaction, magicid
  52.                 FROM {$tablepre}threadsmod
  53.                 WHERE tid='$tid' ORDER BY dateline DESC LIMIT 1");
  54.         if($lastmod = $db->fetch_array($query)) {
  55.                 include language('modactions');
  56.                 $lastmod['modusername'] = $lastmod['modusername'] ? $lastmod['modusername'] : 'System';
  57.                 $lastmod['moddateline'] = gmdate("$dateformat $timeformat", $lastmod['moddateline'] + $timeoffset * 3600);
  58.                 $lastmod['modaction'] = $modactioncode[$lastmod['modaction']];
  59.                 if($lastmod['magicid']) {
  60.                         require_once DISCUZ_ROOT.'./forumdata/cache/cache_magics.php';
  61.                         $lastmod['magicname'] = $_DCACHE['magics'][$lastmod['magicid']]['name'];
  62.                 }

  63.         } else {
  64.                 $db->query("UPDATE {$tablepre}threads SET moderated='0' WHERE tid='$tid'", 'UNBUFFERED');
  65.         }
  66. }

  67. $supe_fromdiscuz = $supe['status'] && $thread['itemid'] ? md5("$discuz_auth_key-$thread[itemid]") : '';
  68. $iscircle = $supe['status'] && $supe['circlestatus'] && $forum['status'] == 2 && $thread['sgid'];

  69. $codecount = 0;
  70. $thread['subjectenc'] = rawurlencode($thread['subject']);
  71. $fromuid = $creditspolicy['promotion_visit'] && $discuz_uid ? '&amp;fromuid='.$discuz_uid : '';

  72. $oldtopics = isset($_DCOOKIE['oldtopics']) ? $_DCOOKIE['oldtopics'] : 'D';
  73. if(strpos($oldtopics, 'D'.$tid.'D') === FALSE) {
  74.         $oldtopics = 'D'.$tid.$oldtopics;
  75.         if(strlen($oldtopics) > 3072) {
  76.                 $oldtopics = preg_replace("((D\d+)+D).*$", "\\1", substr($oldtopics, 0, 3072));
  77.         }
  78.         dsetcookie('oldtopics', $oldtopics, 3600);
  79. }

  80. if($lastvisit < $thread['lastpost'] && (!isset($_DCOOKIE['fid'.$fid]) || $thread['lastpost'] > $_DCOOKIE['fid'.$fid])) {
  81.         dsetcookie('fid'.$fid, $thread['lastpost'], 3600);
  82. }
  83. $navigation = '&raquo; <a href="'.($iscircle ? $supe['siteurl'].'?action_mygroup_gid_'.$thread['sgid'].'_op_list_type_bbs_fid_'.$fid : 'forumdisplay.php?fid='.$fid.($extra ? '&amp;'.preg_replace("/^(&amp;)*/", '', $extra) : '')).'">'.$forum[name].'</a> &raquo; '.$thread[subject];
  84. $navtitle = $thread['subject'].' - '.strip_tags($forum['name']);
  85. if($forum['type'] == 'sub') {
  86.         $query = $db->query("SELECT fid, name FROM {$tablepre}forums WHERE fid='$forum[fup]'");
  87.         $fup = $db->fetch_array($query);
  88.         $navigation = '&raquo; <a href="'.($iscircle ? $supe['siteurl'].'?action_mygroup_gid_'.$thread['sgid'].'_op_list_type_bbs_fid_'.$fup[fid] : 'forumdisplay.php?fid='.$fup[fid]).'">'.$fup[name].'</a> '.$navigation;
  89.         $navtitle = $navtitle.' - '.strip_tags($fup['name']);
  90. }
  91. $navtitle .= ' - ';

  92. if($thread['typeid'] && isset($forum['threadtypes']['types'][$thread['typeid']])) {
  93.         $thread['subject'] = ($forum['threadtypes']['listable'] ? '<a href="forumdisplay.php?fid='.$fid.'&amp;filter=type&amp;typeid='.$thread['typeid'].'">['.$forum['threadtypes']['types'][$thread['typeid']].']</a>' : '['.$forum['threadtypes']['types'][$thread['typeid']].']').' '.$thread['subject'];
  94. }
  95. if(empty($forum['allowview'])) {
  96.         if(!$forum['viewperm'] && !$readaccess) {
  97.                 showmessage('group_nopermission', NULL, 'NOPERM');
  98.         } elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
  99.                 $navtitle = '';
  100.                 showmessage('forum_nopermission', NULL, 'NOPERM');
  101.         }
  102. }

  103. if($forum['password'] && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
  104.         dheader("Location: {$boardurl}forumdisplay.php?fid=$fid&amp;sid=$sid");
  105. }

  106. if($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
  107.         showmessage('thread_nopermission', NULL, 'NOPERM');
  108. }

  109. if($thread['price'] > 0 && $thread['special'] == 0) {

  110.         if($maxchargespan && $timestamp - $thread['dateline'] >= $maxchargespan * 3600) {
  111.                 $db->query("UPDATE {$tablepre}threads SET price='0' WHERE tid='$tid'");
  112.                 $thread['price'] = 0;
  113.         } else {
  114.                 if(!$discuz_uid) {
  115.                         showmessage('group_nopermission', NULL, 'NOPERM');

  116.                 } elseif(!$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
  117.                         $query = $db->query("SELECT tid FROM {$tablepre}paymentlog WHERE tid='$tid' AND uid='$discuz_uid'");
  118.                         if(!$db->num_rows($query)) {
  119.                                 require_once DISCUZ_ROOT.'./include/threadpay.inc.php';
  120.                                 exit();
  121.                         }
  122.                 }
  123.         }
  124. }

  125. if($iscircle) {
  126.         require_once DISCUZ_ROOT.'./include/supesite_circle.inc.php';
  127. }

  128. $raterange = $modratelimit && $adminid == 3 && !$forum['ismoderator'] ? array() : $raterange;

  129. $extra = rawurlencode($extra);

  130. $allowgetattach = !empty($forum['allowgetattach']) || ($allowgetattach && !$forum['getattachperm']) || forumperm($forum['getattachperm']);

  131. $postlist = $attachtags = $attachlist = array();
  132. $attachpids = $announcepm = 0;
  133. if(empty($action) && $tid) {

  134.         $pmlist = array();
  135.         if($_DCACHE['pmlist']) {
  136.                 $readapmids = !empty($_DCOOKIE['readapmid']) ? explode('D', $_DCOOKIE['readapmid']) : array();
  137.                 foreach($_DCACHE['pmlist'] as $pm) {
  138.                         if($discuz_uid && (empty($pm['groups']) || in_array($groupid, $pm['groups']))) {
  139.                                 if(!in_array($pm['id'], $readapmids)) {
  140.                                         $pm['announce'] = TRUE;
  141.                                         $pmlist[] = $pm;
  142.                                         $announcepm++;
  143.                                 }
  144.                         }
  145.                 }
  146.         }
  147.         if($discuz_uid && $newpm) {
  148.                 require_once DISCUZ_ROOT.'./include/pmprompt.inc.php';
  149.         }

  150.         $showsettings = str_pad(decbin($showsettings), 3, '0', STR_PAD_LEFT);

  151.         $customshow = $discuz_uid ? str_pad(base_convert($customshow, 10, 3), 3, '0', STR_PAD_LEFT) : '222';

  152.         $showsignatures = $customshow{0} == 2 ? $showsettings{0} : $customshow{0};
  153.         $showavatars = $customshow{1} == 2 ? $showsettings{1} : $customshow{1};
  154.         $showimages = $customshow{2} == 2 ? $showsettings{2} : $customshow{2};
  155.         $allowpaytoauthor = $forum['allowpaytoauthor'];

  156.         //get qihoo status (pos. -3)
  157.         $searchboxstatus = substr(sprintf('%03b', $qihoo_searchbox), -3, 1);

  158.         $highlightstatus = isset($highlight) && str_replace('+', '', $highlight) ? 1 : 0;
  159.         $maxsigrows = $maxsigrows ? 'style="overflow: hidden; max-height: '.$maxsigrows.'em; maxHeightIE: '.($maxsigrows * intval(FONTSIZE) + 5).'px;"' : '';

  160.         $ppp = $forum['threadcaches'] && !$discuz_uid ? $_DCACHE['settings']['postperpage'] : $ppp;
  161.         $start_limit = $numpost = ($page - 1) * $ppp;
  162.         if($start_limit > $thread['replies']) {
  163.                 $start_limit = $numpost = 0;
  164.                 $page = 1;
  165.         }
  166.         $multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&amp;extra=$extra".(isset($highlight) ? "&amp;highlight=".rawurlencode($highlight) : ''));

  167.         if($thread['special'] > 0) {
  168.                 include_once DISCUZ_ROOT.'./include/special.inc.php';
  169.         }

  170.         $extcredits_thread = array();

  171.         if(!empty($extcredits)) {
  172.                 foreach($extcredits as $key => $value) {
  173.                         if($value['showinthread']) {
  174.                                 $extcredits_thread['extcredits'.$key] = array('title' => $value['title'], 'unit' => $value['unit']);
  175.                         }
  176.                 }
  177.         }

  178.         $fieldsadd = '';
  179.         if(is_array($_DCACHE['fields_thread'])) {
  180.                 foreach($_DCACHE['fields_thread'] as $field) {
  181.                         $fieldsadd .= ', mf.field_'.$field['fieldid'];
  182.                 }
  183.         }

  184.         $newpostanchor = $postcount = $ratelogpids = 0;

  185.         $onlineauthors = array();
  186.         $query = $db->query("SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
  187.                 m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
  188.                 m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, m.xspacestatus, mf.nickname, mf.site,
  189.                 mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals, mf.avatar, mf.avatarwidth,
  190.                 mf.avatarheight, mf.sightml AS signature, mf.customstatus, mf.spacename $fieldsadd
  191.                 FROM {$tablepre}posts p
  192.                 LEFT JOIN {$tablepre}members m ON m.uid=p.authorid
  193.                 LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
  194.                 WHERE p.tid='$tid' AND p.invisible='0' ORDER BY dateline LIMIT $start_limit, $ppp");

  195.         while($post = $db->fetch_array($query)) {

  196.                 if(!$newpostanchor && $post['dateline'] > $lastvisit) {
  197.                         $post['newpostanchor'] = '<a name="newpost"></a>';
  198.                         $newpostanchor = 1;
  199.                 } else {
  200.                         $post['newpostanchor'] = '';
  201.                 }
  202.                 $post['lastpostanchor'] = $numpost == $thread['replies'] ? '<a name="lastpost"></a>' : '';
  203.                 $post['number'] = ++$numpost;
  204.                 $post['count'] = $postcount++;
  205.                 $post['thisbg'] = $thisbg = isset($thisbg) && $thisbg == 'altbg1' ? 'altbg2' : 'altbg1';
  206.                 $post['dbdateline'] = $post['dateline'];
  207.                 $post['dateline'] = gmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);
  208. $daysreg = ($timestamp - $post['regdate']) / (24*3600);
  209. $ppd = $post['posts'] / $daysreg;
  210. $post['exp_mp_hp'] = exp_mp_hp($post['posts'],$ppd,$daysreg);
  211.                 $post['groupid'] = $_DCACHE['usergroups'][$post['groupid']] ? $post['groupid'] : 7;

  212.                 if($post['username']) {
  213.                         $onlineauthors[] = $post['authorid'];
  214.                         $post['groupid'] = getgroupid($post['authorid'], $_DCACHE['usergroups'][$post['groupid']], $post);
  215.                         $post['readaccess'] = $_DCACHE['usergroups'][$post['groupid']]['readaccess'];
  216.                         if($userstatusby == 1 || $_DCACHE['usergroups'][$post['groupid']]['byrank'] === '0') {
  217.                                 $post['authortitle'] = $_DCACHE['usergroups'][$post['groupid']]['grouptitle'];
  218.                                 $post['stars'] = $_DCACHE['usergroups'][$post['groupid']]['stars'];
  219.                         } elseif($userstatusby == 2) {
  220.                                 foreach($_DCACHE['ranks'] as $rank) {
  221.                                         if($post['posts'] > $rank['postshigher']) {
  222.                                                 $post['authortitle'] = $rank['ranktitle'];
  223.                                                 $post['stars'] = $rank['stars'];
  224.                                                 break;
  225.                                         }
  226.                                 }
  227.                         }

  228.                         if(!$allowpaytoauthor) {
  229.                                 $post['alipay'] = '';
  230.                         }

  231.                         $post['taobao'] = addslashes($post['taobao']);
  232.                         $post['authoras'] = !$post['anonymous'] ? ' '.addslashes($post['author']) : '';
  233.                         $post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
  234.                         $post['allowuseblog'] = $_DCACHE['usergroups'][$post['groupid']]['allowuseblog'];

  235.                         if($post['medals']) {
  236.                                 require_once DISCUZ_ROOT.'./forumdata/cache/cache_medals.php';
  237.                                 foreach($post['medals'] = explode("\t", $post['medals']) as $key => $medalid) {
  238.                                         if(isset($_DCACHE['medals'][$medalid])) {
  239.                                                 $post['medals'][$key] = $_DCACHE['medals'][$medalid];
  240.                                         } else {
  241.                                                 unset($post['medals'][$key]);
  242.                                         }
  243.                                 }

  244.                         }

  245.                         if($showavatars) {
  246.                                 if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
  247.                                         $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
  248.                                 } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
  249.                                         $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';
  250.                                 } else {
  251.                                         $post['avatar'] = '<img src="./images/avatars/noavatar.gif" border="0" alt="" />';
  252.                                 }
  253.                         }

  254.                 } else {

  255.                         if(!$post['authorid']) {
  256.                                 $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')).'.x';
  257.                         }

  258.                 }

  259.                 $post['attachments'] = array();
  260.                 if($post['attachment'] && $allowgetattach) {
  261.                         $attachpids .= ",$post[pid]";
  262.                         $post['attachment'] = 0;
  263.                         if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
  264.                                 $attachtags[$post['pid']] = $matchaids[1];
  265.                         }
  266.                 }

  267.                 if($ratelogrecord && $post['ratetimes']) $ratelogpids .= ','.$post['pid'];

  268.                 $forum['allowbbcode'] = $forum['allowbbcode'] ? ($_DCACHE['usergroups'][$post['groupid']]['allowcusbbcode'] ? 2 : 1) : 0;

  269.                 $post['ratings'] = karmaimg($post['rate'], $post['ratetimes']);
  270.                 $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'], $forum['allowsmilies'], $forum['allowbbcode'], ($forum['allowimgcode'] && $showimages ? 1 : 0), $forum['allowhtml'], ($forum['jammer'] && $post['authorid'] != $discuz_uid ? 1 : 0), 0, $post['authorid']);
  271. //-----------------------每个主题只显示一次签名  for  南坝论坛修改版
  272.         $count[$post['authorid']] = $post['usesig'] ? $count[$post['authorid']] + 1 : $count[$post['authorid']];
  273.         $post['signature'] = $count[$post['authorid']] == 1 ? $post['signature'] : NULL;
  274. //-----------------------每个主题只显示一次签名  for  [url]www.nanba.com.cn[/url]
  275.                 $post['signature'] = $post['usesig'] ? $post['signature'] : '';
  276.                 $postlist[$post['pid']] = $post;

  277.         }

  278.         if($vtonlinestatus == 2 && $onlineauthors) {
  279.                 $query = $db->query("SELECT uid FROM {$tablepre}sessions WHERE uid IN(".(implode(',', $onlineauthors)).") AND invisible=0");
  280.                 $onlineauthors = array();
  281.                 while($author = $db->fetch_array($query)) {
  282.                         $onlineauthors[$author['uid']] = 1;
  283.                 }
  284.         } else {
  285.                 $onlineauthors = array();
  286.         }
  287.         if($ratelogpids) {
  288.                 $query = $db->query("SELECT * FROM {$tablepre}ratelog WHERE pid IN ($ratelogpids) ORDER BY dateline DESC");
  289.                 while($ratelog = $db->fetch_array($query)) {
  290.                         if(count($postlist[$ratelog['pid']]['ratelog']) < $ratelogrecord) {
  291.                                 $ratelog['dateline'] = gmdate("$dateformat $timeformat", $ratelog['dateline'] + $timeoffset * 3600);
  292.                                 $ratelog['score'] = $ratelog['score'] > 0 ? '+'.$ratelog['score'] : $ratelog['score'];
  293.                                 $ratelog['reason'] = dhtmlspecialchars($ratelog['reason']);
  294.                                 $postlist[$ratelog['pid']]['ratelog'][] = $ratelog;
  295.                         }
  296.                 }
  297.         }

  298.         if($attachpids) {
  299.                 require_once DISCUZ_ROOT.'./include/attachment.func.php';
  300.                 parseattach($attachpids, $attachtags, $postlist, $showimages);
  301.         }

  302.         if(empty($postlist)) {
  303.                 showmessage('undefined_action', NULL, 'HALTED');
  304.         }

  305.         $relatedthreadlist = array();
  306.         $relatedthreadupdate = FALSE;
  307.         if(!empty($qihoo_status) && $qihoo_relatedthreads && $qihoo_searchbox) {
  308.                 $site = site();
  309.                 $relatedkeywords = $metakeywords = '';
  310.                 $query = $db->query("SELECT expiration, keywords, relatedthreads FROM {$tablepre}relatedthreads WHERE tid='$tid'");
  311.                 $related = $db->fetch_array($query);
  312.                 if($related['expiration'] > $timestamp) {
  313.                         $relatedthreadlist = unserialize($related['relatedthreads']);
  314.                         if($related['keywords']) {
  315.                                 $searchkeywords = rawurlencode(str_replace("\t", ' ', $related['keywords']));
  316.                                 foreach(explode("\t", $related['keywords']) as $keyword) {
  317.                                         $relatedkeywords .= $keyword ? '<a href="search.php?srchtype=qihoo&amp;srchtxt='.rawurlencode($keyword).'&amp;searchsubmit=yes" target="_blank"><span class="bold"><font color=red>'.$keyword.'</font></span></a> ' : '';
  318.                                         $metakeywords .= $keyword ? $keyword.',' : '';
  319.                                 }
  320.                         }
  321.                 } else {
  322.                         $relatedthreadupdate = TRUE;
  323.                         $verifykey = md5($authkey.$tid.$thread['subjectenc'].$charset.$site);
  324.                 }
  325.         }
  326.         $relatedthreads = array();
  327.         if(!empty($relatedthreadlist)) {
  328.                 if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'relatedthreads') === FALSE) {
  329.                         $relatedthreads['img'] = 'collapsed_no.gif';
  330.                         $relatedthreads['style'] = '';
  331.                 } else {
  332.                         $relatedthreads['img'] = 'collapsed_yes.gif';
  333.                         $relatedthreads['style'] = 'display: none';
  334.                 }
  335.         }

  336.         $visitedforums = $visitedforums ? visitedforums() : '';
  337.         $forumselect = $forummenu = $smmultipage = '';
  338.         if($fastpost && $allowpost && $_DCACHE['smiliesnum'] > $smcols * $smrows) {
  339.                 $smpage = max(1, intval($_COOKIE['smpage']));
  340.                 $smmultipage = multi($_DCACHE['smiliesnum'], $smcols * $smrows, 1, '###', 0, 4, 1, 'getSmilies');
  341.         }
  342.         if($forumjump && empty($jsmenu[1])) {
  343.                 $forumselect = forumselect();
  344.         }

  345.         $usesigcheck = $discuz_uid && $sigstatus ? 'checked' : '';
  346.         $allowpostreply = ((!$thread['closed'] && !checkautoclose()) || $forum['ismoderator']) && ((!$forum['replyperm'] && $allowreply) || ($forum['replyperm'] && forumperm($forum['replyperm'])) || $forum['allowreply']);
  347.         $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])) || $forum['allowpost'];

  348.         if($allowpost) {
  349.                 $allowpostpoll = $allowpostpoll && ($forum['allowpostspecial'] & 1);
  350.                 $allowposttrade = $allowposttrade && ($forum['allowpostspecial'] & 2);
  351.                 $allowpostreward = $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]);
  352.                 $allowpostactivity = $allowpostactivity && ($forum['allowpostspecial'] & 8);
  353.         } else {
  354.                 $allowpostpoll = $allowposttrade = $allowpostreward = $allowpostactivity = FALSE;
  355.         }

  356.         $supe_pushstatusadd = '';
  357.         if($supe['status'] && $supe_allowpushthread && $forum['supe_pushsetting']['status'] == 3) {
  358.                 if(($thread['views'] && $forum['supe_pushsetting']['filter']['views'] && $thread['views'] >= intval($forum['supe_pushsetting']['filter']['views'])) ||
  359.                         ($thread['replies'] && $forum['supe_pushsetting']['filter']['replies'] && $thread['replies'] >= intval($forum['supe_pushsetting']['filter']['replies'])) ||
  360.                         ($thread['digest'] && $forum['supe_pushsetting']['filter']['digest'] && $thread['digest'] >= intval($forum['supe_pushsetting']['filter']['digest'])) ||
  361.                         ($thread['displayorder'] && $forum['supe_pushsetting']['filter']['displayorder'] && $thread['displayorder'] >= intval($forum['supe_pushsetting']['filter']['displayorder']))) {
  362.                         if($thread['supe_pushstatus'] == 0) {
  363.                                 $supe_pushstatusadd = ", supe_pushstatus='3'";
  364.                         }
  365.                 } elseif($thread['supe_pushstatus'] == 3) {
  366.                         $supe_pushstatusadd = ", supe_pushstatus='0'";
  367.                 }
  368.         }

  369.         viewthread_updateviews();

  370.         $forumselect = $forummenu = '';
  371.         if($forumjump) {
  372.                 if($jsmenu[1]) {
  373.                         $forummenu = forumselect(FALSE, 1);
  374.                 } else {
  375.                         $forumselect = forumselect();
  376.                 }
  377.         }

  378.         include template($iscircle ? 'supesite_viewthread' : 'viewthread');

  379. } elseif($action == 'printable' && $tid) {

  380.         if(ISROBOT) {
  381.                 exit(dheader("HTTP/1.1 403 Forbidden"));
  382.         }
  383.         require_once DISCUZ_ROOT.'./include/printable.inc.php';

  384. }

  385. function viewthread_updateviews() {
  386.         global $delayviewcount, $supe_pushstatusadd, $timestamp, $tablepre, $tid, $db, $adminid;

  387.         if(($delayviewcount == 1 || $delayviewcount == 3) && !$supe_pushstatusadd) {
  388.                 $logfile = './forumdata/cache/cache_threadviews.log';
  389.                 if(substr($timestamp, -2) == '00') {
  390.                         require_once DISCUZ_ROOT.'./include/misc.func.php';
  391.                         updateviews('threads', 'tid', 'views', $logfile);
  392.                 }
  393.                 if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
  394.                         fwrite($fp, "$tid\n");
  395.                         fclose($fp);
  396.                 } elseif($adminid == 1) {
  397.                         showmessage('view_log_invalid');
  398.                 }
  399.         } else {

  400.                 $db->query("UPDATE {$tablepre}threads SET views=views+1 $supe_pushstatusadd WHERE tid='$tid'", 'UNBUFFERED');
  401.         }
  402.         unset($supe_pushstatusadd);
  403. }

  404. ?>
复制代码
回复

使用道具 举报

luhui23 发表于 2007-3-25 17:57:06 | 显示全部楼层
回复

使用道具 举报

 楼主| HPotter 发表于 2007-3-25 18:04:21 | 显示全部楼层
<?php

/*
        [Discuz!] (C)2001-2006 Comsenz Inc.
        This is NOT a freeware, use is subject to license terms

        $RCSfile: viewthread.php,v $
        $Revision: 1.166.2.7 $
        $Date: 2007/03/08 20:17:03 $
*/

define('CURSCRIPT', 'viewthread');
define('SQL_ADD_THREAD', ' t.dateline, t.special, t.lastpost AS lastthreadpost,');

require_once './include/common.inc.php';
require_once DISCUZ_ROOT.'./include/forum.func.php';
supe_dbconnect();


$page = max(1, intval($page));

if($cachethreadlife && $forum['threadcaches'] && !$discuz_uid && $page == 1 && !$forum['special']) {

        $forum['livedays'] = ceil(($timestamp - $forum['dateline']) / 86400);
        $forum['lastpostdays'] = ceil(($timestamp - $forum['lastthreadpost']) / 86400);

        $threadcachemark = 100 - (
                $forum['displayorder'] * 15 +
                $forum['digest'] * 10 +
                min($forum['views'] / max($forum['livedays'], 10) * 2, 50) +
                max(-10, (15 - $forum['lastpostdays'])) +
                min($forum['replies'] / $_DCACHE['settings']['postperpage'] * 1.5, 15));

        if($threadcachemark < $forum['threadcaches']) {

                $threadcache = getcacheinfo($tid);

                if($timestamp - $threadcache['filemtime'] > $cachethreadlife) {
                        @unlink($threadcache['filename']);
                        define('CACHE_FILE', $threadcache['filename']);

                } else {
                        readfile($threadcache['filename']);

                        $supe_pushstatusadd = '';
                        viewthread_updateviews();

                        $debug && debuginfo();
                        die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " '.($debug ? 'Update at '.gmdate("H:i:s", $threadcache['filemtime'] + 3600 * 8).', Processed in '.$debuginfo['time'].' second(s), '.$debuginfo['queries'].' Queries'.($gzipcompress ? ', Gzip enabled' : '') : '').'";</script>');
                }
        }
}

require_once DISCUZ_ROOT.'./include/discuzcode.func.php';
require("./include/add_function.php");

$discuz_action = 3;

$query = $db->query("SELECT * FROM {$tablepre}threads t WHERE tid='$tid' AND displayorder>='0'");

$lastmod = array();

if(!$thread = $db->fetch_array($query)) {

        $tid = $_GET['tid'];
        if(is_numeric($tid) && $supe['status'] && !empty($supe_fromsupesite) && md5("$discuz_auth_key-$tid") == $supe_fromsupesite) {
                supe_dbconnect();
                $supe['db']->query("UPDATE {$supe[tablepre]}spaceitems SET tid='0' WHERE tid='$tid'");
        }

        showmessage('thread_nonexistence');

} elseif($thread['moderated']) {
        $query = $db->query("SELECT uid AS moduid, username AS modusername, dateline AS moddateline, action AS modaction, magicid
                FROM {$tablepre}threadsmod
                WHERE tid='$tid' ORDER BY dateline DESC LIMIT 1");
        if($lastmod = $db->fetch_array($query)) {
                include language('modactions');
                $lastmod['modusername'] = $lastmod['modusername'] ? $lastmod['modusername'] : 'System';
                $lastmod['moddateline'] = gmdate("$dateformat $timeformat", $lastmod['moddateline'] + $timeoffset * 3600);
                $lastmod['modaction'] = $modactioncode[$lastmod['modaction']];
                if($lastmod['magicid']) {
                        require_once DISCUZ_ROOT.'./forumdata/cache/cache_magics.php';
                        $lastmod['magicname'] = $_DCACHE['magics'][$lastmod['magicid']]['name'];
                }

        } else {
                $db->query("UPDATE {$tablepre}threads SET moderated='0' WHERE tid='$tid'", 'UNBUFFERED');
        }
}

$supe_fromdiscuz = $supe['status'] && $thread['itemid'] ? md5("$discuz_auth_key-$thread[itemid]") : '';
$iscircle = $supe['status'] && $supe['circlestatus'] && $forum['status'] == 2 && $thread['sgid'];

$codecount = 0;
$thread['subjectenc'] = rawurlencode($thread['subject']);
$fromuid = $creditspolicy['promotion_visit'] && $discuz_uid ? '&fromuid='.$discuz_uid : '';

$oldtopics = isset($_DCOOKIE['oldtopics']) ? $_DCOOKIE['oldtopics'] : 'D';
if(strpos($oldtopics, 'D'.$tid.'D') === FALSE) {
        $oldtopics = 'D'.$tid.$oldtopics;
        if(strlen($oldtopics) > 3072) {
                $oldtopics = preg_replace("((D\d+)+D).*$", "\\1", substr($oldtopics, 0, 3072));
        }
        dsetcookie('oldtopics', $oldtopics, 3600);
}

if($lastvisit < $thread['lastpost'] && (!isset($_DCOOKIE['fid'.$fid]) || $thread['lastpost'] > $_DCOOKIE['fid'.$fid])) {
        dsetcookie('fid'.$fid, $thread['lastpost'], 3600);
}
$navigation = '&raquo; <a href="'.($iscircle ? $supe['siteurl'].'?action_mygroup_gid_'.$thread['sgid'].'_op_list_type_bbs_fid_'.$fid : 'forumdisplay.php?fid='.$fid.($extra ? '&'.preg_replace("/^(&)*/", '', $extra) : '')).'">'.$forum[name].'</a> &raquo; '.$thread[subject];
$navtitle = $thread['subject'].' - '.strip_tags($forum['name']);
if($forum['type'] == 'sub') {
        $query = $db->query("SELECT fid, name FROM {$tablepre}forums WHERE fid='$forum[fup]'");
        $fup = $db->fetch_array($query);
        $navigation = '&raquo; <a href="'.($iscircle ? $supe['siteurl'].'?action_mygroup_gid_'.$thread['sgid'].'_op_list_type_bbs_fid_'.$fup[fid] : 'forumdisplay.php?fid='.$fup[fid]).'">'.$fup[name].'</a> '.$navigation;
        $navtitle = $navtitle.' - '.strip_tags($fup['name']);
}
$navtitle .= ' - ';

if($thread['typeid'] && isset($forum['threadtypes']['types'][$thread['typeid']])) {
        $thread['subject'] = ($forum['threadtypes']['listable'] ? '<a href="forumdisplay.php?fid='.$fid.'&filter=type&typeid='.$thread['typeid'].'">['.$forum['threadtypes']['types'][$thread['typeid']].']</a>' : '['.$forum['threadtypes']['types'][$thread['typeid']].']').' '.$thread['subject'];
}
if(empty($forum['allowview'])) {
        if(!$forum['viewperm'] && !$readaccess) {
                showmessage('group_nopermission', NULL, 'NOPERM');
        } elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
                $navtitle = '';
                showmessage('forum_nopermission', NULL, 'NOPERM');
        }
}

if($forum['password'] && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
        dheader("Location: {$boardurl}forumdisplay.php?fid=$fid&sid=$sid");
}

if($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
        showmessage('thread_nopermission', NULL, 'NOPERM');
}

if($thread['price'] > 0 && $thread['special'] == 0) {

        if($maxchargespan && $timestamp - $thread['dateline'] >= $maxchargespan * 3600) {
                $db->query("UPDATE {$tablepre}threads SET price='0' WHERE tid='$tid'");
                $thread['price'] = 0;
        } else {
                if(!$discuz_uid) {
                        showmessage('group_nopermission', NULL, 'NOPERM');

                } elseif(!$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
                        $query = $db->query("SELECT tid FROM {$tablepre}paymentlog WHERE tid='$tid' AND uid='$discuz_uid'");
                        if(!$db->num_rows($query)) {
                                require_once DISCUZ_ROOT.'./include/threadpay.inc.php';
                                exit();
                        }
                }
        }
}

if($iscircle) {
        require_once DISCUZ_ROOT.'./include/supesite_circle.inc.php';
}

$raterange = $modratelimit && $adminid == 3 && !$forum['ismoderator'] ? array() : $raterange;

$extra = rawurlencode($extra);

$allowgetattach = !empty($forum['allowgetattach']) || ($allowgetattach && !$forum['getattachperm']) || forumperm($forum['getattachperm']);

$postlist = $attachtags = $attachlist = array();
$attachpids = $announcepm = 0;
if(empty($action) && $tid) {

        $pmlist = array();
        if($_DCACHE['pmlist']) {
                $readapmids = !empty($_DCOOKIE['readapmid']) ? explode('D', $_DCOOKIE['readapmid']) : array();
                foreach($_DCACHE['pmlist'] as $pm) {
                        if($discuz_uid && (empty($pm['groups']) || in_array($groupid, $pm['groups']))) {
                                if(!in_array($pm['id'], $readapmids)) {
                                        $pm['announce'] = TRUE;
                                        $pmlist[] = $pm;
                                        $announcepm++;
                                }
                        }
                }
        }
        if($discuz_uid && $newpm) {
                require_once DISCUZ_ROOT.'./include/pmprompt.inc.php';
        }

        $showsettings = str_pad(decbin($showsettings), 3, '0', STR_PAD_LEFT);

        $customshow = $discuz_uid ? str_pad(base_convert($customshow, 10, 3), 3, '0', STR_PAD_LEFT) : '222';

        $showsignatures = $customshow{0} == 2 ? $showsettings{0} : $customshow{0};
        $showavatars = $customshow{1} == 2 ? $showsettings{1} : $customshow{1};
        $showimages = $customshow{2} == 2 ? $showsettings{2} : $customshow{2};
        $allowpaytoauthor = $forum['allowpaytoauthor'];

        //get qihoo status (pos. -3)
        $searchboxstatus = substr(sprintf('%03b', $qihoo_searchbox), -3, 1);

        $highlightstatus = isset($highlight) && str_replace('+', '', $highlight) ? 1 : 0;
        $maxsigrows = $maxsigrows ? 'style="overflow: hidden; max-height: '.$maxsigrows.'em; maxHeightIE: '.($maxsigrows * intval(FONTSIZE) + 5).'px;"' : '';

        $ppp = $forum['threadcaches'] && !$discuz_uid ? $_DCACHE['settings']['postperpage'] : $ppp;
        $start_limit = $numpost = ($page - 1) * $ppp;
        if($start_limit > $thread['replies']) {
                $start_limit = $numpost = 0;
                $page = 1;
        }
        $multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&extra=$extra".(isset($highlight) ? "&highlight=".rawurlencode($highlight) : ''));

        if($thread['special'] > 0) {
                include_once DISCUZ_ROOT.'./include/special.inc.php';
        }

        $extcredits_thread = array();

        if(!empty($extcredits)) {
                foreach($extcredits as $key => $value) {
                        if($value['showinthread']) {
                                $extcredits_thread['extcredits'.$key] = array('title' => $value['title'], 'unit' => $value['unit']);
                        }
                }
        }

        $fieldsadd = '';
        if(is_array($_DCACHE['fields_thread'])) {
                foreach($_DCACHE['fields_thread'] as $field) {
                        $fieldsadd .= ', mf.field_'.$field['fieldid'];
                }
        }

        $newpostanchor = $postcount = $ratelogpids = 0;

        $onlineauthors = array();
        $query = $db->query("SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
                m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
                m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, m.xspacestatus, mf.nickname, mf.site,
                mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals, mf.avatar, mf.avatarwidth,
                mf.avatarheight, mf.sightml AS signature, mf.customstatus, mf.spacename $fieldsadd
                FROM {$tablepre}posts p
                LEFT JOIN {$tablepre}members m ON m.uid=p.authorid
                LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
                WHERE p.tid='$tid' AND p.invisible='0' ORDER BY dateline LIMIT $start_limit, $ppp");

        while($post = $db->fetch_array($query)) {

                if(!$newpostanchor && $post['dateline'] > $lastvisit) {
                        $post['newpostanchor'] = '<a name="newpost"></a>';
                        $newpostanchor = 1;
                } else {
                        $post['newpostanchor'] = '';
                }
                $post['lastpostanchor'] = $numpost == $thread['replies'] ? '<a name="lastpost"></a>' : '';
                $post['number'] = ++$numpost;
                $post['count'] = $postcount++;
                $post['thisbg'] = $thisbg = isset($thisbg) && $thisbg == 'altbg1' ? 'altbg2' : 'altbg1';
                $post['dbdateline'] = $post['dateline'];
                $post['dateline'] = gmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);
$daysreg = ($timestamp - $post['regdate']) / (24*3600);
$ppd = $post['posts'] / $daysreg;
$post['exp_mp_hp'] = exp_mp_hp($post['posts'],$ppd,$daysreg);
                $post['groupid'] = $_DCACHE['usergroups'][$post['groupid']] ? $post['groupid'] : 7;

                if($post['username']) {
                        $onlineauthors[] = $post['authorid'];
                        $post['groupid'] = getgroupid($post['authorid'], $_DCACHE['usergroups'][$post['groupid']], $post);
                        $post['readaccess'] = $_DCACHE['usergroups'][$post['groupid']]['readaccess'];
                        if($userstatusby == 1 || $_DCACHE['usergroups'][$post['groupid']]['byrank'] === '0') {
                                $post['authortitle'] = $_DCACHE['usergroups'][$post['groupid']]['grouptitle'];
                                $post['stars'] = $_DCACHE['usergroups'][$post['groupid']]['stars'];
                        } elseif($userstatusby == 2) {
                                foreach($_DCACHE['ranks'] as $rank) {
                                        if($post['posts'] > $rank['postshigher']) {
                                                $post['authortitle'] = $rank['ranktitle'];
                                                $post['stars'] = $rank['stars'];
                                                break;
                                        }
                                }
                        }

                        if(!$allowpaytoauthor) {
                                $post['alipay'] = '';
                        }

                        $post['taobao'] = addslashes($post['taobao']);
                        $post['authoras'] = !$post['anonymous'] ? ' '.addslashes($post['author']) : '';
                        $post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
                        $post['allowuseblog'] = $_DCACHE['usergroups'][$post['groupid']]['allowuseblog'];

                        if($post['medals']) {
                                require_once DISCUZ_ROOT.'./forumdata/cache/cache_medals.php';
                                foreach($post['medals'] = explode("\t", $post['medals']) as $key => $medalid) {
                                        if(isset($_DCACHE['medals'][$medalid])) {
                                                $post['medals'][$key] = $_DCACHE['medals'][$medalid];
                                        } else {
                                                unset($post['medals'][$key]);
                                        }
                                }

                        }
   if(($post['overtime'] > $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) && ($post['status']&1)==1) {
    $post['avatar'] = '被诅咒中...<br><img src="images/pig/'.$post['type'].'.gif" border="0" alt="我是猪头" /><br>恢复时间:'.gmdate('Y-n-d H:i',$post['overtime']);
   }else{

                        if($showavatars) {
                                if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
                                        $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
                                } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
                                        $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';
                                } else {
                                        $post['avatar'] = '<img src="./images/avatars/noavatar.gif" border="0" alt="" />';
                                }
                        }
}
                } else {

                        if(!$post['authorid']) {
                                $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')).'.x';
                        }

                }

                $post['attachments'] = array();
                if($post['attachment'] && $allowgetattach) {
                        $attachpids .= ",$post[pid]";
                        $post['attachment'] = 0;
                        if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
                                $attachtags[$post['pid']] = $matchaids[1];
                        }
                }

                if($ratelogrecord && $post['ratetimes']) $ratelogpids .= ','.$post['pid'];

                $forum['allowbbcode'] = $forum['allowbbcode'] ? ($_DCACHE['usergroups'][$post['groupid']]['allowcusbbcode'] ? 2 : 1) : 0;

                $post['ratings'] = karmaimg($post['rate'], $post['ratetimes']);
                $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'], $forum['allowsmilies'], $forum['allowbbcode'], ($forum['allowimgcode'] && $showimages ? 1 : 0), $forum['allowhtml'], ($forum['jammer'] && $post['authorid'] != $discuz_uid ? 1 : 0), 0, $post['authorid']);
//-----------------------每个主题只显示一次签名  for  南坝论坛修改版
        $count[$post['authorid']] = $post['usesig'] ? $count[$post['authorid']] + 1 : $count[$post['authorid']];
        $post['signature'] = $count[$post['authorid']] == 1 ? $post['signature'] : NULL;
//-----------------------每个主题只显示一次签名  for  www.nanba.com.cn
                $post['signature'] = $post['usesig'] ? $post['signature'] : '';
                $postlist[$post['pid']] = $post;

        }

        if($vtonlinestatus == 2 && $onlineauthors) {
                $query = $db->query("SELECT uid FROM {$tablepre}sessions WHERE uid IN(".(implode(',', $onlineauthors)).") AND invisible=0");
                $onlineauthors = array();
                while($author = $db->fetch_array($query)) {
                        $onlineauthors[$author['uid']] = 1;
                }
        } else {
                $onlineauthors = array();
        }
        if($ratelogpids) {
                $query = $db->query("SELECT * FROM {$tablepre}ratelog WHERE pid IN ($ratelogpids) ORDER BY dateline DESC");
                while($ratelog = $db->fetch_array($query)) {
                        if(count($postlist[$ratelog['pid']]['ratelog']) < $ratelogrecord) {
                                $ratelog['dateline'] = gmdate("$dateformat $timeformat", $ratelog['dateline'] + $timeoffset * 3600);
                                $ratelog['score'] = $ratelog['score'] > 0 ? '+'.$ratelog['score'] : $ratelog['score'];
                                $ratelog['reason'] = dhtmlspecialchars($ratelog['reason']);
                                $postlist[$ratelog['pid']]['ratelog'][] = $ratelog;
                        }
                }
        }

        if($attachpids) {
                require_once DISCUZ_ROOT.'./include/attachment.func.php';
                parseattach($attachpids, $attachtags, $postlist, $showimages);
        }

        if(empty($postlist)) {
                showmessage('undefined_action', NULL, 'HALTED');
        }

        $relatedthreadlist = array();
        $relatedthreadupdate = FALSE;
        if(!empty($qihoo_status) && $qihoo_relatedthreads && $qihoo_searchbox) {
                $site = site();
                $relatedkeywords = $metakeywords = '';
                $query = $db->query("SELECT expiration, keywords, relatedthreads FROM {$tablepre}relatedthreads WHERE tid='$tid'");
                $related = $db->fetch_array($query);
                if($related['expiration'] > $timestamp) {
                        $relatedthreadlist = unserialize($related['relatedthreads']);
                        if($related['keywords']) {
                                $searchkeywords = rawurlencode(str_replace("\t", ' ', $related['keywords']));
                                foreach(explode("\t", $related['keywords']) as $keyword) {
                                        $relatedkeywords .= $keyword ? '<a href="search.php?srchtype=qihoo&srchtxt='.rawurlencode($keyword).'&searchsubmit=yes" target="_blank"><span class="bold"><font color=red>'.$keyword.'</font></span></a> ' : '';
                                        $metakeywords .= $keyword ? $keyword.',' : '';
                                }
                        }
                } else {
                        $relatedthreadupdate = TRUE;
                        $verifykey = md5($authkey.$tid.$thread['subjectenc'].$charset.$site);
                }
        }
        $relatedthreads = array();
        if(!empty($relatedthreadlist)) {
                if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'relatedthreads') === FALSE) {
                        $relatedthreads['img'] = 'collapsed_no.gif';
                        $relatedthreads['style'] = '';
                } else {
                        $relatedthreads['img'] = 'collapsed_yes.gif';
                        $relatedthreads['style'] = 'display: none';
                }
        }

        $visitedforums = $visitedforums ? visitedforums() : '';
        $forumselect = $forummenu = $smmultipage = '';
        if($fastpost && $allowpost && $_DCACHE['smiliesnum'] > $smcols * $smrows) {
                $smpage = max(1, intval($_COOKIE['smpage']));
                $smmultipage = multi($_DCACHE['smiliesnum'], $smcols * $smrows, 1, '###', 0, 4, 1, 'getSmilies');
        }
        if($forumjump && empty($jsmenu[1])) {
                $forumselect = forumselect();
        }

        $usesigcheck = $discuz_uid && $sigstatus ? 'checked' : '';
        $allowpostreply = ((!$thread['closed'] && !checkautoclose()) || $forum['ismoderator']) && ((!$forum['replyperm'] && $allowreply) || ($forum['replyperm'] && forumperm($forum['replyperm'])) || $forum['allowreply']);
        $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])) || $forum['allowpost'];

        if($allowpost) {
                $allowpostpoll = $allowpostpoll && ($forum['allowpostspecial'] & 1);
                $allowposttrade = $allowposttrade && ($forum['allowpostspecial'] & 2);
                $allowpostreward = $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]);
                $allowpostactivity = $allowpostactivity && ($forum['allowpostspecial'] & 8);
        } else {
                $allowpostpoll = $allowposttrade = $allowpostreward = $allowpostactivity = FALSE;
        }

        $supe_pushstatusadd = '';
        if($supe['status'] && $supe_allowpushthread && $forum['supe_pushsetting']['status'] == 3) {
                if(($thread['views'] && $forum['supe_pushsetting']['filter']['views'] && $thread['views'] >= intval($forum['supe_pushsetting']['filter']['views'])) ||
                        ($thread['replies'] && $forum['supe_pushsetting']['filter']['replies'] && $thread['replies'] >= intval($forum['supe_pushsetting']['filter']['replies'])) ||
                        ($thread['digest'] && $forum['supe_pushsetting']['filter']['digest'] && $thread['digest'] >= intval($forum['supe_pushsetting']['filter']['digest'])) ||
                        ($thread['displayorder'] && $forum['supe_pushsetting']['filter']['displayorder'] && $thread['displayorder'] >= intval($forum['supe_pushsetting']['filter']['displayorder']))) {
                        if($thread['supe_pushstatus'] == 0) {
                                $supe_pushstatusadd = ", supe_pushstatus='3'";
                        }
                } elseif($thread['supe_pushstatus'] == 3) {
                        $supe_pushstatusadd = ", supe_pushstatus='0'";
                }
        }

        viewthread_updateviews();

        $forumselect = $forummenu = '';
        if($forumjump) {
                if($jsmenu[1]) {
                        $forummenu = forumselect(FALSE, 1);
                } else {
                        $forumselect = forumselect();
                }
        }

        include template($iscircle ? 'supesite_viewthread' : 'viewthread');

} elseif($action == 'printable' && $tid) {

        if(ISROBOT) {
                exit(dheader("HTTP/1.1 403 Forbidden"));
        }
        require_once DISCUZ_ROOT.'./include/printable.inc.php';

}

function viewthread_updateviews() {
        global $delayviewcount, $supe_pushstatusadd, $timestamp, $tablepre, $tid, $db, $adminid;

        if(($delayviewcount == 1 || $delayviewcount == 3) && !$supe_pushstatusadd) {
                $logfile = './forumdata/cache/cache_threadviews.log';
                if(substr($timestamp, -2) == '00') {
                        require_once DISCUZ_ROOT.'./include/misc.func.php';
                        updateviews('threads', 'tid', 'views', $logfile);
                }
                if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
                        fwrite($fp, "$tid\n");
                        fclose($fp);
                } elseif($adminid == 1) {
                        showmessage('view_log_invalid');
                }
        } else {

                $db->query("UPDATE {$tablepre}threads SET views=views+1 $supe_pushstatusadd WHERE tid='$tid'", 'UNBUFFERED');
        }
        unset($supe_pushstatusadd);
}

?>


修改好了,拿去吧!

[ 本帖最后由 HPotter 于 2007-3-25 18:08 编辑 ]
回复

使用道具 举报

itotti 发表于 2007-3-25 20:00:46 | 显示全部楼层
这样就可以了lz???
回复

使用道具 举报

 楼主| HPotter 发表于 2007-3-25 20:13:18 | 显示全部楼层

回复 #74 itotti 的帖子

恩,修改过的地方我已经红色注明了!
回复

使用道具 举报

ApLinD 发表于 2007-3-25 22:14:22 | 显示全部楼层
这个支持....
回复

使用道具 举报

dgcr007 发表于 2007-3-25 22:26:18 | 显示全部楼层
:确实不错!呵~~好象[DST]也有出类似的猪头卡,但功能没有LZ的这么细致了,呵~~
回复

使用道具 举报

tanwill 发表于 2007-3-25 22:42:05 | 显示全部楼层
1. 诅咒时间好像只有1个小时....可以增加为 1天吗?

2. 修改viewpro.php   > 找不到   > s.lastactivity as online $oltimeadd1
回复

使用道具 举报

ApLinD 发表于 2007-3-26 00:56:26 | 显示全部楼层
希望楼主可以增加我这个代码.....
如果大家有安装虚拟形象想必一定烦恼怎么添加代码吧...
毕竟如果将虚拟形象的代码往诅咒的代码下移也是不能显示你被诅咒的(有使用虚拟形象的会员)...
如楼主所示...

viewthread.php

  1.    if($showavatars) {
  2.     if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
  3.      $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
  4.     } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
  5.      $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';
  6.     } else {
  7.      $post['avatar'] = '';
  8.     }
  9.    }
复制代码

修改为
  1.    if(($post['overtime'] > $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) && ($post['status']&1)==1) {
  2.     $post['avatar'] = '被诅咒中...<br><img src="images/pig/'.$post['type'].'.gif" border="0" alt="我是猪头" /><br>恢复时间:'.gmdate('Y-n-d H:i',$post['overtime']);
  3.    }else{
  4.    if($showavatars) {
  5.     if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
  6.      $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
  7.     } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
  8.      $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';
  9.     } else {
  10.      $post['avatar'] = '';
  11.     }
  12.    }
  13.   }
复制代码

这一段的步骤....

如果有添加虚拟形象的代码的话...
应该装不了吧...
呵呵~~
我自己是装不到啦...
因为代码会出现冲突...
如果要在安装有虚拟形象下出现诅咒的猪样
就将虚拟形象的代码放进诅咒术的代码中...
如下
   if(($post['overtime'] > $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) && ($post['status']&1)==1) {
    $post['avatar'] = '被诅咒中...<br><img src="images/pig/'.$post['type'].'.gif" border="0" alt="我是猪头" /><br>恢复时间:'.gmdate('Y-n-d H:i',$post['overtime']);
   }else{
   if($showavatars) {
    if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
     $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
    } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
     $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';//------------------------------------------------------------virtualimage
                if ($imagesset['orderuse']!='1' && $post['useimages']!=1){
                $post['avatar'] = $post['avatar'];
                }elseif($post['gender']=='0'){
                if($imagesset['orderuse']=='1'){
                $post['avatar'] = "<img src='{$imagesset[imageurl]}noface.gif'  border='0'>";
                }else{
                $post['avatar'] = $post['avatar'];
                        }
                }else{
                if ($post[gender]==1){
                $imagesdata[tempequip] = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //male initial
                $imagesdata[sex] = "m";
                $imagesdata[upid] = "init";
                }else if ($post[gender]==2){
                $imagesdata[tempequip] = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //female initial
                $imagesdata[sex] = "f";
                $imagesdata[upid] = "initf";
                        }
                $imagesdata[pid] = $post[pid];
                  $imagesdata[uid] = $post[uid];
                $imagesdatas[] = $imagesdata;
                $post['avatar'] = "
                <!-- virtualimage start-->
                <div id=Show{$post['pid']}
                style=\"padding-right: 0px; padding-left: 0px; left: 0px; padding-bottom: 0px; width: 140px; padding-top: 0px; position: relative; top: 0px; height: 226px\"></div>
                <!-- virtualimage end-->";
                }
//--------------------------------------------------------------

    } else {
     $post['avatar'] = '';
    }
   }
  }

红色的部分是虚拟形象的代码....
只要添加过后就可以连开启了虚拟形象的会员也显示诅咒的猪样了....
希望对大家有帮助...

(大家应该明白我说什么吧?)

=-=--=-=总结论=-=-=-=-=-=-=-
如果有安装虚拟形象的会员....
viewthread.php

  1. if($showavatars) {
  2.     if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
  3.      $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
  4.     } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
  5.      $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';
  6.     } else {
  7.      $post['avatar'] = '';
  8.     }
  9.    }
复制代码

改为
  1.    if(($post['overtime'] > $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) && ($post['status']&1)==1) {
  2.     $post['avatar'] = '被诅咒中...<br><img src="images/pig/'.$post['type'].'.gif" border="0" alt="我是猪头" /><br>恢复时间:'.gmdate('Y-n-d H:i',$post['overtime']);
  3.    }else{
  4.    if($showavatars) {
  5.     if($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
  6.      $post['avatar'] = '<img src="'.$_DCACHE['usergroups'][$post['groupid']]['groupavatar'].'" border="0" alt="" />';
  7.     } elseif($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
  8.      $post['avatar'] = '<div class="avatar" style="width: '.$post['avatarwidth'].'"><img src="'.$post['avatar'].'" width="'.$post['avatarwidth'].'" height="'.$post['avatarheight'].'" border="0" alt="" /></div>';//------------------------------------------------------------virtualimage
  9.                 if ($imagesset['orderuse']!='1' && $post['useimages']!=1){
  10.                 $post['avatar'] = $post['avatar'];
  11.                 }elseif($post['gender']=='0'){
  12.                 if($imagesset['orderuse']=='1'){
  13.                 $post['avatar'] = "<img src='{$imagesset[imageurl]}noface.gif'  border='0'>";
  14.                 }else{
  15.                 $post['avatar'] = $post['avatar'];
  16.                         }
  17.                 }else{
  18.                 if ($post[gender]==1){
  19.                 $imagesdata[tempequip] = '0-0-0-0-0-0-0-0-init-init-0-init-0-init-init-0-0-0-init-0-0-0-0-0-0-0';  //male initial
  20.                 $imagesdata[sex] = "m";
  21.                 $imagesdata[upid] = "init";
  22.                 }else if ($post[gender]==2){
  23.                 $imagesdata[tempequip] = '0-0-0-0-0-0-0-0-initf-initf-0-initf-0-initf-initf-0-0-0-initf-0-0-0-0-0-0-0'; //female initial
  24.                 $imagesdata[sex] = "f";
  25.                 $imagesdata[upid] = "initf";
  26.                         }
  27.                 $imagesdata[pid] = $post[pid];
  28.                   $imagesdata[uid] = $post[uid];
  29.                 $imagesdatas[] = $imagesdata;
  30.                 $post['avatar'] = "
  31.                 <!-- virtualimage start-->
  32.                 <div id=Show{$post['pid']}
  33.                 style="padding-right: 0px; padding-left: 0px; left: 0px; padding-bottom: 0px; width: 140px; padding-top: 0px; position: relative; top: 0px; height: 226px"></div>
  34.                 <!-- virtualimage end-->";
  35.                 }
  36. //--------------------------------------------------------------
  37.     } else {
  38.      $post['avatar'] = '';
  39.     }
  40.    }
  41.   }
复制代码

[ 本帖最后由 ApLinD 于 2007-3-26 01:48 编辑 ]
回复

使用道具 举报

Rockoy 发表于 2007-3-26 02:24:14 | 显示全部楼层
这个和当年的垃圾腾讯的“QQ秀整人”有什么区别?

本人不是很看好,因为这个插件里有垃圾腾讯的影子!
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-28 03:07 , Processed in 0.135295 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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