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

include_once("$g4[path]/head.sub.php");
include_once("$g4[path]/lib/outlogin.lib.php");
include_once("$g4[path]/lib/poll.lib.php");
include_once("$g4[path]/lib/visit.lib.php");
include_once("$g4[path]/lib/connect.lib.php");
include_once("$g4[path]/lib/popular.lib.php");

//print_r2(get_defined_constants());
?>

<!-- 상단 로고 시작 -->
<table width="950" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td>
<a href="<?=$g4['path']?>"><img src="<?=$g4['path']?>/img/logo.gif" border="0"></a>
</td>
<? if (!$member['mb_id']) { ?>
            <!-- 로그인 이전 -->
            <td width="100"><a href="<?=$g4['bbs_path']?>/login.php?url=<?=$urlencode?>"><img src="<?=$g4['path']?>/img/login.gif" width="49" height="20" border="0"></a></td>
            <? } else { ?>
            <!-- 로그인 이후 -->
            <td width="100"><a href="<?=$g4['bbs_path']?>/logout.php"><img src="<?=$g4['path']?>/img/logout.gif" width="49" height="20" border="0"></a></td>
            <? } ?>
<td width="400" align="right">
						<table width='400' cellpadding='0' cellspacing='0' border='0' align='center'>
						<tr>
						<!-- 메인 상단 그룹 시작-->
						<?
								//접근가능그룹 여분필드 1 순서로 추출
								//조건외 제외시키고자 하는 그룹 수동으로 추가
								$excgr = "('00', '00', '00')"; // 00 , 00 , 00 그룹은 제외시킴
								$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_10, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0' and a.gr_id not in " . $excgr . " ORDER BY a.gr_admin";
								$result = sql_query($sql);
								for ($i=0; $row=sql_fetch_array($result); $i++){

								$gSubject = ($row['gr_id'] == $gr_id)?"<span style=''>" .$row['gr_subject']."</span>":"<span style=''>" .$row['gr_subject']."</span>";//그룹제목
								$gLink = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/board.php?bo_table='.'' .$row['gr_id'];//그룹링크 - 별도링크 필요하면 gr_10 필드에 전체 url 입력
								echo "<td><a href='" . $gLink . "' style='color:#000000;'><b>" . $gSubject . "</b></a></font></td><td>&nbsp;<font color='000000'>|</font>&nbsp;</td>"; // 그룹명 출력
								}
								?></tr></table>

</td>
</tr>
</table>

<!-- 상단 메뉴스킨 시작 -->
<table width="950" cellspacing="0" cellpadding="0" border="0" align="center" height="38">
<tr>
<td width="16" background="<?=$head_menu_skin_path?>/img/m_l.gif" height="38">
</td>
<td background="<?=$head_menu_skin_path?>/img/m_c.gif" width="918" height="38">
	<table cellpadding='0' cellspacing='0' border='0'>
						<tr>
						<!-- 메인 상단 그룹 시작-->
						<?
								//접근가능그룹 여분필드 1 순서로 추출
								//조건외 제외시키고자 하는 그룹 수동으로 추가
								$excgr = "('00', '00', '00')"; // 00 , 00 , 00 그룹은 제외시킴
								$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_10, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0' and a.gr_id not in " . $excgr . " ORDER BY a.gr_admin";
								$result = sql_query($sql);
								for ($i=0; $row=sql_fetch_array($result); $i++){

								$gSubject = ($row['gr_id'] == $gr_id)?"<span style=''>" .$row['gr_subject']."</span>":"<span style=''>" .$row['gr_subject']."</span>";//그룹제목
								$gLink = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/board.php?bo_table='.'' .$row['gr_id'];//그룹링크 - 별도링크 필요하면 gr_10 필드에 전체 url 입력
								echo "<td><a href='" . $gLink . "' style='color:#FFFFFF;'><b>" . $gSubject . "</b></a></font></td><td>&nbsp;<font color='FFFFFF'>|</font>&nbsp;</td>"; // 그룹명 출력
								}
								?></tr></table>					
</td>
<td width="16" background="<?=$head_menu_skin_path?>/img/m_r.gif" height="38">
</td>
</tr>

<tr>
<td width="16" height="32" background="<?=$head_menu_skin_path?>/img/s_left.gif">
</td><td width="918" height="32" background="<?=$head_menu_skin_path?>/img/s_center.gif">
<?
			$sql = " select * from $g4[board_table] 
            where gr_id = '$gr_id' and bo_list_level <= '$member[mb_level]' order by bo_table "; 
			$result = sql_query($sql); 
			$sub_cnt = mysql_num_rows($result) - 1;
			?>
			<table cellpadding='0' cellspacing='0' border='0'>
				<tr>
					<td width="5"></td>
					<td>
					<?for ($i=0; $row=sql_fetch_array($result); $i++) { 
						if($row[bo_table] == $bo_table) 
							$sub_menu = "<span style='color:#f0761c;font-weight:bold;'>".$row[bo_subject]."</span>";
						else
							$sub_menu = $row[bo_subject];

						if($i < ($sub_cnt)){
							$img = "<td align='center' style='padding: 0 3 3 3;'> | </td>";
						}else{
							$img ="";
						};
						
						echo "<td style='padding: 0 5 3 5;'><a href='".$g4[path]."/bbs/board.php?bo_table=".$row[bo_table]."'>".$sub_menu."</a></td>".$img."";
						
					}?>
					</td>
				</tr>
			</table>
</td>
<td width="16" height="32" background="<?=$head_menu_skin_path?>/img/s_right.gif">
</td></tr>
</table>
<!-- 상단 메뉴스킨 끝 -->
