This commit is contained in:
Amberstone 2024-10-19 10:45:56 +09:00
parent 2c6a4e0e96
commit 81df73bda7
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
8 changed files with 1171 additions and 1103 deletions

View file

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

View file

@ -1,78 +1,85 @@
<?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%";
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);
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_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_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]);
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;
}
#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 } ?>
<!-- 게시판 카테고리 시작 { -->
<?php if ($is_category) { ?>
<nav id="navi_category">
<?php if ($board['bo_type'] == 'board') { ?>
<select name="sca" id="sca" onchange="location.href='?bo_table=<?= $bo_table ?>&sca=' + this.value;">
<option value="">전체</option>
<?php echo $category_option ?>
</select>
<?php } else { ?>
<ul>
<?php echo $category_option ?>
</ul>
<?php } ?>
</div>
<!-- } 게시판 페이지 정보 버튼 -->
<?php } ?>
</nav>
<?php } ?>
<!-- } 게시판 카테고리 -->
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<!-- 게시판 페이지 정보 버튼 시작 { -->
<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 ?>">
@ -84,227 +91,241 @@ if($board['bo_2']){
<ul id="gall_ul" class="gall_row">
<?php for ($i=0; $i<count($list); $i++) {
<?php for ($i = 0; $i < count($list); $i++) {
$img_content="none";
$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";
}
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) { ?>
?>
<li class="gall_li<?php 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>
<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" <?php } ?>>
<?php
// 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>"; } ?>
<?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 || $is_checkbox || $write_href) { ?>
<div class="bo_fx">
<?php if ($list_href || $write_href) { ?>
<ul class="btn_bo_user">
<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>
<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 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>
</div>
<?php } ?>
</form>
</form>
<!-- 게시판 검색 시작 { -->
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<!-- 게시판 검색 시작 { -->
<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>
<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'); ?>>제목</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>
<!-- } 게시판 검색 -->
<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>
<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>
</div>
<?php if($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?php if ($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?php } ?>
<!-- 페이지 -->
<?php echo $write_pages; ?>
<?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++){
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(''));
}
$("#gall_ul").append(html.join(''));
$("#close_area").click(function(){
$("#view_box").removeClass('on');
$("#view_area").empty();
return false;
});
$("#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;
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++) {
for (var i = 0; i < f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
f.elements[i].checked = sw;
}
}
}
function fboardlist_submit(f) {
var chk_count = 0;
function fboardlist_submit(f) {
var chk_count = 0;
for (var i=0; i<f.length; i++) {
for (var i = 0; i < f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++;
}
chk_count++;
}
if (!chk_count) {
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
}
if(document.pressed == "선택복사") {
if (document.pressed == "선택복사") {
select_copy("copy");
return;
}
}
if(document.pressed == "선택이동") {
if (document.pressed == "선택이동") {
select_copy("move");
return;
}
}
if(document.pressed == "선택삭제") {
if (document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
return false;
return false;
f.removeAttribute("target");
f.action = "./board_list_update.php";
}
return true;
}
return true;
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
if (sw == 'copy')
if (sw == 'copy')
str = "복사";
else
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
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 } ?>
f.sw.value = sw;
f.target = "move";
f.action = "./move.php";
f.submit();
}
<?php } ?>
</script>
<!-- } 게시판 목록 -->

View file

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

19
readme.md Normal file
View file

@ -0,0 +1,19 @@
## 게시판 갤러리형 게시판 (고정사이즈) 스킨
작성자: 대하 (Extra Shot)
원본주소: https://extrashot.tistory.com/76
오류 수정 및 일부 코드에 최적화 작업을 진행했습니다.
### 주요 수정 사항
- short open tag 제거
모든 아보카도 버전에 호환됩니다.
## 설치방법
아보카도가 설치된 폴더의 하위 폴더인 `skin/board/``gallery_fix` 라는 폴더를 생성하고 파일을 업로드합니다.
```
php 최소 버전: 5.6 이상 (5.3부터 사용 가능)
```

315
view.php
View file

@ -1,185 +1,196 @@
<?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 ");
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 ");
// 아래글을 얻음
$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;
// 수정, 삭제 링크
$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 class="bo_v_nb">
<?php if ($prev['wr_id']) { ?><a href="javascript:open_view('<?= $bo_table ?>','<?= $prev['wr_id'] ?>');"
class="prev"><span>이전글</span></a><?php } ?>
<?php if ($next['wr_id']) { ?><a href="javascript:open_view('<?= $bo_table ?>','<?= $next['wr_id'] ?>');"
class="next"><span>다음글</span></a><?php } ?>
</div>
<article id="bo_v" class="theme-box">
<? }}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">
<?php 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" 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 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>
</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>
</div>
<?php }
} 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>
<?php } else { ?>
<div id="password_box">
<p class="txt-center" style="padding:30px 0;"><strong>비밀글입니다.</strong></p>
</div>
<?php }
}
} 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>
<?php
} 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>
<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>
<?}
}
}
?>
<?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>
<?php }
}
}
?>
</section>
<!-- 게시물 하단 영역 -->
<hr class="line">
<!-- 게시물 하단 영역 -->
<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>
<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>
<!-- 게시물 하단 영역 -->
<?}?>
<!-- 게시물 하단 영역 -->
<?php } ?>
</article>
<!-- } 게시글 읽기 -->
<script>
var w=document.documentElement.clientHeight-100;
$("#bo_v").css('max-height',w+'px');
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) {
$('#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
}
});
});
}
, complete: function () {
// Complete
}
});
});
</script>

View file

@ -1,256 +1,258 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (!defined('_GNUBOARD_'))
exit; // 개별 페이지 접근 불가
?>
<script>
// 글자수 제한
var char_min = parseInt(<?php echo $comment_min ?>); // 최소
var char_max = parseInt(<?php echo $comment_max ?>); // 최대
// 글자수 제한
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 이하 사이드뷰 겹침 문제 해결
?>
<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>
<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']);
<!-- 댓글 출력 -->
<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'];
}
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><!-- 답변 -->
$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>
<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 } ?>
<hr class="line" />
<?php } ?>
</section>
<!-- } 댓글 -->
<?php if ($is_comment_write) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w" class="bo_vc_w">
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="">
<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) {
<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">
}
});
</script>
<div class="bo_vc_w_wr">
<div class="bo_vc_w_info">
<?php if ($is_guest) { ?>
<?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="이름">
<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="비밀번호">
<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 } ?>
}
?>
<?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="등록">
<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>
</div>
</form>
</aside>
<script>
var save_before = '';
var save_html = document.getElementById('bo_vc_w').innerHTML;
</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)) {
function good_and_write() {
var f = document.fviewcomment;
if (fviewcomment_submit(f)) {
f.is_good.value = 1;
f.submit();
} else {
} else {
f.is_good.value = 0;
}
}
}
function fviewcomment_submit(f)
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
function fviewcomment_submit(f) {
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
f.is_good.value = 0;
f.is_good.value = 0;
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url + "/ajax.filter.php",
type: "POST",
data: {
"subject": "",
"content": f.wr_content.value
"subject": "",
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
success: function (data, textStatus) {
subject = data.subject;
content = data.content;
}
});
});
if (content) {
alert("내용에 금지단어('"+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)
{
// 양쪽 공백 없애기
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;
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)
{
}
else if (!document.getElementById('wr_content').value) {
alert("댓글을 입력하여 주십시오.");
return false;
}
}
if (typeof(f.wr_name) != 'undefined')
{
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 (f.wr_name.value == '') {
alert('이름이 입력되지 않았습니다.');
f.wr_name.focus();
return false;
}
}
}
if (typeof(f.wr_password) != 'undefined')
{
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;
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;
}
<?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,
function comment_box(comment_id, work) {
var el_id,
form_el = 'fviewcomment',
respond = document.getElementById(form_el);
// 댓글 아이디가 넘어오면 답변, 수정
if (comment_id)
{
// 댓글 아이디가 넘어오면 답변, 수정
if (comment_id) {
if (work == 'c')
el_id = 'reply_' + comment_id;
el_id = 'reply_' + comment_id;
else
el_id = 'edit_' + 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';
if (save_before != el_id) {
if (save_before) {
document.getElementById(save_before).style.display = 'none';
}
document.getElementById(el_id).style.display = '';
@ -259,34 +261,32 @@ function comment_box(comment_id, work)
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;
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");
if (save_before)
$("#captcha_reload").trigger("click");
save_before = el_id;
}
}
}
function comment_delete()
{
return confirm("이 댓글을 삭제하시겠습니까?");
}
function comment_delete() {
return confirm("이 댓글을 삭제하시겠습니까?");
}
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
</script>
</script>
<?php } ?>
<!-- } 댓글 쓰기 -->

View file

@ -1,245 +1,263 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (!defined('_GNUBOARD_'))
exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
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>';
}
<!-- 게시물 작성/수정 시작 { -->
<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_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_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">';
}
}
}
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>';}
?>
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>
<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>
<?php } ?>
<dl>
<dt>OPTION</dt>
<dd>
<?php if ($is_secret != 2 || $is_admin) { ?>
<select name="set_secret" id="set_secret">
<option value="">전체공개</option>
<?= $sec ?>
</select>
<?php } ?>
<?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>
<?php if (!$board['bo_use_dhtml_editor']) { ?>
<dl>
<dt>FILES</dt>
<dd>
<?php 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 } ?>
<?php } ?>
</dd>
</dl>
<?}?>
<?php } ?>
<?php 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>
<?php } ?>
</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");
});
});
<?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 } ?>
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 = "";
}
<?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>
<?}?>
function fwrite_submit(f) {
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
</div>
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;
}
});
<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>
if (subject) {
alert("제목에 금지단어('" + subject + "')가 포함되어있습니다");
f.wr_subject.focus();
return false;
}
<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");
if (content) {
alert("내용에 금지단어('" + content + "')가 포함되어있습니다");
if (typeof (ed_wr_content) != "undefined")
ed_wr_content.returnFalse();
else
f.wr_content.focus();
return false;
}
$(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;
}
}
}
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";
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>
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>
<!-- } 게시물 작성/수정 -->

View file

@ -1,31 +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` ");
}
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'){
if ($w != 'c' && $w != 'cu') {
$temp_wr_id = $wr_id;
$temp_wr_id = $wr_id;
$sec="";
$mem=0;
$protect="";
$sec = "";
$mem = 0;
$protect = "";
if($set_secret) {
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;
}
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}'");
}
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);
?>
goto_url(G5_HTTP_BBS_URL . '/board.php?bo_table=' . $bo_table . $qstr);