This commit is contained in:
Amberstone 2024-10-18 11:18:51 +09:00
commit 1aa77a0ada
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
11 changed files with 1945 additions and 0 deletions

31
day/lunar.txt Normal file
View file

@ -0,0 +1,31 @@
<?php // 음력 절기 파일, 기념일 추가시 else if 구문 복사해서 사용하세요. 한자리 날짜는 한자리로 써야 합니다.
if ( $myarray[month].'/'.$myarray[day]=="1/15" ) $annivmoonday="<font color=blue>대보름</font>" ;
else if ( $myarray[month].'/'.$myarray[day]=="12/30" ) {
$annivmoonday="<font color=red>설연휴</font>" ; $daycolor=red ;}
else if ( $myarray[month].'/'.$myarray[day]=="1/1" ) {
$annivmoonday="<img src='{$board_skin_url}/img/bull_26.gif' align=absmiddle><font color=red>설날</font>" ;
$daycolor=red ;}
else if ( $myarray[month].'/'.$myarray[day]=="1/2" ) {
$annivmoonday="<font color=red>설연휴</font>" ; $daycolor=red ;}
else if ( $myarray[month].'/'.$myarray[day]=="4/8" ) {
$annivmoonday="<font color=red>석가탄신일</font>" ; $daycolor=red; }
else if ( $myarray[month].'/'.$myarray[day]=="5/5" )
$annivmoonday="<font color=blue>단오</font>" ;
else if ( $myarray[month].'/'.$myarray[day]=="8/14" ) {
$annivmoonday="<font color=red>추석연휴</font>" ; $daycolor=red ;}
else if ( $myarray[month].'/'.$myarray[day]=="8/15" ) {
$annivmoonday="<img src='{$board_skin_url}/img/bull_26.gif' align=absmiddle><font color=red>추석</font>" ;
$daycolor=red ;}
else if ( $myarray[month].'/'.$myarray[day]=="8/16" ) {
$annivmoonday="<font color=red>추석연휴</font>" ; $daycolor=red ;}
else $annivmoonday="" ;
?>

22
day/solar.txt Normal file
View file

@ -0,0 +1,22 @@
[양력 기념일] 형식 : 날짜(4자리) | 명칭 | 글자색 (공휴일은 red 로 표기)
0101|신정|red
0130|대체휴일|red
0214|발렌타인데이|blue
0301|삼일절|red
0314|화이트데이|blue
0405|식목일|blue
0501|근로자의날|red
0505|어린이날|red
0508|어버이날|blue
0515|스승의날|blue
0518|518기념일|blue
0606|현충일|red
0625|6.25 한국전쟁|blue
0717|제헌절|blue
0815|광복절|red
1001|국군의날|blue
1003|개천절|red
1006|대체휴일|red
1009|한글날|red
1225|성탄절|red
#빈줄삽입

366
list.skin.php Normal file
View file

@ -0,0 +1,366 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
//include_once($board_skin_path."/moonday.php"); // 석봉운님의 음력날짜 함수
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
if (preg_match('/%/', $width)) {
$col_width = "14%"; //표의 가로 폭이 100보다 크면 픽셀값입력
} else{
$col_width = round($width/7); //표의 가로 폭이 100보다 작거나 같으면 백분율 값을 입력
}
$col_height= 80 ;//내용 들어갈 사각공간의 세로길이를 가로 폭과 같도록
$offset=$board['bo_3']? " ".$board['bo_3']." hours" : "";
$today=date('Ymd',strtotime(date('Y/m/d H:i:s').$offset));
$b_mon = date('n',strtotime($today));
$b_day = date('j',strtotime($today));
$b_year = date('Y',strtotime($today));
if ($year < 1) { // 오늘의 달력 일때
$month = $b_mon;
$mday = $b_day;
$year = $b_year;
}
if(!$year) $year = date("Y");
$file_index = $board_skin_path."/day"; ### 기념일 폴더 위치 지정
### 양력 기념일 파일 지정 : 해당년도 파일이 없으면 기본파일(solar.txt)을 불러온다
//$dayfile = file($file_index."/solar.txt");
$lastday=array(0,31,28,31,30,31,30,31,31,30,31,30,31);
if ($year%4 == 0) $lastday[2] = 29;
$dayoftheweek = date("w", mktime (0,0,0,$month,1,$year));
$cday = 1;
$sel_mon = sprintf("%02d",$month);
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
$width=$board['bo_table_width'] ? $board['bo_table_width'] : 1000;
if($width>100) $width.="px";
else $width.="%";
$gall_w=$board['bo_1'] ? $board['bo_1'] : 400;
$gall_h=$board['bo_2'] ? $board['bo_2'] : 300;
?>
<div id="bo_frame" style="max-width:<?=$width?>;margin:0 auto;">
<!-- 상단 공지 부분 -->
<nav class="pg_wrap theme-box">
<span class="pg control">
<a href="<?php echo G5_BBS_URL."/board.php?bo_table=".$bo_table."&";
if ($month == 1) {
$year_pre=$year-1; $month_pre=$month;
} else {
$year_pre=$year-1; $month_pre=$month;
}
echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>" class="pg_page">
<i class="ico prevyr txt-default"><?php echo $year_pre ?></i>
</a><a href="<?php echo G5_BBS_URL."/board.php?bo_table=".$bo_table."&";
if ($month == 1) {
$year_pre=$year-1; $month_pre=12;
} else {
$year_pre=$year; $month_pre=$month-1;
}
echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>" class="pg_page">
<i class="ico prevmth txt-default"><?php echo $month_pre ?></i>
</a>
</span>
<span class="pg">
<strong class="year"><?=$year?></strong><?for($m=1;$m<=12;$m++){
if($m==$month){
?><strong class="pg_current pg_page month" title="<?=$year?>년 <?=$m?>월"><span class="txt-point"><?=$m?></span></strong><?}
else{?><a href="<?php echo G5_BBS_URL."/board.php?bo_table=".$bo_table."&year=".$year."&month=".$m."&sc_no=".$sc_no; ?>" class="pg_page month"><span class="txt-default"><?=$m?></span></a><?}?>
<?}?>
</span>
<span class="pg control">
<a href="<?php echo G5_BBS_URL."/board.php?bo_table=".$bo_table."&";
if ($month == 12) {
$year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>" class="pg_page">
<i class="ico nextmth txt-default"><?php echo $month_pre ?></i>
</a><a href="<?php echo G5_BBS_URL."/board.php?bo_table=".$bo_table."&";
if ($month == 12) {
$year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;
}
echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>" class="pg_page">
<i class="ico nextyr txt-default"><?php echo $year_pre ?></i>
</a>
</span>
</nav>
<div id="bo_list">
<section id="diary_calendar">
<div class="diary-calendar theme-box">
<h2 class="this-month txt-point"><?=$year?>/<?=$sel_mon?></h2>
<div class="controls txt-right">
<?php if ($admin_href) { ?><a href="<?php echo $admin_href ?>" class="ui-btn small admin">관리자</a><?php } ?>
</div>
<table class="theme-list calendar-list">
<thead>
<tr class="txt-center">
<th class="sun"></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th class="sat"></th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * FROM {$write_table} WHERE wr_1!='' and left(wr_1,6) = '$year$sel_mon' ORDER BY wr_id ASC";
$result = sql_query($query);
$j=0; // layer id
// 내용을 보여주는 부분
while ($row = sql_fetch_array($result)) { // 제목글 뽑아서 링크 문자열 만들기..
if(strstr($row['wr_option'],"secret") && (!$is_admin || ($row['mb_id'] && $member['mb_id']!=$member['mb_id']))) continue;
if( substr($row['wr_1'],0,6) < $year.$sel_mon ) {
$start_day =1;
$start_day= (int)$start_day;
} else {
$start_day = substr($row['wr_1'],6,2);
$start_day= (int)$start_day;
}
$end_day = $start_day;
if(!$write_href){ $link=''; $cursor=" default";}
else if($is_admin || ($member['mb_id'] && $member['mb_id']==$row['mb_id'])){
$cursor="";
$link="get_info('".$row['wr_1']."');";
}
else {
$link="";
$cursor=" default";
}
$secret=strstr($row['wr_option'],"secret") ? "secret":"";
$html_day[$start_day].= '<a href="#" onclick="'.$link.' return false;" id="d_'.$row['wr_1'].'" class="wr-date ui-btn point'.$cursor.'">';
$html_day[$start_day].= '<i>'.$start_day.'</i>';
$html_day[$start_day].='</a>';
}
// 달력의 틀을 보여주는 부분
$temp = 7- (($lastday[$month]+$dayoftheweek)%7);
if ($temp == 7) $temp = 0;
$lastcount = $lastday[$month]+$dayoftheweek + $temp;
for ($iz = 1; $iz <= $lastcount; $iz++) { // 42번을 칠하게 된다.
$bgcolor = "days"; // 쭉 흰색으로 칠하고
if ($b_year==$year && $b_mon==$month && $b_day==$cday) $bgcolor = "today"; // 오늘날짜 표기
$re=$iz%7;
if ($re == 1) echo ("<tr>"); // 주당 7개씩 한쎌씩을 쌓는다.
if ($dayoftheweek < $iz && $iz <= $lastday[$month]+$dayoftheweek) {
// 전체 루프안에서 숫자가 들어가는 셀들만 해당됨
// 즉 11월 달에서 1일부터 30 일까지만 해당
$daytext = "$cday"; // $cday 는 숫자 예> 11월달은 1~ 30일 까지
//$daytext 은 셀에 써질 날짜 숫자 넣을 공간
// 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고
// 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
if($re==0) $col="right";
else if($re==1) $col="left";
else $col="";
$fr_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);
echo ("<td width=$col_width height=$col_height class='{$bgcolor} {$col}' valign='top'>");
// 기념일 파일 내용 비교위한 변수 선언, 월과 일을 두자리 포맷으로 고정
if (strlen($month) == 1) {
$monthp = "0".$month ;
} else {
$monthp = $month ;
}
if (strlen($cday) == 1) {
$cdayp = "0".$cday ;
} else {
$cdayp = $cday ;
}
$memday = $year.$monthp.$cdayp;
$daycont = "" ;
// 기념일(양력) 표시
/*
for($i=0 ; $i < sizeof($dayfile) ; $i++) { // 파일 첫 행부터 끝행까지 루프
$arrDay = explode("|", $dayfile[$i]);
if($memday == $year.$arrDay[0]) {
$daycont = $arrDay[1];
$daycontcolor = $arrDay[2];
if(substr($arrDay[2],0,3)=="red") $daycolor = "red"; // 공휴일은 날짜를 빨간색으로 표시
}
}
*/
/*
// 석봉운님의 음력날짜 변수선언
$myarray = soltolun($year,$month,$cday);
if ($myarray[day]==1 || $myarray[day]==11 || $myarray[day]==21) {
$moonday ="<font color='gray'>&nbsp;(음)$myarray[month].$myarray[day]$myarray[leap]</font>";
} else {
$moonday="";
}
include($file_index."/lunar.txt"); ### 음력 기념일 파일 지정
if ($annivmoonday&&$daycont) $blank="<br />"; // 음력절기와 양력기념일이 동시에 있으면 한칸 띔
else $blank="";
*/
if($html_day[$cday]){
echo $html_day[$cday];
}else {
if($write_href){ $wlink="get_info('".$fr_date."');"; $cursor="";}
else {$wlink=""; $cursor=" default";}
$html_day[$cday].= '<a href="#" onclick="'.$wlink.' return false;" id="w_'.$fr_date.'" class="wr-date ui-btn etc'.$cursor.'" data-date="'.$fr_date.'" data-mood="" data-etc="" data-wid="">';
$html_day[$cday].= '<i>'.$daytext.'</i>';
$html_day[$cday].='</a>';
echo $html_day[$cday];
}
echo ("</td>"); // 한칸을 마무리
$cday++; // 날짜를 카운팅
}
// 유효날짜가 아니면 그냥 회색을 칠한다.
else { echo ("<td width=$col_width height=$col_height class='noday'>&nbsp;</td>"); }
if ($re == 0) echo ("</tr>");
} // 반복구문이 끝남
unset($row);
?>
</tbody>
</table>
</div>
<? if($board['bo_content_head']) { ?>
<hr class="padding small">
<div class="board-notice">
<?=stripslashes($board['bo_content_head']);?>
</div>
<? } ?>
<?if($is_member && $write_href){?>
<hr class="padding small">
<div id="diary_write" class="none-trans">
<div class="theme-box">
<a href="#" onclick="$('#bo_w').toggleClass('on');return false;" id="write_open"> 글쓰기</a>
<? include_once($board_skin_path.'/write.php');?>
</div>
</div>
<hr class="padding small">
<?}?>
</section>
<section id="diary_list">
<div class="diary-cont">
<?
$order=$board['bo_4'] ? "asc" : "desc";
$result=sql_query("SELECT * FROM {$write_table} WHERE wr_1!='' and left(wr_1,6) = '$year$sel_mon' ORDER BY wr_1 {$order}");
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']))) continue;
?>
<div class="theme-box" id="w_<?=$row['wr_1']?>" data-date="<?=$row['wr_1']?>" data-wid="<?=$row['wr_id']?>">
<div class="options">
<h3 class="wr_date"><?=substr($row['wr_1'],0,4)?>/<?=substr($row['wr_1'],4,2)?>/<?=substr($row['wr_1'],6,2)?><span class="secret"><?=strstr($row['wr_option'],"secret") ? " ::":"";?></span></h3>
<p class="btn_confirm">
<? if($is_admin || ($member['mb_id'] && $member['mb_id']==$row['mb_id'])){
$cursor="";
$delete_href = "";
// 로그인중이고 자신의 글이라면 또는 관리자라면 패스워드를 묻지 않고 바로 수정, 삭제 가능
if (($member['mb_id'] && ($member['mb_id'] == $row['mb_id'])) || $is_admin) {
$delete_href = "javascript:del('./delete.php?bo_table=".$bo_table."&wr_id=".$row['wr_id']."&page=".$page.urldecode($qstr)."');";
if ($is_admin)
{
$delete_href = "javascript:del('./delete.php?bo_table=".$bo_table."&wr_id=".$row['wr_id']."&token=".$token."&page=".$page.urldecode($qstr)."');";
}
}
else if (!$write['mb_id']) { // 회원이 쓴 글이 아니라면
$delete_href = "./password.php?w=d&bo_table=".$bo_table."&wr_id=".$row['wr_id']."&page=".$page.$qstr;
}
?><a href="#" onclick="get_info('<?=$row['wr_1']?>'); return false;">M</a><a href="<?=$delete_href?>">D</a><?
}?>
</p>
</div>
<hr class="line">
<div class="ui-cont<?=$row['wr_file'] ? " with-image":"";?>">
<div class="ui-thumb file" data-file="<?=$row['wr_file']?>">
<?if($row['wr_file']){
$thumb=get_list_thumbnail($bo_table,$row['wr_id'],$gall_w,$gall_h,false,true);
$thumb2= get_mmb_image($bo_table, $row['wr_id']);
?>
<a href="<?=$thumb2['src']?>" onclick="view_img(this.href);return false;"><img src="<?=$thumb['src']?>"></a>
<?}?>
</div>
<div class="diary-text">
<p class="misc"><?if($row['wr_4']){?><em><?=$board['bo_5'] ? $board['bo_5']: "[날씨]";?></em> <span class="weather"><?=$row['wr_4']?></span><?}if($row['wr_3']){?><em><?=$board['bo_6'] ? $board['bo_6']: "[무드]";?></em> <span class="mood"><?=$row['wr_3']?></span><?}?></p>
<div class="content"><?=nl2br($row['wr_content'])?></div>
</div>
</div>
</div>
<hr class="padding small">
<?}?>
</div>
</section>
</div>
</div>
<div id="view_img">
<a href="#" onclick="$('#img_cont').empty();$('#view_img').removeClass();return false;" id="img_close">
<div id="img_cont"></div>
</a>
</div>
<script>
function view_img(url){
$("#view_img").addClass('on');
$("#img_cont").empty().html('<p><img src="'+url+'"></p>');
}
const bo_skin_url="<?=$board_skin_url?>";
<?if($is_member && $write_href){?>
const idx=$("td.today .wr-date").data("wid");
if(idx!='')$("#btn_submit").prop("disabled",true);
function get_info(wr_id){
$('#bo_w').addClass('on');
let elem=$("#w_"+wr_id);
let wid=elem.data("wid");
let w_date=elem.data("date");
let contents=$("#wr_content").val();
if(contents!='' && $("#write_w").val()==''){
var result=confirm("작성하던 내용을 파기합니까?");
if(!result) return false;
}
$("#btn_submit").prop("disabled",false);
$("#write_open").text("▶ 글쓰기");
$("#wr_subject").val(w_date);
$("#wr_1").val(w_date);
$("#wr_3").val("");
$("#wr_4").val("");
$("#wr_content").val("");
$("#write_w").val("");
$("#write_id").val("");
$("#wr_file").val("");
$("#file_del").addClass("sound_only");
$("#secret").prop("checked",false);
if(wid>0){
$("#write_open").text("▶ 글수정");
let w_3=elem.find(".mood").text();
let w_4=elem.find(".weather").text();
let w_content=elem.find(".content").text();
let w_file = elem.find(".file").data("file");
let w_secret = elem.find(".secret").text();
$("#wr_content").val(w_content);
$("#wr_3").val(w_3);
$("#wr_4").val(w_4);
$("#write_w").val("u");
$("#write_id").val(wid);
if(w_file=='1') $("#file_del").removeClass();
if(w_secret) $("#secret").prop("checked",true);
}
};
const d_pos=$("#diary_write").offset().top;
console.log(d_pos);
if($(window).width()<=720){
$(window).scroll(function(){
var w_pos=$(window).scrollTop();
if(w_pos>=d_pos){
$("#diary_write").addClass("scroll-fix");
}else if (w_pos<d_pos){
$("#diary_write").removeClass("scroll-fix").css("transform","translateY(0)");
}
}); }
<?}?>
</script>

244
moonday.php Normal file
View file

@ -0,0 +1,244 @@
<?php
#############################################################
/*
PHPschool의 석봉운님 오픈소스를 수정하여 사용하였습니다.
석봉운님께 감사드립니다.
주소 http://www.phpschool.com/bbs2/inc_view.html?id=9914&code=tnt2
음력 데이터는
작은 : 1
큰달 : 2
윤달이 있는 - 평달이 작고 윤달도 작으면 : 3
평달이 작고 윤달이 크면: 4
평달이 크고 윤달이 작으면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,2,1,2, 1,2,1,1,2,1,1,2,2,1,2,2);
###################################################
/*
$sy/ly :
$sm/lm :
$sd/ld :
$leapyes: 윤달
*/
###################################################
$md = array(31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
function febdays($sy) {
if(($sy%100 != 0 && $sy%4 ==0) || $sy%400 ==0) $md[1] = 29;
else $md[1] = 28;
return array($md[1]);
}
function alltd($sy) {
global $md;
$td = 0;
for($i=1841;$i<=$sy-1;$i++) {
list($md[1]) = febdays($i);
for($j=0;$j<12;$j++) {
$td += $md[$j];
$ttd[$i][12] += $md[$j];
}
}
$td -= 22;
return array($td);
}
function soltolun($sy, $sm, $sd) {
global $kk;
global $md;
list($td) = alltd($sy);
list($md[1]) = febdays($sy);
for($i=0;$i<$sm-1;$i++) $td += $md[$i];
$td += $sd;
$i = 0;
$temptd = $td;
while($temptd>0) {
$yoon = "";
switch($kk[$i]) {
case 1 :
$mm = 29;
break;
case 2 :
$mm = 30;
break;
case 3 :
$mm = 29;
$ymm = 29;
if($temptd > 29) {
$temptd -= 29;
$yoon = "*";
}
break;
case 4 :
$mm = 29;
$ymm = 30;
if($temptd > 30) {
$temptd -= 30;
$yoon = "*";
}
break;
case 5 :
$mm = 30;
$ymm = 29;
if($temptd > 29) {
$temptd -= 29;
$yoon = "*";
}
break;
case 6 :
$mm = 30;
$ymm = 30;
if($temptd > 30) {
$temptd -= 30;
$yoon = "*";
}
break;
}
$temptd -=$mm;
$i++;
if($i%12 == 1) $ly += 1;
}
if($temptd <= 0) {
if($yoon=="*") $temptd += $ymm;
else $temptd +=$mm;
}
$ly += 1840;
$lm = $i % 12;
if($lm==0) $lm=12;
$ld = $temptd;
/* output */
$myarray["year"] = $ly;
$myarray["month"] = $lm;
$myarray["day"] = $ld;
$myarray["leap"] = $yoon;
return $myarray;
}
function luntosol($ly, $lm, $ld) {
global $kk;
global $md;
$temptd = 0;
$dm = ($ly-1841)*12 + ($lm-1) -1;
for($i=$dm;$i>=0;$i--) {
switch($kk[$i]) {
case 1 :
$temptd += 29;
break;
case 2 :
$temptd += 30;
break;
case 3 :
$temptd += 58;
break;
case 4 :
case 5 :
$temptd += 59;
break;
case 6 :
$temptd += 60;
break;
}
}
$dm = ($ly-1841)*12 + ($lm) -1;
if($leapyes == "yoon") {
switch($kk[$dm]) {
case 1 :
case 2 : break;
case 3 :
case 4 :
$temptd += 29;
break;
case 5 :
case 6 :
$temptd += 30;
break;
}
}
$temptd += $ld;
$temptd += 22;
$td = $temptd;
$tempsy = 1841;
while(1) {
list($md[1]) = febdays($tempsy);
for($tempsm=0;$tempsm<=11;$tempsm++) {
$temptd -= $md[$tempsm];
if($temptd <= 0) break;
}
if($temptd <= 0) {
$temptd += $md[$tempsm];
$tempsd = $temptd;
break;
}
$tempsy++;
}
$sy = $tempsy;
$sm = $tempsm + 1;
$sd = $tempsd;
/* output */
$myyarray["year"] = $sy;
$myyarray["month"] = $sm;
$myyarray["day"] = $sd;
$myyarray["leap"] = $yoob;
return $myyarray;
}
?>

12
readme.md Normal file
View file

@ -0,0 +1,12 @@
## 게시판 Diary 스킨
작성자: 대하 (Extra Shot)
원본주소: https://extrashot.tistory.com/85
오류 수정 및 일부 코드에 최적화 작업을 진행했습니다.
모든 아보카도 버전에 호환됩니다.
```
php 최소 버전: 5.3
```

135
style.css Normal file
View file

@ -0,0 +1,135 @@
@charset "utf-8";
/* 공통 */
.board-notice { max-width: 100%; padding: 20px; margin: 0 auto; text-align: center;}
#bo_frame .pg_wrap {padding:2px;margin-bottom:15px;display:grid; gap:10px; grid-template-columns: 65px auto 65px; }
#bo_frame .pg {border:0 none;}
#bo_frame .pg.control .pg_page{padding:0 2px;}
#bo_frame .pg_wrap .pg_page {border:0 none;background:none;}
#bo_frame .pg_wrap .year {font-size:16px;font-weight:bold;display:inline-block;padding-right:10px;vertical-align: middle;}
#bo_frame .pg_wrap .year::after{display:inline-block;padding-left:15px;content:"||";font-weight:normal;opacity:0.8;}
#bo_frame .pg_wrap .month {padding:0 3px;}
#bo_frame .pg_wrap .month:last-child::after{content:"";}
#bo_frame .pg_wrap .ico{position:relative;display:inline-block;width:20px;height:30px;overflow:hidden;text-indent:100%;white-space:nowrap;}
#bo_frame .pg_wrap .ico:before{position:absolute;left:0;top:0;display:block;width:20px;height:30px;line-height:30px;text-indent:0;text-align:center;}
#bo_frame .pg_wrap .ico.prevyr:before{content:"◀◀";letter-spacing:-5px;text-indent:-2px;}
#bo_frame .pg_wrap .ico.prevmth:before{content:"◀";}
#bo_frame .pg_wrap .ico.nextyr:before{content:"▶▶";letter-spacing:-5px;text-indent:-2px;}
#bo_frame .pg_wrap .ico.nextmth:before{content:"▶";}
/*
#bo_frame .pg_wrap .ico:before{position:absolute;left:0;top:0;display:inline-block;width:24px;height:30px;line-height:30px;text-indent:0;font-family:'icon';}
#bo_frame .pg_wrap .ico.prevyr:before{content:"\ea21";}
#bo_frame .pg_wrap .ico.prevmth:before{content:"\ea23";}
#bo_frame .pg_wrap .ico.nextyr:before{content:"\ea22";}
#bo_frame .pg_wrap .ico.nextmth:before{content:"\ea24";}
*/
#bo_list {display:grid; grid-template-columns: 40% auto; gap:15px;}
/* 캘린더 */
#diary_calendar {max-height:calc(100vh - 200px); position:sticky;overflow:auto;top:70px;} /* 캘린더 고정 */
.diary-calendar {height:fit-content;}
.diary-calendar h2{ padding:5px; font-size:18px;font-weight:normal;}
.diary-calendar .controls {position: absolute;right:10px;top:10px;}
.calendar-list.theme-list {border-collapse:separate;border-spacing: 1px;padding:5px 0 0;}
.calendar-list.theme-list th{ height:26px;padding:0;border:0 none;font-size:11px;border-top:1px solid #aaaaaa22;border-bottom:1px solid #aaaaaa22;background:none;} /* 요일 표시 칸 */
.calendar-list.theme-list th.sun{color:#c70039;} /* 일요일 */
.calendar-list.theme-list th.sat{color:#345ad6;} /* 토요일 */
.calendar-list.theme-list td {text-align:center; padding:5px; font-size:11px;height:25px;border:0 none;} /* 날짜 표시 칸 */
.calendar-list.theme-list td.noday {background:#aaaaaa11;} /* 날짜없는 칸 */
.calendar-list.theme-list td i {position:relative;display:block; font-style:normal;}/* 날짜(숫자) */
.calendar-list.theme-list td.today i {font-weight:bold;}
/* 날짜 */
.calendar-list.theme-list td .wr-date {position:relative;display:inline-block;padding:0;width:25px;height:25px;line-height:25px;border-radius:100%;overflow:hidden;border:0 none;}
.calendar-list.theme-list td .wr-date.etc {background:none;color:inherit;}
.calendar-list.theme-list td .wr-date.default {cursor:default;}
/* 게시판 쓰기 */
#diary_write {text-align:left;z-index:1;}
#diary_write p.ui-btn.point{margin-bottom:10px;line-height:26px;cursor:default;}
#write_open {display:block;}
#bo_w {display:none;}
#bo_w.on {display:block;}
#bo_w .wr_content textarea {display:block;height:120px !important;}
#wr_info {position:relative;}
.options {position:relative;}
.options input {width:50%;}
.options .btn_confirm {position:absolute;right:5px;top:0; }
#btn_submit:disabled {filter:saturate(0);cursor:default;}
#file_del {float:left;}
/* 게시판 읽기 */
#bo_v {margin-bottom:20px;padding-bottom:20px}
#bo_v_table {position:absolute;top:0;right:16px;margin:0;padding:0 5px;height:25px;background:#ff3061;color:#fff;font-weight:bold;line-height:2.2em}
#bo_v_link h2, #bo_v_bot h2, #bo_v_atc_title{position:absolute;font-size:0;line-height:0;overflow:hidden}
#bo_v_title {padding:10px 0;font-size:1.4em}
#bo_v_bot {zoom:1}
#bo_v_bot:after {display:block;visibility:hidden;clear:both;content:""}
#bo_v_bot ul {margin:0;padding:0;list-style:none}
.bo_v_nb {float:left}
.bo_v_nb li {float:left;margin-right:5px}
.bo_v_com {float:right}
.bo_v_com li {float:left;margin-left:5px}
#bo_v_link {margin:20px 10px ;}
#bo_v_img {margin:20px 0;}
#bo_v_img:after {display:block;visibility:hidden;clear:both;content:""}
#bo_v_con {margin-bottom:5px;width:100%;line-height:1.7em;word-break:break-all;overflow:hidden}
#diary_list .misc {padding-bottom:4px; opacity:0.65;font-size:11px;}
#diary_list .misc span,#diary_list .misc em {display:inline-block; }
#diary_list .misc span {padding-right:10px;}
#diary_list h3 {line-height:25px;padding:0 5px;}
#diary_list hr.line {margin:2px auto 8px;}
#diary_list .diary-text {padding:0 5px;}
#diary_list .btn_confirm a {display: inline-block;padding:0 8px;line-height:25px;font-size:10px;}
.with-image {position:relative;padding-left:35%;min-height:80px;}/* 사진이 있을 경우 설정 */
.with-image .ui-thumb {
position:absolute;top:0;left:0;bottom:0;width:35%;padding:5px;
display:flex;justify-content: center;align-items: center;
overflow:hidden;
box-sizing:border-box;
}
/* 이미지뷰어 */
#view_img {display:none;position:fixed;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,0.8);overflow:auto;z-index:9999;}
#view_img.on {display:block;text-align: center;}
#img_close {display:block;position:fixed;right: 0;top: 0;bottom: 0;left: 0;overflow:hidden;}
#img_cont p {display:inline-block;vertical-align: middle;font-size:0;height:100vh;}
#img_cont p::before {content:"";display:inline-block;width:0;height:100vh;vertical-align:middle;font-size:0;line-height:0;}
#img_cont p img {max-height:100%;}
@media all and (min-width:721px){
#diary_write.scroll-fix {transform: translateY(0) !important;}
}
@media all and (max-width:720px){
#bo_list {display:block;}
#file_del {float:none;}
#diary_calendar {max-height:none;position:static;top:auto;overflow:hidden;}
#diary_write.scroll-fix{position:absolute;width:calc(100% - 20px);top:0;}
}
@media all and (max-width:480px) {
#bo_frame .pg_wrap {grid-template-columns: 30px auto 30px;}
#bo_frame .pg.control .pg_page {padding:0;}
#bo_frame .pg.control {display:flex;justify-content: space-between;flex-direction: column;}
#bo_frame .pg.control:last-of-type {flex-direction: column-reverse;}
#bo_frame .pg_wrap .year {display:block; padding:10px;}
#bo_frame .pg_wrap .year::after {display:none;}
}

229
view.skin.php Normal file
View file

@ -0,0 +1,229 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>
<!-- 게시물 읽기 시작 { -->
<hr class="padding big">
<article id="bo_v" class="theme-box">
<h2 id="bo_v_title" class="txt-center">
<?php
if ($category_name) echo $view['ca_name'].' | '; // 분류 출력 끝
echo cut_str(get_text($view['wr_subject']), 70);
?>
</h2>
<?php
if ($view['file']['count']) {
$cnt = 0;
for ($i=0; $i<count($view['file']); $i++) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view'])
$cnt++;
}
}
?>
<?php if($cnt) { ?>
<!-- 첨부파일 시작 { -->
<section id="bo_v_file">
<h2>첨부파일</h2>
<ul>
<?php
// 가변 파일
for ($i=0; $i<count($view['file']); $i++) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
?>
<li>
<a href="<?php echo $view['file'][$i]['href']; ?>" class="view_file_download">
<strong><?php echo $view['file'][$i]['source'] ?></strong>
<?php echo $view['file'][$i]['content'] ?> (<?php echo $view['file'][$i]['size'] ?>)
</a>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 첨부파일 -->
<?php } ?>
<?php
if ($view['link']) {
?>
<!-- 관련링크 시작 { -->
<section id="bo_v_link">
<h2>관련링크</h2>
<ul>
<?php
// 링크
$cnt = 0;
for ($i=1; $i<=count($view['link']); $i++) {
if ($view['link'][$i]) {
$cnt++;
$link = cut_str($view['link'][$i], 70);
?>
<li>
<em>LINK <?=$i+1?></em> <a href="<?php echo $view['link_href'][$i] ?>" target="_blank">
<strong><?php echo $link ?></strong>
</a>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 관련링크 -->
<?php } ?>
<section id="bo_v_atc" class='txt-center'>
<h2 id="bo_v_atc_title">본문</h2>
<?php
// 파일 출력
$v_img_count = count($view['file']);
if($v_img_count) {
echo "<div id=\"bo_v_img\">\n";
for ($i=0; $i<=count($view['file']); $i++) {
if ($view['file'][$i]['view']) {
//echo $view['file'][$i]['view'];
echo get_view_thumbnail($view['file'][$i]['view']);
}
}
echo "</div>\n";
}
?>
<!-- 본문 내용 시작 { -->
<div id="bo_v_con"><?php echo get_view_thumbnail($view['content']); ?></div>
<?php //echo $view['rich_content']; // {이미지:0} 과 같은 코드를 사용할 경우 ?>
<!-- } 본문 내용 -->
</section>
<?php
// 코멘트 입출력
// include_once(G5_BBS_PATH.'/view_comment.php');
?>
<!-- 링크 버튼 시작 { -->
<div id="bo_v_bot">
<hr class="padding">
<?
ob_start();
?>
<? if ($prev_href || $next_href) { ?>
<div class="bo_v_nb">
<? if ($prev_href) { ?><a href="<? echo $prev_href ?>" class="ui-btn">이전글</a><? } ?>
<? if ($next_href) { ?><a href="<? echo $next_href ?>" class="ui-btn">다음글</a><? } ?>
</div>
<? } ?>
<div class="bo_v_com">
<? if ($update_href) { ?><a href="<? echo $update_href ?>" class="ui-btn">수정</a><? } ?>
<? if ($delete_href) { ?><a href="<? echo $delete_href ?>" class="ui-btn" onclick="del(this.href); return false;">삭제</a><? } ?>
<? if ($copy_href) { ?><a href="<? echo $copy_href ?>" class="ui-btn admin" onclick="board_move(this.href); return false;">복사</a><? } ?>
<? if ($move_href) { ?><a href="<? echo $move_href ?>" class="ui-btn admin" onclick="board_move(this.href); return false;">이동</a><? } ?>
<? if ($search_href) { ?><a href="<? echo $search_href ?>" class="ui-btn">검색</a><? } ?>
<a href="<? echo $list_href ?>" class="ui-btn">목록</a>
<? if ($write_href) { ?><a href="<? echo $write_href ?>" class="ui-btn point">글쓰기</a><? } ?>
</div>
<?
$link_buttons = ob_get_contents();
ob_end_flush();
?>
</div>
<!-- } 링크 버튼 -->
</article>
<!-- } 게시판 읽기 -->
<script>
<?php if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").click(function() {
if(!g5_is_member) {
alert("다운로드 권한이 없습니다.\n회원이시라면 로그인 후 이용해 보십시오.");
return false;
}
var msg = "파일을 다운로드 하시면 포인트가 차감(<?php echo number_format($board['bo_download_point']) ?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if(confirm(msg)) {
var href = $(this).attr("href")+"&js=on";
$(this).attr("href", href);
return true;
} else {
return false;
}
});
});
<?php } ?>
function board_move(href)
{
window.open(href, "boardmove", "left=50, top=50, width=500, height=550, scrollbars=1");
}
</script>
<script>
$(function() {
$("a.view_image").click(function() {
window.open(this.href, "large_image", "location=yes,links=no,toolbar=no,top=10,left=10,width=10,height=10,resizable=yes,scrollbars=no,status=no");
return false;
});
// 추천, 비추천
$("#good_button, #nogood_button").click(function() {
var $tx;
if(this.id == "good_button")
$tx = $("#bo_v_act_good");
else
$tx = $("#bo_v_act_nogood");
excute_good(this.href, $(this), $tx);
return false;
});
// 이미지 리사이즈
$("#bo_v_atc").viewimageresize();
});
function excute_good(href, $el, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if(data.error) {
alert(data.error);
return false;
}
if(data.count) {
$el.find("strong").text(number_format(String(data.count)));
if($tx.attr("id").search("nogood") > -1) {
$tx.text("이 글을 비추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
} else {
$tx.text("이 글을 추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
}
}
}, "json"
);
}
</script>
<!-- } 게시글 읽기 -->

321
view_comment.skin.php Normal file
View file

@ -0,0 +1,321 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<script>
// 글자수 제한
var char_min = parseInt(<?php echo $comment_min ?>); // 최소
var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</script>
<!-- 댓글 시작 { -->
<section id="bo_vc">
<?php
$cmt_amt = count($list);
for ($i=0; $i<$cmt_amt; $i++) {
$comment_id = $list[$i]['wr_id'];
$cmt_depth = ""; // 댓글단계
$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 20;
$comment = $list[$i]['content'];
/*
if (strstr($list[$i]['wr_option'], "secret")) {
$str = $str;
}
*/
$comment = 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>", $comment);
$cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결
?>
<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="margin-left:<?php echo $cmt_depth ?>px;border-top-color:#e0e0e0"<?php } ?>>
<header style="z-index:<?php echo $cmt_sv; ?>">
<h1><?php echo get_text($list[$i]['wr_name']); ?>님의 댓글</h1>
<?php echo $list[$i]['name'] ?>
<?php if ($cmt_depth) { ?><img src="<?php echo $board_skin_url ?>/img/icon_reply.gif" class="icon_reply" alt="댓글의 댓글"><?php } ?>
<?php if ($is_ip_view) { ?>
<span class="bo_vc_hdinfo">(<?php echo $list[$i]['ip']; ?>)</span>
<?php } ?>
작성일
<span class="bo_vc_hdinfo"><time datetime="<?php echo date('Y-m-d\TH:i:s+09:00', strtotime($list[$i]['datetime'])) ?>"><?php echo $list[$i]['datetime'] ?></time></span>
<?php
include(G5_SNS_PATH.'/view_comment_list.sns.skin.php');
?>
</header>
<!-- 댓글 출력 -->
<p>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>
<?php echo $comment ?>
</p>
<span id="edit_<?php echo $comment_id ?>"></span><!-- 수정 -->
<span id="reply_<?php echo $comment_id ?>"></span><!-- 답변 -->
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<?php echo $comment_id ?>">
<textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
<?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';
?>
<footer>
<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;" >답변</a></li><?php } ?>
<?php if ($list[$i]['is_edit']) { ?><li><a href="<?php echo $c_edit_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;" >수정</a></li><?php } ?>
<?php if ($list[$i]['is_del']) { ?><li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();" >삭제</a></li><?php } ?>
</ul>
</footer>
<?php } ?>
</article>
<?php } ?>
</section>
<!-- } 댓글 -->
<?php if ($is_comment_write) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w">
<form name="fviewcomment" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<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="">
<div class="tbl_frm01 tbl_wrap">
<table>
<tbody>
<?php if ($is_guest) { ?>
<tr>
<th scope="row"><label for="wr_name">이름<strong class="sound_only"> 필수</strong></label></th>
<td><input type="text" name="wr_name" value="<?php echo get_cookie("ck_sns_name"); ?>" id="wr_name" required class="frm_input required" size="5" maxLength="20"></td>
</tr>
<tr>
<th scope="row"><label for="wr_password">비밀번호<strong class="sound_only"> 필수</strong></label></th>
<td><input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="10" maxLength="20"></td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="wr_secret">비밀글사용</label></th>
<td><input type="checkbox" name="wr_secret" value="secret" id="wr_secret"></td>
</tr>
<?php if ($is_guest) { ?>
<tr>
<th scope="row">자동등록방지</th>
<td><?php echo $captcha_html; ?></td>
</tr>
<?php } ?>
<tr>
<th scope="row">내용</th>
<td>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script>
$(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
var str = $(this).val()
var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) {
$(this).val(str.substr(0, mx));
return false;
}
});
</script>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm txt-right">
<input type="submit" id="btn_submit" class="ui-btn point" value="댓글등록">
</div>
</form>
</aside>
<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;
// 댓글 아이디가 넘어오면 답변, 수정
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(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;
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'])) { ?>
// sns 등록
$(function() {
$("#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 } ?>
<!-- } 댓글 쓰기 -->

413
write.php Normal file
View file

@ -0,0 +1,413 @@
<?php
include_once('./_common.php');
include_once(G5_EDITOR_LIB);
if (!$board['bo_table']) {
alert('존재하지 않는 게시판입니다.', G5_URL);
}
if (!$bo_table) {
alert("bo_table 값이 넘어오지 않았습니다.\\nwrite.php?bo_table=code 와 같은 방식으로 넘겨 주세요.", G5_URL);
}
check_device($board['bo_device']);
$notice_array = explode(',', trim($board['bo_notice']));
if (!($w == '' || $w == 'u' || $w == 'r')) {
alert('w 값이 제대로 넘어오지 않았습니다.');
}
if ($w == 'u' || $w == 'r') {
if ($write['wr_id']) {
// 가변 변수로 $wr_1 .. $wr_10 까지 만든다.
for ($i=1; $i<=10; $i++) {
$vvar = "wr_".$i;
$$vvar = $write['wr_'.$i];
}
} else {
alert("글이 존재하지 않습니다.\\n삭제되었거나 이동된 경우입니다.", G5_URL);
}
}
if ($w == '') {
if ($wr_id) {
alert('글쓰기에는 \$wr_id 값을 사용하지 않습니다.', G5_BBS_URL.'/board.php?bo_table='.$bo_table);
}
if ($member['mb_level'] < $board['bo_write_level']) {
if ($member['mb_id']) {
alert('글을 쓸 권한이 없습니다.');
} else {
alert("글을 쓸 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.", './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table));
}
}
// 음수도 true 인것을 왜 이제야 알았을까?
if ($is_member) {
$tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0;
if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) {
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글쓰기('.number_format($board['bo_write_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글쓰기 해 주십시오.');
}
}
$title_msg = '글쓰기';
} else if ($w == 'u') {
// 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함
//if ($member['mb_level'] < $board['bo_write_level']) {
if($member['mb_id'] && $write['mb_id'] == $member['mb_id']) {
;
} else if ($member['mb_level'] < $board['bo_write_level']) {
if ($member['mb_id']) {
alert('글을 수정할 권한이 없습니다.');
} else {
alert('글을 수정할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table));
}
}
$len = strlen($write['wr_reply']);
if ($len < 0) $len = 0;
$reply = substr($write['wr_reply'], 0, $len);
// 원글만 구한다.
$sql = " select count(*) as cnt from {$write_table}
where wr_reply like '{$reply}%'
and wr_id <> '{$write['wr_id']}'
and wr_num = '{$write['wr_num']}'
and wr_is_comment = 0 ";
$row = sql_fetch($sql);
if ($row['cnt'] && !$is_admin)
alert('이 글과 관련된 답변글이 존재하므로 수정 할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다.');
// 코멘트 달린 원글의 수정 여부
$sql = " select count(*) as cnt from {$write_table}
where wr_parent = '{$wr_id}'
and mb_id <> '{$member['mb_id']}'
and wr_is_comment = 1 ";
$row = sql_fetch($sql);
if ($board['bo_count_modify'] && $row['cnt'] >= $board['bo_count_modify'] && !$is_admin)
alert('이 글과 관련된 댓글이 존재하므로 수정 할 수 없습니다.\\n\\n댓글이 '.$board['bo_count_modify'].'건 이상 달린 원글은 수정할 수 없습니다.');
$title_msg = '글수정';
} else if ($w == 'r') {
if ($member['mb_level'] < $board['bo_reply_level']) {
if ($member['mb_id'])
alert('글을 답변할 권한이 없습니다.');
else
alert('답변글을 작성할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table));
}
$tmp_point = isset($member['mb_point']) ? $member['mb_point'] : 0;
if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin)
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글답변('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글답변 해 주십시오.');
//if (preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice']))
if (in_array((int)$wr_id, $notice_array))
alert('공지에는 답변 할 수 없습니다.');
//----------
// 4.06.13 : 비밀글을 타인이 열람할 수 있는 오류 수정 (헐랭이, 플록님께서 알려주셨습니다.)
// 코멘트에는 원글의 답변이 불가하므로
if ($write['wr_is_comment'])
alert('정상적인 접근이 아닙니다.');
// 비밀글인지를 검사
if (strstr($write['wr_option'], 'secret')) {
if ($write['mb_id']) {
// 회원의 경우는 해당 글쓴 회원 및 관리자
if (!($write['mb_id'] == $member['mb_id'] || $is_admin))
alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.');
} else {
// 비회원의 경우는 비밀글에 답변이 불가함
if (!$is_admin)
alert('비회원의 비밀글에는 답변이 불가합니다.');
}
}
//----------
// 게시글 배열 참조
$reply_array = &$write;
// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
if (strlen($reply_array['wr_reply']) == 10)
alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.');
$reply_len = strlen($reply_array['wr_reply']) + 1;
if ($board['bo_reply_order']) {
$begin_reply_char = 'A';
$end_reply_char = 'Z';
$reply_number = +1;
$sql = " select MAX(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' ";
} else {
$begin_reply_char = 'Z';
$end_reply_char = 'A';
$reply_number = -1;
$sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' ";
}
if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' ";
$row = sql_fetch($sql);
if (!$row['reply'])
$reply_char = $begin_reply_char;
else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다.
alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.');
else
$reply_char = chr(ord($row['reply']) + $reply_number);
$reply = $reply_array['wr_reply'] . $reply_char;
$title_msg = '글답변';
$write['wr_subject'] = 'Re: '.$write['wr_subject'];
}
// 그룹접근 가능
if (!empty($group['gr_use_access'])) {
if ($is_guest) {
alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", 'login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table));
}
if ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']) {
; // 통과
} else {
// 그룹접근
$sql = " select gr_id from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if (!$row['gr_id'])
alert('접근 권한이 없으므로 글쓰기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.');
}
}
// 본인확인을 사용한다면
if ($config['cf_cert_use'] && !$is_admin) {
// 인증된 회원만 가능
if ($board['bo_use_cert'] != '' && $is_guest) {
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', 'login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table));
}
if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) {
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL);
}
if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) {
alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글쓰기가 가능합니다.\\n\\n성인인데 글쓰기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL);
}
if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') {
alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL);
}
if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) {
alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL);
}
}
// 글자수 제한 설정값
if ($is_admin || $board['bo_use_dhtml_editor'])
{
$write_min = $write_max = 0;
}
else
{
$write_min = (int)$board['bo_write_min'];
$write_max = (int)$board['bo_write_max'];
}
$g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$title_msg;
$is_notice = false;
$notice_checked = '';
if ($is_admin && $w != 'r') {
$is_notice = true;
if ($w == 'u') {
// 답변 수정시 공지 체크 없음
if ($write['wr_reply']) {
$is_notice = false;
} else {
if (in_array((int)$wr_id, $notice_array)) {
$notice_checked = 'checked';
}
}
}
}
$is_html = false;
if ($member['mb_level'] >= $board['bo_html_level'])
$is_html = true;
$is_secret = $board['bo_use_secret'];
$is_mail = false;
if ($config['cf_email_use'] && $board['bo_use_email'])
$is_mail = true;
$recv_email_checked = '';
if ($w == '' || strstr($write['wr_option'], 'mail'))
$recv_email_checked = 'checked';
$is_name = false;
$is_password = false;
$is_email = false;
$is_homepage = false;
if ($is_guest || ($is_admin && $w == 'u' && $member['mb_id'] != $write['mb_id'])) {
$is_name = true;
$is_password = true;
$is_email = true;
$is_homepage = true;
}
$is_category = false;
$category_option = '';
if ($board['bo_use_category']) {
$ca_name = "";
if (isset($write['ca_name']))
$ca_name = $write['ca_name'];
$category_option = get_category_option($bo_table, $ca_name);
$is_category = true;
}
$is_link = false;
if ($member['mb_level'] >= $board['bo_link_level']) {
$is_link = true;
}
$is_file = false;
if ($member['mb_level'] >= $board['bo_upload_level']) {
$is_file = true;
}
$is_file_content = false;
if ($board['bo_use_file_content']) {
$is_file_content = true;
}
$file_count = (int)$board['bo_upload_count'];
$name = "";
$email = "";
$homepage = "";
if ($w == "" || $w == "r") {
if ($is_member) {
if (isset($write['wr_name'])) {
$name = get_text(cut_str(stripslashes($write['wr_name']),20));
}
$email = get_email_address($member['mb_email']);
$homepage = get_text(stripslashes($member['mb_homepage']));
}
}
$html_checked = "";
$html_value = "";
$secret_checked = "";
if ($w == '') {
$password_required = 'required';
} else if ($w == 'u') {
$password_required = '';
if (!$is_admin) {
if (!($is_member && $member['mb_id'] == $write['mb_id'])) {
if (!check_password($wr_password, $write['wr_password'])) {
alert('비밀번호가 틀립니다.');
}
}
}
$name = get_text(cut_str(stripslashes($write['wr_name']),20));
$email = get_email_address($write['wr_email']);
$homepage = get_text(stripslashes($write['wr_homepage']));
for ($i=1; $i<=G5_LINK_COUNT; $i++) {
$write['wr_link'.$i] = get_text($write['wr_link'.$i]);
$link[$i] = $write['wr_link'.$i];
}
if (strstr($write['wr_option'], 'html1')) {
$html_checked = 'checked';
$html_value = 'html1';
} else if (strstr($write['wr_option'], 'html2')) {
$html_checked = 'checked';
$html_value = 'html2';
}
if (strstr($write['wr_option'], 'secret')) {
$secret_checked = 'checked';
}
$file = get_file($bo_table, $wr_id);
if($file_count < $file['count'])
$file_count = $file['count'];
} else if ($w == 'r') {
if (strstr($write['wr_option'], 'secret')) {
$is_secret = true;
$secret_checked = 'checked';
}
$password_required = "required";
for ($i=1; $i<=G5_LINK_COUNT; $i++) {
$write['wr_link'.$i] = get_text($write['wr_link'.$i]);
}
}
set_session('ss_bo_table', $_REQUEST['bo_table']);
set_session('ss_wr_id', $_REQUEST['wr_id']);
$subject = "";
if (isset($write['wr_subject'])) {
$subject = str_replace("\"", "&#034;", get_text(cut_str($write['wr_subject'], 255), 0));
}
$content = '';
if ($w == '') {
$content = $board['bo_insert_content'];
} else if ($w == 'r') {
if (!strstr($write['wr_option'], 'html')) {
$content = "\n\n\n &gt; "
."\n &gt; "
."\n &gt; ".str_replace("\n", "\n> ", get_text($write['wr_content'], 0))
."\n &gt; "
."\n &gt; ";
}
} else {
$content = get_text($write['wr_content'], 0);
}
$upload_max_filesize = number_format($board['bo_upload_size']) . ' 바이트';
$width = $board['bo_table_width'];
if ($width <= 100)
$width .= '%';
else
$width .= 'px';
$is_dhtml_editor = false;
$is_dhtml_editor_use = false;
$editor_content_js = '';
if(!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)
$is_dhtml_editor_use = true;
// 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용
if ($config['cf_editor'] && $is_dhtml_editor_use && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) {
$is_dhtml_editor = true;
if(is_file(G5_EDITOR_PATH.'/'.$config['cf_editor'].'/autosave.editor.js'))
$editor_content_js = '<script src="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/autosave.editor.js"></script>'.PHP_EOL;
}
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_js = '';
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);
// 임시 저장된 글 수
$autosave_count = autosave_count($member['mb_id']);
$action_url = https_url(G5_BBS_DIR)."/write_update.php";
echo '<!-- skin : '.(G5_IS_MOBILE ? $board['bo_mobile_skin'] : $board['bo_skin']).' -->';
include_once ($board_skin_path.'/write.skin.php');
?>

157
write.skin.php Normal file
View file

@ -0,0 +1,157 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<section id="bo_w">
<hr class="padding small">
<!-- 게시물 작성/수정 시작 -->
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>" id="write_w" >
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>" id="write_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="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<?php
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$offset=$board['bo_3']? " ".$board['bo_3']." hours" : "";
$today=date('Ymd',strtotime(date('Y/m/d H:i:s').$offset));
if (empty($fr_date)) $fr_date = $today;
if($w=='' ){if ($_GET['fr_date']) {
$write['wr_1'] = $_GET['fr_date'];
}else{
$write['wr_1'] = $today;
}
}
$option = '';
$option_hidden = '';
echo $option_hidden;
?>
<section class="wr_content">
<div id="wr_info">
<?php if ($is_name) { ?>
<p>
<label for="wr_name">이름<strong class="sound_only">필수</strong></label>
<input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required class="frm_input required" size="10" maxlength="20">
</p>
<?php } ?>
<?php if ($is_password) { ?>
<p>
<label for="wr_password">패스워드<strong class="sound_only">필수</strong></label>
<input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?> class="frm_input <?php echo $password_required ?>" maxlength="20">
</p>
<?php } ?>
<?php if ($option) { ?>
<p>
<?php echo $option ?>
</p>
<?php } ?>
<?php if ($is_category) { ?>
<p>
<select name="ca_name" id="ca_name" required class="required" >
<option value="">선택하세요</option>
<?php echo $category_option ?>
</select>
</p>
<?php } ?>
<p>
<input type="hidden" name="wr_subject" value="<?php echo $write['wr_1']; ?>" id="wr_subject" required maxlength="255">
<input type="text" name="wr_1" value="<?php echo $write['wr_1']; ?>" id="wr_1" required class="date full frm_input required" size="21" maxlength="8" placeholder="날짜">
</p>
</div>
<section class="options">
<input type="text" name="wr_4" id="wr_4" value="<?=$write['wr_4']?>" placeholder="<?=$board['bo_5'] ? $board['bo_5']: "날씨";?>"><input type="text" name="wr_3" id="wr_3" value="<?=$write['wr_3']?>" placeholder="<?=$board['bo_6'] ? $board['bo_6']: "무드";?>">
</section>
<textarea name="wr_content" id="wr_content" maxlength="255" required></textarea>
<input type="file" id="wr_file" name="bf_file[0]" title="파일첨부 : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input full">
<div class="btn_confirm txt-right">
<label id="file_del" for="bf_file_del0" class="sound_only"><input type="checkbox" id="bf_file_del0" name="bf_file_del[0]" value="1"> 파일 삭제</label>
<?if($is_secret){?><label for="secret" id="wr_secret"><input type="checkbox" id="secret" value="secret" name="secret"> 비밀글 </label><?}?>
<input type="submit" value="입력" id="btn_submit" accesskey="s" class="ui-btn point">
</div>
</section>
</form>
</section>
<!-- 게시물 작성/수정 -->
<script>
$(function(){
$(".date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yymmdd", showButtonPanel: true, yearRange: "c-99:c+99" });
});
function html_auto_br(obj)
{
if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
if (result)
obj.value = "html2";
else
obj.value = "html1";
}
else
obj.value = "";
}
function fwrite_submit(f)
{
var frdate="<?=$fr_date?>";
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
f.wr_subject.focus();
return false;
}
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
if (typeof(ed_wr_content) != "undefined")
ed_wr_content.returnFalse();
else
f.wr_content.focus();
return false;
}
if (document.getElementById("char_count")) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(check_byte("wr_content", "char_count"));
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;
}
}
}
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
</script>

15
write_update.skin.php Normal file
View file

@ -0,0 +1,15 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 자신만의 코드를 넣어주세요.
if($wr_etc){
$etc=implode("||",$wr_etc);
$etc.="||";
$sql = " update {$write_table}
set wr_4='{$etc}'
where wr_id = '{$wr_id}' ";
sql_query($sql);
}
goto_url("./board.php?bo_table=$bo_table");
?>