이 게시판 소스에서 코멘트에 레벨아이콘이 나오게 하는 방법 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

이 게시판 소스에서 코멘트에 레벨아이콘이 나오게 하는 방법 정보

이 게시판 소스에서 코멘트에 레벨아이콘이 나오게 하는 방법

본문

이소스입니다 코멘트에 레벨아이콘 나오게 하는방법좀 알려주세요


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

$colist = array();

if($is_admin)set_session("ss_delete_token", $token = uniqid(time()));
?>

<style>
.line { background-color:#DDDDDD; height:1px; }
.bnum { font:bold 18px Georgia; color:333333; margin-right:10px; }

.c_name { color:#aaaaaa; text-decoration:none; font-size:8pt; }
.c_date { color:#aaaaaa; font-family:tahoma; }
</style>

<script language="JavaScript">
// 글자수 제한
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>


<!-- 게시판 리스트 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0">
<tr><td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><td colspan="6" align="right" style="padding:5px;">
<? if ($write_href) { ?><a href="<?=$write_href?>">새로운 글 작성</a><? } ?>
</td></tr>

<?
for($i= 0; $i< count($list); $i++){
        $wr_id= $list[$i][wr_id];

        $write = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
        $view = get_view($write, $board, $board_skin_path, 255);
        if (strstr($sfl, "subject"))
                $view[subject] = search_font($stx, $view[subject]);

        $html = 0;
        if (strstr($view[wr_option], "html1"))
                $html = 1;
        else if (strstr($view[wr_option], "html2"))
                $html = 2;

        $view[content] = conv_content($view[wr_content], $html);
        if (strstr($sfl, "content"))
                $view[content] = search_font($stx, $view[content]);
        $view[content] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1 name='target_resize_image[]' onclick='image_window(this)' style='cursor:pointer;' \\2 \\3", $view[content]);

        $view[rich_content] = preg_replace("/{이미지\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);
?>

<!-- 본문 리스트 -->
        <tr><td height="25" colspan="5" style="padding-left:5px;">
<a name="c_<?=$wr_id?>"></a>
                <span class=bnum>|<?= abs($list[$i][num]) ?>|<?=$list[$i][subject]?></span>
<!-- use element of num instead of wr_num to increase numbers in order -->
<!-- also change the link title below, wr_num to num, line 70 -->
                <b style="font-size:11px;"><?=$list[$i][datetime]?></b>

        </td><td align="right" style="padding-right:5px;">

                <? if (($member[mb_id] && ($member[mb_id] == $list[$i][mb_id])) || $is_admin) { ?>
                <a href="./write.php?w=u&bo_table=<?=$bo_table?>&wr_id=<?=$wr_id?>&page=<?=$page?>" class="write">+수정하기</a>
                <a href="javascript:if (confirm('Are you sure to delete?')) { location='./delete.php?w=d&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&page=<?=$page?>&token=<?=$token?>';}" class="write">-삭제하기</a>
                <? } ?>

        </td></tr>
        <tr><td colspan="6" class="line"></td></tr>
        <tr style="cursor:pointer;_cursor:hand;" title="클릭하면 코멘트를 달수있습니다!" onClick="javascript:list_box('<?=$wr_id?>', 'r');"><td colspan="6" style="padding:5px 5px 0 5px;">

        <div class="writeContents">
<!-- 비밀글 걸러내기 -->
<?
if ( strstr($list[$i][wr_option], "secret") && ($member[mb_id] != $list[$i][mb_id]) ) {
echo "<span class='small' style='color:#ff6600;'>비밀글 입니다</span>";
}
else { ?>
                <!-- 첨부파일 표시 -->
                <?
if(!strstr($view[wr_1], "invisible")){
                if(count($view[file])> 1){
                        echo "<div class='contentsInfo'>";
                        // 가변 파일
                        $acnt = 0;
                        for ($ai=0; $ai<count($view[file]); $ai++) {
                                if ($view[file][$ai][source] && !$view[file][$ai][view]) {
                                        $acnt++;
                                        echo "#Attached File{$acnt}:";
echo "<a href=\"javascript:file_download('{$view[file][$ai][href]}', '".urlencode($view[file][$ai][source])."');\" title='{$view[file][$ai][content]}'>";
                                        echo "&nbsp;<span style=\"color:#888;\">{$view[file][$ai][source]} ({$view[file][$ai][size]})</span>";
                                        echo "</a><br />";
                                }
                        }

                        // 파일 출력
                        for ($ai=0; $ai<=count($view[file]); $ai++) {
                                if ($view[file][$ai][view])
                                        echo $view[file][$ai][view] . "<br />";
                        }
                        echo "</div>";
                }
}
                ?>
                <!-- 첨부파일 표시 끝 -->

                <?= $view[content] ?>

<? } ?>
<!-- 비밀글 걸러내기 끝 -->
        </div>

        </td></tr>
<!-- 본문 리스트 끝 -->

<!-- 본문 댓글쓰기 -->
        <tr><td colspan="6">
                <span id='reply_<?=$wr_id?>' style='display:none; width:100%; padding:5;'></span>
                <span id='edit_<?=$wr_id?>' style='display:none; width:100%; padding:5;'></span>
        </td></tr>
<!-- 본문 댓글쓰기 끝 -->

<tr><td colspan="6" style="padding:30 0 30 30;line-height:1.6em">
<!-- 코멘트 리스트 -->
<?
$cosql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
$coresult = sql_query($cosql);

for ($ii=0; $corow=sql_fetch_array($coresult); $ii++)
{
    $colist[$ii] = $corow;

    $cotmp_name = get_text(cut_str($corow[wr_name], $config[cf_cut_name])); // 설정된 자리수 만큼만 이름 출력
    if ($board[bo_use_sideview])
        $colist[$ii][name] = get_sideview($corow[mb_id], $cotmp_name, $corow[wr_email], $corow[wr_homepage]);
    else
        $colist[$ii][name] = "<span class='".($corow[mb_id]?'member':'guest')."'>$cotmp_name </span>";



    // 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)

    $c_secret_f= 1;
    $colist[$ii][content] = $colist[$ii][content1]= "비밀글 입니다";
    if (!strstr($corow[wr_option], "secret") ||
        $is_admin ||
        ($write[mb_id]==$member[mb_id] && $member[mb_id]) ||
        ($corow[mb_id]==$member[mb_id] && $member[mb_id])) {
$c_secret_f= 0;
        $colist[$ii][content1] = $corow[wr_content];
        $colist[$ii][content] = conv_content($corow[wr_content], 0, 'wr_content');
        $colist[$ii][content] = search_font($stx, $colist[$ii][content]);
    }

    $colist[$ii][trackback] = url_auto_link($corow[wr_trackback]);
    $colist[$ii][datetime] = substr($corow[wr_datetime],0,16);

    // 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
    $colist[$ii][ip] = $corow[wr_ip];
    if (!$is_admin)
        $colist[$ii][ip] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $corow[wr_ip]);

    $colist[$ii][is_reply] = false;
    $colist[$ii][is_edit] = false;
    $colist[$ii][is_del]  = false;
    if ($is_comment_write || $is_admin)
    {
        if ($member[mb_id])
        {
            if ($corow[mb_id] == $member[mb_id] || $is_admin)
            {
                $colist[$ii][del_link]  = "./delete_comment.php?bo_table=$bo_table&comment_id=$corow[wr_id]&cwin=$cwin&page=$page&token=$token".$qstr;
                $colist[$ii][is_edit]  = true;
                $colist[$ii][is_del]    = true;
            }
        }
        else
        {
            if (!$corow[mb_id]) {
                $colist[$ii][del_link] = "./password.php?w=x&bo_table=$bo_table&comment_id=$corow[wr_id]&cwin=$cwin&page=$page".$qstr;
                $colist[$ii][is_del]  = true;
            }
        }

        if (strlen($corow[wr_comment_reply]) < 5)
            $colist[$ii][is_reply] = true;
    }

    // 05.05.22
    // 답변있는 코멘트는 수정, 삭제 불가
    if ($ii > 0 && !$is_admin)
    {
        if ($corow[wr_comment_reply])
        {
            $tmp_comment_reply = substr($corow[wr_comment_reply], 0, strlen($corow[wr_comment_reply]) - 1);
            if ($tmp_comment_reply == $colist[$ii-1][wr_comment_reply])
            {
                $colist[$ii-1][is_edit] = false;
                $colist[$ii-1][is_del] = false;
            }
        }
    }

    $t_name= $colist[$ii][name];
    $t_content= $colist[$ii][content];
    $t_date= $colist[$ii][datetime];
    $t_id= $colist[$ii][wr_id];

    echo "<div style='padding:5 10 10 10;text-align:justify;'>";
    for ($tc= 0; $tc< strlen($colist[$ii][wr_comment_reply]); $tc++) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    if($c_secret_f)
    echo "<span class='small' style='color:#ff6600;'>$t_content</span> <span class='c_date'>$t_date</span>";
    else {
if ($colist[$ii][wr_homepage]) { echo "<a href=\"http://{$colist[$ii][wr_homepage]}\">"; }
else if ($colist[$ii][wr_email]) { echo "<a href=\"mailto:{$colist[$ii][wr_email]}\">"; }
else {echo "<a name=\"\">"; }
    echo "<span class='c_name'><NOBR>$t_name</NOBR></span></a>&nbsp;&nbsp;<span class='c_date'>$t_date</span>";
    if ($colist[$ii][is_del])
    echo "&nbsp; <a href=\"javascript:comment_delete('{$colist[$ii][del_link]}');\" class='write'>-삭제하기</a> ";
if(strstr($corow[wr_option], "secret"))
echo "<span style='color:#ff6600;'><br />$t_content";
else
echo "<br />$t_content";
    }
    echo "</div>";
}
?>
<!-- 코멘트 리스트 끝 -->
&nbsp;</td></tr>

<?      } // 전체 루프끝 ?>

<? if (count($list) == 0) { ?>
        <tr><td height="100" align="center">There's no article related.</td></tr>
<? } ?>

        </table>

<!-- 페이지 표시 시작 -->
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <? if ($write_pages || $prev_part_href || $next_part_href ) { ?>
        <tr><td height="25" align="center">
                <? if ($prev_part_href) { echo "<a href='$prev_part_href'>prev</a>"; } ?>
        <?
        // 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.
        //echo $write_pages;
        $write_pages = str_replace("처음", "<img src='$board_skin_path/img/begin.gif' border='0' align='absmiddle' title='begin'>", $write_pages);
        $write_pages = str_replace("이전", "<img src='$board_skin_path/img/prev.gif' border='0' align='absmiddle' title='prev'>", $write_pages);
        $write_pages = str_replace("다음", "<img src='$board_skin_path/img/next.gif' border='0' align='absmiddle' title='next'>", $write_pages);
        $write_pages = str_replace("맨끝", "<img src='$board_skin_path/img/end.gif' border='0' align='absmiddle' title='end'>", $write_pages);
        $write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><span style=\"color:#4D6185; font-size:12px; text-decoration:underline;\">$1</span></b>", $write_pages);
        ?>
                <?=$write_pages?>
                <? if ($next_part_href) { echo "<a href='$next_part_href'>more...</a>"; } ?>
        </td></tr>
        <? } ?>
        </table>
<!-- 페이지 표시 끝 -->

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

<!-- 댓글쓰기 양식 -->
<span id=list_write style="display:inline; width:100%; padding:10;">
<table width=100% border=0 cellpadding=1 cellspacing=0><tr><td>
<form name="fwrite" method="post" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" autocomplete="off">
<input type=hidden name=w          id=list_w value='c'>
<input type=hidden name=bo_table    value='<?=$bo_table?>'>
<input type=hidden name=wr_id      id=list_id value='<?=$wr_id?>'>
<input type=hidden name=wr_subject value="<?=$subject?>">
<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 cellspacing=0>
<tr>
    <td valign="bottom" style="padding:5px 0 0 5px;">
        <? if ($is_guest) { ?>
            name <INPUT type=text maxLength=20 size=10 name="wr_name" itemname="이름" class=ed>
            contact <INPUT type=text size=10 name="wr_password" itemname="패스워드" class=ed>
        <? } ?>
        비밀글<input type=checkbox id="wr_secret" name="wr_secret" value="비밀글">
        <? if ($comment_min || $comment_max) { ?><span id=char_count></span>characters<?}?>
    </td>
    <td valign="bottom" align="right">
        <? if ($is_guest) { ?>
        <img id='kcaptcha_image' border='0' width=120 height=60 title="Refresh the page if not working">
        <input title="Type the left characters" type="input" name="wr_key" size="10" itemname="자동등록방지" class=ed>
        <?}?>
        <span style="cursor: pointer;" onclick="textarea_decrease('list_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_up.gif" border='0'></span>
        <span style="cursor: pointer;" onclick="textarea_original('list_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_init.gif" border='0'></span>
        <span style="cursor: pointer;" onclick="textarea_increase('list_content', 4);"><img src="<?=$board_skin_path?>/img/co_btn_down.gif" border='0'></span>
    </td>
</tr>
<tr>
    <td colspan="2">
        <textarea id="list_content" name="wr_content" rows=4 itemname="내용"
        <? if ($comment_min || $comment_max) { ?>onkeyup="check_byte('list_content', 'char_count');"<?}?> style='width:100%;' class=tx></textarea>
        <? if ($comment_min || $comment_max) { ?><script type="text/javascript"> check_byte('list_content', 'char_count'); </script><?}?>
        <div style="float:right;"><input type="submit" value="작성하기" border=0 accesskey='s'></div>
    </td>
</tr>
</table>
</form>
</td></tr></table>
<!-- 댓글쓰기 양식 끝 -->

<script type="text/javascript">
function file_download(link, file) {
    <? if ($board[bo_download_point] < 0) { ?>if (confirm("'"+decodeURIComponent(file)+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board[bo_download_point])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))<?}?>
    document.location.href=link;
}
</script>

<script type="text/javascript" src="<?="$g4[path]/js/board.js"?>"></script>
<script type="text/javascript">
window.onload=function() {
    resizeBoardImage(<?=(int)$board[bo_image_width]?>);
    drawFont();
}
</script>

<script type="text/javascript"> var md5_norobot_key = ''; </script>
<script type="text/javascript" src="<?="$g4[path]/js/prototype.js"?>"></script>
<script type="text/javascript">
function comment_delete(url)
{
    if (confirm("Are you sure to delete the comment?")) location.href = url;
}
</script>

<?
if (!$member[mb_id])
    echo "<script language='javascript' src='$g4[path]/js/md5.js'></script>\n";

echo "<script language='javascript'> var g4_cf_filter = '$config[cf_filter], '; </script>\n";
echo "<script language='javascript' src='$g4[path]/js/filter.js'></script>\n";
?>

<script type="text/javascript">
function imageClick() {
    var url = "<?=$g4[bbs_path]?>/kcaptcha_session.php";
    var para = "";
    var myAjax = new Ajax.Request(
        url,
        {
            method: 'post',
            asynchronous: true,
            parameters: para,
            onComplete: imageClickResult
        });
}

function imageClickResult(req) {
    var result = req.responseText;
    var img = document.createElement("IMG");
    img.setAttribute("src", "<?=$g4[bbs_path]?>/kcaptcha_image.php?t=" + (new Date).getTime());
    document.getElementById('kcaptcha_image').src = img.getAttribute('src');

    md5_norobot_key = result;
}

<? if (!$member[mb_id]) { ?>Event.observe(window, "load", imageClick);<? } ?>

var old_id, new_id;
var save_html = document.getElementById('list_write').innerHTML;

function list_box(list_id, work)
{
imageClick();

        if (list_id){
                if (work == 'r')
                    new_id = 'reply_' + list_id;
                else
                    new_id = 'edit_' + list_id;
        }
        else
                new_id = 'list_write';

        if (old_id == new_id) {
                var mode = document.getElementById(new_id).style.display;
                if (mode == 'inline') {
                        document.getElementById(new_id).style.display = 'none';
                }
                else {
                        document.getElementById(new_id).style.display = 'inline';
                }
        }
        else {
                if (old_id){
                        document.getElementById(old_id).style.display = 'none';
                        document.getElementById(old_id).innerHTML = '';
                }

                document.getElementById(new_id).style.display = 'inline';
                document.getElementById(new_id).innerHTML = save_html;

                if (work == 'u'){
                        document.getElementById('list_content').value = document.getElementById('save_content_' + list_id).value;
                        var commentObj = eval("document.getElementById('comment_" + list_id + "')");

                        if(commentObj != null)
                                if(commentObj.style.display == 'none')  commentObj.style.display = 'inline';

                        else
                                commentObj.style.display = 'none';
                }

                document.getElementById('list_id').value = list_id;
                document.getElementById('list_w').value = 'c';
                old_id = new_id;
        }
}

list_box('', '');
new_id = 'list_write';
document.getElementById(new_id).style.display = 'none';

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("prohibited word:"+content+" included");
        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("are you trying to say something with a black?");
        return false;
    }

    if (typeof(f.wr_name) != 'undefined')
    {
        f.wr_name.value = f.wr_name.value.replace(pattern, "");
        if (f.wr_name.value == '')
        {
            alert('name field required');
            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('contact field required');
            f.wr_password.focus();
            return false;
        }
    }

    if (!check_kcaptcha(f.wr_key)) {
        return false;
    }

    return true;
}
</script>

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT