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

<table width=100% cellpadding=0 cellspacing=0> 
	<tr height='5'><td></td></tr>
	<tr> 
		<td width='100%' valign=top align=center> 
		<? 
		$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * $hours)); 

		$sql = " select bo_subject, bo_table 
		from $g4[board_table] 
		where bo_use_search = '1' 
		order by bo_order_search "; 
		$result = sql_query($sql); 

		while ($row = mysql_fetch_array($result)) { 

		// 게시판 제외
		if($row[bo_table]==""){} 
		else{ 

		$tbl = "{$g4[write_prefix]}{$row[bo_table]}"; 
		$sql2 = " select wr_id, 
		wr_parent, 
		mb_id, 
		wr_name, 
		wr_email, 
		wr_homepage, 
		wr_num, 
		wr_subject, 
		wr_is_comment, 
		wr_comment, 
		wr_datetime, 
		wr_hit 
		from $tbl 
		where wr_datetime >= '$intime' 
		and wr_is_comment = '0' 
		order by wr_datetime desc "; 

		$result2 = sql_query($sql2); 

		for ($i = 0; $row2 = mysql_fetch_array($result2); $i++) { 

		$wr_subject = get_text($row2[wr_subject]); 

		$key = $row2[wr_datetime] . $row[bo_table] . $row2[wr_id]; 
		$list[$key]->bo_subject = $row[bo_subject]; 
		$list[$key]->bo_table = $row[bo_table]; 
		$list[$key]->mb_id = $row2[mb_id]; 
		$list[$key]->mb_open = $row2[mb_open]; 
		$list[$key]->wr_id = $row2[wr_id]; 
		$list[$key]->wr_parent = $row2[wr_parent]; 
		$list[$key]->wr_email = $row2[wr_email]; 
		$list[$key]->wr_homepage = $row2[wr_homepage]; 
		$list[$key]->wr_name = get_text(cut_str($row2[wr_name],12)); 
		$list[$key]->wr_subject = get_text(cut_str($wr_subject,70,'…')); 
		$list[$key]->wr_is_comment = $row2[wr_is_comment]; 
		$list[$key]->wr_comment = $row2[wr_comment]; 
		$list[$key]->wr_datetime = $row2[wr_datetime]; 
		$list[$key]->wr_hit = $row2[wr_hit]; 
		} 
			mysql_free_result($result2); 
		} 
		} 
		mysql_free_result($result); 
		?> 
					  

		<table width=100% border=0 cellspacing=0 cellpadding=0 align=center> 
			<? 
			if (count($list) > 0) { 
				$p=-1; 
				krsort($list); 
				foreach ($list as $key=>$value) { 
			if(time()-(60*60*24) <= strtotime($list[$i][wr_datetime])) $list[$i][date] = date('H:i',strtotime($list[$i][wr_datetime])); 
			else $list[$i][date] = date('Y.m.d',strtotime($list[$i][wr_datetime])); 

				  $p++; 
				  if ($p >= $rows) break; 

			$wr_commentcnt = ""; 
			if ($value->wr_comment > 0) { 
			$wr_commentcnt = "<font size=-2>({$value->wr_comment})</font>"; 
			} 

			$name = get_sideview($value->mb_id, cut_str($value->wr_name,12), $value->wr_email, $value->wr_homepage); 
			$value->bo_subject = cut_str($value->bo_subject, 20); 

			echo "<tr><td width=100%>"; 
			echo "<table width=100% border=0 cellspacing=0 cellpadding=0 align=center>"; 
			echo "<tr height='25'>"; 
			//echo "<td width=125 align=left class=cOrange>{$value->wr_datetime}</td>"; 
			//echo "<td width=125 align=left class=cOrange>".substr($value->wr_datetime,5,6)."</td>"; //12-05 (월-일) 
			//echo "<td width=125 align=left class=cOrange>".substr($value->wr_datetime,2,5)."</td>"; //04-12 (년-월) 
			//echo "<td width=125 align=left class=cOrange>".substr($value->wr_datetime,2,8)."</td>"; //04-12-07 (년-월-일) 
			// echo "<td width=125 align=left class=cOrange>".substr($value->wr_datetime,2,14)."</td>"; //04-12-07 17:25 (년-월-일 시:분) 
			echo "<td width='' align=left><a href='$g4[path]/bbs/board.php?bo_table=".$value->bo_table."&wr_id=".$value->wr_parent."$atag_comment'>$comment{$value->wr_subject}</a> <span style='color:#f0761c;'>{$wr_commentcnt}</span> - <span class='small' style='color:#aaaaaa;'>".substr($value->wr_datetime,5,6)."</span></td>"; 
			echo "<td width=80 align=right class=small>{$value->wr_name}</td></tr>"; 
			echo "</table></td>"; 
			echo "</tr>"; 
			} 
		}
		?> 
		</table> 
		</td>
	</tr> 
</table>