미채택 완료

latest 질문입니다.

1888899041_1579504020.0289.png

list.skin.php에 latest를 불러오는 방식으로 ui를 개선시키고 있는 도중

view.skin.php에서 댓글을 남기면 갑자기 이미지(밑줄 친 부분)가 생성이 됩니다...

1시간정도 오류를 찾고 있는데 도대체 어디가 문제인지를 모르겠네요...ㅠㅠ

답변 2개

comment.skin.php 코드

Copy
<div class="top_top2">

<a href="javascript:history.back()"><img src="<?php echo G5_THEME_IMG_URL ?>/back.png" class="back_cat"></a>

<span class="topspan">댓글</span>

</div>

 

<script>

// 글자수 제한

var char_min = parseInt(<?php echo $comment_min ?>); // 최소

var char_max = parseInt(<?php echo $comment_max ?>); // 최대

</script>

<?php if ($is_comment_write) {

if($w == '')

$w = 'c';

?>

 

<script>

var save_before = '';

var save_html = document.getElementById('bo_vc_w').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 subject = "";

var content = "";

$.ajax({

url: g5_bbs_url+"/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;

    }

}

 

<?php if($is_guest) echo chk_captcha_js(); ?>

set_comment_token(f);

document.getElementById("btn_submit").disabled = "disabled";

 

return true;

}

 

function comment_box(comment_id, work)

{

var el_id,

form_el = 'fviewcomment',

respond = document.getElementById(form_el);

 

// 댓글 아이디가 넘어오면 답변, 수정

if (comment_id)

{

if (work == 'c')

el_id = 'reply_' + comment_id;

    else

 el_id = 'edit_' + comment_id;

}

else

el_id = 'bo_vc_w';

if (save_before != el_id)

{

if (save_before)

{

document.getElementById(save_before).style.display = 'none';

}

 

document.getElementById(el_id).style.display = '';

document.getElementById(el_id).appendChild(respond);

//입력값 초기화

document.getElementById('wr_content').value = '';

// 댓글 수정

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;

 

if(save_before)

$("#captcha_reload").trigger("click");

save_before = el_id;

    }

}

 

function comment_delete()

{

return confirm("이 댓글을 삭제하시겠습니까?");

}

 

comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)

<?php if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) { ?>

$(function() {

// sns 등록

$("#bo_vc_send_sns").load(

"<?php echo G5_SNS_URL; ?>/view_comment_write.sns.skin.php?bo_table=<?php echo $bo_table; ?>",

function() {

save_html = document.getElementById('bo_vc_w').innerHTML;

            }

        );

    });

<?php } ?>

</script>

<?php } ?>

 

<!-- 댓글 리스트 -->

<section id="bo_vc">

<h2>댓글목록</h2>

<?php

for ($i=0; $i<count($list); $i++) {

//$comment_id = $list[$i]['wr_id'];

$cmt_depth = ""; // 댓글단계

$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 20;

$str = $list[$i]['content'];

if (strstr($list[$i]['wr_option'], "secret"))

$str = $str;

$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);

    ?>

<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="margin-left:0px;border-top-color:#e0e0e0;"<?php } ?>>

<header>

<h2><?php echo get_text($list[$i]['wr_name']); ?>님의 댓글<?php if ($cmt_depth) { ?><span class="sound_only">의 댓글</span><?php } ?></h2>

 

<?php

$mb_img_path = G5_DATA_PATH.'/member_image/'.substr($list[$i]['mb_id'],0,2).'/'.$list[$i]['mb_id'].'.gif';

$mb_img_url  = G5_DATA_URL.'/member_image/'.substr($list[$i]['mb_id'],0,2).'/'.$list[$i]['mb_id'].'.gif';

?>

 

<?php if (file_exists($mb_img_path)) {  ?>

<!--<a href="/bbs/user_profile.php?mb_id=<?=$list[$i]['mb_id']?>"></a>-->

<img class="img_img" src="<?php echo $mb_img_url ?>" alt="회원이미지" width="35" style="border:1px solid#ffff; border-radius:25px;margin:0 0 0 15px;">

<?php } else { ?>

<!--<a href="/bbs/user_profile.php?mb_id=<?=$list[$i]['mb_id']?>"></a>-->

<img class="no_img_img" src="/img/no_img.png" alt="회원이미지" width="35"style="border:1px solid#ffff; border-radius:25px;margin:0 0 0 15px;">

<?php }  ?>

<?php echo file_exists($list[$i]['mb_id']); ?>

<span class="name_feed2"><?php echo ($list[$i] ['wr_name'])?></span>

<span class="sound_only">작성일</span>

<span class="bo_vc_hdinfo"><?php echo passing_time($list[$i]['wr_datetime']) ?> </span>

<br>

<?php

include(G5_SNS_PATH."/view_comment_list.sns.skin.php");

?>

</header>

 

<div class="cmt_contents">

<!-- 댓글 출력 -->

<p>

<?php if (strstr($list[$i]['wr_option'], "secret")) echo "<img src=\"".$board_skin_url."/img/icon_secret.gif\" alt=\"비밀글\">"; ?>

<?php echo $str ?>

</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.'&amp;c_id='.$comment_id.'&amp;w=c#bo_vc_w';

$c_edit_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=cu#bo_vc_w';

?>

<?php } ?>

<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_del'])  { ?><li><a href="<?php echo $list[$i]['del_link'];  ?>" onclick="return comment_delete();" class="btn_b03">삭제</a></li><?php } ?>

</ul>

</div>

 

<span id="edit_<?php echo $comment_id ?>"></span><!-- 수정 -->

<span id="reply_<?php echo $comment_id ?>"></span><!-- 답변 -->

<input type="hidden" id="secret_comment_<?php echo $comment_id ?>" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>">

<textarea id="save_comment_<?php echo $comment_id ?>"style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>

</article>

<?php } ?>

<div class="bo_vc_empty2_warp">

<?php if ($i == 0 && !$is_member) { //댓글이 없다면 ?>

<img src="<?php echo G5_THEME_IMG_URL ?>/chat.png" style="width:70px; height:70px; margin:80px 0 0 130px">

<p id="bo_vc_empty2">회원만 댓글쓰기가 가능합니다.</p>

<?php } ?>

</div>

</section>

 

<div class="cat_bo">

<aside id="bo_vc_w">

<form name="fviewcomment" id="fviewcomment" action="<?php echo $comment_action_url; ?>" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off" class="bo_vc_w">

<input type="hidden" name="w" value="<?php echo $w ?>" id="w">

<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">

<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">

<input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id">

<input type="hidden" name="sca" value="<?php echo $sca ?>">

<input type="hidden" name="sfl" value="<?php echo $sfl ?>">

<input type="hidden" name="stx" value="<?php echo $stx ?>">

<input type="hidden" name="spt" value="<?php echo $spt ?>">

<input type="hidden" name="page" value="<?php echo $page ?>">

<input type="hidden" name="is_good" value="">

<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>

<textarea id="wr_content" name="wr_content" required title="댓글 내용" style="margin:0; position:fixed;z-index:10;

bottom:8px;"

<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>

placeholder="댓글쓰기"><?php echo $c_wr_content; ?></textarea>

<input type="submit" id="btn_submit" class="tc_btn_submit" value="등록">

<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script>

<?php } ?>

<div class="bo_vc_w_wr" style="width:318px">

<div class="bo_vc_w_info">

<?php if ($is_guest) { ?>

<?php echo $captcha_html; ?>

<?php } ?>

<?php

if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) {

?>

<span class="sound_only">SNS 동시등록</span>

<span id="bo_vc_send_sns"></span>

<?php } ?>

</div>

</div>

</div>

</form>

</aside>

</div>

latest.php

Copy
<?php

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

include_once(G5_LIB_PATH.'/thumbnail.lib.php');

 

$imgwidth = "600"; //표시할 이미지의 가로사이즈

$imgheight = "300"; //표시할 이미지의 세로사이즈


 

$list = array();

$sql = "SELECT * FROM g5_write_$bo_table ORDER BY rand() LIMIT 4";

$result = sql_query($sql);

for($i=0 ; $row=sql_fetch_array($result); $i++) {

$list[$i] = $row;

    }

?>

 

<script type="text/javascript" src="<?php echo $latest_skin_url ?>/slick.min.js"></script>

<link rel="stylesheet" href="<?php echo $latest_skin_url ?>/slick.css?ver=5">

<link rel="stylesheet" href="<?php echo $latest_skin_url ?>/slick-theme.css">

<link rel="stylesheet" href="<?php echo $latest_skin_url ?>/style.css">

 

<style>

.m_box_evn{float:left;width:85px;height:auto;margin-top:9px;color:#000;font-size:12px;font-weight:600;}

.tit_dicv{text-align:center;}

.wr_subject_ev2{font-size:11px;color:#808080;padding:5px 0 0 0;font-weight:300;}

.gy{height:165px;margin:0 0 0 10px;}

</style>

 

<!-- <?php echo $bo_subject; ?> 최신글 시작 { -->

<div class="gy">

    <div class="single-item slider">

    <?php for ($i=0; $i<count($list); $i++) : ?>

        <div class="slide sbox">

        <a onclick="javascript:location.href='<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>&wr_id=<?=$list[$i]['wr_id']?>'">

        <?php

            $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_mobile_gallery_width'], $board['bo_mobile_gallery_height'], false, true);

            if($thumb['src']) {

                $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';

                } else {

                $img_content = '<span class="no_image"><img src="'.G5_THEME_IMG_URL.'/sky.png"></span>';

                }

            echo $img_content;

            ?>

       </a>

 

<div class="m_box_evn">

<span class="wr_subject_ev"><?php echo $list[$i]['wr_2']; ?></span>

<p class="wr_subject_ev2"><?php echo $list[$i]['wr_1']; ?></p>

</div>

</div>

 

   <?php endfor; ?>

    <? if (count($list) == 0) { //게시물이 없을 때 ?>

    게시물이 없습니다.

    <? } ?>

    </div>

</div>

<!-- } <?php echo $bo_subject; ?> 최신글 끝 -->

<script type="text/javascript">

    $(document).on('ready', function() {

      $(".single-item").slick({

          slidesToShow: 3,

          slidesToScroll: 1,

          autoplay: false,

          autoplaySpeed: 3000,

          dots: false,

          arrows: false,

      });

    });

</script>

어떤게 오류인지 몰라서... 해당되는 파일의 소스코드를 올립니다 ...ㅠㅠ

관련 소스 없이 해당 내용만으론 오류를 알기 매우 어렵습니다.

답변을 작성하려면 로그인이 필요합니다.