⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewthread.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		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);
		$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($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'] = '';
				}
			}

		} 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']);
		$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;
	$relatedkeywords = $metakeywords = '';
	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&amp;srchtxt='.rawurlencode($keyword).'&amp;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);
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -