0){ if ($member['community_point'] + $board_config['read_point'] < 0 && $config['community_point']) alert($LANG_BOARD['47'], "./list.php?board_name=$board_name{$query_str}"); } if (!$write_tbl['id']) //글이 없으면 go_url($LANG_BOARD[10],"./list.php?board_name=$board_name",$LANG_BOARD[10]); if (($write_tbl['member_id'] && $write_tbl['member_id'] == $member['id']) || $is_admin) // 본인글이거나 관리자 ; else{ if (strstr($write_tbl['reg_option'], "secret")) { $is_owner = false; if ($write_tbl['reply'] && $member['id']) // 답변여부 { //원글 $sql = " select member_id from $board_tbl where num = '$write_tbl[num]' and reply = '' and is_comment = '0' "; $row = sql_fetch($sql); if ($row['member_id'] == $member['id']) $is_owner = true; } $view_ss="{$board_name}_{$write_tbl['num']}"; $view_ss_val=md5("$view_ss.{$config[random_key]}"); if (!$is_owner) if (!get_session($view_ss) && $view_ss_val!=get_session($view_ss)) go_url("","./password.php?w=v&board_name=$board_name&view_id=$view_id{$query_str}",$LANG_BOARD[11]); set_session($view_ss,$view_ss_val); } if (!get_session("{$board_name}_{$view_id}")) // 글번호 세션 저장 { sql_query(" update $board_tbl set hit = hit + 1 where id = '$view_id' "); set_session("{$board_name}_{$view_id}", true); // 뷰 포인트 차감 community_point($member_id,$board_config['subject']." ".$LANG_BOARD[40],$board_config['read_point'],$view_id,$board_tbl,"board_view"); } } // 이전글 $sql_search =search_board($search_text,$search_flag,$category,$search_oper); if ($sql_search) $sql_search = " and " . $sql_search; $sql = " select id, subject from $board_tbl where is_comment = 0 and num = '$write_tbl[num]' and reply < '$write_tbl[reply]' $sql_search order by num desc, reply desc limit 1 "; $prev = sql_fetch($sql); if (!$prev[id]) { $sql = " select id, subject from $board_tbl where is_comment = 0 and num < '$write_tbl[num]' $sql_search order by num desc, reply desc limit 1 "; $prev = sql_fetch($sql); } // 다음글 $sql = " select id, subject from $board_tbl where is_comment = 0 and num = '$write_tbl[num]' and reply > '$write_tbl[reply]' $sql_search order by num, reply limit 1 "; $next = sql_fetch($sql); if (!$next[id]) { $sql = " select id, subject from $board_tbl where is_comment = 0 and num > '$write_tbl[num]' $sql_search order by num,reply limit 1 "; $next = sql_fetch($sql); } //print_r($write_tbl); $view=array(); $view=board_row_get($write_tbl,$board_config,$query_str); $file_array=array(); $file_array=$view['file']; $TPL->assign('FILE_LOOP', $file_array); // 트랙백 $trackback_url = "{$host}main/board/tb.php?no=$board_name&id=$view_id"; $trackback="$trackback_url"; if(!$board_config['use_list_content']){ $view['content']=scanXss(table_count_match($write_tbl['content'])); preg_match_all('/]+>/i', $view['content'],$match); $match_count=count($match[0]); for ($i=0; $i < $match_count; $i++) { $src=$match[0][$i]; preg_match_all('@(?P[^\s\'\"]+)\s*=\s*(\'|\")?(?P[^\s\'\"]+)(\'|\")?@i', $src, $sub_match); $img = array_change_key_case(array_combine($sub_match['attribute'], $sub_match['value'])); $get_size=false; if(isset($img['width']) == false) { list($img['width']) =@getimagesize(str_replace($host,$root,$img['src'])); $get_size=true; } if($img['width'] > $board_config['image_width']) { if($get_size){ $src2= preg_replace("/>$/", " width=\"$board_config[image_width]\">", $src); }else{ $src2=preg_replace('/width\=(\'|\")?[0-9]+(\'|\")?/i', 'width=' . $board_config['image_width'], $src); } $src2= preg_replace('/height\=(\'|\")?[0-9]+(\'|\")?/i', null, $src2); $view['content']=str_replace($src,$src2,$view['content']); } unset($img); } } $TPL->assign('SUBJECT',$view['subject']); // 제목 $TPL->assign('CONTENT',$view['content']); // 내용 $TPL->assign('NAME',$view['name']); // 닉네임 $TPL->assign('TAG',$view['tag']); // 테그 $TPL->assign('HIT',$view['hit']); // 조회수 $TPL->assign('DATE',$view['datetime']); // 작성일 $TPL->assign('EMAIL',$view['email']); // email $TPL->assign('GOOD',$view['good']); // 추천수 $TPL->assign('NOGOOD',$view['nogood']); // 비추천 $TPL->assign('HOMEPAGE',$view['homepage']); // 홈페이지 $TPL->assign('CATENAME',$view['ca_name']); // 분류 $TPL->assign('TRACKBACK',$trackback); // 트랙백 주소 $ip=$view['ip']; // ip $subject=$view['subject']; /* 사용자 추가 필드 */ for($i=1;$i<=10;$i++){ $TPL->assign("ADD_FIELD".$i."_NAME",$board_config['field'.$i.'_name']); $TPL->assign("ADD_FIELD".$i."_USED",$board_config['field'.$i.'_used']); $field_val=$view['add_field'.$i]; $TPL->assign("ADD_FIELD".$i."_VAL",$field_val); } /* 사용자 추가 필드 끝 */ $TPL->assign('LINK1', $view['link']['1']); $TPL->assign('LINK2', $view['link']['2']); unset($view); $TPL->assign('IP', $ip); // 추천 if ($board_config['use_good']) $TPL->assign('IS_GOOD', true); // 비추천 if ($board_config['use_nogood']) $TPL->assign('IS_NOGOOD', true); $total_count = $board_config['count_write']; $TPL->assign('TOTAL_COUNT',$total_count); //전체 건수 // 이전글 $prev_href = ""; if ($prev[id]) { $prev_subject = strip_tags($prev['subject']); $prev_href = "./view.php?board_name=$board_name&view_id=$prev[id]" . $query_str; $TPL->assign('PREV_HREF',$prev_href); $TPL->assign('PREV_HREF_TITLE',$prev_subject); } // 다음글 $next_href = ""; if ($next[id]) { $next_subject = strip_tags($next['subject']); $next_href = "./view.php?board_name=$board_name&view_id=$next[id]" . $query_str; $TPL->assign('NEXT_HREF',$next_href); $TPL->assign('NEXT_HREF_TITLE',$next_subject); } /* comment */ $TPL->assign('IS_COMMENT_VIEW', $board_config['use_comment']); if($board_config['use_comment']){ $is_comment_write = false; if ($member['level'] >= $board_config['comment_level']) $is_comment_write = true; $TPL->assign('IS_COMMENT_WRITE', $is_comment_write); $sql = " select * from $board_tbl where parent = '$view_id' and is_comment = 1 order by reg_comment, comment_reply "; $result= sql_query($sql); $comment_list=array(); $json=array(); $board_url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; for ($i=0; $row= sql_fetch_array($result); $i++) { $comment_list[$i]=board_row_get($row,$board_config,$query_str); unset($comment_list[$i]['link']); unset($comment_list[$i]['link_href']); unset($comment_list[$i]['link_hit']); $content=scanXss(table_count_match($row['content'])); $comment_list[$i]['content'] = $LANG_BOARD['37']; if (!strstr($row['reg_option'], "secret") || $is_admin || ($write_tbl['member_id']==$member['id'] && $member['id']) || ($row['member_id']==$member['id'] && $member['id'])) { $comment_list[$i]['content'] =$content; $comment_list[$i]['content_cut'] =cut_str(strip_tags($content),30); $content2 = cut_str(strip_tags($content),80); $tw= $content2." ".$board_url; $tw = urlencode($tw); $home_page_title=urlencode($config['title_tag']); $me_subject=urlencode($subject); $encode_me_url=urlencode($board_url); $encode_me_content=urlencode($content2); $comment_list[$i]['twitter']="http://twitter.com/home/?status=$tw"; $comment_list[$i]['facebook']="http://www.facebook.com/sharer.php?u=$encode_me_url&t=$encode_me_content"; $comment_list[$i]['me2day']="http://me2day.net/posts/new?new_post[body]=$encode_me_content+++++++[$home_page_title:$encode_me_url+]&new_post[tags]=$me_subject"; $comment_list[$i]['yozm']="http://yozm.daum.net/api/popup/prePost?sourceid=41&link=$encode_me_url&prefix=$encode_me_content"; } $cmt_id="comment_seq_".$i; $comment_list[$i]['seq']=$cmt_id; $comment_list[$i]['reply_btn']="onclick=\"comment_box_position_reply('$cmt_id','$row[id]','$board_name'); return false;\" onkeypress=\"comment_box_position_reply('$cmt_id','$row[id]','$board_name'); return false;\" "; $comment_list[$i]['modify_btn']="onclick=\"comment_box_position_modify('$cmt_id','$row[id]','$board_name'); return false;\" onkeypress=\"comment_box_position_modify('$cmt_id','$row[id]','$board_name'); return false;\" "; $comment_list[$i]['cmt_is_reply'] = false; $comment_list[$i]['cmt_is_edit'] = false; $comment_list[$i]['cmt_is_del'] = false; if ($is_comment_write || $is_admin){ if (($member['id'] && ($member['id'] == $row['member_id'])) || $is_admin) { $comment_list[$i]['cmt_del_href'] = "./password.php?w=cd&board_name=$board_name&view_id=$view_id&comment_id=$row[id]" . $query_str; $comment_list[$i]['cmt_is_edit'] = true; $comment_list[$i]['cmt_is_del'] = true; }else if (!$row['member_id']){ $comment_list[$i]['cmt_del_href'] = "./password.php?w=cd&board_name=$board_name&view_id=$view_id&comment_id=$row[id]" . $query_str; $comment_list[$i]['cmt_is_del'] = true; } if (strlen($row['comment_reply']) < 4) $comment_list[$i]['cmt_is_reply'] = true; } $json[$row['id']]['content']=$comment_list[$i]['content']; $json[$row['id']]['name']=$comment_list[$i]['name']; $json[$row['id']]['secret']=false; $json[$row['id']]['email']=false; if (strstr($row['reg_option'], "secret")){ $json[$row['id']]['secret']=true; } if (strstr($row['reg_option'], "email")){ $json[$row['id']]['secret']=true; } } $json_data= json_encode($json); // 수정 데이터용 //print_r($comment_list); $TPL->assign('COMMENT_COUNT', count($comment_list)); $TPL->assign('COMMENT_LOOP', $comment_list); $editor_height = 100; // 에디터 높이 $header_file.="\n"; $content=" "; // 일단 에디터 사용 금지 오류가 있음 //$content=" "; //$TPL->assign('COMMENT_CONTENT', "
".$content."
"); $TPL->assign('COMMENT_CONTENT', $content); $token1=md5(uniqid(rand(), true)); set_session('token1',$token1); $start="
"; $end="
\n"; $TPL->assign('START', $start); // 폼 시작 $TPL->assign('END', $end); // 폼 끝 $TPL->assign('COMMENT_NAME',"comment_name"); // 코멘트 네임 $TPL->assign('COMMENT_PW',"comment_pw"); // 코멘트 비번 if(!$is_member){ // 비회원 $spam="\"$LANG_MEMBER[8]\""; $TPL->assign('SPAM_IMG', $spam); // 캡챠 이미지 $TPL->assign('SPAM_ID', "spam_id"); // 캡챠 입력ID $TPL->assign('IS_SPAM', true); } if($board_config['use_secret'] && $is_member){ // 비밀글 사용 여부 $TPL->assign('OPT_SECRET'," "); } if ($board_config['use_email'] && $is_member){ // 답변 메일 사용 여부 $TPL->assign('OPT_EMAIL'," "); } $TPL->assign('REG_BTN', "id=\"comment_btn\" onclick=\"board_comment_write(); return false;\" onkeypress=\"board_comment_write(); return false;\""); // 등록버튼 $header_file.=" "; }// end comment end; /* comment end */ /* 뷰 */ $board_body="/skin_list/$view_code/$skin_tpl/$boardskin_type/view.html"; Skin_Layout($board_name); $TPL->assign("HEAD", $header_file); $TPL->define(array("MODULE"=>$board_body)); $board_top="/skin_list/$view_code/$skin_tpl/design/{$board_name}_view_top.html"; if(is_file($root.$board_top) && !defined("_ADMIN_")){ $TPL->define(array('BOARD_TOP'=>$board_top)); }else{ $TPL->define(array('BOARD_TOP'=>"main/empty.html")); } if (defined("_ADMIN_")){ $frames['BODY']=$frames['BODY']="main/empty_self.html"; $TPL->define($frames); echo $header_file; } $TPL->print_("BODY"); ?>