<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<script>
// 글자수 제한
var char_min = parseInt(<?php echo $comment_min ?>); // 최소
var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</script>
<h3 class="comment_num">댓글(<?php echo number_format($view['wr_comment']) ?>)</h3>
<!-- 댓글 시작 { -->
<section id="bo_vc">
<!-- 댓글 페이징을 위해 추가 [시작] -->
<?php if(!$c_rows) $c_rows = 5; ?> // 표시댓글수가 지정되지 않았을경우 기본값 20
<div>
<h2>댓글목록</h2>
<div align='right'>
<form method = "post" action = "./board.php?bo_table=<?php echo $bo_table ?>&wr_id=<?php echo $wr_id?>">
표시댓글수<input type = "number" value="<?php echo $c_rows ?>" name = "c_rows" style="width:50px;">
<input type = "submit" value = "설정">
</form>
</div>
</div>
<?php // 코멘트 번호 계산식 및 페이징 표시
$c_total_count = count($list); // 전체 코멘트 수 할당 // 보여줄 개수
if ($c_total_count != 0){
$c_total_page = ceil($c_total_count / $c_rows); // 전체 페이지 계산
if (!$c_page) $c_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$c_from_record = ($c_page - 1) * $c_rows; // 시작 코멘트 구하기
$c_last_record = $c_from_record + $c_rows; // 끝 코멘트 구하기
if($c_last_record > $c_total_count){ // 마지막 코멘트가 전체 코멘트 보다 크면 전체 코멘트로 할당
$c_last_record = $c_total_count;
}
}
// 페이징 처리 함수 및 표시
$c_pagelist = get_comment_paging($c_rows, $c_page, $c_total_page, "./board.php?bo_table=$bo_table&c_rows=$c_rows&wr_id=$wr_id&c_page=");
if ($c_pagelist) {
echo "<table width=100% cellpadding=3 cellspacing=1><tr><td align=right>$c_pagelist</td></tr></table>\n";
}
?>
<!-- 댓글 페이징을 위해 추가 [끝] -->
<?php
$cmt_amt = count($list);
for ($i=0; $i<$cmt_amt; $i++) {
$comment_id = $list[$i]['wr_id'];
$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;
$comment = $list[$i]['content'];
/*
if (strstr($list[$i]['wr_option'], "secret")) {
$str = $str;
}
*/
$comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);
$cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결
?>
<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="padding-left:30px;background: url(/images/icon_reply.gif) no-repeat 13px 20px #f4f4f4;"<?php } ?>>
<div style="z-index:<?php echo $cmt_sv; ?>">
<h2><?php echo get_text($list[$i]['wr_name']); ?>님의 <?php if ($cmt_depth) { ?><span class="sound_only">댓글의</span><?php } ?> 댓글</h2>
<?php echo $list[$i]['name'] ?>
<?php if ($is_ip_view) { ?>
<span class="sound_only">아이피</span>
<span>(<?php echo $list[$i]['ip']; ?>)</span>
<?php } ?>
<span class="sound_only">작성일</span>
<span class="bo_vc_hdinfo"><time datetime="<?php echo date('Y-m-d\TH:i:s+09:00', strtotime($list[$i]['datetime'])) ?>"><?php echo $list[$i]['datetime'] ?></time></span>
<?php
include(G5_SNS_PATH.'/view_comment_list.sns.skin.php');
?>
</div>
<!-- 댓글 출력 -->
<div class="cmt_contents">
<p>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>
<?php echo $comment ?>
</p>
<?php if($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) {
$query_string = clean_query_string($_SERVER['QUERY_STRING']);
if($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql);
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
$cmt['wr_content'] = '';
$c_wr_content = $cmt['wr_content'];
}
$c_reply_href = './board.php?'.$query_string.'&c_id='.$comment_id.'&w=c#bo_vc_w';
$c_edit_href = './board.php?'.$query_string.'&c_id='.$comment_id.'&w=cu#bo_vc_w';
?>
<ul class="bo_vc_act">
<?php if ($list[$i]['is_reply']) { ?><li><a href="<?php echo $c_reply_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'c'); return false;" class="btn_b03">답변</a></li><?php } ?>
<?php if ($list[$i]['is_edit']) { ?><li><a href="<?php echo $c_edit_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;" class="btn_b03">수정</a></li><?php } ?>
<?php if ($list[$i]['is_del']) { ?><li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();" class="btn_b03">삭제</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<span id="edit_<?php echo $comment_id ?>" class