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 <?php
include_once('../../../common.php'); include_once '../../../common.php';
?>

View file

@ -1,41 +1,45 @@
<?php <?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_'))
include_once(G5_LIB_PATH.'/thumbnail.lib.php'); exit; // 개별 페이지 접근 불가
if($board['bo_type']=='board')$category_option = get_category_option($bo_table, $sca); include_once G5_LIB_PATH . '/thumbnail.lib.php';
if($board['bo_table_width']==0) $width="100%"; 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('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_size = array();
$gall_margin=array(); $gall_margin = array();
$gall_w=240; $gall_w = 240;
$gall_h=240; $gall_h = 240;
$gall_mw = 10; $gall_mw = 10;
$gall_mh = 10; $gall_mh = 10;
if($board['bo_1']){ if ($board['bo_1']) {
$gall_size=explode("|",$board['bo_1']); $gall_size = explode("|", $board['bo_1']);
$gall_w=trim($gall_size[0]); $gall_w = trim($gall_size[0]);
if(count($gall_size)>1) if (count($gall_size) > 1)
$gall_h=trim($gall_size[1]); $gall_h = trim($gall_size[1]);
else else
$gall_h=trim($gall_size[0]); $gall_h = trim($gall_size[0]);
} }
if($board['bo_2']){ if ($board['bo_2']) {
$gall_margin=explode("|",$board['bo_2']); $gall_margin = explode("|", $board['bo_2']);
$gall_mh=trim($gall_margin[0]); $gall_mh = trim($gall_margin[0]);
if(count($gall_margin)>1) if (count($gall_margin) > 1)
$gall_mw=trim($gall_margin[1]); $gall_mw = trim($gall_margin[1]);
else else
$gall_mw=trim($gall_margin[0]); $gall_mw = trim($gall_margin[0]);
} }
?> ?>
<style> <style>
#gall_ul .gall_li{ #gall_ul .gall_li {
margin-bottom:<?=$gall_mh?>px; margin-bottom: <?= $gall_mh ?>px;
} }
#gall_ul .gall_li:not(.bo_notice){
width:<?=$gall_w?>px; #gall_ul .gall_li:not(.bo_notice) {
height:<?=$gall_h?>px; width: <?= $gall_w ?>px;
height: <?= $gall_h ?>px;
} }
</style> </style>
@ -44,20 +48,20 @@ if($board['bo_2']){
<!-- 게시판 카테고리 시작 { --> <!-- 게시판 카테고리 시작 { -->
<? if ($is_category) { ?> <?php if ($is_category) { ?>
<nav id="navi_category"> <nav id="navi_category">
<?if($board['bo_type']=='board'){?> <?php if ($board['bo_type'] == 'board') { ?>
<select name="sca" id="sca" onchange="location.href='?bo_table=<?=$bo_table?>&sca=' + this.value;"> <select name="sca" id="sca" onchange="location.href='?bo_table=<?= $bo_table ?>&sca=' + this.value;">
<option value="">전체</option> <option value="">전체</option>
<? echo $category_option ?> <?php echo $category_option ?>
</select> </select>
<?}else {?> <?php } else { ?>
<ul> <ul>
<?php echo $category_option ?> <?php echo $category_option ?>
</ul> </ul>
<?}?> <?php } ?>
</nav> </nav>
<? } ?> <?php } ?>
<!-- } 게시판 카테고리 --> <!-- } 게시판 카테고리 -->
@ -65,14 +69,17 @@ if($board['bo_2']){
<div id="bo_btn_top"> <div id="bo_btn_top">
<?php if ($rss_href || $write_href) { ?> <?php if ($rss_href || $write_href) { ?>
<ul class="btn_bo_user"> <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 ($admin_href) { ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="ui-btn point">글쓰기</a></li><?php } ?> <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> </ul>
<?php } ?> <?php } ?>
</div> </div>
<!-- } 게시판 페이지 정보 버튼 --> <!-- } 게시판 페이지 정보 버튼 -->
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post"> <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="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>"> <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>"> <input type="hidden" name="stx" value="<?php echo $stx ?>">
@ -84,25 +91,28 @@ if($board['bo_2']){
<ul id="gall_ul" class="gall_row"> <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']) { if (!$list[$i]['is_notice']) {
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'],$gall_w,$gall_h,false,true); $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $gall_w, $gall_h, false, true);
if($thumb['src']) if ($thumb['src'])
$img_content = "url('".$thumb['src']."') center no-repeat;background-size:cover"; $img_content = "url('" . $thumb['src'] . "') center no-repeat;background-size:cover";
else $img_content="none"; else
$img_content = "none";
} }
?> ?>
<li class="gall_li<? if ($list[$i]['is_notice']) echo " bo_notice";?>"> <li class="gall_li<?php if ($list[$i]['is_notice'])
<div class="gall_box theme-box" style="background:<?=$img_content?>;"> echo " bo_notice"; ?>">
<div class="gall_box theme-box" style="background:<?= $img_content ?>;">
<div class="gall_chk"> <div class="gall_chk">
<?php if ($is_checkbox) { ?> <?php if ($is_checkbox) { ?>
<label for="chk_wr_id_<?php echo $i ?>"><span class="sound_only"><?php echo $list[$i]['subject'] ?></span> <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> <input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>"
id="chk_wr_id_<?php echo $i ?>"></label>
<?php } ?> <?php } ?>
<span class="sound_only"> <span class="sound_only">
<?php <?php
@ -114,12 +124,14 @@ if($board['bo_2']){
</span> </span>
</div> </div>
<div class="gall_con"> <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" > <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']) { // 공지사항 ?> <?php if ($list[$i]['is_notice']) { // 공지사항 ?>
<i class="ui-btn point notice_icon">!</i> <i class="ui-btn point notice_icon">!</i>
<?php }?> <?php } ?>
<strong <?php if (!$list[$i]['is_notice']) { ?>class="sound_only"<?}?>> <strong <?php if (!$list[$i]['is_notice']) { ?>class="sound_only" <?php } ?>>
<? <?php
// echo $list[$i]['icon_reply']; 갤러리는 reply 를 사용 안 할 것 같습니다. - 지운아빠 2013-03-04 // echo $list[$i]['icon_reply']; 갤러리는 reply 를 사용 안 할 것 같습니다. - 지운아빠 2013-03-04
if ($is_category && $list[$i]['ca_name']) { if ($is_category && $list[$i]['ca_name']) {
?> ?>
@ -132,7 +144,9 @@ if($board['bo_2']){
</div> </div>
</li> </li>
<?php } ?> <?php } ?>
<?php if (count($list) == 0) { echo "<li class=\"empty_list\">게시물이 없습니다.</li>"; } ?> <?php if (count($list) == 0) {
echo "<li class=\"empty_list\">게시물이 없습니다.</li>";
} ?>
</ul> </ul>
<?php if ($list_href || $is_checkbox || $write_href) { ?> <?php if ($list_href || $is_checkbox || $write_href) { ?>
@ -141,13 +155,19 @@ if($board['bo_2']){
<ul class="btn_bo_user"> <ul class="btn_bo_user">
<?php if ($is_checkbox) { ?> <?php if ($is_checkbox) { ?>
<li><input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);"> <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> <label for="chkall"><span id="checkall" class="ui-btn etc">전체</span></label>
<li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value" class="ui-btn admin"></li> </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"
<li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value" class="ui-btn admin"></li> 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 } ?>
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="ui-btn">목록</a></li><?php } ?> <?php if ($list_href) { ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="ui-btn point">글쓰기</a></li><?php } ?> <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> </ul>
<?php } ?> <?php } ?>
</div> </div>
@ -164,16 +184,17 @@ if($board['bo_2']){
<input type="hidden" name="sop" value="and"> <input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label> <label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl"> <select name="sfl" id="sfl">
<option value="wr_subject"<?php echo get_selected($sfl, 'wr_subject', true); ?>>제목</option> <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_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="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,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="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,1" <?php echo get_selected($sfl, 'wr_name,1'); ?>>글쓴이</option>
<!-- <option value="wr_name,0"<?php echo get_selected($sfl, 'wr_name,0'); ?>>글쓴이(코)</option>--> <!-- <option value="wr_name,0"<?php echo get_selected($sfl, 'wr_name,0'); ?>>글쓴이(코)</option>-->
</select> </select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label> <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="검색"> <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> <button type="submit" value="검색" class="ui-btn">검색</button>
</form> </form>
</fieldset> </fieldset>
@ -183,15 +204,15 @@ if($board['bo_2']){
<div id="view_box"> <div id="view_box">
<a href="#" id="close_area"><span class="sound_only">close</span></a> <a href="#" id="close_area"><span class="sound_only">close</span></a>
<div class="fix-layout"> <div class="fix-layout">
<div id="view_area" style="width:100%"> <div id="view_area" style="width:100%">
</div> </div>
</div>
</div> </div>
</div> <?php if ($is_checkbox) { ?>
<?php if($is_checkbox) { ?> <noscript>
<noscript> <p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p> </noscript>
</noscript>
<?php } ?> <?php } ?>
@ -199,66 +220,66 @@ if($board['bo_2']){
<!-- 페이지 --> <!-- 페이지 -->
<?php echo $write_pages; ?> <?php echo $write_pages; ?>
<script> <script>
const gall_max=$("#gall_ul").width(); const gall_max = $("#gall_ul").width();
const gall_w=<?=$gall_w?>; const gall_w = <?= $gall_w ?>;
const margin=<?=$gall_mw?>; const margin = <?= $gall_mw ?>;
let cols=Math.floor((gall_max+margin)/(gall_w+margin)); let cols = Math.floor((gall_max + margin) / (gall_w + margin));
let new_w=(cols-1)*(gall_w+margin)+gall_w; let new_w = (cols - 1) * (gall_w + margin) + gall_w;
$("#gall_ul").css("max-width",new_w+"px"); $("#gall_ul").css("max-width", new_w + "px");
let html=[]; let html = [];
const items=$(".gall_li:not(.bo_notice)").length; const items = $(".gall_li:not(.bo_notice)").length;
let leftover=cols-items%cols; let leftover = cols - items % cols;
if(leftover==cols) leftover=0; if (leftover == cols) leftover = 0;
for(i=0;i<leftover;i++){ for (i = 0; i < leftover; i++) {
html.push('<li class="gall_li empty"></li>'); html.push('<li class="gall_li empty"></li>');
} }
$("#gall_ul").append(html.join('')); $("#gall_ul").append(html.join(''));
$("#close_area").click(function(){ $("#close_area").click(function () {
$("#view_box").removeClass('on'); $("#view_box").removeClass('on');
$("#view_area").empty(); $("#view_area").empty();
return false; return false;
}); });
function open_view(table,idx) { function open_view(table, idx) {
hlink='<?=$board_skin_url?>/view.php?bo_table='+table+'&wr_id='+idx; hlink = '<?= $board_skin_url ?>/view.php?bo_table=' + table + '&wr_id=' + idx;
$.ajax({ $.ajax({
async: true async: true
, url: hlink , url: hlink
, beforeSend: function() {} , beforeSend: function () { }
, success: function(data) { , success: function (data) {
// Toss // Toss
var response = data; var response = data;
$('#view_area').empty().append(response); $('#view_area').empty().append(response);
$('#view_box').addClass('on'); $('#view_box').addClass('on');
} }
, error: function(data, status, err) { , error: function (data, status, err) {
$('#view_area').empty(); $('#view_area').empty();
$('#view_box').removeClass('on'); $('#view_box').removeClass('on');
} }
, complete: function() { , complete: function () {
// Complete // Complete
} }
}); });
return false; return false;
} }
<?php if ($is_checkbox) { ?> <?php if ($is_checkbox) { ?>
$("#checkall").click(function(){ $("#checkall").click(function () {
$(this).toggleClass("on"); $(this).toggleClass("on");
}); });
function all_checked(sw) { function all_checked(sw) {
var f = document.fboardlist; 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[]") if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw; f.elements[i].checked = sw;
} }
} }
function fboardlist_submit(f) { function fboardlist_submit(f) {
var chk_count = 0; 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) if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++; chk_count++;
} }
@ -268,17 +289,17 @@ function fboardlist_submit(f) {
return false; return false;
} }
if(document.pressed == "선택복사") { if (document.pressed == "선택복사") {
select_copy("copy"); select_copy("copy");
return; return;
} }
if(document.pressed == "선택이동") { if (document.pressed == "선택이동") {
select_copy("move"); select_copy("move");
return; return;
} }
if(document.pressed == "선택삭제") { if (document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다.")) if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
return false; return false;
@ -287,10 +308,10 @@ function fboardlist_submit(f) {
} }
return true; return true;
} }
// 선택한 게시물 복사 및 이동 // 선택한 게시물 복사 및 이동
function select_copy(sw) { function select_copy(sw) {
var f = document.fboardlist; var f = document.fboardlist;
if (sw == 'copy') if (sw == 'copy')
@ -304,7 +325,7 @@ function select_copy(sw) {
f.target = "move"; f.target = "move";
f.action = "./move.php"; f.action = "./move.php";
f.submit(); f.submit();
} }
<?php } ?> <?php } ?>
</script> </script>
<!-- } 게시판 목록 --> <!-- } 게시판 목록 -->

View file

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

139
view.php
View file

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

View file

@ -1,18 +1,18 @@
<?php <?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_'))
exit; // 개별 페이지 접근 불가
?> ?>
<script> <script>
// 글자수 제한 // 글자수 제한
var char_min = parseInt(<?php echo $comment_min ?>); // 최소 var char_min = parseInt(<?php echo $comment_min ?>); // 최소
var char_max = parseInt(<?php echo $comment_max ?>); // 최대 var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</script> </script>
<!-- 댓글 시작 { --> <!-- 댓글 시작 { -->
<section id="bo_vc"> <section id="bo_vc">
<h2>댓글목록</h2> <h2>댓글목록</h2>
<?php <?php
$cmt_amt = count($list); $cmt_amt = count($list);
for ($i=0; $i<$cmt_amt; $i++) { for ($i = 0; $i < $cmt_amt; $i++) {
$comment_id = $list[$i]['wr_id']; $comment_id = $list[$i]['wr_id'];
$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50; $cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;
$comment = $list[$i]['content']; $comment = $list[$i]['content'];
@ -25,16 +25,26 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
$cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결 $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 } ?>> <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; ?>"> <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> <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'] ?> <?php echo $list[$i]['name'] ?>
<span class="sound_only">작성일</span> <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> <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"> <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_reply']) { ?>
<?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 } ?> <li><a href="<?php echo $c_reply_href; ?>"
<?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 } ?> 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> </ul>
</header> </header>
@ -44,10 +54,10 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?> <span class="icon color_3">비밀글</span> <?php } ?> <?php if (strstr($list[$i]['wr_option'], "secret")) { ?> <span class="icon color_3">비밀글</span> <?php } ?>
<?php echo $comment ?> <?php echo $comment ?>
</p> </p>
<?php if($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) { <?php if ($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) {
$query_string = clean_query_string($_SERVER['QUERY_STRING']); $query_string = clean_query_string($_SERVER['QUERY_STRING']);
if($w == 'cu') { if ($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' "; $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); $cmt = sql_fetch($sql);
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id']))) if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
@ -55,16 +65,18 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
$c_wr_content = $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_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'; $c_edit_href = './board.php?' . $query_string . '&amp;c_id=' . $comment_id . '&amp;w=cu#bo_vc_w';
?> ?>
<?php } ?> <?php } ?>
</div> </div>
<span id="edit_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 수정 --> <span id="edit_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 수정 -->
<span id="reply_<?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 ?>"> <input type="hidden" value="<?php echo strstr($list[$i]['wr_option'], "secret") ?>"
<textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea> 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> </article>
<hr class="line" /> <hr class="line" />
@ -75,13 +87,14 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
<?php if ($is_comment_write) { <?php if ($is_comment_write) {
if($w == '') if ($w == '')
$w = 'c'; $w = 'c';
?> ?>
<!-- 댓글 쓰기 시작 { --> <!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w" class="bo_vc_w"> <aside id="bo_vc_w" class="bo_vc_w">
<h2>댓글쓰기</h2> <h2>댓글쓰기</h2>
<form name="fviewcomment" id="fviewcomment" action="<?php echo $comment_action_url; ?>" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off"> <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="w" value="<?php echo $w ?>" id="w">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> <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="wr_id" value="<?php echo $wr_id ?>">
@ -95,11 +108,11 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
<span class="sound_only">내용</span> <span class="sound_only">내용</span>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?> <?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="내용" <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) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea> <?php if ($comment_min || $comment_max) { ?>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?> <script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script> <script>
$(document).on("keyup change", "textarea#wr_content[maxlength]", function() { $(document).on("keyup change", "textarea#wr_content[maxlength]", function () {
var str = $(this).val() var str = $(this).val()
var mx = parseInt($(this).attr("maxlength")) var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) { if (str.length > mx) {
@ -112,9 +125,11 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
<div class="bo_vc_w_info"> <div class="bo_vc_w_info">
<?php if ($is_guest) { ?> <?php if ($is_guest) { ?>
<label for="wr_name" class="sound_only">이름<strong> 필수</strong></label> <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> <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
} }
?> ?>
@ -129,13 +144,12 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</div> </div>
</div> </div>
</form> </form>
</aside> </aside>
<script> <script>
var save_before = ''; var save_before = '';
var save_html = document.getElementById('bo_vc_w').innerHTML; var save_html = document.getElementById('bo_vc_w').innerHTML;
function good_and_write() function good_and_write() {
{
var f = document.fviewcomment; var f = document.fviewcomment;
if (fviewcomment_submit(f)) { if (fviewcomment_submit(f)) {
f.is_good.value = 1; f.is_good.value = 1;
@ -143,10 +157,9 @@ function good_and_write()
} else { } else {
f.is_good.value = 0; f.is_good.value = 0;
} }
} }
function fviewcomment_submit(f) function fviewcomment_submit(f) {
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자 var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
f.is_good.value = 0; f.is_good.value = 0;
@ -154,7 +167,7 @@ function fviewcomment_submit(f)
var subject = ""; var subject = "";
var content = ""; var content = "";
$.ajax({ $.ajax({
url: g5_bbs_url+"/ajax.filter.php", url: g5_bbs_url + "/ajax.filter.php",
type: "POST", type: "POST",
data: { data: {
"subject": "", "subject": "",
@ -163,14 +176,14 @@ function fviewcomment_submit(f)
dataType: "json", dataType: "json",
async: false, async: false,
cache: false, cache: false,
success: function(data, textStatus) { success: function (data, textStatus) {
subject = data.subject; subject = data.subject;
content = data.content; content = data.content;
} }
}); });
if (content) { if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다"); alert("내용에 금지단어('" + content + "')가 포함되어있습니다");
f.wr_content.focus(); f.wr_content.focus();
return false; return false;
} }
@ -178,66 +191,57 @@ function fviewcomment_submit(f)
// 양쪽 공백 없애기 // 양쪽 공백 없애기
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자 var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, ""); document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, "");
if (char_min > 0 || char_max > 0) if (char_min > 0 || char_max > 0) {
{
check_byte('wr_content', 'char_count'); check_byte('wr_content', 'char_count');
var cnt = parseInt(document.getElementById('char_count').innerHTML); var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt) if (char_min > 0 && char_min > cnt) {
{ alert("댓글은 " + char_min + "글자 이상 쓰셔야 합니다.");
alert("댓글은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false; return false;
} else if (char_max > 0 && char_max < cnt) } else if (char_max > 0 && char_max < cnt) {
{ alert("댓글은 " + char_max + "글자 이하로 쓰셔야 합니다.");
alert("댓글은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false; return false;
} }
} }
else if (!document.getElementById('wr_content').value) else if (!document.getElementById('wr_content').value) {
{
alert("댓글을 입력하여 주십시오."); alert("댓글을 입력하여 주십시오.");
return false; return false;
} }
if (typeof(f.wr_name) != 'undefined') if (typeof (f.wr_name) != 'undefined') {
{
f.wr_name.value = f.wr_name.value.replace(pattern, ""); f.wr_name.value = f.wr_name.value.replace(pattern, "");
if (f.wr_name.value == '') if (f.wr_name.value == '') {
{
alert('이름이 입력되지 않았습니다.'); alert('이름이 입력되지 않았습니다.');
f.wr_name.focus(); f.wr_name.focus();
return false; return false;
} }
} }
if (typeof(f.wr_password) != 'undefined') if (typeof (f.wr_password) != 'undefined') {
{
f.wr_password.value = f.wr_password.value.replace(pattern, ""); f.wr_password.value = f.wr_password.value.replace(pattern, "");
if (f.wr_password.value == '') if (f.wr_password.value == '') {
{
alert('비밀번호가 입력되지 않았습니다.'); alert('비밀번호가 입력되지 않았습니다.');
f.wr_password.focus(); f.wr_password.focus();
return false; return false;
} }
} }
<?php if(($board['bo_use_captcha'] && $w !== 'u') && !$is_admin) echo chk_captcha_js(); ?> <?php if (($board['bo_use_captcha'] && $w !== 'u') && !$is_admin)
echo chk_captcha_js(); ?>
set_comment_token(f); set_comment_token(f);
document.getElementById("btn_submit").disabled = "disabled"; document.getElementById("btn_submit").disabled = "disabled";
return true; return true;
} }
function comment_box(comment_id, work) function comment_box(comment_id, work) {
{
var el_id, var el_id,
form_el = 'fviewcomment', form_el = 'fviewcomment',
respond = document.getElementById(form_el); respond = document.getElementById(form_el);
// 댓글 아이디가 넘어오면 답변, 수정 // 댓글 아이디가 넘어오면 답변, 수정
if (comment_id) if (comment_id) {
{
if (work == 'c') if (work == 'c')
el_id = 'reply_' + comment_id; el_id = 'reply_' + comment_id;
else else
@ -246,10 +250,8 @@ function comment_box(comment_id, work)
else else
el_id = 'bo_vc_w'; el_id = 'bo_vc_w';
if (save_before != el_id) if (save_before != el_id) {
{ if (save_before) {
if (save_before)
{
document.getElementById(save_before).style.display = 'none'; document.getElementById(save_before).style.display = 'none';
} }
@ -259,12 +261,11 @@ function comment_box(comment_id, work)
document.getElementById('wr_content').value = ''; document.getElementById('wr_content').value = '';
// 댓글 수정 // 댓글 수정
if (work == 'cu') if (work == 'cu') {
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value; document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined') if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count'); check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value) if (document.getElementById('secret_comment_' + comment_id).value)
document.getElementById('wr_secret').checked = true; document.getElementById('wr_secret').checked = true;
else else
document.getElementById('wr_secret').checked = false; document.getElementById('wr_secret').checked = false;
@ -273,20 +274,19 @@ function comment_box(comment_id, work)
document.getElementById('comment_id').value = comment_id; document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work; document.getElementById('w').value = work;
if(save_before) if (save_before)
$("#captcha_reload").trigger("click"); $("#captcha_reload").trigger("click");
save_before = el_id; save_before = el_id;
} }
} }
function comment_delete() function comment_delete() {
{
return confirm("이 댓글을 삭제하시겠습니까?"); return confirm("이 댓글을 삭제하시겠습니까?");
} }
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님) comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
</script> </script>
<?php } ?> <?php } ?>
<!-- } 댓글 쓰기 --> <!-- } 댓글 쓰기 -->

View file

@ -1,15 +1,17 @@
<?php <?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_'))
exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨 // 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"> <hr class="padding">
<section id="bo_w"> <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"> <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="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>"> <input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
@ -24,30 +26,31 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
<?php <?php
$option = ''; $option = '';
$option_hidden = ''; $option_hidden = '';
$sec=''; $sec = '';
if ($is_notice || $is_html || $is_secret || $is_mail) { if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = ''; $option = '';
if ($is_notice) { if ($is_notice) {
$option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>'; $option .= "\n" . '<input type="checkbox" id="notice" name="notice" value="1" ' . $notice_checked . '>' . "\n" . '<label for="notice">공지</label>';
} }
if ($is_html) { if ($is_html) {
if ($is_dhtml_editor) { if ($is_dhtml_editor) {
$option_hidden .= '<input type="hidden" value="html1" name="html">'; $option_hidden .= '<input type="hidden" value="html1" name="html">';
} else { } 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>'; $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) { if ($is_mail) {
$option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>'; $option .= "\n" . '<input type="checkbox" id="mail" name="mail" value="mail" ' . $recv_email_checked . '>' . "\n" . '<label for="mail">답변메일받기</label>';
} }
if ($is_secret) { if ($is_secret) {
if ($is_admin || $is_secret==1) { if ($is_admin || $is_secret == 1) {
if($secret_checked)$sec_select="selected"; if ($secret_checked)
$sec .='<option value="secret" '.$sec_select.'>비밀글</option>'; $sec_select = "selected";
$sec .= '<option value="secret" ' . $sec_select . '>비밀글</option>';
} else { } else {
$option_hidden .= '<input type="hidden" name="secret" value="secret">'; $option_hidden .= '<input type="hidden" name="secret" value="secret">';
} }
@ -55,93 +58,110 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
} }
echo $option_hidden; echo $option_hidden;
if($write['wr_secret']=='1') $mem_select="selected"; if ($write['wr_secret'] == '1')
if($write['wr_protect']!='') $pro_select="selected"; $mem_select = "selected";
if($is_member) {$sec .='<option value="protect" '.$pro_select.'>보호글</option>'; if ($write['wr_protect'] != '')
$sec .='<option value="member" '.$mem_select.'>멤버공개</option>';} $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"> <div class="board-write theme-box">
<?php if ($is_category) { ?> <?php if ($is_category) { ?>
<dl> <dl>
<dt>CATEGORY</dt> <dt>CATEGORY</dt>
<dd><nav id="write_category"> <dd>
<select name="ca_name" id="ca_name" required class="required" > <nav id="write_category">
<select name="ca_name" id="ca_name" required class="required">
<option value="">선택하세요</option> <option value="">선택하세요</option>
<?php echo $category_option ?> <?php echo $category_option ?>
</select> </select>
</nav> </nav>
</dd> </dd>
</dl> </dl>
<?}?> <?php } ?>
<dl> <dl>
<dt>OPTION</dt> <dt>OPTION</dt>
<dd> <dd>
<?if($is_secret!=2||$is_admin){?> <?php if ($is_secret != 2 || $is_admin) { ?>
<select name="set_secret" id="set_secret"> <select name="set_secret" id="set_secret">
<option value="">전체공개</option> <option value="">전체공개</option>
<?=$sec?> <?= $sec ?>
</select> </select>
<?}?> <?php } ?>
<?php echo $option ?></dd> <?php echo $option ?>
</dd>
</dl> </dl>
<dl id="set_protect" style="display:<?=$w=='u' && $pro_select ? 'block':'none'?>;"> <dl id="set_protect" style="display:<?= $w == 'u' && $pro_select ? 'block' : 'none' ?>;">
<dt><label for="wr_protect">보호글 암호</label></dt> <dt><label for="wr_protect">보호글 암호</label></dt>
<dd><input type="text" name="wr_protect" id="wr_protect" value="<?=$write['wr_protect']?>" maxlength="20"></dd> <dd><input type="text" name="wr_protect" id="wr_protect" value="<?= $write['wr_protect'] ?>" maxlength="20"></dd>
</dl> </dl>
<dl> <dl>
<dt>SUBJECT</dt> <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> <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>
<dl> <dl>
<dt>CONTENT</dt> <dt>CONTENT</dt>
<dd><div class="wr_content"> <dd>
<?php if($write_min || $write_max) { ?> <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> <p id="char_count_desc"> 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대
<strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
<?php } ?> <?php } ?>
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?> <?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
<?php if($write_min || $write_max) { ?> <?php if ($write_min || $write_max) { ?>
<!-- 최소/최대 글자 사용 --> <!-- 최소/최대 글자 사용 -->
<div id="char_count_wrap"><span id="char_count"></span>글자</div> <div id="char_count_wrap"><span id="char_count"></span>글자</div>
<?php } ?> <?php } ?>
</div></dd> </div>
</dd>
</dl> </dl>
<?if(!$board['bo_use_dhtml_editor']){?> <?php if (!$board['bo_use_dhtml_editor']) { ?>
<dl> <dl>
<dt>FILES</dt> <dt>FILES</dt>
<dd> <dd>
<?for($i=0;$i<$board['bo_upload_count'];$i++){?> <?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"> <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) { ?> <?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"> <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 } ?>
<?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> </dd>
</dl> </dl>
<?}?> <?php } ?>
<?if(!$is_member){?> <?php if (!$is_member) { ?>
<dl> <dl>
<dt></dt> <dt></dt>
<dd class="txt-right"> <dd class="txt-right">
<?php if ($is_name) { ?> <?php if ($is_name) { ?>
<label for="wr_name">NAME<strong class="sound_only">필수</strong></label> <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" > <input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required
class="frm_input required">
<?php } ?> <?php } ?>
<?php if ($is_password) { ?> <?php if ($is_password) { ?>
&nbsp;&nbsp; &nbsp;&nbsp;
<label for="wr_password">PASSWORD<strong class="sound_only">필수</strong></label> <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 ?>" > <input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?>
class="frm_input <?php echo $password_required ?>">
<?php } ?> <?php } ?>
</dd> </dd>
</dl> </dl>
<?}?> <?php } ?>
</div> </div>
@ -153,21 +173,20 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</form> </form>
<script> <script>
<?php if($write_min || $write_max) { ?> <?php if ($write_min || $write_max) { ?>
// 글자수 제한 // 글자수 제한
var char_min = parseInt(<?php echo $write_min; ?>); // 최소 var char_min = parseInt(<?php echo $write_min; ?>); // 최소
var char_max = parseInt(<?php echo $write_max; ?>); // 최대 var char_max = parseInt(<?php echo $write_max; ?>); // 최대
check_byte("wr_content", "char_count"); check_byte("wr_content", "char_count");
$(function() { $(function () {
$("#wr_content").on("keyup", function() { $("#wr_content").on("keyup", function () {
check_byte("wr_content", "char_count"); check_byte("wr_content", "char_count");
}); });
}); });
<?php } ?> <?php } ?>
function html_auto_br(obj) function html_auto_br(obj) {
{
if (obj.checked) { if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다."); result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
if (result) if (result)
@ -179,14 +198,13 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
obj.value = ""; obj.value = "";
} }
function fwrite_submit(f) function fwrite_submit(f) {
{
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?> <?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
var subject = ""; var subject = "";
var content = ""; var content = "";
$.ajax({ $.ajax({
url: g5_bbs_url+"/ajax.filter.php", url: g5_bbs_url + "/ajax.filter.php",
type: "POST", type: "POST",
data: { data: {
"subject": f.wr_subject.value, "subject": f.wr_subject.value,
@ -195,21 +213,21 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
dataType: "json", dataType: "json",
async: false, async: false,
cache: false, cache: false,
success: function(data, textStatus) { success: function (data, textStatus) {
subject = data.subject; subject = data.subject;
content = data.content; content = data.content;
} }
}); });
if (subject) { if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다"); alert("제목에 금지단어('" + subject + "')가 포함되어있습니다");
f.wr_subject.focus(); f.wr_subject.focus();
return false; return false;
} }
if (content) { if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다"); alert("내용에 금지단어('" + content + "')가 포함되어있습니다");
if (typeof(ed_wr_content) != "undefined") if (typeof (ed_wr_content) != "undefined")
ed_wr_content.returnFalse(); ed_wr_content.returnFalse();
else else
f.wr_content.focus(); f.wr_content.focus();
@ -220,11 +238,11 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
if (char_min > 0 || char_max > 0) { if (char_min > 0 || char_max > 0) {
var cnt = parseInt(check_byte("wr_content", "char_count")); var cnt = parseInt(check_byte("wr_content", "char_count"));
if (char_min > 0 && char_min > cnt) { if (char_min > 0 && char_min > cnt) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다."); alert("내용은 " + char_min + "글자 이상 쓰셔야 합니다.");
return false; return false;
} }
else if (char_max > 0 && char_max < cnt) { else if (char_max > 0 && char_max < cnt) {
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다."); alert("내용은 " + char_max + "글자 이하로 쓰셔야 합니다.");
return false; return false;
} }
} }
@ -235,10 +253,10 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
return true; return true;
} }
$('#set_secret').on('change', function() { $('#set_secret').on('change', function () {
var selection = $(this).val(); var selection = $(this).val();
if(selection=='protect') $('#set_protect').css('display','block'); if (selection == 'protect') $('#set_protect').css('display', 'block');
else {$('#set_protect').css('display','none'); $('#wr_protect').val('');} else { $('#set_protect').css('display', 'none'); $('#wr_protect').val(''); }
}); });
</script> </script>
</section> </section>

View file

@ -1,31 +1,31 @@
<?php <?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_"))
$temp=sql_fetch("select * from {$write_table}"); exit; // 개별 페이지 접근 불가
if(!isset($temp['wr_protect'])){
$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` "); 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;
}
} }
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}'"); 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);