This commit is contained in:
Amberstone 2024-10-19 10:41:44 +09:00
commit 2c6a4e0e96
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
8 changed files with 1263 additions and 0 deletions

4
_common.php Normal file
View file

@ -0,0 +1,4 @@
<?php
include_once('../../../common.php');
?>

310
list.skin.php Normal file
View file

@ -0,0 +1,310 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
if($board['bo_type']=='board')$category_option = get_category_option($bo_table, $sca);
if($board['bo_table_width']==0) $width="100%";
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
$gall_size=array();
$gall_margin=array();
$gall_w=240;
$gall_h=240;
$gall_mw = 10;
$gall_mh = 10;
if($board['bo_1']){
$gall_size=explode("|",$board['bo_1']);
$gall_w=trim($gall_size[0]);
if(count($gall_size)>1)
$gall_h=trim($gall_size[1]);
else
$gall_h=trim($gall_size[0]);
}
if($board['bo_2']){
$gall_margin=explode("|",$board['bo_2']);
$gall_mh=trim($gall_margin[0]);
if(count($gall_margin)>1)
$gall_mw=trim($gall_margin[1]);
else
$gall_mw=trim($gall_margin[0]);
}
?>
<style>
#gall_ul .gall_li{
margin-bottom:<?=$gall_mh?>px;
}
#gall_ul .gall_li:not(.bo_notice){
width:<?=$gall_w?>px;
height:<?=$gall_h?>px;
}
</style>
<!-- 게시판 목록 시작 { -->
<div id="bo_gall" style="max-width:<?php echo $width; ?>">
<!-- 게시판 카테고리 시작 { -->
<? if ($is_category) { ?>
<nav id="navi_category">
<?if($board['bo_type']=='board'){?>
<select name="sca" id="sca" onchange="location.href='?bo_table=<?=$bo_table?>&sca=' + this.value;">
<option value="">전체</option>
<? echo $category_option ?>
</select>
<?}else {?>
<ul>
<?php echo $category_option ?>
</ul>
<?}?>
</nav>
<? } ?>
<!-- } 게시판 카테고리 -->
<!-- 게시판 페이지 정보 버튼 시작 { -->
<div id="bo_btn_top">
<?php if ($rss_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" target="_black" class="admin ui-btn">게시판관리</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="ui-btn point">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<!-- } 게시판 페이지 정보 버튼 -->
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<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 ?>">
<input type="hidden" name="sw" value="">
<ul id="gall_ul" class="gall_row">
<?php for ($i=0; $i<count($list); $i++) {
$img_content="none";
if (!$list[$i]['is_notice']) {
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'],$gall_w,$gall_h,false,true);
if($thumb['src'])
$img_content = "url('".$thumb['src']."') center no-repeat;background-size:cover";
else $img_content="none";
}
?>
<li class="gall_li<? if ($list[$i]['is_notice']) echo " bo_notice";?>">
<div class="gall_box theme-box" style="background:<?=$img_content?>;">
<div class="gall_chk">
<?php if ($is_checkbox) { ?>
<label for="chk_wr_id_<?php echo $i ?>"><span class="sound_only"><?php echo $list[$i]['subject'] ?></span>
<input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>"></label>
<?php } ?>
<span class="sound_only">
<?php
if ($wr_id == $list[$i]['wr_id'])
echo "<span class=\"bo_current\">열람중</span>";
else
echo $list[$i]['num'];
?>
</span>
</div>
<div class="gall_con">
<a href="#" onclick="<?=$board['bo_read_level']<=$member['mb_level'] ? "open_view('".$bo_table."','".$list[$i]['wr_id']."');return false;": "void(0);";?>" class="bo_tit" >
<?php if ($list[$i]['is_notice']) { // 공지사항 ?>
<i class="ui-btn point notice_icon">!</i>
<?php }?>
<strong <?php if (!$list[$i]['is_notice']) { ?>class="sound_only"<?}?>>
<?
// echo $list[$i]['icon_reply']; 갤러리는 reply 를 사용 안 할 것 같습니다. - 지운아빠 2013-03-04
if ($is_category && $list[$i]['ca_name']) {
?>
[<?php echo $list[$i]['ca_name'] ?>]
<?php } ?>
<?php echo $list[$i]['subject'] ?>
</strong>
</a>
</div>
</div>
</li>
<?php } ?>
<?php if (count($list) == 0) { echo "<li class=\"empty_list\">게시물이 없습니다.</li>"; } ?>
</ul>
<?php if ($list_href || $is_checkbox || $write_href) { ?>
<div class="bo_fx">
<?php if ($list_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($is_checkbox) { ?>
<li><input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
<label for="chkall"><span id="checkall" class="ui-btn etc" >전체</span></label></li>
<li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value" class="ui-btn admin"></li>
<li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value" class="ui-btn admin"></li>
<li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value" class="ui-btn admin"></li>
<?php } ?>
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="ui-btn">목록</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="ui-btn point">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</form>
<!-- 게시판 검색 시작 { -->
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<option value="wr_subject"<?php echo get_selected($sfl, 'wr_subject', true); ?>>제목</option>
<!-- <option value="wr_content"<?php echo get_selected($sfl, 'wr_content'); ?>>내용</option>
<option value="wr_subject||wr_content"<?php echo get_selected($sfl, 'wr_subject||wr_content'); ?>>제목+내용</option> -->
<option value="mb_id,1"<?php echo get_selected($sfl, 'mb_id,1'); ?>>회원아이디</option>
<!--<option value="mb_id,0"<?php echo get_selected($sfl, 'mb_id,0'); ?>>회원아이디(코)</option>-->
<option value="wr_name,1"<?php echo get_selected($sfl, 'wr_name,1'); ?>>글쓴이</option>
<!-- <option value="wr_name,0"<?php echo get_selected($sfl, 'wr_name,0'); ?>>글쓴이(코)</option>-->
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx" class="sch_input" size="25" maxlength="20" placeholder="검색">
<button type="submit" value="검색" class="ui-btn">검색</button>
</form>
</fieldset>
<!-- } 게시판 검색 -->
</div>
<div id="view_box">
<a href="#" id="close_area"><span class="sound_only">close</span></a>
<div class="fix-layout">
<div id="view_area" style="width:100%">
</div>
</div>
</div>
<?php if($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?php } ?>
<!-- 페이지 -->
<?php echo $write_pages; ?>
<script>
const gall_max=$("#gall_ul").width();
const gall_w=<?=$gall_w?>;
const margin=<?=$gall_mw?>;
let cols=Math.floor((gall_max+margin)/(gall_w+margin));
let new_w=(cols-1)*(gall_w+margin)+gall_w;
$("#gall_ul").css("max-width",new_w+"px");
let html=[];
const items=$(".gall_li:not(.bo_notice)").length;
let leftover=cols-items%cols;
if(leftover==cols) leftover=0;
for(i=0;i<leftover;i++){
html.push('<li class="gall_li empty"></li>');
}
$("#gall_ul").append(html.join(''));
$("#close_area").click(function(){
$("#view_box").removeClass('on');
$("#view_area").empty();
return false;
});
function open_view(table,idx) {
hlink='<?=$board_skin_url?>/view.php?bo_table='+table+'&wr_id='+idx;
$.ajax({
async: true
, url: hlink
, beforeSend: function() {}
, success: function(data) {
// Toss
var response = data;
$('#view_area').empty().append(response);
$('#view_box').addClass('on');
}
, error: function(data, status, err) {
$('#view_area').empty();
$('#view_box').removeClass('on');
}
, complete: function() {
// Complete
}
});
return false;
}
<?php if ($is_checkbox) { ?>
$("#checkall").click(function(){
$(this).toggleClass("on");
});
function all_checked(sw) {
var f = document.fboardlist;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
}
}
function fboardlist_submit(f) {
var chk_count = 0;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++;
}
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택복사") {
select_copy("copy");
return;
}
if(document.pressed == "선택이동") {
select_copy("move");
return;
}
if(document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
return false;
f.removeAttribute("target");
f.action = "./board_list_update.php";
}
return true;
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
if (sw == 'copy')
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = "./move.php";
f.submit();
}
<?php } ?>
</script>
<!-- } 게시판 목록 -->

40
password_check.php Normal file
View file

@ -0,0 +1,40 @@
<?php
include_once('./_common.php');
$write_table=$g5['write_prefix'].$bo_table;
if ($w == 's') {
$qstr = 'bo_table='.$bo_table.'&amp;sfl='.$sfl.'&amp;stx='.$stx.'&amp;sop='.$sop.'&amp;wr_id='.$wr_id.'&amp;page='.$page;
$wr = get_write($write_table, $wr_id);
if (!check_password($wr_password, $wr['wr_password'])){
echo help('비밀번호가 틀립니다.');
$is_viewer=false;
} else {
// 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임.
$ss_name = 'ss_secret_'.$bo_table.'_'.$wr['wr_num'];
set_session($ss_name, TRUE);
$is_viewer=true;
echo $wr_id;
}
} else if ($w == 'p') {
$qstr = 'bo_table='.$bo_table.'&amp;sfl='.$sfl.'&amp;stx='.$stx.'&amp;sop='.$sop.'&amp;wr_id='.$wr_id.'&amp;page='.$page;
$wr = get_write($write_table, $wr_id);
if ($wr_password!=$wr['wr_protect']){
echo help('비밀번호가 틀립니다.');
$is_viewer=false;
} else {
// 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임.
$ss_name = 'ss_secret_'.$bo_table.'_'.$wr['wr_num'];
set_session($ss_name, TRUE);
$is_viewer=true;
echo $wr_id;
}
} else
echo help('w 값이 제대로 넘어오지 않았습니다.');
?>

156
style.css Normal file
View file

@ -0,0 +1,156 @@
@charset "utf-8";
/* SIR 지운아빠 */
/* 게시판 목록 */
.board-category {
float:left;height:30px;
display: block;
position: relative;margin: 10px 0;
}
#navi_category ul {text-align:center;}
#navi_category li {display:inline-block; padding:5px 0;}
#navi_category li:before {display:inline-block; content:"|";padding:0 15px;opacity:.6;}
#navi_category li:first-child:before {display:none;content:"";}
#navi_category #bo_cate_on {font-weight:bold;}
/* 갤러리 목록 */
#bo_gall {margin:0 auto;}
#bo_gall h2 {margin:0;padding:0;width:1px;height:1px;font-size:0;line-height:0;overflow:hidden}
#bo_gall #gall_ul {
display:flex;
flex-wrap:wrap;
justify-content: space-around;
box-sizing:border-box;
margin:0 auto;padding:25px 0;list-style:none;}
#bo_gall .gall_box {position:relative; padding:0;overflow:hidden;opacity:0.8;width:100%;height:100%;}
#bo_gall .gall_box:hover {opacity:1;}
#bo_gall .gall_li .gall_chk{position:absolute;bottom:0;left:0;right:0;}
#bo_gall .gall_li .gall_chk label{display:block;width:100%;padding:10px;box-sizing:border-box;}
#bo_gall .gall_con {width:100%;height:100%;}
#bo_gall .bo_tit{display:block;font-weight:bold; width:100%;height:100%;padding:0 10px;box-sizing:border-box;text-align:center;}
/* 게시판 목록 공통 */
#bo_btn_top{margin: 10px 0}
#bo_btn_top:after {display:block;visibility:hidden;clear:both;content:""}
.bo_fx {margin-bottom:5px;float:right; }
.bo_fx:after {display:block;visibility:hidden;clear:both;content:""}
.bo_fx ul {margin:0;padding:0;list-style:none}
.bo_fx #chkall {display:inline-block;width:0;height:0;overflow:hidden;}
.bo_fx #chkall + label span {display:inline-block;font-size:12px;line-height:26px;}
.bo_fx #chkall + label span:after {content:"선택";}
.bo_fx #chkall + label span.on:after{ content:"해제";}
.bo_fx ul {margin:0;padding:0;list-style:none}
.btn_bo_user {float:right;margin:0;padding:0;list-style:none}
.btn_bo_user li {float:left;margin-left:5px;margin-bottom:2px;}
.btn_bo_adm {float:left}
.btn_bo_adm li {float:left;margin-right:5px}
.btn_bo_adm input {padding:0 8px;border:0; text-decoration:none;vertical-align:middle}
#bo_sch {float:left;}
#bo_sch:after {display:block;visibility:hidden;clear:both;content:""}
#bo_sch legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden}
#bo_sch select{border:0;height:28px;float:left;}
#bo_sch .sch_input{height:28px;border:0;padding:0 10px;float:left}
#bo_sch .sch_btn{ float:left; margin-top:-1px; }
#bo_gall li.empty_list {padding:85px 0;text-align:center}
#bo_gall li.gall_li.bo_notice .gall_name,#bo_gall li.gall_li.bo_notice .gall_date{display:none;}
#bo_gall li.gall_li.bo_notice,#bo_gall li.gall_li.bo_notice .gall_box ,#bo_gall li.gall_li.bo_notice .gall_con{display:block;width:100%;clear:both;}
#bo_gall li.gall_li.bo_notice .bo_tit{padding:10px;height:auto;}
#bo_gall li.gall_li.bo_notice .gall_chk{left:auto;right:0;top:0;bottom:0;}
#bo_gall li.gall_li.bo_notice .gall_box {opacity:1;}
#bo_gall .bo_notice .notice_icon{display:inline-block; width:20px;height:20px;line-height:18px;padding:0;margin-right:5px;font-style:normal;text-align:center;font-weight:bold;}
.pg_wrap{clear:both;}
/* 갤러리 뷰 */
#password_box {max-width:300px;margin:20px auto;position:relative;z-index:9999;}
#password_box p{padding:5px;}
#view_box{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,0.7);z-index:999;}
#view_box.on {display:block;}
#view_box .fix-layout {margin:0 auto;height:100%;}
#view_box #close_area{display:block;position:fixed;width:100%;height:100%;top:0;right:0;bottom:0;left:0;z-index:10;}
#view_area{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:90;}
#bo_v {position:relative;padding:20px 30px;box-sizing:border-box; overflow:auto;}
#bo_v_top{position:absolute;width:100%;left:0;z-index:999;}
#bo_v_top:after {display:block;visibility:hidden;clear:both;content:""}
#bo_v_top h2 {position:absolute;font-size:0;line-height:0;overflow:hidden}
#bo_v_top ul {padding-right:20px;list-style:none;word-break:break-all}
#bo_v_info {padding:0 10px;}
#bo_v_info:after {display:block;visibility:hidden;clear:both;content:""}
#bo_v_info h2 {font-size:15px;padding-bottom:5px;}
#bo_v_info strong {display:inline-block;margin:0 10px 0 0;font-weight:normal}
#bo_v_info .if_date{margin:0;opacity:0.8;}
.bo_v_com { float:right; }
.bo_v_com li {float:left;margin-right:8px}
.bo_v_left { float:left}
.bo_v_left li {float:left;margin-right:5px}
.bo_v_nb {position:absolute;width:100%;top:50%;left:0;height:50px;transform:translateY(-50%);z-index:999;}
.bo_v_nb .prev, .bo_v_nb .next{position:relative;display:block;width:50px;height:50px;line-height:50px;}
.bo_v_nb .prev {float:left}
.bo_v_nb .next {float:right;}
.bo_v_nb .prev:after {content:"<";}
.bo_v_nb .next:after {content:">";}
.bo_v_nb .prev:after, .bo_v_nb .next:after{position:absolute;top:0;display:block;width:100%;height:100%;font-size:35px;text-align:center;}
.bo_v_nb .prev span, .bo_v_nb .next span{display:inline-block;width:0;height:0;white-space:nowrap;overflow:hidden;}
#bo_v .bo_block {position:absolute;top:0;right:0;left:0;bottom:0;z-index:100;}
#bo_v_atc {min-height:100px;padding:30px 10px 10px; }
#bo_v_con { width:100%; overflow:hidden}
#bo_v_con img {max-width:100%;height:auto}
/*글쓰기*/
#bo_w .write_div{margin:10px 0;position:relative}
#bo_w .bo_w_info:after {display:block;visibility:hidden;clear:both;content:""}
#bo_w .bo_w_info .frm_input{float:left;width:33%}
#bo_w #wr_password{margin:0 0.5% }
#bo_w .wr_content.smarteditor2 iframe{background:#fff}
#bo_w .bo_w_tit{position:relative}
#bo_w .bo_w_tit .frm_input{padding-right:120px;}
#bo_w .bo_w_tit #btn_autosave{position:absolute;top:0;right:0;line-height:30px;height:30px;}
#bo_w .bo_w_link label,#bo_w .bo_w_flie label{display:inline-block;height:28px;line-height:28px;width:60px;background: #eee;text-align:center;color:#888}
#bo_w .bo_w_link .frm_input,#bo_w .bo_w_flie .frm_file{padding-left:65px}
#bo_w .bo_w_flie .frm_input{margin:10px 0 0 }
.board-write > dl {position:relative;}
.board-write > dl > dt { width:70px;position:absolute;line-height:32px;text-align:center; }
.board-write > dl > dd { width:100%;margin-left:0;padding-left:80px;box-sizing:border-box;line-height:32px;}
.board-write input.frm_input.full { width: 100%; display:block;margin:1px 0;}
/* 게시판 댓글 (현재 사용안함) */
#bo_vc h2 {position:absolute;font-size:0;line-height:0;overflow:hidden}
#bo_vc article {margin:20px 10px;position:relative}
#bo_vc header {line-height:23px;}
#bo_vc header:after {display:block;visibility:hidden;clear:both;content:""}
#bo_vc header .icon_reply {position:absolute;top:15px;left:-20px}
#bo_vc .member, #bo_vc .guest, #bo_vc .sv_member, #bo_vc .sv_guest {font-weight:bold}
#bo_vc h1 {position:absolute;font-size:0;line-height:0;overflow:hidden}
#bo_vc .cmt_contents {padding:10px;margin:5px 0 0;}
#bo_vc #bo_vc_winfo {float:left}
.bo_vc_w {position:relative;margin:10px 0;display:block;}
.bo_vc_w:after {display:block;visibility:hidden;clear:both;content:""}
.bo_vc_w h2 {position:absolute;font-size:0;line-height:0;overflow:hidden}
.bo_vc_w #char_cnt {display:block;margin:0 0 5px}
.bo_vc_w_info{margin:10px 0;float:left}
.bo_vc_w_info:after {display:block;visibility:hidden;clear:both;content:""}
.bo_vc_w_info .frm_input{float:left;margin-right:5px}
.bo_vc_w .btn_confirm{float:right;margin-top:5px}
.bo_vc_w .btn_confirm label{display:inline-block;margin-right:10px; text-align:center;}
.bo_vc_w .btn_submit{height:30px;padding:0 20px; font-weight:bold; }
.bo_vc_w_wr:after {display:block;visibility:hidden;clear:both;content:""}

185
view.php Normal file
View file

@ -0,0 +1,185 @@
<?php
include_once('./_common.php');
$view=sql_fetch("select * from {$write_table} where wr_id='{$wr_id}'" );
// 윗글을 얻음
$prev = sql_fetch(" select wr_id, wr_num from {$write_table} where wr_is_comment = 0 and wr_num < '{$view['wr_num']}' and wr_parent=wr_id order by wr_num desc limit 1 ");
// 아래글을 얻음
$next = sql_fetch(" select wr_id, wr_num from {$write_table} where wr_is_comment = 0 and wr_num > '{$view['wr_num']}' and wr_parent=wr_id order by wr_num asc limit 1 ");
// 수정, 삭제 링크
$update_href = $delete_href = '';
// 로그인중이고 자신의 글이라면 또는 관리자라면 비밀번호를 묻지 않고 바로 수정, 삭제 가능
if (($member['mb_id'] && ($member['mb_id'] === $view['mb_id'])) || $is_admin) {
$update_href = './write.php?w=u&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id;
set_session('ss_delete_token', $token = uniqid(time()));
$delete_href ='./delete.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;token='.$token;
}else if (!$view['mb_id']) { // 회원이 쓴 글이 아니라면
$update_href = './password.php?w=u&amp;bo_table='.$bo_table.'&amp;wr_id='.$view['wr_id'].'&amp;page='.$page.$qstr;
$delete_href = './password.php?w=d&amp;bo_table='.$bo_table.'&amp;wr_id='.$view['wr_id'].'&amp;page='.$page.$qstr;
}
?>
<!-- 게시물 읽기 시작 { -->
<div class="bo_v_nb">
<? if ($prev['wr_id']) { ?><a href="javascript:open_view('<?=$bo_table?>','<?=$prev['wr_id']?>');" class="prev" ><span>이전글</span></a><? } ?>
<? if ($next['wr_id']) { ?><a href="javascript:open_view('<?=$bo_table?>','<?=$next['wr_id']?>');" class="next" ><span>다음글</span></a><? } ?>
</div>
<article id="bo_v" class="theme-box" >
<?if($view['wr_protect']!=''){
if( get_session("ss_secret_{$bo_table}_{$view['wr_num']}") || $view['mb_id'] && $view['mb_id']==$member['mb_id'] || $is_admin )
$is_viewer = true;
else {
$is_viewer = false;?>
<div id="password_box">
<p>
<strong>보호글입니다.</strong>
열람을 위해 비밀번호를 입력 주세요.
</p>
<div class="pass-form">
<form name="fboardpassword" action="<?=$board_skin_url?>/password_check.php" method="post" id="fboardpass">
<input type="hidden" name="w" value="p">
<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="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<fieldset class="box-pw">
<input type="text" name="wr_password" id="password_wr_password" required class="frm_input required" size="15" maxlength="20">
<input type="submit" value="확인" class="pass-btn btn_submit ui-btn">
</fieldset>
</form>
</div>
</div>
<? }}else if(strstr($view['wr_option'],'secret')){
if( !$view['mb_id'] && get_session("ss_secret_{$bo_table}_{$view['wr_num']}") || $view['mb_id'] && $view['mb_id']==$member['mb_id'] || $is_admin )
$is_viewer = true;
else {
$is_viewer = false;
if(!$view['mb_id']){?>
<div id="password_box">
<p class="txt-center">
<strong>비밀글입니다.</strong>
열람을 위해 비밀번호를 입력 주세요.
</p>
<div class="pass-form">
<form name="fboardpassword" action="<?=$board_skin_url?>/password_check.php" id="fboardpass">
<input type="hidden" name="w" value="s">
<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="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<fieldset class="box-pw">
<input type="password" name="wr_password" id="password_wr_password" required class="frm_input required" size="15" maxlength="20">
<input type="submit" value="확인" class="pass-btn btn_submit ui-btn">
</fieldset>
</form>
</div>
</div>
<?}else {?>
<div id="password_box">
<p class="txt-center" style="padding:30px 0;"><strong>비밀글입니다.</strong></p>
</div>
<?}
}}else if ($view['wr_secret'] && !$is_member){
$is_viewer=false;?>
<div id="password_box">
<p class="txt-center" style="padding:30px 0;"><strong>멤버공개글입니다.</strong></p>
</div>
<?
}else {if($board['bo_read_level']<=$member['mb_level'] ) $is_viewer=true;}
if($is_viewer){?>
<div class="bo_block">&nbsp;</div>
<!-- 게시물 상단 버튼 시작 { -->
<div id="bo_v_top">
<ul class="bo_v_com">
<?php if ($update_href) { ?><li><a href="<?php echo $update_href ?>" >M</a></li><?php } ?>
<?php if ($delete_href) { ?><li><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;">D</a></li><?php } ?>
</ul>
</div>
<!-- } 게시물 상단 버튼 -->
<section id="bo_v_atc" class="txt-center">
<?php
// 파일 출력
if($board['bo_use_dhtml_editor']){
echo conv_content($view['wr_content'],2);
}else{
if ($view['wr_file']>0) { /* view 인 경우 */
$result = sql_query(" select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' order by bf_no ");
for ($k=0;$file = sql_fetch_array($result);$k++)
{
$file_url=G5_DATA_URL."/file/".$file['bo_table']."/".$file['bf_file'];
?>
<p><img src="<?=$file_url?>"></p>
<?}
}
}
?>
</section>
<!-- 게시물 하단 영역 -->
<hr class="line">
<section id="bo_v_info" class="txt-right">
<h2 id="bo_v_title" >
<span class="bo_v_tit txt-point">
<?php
echo $view['wr_subject']; // 글제목 출력
?></span>
</h2>
<?php if ($board['bo_use_category'] && $view['ca_name']) { ?>
<strong class="bo_v_cate"><?php echo $view['ca_name']; // 분류 출력 끝 ?></strong>
<?php } ?>
<strong></strong>
<!--
<span class="sound_only">작성자</span> <strong><?php echo $view['wr_name'] ?></strong>
-->
<strong class="if_date"><span class="sound_only">작성일</span><?php echo date("Y/m/d", strtotime($view['wr_datetime'])) ?></strong>
</section>
<!-- 게시물 하단 영역 -->
<?}?>
</article>
<!-- } 게시글 읽기 -->
<script>
var w=document.documentElement.clientHeight-100;
$("#bo_v").css('max-height',w+'px');
$('#fboardpass').submit(function(e){
e.preventDefault();
var form = $(this);
var post_url = form.attr('action');
var post_data = form.serialize();
$.ajax({
type: 'POST',
url: post_url,
data:post_data,
success: function(data) {
// Toss
var response = data;
if(response>0)
$('#view_area').empty().load("<?=$board_skin_url?>/view.php?bo_table=<?=$bo_table?>&wr_id="+response);
else $("#password_box").append(response);
}
, error: function(data, status, err) {
}
, complete: function() {
// Complete
}
});
});
</script>

292
view_comment.skin.php Normal file
View file

@ -0,0 +1,292 @@
<?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">
<h2>댓글목록</h2>
<?php
$cmt_amt = count($list);
for ($i=0; $i<$cmt_amt; $i++) {
$comment_id = $list[$i]['wr_id'];
$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;
$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; ?>">
<h2><?php echo get_text($list[$i]['wr_name']); ?>님의 <?php if ($cmt_depth) { ?><span class="sound_only">댓글의</span><?php } ?> 댓글</h2>
<?php echo $list[$i]['name'] ?>
<span class="sound_only">작성일</span>
<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>
<ul class="bo_vc_act">
<?php if ($list[$i]['is_reply']) { ?><li><a href="<?php echo $c_reply_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'c'); return false;" class="ui-btn small">답변</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;" class="ui-btn small">수정</a></li><?php } ?>
<?php if ($list[$i]['is_del']) { ?><li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();" class="ui-btn small">삭제</a></li><?php } ?>
</ul>
</header>
<!-- 댓글 출력 -->
<div class="cmt_contents">
<p>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?> <span class="icon color_3">비밀글</span> <?php } ?>
<?php echo $comment ?>
</p>
<?php if($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) {
$query_string = clean_query_string($_SERVER['QUERY_STRING']);
if($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql);
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
$cmt['wr_content'] = '';
$c_wr_content = $cmt['wr_content'];
}
$c_reply_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=c#bo_vc_w';
$c_edit_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=cu#bo_vc_w';
?>
<?php } ?>
</div>
<span id="edit_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 수정 -->
<span id="reply_<?php echo $comment_id ?>" class="bo_vc_w"></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>
</article>
<hr class="line" />
<?php } ?>
</section>
<!-- } 댓글 -->
<?php if ($is_comment_write) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w" class="bo_vc_w">
<h2>댓글쓰기</h2>
<form name="fviewcomment" id="fviewcomment" action="<?php echo $comment_action_url; ?>" 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="">
<span class="sound_only">내용</span>
<?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>
<div class="bo_vc_w_wr">
<div class="bo_vc_w_info">
<?php if ($is_guest) { ?>
<label for="wr_name" class="sound_only">이름<strong> 필수</strong></label>
<input type="text" name="wr_name" value="<?php echo get_cookie("ck_sns_name"); ?>" id="wr_name" required class="frm_input required" size="25" placeholder="이름">
<label for="wr_password" class="sound_only">비밀번호<strong> 필수</strong></label>
<input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="25" placeholder="비밀번호">
<?php
}
?>
<?php if ($is_guest) { ?>
<?php echo $captcha_html; ?>
<?php } ?>
</div>
<div class="btn_confirm">
<input type="checkbox" name="wr_secret" value="secret" id="wr_secret">
<label for="wr_secret"> 비밀글</label>
<input type="submit" id="btn_submit" class="ui-btn submit" value="등록">
</div>
</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(($board['bo_use_captcha'] && $w !== 'u') && !$is_admin) echo chk_captcha_js(); ?>
set_comment_token(f);
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
function comment_box(comment_id, work)
{
var el_id,
form_el = 'fviewcomment',
respond = document.getElementById(form_el);
// 댓글 아이디가 넘어오면 답변, 수정
if (comment_id)
{
if (work == 'c')
el_id = 'reply_' + comment_id;
else
el_id = 'edit_' + comment_id;
}
else
el_id = 'bo_vc_w';
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).appendChild(respond);
//입력값 초기화
document.getElementById('wr_content').value = '';
// 댓글 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
if(save_before)
$("#captcha_reload").trigger("click");
save_before = el_id;
}
}
function comment_delete()
{
return confirm("이 댓글을 삭제하시겠습니까?");
}
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
</script>
<?php } ?>
<!-- } 댓글 쓰기 -->

245
write.skin.php Normal file
View file

@ -0,0 +1,245 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<hr class="padding">
<section id="bo_w">
<!-- 게시물 작성/수정 시작 { -->
<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 ?>">
<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="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
$option = '';
$option_hidden = '';
$sec='';
if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = '';
if ($is_notice) {
$option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>';
}
if ($is_html) {
if ($is_dhtml_editor) {
$option_hidden .= '<input type="hidden" value="html1" name="html">';
} else {
$option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>';
}
}
if ($is_mail) {
$option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>';
}
if ($is_secret) {
if ($is_admin || $is_secret==1) {
if($secret_checked)$sec_select="selected";
$sec .='<option value="secret" '.$sec_select.'>비밀글</option>';
} else {
$option_hidden .= '<input type="hidden" name="secret" value="secret">';
}
}
}
echo $option_hidden;
if($write['wr_secret']=='1') $mem_select="selected";
if($write['wr_protect']!='') $pro_select="selected";
if($is_member) {$sec .='<option value="protect" '.$pro_select.'>보호글</option>';
$sec .='<option value="member" '.$mem_select.'>멤버공개</option>';}
?>
<div class="board-write theme-box">
<?php if ($is_category) { ?>
<dl>
<dt>CATEGORY</dt>
<dd><nav id="write_category">
<select name="ca_name" id="ca_name" required class="required" >
<option value="">선택하세요</option>
<?php echo $category_option ?>
</select>
</nav>
</dd>
</dl>
<?}?>
<dl>
<dt>OPTION</dt>
<dd>
<?if($is_secret!=2||$is_admin){?>
<select name="set_secret" id="set_secret">
<option value="">전체공개</option>
<?=$sec?>
</select>
<?}?>
<?php echo $option ?></dd>
</dl>
<dl id="set_protect" style="display:<?=$w=='u' && $pro_select ? 'block':'none'?>;">
<dt><label for="wr_protect">보호글 암호</label></dt>
<dd><input type="text" name="wr_protect" id="wr_protect" value="<?=$write['wr_protect']?>" maxlength="20"></dd>
</dl>
<dl>
<dt>SUBJECT</dt>
<dd><input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required full" size="50" maxlength="255"></dd>
</dl>
<dl>
<dt>CONTENT</dt>
<dd><div class="wr_content">
<?php if($write_min || $write_max) { ?>
<!-- 최소/최대 글자 사용 -->
<p id="char_count_desc"> 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
<?php } ?>
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
<?php if($write_min || $write_max) { ?>
<!-- 최소/최대 글자 사용 -->
<div id="char_count_wrap"><span id="char_count"></span>글자</div>
<?php } ?>
</div></dd>
</dl>
<?if(!$board['bo_use_dhtml_editor']){?>
<dl>
<dt>FILES</dt>
<dd>
<?for($i=0;$i<$board['bo_upload_count'];$i++){?>
<input type="file" name="bf_file[]" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input full">
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
<?php } ?>
<?php if($w == 'u' && $file[$i]['file']) { ?>
<input type="checkbox" id="bf_file_del<?php echo $i ?>" name="bf_file_del[<?php echo $i; ?>]" value="1"> <label for="bf_file_del<?php echo $i ?>"><?php echo $file[$i]['source'].'('.$file[$i]['size'].')'; ?> 파일 삭제</label>
<?php } ?>
<?}?>
</dd>
</dl>
<?}?>
<?if(!$is_member){?>
<dl>
<dt></dt>
<dd class="txt-right">
<?php if ($is_name) { ?>
<label for="wr_name">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" >
<?php } ?>
<?php if ($is_password) { ?>
&nbsp;&nbsp;
<label for="wr_password">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 ?>" >
<?php } ?>
</dd>
</dl>
<?}?>
</div>
<hr class="padding" />
<div class="btn_confirm txt-center">
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn_submit ui-btn point">
<a href="./board.php?bo_table=<?php echo $bo_table ?>" class="btn_cancel ui-btn">취소</a>
</div>
</form>
<script>
<?php if($write_min || $write_max) { ?>
// 글자수 제한
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
check_byte("wr_content", "char_count");
$(function() {
$("#wr_content").on("keyup", function() {
check_byte("wr_content", "char_count");
});
});
<?php } ?>
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)
{
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
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;
}
$('#set_secret').on('change', function() {
var selection = $(this).val();
if(selection=='protect') $('#set_protect').css('display','block');
else {$('#set_protect').css('display','none'); $('#wr_protect').val('');}
});
</script>
</section>
<!-- } 게시물 작성/수정 -->

31
write_update.skin.php Normal file
View file

@ -0,0 +1,31 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$temp=sql_fetch("select * from {$write_table}");
if(!isset($temp['wr_protect'])){
sql_query(" ALTER TABLE `{$write_table}` ADD `wr_protect` varchar(255) NOT NULL DEFAULT '' AFTER `wr_url` ");
}
unset($temp);
if($w!='c' && $w!='cu'){
$temp_wr_id = $wr_id;
$sec="";
$mem=0;
$protect="";
if($set_secret) {
if($set_secret=='secret'){
$sec="secret";
}
else if ($set_secret=='member'){
$mem=1;
}
else if($set_secret == 'protect' && $wr_protect!=''){
$protect=$wr_protect;
}
}
sql_query("update {$write_table} set wr_option='$html,$sec', wr_secret='{$mem}', wr_protect= '{$wr_protect}' where wr_id='{$wr_id}'");
}
goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.$qstr);
?>