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

📄 pw_home.php

📁 PHPWind7_RC_UTF8 开源php论坛很不错的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		/**   默认配置   **/
		$config['nums']<1 && $config['nums'] = 10;
		if(!in_array($config['order'],array('hits','replies','dig'))){
			$config['order'] = 'replies';
		}
		$sql  = $config['time']>0 ? " AND t.postdate>".pwEscape($timestamp-86400*$config['time']) : '';

		$html = "<div id=\"hottopic\" class=\"remen\"><h5 class=\"h\">$title</h5><ul class=\"listB\">";
		$query = $db->query("SELECT t.tid,t.subject FROM pw_threads t LEFT JOIN pw_forums f ON t.fid=f.fid WHERE 1 $sql AND f.password='' AND f.allowvisit='' AND f.f_type<>'hidden' ORDER BY t.$config[order] LIMIT $config[nums]");
		while($rt = $db->fetch_array($query)){
			$html .= "<li><a href=\"read.php?tid=$rt[tid]\">$rt[subject]</a></li>";
		}
		$html .= "</ul></div>";
		$db->update("UPDATE pw_home SET ".pwSqlSingle(array('lastupdate'=>$timestamp,'cache'=>$html),false)."WHERE name='hottopic'");
	}

	function bbsinfo($name,$title,$config){//站点信息
		global $db,$imgpath,$timestamp;
		@include_once(D_P.'data/bbscache/olcache.php');
		$usertotal = $guestinbbs + $userinbbs;

		@extract($db->get_one("SELECT * FROM pw_bbsinfo WHERE id='1'"));
		@extract($db->get_one("SELECT SUM(tpost) AS tposts,SUM(topic) AS threads,SUM(article) AS posts FROM pw_forumdata"));
		$higholtime = get_date($higholtime);
		$html = "<div id=\"bbsinfo\"><h5 class=\"h\">$title </h5><div class=\"boxA\">".str_replace(array("\n",'{$totalmember}','{$newmember}','{$threads}','{$posts}','{$tposts}','{$yposts}','{$hposts}','{$usertotal}','{$userinbbs}','{$guestinbbs}','{$higholnum}','{$higholtime}'),array("<br />",$totalmember,$newmember,$threads,$posts,$tposts,$yposts,$hposts,$usertotal,$userinbbs, $guestinbbs,$higholnum,$higholtime),$config['info'])."</div></div><div class=\"c\"></div>";
		$db->update("UPDATE pw_home SET ".pwSqlSingle(array('lastupdate'=>$timestamp,'cache'=>$html),false)."WHERE name='bbsinfo'");
	}

	function forumsort($name,$title,$config){//版块排行榜
		global $db,$imgpath,$timestamp;

		/**   默认配置   **/
		$config['nums']<1 && $config['nums'] = 10;

		$i    = 1;
		$html = "<div id=\"forumsort\"><h5 class=\"h\">$title </h5><div class=\"boxA\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"paihang\"><tr class=\"tr2\"><td class=\"gray\">".getLangInfo('other','home_forums')."</td><td class=\"gray\">".getLangInfo('other','home_posts')."</td></tr>";

		$query  = $db->query("SELECT f.fid,f.name,fd.topic FROM pw_forumdata fd LEFT JOIN pw_forums f USING(fid) WHERE f.password='' AND f.allowvisit='' AND f.f_type<>'hidden' AND f.type<>'category' ORDER BY fd.topic DESC LIMIT $config[nums]");
		while($forums = $db->fetch_array($query)){
			$html .= "<tr><td>";
			$i<4 && $html .= '<span class="cl2">';
			$html .= ($i<10 ? '0' : '').$i.'.';
			$i<4 && $html .= '</span>';
			$forums['name']=strip_tags($forums['name']);
			$fname=substrs($forums['name'],10);
			$html .= "<a href=\"thread.php?fid=$forums[fid]\" title=\"$forums[name]\">$fname</a></td><td class=\"gray\">($forums[topic])</td></tr>";
			$i++;
		}
		$html .= "</table></div></div>";
		$db->update("UPDATE pw_home SET ".pwSqlSingle(array('lastupdate'=>$timestamp,'cache'=>$html),false)."WHERE name='forumsort'");
	}

	function newreply($name,$title,$config){//最新回复
		global $db,$imgpath,$timestamp;

		/**   默认配置   **/
		$config['nums']<1 && $config['nums'] = 15;

		$fids   = array('-99');
		$query  = $db->query("SELECT fid FROM pw_forums WHERE password='' AND allowvisit='' AND f_type<>'hidden'");
		while($rt = $db->fetch_array($query)){
			$fids[] = $rt['fid'];
		}
		$fids = pwImplode($fids);
		$sql  = $config['time']>0 ? " AND postdate>".pwEscape($timestamp-86400*$config['time']) : '';
		$html = "<div id=\"newreply\"><h5 class=\"h\">$title </h5><ul class=\"listC\">";

		$query  = $db->query("SELECT tid,subject,postdate FROM pw_threads WHERE fid IN($fids) AND topped<'1' $sql ORDER BY topped,lastpost DESC LIMIT $config[nums]");
		while($rt = $db->fetch_array($query)){
			$html .= "<li><em>".get_date($rt['postdate'],'m-d')."</em><a href=\"read.php?tid=$rt[tid]\" target=\"_blank\">$rt[subject]</a></li>";
		}
		$html .= "</ul></div>";
		$db->update("UPDATE pw_home SET ".pwSqlSingle(array('lastupdate'=>$timestamp,'cache'=>$html),false)."WHERE name='newreply'");
	}

	function newtopic($name,$title,$config){//最新发表帖子
		global $db,$imgpath,$timestamp,$windid,$groupid,$db_anonymousname;

		/**   默认配置   **/
		$config['nums']<1 && $config['nums'] = 15;

		$fids   = array('-99');
		$query  = $db->query("SELECT fid FROM pw_forums WHERE password='' AND allowvisit='' AND f_type<>'hidden'");
		while($rt = $db->fetch_array($query)){
			$fids[] = $rt['fid'];
		}
		$fids = pwImplode($fids);
		$html   = "<div><h5 class=\"h\">$title </h5><ul class=\"listD\">";

		$sql   = $config['time']>0 ? " AND postdate>".pwEscape($timestamp-86400*$config['time']) : '';
		$query = $db->query("SELECT tid,subject,author,authorid,postdate,anonymous FROM pw_threads WHERE fid IN($fids) $sql ORDER BY postdate DESC LIMIT $config[nums]");
		while($rt = $db->fetch_array($query)){
			if ($rt['anonymous']) {
				$rt['author'] = $db_anonymousname;
				$rt['authorid'] = 0;
			}
			$html .= "<li><em><cite><a class=\"gray\" href=\"u.php?action=show&uid=$rt[authorid]\">$rt[author]</a></cite>".get_date($rt['postdate'],'m-d')."</em><a href=\"read.php?tid=$rt[tid]\">$rt[subject]</a></li>";
		}
		$html .= "</ul></div>";
		$db->update("UPDATE pw_home SET lastupdate='$timestamp',cache='$html' WHERE name='newtopic'");
	}

	function usersort($name,$title,$config){//会员帖子排行榜
		global $db,$imgpath,$timestamp;

		/**   默认配置   **/
		$config['nums']<1 && $config['nums'] = 10;
		if(!in_array($config['order'],array('postnum','rvrc','money'))){
			$config['order'] = 'postnum';
		}

		$i    = 1;
		$html = "<div id=\"usersort\"><h5 class=\"h\">$title </h5><div class=\"boxA\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"paihang\"><tr class=\"tr2\"><td class=\"gray\">".getLangInfo('other','home_user')."</td><td class=\"gray\">".getLangInfo('other','home_'.$config['order'])."</td></tr>";

		$query = $db->query("SELECT m.uid,m.username,md.$config[order] FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) ORDER BY md.$config[order] DESC LIMIT $config[nums]");
		while($men = $db->fetch_array($query)){
			$config['order'] == 'rvrc' && $men[$config['order']] = floor($men[$config['order']]/10);
			$html .= "<tr><td>";
			$i<4 && $html .= '<span class="cl2">';
			$html .= ($i<10 ? '0' : '').$i.'.';
			$i<4 && $html .= '</span>';
			$html .= "<a href=\"u.php?action=show&uid=$men[uid]\">$men[username]</a></td><td class=\"gray\">({$men[$config[order]]})</td></tr>";
			$i++;
		}
		$html .= "</table></div></div>";
		$db->update("UPDATE pw_home SET ".pwSqlSingle(array('lastupdate'=>$timestamp,'cache'=>$html),false)."WHERE name='usersort'");
	}

	function forums($name,$title,$config){//版块信息调用
		global $db,$imgpath,$timestamp;

		/**   默认配置   **/
		$config['nums']<1 && $config['nums'] = 10;
		!$config['pic'] && $config['pic'] = "hack/home/image/none.bmp";
		$fid = substr($name,7);

		$sql   = $config['time']>0 ? " AND postdate>".pwEscape($timestamp-86400*$config['time']) : '';
		$read  = array();
		$query = $db->query("SELECT tid,subject,postdate FROM pw_threads WHERE fid=".pwEscape($fid).$sql." ORDER BY postdate DESC LIMIT $config[nums]");
		while($rt = $db->fetch_array($query)){
			$read[] = $rt;
		}
		$readone = $read[0];
		unset($read[0]);
		$pw_tmsgs = GetTtable($readone['tid']);
		$rs = $db->get_one("SELECT content FROM $pw_tmsgs WHERE tid=".pwEscape($readone['tid'],false));
		$readone['content'] = substrs(strip_tags($rs['content']),60);
		$html = "<div id=\"forums_$fid\"><h5 class=\"h\"><a href=\"thread.php?fid=$fid\" class=\"fr fn cl4\"> ".getLangInfo('other','home_more')."</a>{$title}</h5><dl class=\"dlB\"><dd class=\"pic\"><img src=\"$config[pic]\" /></dd><dt class=\"b\"><a href=\"read.php?tid=$readone[tid]\" class=\"cl3\">$readone[subject]</a></dt><dd class=\"txt\">$readone[content]<div class=\"tar\"><a href=\"read.php?tid=$readone[tid]\">(".getLangInfo('other','home_detail').")</a></div></dd></dl><div class=\"c\"></div><ul class=\"listC listE\">";

		foreach($read as $key=>$value){
			$html .= "<li><em>".get_date($value['postdate'],'m-d')."</em><a href=\"read.php?tid=$value[tid]\" target=\"_blank\">$value[subject]</a></li>";
		}
		$html .= "</ul></div>";
		$db->update("UPDATE pw_home SET ".pwSqlSingle(array('lastupdate'=>$timestamp,'cache'=>$html),false)."WHERE name=".pwEscape($name));
	}

	function checktids($tids){
		$t = '';
		$s = explode(',',$tids);
		foreach($s as $v){
			is_numeric($v) && $t .= $t ? ','.$v : $v;
		}
		return $t;
	}
}
?>

⌨️ 快捷键说明

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