<?php


function listNoticeTitle($num=10,$id=false,$type=false){
	global $db_tablepre;
	$str = '';
	$type && $sql_add = " n LEFT JOIN ".$db_tablepre."user u ON n.n_uid=u.u_id ";
	$id ? $sql_add .= " WHERE  n_id=".$id : $sql_add .= "  order by n_uptimes desc limit ".$num;
	$sql = "SELECT *  FROM ".$db_tablepre."notice ".$sql_add;
	$result = sql_return($sql);
	while ($row = sql_return($result,'FetchRow')) {
		if (!$type) $str .= '    ◎ <a href="notice.php?id='.$row['n_id'].'"  target="_blank">'.$row['n_title'].date("Y-m-d H:i",$row['n_uptimes']).'</a>   ';
		else $str .= '<div id="content_title">'.$row['n_title'].'</div>
<div id="contents_table"><div align="center">发布:'.$row['u_name_2'].' &nbsp;&nbsp;&nbsp;
发布时间:'.date("Y-m-d H:i:s",$row['n_uptimes']).' </div>
</br>
</br>'.$row['n_content'].'</div><hr />';

	}

	return $str;
}


function list_footerLink($num=20,$type=1){
	global $db_tablepre;
	switch ($type){
		case 1:
			$sql = ' AND l_img_true=0 ';
			break;
		case 2:
			$sql = ' AND l_img_true=1 ';
			break;
	}
	$sql = 'SELECT *  FROM '.$db_tablepre.'link  WHERE l_review=1'.$sql.'  order by l_sort asc limit '.$num;
	$result = sql_return($sql);

	while ($row = sql_return($result,'FetchRow')) {
		if ($type==3){
			strpos($row['l_url'], '://') ? $http_per = '' :  $http_per = 'http://';
			if ($row['l_img_true'] == 0) {
				$str_1 .= '<li> <a href="'.$http_per.$row['l_url'].'"  target="_blank">'.$row['l_title'].'</a></li>';
			}
			else {
				$str_2 .= '<li> <a href="'.$http_per.$row['l_url'].'"  target="_blank"><img src="'.$row['l_img_url'].'" width="88" hight="31" /></a></li>';
			}
		}
		elseif ($type==2) $str .= '<li> <a href="'.$http_per.$row['l_url'].'"  target="_blank"><img src="'.$row['l_img_url'].'" width="88" hight="31" /></a></li>';

		else $str .= '<li> <a href="'.$http_per.$row['l_url'].'"  target="_blank">'.$row['l_title'].'</a></li>';


	}

	if ($type==3) $str = '<div id="link_content"><ul>'.$str_1.'</ul></div>'.'<div id="link_content"><ul>'.$str_2.'</ul></div>';
	else $str = '<div id="link_content"><ul>'.$str.'</ul></div>';
	
	
	return $str;
}
?>