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

📄 threads.inc.php

📁 论坛代码网增加免费空间业务
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php

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

	$Id: threads.inc.php 13614 2008-04-28 08:00:43Z liuqiang $
*/

if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
        exit('Access Denied');
}

require_once DISCUZ_ROOT.'./include/post.func.php';

cpheader();

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

if(!$operation) {

	require_once DISCUZ_ROOT.'./include/forum.func.php';

	$forumselect = '<select name="inforum"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option>'.
		'<option value="">&nbsp;</option>'.forumselect().'</select>';
	if(isset($inforum)) {
		$forumselect = preg_replace("/(\<option value=\"$inforum\")(\>)/", "\\1 selected=\"selected\" \\2", $forumselect);
	}

	$typeselect = '';
	$query = $db->query("SELECT * FROM {$tablepre}threadtypes ORDER BY displayorder");
	while($type = $db->fetch_array($query)) {
		$typeselect .= '<option value="'.$type['typeid'].'">&nbsp;&nbsp;> '.$type['name'].'</option>';
	}

	if(isset($intype)) {
		$typeselect = preg_replace("/(\<option value=\"$intype\")(\>)/", "\\1 selected=\"selected\" \\2", $typeselect);
	}

	echo <<<EOT
<script src="include/javascript/calendar.js"></script>
<script type="text/JavaScript">
	function page(number) {
		$('threadforum').page.value=number;
		$('threadforum').searchsubmit.click();
	}
</script>
EOT;
	shownav('topic', 'nav_maint_threads');
	showsubmenusteps('nav_maint_threads', array(
		array('threads_search', !$searchsubmit),
		array('nav_maint_threads', $searchsubmit)
	));
	showtips('threads_tips');
	showtagheader('div', 'threadsearch', !submitcheck('searchsubmit'));
	showformheader('threads', '', 'threadforum');
	showhiddenfields(array('page' => $page));
	showtableheader();
	showsetting('threads_search_detail', 'detail', $detail, 'radio');
	showsetting('threads_search_forum', '', '', $forumselect);
	showsetting('threads_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
	showsetting('threads_search_user', 'users', $users, 'text');
	showsetting('threads_search_keyword', 'keywords', $keywords, 'text');

	showtagheader('tbody', 'advanceoption');
	showsetting('threads_search_type', '', '', '<select name="intype"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option><option value="">&nbsp;</option><option value="0">&nbsp;&nbsp;> '.$lang['threads_search_type_none'].'</option>'.$typeselect.'</select>');
	showsetting('threads_search_viewrange', array('viewsmore', 'viewsless'), array($viewsmore, $viewsless), 'range');
	showsetting('threads_search_replyrange', array('repliesmore', 'repliesless'), array($repliesmore, $repliesless), 'range');
	showsetting('threads_search_readpermmore', 'readpermmore', $readpermmore, 'text');
	showsetting('threads_search_pricemore', 'pricemore', $pricemore, 'text');
	showsetting('threads_search_noreplyday', 'noreplydays', $noreplydays, 'text');
	showsetting('threads_search_type', array('specialthread', array(
		array(0, lang('unlimited'), array('showspecial' => 'none')),
		array(1, lang('threads_search_include_yes'), array('showspecial' => '')),
		array(2, lang('threads_search_include_no'), array('showspecial' => '')),
	), TRUE), $specialthread, 'mradio');
	showtablerow('id="showspecial" style="display:'.($specialthread ? '' : 'none').'"', 'class="sub" colspan="2"', mcheckbox('special', array(
		1 => lang('thread_poll'),
		2 => lang('thread_trade'),
		3 => lang('thread_reward'),
		4 => lang('thread_activity'),
		5 => lang('thread_debate'),
		6 => lang('thread_video')
	), $special ? $special : array(0)));
	showsetting('threads_search_sticky', array('sticky', array(
		array(0, lang('unlimited')),
		array(1, lang('threads_search_include_yes')),
		array(2, lang('threads_search_include_no')),
	), TRUE), $sticky, 'mradio');
	showsetting('threads_search_digest', array('digest', array(
		array(0, lang('unlimited')),
		array(1, lang('threads_search_include_yes')),
		array(2, lang('threads_search_include_no')),
	), TRUE), $digest, 'mradio');
	showsetting('threads_search_attach', array('attach', array(
		array(0, lang('unlimited')),
		array(1, lang('threads_search_include_yes')),
		array(2, lang('threads_search_include_no')),
	), TRUE), $attach, 'mradio');
	showsetting('threads_rate', array('rate', array(
		array(0, lang('unlimited')),
		array(1, lang('threads_search_include_yes')),
		array(2, lang('threads_search_include_no')),
	), TRUE), $rate, 'mradio');
	showsetting('threads_highlight', array('highlight', array(
		array(0, lang('unlimited')),
		array(1, lang('threads_search_include_yes')),
		array(2, lang('threads_search_include_no')),
	), TRUE), $highlight, 'mradio');
	showtagfooter('tbody');

	showsubmit('searchsubmit', 'submit', '', 'more_options');
	showtablefooter();
	showformfooter();
	showtagfooter('div');

	if(submitcheck('searchsubmit')) {

		$sql = '';
		$sql .= $inforum != '' && $inforum != 'all' ? " AND fid='$inforum'" : '';
		$sql .= $intype != '' && $intype != 'all' ? " AND typeid='$intype'" : '';
		$sql .= $viewsless != '' ? " AND views<'$viewsless'" : '';
		$sql .= $viewsmore != '' ? " AND views>'$viewsmore'" : '';
		$sql .= $repliesless != '' ? " AND replies<'$repliesless'" : '';
		$sql .= $repliesmore != '' ? " AND replies>'$repliesmore'" : '';
		$sql .= $readpermmore != '' ? " AND readperm>'$readpermmore'" : '';
		$sql .= $pricemore != '' ? " AND price>'$pricemore'" : '';
		$sql .= $beforedays != '' ? " AND dateline<'$timestamp'-'$beforedays'*86400" : '';
		$sql .= $noreplydays != '' ? " AND lastpost<'$timestamp'-'$noreplydays'*86400" : '';
		$sql .= $starttime != '' ? " AND dateline>'".strtotime($starttime)."'" : '';
		$sql .= $endtime != '' ? " AND dateline<='".strtotime($endtime)."'" : '';

		if(trim($keywords)) {
			$sqlkeywords = '';
			$or = '';
			$keywords = explode(',', str_replace(' ', '', $keywords));
			for($i = 0; $i < count($keywords); $i++) {
				$sqlkeywords .= " $or subject LIKE '%".$keywords[$i]."%'";
				$or = 'OR';
			}
			$sql .= " AND ($sqlkeywords)";
		}

		$sql .= trim($users) ? " AND author IN ('".str_replace(',', '\',\'', str_replace(' ', '', trim($users)))."')" : '';

		if($sticky == 1) {
			$sql .= " AND displayorder>'0'";
		} elseif($sticky == 2) {
			$sql .= " AND displayorder='0'";
		}
		if($digest == 1) {
			$sql .= " AND digest>'0'";
		} elseif($digest == 2) {
			$sql .= " AND digest='0'";
		}
		if($attach == 1) {
			$sql .= " AND attachment>'0'";
		} elseif($attach == 2) {
			$sql .= " AND attachment='0'";
		}
		if($rate == 1) {
			$sql .= " AND rate>'0'";
		} elseif($rate == 2) {
			$sql .= " AND rate='0'";
		}
		if($highlight == 1) {
			$sql .= " AND highlight>'0'";
		} elseif($highlight == 2) {
			$sql .= " AND highlight='0'";
		}
		if(!empty($special)) {
			$specials = $comma = '';
			foreach($special as $val) {
				$specials .= $comma.'\''.$val.'\'';
				$comma = ',';
			}
			if($specialthread == 1) {
				$sql .=  " AND special IN ($specials)";
			} elseif($specialthread == 2) {
				$sql .=  " AND special NOT IN ($specials)";
			}
		}

		$fids = array();
		$tids = $threadcount = '0';
		if($sql) {
			$sql = "digest>='0' AND displayorder>='0' $sql";
			if($detail) {
				$pagetmp = $page;
				do{
					$query = $db->query("SELECT fid, tid, readperm, price, subject, authorid, author, views, replies, lastpost FROM {$tablepre}threads WHERE $sql LIMIT ".(($pagetmp - 1) * $tpp).",$tpp");
					$pagetmp--;
				} while(!$db->num_rows($query) && $pagetmp);
				$threads = '';
				while($thread = $db->fetch_array($query)) {
					$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
					$threads .= showtablerow('', array('class="td25"', '', '', '', 'class="td25"', 'class="td25"'), array(
						"<input class=\"checkbox\" type=\"checkbox\" name=\"tidarray[]\" value=\"$thread[tid]\" checked />",
						"<a href=\"viewthread.php?tid=$thread[tid]\" target=\"_blank\">$thread[subject]</a>".($thread['readperm'] ? " - [$lang[threads_readperm] $thread[readperm]]" : '').($thread['price'] ? " - [$lang[threads_price] $thread[price]]" : ''),
						"<a href=\"forumdisplay.php?fid=$thread[fid]\" target=\"_blank\">{$_DCACHE[forums][$thread[fid]][name]}</a>",
						"<a href=\"space.php?uid=$thread[authorid]\" target=\"_blank\">$thread[author]</a>",
						$thread['replies'],
						$thread['views'],
						$thread['lastpost']
					), TRUE);
				}
				$threadcount = $db->result_first("SELECT count(*) FROM {$tablepre}threads WHERE $sql");
				$multi = multi($threadcount, $tpp, $page, "admincp.php?action=threads");
				$multi = preg_replace("/href=\"admincp.php\?action=threads&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
				$multi = str_replace("window.location='admincp.php?action=threads&amp;page='+this.value", "page(this.value)", $multi);

⌨️ 快捷键说明

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