
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
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");

// $board[shop]; 
  $mct     =  "  po_poll1 = 'skin'  ";  
  $mct    .=  " and po_poll2 = '$url' "; 
  $site_bill = sql_fetch("select * from $board[shop] where  $mct");

  if(!$out_row)
    $set_skin = 'basic';

  $colspan = 2;

?>



<table width=100% cellpadding=0 cellspacing=1>
<tr><td colspan='<?=$colspan?>' class='line1'></td></tr>

<form action="<?=$shop_path?>/skin.update.php?act=<?=$url?>" method=post enctype="multipart/form-data">

<input type=hidden name=po_poll1   value="skin">

<tr><td colspan='<?=$colspan?>' style='padding-left:10px; height:30px;'><b><?=$url?></b></td></tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>스킨선택</td>
    <td style='padding-left:10px;'><select name="po_poll3" value="<?=$site_bill[po_poll3]?>" >
<?
$skin_path  = "../skin";
$skin_path .= "/$url/";  // 목록스킨을 지정합니다.
$arr = shop_file("$skin_path");
for ($k=0; $k<count($arr); $k++){
   $option = $arr[$k];
   if (strlen($option) > 10)
   $option = substr($arr[$k], 0, 25) . "";
   echo '<option value="';
   echo $arr[$k];
   echo '"';
   if ($arr[$k] == $site_bill[po_poll3])
   echo 'selected';
   echo '>';
   echo  $option;
   echo "\n"; 
   }  
?>    
</select>
</td></tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>이미지1</td>
    <td style='padding-left:10px;'>
        <input type=file name=po_poll19 class=ed size=60>
        <?
        if ($site_bill[po_poll19])
            echo "<br><a href='$g4[path]/data/file/index/$site_bill[po_poll19]' target='_blank'>$site_bill[po_poll19]</a> <input type=checkbox name='index_menu_del' value='$site_bill[po_poll19]'> 삭제";
        ?>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>이미지2</td>
    <td style='padding-left:10px;'>
        <input type=file name=po_poll18 class=ed size=60>
        <?
        if ($site_bill[po_poll18])
            echo "<br><a href='$g4[path]/data/file/index/$site_bill[po_poll18]' target='_blank'>$site_bill[po_poll18]</a> <input type=checkbox name='index_menu_del2' value='$site_bill[po_poll18]'> 삭제";
        ?>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;' valign="top"><input type=text class=ed name='po_poll14' value='<?=$site_bill[po_poll4]?>' title='여분필드 po_poll14 제목' style='text-align:right;font-weight:bold;'></td>
    <td style='padding-left:10px;'>
     <textarea class=ed name=po_poll4 rows=7 style='width:80%;' title='여분필드 po_poll4 설정값'><?=$site_bill["po_poll4"] ?></textarea>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'><input type=text class=ed name='po_poll15' value='<?=$site_bill[po_poll5]?>' title='여분필드 po_poll15 제목' style='text-align:right;font-weight:bold;'></td>
    <td style='padding-left:10px;'>
     <input type=text class=ed style='width:80%;' name='po_poll5' value='<?=$site_bill[po_poll5]?>' title='여분필드 po_poll5 설정값'>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'><input type=text class=ed name='po_poll15' value='<?=$site_bill[po_poll6]?>' title='여분필드 po_poll16 제목' style='text-align:right;font-weight:bold;'></td>
    <td style='padding-left:10px;'>
     <input type=text class=ed style='width:80%;' name='po_poll6' value='<?=$site_bill[po_poll6]?>' title='여분필드 po_poll6 설정값'>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'><input type=text class=ed name='po_poll17' value='<?=$site_bill[po_poll7]?>' title='여분필드 po_poll17 제목' style='text-align:right;font-weight:bold;'></td>
    <td style='padding-left:10px;'>
     <input type=text class=ed style='width:80%;' name='po_poll7' value='<?=$site_bill[po_poll7]?>' title='여분필드 po_poll7 설정값'>
    </td>
</tr>
<tr><td colspan='<?=$colspan?>' height="15"></td></tr>
<tr><td colspan='<?=$colspan?>' align="center"><input type="submit" name="formbutton1" value="확인"></td></tr>
<tr><td colspan='<?=$colspan?>' height="15"></td></tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<tr><td colspan='<?=$colspan?>' height="15"></td></tr>
</form>
</table>

<table width=100% cellpadding=0 cellspacing=1>
<tr><td colspan='<?=$colspan?>' align='center'>
*하단위 실재 링크연결은 해당페이지에서...
<?
$gnu_path = "../bbs";
$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' ";
if ($gr_id)
    $sql_common .= " and b.gr_id = '$gr_id' ";
if ($view == "w")
    $sql_common .= " and a.wr_id = a.wr_parent ";
else if ($view == "c")
    $sql_common .= " and a.wr_id <> a.wr_parent ";
if ($mb_id)
    $sql_common .= " and a.mb_id = '$mb_id' ";
$sql_order = " order by a.bn_id desc ";

$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];

$rows = $config[cf_new_rows];
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함

$group_select = "<select name=gr_id id=gr_id onchange='select_change();'><option value=''>전체그룹";
$sql = " select gr_id, gr_subject from $g4[group_table] order by gr_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) 
{
    $group_select .= "<option value='$row[gr_id]'>$row[gr_subject]";
}
$group_select .= "</select>";


$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
          $sql_common
          $sql_order
          limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) 
{
    $tmp_write_table = $g4[write_prefix] . $row[bo_table];

    if ($row[wr_id] == $row[wr_parent]) // 원글
    {
        $comment = "";
        $comment_link = "";
        $row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
        $list[$i] = $row2;

        $name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
        // 당일인 경우 시간으로 표시함
        $datetime = substr($row2[wr_datetime],0,10);
        $datetime2 = $row2[wr_datetime];
        if ($datetime == $g4[time_ymd])
            $datetime2 = substr($datetime2,11,5);
        else
            $datetime2 = substr($datetime2,5,5);

    }
    else // 코멘트
    {
        $comment = "[코] ";
        $comment_link = "#c_{$row[wr_id]}";
        $row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
        $row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from $tmp_write_table where wr_id = '$row[wr_id]' ");
        $list[$i] = $row2;
        $list[$i][mb_id] = $row3[mb_id];
        $list[$i][wr_name] = $row3[wr_name];
        $list[$i][wr_email] = $row3[wr_email];
        $list[$i][wr_homepage] = $row3[wr_homepage];

        $name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
        // 당일인 경우 시간으로 표시함
        $datetime = substr($row3[wr_datetime],0,10);
        $datetime2 = $row3[wr_datetime];
        if ($datetime == $g4[time_ymd])
            $datetime2 = substr($datetime2,11,5);
        else
            $datetime2 = substr($datetime2,5,5);
    }

    $list[$i][gr_id] = $row[gr_id];
    $list[$i][bo_table] = $row[bo_table];
    $list[$i][name] = $name;
    $list[$i][comment] = $comment;
    $list[$i][href] = "$gnu_path/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
    $list[$i][datetime] = $datetime;
    $list[$i][datetime2] = $datetime2;

    $list[$i][gr_subject] = $row[gr_subject];
    $list[$i][bo_subject] = $row[bo_subject];
    $list[$i][wr_subject] = $row2[wr_subject];
}

$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&view=$view&mb_id=$mb_id&page=");

$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";

echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";


include_once("$skin_path/$site_bill[po_poll3]/new.skin.php");

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

