베스트 댓글 관련 질문드립니다. 정보
베스트 댓글 관련 질문드립니다.본문
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.
오류 주소 :
현재 쓰고 있는 댓글이 이미지첨부되는 댓글 스킨과 베스트댓글 할 수 있는 댓글을 짜집기 하여 쓰고 있습니다.
베스트댓글이 되었을때 그 댓글이 상위에 따로 표시는 되는데
br 처리가 안되는 현상과 댓글 이미지첨부가 첨부 되었으면 같이 표시가 안됩니다.
이리저리 짬뽕 해봤지만 결국 실패로 돌아가 다시 질문 올립니다.
보통 br 처리가 안되면 <?=nl2br($view['content'])?> 이런식으로 넣으면 된다고 팁에서 본 것 같은데
아래 소스에선 어떻게 적용을 해야할지 잘 감이 오지 않습니다...
------------------------------------------------------------
br처리가 안된다는 예시는 아래와 같습니다.
*기존 댓글
안녕하세요!
안녕하세요!
안녕하세요!
*베스트댓글
안녕하세요!안녕하세요!안녕하세요!
------------------------------------------------------------
위와 같이 br 처리가...(첨부된 파일 보시면 대강 현상을 이해하실거라 생각합니다.)
혹시 주소가 필요하거나 다른 소스가 더 필요하시면 말씀해주세요~
거즘 한달째 싸메고 있는데 답이 안나와 다시 질문드립니다.
간략요약
1.베스트댓글 됐을시 상위에 표시되는 댓글이 br처리가 안됨
2.댓글에 이미지첨부하게 되있는데 베스트댓글이 됐을시 이미지는 첨부가 안됨.
================== 아래는 베스트댓글 소스입니다.==============================
<?
// 가장 추천이 높은 댓글 불러오기.
$best_sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = '1' order by wr_good desc ";
$best_row = sql_fetch($best_sql);
if ($best_row[wr_good] > 0)
{
?>
<style type="text/css">
.co_best2 ul li{float:left;margin-left:5px;}
.co_best2 ul li.co_good2{dosplay:block;width:50px;height:17px;background: url("<?=$board_skin_path?>/img/co_good.gif") 0 0 no-repeat;padding-left:24px;padding-top:5px;}
.co_best2 ul li.co_bad2{dosplay:block;width:50px;height:17px;background: url("<?=$board_skin_path?>/img/co_bad.gif") 0 0 no-repeat;padding-left:24px;padding-top:5px;}
</style>
</style>
<!-- best_comment.skin.php 시작 -->
<div style="background:#fcf2fb;border-top:2px solid #d44094;border-bottom:1px solid #d44094;padding-bottom:10px;padding-left:10px;padding-right:10px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="45px" align="left">
<table>
<td height="45"><img src="<?=$board_skin_path?>/img/best_jjoa.gif" alt="베스트 쪼아 당첨!" /></td>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="60">
<table border="0" cellspacing="2" cellpadding="0" >
<tr>
<td>
<div style="width:58px;height:58px;border:1px solid #ddd;background:#fff;text-align:center;display:table-cell;vertical-align:bottom;">
<? $mb1_dir = substr($best_row[mb_id],0,2); $mb_1 = "{$g4[path]}/data/member_image/{$mb1_dir}/{$best_row[mb_id]}.gif";?>
<?if(file_exists($mb_1)){echo"<img src='{$mb_1}' align=absmiddle border='0'>";}else{echo"<img src='$g4[path]/img/member_noimg.gif' title='등록된 회원사진이 없습니다.'>";}?>
</div>
</td>
</tr>
</table>
</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" >
<?
$best_data4=mysql_fetch_array(mysql_query("select mb_id,mb_email,mb_homepage from $g4[member_table] where mb_nick='{$best_row[wr_name]}'"));
$best_list[name] = get_sideview($best_data4[mb_id], $best_row[wr_name], $best_data4[wr_email], $best_data4[wr_homepage]);
?>
<tr>
<td>
<div style="float:left; margin:0 0 0 7px;"><strong><?=$best_list[name]?></strong>
<span style="color:#888888; font-size:11px;"><?=date("y.m.d H:i", strtotime($best_row[wr_datetime]))?>
<!-- <? if ($is_ip_view) { echo " <span style=\"color:#B2B2B2; font-size:11px;\">{$best_row[wr_ip]}</span>"; } ?> -->
</div>
</td>
<td>
<div class="co_best2" style="float:right;">
<ul>
<li style="padding-right:0px;">
<? if ($list[$i][is_reply]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'c');\"><span style='font-size:11px;color:#999;'>답변</span></a> "; } ?>
<? if ($list[$i][is_edit]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'cu');\"><span style='font-size:11px;color:#999;'>수정</span></a> "; } ?>
<? if ($list[$i][is_del]) { echo "<a href=\"javascript:comment_delete('{$list[$i][del_link]}');\"><span style='font-size:11px;color:#999;'>삭제</span></a> "; } ?>
</li>
<? //공감댓글 출력
echo"";
if ($is_guest){$href="";}else{
$good_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$best_row[wr_id]&good=good' target='hiddenframe'";
$nogood_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$best_row[wr_id]&good=nogood' target='hiddenframe'";
}
if ($bo_7[2]) { echo "<li class='co_good2'><a {$good_href} title='댓글 쪼아'><span style='font-size:11px;color:#dc143c;'>쪼아</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$best_row[wr_good]}</span></a></li>";}
if ($bo_7[2]) { echo "<li class='co_bad2'><a {$nogood_href} title='댓글 그닥'><span style='font-size:11px;color:#9655a4;'>그닥</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$best_row[wr_nogood]}</span></a></li>";}
echo"";
//공감댓글 출력 끝
?>
</ul>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:0 0 10 0;">
<!-- 코멘트 출력 -->
<div style='line-height:20px; padding:7px; word-break:break-all; overflow:hidden; clear:both; '>
<?
if (strstr($best_row[wr_content], "secret")) echo "<span style='color:#000;'>*</span> ";
$str = $best_row[wr_content];
if (strstr($list[$i][wr_option], "secret")){ $str = "<span class='small' style='color:#000;'>$str</span>"; } else { $str = "<span style='color:#000 ;'>$str</span>"; }
$str = 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>", $str);
// FLASH XSS 공격에 의해 주석 처리 - 110406
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
echo $str;
?>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- best_comment.skin.php 끝 -->
<?}?>
======= 아래는 이미지 첨부하는 기본 코멘트 스킨입니다. ================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$board_skin_path/_setup/inc.option.php");
$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if (!strstr($row[wr_option], "secret") ||
$is_admin ||
($row[mb_id]==$member[mb_id] && $member[mb_id])) {
$list[$i][cfile] = get_file($board['bo_table'], $row['wr_id']);
if(!$list[$i][cfile][0][view]){
/* 이미지가 아닌건 허용된확장자만 링크 */
$sPermissionExt = "txt|csv|zip|tar";
if( preg_match("/\.($sPermissionExt)$/i", $list[$i][cfile][0][source])){
$list[$i][cfile][0][view] = "<img src='{$board_skin_path}/img/icon_file.gif' align=absmiddle border='0'> <a href='".$list[$i][cfile][0][href]."'>".$list[$i][cfile][0][source]."</a><br>";
set_session("ss_view_{$bo_table}_{$row[wr_id]}" , TRUE );
}
}
}
}
?>
<style type="text/css">
.ed{width:100px;height:20px;border:1px solid #ccc;line-height:20px;font-size:14px;font-weight:bold;}
input.button {
text-decoration:none !important;
color:#273234;
font-size:12px;
font-weight:bold;
font-family:돋움, Tahoma;
line-height:16px;
text-decoration:none;
padding:4px 12px 5px 12px;
position:relative;
display:inline-block;
text-shadow:0 1px 0 #fff;
-webkit-transition:border-color .218s;
-moz-transition:border .218s;
-o-transition:border-color .218s;
transition:border-color .218s;
background:-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#eff1f2));
background:-moz-linear-gradient(linear,0% 0%,0% 100%,from(#fff),to(#eff1f2));
background:#f8f8f8 url(../img/bg_btn_big.gif) 0 50% repeat-x;
border:solid 1px #c0c4cf;
border-radius:2px;
-webkit-border-radius:2px;
-moz-border-radius:2px;
margin:0;
white-space:nowrap;
vertical-align:top;
}
input.button:hover { color:#e15305; border-color:#e15305; -moz-box-shadow:0 2px 0 rgba(0, 0, 0, 0.2) -webkit-box-shadow:0 2px 5px rgba(0, 0, 0, 0.2); box-shadow 0 1px 2px rgba(0, 0, 0, 0.15);}
input.button { padding:5px 12px 5px 12px;}
input.button{cursor:pointer;}
.co_best ul li{float:left;margin-left:5px;}
.co_best ul li.co_good{dosplay:block;width:50px;height:26px;background: url("<?=$board_skin_path?>/img/co_good.gif") 0 4px no-repeat;padding-left:24px;}
.co_best ul li.co_bad{dosplay:block;width:50px;height:26px;background: url("<?=$board_skin_path?>/img/co_bad.gif") 0 4px no-repeat;padding-left:24px;}
</style>
<script type="text/javascript">
// 글자수 제한
var char_min = parseInt(<?=$comment_min?>); // 최소
var char_max = parseInt(<?=$comment_max?>); // 최대
</script>
<? if ($cwin==1) { ?><table width=100% cellpadding=10 align=center><tr><td><?}?>
<!-- 코멘트 리스트 -->
<div id="commentContents">
<h3 style=" margin:0 0 10px 0;text-align:left;">펀펀한 댓글보기 <span style="font-size:.8em; color:#ff4b0d;"><?=$view[comment_cnt]?></span> <!-- <span style="font-size:.8em; color:#999;">댓글은 당신의 또 하나의 얼굴!</span> --></h3>
<div><?if($bo_7[2]) { include("$board_skin_path/_skin/view_comment.skin.best.php"); }//베트스 댓글?></div>
<? // 코멘트 번호 계산식 및 페이징 표시
$c_total_count = count($list); // 전체 코멘트 수 할당
$c_rows = 15; // 보여줄 개수
if ($c_total_count != 0){
//댓글 첫페이지가 계속 보이게 하려면 해제$c_total_page = ceil($c_total_count / $c_rows); // 전체 페이지 계산
//댓글 첫페이지가 계속 보이게 하려면 해제 아래두개 주석 이나 삭제if (!$c_page) $c_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$c_total_page = ceil($c_total_count / $c_rows); // 전체 페이지 계산
if (!$c_page) $c_page = $c_total_page; // 페이지가 없으면 첫 페이지 (last 페이지)
$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_paging($c_rows, $c_page, $c_total_page, "./board.php?bo_table=$bo_table&wr_id=$wr_id&c_page=");
if ($c_pagelist) {
echo "<table width=100% cellpadding=3 cellspacing=1><tr><td height='30' align='right'><span style='font-family:Tahoma;font-weight:bold;font-size:14px;color:red;'>$c_pagelist</span></td></tr></table>\n";
}
?>
<? // 코멘트 표시
$i = $c_from_record;
for ($i; $i<$c_last_record; $i++) {
$comment_id = $list[$i][wr_id];
//코멘트앞에 번호구하기echo $comment_id;
?>
<a name="c_<?=$comment_id?>"></a>
<div>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td><? for ($k=0; $k<strlen($list[$i][wr_comment_reply]); $k++) echo " "; ?></td>
<td width='100%'>
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td height=1 colspan=3 bgcolor="#dddddd"><td>
</tr>
<tr>
<td height=10 colspan=3></td>
</tr>
<tr>
<td valign=top align="left" width="10"><?php if ($k != 0) echo "<img src='$board_skin_path/img/icon_reply.gif' align='absmiddle' title='리플' /> "; ?></td>
<td valign=top align="left" width="58">
<div style="width:58px;height:58px;border:1px solid #ddd;text-align:center;display:table-cell;vertical-align:bottom;">
<?php
//echo $config[cf_1] + "10";
// 회원 이미지
$mb1_dir = substr($list[$i][mb_id],0,2);
$mb_1 = "$g4[path]/data/member_image/$mb1_dir/". $list[$i][mb_id] .".gif";
if (!$list[$i][mb_id]||!file_exists($mb_1)) { // 회원이 아니거나, 파일이 없으면 noimage 출력
echo "<img src='$g4[path]/img/member_noimg.gif' title='등록된 회원사진이 없습니다.'>";
} else {
echo "<img src='{$mb_1}'>";
}
?></div></td>
<td valign=top>
<!-- <div style="height:28px;background:url(<?=$board_skin_path?>/img/co_title_bg.gif); clear:both; line-height:28px;"> -->
<div style="height:30px;border-bottom:1px dotted #ccc;clear:both; line-height:30px;">
<div style="float:left; margin:0 0 0 7px;"><strong><span style="color:#000;"><?=$list[$i][name]?></span></strong>
<span style="color:#888888; font-size:11px;"><?=date("y.m.d H:i", strtotime($list[$i][wr_datetime]))?></span>
<? if ($is_ip_view) { echo " <span style=\"color:#B2B2B2; font-size:11px;\">{$list[$i][ip]}</span>"; } ?>
</div>
<div class="co_best" style="float:right;">
<ul>
<li style="padding-right:0px;">
<? if ($list[$i][is_reply]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'c');\"><span style='font-size:11px;color:#999;'>답변</span></a> "; } ?>
<? if ($list[$i][is_edit]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'cu');\"><span style='font-size:11px;color:#999;'>수정</span></a> "; } ?>
<? if ($list[$i][is_del]) { echo "<a href=\"javascript:comment_delete('{$list[$i][del_link]}');\"><span style='font-size:11px;color:#999;'>삭제</span></a> "; } ?>
</li>
<? //공감댓글 출력
echo"";
if ($is_guest){$href="";}else{
$good_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$comment_id&good=good' target='hiddenframe'";
$nogood_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$comment_id&good=nogood' target='hiddenframe'";
}
if ($bo_7[2]) { echo "<li class='co_good'><a {$good_href} title='댓글 쪼아'><span style='font-size:11px;color:#dc143c;'>쪼아</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$list[$i][wr_good]}</span></a></li>";}
if ($bo_7[2]) { echo "<li class='co_bad'><a {$nogood_href} title='댓글 그닥'><span style='font-size:11px;color:#9655a4;'>그닥</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$list[$i][wr_nogood]}</span></a></li>";}
echo"";
//공감댓글 출력 끝
?>
</ul>
</div>
</div>
<!-- 코멘트 출력 -->
<div style='line-height:20px; padding:7px; word-break:break-all; overflow:hidden; clear:both; '>
<?
if($list[$i][cfile][0][view]){
echo $list[$i][cfile][0][view]."<br>";
}
?>
<?
if (strstr($list[$i][wr_option], "secret")) echo "<span style='color:#ff6600;'>*</span> ";
$str = $list[$i][content];
$str = 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>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\".*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);'>", $str);
echo $str;
?>
</div>
<? if ($list[$i][trackback]) { echo "<p>".$list[$i][trackback]."</p>"; } ?>
<span id='edit_<?=$comment_id?>' style='display:none;'></span><!-- 수정 -->
<span id='reply_<?=$comment_id?>' style='display:none;'></span><!-- 답변 -->
</div>
<input type=hidden id='secret_comment_<?=$comment_id?>' value="<?=strstr($list[$i][wr_option],"secret")?>" />
<input type=hidden id='commentfile_<?=$comment_id?>' value="<?=$list[$i][cfile][0][file]?>" />
<textarea id='save_comment_<?=$comment_id?>' style='display:none;'><span style="color:#000;"><?=get_text($list[$i][content1], 0)?></span></textarea>
</td>
</tr>
<tr>
<td height=5 colspan=3></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<? } ?>
</div>
<!-- 코멘트 리스트 -->
<? // 코멘트 번호 계산식 및 페이징 표시
// 페이징 처리 함수 및 표시
$c_pagelist = get_paging($c_rows, $c_page, $c_total_page, "./board.php?bo_table=$bo_table&wr_id=$wr_id&c_page=");
if ($c_pagelist) {
echo "<table width=100% cellpadding=3 cellspacing=1><tr><td align=right><span style='font-family:Tahoma;font-weight:bold;font-size:14px;color:red;'>$c_pagelist</span></td></tr></table>\n";
}
?>
<!-- 코멘트 입력 -->
<div id=comment_write style="display:none;">
<div style="height:15px;"></div>
<div style="width:100%;height:1px;background:#999;"></div>
<div style="padding:7px;background:#f6f6f6;"><h4 style="text-align:left;background:#f6f6f6;">댓글쓰기</h4></div>
<div style="width:100%;color:red;font-size:11px;padding-top:10px;">* 펀펀한댓글은 회원, 비회원 모두 작성하실 수 있으며, 회원이시라면 <a href='<?=$g4[bbs_path]?>/login.php?url=<?=$urlencode?>'><span style="color:#000;font-size:11px;font-weight:bold;text-decoration:underline;">로그인</span></a>해주세요.</div>
<div style="width:100%;color:red;font-size:11px;padding-top:5px;">* 댓글 쪼아, 그닥은 회원전용으로 <a href='<?=$g4[bbs_path]?>/register.php'><span style="color:#000;font-size:11px;font-weight:bold;text-decoration:underline;">회원가입</span></a>이 필요합니다. 비방/욕설 등은 삼가해 주세요!</div>
<div style="width:100%;color:red;font-size:11px;padding-top:5px;">* 댓글 작성 후 비밀글 체크시 댓글작성자와 해당게시글 작성자만 볼 수 있습니다.(댓글 첨부이미지 업로드 가능)</div>
<table width=100% border=0 cellpadding=1 cellspacing=0 bgcolor="#dddddd"><tr><td>
<form name="fviewcomment" method="post" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" autocomplete="off" style="margin:0px;" enctype="multipart/form-data">
<input type=hidden name=w id=w value='c' />
<input type=hidden name=bo_table value='<?=$bo_table?>' />
<input type=hidden name=wr_id value='<?=$wr_id?>' />
<input type=hidden name=comment_id id='comment_id' value='' />
<input type=hidden name=sca value='<?=$sca?>' />
<input type=hidden name=sfl value='<?=$sfl?>' />
<input type=hidden name=stx value='<?=$stx?>' />
<input type=hidden name=spt value='<?=$spt?>' />
<input type=hidden name=page value='<?=$page?>' />
<input type=hidden name=cwin value='<?=$cwin?>' />
<input type=hidden name=is_good value='' />
<table width=100% cellpadding=3 height=156 cellspacing=0 bgcolor="#ffffff" style="border:1px solid #fff; background:url(<?=$board_skin_path?>/img/co_bg.gif) x-repeat;">
<tr>
<td colspan="2" style="padding-top:5px;">
<span style="cursor:pointer;padding-right:1px;" onclick="textarea_decrease('wr_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_up.gif" alt="댓글창 줄이기" title="댓글창 줄이기" border='0' /></span><span style="cursor: pointer;padding-right:1px;" onclick="textarea_original('wr_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_init.gif" alt="댓글창 처음크기로" title="댓글창 처음크기로" border='0' /></span><span style="cursor: pointer;" onclick="textarea_increase('wr_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_down.gif" alt="댓글창 늘리기" title="댓글창 늘리기" border='0' /></span>
<? if ($is_guest) { ?>
<label for="nomemberName"><b>이름</b></label> <INPUT type=text maxLength=20 id="nomemberName" name="wr_name" itemname="이름" required class=ed />
<label for="nomemberPw"><b>패스워드</b></label> <INPUT type=password maxLength=20 id="nomemberPw" name="wr_password" itemname="패스워드" required class=ed />
<? if ($is_guest) { ?>
<img id='kcaptcha_image' />
<input title="왼쪽의 글자를 입력하세요." type="input" name="wr_key" size="10" itemname="자동등록방지" required class=ed />
<?}?>
<? } ?>
<input type=checkbox id="wr_secret" name="wr_secret" value="secret"> 비밀글
<? if ($comment_min || $comment_max) { ?><span id=char_count></span>글자<?}?>
</td>
</tr>
<tr>
<td width=95%>
<textarea id="wr_content" name="wr_content" rows=8 itemname="내용" required
<? if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?> style='width:100%; word-break:break-all;border:1px solid #ccc;' class=tx></textarea>
<p style="padding-top:7px;font-size:12px;color:#999;letter-spacing:-1px;"><input type=file name=wr_commentfile style='width:200px;height:25px;' value='첨부파일' /> [댓글 첨부 이미지는 <b>가로 500px 이하 저용량 gif,jpg,png</b> 업로드 권장합니다!]
<span id="delspan" style='display:none'><input type=checkbox name=wr_commentfile_del value=Y />파일삭제</span>
<? if ($comment_min || $comment_max) { ?><script type="text/javascript"> check_byte('wr_content', 'char_count'); </script><?}?></p>
</td>
<td align="right" valign="top" style="padding-top:5px;"><input type="submit" value="댓글등록" accesskey="s" class="button" style="width:90px; height:98px; float:right;" /></td>
</tr>
</table>
</form>
</td></tr></table>
<div style="height:15px;"></div>
</div>
<!-- 코멘트 입력 -->
<script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script>
<script type="text/javascript">
var save_before = '';
var save_html = document.getElementById('comment_write').innerHTML;
function good_and_write()
{
var f = document.fviewcomment;
if (fviewcomment_submit(f)) {
f.is_good.value = 1;
f.submit();
} else {
f.is_good.value = 0;
}
}
function fviewcomment_submit(f)
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
f.is_good.value = 0;
/*
var s;
if (s = word_filter_check(document.getElementById('wr_content').value))
{
alert("내용에 금지단어('"+s+"')가 포함되어있습니다");
document.getElementById('wr_content').focus();
return false;
}
*/
var subject = "";
var content = "";
$.ajax({
url: "<?=$board_skin_path?>/ajax.filter.php",
type: "POST",
data: {
"subject": "",
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
f.wr_content.focus();
return false;
}
// 양쪽 공백 없애기
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, "");
if (char_min > 0 || char_max > 0)
{
check_byte('wr_content', 'char_count');
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt)
{
alert("코멘트는 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
} else if (char_max > 0 && char_max < cnt)
{
alert("코멘트는 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
else if (!document.getElementById('wr_content').value)
{
alert("코멘트를 입력하여 주십시오.");
return false;
}
if (typeof(f.wr_name) != 'undefined')
{
f.wr_name.value = f.wr_name.value.replace(pattern, "");
if (f.wr_name.value == '')
{
alert('이름이 입력되지 않았습니다.');
f.wr_name.focus();
return false;
}
}
if (typeof(f.wr_password) != 'undefined')
{
f.wr_password.value = f.wr_password.value.replace(pattern, "");
if (f.wr_password.value == '')
{
alert('패스워드가 입력되지 않았습니다.');
f.wr_password.focus();
return false;
}
}
if (!check_kcaptcha(f.wr_key)) {
return false;
}
return true;
}
/*
jQuery.fn.extend({
kcaptcha_load: function() {
$.ajax({
type: 'POST',
url: g4_path+'/'+g4_bbs+'/kcaptcha_session.php',
cache: false,
async: false,
success: function(text) {
$('#kcaptcha_image')
.attr('src', g4_path+'/'+g4_bbs+'/kcaptcha_image.php?t=' + (new Date).getTime())
.css('cursor', '')
.attr('title', '');
md5_norobot_key = text;
}
});
}
});
*/
function comment_box(comment_id, work)
{
var el_id;
var cf_id;
// 코멘트 아이디가 넘어오면 답변, 수정
if (comment_id)
{
if (work == 'c')
el_id = 'reply_' + comment_id;
else
el_id = 'edit_' + comment_id;
}
else
el_id = 'comment_write';
cf_id = 'commentfile_' + comment_id;
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
document.getElementById(save_before).innerHTML = '';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).innerHTML = save_html;
// 코멘트 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
save_before = el_id;
}
if (typeof(wrestInitialized) != 'undefined')
wrestInitialized();
//jQuery(this).kcaptcha_load();
if (comment_id && work == 'c')
$.kcaptcha_run();
if (comment_id){
if(document.getElementById(cf_id).value && work =='cu'){
document.getElementById('delspan').style.display = "inline";
}
}
}
function comment_delete(url)
{
if (confirm("이 코멘트를 삭제하시겠습니까?")) location.href = url;
}
comment_box('', 'c'); // 코멘트 입력폼이 보이도록 처리하기위해서 추가 (root님)
</script>
<? if($cwin==1) { ?></td><tr></table><p align=center><a href="javascript:window.close();"><img src="<?=$board_skin_path?>/img/btn_close.gif" border="0"></a><br><br><?}?>
오류 주소 :
현재 쓰고 있는 댓글이 이미지첨부되는 댓글 스킨과 베스트댓글 할 수 있는 댓글을 짜집기 하여 쓰고 있습니다.
베스트댓글이 되었을때 그 댓글이 상위에 따로 표시는 되는데
br 처리가 안되는 현상과 댓글 이미지첨부가 첨부 되었으면 같이 표시가 안됩니다.
이리저리 짬뽕 해봤지만 결국 실패로 돌아가 다시 질문 올립니다.
보통 br 처리가 안되면 <?=nl2br($view['content'])?> 이런식으로 넣으면 된다고 팁에서 본 것 같은데
아래 소스에선 어떻게 적용을 해야할지 잘 감이 오지 않습니다...
------------------------------------------------------------
br처리가 안된다는 예시는 아래와 같습니다.
*기존 댓글
안녕하세요!
안녕하세요!
안녕하세요!
*베스트댓글
안녕하세요!안녕하세요!안녕하세요!
------------------------------------------------------------
위와 같이 br 처리가...(첨부된 파일 보시면 대강 현상을 이해하실거라 생각합니다.)
혹시 주소가 필요하거나 다른 소스가 더 필요하시면 말씀해주세요~
거즘 한달째 싸메고 있는데 답이 안나와 다시 질문드립니다.
간략요약
1.베스트댓글 됐을시 상위에 표시되는 댓글이 br처리가 안됨
2.댓글에 이미지첨부하게 되있는데 베스트댓글이 됐을시 이미지는 첨부가 안됨.
================== 아래는 베스트댓글 소스입니다.==============================
<?
// 가장 추천이 높은 댓글 불러오기.
$best_sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = '1' order by wr_good desc ";
$best_row = sql_fetch($best_sql);
if ($best_row[wr_good] > 0)
{
?>
<style type="text/css">
.co_best2 ul li{float:left;margin-left:5px;}
.co_best2 ul li.co_good2{dosplay:block;width:50px;height:17px;background: url("<?=$board_skin_path?>/img/co_good.gif") 0 0 no-repeat;padding-left:24px;padding-top:5px;}
.co_best2 ul li.co_bad2{dosplay:block;width:50px;height:17px;background: url("<?=$board_skin_path?>/img/co_bad.gif") 0 0 no-repeat;padding-left:24px;padding-top:5px;}
</style>
</style>
<!-- best_comment.skin.php 시작 -->
<div style="background:#fcf2fb;border-top:2px solid #d44094;border-bottom:1px solid #d44094;padding-bottom:10px;padding-left:10px;padding-right:10px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="45px" align="left">
<table>
<td height="45"><img src="<?=$board_skin_path?>/img/best_jjoa.gif" alt="베스트 쪼아 당첨!" /></td>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="60">
<table border="0" cellspacing="2" cellpadding="0" >
<tr>
<td>
<div style="width:58px;height:58px;border:1px solid #ddd;background:#fff;text-align:center;display:table-cell;vertical-align:bottom;">
<? $mb1_dir = substr($best_row[mb_id],0,2); $mb_1 = "{$g4[path]}/data/member_image/{$mb1_dir}/{$best_row[mb_id]}.gif";?>
<?if(file_exists($mb_1)){echo"<img src='{$mb_1}' align=absmiddle border='0'>";}else{echo"<img src='$g4[path]/img/member_noimg.gif' title='등록된 회원사진이 없습니다.'>";}?>
</div>
</td>
</tr>
</table>
</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" >
<?
$best_data4=mysql_fetch_array(mysql_query("select mb_id,mb_email,mb_homepage from $g4[member_table] where mb_nick='{$best_row[wr_name]}'"));
$best_list[name] = get_sideview($best_data4[mb_id], $best_row[wr_name], $best_data4[wr_email], $best_data4[wr_homepage]);
?>
<tr>
<td>
<div style="float:left; margin:0 0 0 7px;"><strong><?=$best_list[name]?></strong>
<span style="color:#888888; font-size:11px;"><?=date("y.m.d H:i", strtotime($best_row[wr_datetime]))?>
<!-- <? if ($is_ip_view) { echo " <span style=\"color:#B2B2B2; font-size:11px;\">{$best_row[wr_ip]}</span>"; } ?> -->
</div>
</td>
<td>
<div class="co_best2" style="float:right;">
<ul>
<li style="padding-right:0px;">
<? if ($list[$i][is_reply]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'c');\"><span style='font-size:11px;color:#999;'>답변</span></a> "; } ?>
<? if ($list[$i][is_edit]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'cu');\"><span style='font-size:11px;color:#999;'>수정</span></a> "; } ?>
<? if ($list[$i][is_del]) { echo "<a href=\"javascript:comment_delete('{$list[$i][del_link]}');\"><span style='font-size:11px;color:#999;'>삭제</span></a> "; } ?>
</li>
<? //공감댓글 출력
echo"";
if ($is_guest){$href="";}else{
$good_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$best_row[wr_id]&good=good' target='hiddenframe'";
$nogood_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$best_row[wr_id]&good=nogood' target='hiddenframe'";
}
if ($bo_7[2]) { echo "<li class='co_good2'><a {$good_href} title='댓글 쪼아'><span style='font-size:11px;color:#dc143c;'>쪼아</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$best_row[wr_good]}</span></a></li>";}
if ($bo_7[2]) { echo "<li class='co_bad2'><a {$nogood_href} title='댓글 그닥'><span style='font-size:11px;color:#9655a4;'>그닥</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$best_row[wr_nogood]}</span></a></li>";}
echo"";
//공감댓글 출력 끝
?>
</ul>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:0 0 10 0;">
<!-- 코멘트 출력 -->
<div style='line-height:20px; padding:7px; word-break:break-all; overflow:hidden; clear:both; '>
<?
if (strstr($best_row[wr_content], "secret")) echo "<span style='color:#000;'>*</span> ";
$str = $best_row[wr_content];
if (strstr($list[$i][wr_option], "secret")){ $str = "<span class='small' style='color:#000;'>$str</span>"; } else { $str = "<span style='color:#000 ;'>$str</span>"; }
$str = 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>", $str);
// FLASH XSS 공격에 의해 주석 처리 - 110406
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
echo $str;
?>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- best_comment.skin.php 끝 -->
<?}?>
======= 아래는 이미지 첨부하는 기본 코멘트 스킨입니다. ================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$board_skin_path/_setup/inc.option.php");
$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if (!strstr($row[wr_option], "secret") ||
$is_admin ||
($row[mb_id]==$member[mb_id] && $member[mb_id])) {
$list[$i][cfile] = get_file($board['bo_table'], $row['wr_id']);
if(!$list[$i][cfile][0][view]){
/* 이미지가 아닌건 허용된확장자만 링크 */
$sPermissionExt = "txt|csv|zip|tar";
if( preg_match("/\.($sPermissionExt)$/i", $list[$i][cfile][0][source])){
$list[$i][cfile][0][view] = "<img src='{$board_skin_path}/img/icon_file.gif' align=absmiddle border='0'> <a href='".$list[$i][cfile][0][href]."'>".$list[$i][cfile][0][source]."</a><br>";
set_session("ss_view_{$bo_table}_{$row[wr_id]}" , TRUE );
}
}
}
}
?>
<style type="text/css">
.ed{width:100px;height:20px;border:1px solid #ccc;line-height:20px;font-size:14px;font-weight:bold;}
input.button {
text-decoration:none !important;
color:#273234;
font-size:12px;
font-weight:bold;
font-family:돋움, Tahoma;
line-height:16px;
text-decoration:none;
padding:4px 12px 5px 12px;
position:relative;
display:inline-block;
text-shadow:0 1px 0 #fff;
-webkit-transition:border-color .218s;
-moz-transition:border .218s;
-o-transition:border-color .218s;
transition:border-color .218s;
background:-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#eff1f2));
background:-moz-linear-gradient(linear,0% 0%,0% 100%,from(#fff),to(#eff1f2));
background:#f8f8f8 url(../img/bg_btn_big.gif) 0 50% repeat-x;
border:solid 1px #c0c4cf;
border-radius:2px;
-webkit-border-radius:2px;
-moz-border-radius:2px;
margin:0;
white-space:nowrap;
vertical-align:top;
}
input.button:hover { color:#e15305; border-color:#e15305; -moz-box-shadow:0 2px 0 rgba(0, 0, 0, 0.2) -webkit-box-shadow:0 2px 5px rgba(0, 0, 0, 0.2); box-shadow 0 1px 2px rgba(0, 0, 0, 0.15);}
input.button { padding:5px 12px 5px 12px;}
input.button{cursor:pointer;}
.co_best ul li{float:left;margin-left:5px;}
.co_best ul li.co_good{dosplay:block;width:50px;height:26px;background: url("<?=$board_skin_path?>/img/co_good.gif") 0 4px no-repeat;padding-left:24px;}
.co_best ul li.co_bad{dosplay:block;width:50px;height:26px;background: url("<?=$board_skin_path?>/img/co_bad.gif") 0 4px no-repeat;padding-left:24px;}
</style>
<script type="text/javascript">
// 글자수 제한
var char_min = parseInt(<?=$comment_min?>); // 최소
var char_max = parseInt(<?=$comment_max?>); // 최대
</script>
<? if ($cwin==1) { ?><table width=100% cellpadding=10 align=center><tr><td><?}?>
<!-- 코멘트 리스트 -->
<div id="commentContents">
<h3 style=" margin:0 0 10px 0;text-align:left;">펀펀한 댓글보기 <span style="font-size:.8em; color:#ff4b0d;"><?=$view[comment_cnt]?></span> <!-- <span style="font-size:.8em; color:#999;">댓글은 당신의 또 하나의 얼굴!</span> --></h3>
<div><?if($bo_7[2]) { include("$board_skin_path/_skin/view_comment.skin.best.php"); }//베트스 댓글?></div>
<? // 코멘트 번호 계산식 및 페이징 표시
$c_total_count = count($list); // 전체 코멘트 수 할당
$c_rows = 15; // 보여줄 개수
if ($c_total_count != 0){
//댓글 첫페이지가 계속 보이게 하려면 해제$c_total_page = ceil($c_total_count / $c_rows); // 전체 페이지 계산
//댓글 첫페이지가 계속 보이게 하려면 해제 아래두개 주석 이나 삭제if (!$c_page) $c_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$c_total_page = ceil($c_total_count / $c_rows); // 전체 페이지 계산
if (!$c_page) $c_page = $c_total_page; // 페이지가 없으면 첫 페이지 (last 페이지)
$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_paging($c_rows, $c_page, $c_total_page, "./board.php?bo_table=$bo_table&wr_id=$wr_id&c_page=");
if ($c_pagelist) {
echo "<table width=100% cellpadding=3 cellspacing=1><tr><td height='30' align='right'><span style='font-family:Tahoma;font-weight:bold;font-size:14px;color:red;'>$c_pagelist</span></td></tr></table>\n";
}
?>
<? // 코멘트 표시
$i = $c_from_record;
for ($i; $i<$c_last_record; $i++) {
$comment_id = $list[$i][wr_id];
//코멘트앞에 번호구하기echo $comment_id;
?>
<a name="c_<?=$comment_id?>"></a>
<div>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td><? for ($k=0; $k<strlen($list[$i][wr_comment_reply]); $k++) echo " "; ?></td>
<td width='100%'>
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td height=1 colspan=3 bgcolor="#dddddd"><td>
</tr>
<tr>
<td height=10 colspan=3></td>
</tr>
<tr>
<td valign=top align="left" width="10"><?php if ($k != 0) echo "<img src='$board_skin_path/img/icon_reply.gif' align='absmiddle' title='리플' /> "; ?></td>
<td valign=top align="left" width="58">
<div style="width:58px;height:58px;border:1px solid #ddd;text-align:center;display:table-cell;vertical-align:bottom;">
<?php
//echo $config[cf_1] + "10";
// 회원 이미지
$mb1_dir = substr($list[$i][mb_id],0,2);
$mb_1 = "$g4[path]/data/member_image/$mb1_dir/". $list[$i][mb_id] .".gif";
if (!$list[$i][mb_id]||!file_exists($mb_1)) { // 회원이 아니거나, 파일이 없으면 noimage 출력
echo "<img src='$g4[path]/img/member_noimg.gif' title='등록된 회원사진이 없습니다.'>";
} else {
echo "<img src='{$mb_1}'>";
}
?></div></td>
<td valign=top>
<!-- <div style="height:28px;background:url(<?=$board_skin_path?>/img/co_title_bg.gif); clear:both; line-height:28px;"> -->
<div style="height:30px;border-bottom:1px dotted #ccc;clear:both; line-height:30px;">
<div style="float:left; margin:0 0 0 7px;"><strong><span style="color:#000;"><?=$list[$i][name]?></span></strong>
<span style="color:#888888; font-size:11px;"><?=date("y.m.d H:i", strtotime($list[$i][wr_datetime]))?></span>
<? if ($is_ip_view) { echo " <span style=\"color:#B2B2B2; font-size:11px;\">{$list[$i][ip]}</span>"; } ?>
</div>
<div class="co_best" style="float:right;">
<ul>
<li style="padding-right:0px;">
<? if ($list[$i][is_reply]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'c');\"><span style='font-size:11px;color:#999;'>답변</span></a> "; } ?>
<? if ($list[$i][is_edit]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'cu');\"><span style='font-size:11px;color:#999;'>수정</span></a> "; } ?>
<? if ($list[$i][is_del]) { echo "<a href=\"javascript:comment_delete('{$list[$i][del_link]}');\"><span style='font-size:11px;color:#999;'>삭제</span></a> "; } ?>
</li>
<? //공감댓글 출력
echo"";
if ($is_guest){$href="";}else{
$good_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$comment_id&good=good' target='hiddenframe'";
$nogood_href="href='$board_skin_path/feel.php?bo_table=$bo_table&wr_id=$comment_id&good=nogood' target='hiddenframe'";
}
if ($bo_7[2]) { echo "<li class='co_good'><a {$good_href} title='댓글 쪼아'><span style='font-size:11px;color:#dc143c;'>쪼아</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$list[$i][wr_good]}</span></a></li>";}
if ($bo_7[2]) { echo "<li class='co_bad'><a {$nogood_href} title='댓글 그닥'><span style='font-size:11px;color:#9655a4;'>그닥</span> <span style='font-size:11px;font-weight:bold;color:#dc143c;'>{$list[$i][wr_nogood]}</span></a></li>";}
echo"";
//공감댓글 출력 끝
?>
</ul>
</div>
</div>
<!-- 코멘트 출력 -->
<div style='line-height:20px; padding:7px; word-break:break-all; overflow:hidden; clear:both; '>
<?
if($list[$i][cfile][0][view]){
echo $list[$i][cfile][0][view]."<br>";
}
?>
<?
if (strstr($list[$i][wr_option], "secret")) echo "<span style='color:#ff6600;'>*</span> ";
$str = $list[$i][content];
$str = 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>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\".*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);'>", $str);
echo $str;
?>
</div>
<? if ($list[$i][trackback]) { echo "<p>".$list[$i][trackback]."</p>"; } ?>
<span id='edit_<?=$comment_id?>' style='display:none;'></span><!-- 수정 -->
<span id='reply_<?=$comment_id?>' style='display:none;'></span><!-- 답변 -->
</div>
<input type=hidden id='secret_comment_<?=$comment_id?>' value="<?=strstr($list[$i][wr_option],"secret")?>" />
<input type=hidden id='commentfile_<?=$comment_id?>' value="<?=$list[$i][cfile][0][file]?>" />
<textarea id='save_comment_<?=$comment_id?>' style='display:none;'><span style="color:#000;"><?=get_text($list[$i][content1], 0)?></span></textarea>
</td>
</tr>
<tr>
<td height=5 colspan=3></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<? } ?>
</div>
<!-- 코멘트 리스트 -->
<? // 코멘트 번호 계산식 및 페이징 표시
// 페이징 처리 함수 및 표시
$c_pagelist = get_paging($c_rows, $c_page, $c_total_page, "./board.php?bo_table=$bo_table&wr_id=$wr_id&c_page=");
if ($c_pagelist) {
echo "<table width=100% cellpadding=3 cellspacing=1><tr><td align=right><span style='font-family:Tahoma;font-weight:bold;font-size:14px;color:red;'>$c_pagelist</span></td></tr></table>\n";
}
?>
<!-- 코멘트 입력 -->
<div id=comment_write style="display:none;">
<div style="height:15px;"></div>
<div style="width:100%;height:1px;background:#999;"></div>
<div style="padding:7px;background:#f6f6f6;"><h4 style="text-align:left;background:#f6f6f6;">댓글쓰기</h4></div>
<div style="width:100%;color:red;font-size:11px;padding-top:10px;">* 펀펀한댓글은 회원, 비회원 모두 작성하실 수 있으며, 회원이시라면 <a href='<?=$g4[bbs_path]?>/login.php?url=<?=$urlencode?>'><span style="color:#000;font-size:11px;font-weight:bold;text-decoration:underline;">로그인</span></a>해주세요.</div>
<div style="width:100%;color:red;font-size:11px;padding-top:5px;">* 댓글 쪼아, 그닥은 회원전용으로 <a href='<?=$g4[bbs_path]?>/register.php'><span style="color:#000;font-size:11px;font-weight:bold;text-decoration:underline;">회원가입</span></a>이 필요합니다. 비방/욕설 등은 삼가해 주세요!</div>
<div style="width:100%;color:red;font-size:11px;padding-top:5px;">* 댓글 작성 후 비밀글 체크시 댓글작성자와 해당게시글 작성자만 볼 수 있습니다.(댓글 첨부이미지 업로드 가능)</div>
<table width=100% border=0 cellpadding=1 cellspacing=0 bgcolor="#dddddd"><tr><td>
<form name="fviewcomment" method="post" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" autocomplete="off" style="margin:0px;" enctype="multipart/form-data">
<input type=hidden name=w id=w value='c' />
<input type=hidden name=bo_table value='<?=$bo_table?>' />
<input type=hidden name=wr_id value='<?=$wr_id?>' />
<input type=hidden name=comment_id id='comment_id' value='' />
<input type=hidden name=sca value='<?=$sca?>' />
<input type=hidden name=sfl value='<?=$sfl?>' />
<input type=hidden name=stx value='<?=$stx?>' />
<input type=hidden name=spt value='<?=$spt?>' />
<input type=hidden name=page value='<?=$page?>' />
<input type=hidden name=cwin value='<?=$cwin?>' />
<input type=hidden name=is_good value='' />
<table width=100% cellpadding=3 height=156 cellspacing=0 bgcolor="#ffffff" style="border:1px solid #fff; background:url(<?=$board_skin_path?>/img/co_bg.gif) x-repeat;">
<tr>
<td colspan="2" style="padding-top:5px;">
<span style="cursor:pointer;padding-right:1px;" onclick="textarea_decrease('wr_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_up.gif" alt="댓글창 줄이기" title="댓글창 줄이기" border='0' /></span><span style="cursor: pointer;padding-right:1px;" onclick="textarea_original('wr_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_init.gif" alt="댓글창 처음크기로" title="댓글창 처음크기로" border='0' /></span><span style="cursor: pointer;" onclick="textarea_increase('wr_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_down.gif" alt="댓글창 늘리기" title="댓글창 늘리기" border='0' /></span>
<? if ($is_guest) { ?>
<label for="nomemberName"><b>이름</b></label> <INPUT type=text maxLength=20 id="nomemberName" name="wr_name" itemname="이름" required class=ed />
<label for="nomemberPw"><b>패스워드</b></label> <INPUT type=password maxLength=20 id="nomemberPw" name="wr_password" itemname="패스워드" required class=ed />
<? if ($is_guest) { ?>
<img id='kcaptcha_image' />
<input title="왼쪽의 글자를 입력하세요." type="input" name="wr_key" size="10" itemname="자동등록방지" required class=ed />
<?}?>
<? } ?>
<input type=checkbox id="wr_secret" name="wr_secret" value="secret"> 비밀글
<? if ($comment_min || $comment_max) { ?><span id=char_count></span>글자<?}?>
</td>
</tr>
<tr>
<td width=95%>
<textarea id="wr_content" name="wr_content" rows=8 itemname="내용" required
<? if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?> style='width:100%; word-break:break-all;border:1px solid #ccc;' class=tx></textarea>
<p style="padding-top:7px;font-size:12px;color:#999;letter-spacing:-1px;"><input type=file name=wr_commentfile style='width:200px;height:25px;' value='첨부파일' /> [댓글 첨부 이미지는 <b>가로 500px 이하 저용량 gif,jpg,png</b> 업로드 권장합니다!]
<span id="delspan" style='display:none'><input type=checkbox name=wr_commentfile_del value=Y />파일삭제</span>
<? if ($comment_min || $comment_max) { ?><script type="text/javascript"> check_byte('wr_content', 'char_count'); </script><?}?></p>
</td>
<td align="right" valign="top" style="padding-top:5px;"><input type="submit" value="댓글등록" accesskey="s" class="button" style="width:90px; height:98px; float:right;" /></td>
</tr>
</table>
</form>
</td></tr></table>
<div style="height:15px;"></div>
</div>
<!-- 코멘트 입력 -->
<script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script>
<script type="text/javascript">
var save_before = '';
var save_html = document.getElementById('comment_write').innerHTML;
function good_and_write()
{
var f = document.fviewcomment;
if (fviewcomment_submit(f)) {
f.is_good.value = 1;
f.submit();
} else {
f.is_good.value = 0;
}
}
function fviewcomment_submit(f)
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
f.is_good.value = 0;
/*
var s;
if (s = word_filter_check(document.getElementById('wr_content').value))
{
alert("내용에 금지단어('"+s+"')가 포함되어있습니다");
document.getElementById('wr_content').focus();
return false;
}
*/
var subject = "";
var content = "";
$.ajax({
url: "<?=$board_skin_path?>/ajax.filter.php",
type: "POST",
data: {
"subject": "",
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
f.wr_content.focus();
return false;
}
// 양쪽 공백 없애기
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, "");
if (char_min > 0 || char_max > 0)
{
check_byte('wr_content', 'char_count');
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt)
{
alert("코멘트는 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
} else if (char_max > 0 && char_max < cnt)
{
alert("코멘트는 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
else if (!document.getElementById('wr_content').value)
{
alert("코멘트를 입력하여 주십시오.");
return false;
}
if (typeof(f.wr_name) != 'undefined')
{
f.wr_name.value = f.wr_name.value.replace(pattern, "");
if (f.wr_name.value == '')
{
alert('이름이 입력되지 않았습니다.');
f.wr_name.focus();
return false;
}
}
if (typeof(f.wr_password) != 'undefined')
{
f.wr_password.value = f.wr_password.value.replace(pattern, "");
if (f.wr_password.value == '')
{
alert('패스워드가 입력되지 않았습니다.');
f.wr_password.focus();
return false;
}
}
if (!check_kcaptcha(f.wr_key)) {
return false;
}
return true;
}
/*
jQuery.fn.extend({
kcaptcha_load: function() {
$.ajax({
type: 'POST',
url: g4_path+'/'+g4_bbs+'/kcaptcha_session.php',
cache: false,
async: false,
success: function(text) {
$('#kcaptcha_image')
.attr('src', g4_path+'/'+g4_bbs+'/kcaptcha_image.php?t=' + (new Date).getTime())
.css('cursor', '')
.attr('title', '');
md5_norobot_key = text;
}
});
}
});
*/
function comment_box(comment_id, work)
{
var el_id;
var cf_id;
// 코멘트 아이디가 넘어오면 답변, 수정
if (comment_id)
{
if (work == 'c')
el_id = 'reply_' + comment_id;
else
el_id = 'edit_' + comment_id;
}
else
el_id = 'comment_write';
cf_id = 'commentfile_' + comment_id;
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
document.getElementById(save_before).innerHTML = '';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).innerHTML = save_html;
// 코멘트 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
save_before = el_id;
}
if (typeof(wrestInitialized) != 'undefined')
wrestInitialized();
//jQuery(this).kcaptcha_load();
if (comment_id && work == 'c')
$.kcaptcha_run();
if (comment_id){
if(document.getElementById(cf_id).value && work =='cu'){
document.getElementById('delspan').style.display = "inline";
}
}
}
function comment_delete(url)
{
if (confirm("이 코멘트를 삭제하시겠습니까?")) location.href = url;
}
comment_box('', 'c'); // 코멘트 입력폼이 보이도록 처리하기위해서 추가 (root님)
</script>
<? if($cwin==1) { ?></td><tr></table><p align=center><a href="javascript:window.close();"><img src="<?=$board_skin_path?>/img/btn_close.gif" border="0"></a><br><br><?}?>
댓글 전체