Skip to content

[re] 코멘트 색깔 다르게 하기

by 하늘지기 posted Jul 07, 2003
그렇게 하기 위해서는 제로보드의 include 디렉토리 안에 있는 list_check.php 파일을 고쳐주셔야 합니다
제가 사용하고 있는 방법은 물론 제가 개발한 것이 아니구요,
옹이님, 유니님이 하신 설명을 보고 적용시킨 것입니다
다시 말해서, 완벽하게 설명드릴 자신이 없다는 얘기지요...^_^
참사랑님도 그냥 제가 쓰는 수정된 파일을 그대로 쓰시는 게 좋을 듯 합니다
제가 쓰는 파일에는 웹폰트를 사용할 경우에 한자가 제대로 출력되지 않는 문제도 해결되어 있습니다
제로보드 파일을 그대로 전달하는 것은 규칙에 어긋난다고 하니까
여기에 파일 내용 전체를 붙이겠습니다
코멘트 표시 색깔을 바꾸고 싶으시다면 107, 108줄에서 색깔만 수정하시면 될 것입니다
==============================================================================
<?

if($_list_check_included) return;
$_list_check_included = true;

/****************************************************************************************
* 한자변환함수  
***************************************************************************************/
if (!function_exists("on_change_hanja")) {
function on_change_hanja($src)
{
$strlen = strlen($src);
$change = "";
$check = 0;
for($i=0;$i<$strlen;$i++)
{
$code = ord($src[$i]);
if($code > 0xC9 && $code < 0xFE) //한자
{
if(!$check) {$check=1; $change.="<font face=돋움>"; }
$change.=$src[$i]; $i++; $change.=$src[$i];
continue;
}
else if($check) {$check =0; $change.="</font>";}
if($code < 0xA1) $change.=$src[$i];
else {$change.=$src[$i]; $i++; $change.=$src[$i];}
}
return $change;
}
}
/****************************************************************************************/


/*********************************************************************************************
* 넘겨지는 데이타에 대한 일괄 정리
********************************************************************************************/
function list_check(&$data,$view_check=0) {

global  $keyword, $sn, $ss, $sc, $setup, $member, $href, $id, $dir, $category_data, $is_admin, $_zbResizeCheck,
$name,$email,$subject, $sort, $prev_no, $no,$homepage, $memo, $hit, $vote, $ip, $comment_num, $sitelink1, $sitelink2,
$file_name1, $file_name2, $file_download1, $file_download2, $file_size1, $file_size2,
$upload_image1, $upload_image2, $category_name, $date, $reg_date, $insert, $icon, $face_image,$number,$loop_number,
$a_file_link1, $a_file_link2, $a_reply, $a_delete, $a_modify, $zbLayer,  $_zbCheckNum,
$_listCheckTime, $t_comment;

$_listCheckTimeStart = getmicrotime();
$data[subject] = on_change_hanja($data[subject]); //제목한자변환
$data[memo] = on_change_hanja($data[memo]); //내용한자변환

if($view_check) $setup[only_board]=0;  

        // 제목에 5줄로 툴바 만듬
        if($setup[use_status]) {
                $tmpData = explode("n",stripslashes($data[memo]));
                $totalCommentLineNum = count($tmpData);
                if($totalCommentLineNum>10) {
                        $showCommentStr_tail.="n".($totalCommentLineNum - 10)." lines more... (total : $totalCommentLineNum lines)";
                        $tmpData_Count = 10;
                } else $tmpData_Count = $totalCommentLineNum;
                $showCommentStr = "";
                for($i=0;$i<$tmpData_Count;$i++) {
                        $tmpStr = trim($tmpData[$i]);
                        if($tmpStr) $showCommentStr .= $tmpStr."n";
                }
                $showCommentStr = str_replace("'","",$showCommentStr);
                $showCommentStr = str_replace(""","",$showCommentStr);
                $showCommentStr .= $showCommentStr_tail;
        }        

        $_zbCount = check_zbLayer($data);
        
        // HTML 사용일 경우 현재 회원의 html 권한이 없거나 관리자가 아니라면 style 속성을 제거
        if($data[use_html]&&$data[islevel]>$setup[grant_html]) {
                $style_pattern = "/(<.*?)style=(.*?)(>?)/i";
                $data[memo]=preg_replace($style_pattern,"\1\3",$data[memo]);
        }
        

        // 검색어에 해당하는 글자를 빨간;; 색으로 바꾸어줌;;
        if($keyword) {

                $keyword_pattern = "/$keyword/i";
                
                if($sn=="on") $data[name] = preg_replace($keyword_pattern, "<font color=FF001E style=background-color:FFF000;>$keyword</font>", $data[name]);

                if($ss=="on") $data[subject] = preg_replace($keyword_pattern, "<font color=FF001E style=background-color:FFF000;>$keyword</font>", $data[subject]);

                if($ss=="on"&&$setup[cut_length]>0) $setup[cut_length]=$setup[cut_length]+52;
        }

        // ' 등의 특수문자때문에 붙인 (역슬래쉬)를 떼어낸다
        $name=$data[name]=stripslashes($data[name]);  // 이름

        $temp_name = get_private_icon($data[ismember], "2");
        if($temp_name) $name="<img src='$temp_name' border=0 align=absmiddle>";


        $subject=$data[subject]=stripslashes($data[subject]); // 제목
        //$subject=$data[subject];
        $subject=cut_str($subject,$setup[cut_length]); // 제목 자르는 부분
        $hit=$data[hit];  // 조회수
        $vote=$data[vote];  // 투표수
        
        // $comment_num="[".$data[total_comment]."]"; //간단한 답글 수
    $last_comment = mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where parent='$data[no]' order by reg_date desc limit 1"));
    $last_comment_time = $last_comment['reg_date'];
    if(time()-$last_comment_time<60*60*12) $comment_num = "<font color=orange style="cursor:hand" title="".cut_str(stripslashes($last_comment[memo]),$textlen)."">(".$data[total_comment].")</font>";
    elseif(time()-$last_comment_time<60*60*24) $comment_num = "<font color=pink style="cursor:hand" title="".cut_str(stripslashes($last_comment[memo]),$textlen)."">(".$data[total_comment].")</font>";
    else $comment_num = "(".$data[total_comment].")";

        if($data[total_comment]==0) $comment_num="";
        if($setup[use_alllist]) $view_file="zboard.php"; else $view_file="view.php";
        
        // 제목에 링크 거는 부분;
        if($member[level]<=$setup[grant_view]||$is_admin) {
                //if($setup[use_status]&&!$data[is_secret]) $addShowComment = " onMouseOver="showComment('$showCommentStr',true)" onMouseOut="showComment('',false)" ";
                if($setup[use_status]&&!$data[is_secret]) $addShowComment = " title="$showCommentStr" ";
                $subject="<a href="".$view_file."?$href$sort&no=$data[no]" $addShowComment >".$subject."</a>";
        }

        if(!$setup[only_board]) {
                $homepage=$data[homepage]=stripslashes($data[homepage]);
                if($homepage) $homepage="<a href='$homepage' target=_blank>$homepage</a>";

                // 이미지 박스 사용을 위해서 정규표현식 사용
                if($data[ismember]) {
                        $imageBoxPattern = "/[img:(.+?).(jpg|gif),align=([a-z]){0,},width=([0-9]+),height=([0-9]+),vspace=([0-9]+),hspace=([0-9]+),border=([0-9]+)]/i";
                        $data[memo]=preg_replace($imageBoxPattern,"<img src='icon/member_image_box/$data[ismember]/\1.\2' align='\3' width='\4' height='\5' vspace='\6' hspace='\7' border='\8'>", stripslashes($data[memo]));
                } else {
                        $data[memo]=stripslashes($data[memo]);
                }

                if($data[use_html]<2) $memo=$data[memo]=nl2br($data[memo]);
                $memo=$data[memo];

                // 자동링크 거는 부분;;
                if($setup[use_autolink]) $memo=autolink($memo);

                $memo .= "<!--"<-->";

                // 검색어가 있을경우 내용의 키워드를 변경
                if($sc=="on" && $keyword) {
                        $keyword_pattern = "/([^<]*)$keyword([^>]*)/i";
                        $memo = preg_replace($keyword_pattern, "\1<font color=FF001E style=background-color:FFF000;>$keyword</font>\2", $memo);
                        $keyword_pattern2 = "/<img(.*)<font color=FF001E style=background-color:FFF000;>$keyword</font>(.*)>/i";
                        $memo = preg_replace($keyword_pattern2, "<img\1$keyword\2>", $memo);
                }

                // 이미지 리사이즈를 위해서 처리하는 부분
                $memo = preg_replace("/(<img)(.*)(>?)/i","\1 name=zb_target_resize style="cursor:hand" onclick=window.open(this.src) \2 \3", $memo);
                $memo = "<table border=0 cellspacing=0 cellpadding=0 width=100% style="table-layout:fixed;"><col width=100%></col><tr><td valign=top>".$memo."</table>";
                $_zbResizeCheck = true;

                // 아이피
                if($is_admin) $ip="IP Address : ".$data[ip]." ";  

                $sitelink1=$data[sitelink1]=stripslashes($data[sitelink1]);
                $sitelink2=$data[sitelink2]=stripslashes($data[sitelink2]);
                if($sitelink1)$sitelink1="<a href='$sitelink1' target=_blank>$sitelink1</a>";
                if($sitelink2)$sitelink2="<a href='$sitelink2' target=_blank>$sitelink2</a>";
                $file_name1=$data[s_file_name1];
                $file_name2=$data[s_file_name2];
                $file_download1=$data[download1];
                $file_download2=$data[download2];
                if($file_name1) {
                        $file_size1=@GetFileSize(filesize($data[file_name1]));
                        $a_file_link1="<a href='download.php?$href$sort&no=$data[no]&filenum=1'>";
                } else {
                        $file_size1=0;
                        $a_file_link1="<Zeroboard";
                }
                if($file_name2) {
                        $file_size2=@GetFileSize(filesize($data[file_name2]));
                        $a_file_link2="<a href='download.php?$href$sort&no=$data[no]&filenum=2'>";
                } else {
                        $file_size2=0;
                        $a_file_link2="<Zeroboard";
                }
  
                $upload_image1=$upload_image2="";

                if(eregi(".jpg",$file_name1)||eregi(".gif",$file_name1)||eregi(".png",$file_name1)) $upload_image1="<img src=$data[file_name1] border=0 name=zb_target_resize style="cursor:hand" onclick=window.open(this.src)><br>";
                if(eregi(".jpg",$file_name2)||eregi(".gif",$file_name2)||eregi(".png",$file_name2)) $upload_image2="<img src=$data[file_name2] border=0 name=zb_target_resize style="cursor:hand" onclick=window.open(this.src)><br>";
        }

        // 카테고리의 이름을 구함
        if($data[category]&&$setup[use_category]) $category_name=$category_data[$data[category]];
        else $category_name=" ";

        // 글쓴 시간을 년월일 시분초 로 변환함
        $reg_date="<span title='".date("Y년 m월 d일 H시 i분 s초", $data[reg_date])."'>".date("Y.m.d", $data[reg_date])."</span>";
        $date=date("Y-m-d H:i:s", $data[reg_date]);
        
        // 폼메일을 사용하고 관련메뉴가 생성이 되면 레이어오픈
        if($_zbCount&&$setup[use_formmail]) {
                $name = "<span onMousedown="ZB_layerAction('zbLayer$_zbCheckNum','visible')" style=cursor:hand>$name</span>";
        // 폼메일을 사용안할 경우 무조건 메일링크
        } else {
                if($data[email]) $name="<a href="javascript:void(window.open('open_window.php?mode=m&str=".urlencode(base64_encode($data[email]))."','ZBremote','width=1,height=1,left=1,top=1'))">$name</a>";
                //$name="<a href="javascript:void(window.open('view_info.php?to=$email&id=$id&member_no=$data[ismember]','mailform','width=400,height=510,statusbar=no,scrollbars=yes,toolbar=no'))">$name</a>";
        }

        // Depth에 의한 들임값을 정함
        $insert="";
        if($data[depth]>15) $data[depth]=15;
        for($z=0;$z<$data[depth];$z++) $insert .="  ";

        $icon=get_icon($data);

        // 이름앞에 붙는 아이콘 정의;;
        $face_image=get_face($data);

        $number=$loop_number;

        // 바로 전에 본 글인 경우 번호를 아이콘으로 바꿈
        if($prev_no==$data[no]) $number="<img src=$dir/arrow.gif border=0 align=absmiddle>"; elseif($number!=" ") $number=$loop_number;

        // 답글 버튼
        if(($is_admin||$member[level]<=$setup[grant_reply])&&$data[headnum]>-2000000000&&$data[headnum]!=-1) $a_reply="<a href='write.php?$href$sort&no=$data[no]&mode=reply'>";
        else $a_reply="<Zeroboard";

        // 삭제버튼
        if(($is_admin||$member[level]<=$setup[grant_delete]||$data[ismember]==$member[no]||!$data[ismember])&&!$data[child]) $a_delete="<a href='delete.php?$href$sort&no=$data[no]'>";
        else $a_delete="<Zeroboard";

        // 수정버튼
        if(($is_admin||$member[level]<=$setup[grant_delete]||$data[ismember]==$member[no]||!$data[ismember])) $a_modify="<a href='write.php?$href$sort&no=$data[no]&mode=modify'>";
        else $a_modify="<Zeroboard";

        // 스팸메일러 금지
        $mail=$data[email]="";

        $_listCheckTime += getmicrotime() - $_listCheckTimeStart;
}
?>

Who's 하늘지기

profile


| 나에게 거짓말을 하지 말고

| 남에게 빈말을 하지 말자

Comment '5'
  • ?
    2003.07.07 17:44
    이대로 카피해서 바꿔주면 되나요?
    전체를요?
  • profile
    하늘지기 2003.07.07 17:47
  • ?
    2003.07.07 17:49
    네에~!!
  • ?
    2003.07.07 17:57
    참.... 가져가두 되죠?
    통째로...ㅎ
    단, 출처는 밝히겠습니다.
    앗 안된다구요?..... 이런 벌써 가져간걸요.. ^^;;
  • profile
    하늘지기 2003.07.07 20:05
    출처 밝히시지 마세요...ㅡㅡ
    통째로 긁어가시라고 저렇게 올린 것입니다
문서 첨부 제한 : 0Byte/ 5.00MB
파일 크기 제한 : 5.00MB (허용 확장자 : *.*)

고공닷컴 자유게시판

로그인 없이, 비밀글도 올릴 수 있습니다. 강의 관련 질문은 [강의실 통합질문게시판]으로~

List of Articles
번호 제목 글쓴이 날짜 조회 수
» [re] 코멘트 색깔 다르게 하기 5 하늘지기 2003.07.07 1080
1508 [re] 토요일 서울로 와라! 2 하늘지기 2002.10.02 577
1507 [re] 할배, too ~* 하늘지기 2002.12.29 281
1506 [re] 햐... 저도 인라인 하늘지기 2003.04.14 246
1505 [re] 형, 한 잔 하셨나....? 하늘지기 2002.05.14 448
1504 [re] 형아! 하늘지기 2002.08.01 618
1503 [re] 형이라... 하늘지기 2003.02.24 266
1502 [re] 후후후 하늘지기 2003.04.23 600
1501 [re] 후훗~* 하늘지기 2002.12.17 303
1500 [re]이소스 함 보시고 해보세요~ 1 welly 2003.12.20 333
1499 [공연] 유미리 소릿길 30 ‘판’ 권은혜 2006.12.07 1105
1498 [국립극장] 2013 여우락(樂) 페스티벌 국립극장 2013.06.27 3024
1497 [문의] 글자가 이렇게 깨지는데, 왜 그런건가요? 10 風雲公子 2007.08.10 1394
1496 [상설무대우리소리] 꿈틀2010오디션 안내 꿈틀2010 2009.10.26 4216
Board Pagination Prev 1 ... 9 10 11 12 13 14 15 16 17 18 ... 121 Next
/ 121

Gogong.com All Rights Reserved.

Powered by Xpress Engine / Designed by Sketchbook

sketchbook5, 스케치북5

sketchbook5, 스케치북5