<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

function day7_latest($skin_dir="", $gr_id, $rows=10, $subject_len=40, $options=""){
		global $g4;

		if ($skin_dir)
			$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
		else
			$latest_skin_path = "$g4[path]/skin/latest/basic";

		$list = array(); // 리스트 초기값 배열설정
		$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' ";

		$sql_common .= " and b.gr_id = '$gr_id'"; // 해당 그룹 전체글 불러오기 위한 옵션
		$sql_common .= " and a.wr_id = a.wr_parent"; // 댓글은 제외하기 위한 옵션
		$sql_order = " order by a.bn_id desc "; //정렬 설정

		$sql = " select count(*) as cnt {$sql_common} ";
		$row = sql_fetch($sql);

		$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id {$sql_common} {$sql_order} limit 0, $rows ";
		$result = sql_query($sql);
		for ($i=0; $row=sql_fetch_array($result); $i++) 
		{
			$tmp_write_table = $g4[write_prefix] . $row[bo_table];
			$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
			$list[$i] = get_list($row2, $row[bo_table], $latest_skin_path, $subject_len);
			$list[$i]['href'] = $g4[bbs_path]."/board.php?bo_table=".$row[bo_table]."&wr_id=".$row2[wr_id];
		}

		ob_start();
		include "{$latest_skin_path}/latest.skin.php";
		$content = ob_get_contents();
		ob_end_clean();

		return $content;
	}

?>