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

View file

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

381
view.php
View file

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

View file

@ -1,292 +1,292 @@
<?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'];
/* /*
if (strstr($list[$i]['wr_option'], "secret")) { if (strstr($list[$i]['wr_option'], "secret")) {
$str = $str; $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); $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 이하 사이드뷰 겹침 문제 해결 $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
<?php echo $list[$i]['name'] ?> class="sound_only">댓글의</span><?php } ?> 댓글</h2>
<span class="sound_only">작성일</span> <?php echo $list[$i]['name'] ?>
<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="sound_only">작성일</span>
<ul class="bo_vc_act"> <span class="bo_vc_hdinfo"><time
<?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 } ?> datetime="<?php echo date('Y-m-d\TH:i:s+09:00', strtotime($list[$i]['datetime'])) ?>"><?php echo $list[$i]['datetime'] ?></time></span>
<?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 } ?> <ul class="bo_vc_act">
<?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 } ?> <?php if ($list[$i]['is_reply']) { ?>
</ul> <li><a href="<?php echo $c_reply_href; ?>"
</header> onclick="comment_box('<?php echo $comment_id ?>', 'c'); return false;" class="ui-btn small">답변</a></li>
<?php } ?>
<!-- 댓글 출력 --> <?php if ($list[$i]['is_edit']) { ?>
<div class="cmt_contents"> <li><a href="<?php echo $c_edit_href; ?>"
<p> onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;" class="ui-btn small">수정</a></li>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?> <span class="icon color_3">비밀글</span> <?php } ?> <?php } ?>
<?php echo $comment ?> <?php if ($list[$i]['is_del']) { ?>
</p> <li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();"
<?php if($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) { class="ui-btn small">삭제</a></li><?php } ?>
$query_string = clean_query_string($_SERVER['QUERY_STRING']); </ul>
</header>
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); <div class="cmt_contents">
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id']))) <p>
$cmt['wr_content'] = ''; <?php if (strstr($list[$i]['wr_option'], "secret")) { ?> <span class="icon color_3">비밀글</span> <?php } ?>
$c_wr_content = $cmt['wr_content']; <?php echo $comment ?>
} </p>
<?php if ($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) {
$c_reply_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=c#bo_vc_w'; $query_string = clean_query_string($_SERVER['QUERY_STRING']);
$c_edit_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=cu#bo_vc_w';
?> if ($w == 'cu') {
<?php } ?> $sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' ";
</div> $cmt = sql_fetch($sql);
<span id="edit_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 수정 --> if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
<span id="reply_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 답변 --> $cmt['wr_content'] = '';
$c_wr_content = $cmt['wr_content'];
<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>
$c_reply_href = './board.php?' . $query_string . '&amp;c_id=' . $comment_id . '&amp;w=c#bo_vc_w';
</article> $c_edit_href = './board.php?' . $query_string . '&amp;c_id=' . $comment_id . '&amp;w=cu#bo_vc_w';
<hr class="line" /> ?>
<?php } ?> <?php } ?>
</div>
</section> <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") ?>"
<?php if ($is_comment_write) { id="secret_comment_<?php echo $comment_id ?>">
if($w == '') <textarea id="save_comment_<?php echo $comment_id ?>"
$w = 'c'; style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
?>
<!-- 댓글 쓰기 시작 { --> </article>
<aside id="bo_vc_w" class="bo_vc_w"> <hr class="line" />
<h2>댓글쓰기</h2> <?php } ?>
<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"> </section>
<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 ?>"> <?php if ($is_comment_write) {
<input type="hidden" name="sfl" value="<?php echo $sfl ?>"> if ($w == '')
<input type="hidden" name="stx" value="<?php echo $stx ?>"> $w = 'c';
<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=""> <aside id="bo_vc_w" class="bo_vc_w">
<h2>댓글쓰기</h2>
<span class="sound_only">내용</span> <form name="fviewcomment" id="fviewcomment" action="<?php echo $comment_action_url; ?>"
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?> onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용" <input type="hidden" name="w" value="<?php echo $w ?>" id="w">
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?> <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<script> <input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id">
$(document).on("keyup change", "textarea#wr_content[maxlength]", function() { <input type="hidden" name="sca" value="<?php echo $sca ?>">
var str = $(this).val() <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
var mx = parseInt($(this).attr("maxlength")) <input type="hidden" name="stx" value="<?php echo $stx ?>">
if (str.length > mx) { <input type="hidden" name="spt" value="<?php echo $spt ?>">
$(this).val(str.substr(0, mx)); <input type="hidden" name="page" value="<?php echo $page ?>">
return false; <input type="hidden" name="is_good" value="">
}
}); <span class="sound_only">내용</span>
</script> <?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<div class="bo_vc_w_wr"> <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>
<div class="bo_vc_w_info"> <?php if ($comment_min || $comment_max) { ?>
<?php if ($is_guest) { ?> <script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<label for="wr_name" class="sound_only">이름<strong> 필수</strong></label> <script>
<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="이름"> $(document).on("keyup change", "textarea#wr_content[maxlength]", function () {
<label for="wr_password" class="sound_only">비밀번호<strong> 필수</strong></label> var str = $(this).val()
<input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="25" placeholder="비밀번호"> var mx = parseInt($(this).attr("maxlength"))
<?php if (str.length > mx) {
} $(this).val(str.substr(0, mx));
?> return false;
<?php if ($is_guest) { ?> }
<?php echo $captcha_html; ?> });
<?php } ?> </script>
</div> <div class="bo_vc_w_wr">
<div class="btn_confirm"> <div class="bo_vc_w_info">
<input type="checkbox" name="wr_secret" value="secret" id="wr_secret"> <?php if ($is_guest) { ?>
<label for="wr_secret"> 비밀글</label> <label for="wr_name" class="sound_only">이름<strong> 필수</strong></label>
<input type="submit" id="btn_submit" class="ui-btn submit" value="등록"> <input type="text" name="wr_name" value="<?php echo get_cookie("ck_sns_name"); ?>" id="wr_name" required
</div> class="frm_input required" size="25" placeholder="이름">
</div> <label for="wr_password" class="sound_only">비밀번호<strong> 필수</strong></label>
</form> <input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="25"
</aside> placeholder="비밀번호">
<script> <?php
var save_before = ''; }
var save_html = document.getElementById('bo_vc_w').innerHTML; ?>
<?php if ($is_guest) { ?>
function good_and_write() <?php echo $captcha_html; ?>
{ <?php } ?>
var f = document.fviewcomment; </div>
if (fviewcomment_submit(f)) { <div class="btn_confirm">
f.is_good.value = 1; <input type="checkbox" name="wr_secret" value="secret" id="wr_secret">
f.submit(); <label for="wr_secret"> 비밀글</label>
} else { <input type="submit" id="btn_submit" class="ui-btn submit" value="등록">
f.is_good.value = 0; </div>
} </div>
} </form>
</aside>
function fviewcomment_submit(f) <script>
{ var save_before = '';
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자 var save_html = document.getElementById('bo_vc_w').innerHTML;
f.is_good.value = 0; function good_and_write() {
var f = document.fviewcomment;
var subject = ""; if (fviewcomment_submit(f)) {
var content = ""; f.is_good.value = 1;
$.ajax({ f.submit();
url: g5_bbs_url+"/ajax.filter.php", } else {
type: "POST", f.is_good.value = 0;
data: { }
"subject": "", }
"content": f.wr_content.value
}, function fviewcomment_submit(f) {
dataType: "json", var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
async: false,
cache: false, f.is_good.value = 0;
success: function(data, textStatus) {
subject = data.subject; var subject = "";
content = data.content; var content = "";
} $.ajax({
}); url: g5_bbs_url + "/ajax.filter.php",
type: "POST",
if (content) { data: {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다"); "subject": "",
f.wr_content.focus(); "content": f.wr_content.value
return false; },
} dataType: "json",
async: false,
// 양쪽 공백 없애기 cache: false,
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자 success: function (data, textStatus) {
document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, ""); subject = data.subject;
if (char_min > 0 || char_max > 0) content = data.content;
{ }
check_byte('wr_content', 'char_count'); });
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt) if (content) {
{ alert("내용에 금지단어('" + content + "')가 포함되어있습니다");
alert("댓글은 "+char_min+"글자 이상 쓰셔야 합니다."); f.wr_content.focus();
return false; return false;
} else if (char_max > 0 && char_max < cnt) }
{
alert("댓글은 "+char_max+"글자 이하로 쓰셔야 합니다."); // 양쪽 공백 없애기
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) {
else if (!document.getElementById('wr_content').value) check_byte('wr_content', 'char_count');
{ var cnt = parseInt(document.getElementById('char_count').innerHTML);
alert("댓글을 입력하여 주십시오."); if (char_min > 0 && char_min > cnt) {
return false; alert("댓글은 " + char_min + "글자 이상 쓰셔야 합니다.");
} return false;
} else if (char_max > 0 && char_max < cnt) {
if (typeof(f.wr_name) != 'undefined') alert("댓글은 " + char_max + "글자 이하로 쓰셔야 합니다.");
{ return false;
f.wr_name.value = f.wr_name.value.replace(pattern, ""); }
if (f.wr_name.value == '') }
{ else if (!document.getElementById('wr_content').value) {
alert('이름이 입력되지 않았습니다.'); alert("댓글을 입력하여 주십시오.");
f.wr_name.focus(); return false;
return false; }
}
} if (typeof (f.wr_name) != 'undefined') {
f.wr_name.value = f.wr_name.value.replace(pattern, "");
if (typeof(f.wr_password) != 'undefined') if (f.wr_name.value == '') {
{ alert('이름이 입력되지 않았습니다.');
f.wr_password.value = f.wr_password.value.replace(pattern, ""); f.wr_name.focus();
if (f.wr_password.value == '') return false;
{ }
alert('비밀번호가 입력되지 않았습니다.'); }
f.wr_password.focus();
return false; if (typeof (f.wr_password) != 'undefined') {
} f.wr_password.value = f.wr_password.value.replace(pattern, "");
} if (f.wr_password.value == '') {
alert('비밀번호가 입력되지 않았습니다.');
<?php if(($board['bo_use_captcha'] && $w !== 'u') && !$is_admin) echo chk_captcha_js(); ?> f.wr_password.focus();
return false;
set_comment_token(f); }
}
document.getElementById("btn_submit").disabled = "disabled";
<?php if (($board['bo_use_captcha'] && $w !== 'u') && !$is_admin)
return true; echo chk_captcha_js(); ?>
}
set_comment_token(f);
function comment_box(comment_id, work)
{ document.getElementById("btn_submit").disabled = "disabled";
var el_id,
form_el = 'fviewcomment', return true;
respond = document.getElementById(form_el); }
// 댓글 아이디가 넘어오면 답변, 수정 function comment_box(comment_id, work) {
if (comment_id) var el_id,
{ form_el = 'fviewcomment',
if (work == 'c') respond = document.getElementById(form_el);
el_id = 'reply_' + comment_id;
else // 댓글 아이디가 넘어오면 답변, 수정
el_id = 'edit_' + comment_id; if (comment_id) {
} if (work == 'c')
else el_id = 'reply_' + comment_id;
el_id = 'bo_vc_w'; else
el_id = 'edit_' + comment_id;
if (save_before != el_id) }
{ else
if (save_before) el_id = 'bo_vc_w';
{
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 = ''; }
document.getElementById(el_id).appendChild(respond);
//입력값 초기화 document.getElementById(el_id).style.display = '';
document.getElementById('wr_content').value = ''; document.getElementById(el_id).appendChild(respond);
//입력값 초기화
// 댓글 수정 document.getElementById('wr_content').value = '';
if (work == 'cu')
{ // 댓글 수정
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value; if (work == 'cu') {
if (typeof char_count != 'undefined') document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
check_byte('wr_content', 'char_count'); if (typeof char_count != 'undefined')
if (document.getElementById('secret_comment_'+comment_id).value) check_byte('wr_content', 'char_count');
document.getElementById('wr_secret').checked = true; if (document.getElementById('secret_comment_' + comment_id).value)
else document.getElementById('wr_secret').checked = true;
document.getElementById('wr_secret').checked = false; else
} document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work; 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;
} 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,245 +1,263 @@
<?php <?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('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
?> add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css">', 0);
?>
<hr class="padding">
<section id="bo_w"> <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(); ?>"> <form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);"
<input type="hidden" name="w" value="<?php echo $w ?>"> method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> <input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>"> <input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>"> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>"> <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>"> <input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>"> <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>"> <input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>"> <input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>"> <input type="hidden" name="sst" value="<?php echo $sst ?>">
<?php <input type="hidden" name="sod" value="<?php echo $sod ?>">
$option = ''; <input type="hidden" name="page" value="<?php echo $page ?>">
$option_hidden = ''; <?php
$sec=''; $option = '';
if ($is_notice || $is_html || $is_secret || $is_mail) { $option_hidden = '';
$option = ''; $sec = '';
if ($is_notice) { if ($is_notice || $is_html || $is_secret || $is_mail) {
$option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>'; $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">'; if ($is_html) {
} else { if ($is_dhtml_editor) {
$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_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"; if ($is_secret) {
$sec .='<option value="secret" '.$sec_select.'>비밀글</option>'; if ($is_admin || $is_secret == 1) {
} else { if ($secret_checked)
$option_hidden .= '<input type="hidden" name="secret" value="secret">'; $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>'; echo $option_hidden;
$sec .='<option value="member" '.$mem_select.'>멤버공개</option>';} if ($write['wr_secret'] == '1')
?> $mem_select = "selected";
if ($write['wr_protect'] != '')
<div class="board-write theme-box"> $pro_select = "selected";
<?php if ($is_category) { ?> if ($is_member) {
<dl> $sec .= '<option value="protect" ' . $pro_select . '>보호글</option>';
<dt>CATEGORY</dt> $sec .= '<option value="member" ' . $mem_select . '>멤버공개</option>';
<dd><nav id="write_category"> }
<select name="ca_name" id="ca_name" required class="required" > ?>
<option value="">선택하세요</option>
<?php echo $category_option ?> <div class="board-write theme-box">
</select> <?php if ($is_category) { ?>
</nav> <dl>
</dd> <dt>CATEGORY</dt>
</dl> <dd>
<?}?> <nav id="write_category">
<dl> <select name="ca_name" id="ca_name" required class="required">
<dt>OPTION</dt> <option value="">선택하세요</option>
<dd> <?php echo $category_option ?>
<?if($is_secret!=2||$is_admin){?> </select>
<select name="set_secret" id="set_secret"> </nav>
<option value="">전체공개</option> </dd>
<?=$sec?> </dl>
</select> <?php } ?>
<?}?> <dl>
<?php echo $option ?></dd> <dt>OPTION</dt>
</dl> <dd>
<dl id="set_protect" style="display:<?=$w=='u' && $pro_select ? 'block':'none'?>;"> <?php if ($is_secret != 2 || $is_admin) { ?>
<dt><label for="wr_protect">보호글 암호</label></dt> <select name="set_secret" id="set_secret">
<dd><input type="text" name="wr_protect" id="wr_protect" value="<?=$write['wr_protect']?>" maxlength="20"></dd> <option value="">전체공개</option>
</dl> <?= $sec ?>
<dl> </select>
<dt>SUBJECT</dt> <?php } ?>
<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> <?php echo $option ?>
</dl> </dd>
<dl> </dl>
<dt>CONTENT</dt> <dl id="set_protect" style="display:<?= $w == 'u' && $pro_select ? 'block' : 'none' ?>;">
<dd><div class="wr_content"> <dt><label for="wr_protect">보호글 암호</label></dt>
<?php if($write_min || $write_max) { ?> <dd><input type="text" name="wr_protect" id="wr_protect" value="<?= $write['wr_protect'] ?>" maxlength="20"></dd>
<!-- 최소/최대 글자 사용 --> </dl>
<p id="char_count_desc"> 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p> <dl>
<?php } ?> <dt>SUBJECT</dt>
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?> <dd><input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required
<?php if($write_min || $write_max) { ?> class="frm_input required full" size="50" maxlength="255"></dd>
<!-- 최소/최대 글자 사용 --> </dl>
<div id="char_count_wrap"><span id="char_count"></span>글자</div> <dl>
<?php } ?> <dt>CONTENT</dt>
</div></dd> <dd>
</dl> <div class="wr_content">
<?if(!$board['bo_use_dhtml_editor']){?> <?php if ($write_min || $write_max) { ?>
<dl> <!-- 최소/최대 글자 사용 -->
<dt>FILES</dt> <p id="char_count_desc"> 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대
<dd> <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
<?for($i=0;$i<$board['bo_upload_count'];$i++){?> <?php } ?>
<input type="file" name="bf_file[]" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input full"> <?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
<?php if ($is_file_content) { ?> <?php if ($write_min || $write_max) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50"> <!-- 최소/최대 글자 사용 -->
<?php } ?> <div id="char_count_wrap"><span id="char_count"></span>글자</div>
<?php if($w == 'u' && $file[$i]['file']) { ?> <?php } ?>
<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> </div>
<?php } ?> </dd>
<?}?> </dl>
</dd> <?php if (!$board['bo_use_dhtml_editor']) { ?>
</dl> <dl>
<dt>FILES</dt>
<?}?> <dd>
<?php for ($i = 0; $i < $board['bo_upload_count']; $i++) { ?>
<?if(!$is_member){?> <input type="file" name="bf_file[]"
<dl> title="파일첨부 <?php echo $i + 1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능"
<dt></dt> class="frm_file frm_input full">
<dd class="txt-right"> <?php if ($is_file_content) { ?>
<?php if ($is_name) { ?> <input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>"
<label for="wr_name">NAME<strong class="sound_only">필수</strong></label> title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
<input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required class="frm_input required" > <?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">
<?php if ($is_password) { ?> <label for="bf_file_del<?php echo $i ?>"><?php echo $file[$i]['source'] . '(' . $file[$i]['size'] . ')'; ?> 파일
&nbsp;&nbsp; 삭제</label>
<label for="wr_password">PASSWORD<strong class="sound_only">필수</strong></label> <?php } ?>
<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> <?php if (!$is_member) { ?>
<dl>
<hr class="padding" /> <dt></dt>
<div class="btn_confirm txt-center"> <dd class="txt-right">
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn_submit ui-btn point"> <?php if ($is_name) { ?>
<a href="./board.php?bo_table=<?php echo $bo_table ?>" class="btn_cancel ui-btn">취소</a> <label for="wr_name">NAME<strong class="sound_only">필수</strong></label>
</div> <input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required
</form> class="frm_input required">
<?php } ?>
<script>
<?php if($write_min || $write_max) { ?> <?php if ($is_password) { ?>
// 글자수 제한 &nbsp;&nbsp;
var char_min = parseInt(<?php echo $write_min; ?>); // 최소 <label for="wr_password">PASSWORD<strong class="sound_only">필수</strong></label>
var char_max = parseInt(<?php echo $write_max; ?>); // 최대 <input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?>
check_byte("wr_content", "char_count"); class="frm_input <?php echo $password_required ?>">
<?php } ?>
$(function() { </dd>
$("#wr_content").on("keyup", function() { </dl>
check_byte("wr_content", "char_count"); <?php } ?>
});
}); </div>
<?php } ?> <hr class="padding" />
function html_auto_br(obj) <div class="btn_confirm txt-center">
{ <input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn_submit ui-btn point">
if (obj.checked) { <a href="./board.php?bo_table=<?php echo $bo_table ?>" class="btn_cancel ui-btn">취소</a>
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다."); </div>
if (result) </form>
obj.value = "html2";
else <script>
obj.value = "html1"; <?php if ($write_min || $write_max) { ?>
} // 글자수 제한
else var char_min = parseInt(<?php echo $write_min; ?>); // 최소
obj.value = ""; var char_max = parseInt(<?php echo $write_max; ?>); // 최대
} check_byte("wr_content", "char_count");
function fwrite_submit(f) $(function () {
{ $("#wr_content").on("keyup", function () {
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?> check_byte("wr_content", "char_count");
});
var subject = ""; });
var content = "";
$.ajax({ <?php } ?>
url: g5_bbs_url+"/ajax.filter.php", function html_auto_br(obj) {
type: "POST", if (obj.checked) {
data: { result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
"subject": f.wr_subject.value, if (result)
"content": f.wr_content.value obj.value = "html2";
}, else
dataType: "json", obj.value = "html1";
async: false, }
cache: false, else
success: function(data, textStatus) { obj.value = "";
subject = data.subject; }
content = data.content;
} function fwrite_submit(f) {
}); <?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
if (subject) { var subject = "";
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다"); var content = "";
f.wr_subject.focus(); $.ajax({
return false; url: g5_bbs_url + "/ajax.filter.php",
} type: "POST",
data: {
if (content) { "subject": f.wr_subject.value,
alert("내용에 금지단어('"+content+"')가 포함되어있습니다"); "content": f.wr_content.value
if (typeof(ed_wr_content) != "undefined") },
ed_wr_content.returnFalse(); dataType: "json",
else async: false,
f.wr_content.focus(); cache: false,
return false; success: function (data, textStatus) {
} subject = data.subject;
content = data.content;
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) { if (subject) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다."); alert("제목에 금지단어('" + subject + "')가 포함되어있습니다");
return false; f.wr_subject.focus();
} return false;
else if (char_max > 0 && char_max < cnt) { }
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false; if (content) {
} alert("내용에 금지단어('" + content + "')가 포함되어있습니다");
} if (typeof (ed_wr_content) != "undefined")
} ed_wr_content.returnFalse();
else
f.wr_content.focus();
document.getElementById("btn_submit").disabled = "disabled"; return false;
}
return true;
} if (document.getElementById("char_count")) {
$('#set_secret').on('change', function() { if (char_min > 0 || char_max > 0) {
var selection = $(this).val(); var cnt = parseInt(check_byte("wr_content", "char_count"));
if(selection=='protect') $('#set_protect').css('display','block'); if (char_min > 0 && char_min > cnt) {
else {$('#set_protect').css('display','none'); $('#wr_protect').val('');} alert("내용은 " + char_min + "글자 이상 쓰셔야 합니다.");
}); return false;
</script> }
</section> else if (char_max > 0 && char_max < cnt) {
<!-- } 게시물 작성/수정 --> alert("내용은 " + char_max + "글자 이하로 쓰셔야 합니다.");
return false;
}
}
}
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
$('#set_secret').on('change', function () {
var selection = $(this).val();
if (selection == 'protect') $('#set_protect').css('display', 'block');
else { $('#set_protect').css('display', 'none'); $('#wr_protect').val(''); }
});
</script>
</section>
<!-- } 게시물 작성/수정 -->

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'])){
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; $temp = sql_fetch("select * from {$write_table}");
if (!isset($temp['wr_protect'])) {
$sec=""; sql_query(" ALTER TABLE `{$write_table}` ADD `wr_protect` varchar(255) NOT NULL DEFAULT '' AFTER `wr_url` ");
$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}'"); unset($temp);
} if ($w != 'c' && $w != 'cu') {
goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.$qstr);
?> $temp_wr_id = $wr_id;
$sec = "";
$mem = 0;
$protect = "";
if ($set_secret) {
if ($set_secret == 'secret') {
$sec = "secret";
} else if ($set_secret == 'member') {
$mem = 1;
} else if ($set_secret == 'protect' && $wr_protect != '') {
$protect = $wr_protect;
}
}
sql_query("update {$write_table} set wr_option='$html,$sec', wr_secret='{$mem}', wr_protect= '{$wr_protect}' where wr_id='{$wr_id}'");
}
goto_url(G5_HTTP_BBS_URL . '/board.php?bo_table=' . $bo_table . $qstr);