Compare commits

...

3 commits
1.0.1 ... main

Author SHA1 Message Date
7da8d3743e
change tab style 2025-01-16 13:25:14 +09:00
40da17043b
typo 2024-12-11 15:32:03 +09:00
6f8ed103ae
[bugfix] edit document form empty and comment edit form to multiline 2024-12-11 15:26:39 +09:00
11 changed files with 811 additions and 829 deletions

View file

@ -1,26 +1,25 @@
<?php
include_once "./_common.php";
if (!function_exists('convert_charset'))
{
/*
-----------------------------------------------------------
Charset 변환하는 함수
-----------------------------------------------------------
iconv 함수가 있으면 iconv 변환하고
없으면 mb_convert_encoding 함수를 사용한다.
둘다 없으면 사용할 없다.
*/
function convert_charset($from_charset, $to_charset, $str)
{
if (!function_exists('convert_charset')) {
/*
-----------------------------------------------------------
Charset 변환하는 함수
-----------------------------------------------------------
iconv 함수가 있으면 iconv 변환하고
없으면 mb_convert_encoding 함수를 사용한다.
둘다 없으면 사용할 없다.
*/
function convert_charset($from_charset, $to_charset, $str)
{
if( function_exists('iconv') )
return iconv($from_charset, $to_charset, $str);
elseif( function_exists('mb_convert_encoding') )
return mb_convert_encoding($str, $to_charset, $from_charset);
else
die("Not found 'iconv' or 'mbstring' library in server.");
}
if (function_exists('iconv'))
return iconv($from_charset, $to_charset, $str);
elseif (function_exists('mb_convert_encoding'))
return mb_convert_encoding($str, $to_charset, $from_charset);
else
die("Not found 'iconv' or 'mbstring' library in server.");
}
}
header("Content-Type: text/html; charset={$g5['charset']}");
@ -29,43 +28,39 @@ $subject = strtolower($_POST['subject']);
$content = strtolower(strip_tags($_POST['content']));
//euc-kr 일 경우 $config['cf_filter'] 를 utf-8로 변환한다.
if (strtolower($g5['charset']) == 'euc-kr')
{
//$subject = convert_charset('utf-8', 'cp949', $subject);
//$content = convert_charset('utf-8', 'cp949', $content);
$config['cf_filter'] = convert_charset('cp949', 'utf-8', $config['cf_filter']);
if (strtolower($g5['charset']) == 'euc-kr') {
//$subject = convert_charset('utf-8', 'cp949', $subject);
//$content = convert_charset('utf-8', 'cp949', $content);
$config['cf_filter'] = convert_charset('cp949', 'utf-8', $config['cf_filter']);
}
//$filter = explode(",", strtolower(trim($config['cf_filter'])));
// strtolower 에 의한 한글 변형으로 아래 코드로 대체 (곱슬최씨님이 알려 주셨습니다.)
$filter = explode(",", trim($config['cf_filter']));
for ($i=0; $i<count($filter); $i++)
{
$str = $filter[$i];
for ($i = 0; $i < count($filter); $i++) {
$str = $filter[$i];
// 제목 필터링 (찾으면 중지)
$subj = "";
$pos = strpos($subject, $str);
if ($pos !== false)
{
if (strtolower($g5['charset']) == 'euc-kr')
$subj = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환
else
$subj = $str;
break;
}
// 제목 필터링 (찾으면 중지)
$subj = "";
$pos = strpos($subject, $str);
if ($pos !== false) {
if (strtolower($g5['charset']) == 'euc-kr')
$subj = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환
else
$subj = $str;
break;
}
// 내용 필터링 (찾으면 중지)
$cont = "";
$pos = strpos($content, $str);
if ($pos !== false)
{
if (strtolower($g5['charset']) == 'euc-kr')
$cont = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환
else
$cont = $str;
break;
}
// 내용 필터링 (찾으면 중지)
$cont = "";
$pos = strpos($content, $str);
if ($pos !== false) {
if (strtolower($g5['charset']) == 'euc-kr')
$cont = convert_charset('utf-8', 'cp949', $str);//cp949 로 변환해서 반환
else
$cont = $str;
break;
}
}
die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");

View file

@ -3,12 +3,12 @@
$update_href = $delete_href = "";
// 로그인중이고 자신의 글이라면 또는 관리자라면 패스워드를 묻지 않고 바로 수정, 삭제 가능
if (($member['mb_id'] && ($member['mb_id'] == $write['mb_id'])) || $is_admin) {
$update_href = "./write.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . urldecode($qstr) . "');";
if ($is_admin) {
$delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&token=$token&page=$page" . urldecode($qstr) . "');";
}
$update_href = "./write.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . urldecode($qstr) . "');";
if ($is_admin) {
$delete_href = "javascript:del('./delete.php?bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&token=$token&page=$page" . urldecode($qstr) . "');";
}
} else if (!$write['mb_id']) { // 회원이 쓴 글이 아니라면
$update_href = "./password.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$delete_href = "./password.php?w=d&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$update_href = "./password.php?w=u&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
$delete_href = "./password.php?w=d&bo_table=$bo_table&wr_id={$lists[$ii]['wr_id']}&page=$page" . $qstr;
}

View file

@ -1,332 +1,331 @@
<?php
if (!defined("_GNUBOARD_"))
exit;
exit;
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css">', 0);
if ($is_admin)
set_session("ss_delete_token", $token = uniqid(time()));
set_session("ss_delete_token", $token = uniqid(time()));
if ($is_member) {
$comment_token = uniqid(time());
set_session('ss_comment_token', $comment_token);
$comment_token = uniqid(time());
set_session('ss_comment_token', $comment_token);
}
$is_comment_write = false;
if ($board['bo_table_width'] == 0)
$width = "100%";
$width = "100%";
?>
<div id="page_board_content" style="max-width:<?php echo $width; ?>;margin: 0 auto;">
<!-- 상단 공지 부분 -->
<?php if ($board['bo_content_head']) { ?>
<div class="board-notice theme-box">
<?= stripslashes($board['bo_content_head']); ?>
</div>
<hr class="padding" />
<?php } ?>
<!-- 버튼 링크 -->
<?php if ($admin_href) { ?>
<div class="adm-box"><a href="<?= $admin_href ?>" class="ui-btn admin" target="_blank">관리자</a></div><?php } ?>
<div class="ui-memo-list theme-box ">
<div class="ui-top"><?php if ($write_href) {
?>
<div class="ui-write-area">
<?php include $board_skin_path . "/write.php"; ?>
</div><?php }
?>
<div class="search-box">
<form name="fsearch" method="get" style="margin:0px;">
<input type="hidden" name="bo_table" value="<?= $bo_table ?>">
<input type="hidden" name="sca" value="<?= $sca ?>">
<input type="hidden" name="sfl" value='wr_subject||wr_content'>
<input type="hidden" name="sop" value="and">
<input type="text" name="stx" itemname="검색어" value="<?= $stx ?>">
<?php ?><button type="submit" class="ui-btn">?</button>
</form>
</div>
</div>
<hr class="line">
<ul>
<?php
$lists = array();
for ($i = 0; $i < count($list); $i++) {
$lists[$i] = $list[$i];
}
for ($ii = 0; $ii < count($lists); $ii++) {
$profile = get_member($lists[$ii]['mb_id']);
include "$board_skin_path/inc.list_main.php";
$lists[$ii]['datetime'] = substr($lists[$ii]['wr_datetime'], 0, 4) . "/" . substr($lists[$ii]['wr_datetime'], 5, 2) . "/" . substr($lists[$ii]['wr_datetime'], 8, 2) . " (" . substr($lists[$ii]['wr_datetime'], 11, 8) . ")";
$is_open = false;
if (get_cookie('read_' . $lists[$ii]['wr_id']) == $lists[$ii]['wr_password']) {
$is_open = true;
}
$lists[$ii]['content'] = conv_content($lists[$ii]['wr_content'], 0, 'wr_content');
$lists[$ii]['content'] = search_font($stx, $lists[$ii]['content']);
?>
<li>
<form name="fboardlist" method="post" action="<?= $board_skin_url ?>/password.php" style="margin:0">
<input type="hidden" name="bo_table" value="<?= $bo_table ?>">
<input type="hidden" name="sfl" value="<?= $sfl ?>">
<input type="hidden" name="stx" value="<?= $stx ?>">
<input type="hidden" name="spt" value="<?= $spt ?>">
<input type="hidden" name="page" value="<?= $page ?>">
<input type="hidden" name="wr_idx" value="<?= $lists[$ii]['wr_id'] ?>">
<input type="hidden" name="sw" value="">
<div class="memo-content content-area">
<em><?php if ($is_checkbox) { ?>
<input type="checkbox" name="chk_id_<?php echo $lists[$ii]['wr_id'] ?>"
value="<?php echo $lists[$ii]['wr_id'] ?>" class="chk_id">
<?php } ?>
</em>
<?php if ($lists[$ii]['is_notice']) { ?>
<strong class="txt-point notice">!</strong>
<?php } else { ?>
<strong class="txt-point date"><?= date('Y/m/d', strtotime($lists[$ii]['wr_datetime'])) ?></strong>
<?php } ?>
<?php
if (strstr($lists[$ii]['wr_option'], 'secret') && !$is_admin && !$is_open) {
?>
<a href="#" class="write_open secret ui-btn">***</a>
<p class="pass_in"><input type="password" name="wr_password" id="wr_password_<?= $ii ?>" value=""
placeholder="비밀번호" />
<button type="submit" class="ui-btn">입력</button>
</p>
<?php } else {
if ($member['mb_level'] >= $board['bo_comment_level'])
$is_comment_write = true;
if ($board['bo_comment_write'] <= $member['mb_level'])
$is_comment_write = true; ?>
<?php if (strstr($lists[$ii]['wr_option'], 'secret')) {
?>
&nbsp;<span class="txt-point">***</span>&nbsp;&nbsp;
<?php } ?>
<span class="con">
<?= $lists[$ii]['content'] ?>
<?php echo $secret_msg; ?>
</span>
<?php } ?>
<p class="control">
<?php
if ($is_comment_write) {
?><a href="javascript:comment_wri('comment_write', '<?= $lists[$ii]['wr_id'] ?>');">+</a>
<?php
}
if (($member['mb_id'] && ($member['mb_id'] == $lists[$ii]['mb_id'])) || $is_admin) {
if ($update_href) { ?><a href="<?= $update_href ?>">*</a>
<?php }
?><a href="<?= $delete_href ?>">-</a>
<?php
} else if (!$lists[$ii]['mb_id']) {
?><a href="<?= $delete_href ?>">-</a>
<?php
}
?>
</p>
</div>
</form>
<?php
if (strstr($lists[$ii]['wr_option'], 'secret') && !$is_admin && !$is_open) {
if ($lists[$ii]['wr_comment'] == 1) { ?>
<?php }
} else {
$wr_id = $lists[$ii]['wr_id'];
include $board_skin_path . "/view_comment.php";
}
?>
<hr class="line">
</li>
<?php }
?>
<?php if (count($lists) == 0) {
echo "<li class='no-data'>내역이 없습니다.</li>";
} ?>
</ul>
<?php if ($is_checkbox) { ?>
<hr class="line">
<div class="bo_fx txt-right">
<form name="fchecklist" id="fchecklist" action="./board_list_update.php" method="post">
<input type="hidden" name="write_table" value="<?= $write_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="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<input type="hidden" name="btn_submit" value="">
</form>
<?php if ($is_checkbox && count($lists) > 0) { ?>
<span class="chkall"><input type="checkbox" id="chkall"
onclick="if (this.checked) all_checked(true); else all_checked(false);">
</span>
<?php } ?>
<input type="submit" name="btn_submit" value="선택삭제" onclick="select_delete();" class="ui-btn small admin">
<input type="submit" name="btn_submit" value="선택복사" onclick="select_copy('copy');"
class="ui-btn small admin">
<input type="submit" name="btn_submit" value="선택이동" onclick="select_copy('move');"
class="ui-btn small admin">
</div>
<?php } ?>
<!-- 상단 공지 부분 -->
<?php if ($board['bo_content_head']) { ?>
<div class="board-notice theme-box">
<?= stripslashes($board['bo_content_head']); ?>
</div>
<!-- 페이지 -->
<?php echo $write_pages; ?>
<hr class="padding" />
<?php } ?>
<!-- 버튼 링크 -->
<?php if ($admin_href) { ?>
<div class="adm-box"><a href="<?= $admin_href ?>" class="ui-btn admin" target="_blank">관리자</a></div><?php } ?>
<div class="ui-memo-list theme-box ">
<div class="ui-top"><?php if ($write_href) {
?>
<div class="ui-write-area">
<?php include $board_skin_path . "/write.php"; ?>
</div><?php }
?>
<div class="search-box">
<form name="fsearch" method="get" style="margin:0px;">
<input type="hidden" name="bo_table" value="<?= $bo_table ?>">
<input type="hidden" name="sca" value="<?= $sca ?>">
<input type="hidden" name="sfl" value='wr_subject||wr_content'>
<input type="hidden" name="sop" value="and">
<input type="text" name="stx" itemname="검색어" value="<?= $stx ?>">
<?php ?><button type="submit" class="ui-btn">?</button>
</form>
</div>
</div>
<hr class="line">
<ul>
<?php
$lists = array();
for ($i = 0; $i < count($list); $i++) {
$lists[$i] = $list[$i];
}
for ($ii = 0; $ii < count($lists); $ii++) {
$profile = get_member($lists[$ii]['mb_id']);
include "$board_skin_path/inc.list_main.php";
$lists[$ii]['datetime'] = substr($lists[$ii]['wr_datetime'], 0, 4) . "/" . substr($lists[$ii]['wr_datetime'], 5, 2) . "/" . substr($lists[$ii]['wr_datetime'], 8, 2) . " (" . substr($lists[$ii]['wr_datetime'], 11, 8) . ")";
$is_open = false;
if (get_cookie('read_' . $lists[$ii]['wr_id']) == $lists[$ii]['wr_password']) {
$is_open = true;
}
$lists[$ii]['content'] = conv_content($lists[$ii]['wr_content'], 0, 'wr_content');
$lists[$ii]['content'] = search_font($stx, $lists[$ii]['content']);
?>
<li>
<form name="fboardlist" method="post" action="<?= $board_skin_url ?>/password.php" style="margin:0">
<input type="hidden" name="bo_table" value="<?= $bo_table ?>">
<input type="hidden" name="sfl" value="<?= $sfl ?>">
<input type="hidden" name="stx" value="<?= $stx ?>">
<input type="hidden" name="spt" value="<?= $spt ?>">
<input type="hidden" name="page" value="<?= $page ?>">
<input type="hidden" name="wr_idx" value="<?= $lists[$ii]['wr_id'] ?>">
<input type="hidden" name="sw" value="">
<div class="memo-content content-area">
<em><?php if ($is_checkbox) { ?>
<input type="checkbox" name="chk_id_<?php echo $lists[$ii]['wr_id'] ?>"
value="<?php echo $lists[$ii]['wr_id'] ?>" class="chk_id">
<?php } ?>
</em>
<?php if ($lists[$ii]['is_notice']) { ?>
<strong class="txt-point notice">!</strong>
<?php } else { ?>
<strong class="txt-point date"><?= date('Y/m/d', strtotime($lists[$ii]['wr_datetime'])) ?></strong>
<?php } ?>
<?php
if (strstr($lists[$ii]['wr_option'], 'secret') && !$is_admin && !$is_open) {
?>
<a href="#" class="write_open secret ui-btn">***</a>
<p class="pass_in"><input type="password" name="wr_password" id="wr_password_<?= $ii ?>" value=""
placeholder="비밀번호" />
<button type="submit" class="ui-btn">입력</button>
</p>
<?php } else {
if ($member['mb_level'] >= $board['bo_comment_level'])
$is_comment_write = true;
if ($board['bo_comment_write'] <= $member['mb_level'])
$is_comment_write = true; ?>
<?php if (strstr($lists[$ii]['wr_option'], 'secret')) {
?>
&nbsp;<span class="txt-point">***</span>&nbsp;&nbsp;
<?php } ?>
<span class="con">
<?= $lists[$ii]['content'] ?>
<?php echo $secret_msg; ?>
</span>
<?php } ?>
<p class="control">
<?php
if ($is_comment_write) {
?><a
href="javascript:comment_wri('comment_write', '<?= $lists[$ii]['wr_id'] ?>');">+</a>
<?php
}
if (($member['mb_id'] && ($member['mb_id'] == $lists[$ii]['mb_id'])) || $is_admin) {
if ($update_href) { ?><a href="<?= $update_href ?>">*</a>
<?php }
?><a href="<?= $delete_href ?>">-</a>
<?php
} else if (!$lists[$ii]['mb_id']) {
?><a href="<?= $delete_href ?>">-</a>
<?php
}
?>
</p>
</div>
</form>
<?php
if (strstr($lists[$ii]['wr_option'], 'secret') && !$is_admin && !$is_open) {
if ($lists[$ii]['wr_comment'] == 1) { ?>
<?php }
} else {
$wr_id = $lists[$ii]['wr_id'];
include $board_skin_path . "/view_comment.php";
}
?>
<hr class="line">
</li>
<?php }
?>
<?php if (count($lists) == 0) {
echo "<li class='no-data'>내역이 없습니다.</li>";
} ?>
</ul>
<?php if ($is_checkbox) { ?>
<hr class="line">
<div class="bo_fx txt-right">
<form name="fchecklist" id="fchecklist" action="./board_list_update.php" method="post">
<input type="hidden" name="write_table" value="<?= $write_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="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<input type="hidden" name="btn_submit" value="">
</form>
<?php if ($is_checkbox && count($lists) > 0) { ?>
<span class="chkall"><input type="checkbox" id="chkall"
onclick="if (this.checked) all_checked(true); else all_checked(false);">
</span>
<?php } ?>
<input type="submit" name="btn_submit" value="선택삭제" onclick="select_delete();" class="ui-btn small admin">
<input type="submit" name="btn_submit" value="선택복사" onclick="select_copy('copy');" class="ui-btn small admin">
<input type="submit" name="btn_submit" value="선택이동" onclick="select_copy('move');" class="ui-btn small admin">
</div>
<?php } ?>
</div>
<!-- 페이지 -->
<?php echo $write_pages; ?>
</div>
<script language="JavaScript">
//if ("<?= $sca ?>") document.fcategory.sca.value = "<?= $sca ?>";
if ("<?= $stx ?>") {
document.fsearch.sfl.value = "<?= $sfl ?>";
document.fsearch.sop.value = "<?= $sop ?>";
}
//if ("<?= $sca ?>") document.fcategory.sca.value = "<?= $sca ?>";
if ("<?= $stx ?>") {
document.fsearch.sfl.value = "<?= $sfl ?>";
document.fsearch.sop.value = "<?= $sop ?>";
}
$(".write_open").click(function () {
$(this).next().toggleClass("on");
});
$(".write_open").click(function () {
$(this).next().toggleClass("on");
});
function comment_box(co_id, wr_id) {
$('.modify_area').hide();
$('.comment-content').show();
function comment_box(co_id, wr_id) {
$('.modify_area').hide();
$('.comment-content').show();
$('#c_' + co_id).find('.modify_area').show();
$('#c_' + co_id).find('.comment-content').hide();
$('#c_' + co_id).find('.modify_area').show();
$('#c_' + co_id).find('.comment-content').hide();
$('#save_co_comment_' + co_id).focus();
$('#save_co_comment_' + co_id).focus();
var modify_form = document.getElementById('frm_modify_comment');
modify_form.wr_id.value = wr_id;
modify_form.comment_id.value = co_id;
}
var modify_form = document.getElementById('frm_modify_comment');
modify_form.wr_id.value = wr_id;
modify_form.comment_id.value = co_id;
}
function mod_comment(co_id) {
var modify_form = document.getElementById('frm_modify_comment');
var wr_content = $('#save_co_comment_' + co_id).val();
var wr_option = '';
modify_form.wr_content.value = wr_content;
modify_form.wr_option.value = wr_option;
modify_form.wr_id.value = co_id;
modify_form.comment_id.value = co_id;
$('#frm_modify_comment').submit();
}
function mod_comment(co_id) {
var modify_form = document.getElementById('frm_modify_comment');
var wr_content = $('#save_co_comment_' + co_id).val();
var wr_option = '';
modify_form.wr_content.value = wr_content;
modify_form.wr_option.value = wr_option;
modify_form.wr_id.value = co_id;
modify_form.comment_id.value = co_id;
$('#frm_modify_comment').submit();
}
</script>
<?php if ($is_checkbox) { ?>
<script>
<script>
var count = 0;
$('.chk_id').change(function () {
if ($(this).prop('checked')) {
$("#fchecklist").append('<input type="checkbox" id="ck_id_' + $(this).val() + '" name="chk_wr_id[]" class="chkd" value="' + $(this).val() + '" checked style="display:none;">');
count++;
}
if ($(this).prop('checked') == false) {
$('#ck_id_' + $(this).val()).remove();
count--;
}
});
var count = 0;
$('.chk_id').change(function () {
if ($(this).prop('checked')) {
$("#fchecklist").append('<input type="checkbox" id="ck_id_' + $(this).val() + '" name="chk_wr_id[]" class="chkd" value="' + $(this).val() + '" checked style="display:none;">');
count++;
}
if ($(this).prop('checked') == false) {
$('#ck_id_' + $(this).val()).remove();
count--;
}
});
function all_checked(sw) {
var clen = $('.chk_id').length;
$('.chk_id').prop('checked', sw);
if (sw == true) {
for (i = 0; i < clen; i++) {
$("#fchecklist").append('<input type="checkbox" id="ck_id_' + $('.chk_id').eq(i).val() + '" class="chkd" name="chk_wr_id[]" value="' + $('.chk_id').eq(i).val() + '" checked style="display:none;">');
count++;
}
} else {
$('.chkd').remove();
count--;
}
function all_checked(sw) {
var clen = $('.chk_id').length;
$('.chk_id').prop('checked', sw);
if (sw == true) {
for (i = 0; i < clen; i++) {
$("#fchecklist").append('<input type="checkbox" id="ck_id_' + $('.chk_id').eq(i).val() + '" class="chkd" name="chk_wr_id[]" value="' + $('.chk_id').eq(i).val() + '" checked style="display:none;">');
count++;
}
} else {
$('.chkd').remove();
count--;
}
}
function check_confirm(str) {
var f = $('.chkd');
var chk_count = 0;
for (var i = 0; i < f.length; i++) {
if (f.prop("checked")) {
chk_count++;
}
}
function check_confirm(str) {
var f = $('.chkd');
var chk_count = 0;
if (!chk_count) {
alert(str + "할 게시물을 하나 이상 선택하세요.");
return false;
}
return true;
for (var i = 0; i < f.length; i++) {
if (f.prop("checked")) {
chk_count++;
}
}
// 선택한 게시물 삭제
function select_delete() {
var f = document.fchecklist;
if (!chk_count) {
alert(str + "할 게시물을 하나 이상 선택하세요.");
return false;
}
return true;
}
str = "삭제";
if (!check_confirm(str))
return;
// 선택한 게시물 삭제
function select_delete() {
var f = document.fchecklist;
if (!confirm("선택한 게시물을 정말 " + str + " 하시겠습니까?\n\n한번 " + str + "한 자료는 복구할 수 없습니다"))
return;
f.btn_submit.value = "선택삭제";
f.removeAttribute("target");
f.action = "./board_list_update.php";
f.submit();
}
str = "삭제";
if (!check_confirm(str))
return;
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fchecklist;
if (!confirm("선택한 게시물을 정말 " + str + " 하시겠습니까?\n\n한번 " + str + "한 자료는 복구할 수 없습니다"))
return;
f.btn_submit.value = "선택삭제";
f.removeAttribute("target");
f.action = "./board_list_update.php";
f.submit();
}
if (sw == "copy")
str = "복사";
else
str = "이동";
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fchecklist;
if (!check_confirm(str))
return;
if (sw == "copy")
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
if (!check_confirm(str))
return;
f.sw.value = sw;
f.btn_submit.vaule = "선택" + str;
f.target = "move";
f.action = "./move.php";
f.submit();
}
</script>
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.btn_submit.vaule = "선택" + str;
f.target = "move";
f.action = "./move.php";
f.submit();
}
</script>
<?php } ?>
<form name="modify_comment" id="frm_modify_comment" action="./write_comment_update.php" method="post"
autocomplete="off">
<input type="hidden" name="w" value="cu">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
autocomplete="off">
<input type="hidden" name="w" value="cu">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="comment_id" value="">
<input type="hidden" name="wr_id" value="">
<input type="hidden" name="wr_option" value="">
<textarea name="wr_content" style="display: none;"></textarea>
<button type="submit" style="display: none;"></button>
<input type="hidden" name="comment_id" value="">
<input type="hidden" name="wr_id" value="">
<input type="hidden" name="wr_option" value="">
<textarea name="wr_content" style="display: none;"></textarea>
<button type="submit" style="display: none;"></button>
</form>

View file

@ -2,7 +2,7 @@
include_once './_common.php';
if ($_POST['wr_password']) {
set_cookie('read_' . $_POST['wr_idx'], sql_password($_POST['wr_password']), 3600);
set_cookie('read_' . $_POST['wr_idx'], sql_password($_POST['wr_password']), 3600);
}
goto_url(G5_HTTP_BBS_URL . '/board.php?bo_table=' . $bo_table . '&amp;wr_id=' . $wr_id . $qstr);

View file

@ -1,6 +1,6 @@
<?php
if (!defined("_GNUBOARD_"))
exit;
exit;
set_session("ss_delete_token", $token = uniqid(time()));

View file

@ -1,6 +1,6 @@
<?php
if (!defined('_GNUBOARD_'))
exit;
exit;
$list = array();
@ -8,92 +8,92 @@ $list = array();
$sql = " select * from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
$result = sql_query($sql);
for ($i = 0; $c_row = sql_fetch_array($result); $i++) {
$list[$i] = $c_row;
$list[$i] = $c_row;
//$list[$i]['name'] = get_sideview($c_row['mb_id'], cut_str($c_row['wr_name'], 20, ''), $c_row['wr_email'], $c_row['wr_homepage']);
//$list[$i]['name'] = get_sideview($c_row['mb_id'], cut_str($c_row['wr_name'], 20, ''), $c_row['wr_email'], $c_row['wr_homepage']);
$tmp_name = get_text(cut_str($c_row['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력
if ($board['bo_use_sideview'])
$list[$i]['name'] = get_sideview($c_row['mb_id'], $tmp_name, $c_row['wr_email'], $c_row['wr_homepage']);
else
$list[$i]['name'] = '<span class="' . ($c_row['mb_id'] ? 'member' : 'guest') . '">' . $tmp_name . '</span>';
$tmp_name = get_text(cut_str($c_row['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력
if ($board['bo_use_sideview'])
$list[$i]['name'] = get_sideview($c_row['mb_id'], $tmp_name, $c_row['wr_email'], $c_row['wr_homepage']);
else
$list[$i]['name'] = '<span class="' . ($c_row['mb_id'] ? 'member' : 'guest') . '">' . $tmp_name . '</span>';
// 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
//$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $c_row['wr_content']);
// 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
//$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $c_row['wr_content']);
$list[$i]['content'] = $list[$i]['content1'] = '비밀글 입니다.';
if (
!strstr($c_row['wr_option'], 'secret') ||
$is_admin ||
($write['mb_id'] == $member['mb_id'] && $member['mb_id']) ||
($c_row['mb_id'] == $member['mb_id'] && $member['mb_id'])
) {
$list[$i]['content1'] = $c_row['wr_content'];
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
$list[$i]['content'] = $list[$i]['content1'] = '비밀글 입니다.';
if (
!strstr($c_row['wr_option'], 'secret') ||
$is_admin ||
($write['mb_id'] == $member['mb_id'] && $member['mb_id']) ||
($c_row['mb_id'] == $member['mb_id'] && $member['mb_id'])
) {
$list[$i]['content1'] = $c_row['wr_content'];
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
} else {
$ss_name = 'ss_secret_comment_' . $bo_table . '_' . $list[$i]['wr_id'];
if (!get_session($ss_name))
$list[$i]['content'] = '<a href="./password.php?w=sc&amp;bo_table=' . $bo_table . '&amp;wr_id=' . $list[$i]['wr_id'] . $qstr . '" class="s_cmt">댓글내용 확인</a>';
else {
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
}
}
$list[$i]['datetime'] = substr($c_row['wr_datetime'], 2, 14);
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
$list[$i]['ip'] = $c_row['wr_ip'];
if (!$is_admin)
$list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $c_row['wr_ip']);
$list[$i]['is_reply'] = false;
$list[$i]['is_edit'] = false;
$list[$i]['is_del'] = false;
if ($is_comment_write || $is_admin) {
$token = '';
if ($member['mb_id']) {
if ($c_row['mb_id'] == $member['mb_id'] || $is_admin) {
set_session('ss_delete_comment_' . $c_row['wr_id'] . '_token', $token = uniqid(time()));
$list[$i]['del_link'] = './delete_comment.php?bo_table=' . $bo_table . '&amp;comment_id=' . $c_row['wr_id'] . '&amp;token=' . $token . '&amp;page=' . $page . $qstr;
$list[$i]['is_edit'] = true;
$list[$i]['is_del'] = true;
}
} else {
$ss_name = 'ss_secret_comment_' . $bo_table . '_' . $list[$i]['wr_id'];
if (!get_session($ss_name))
$list[$i]['content'] = '<a href="./password.php?w=sc&amp;bo_table=' . $bo_table . '&amp;wr_id=' . $list[$i]['wr_id'] . $qstr . '" class="s_cmt">댓글내용 확인</a>';
else {
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
}
if (!$c_row['mb_id']) {
$list[$i]['del_link'] = './password.php?w=x&amp;bo_table=' . $bo_table . '&amp;comment_id=' . $c_row['wr_id'] . '&amp;page=' . $page . $qstr;
$list[$i]['is_del'] = true;
}
}
$list[$i]['datetime'] = substr($c_row['wr_datetime'], 2, 14);
if (strlen($c_row['wr_comment_reply']) < 5)
$list[$i]['is_reply'] = true;
}
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
$list[$i]['ip'] = $c_row['wr_ip'];
if (!$is_admin)
$list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $c_row['wr_ip']);
$list[$i]['is_reply'] = false;
$list[$i]['is_edit'] = false;
$list[$i]['is_del'] = false;
if ($is_comment_write || $is_admin) {
$token = '';
if ($member['mb_id']) {
if ($c_row['mb_id'] == $member['mb_id'] || $is_admin) {
set_session('ss_delete_comment_' . $c_row['wr_id'] . '_token', $token = uniqid(time()));
$list[$i]['del_link'] = './delete_comment.php?bo_table=' . $bo_table . '&amp;comment_id=' . $c_row['wr_id'] . '&amp;token=' . $token . '&amp;page=' . $page . $qstr;
$list[$i]['is_edit'] = true;
$list[$i]['is_del'] = true;
}
} else {
if (!$c_row['mb_id']) {
$list[$i]['del_link'] = './password.php?w=x&amp;bo_table=' . $bo_table . '&amp;comment_id=' . $c_row['wr_id'] . '&amp;page=' . $page . $qstr;
$list[$i]['is_del'] = true;
}
}
if (strlen($c_row['wr_comment_reply']) < 5)
$list[$i]['is_reply'] = true;
}
// 05.05.22
// 답변있는 코멘트는 수정, 삭제 불가
if ($i > 0 && !$is_admin) {
if ($c_row['wr_comment_reply']) {
$tmp_comment_reply = substr($c_row['wr_comment_reply'], 0, strlen($c_row['wr_comment_reply']) - 1);
if ($tmp_comment_reply == $list[$i - 1]['wr_comment_reply']) {
$list[$i - 1]['is_edit'] = false;
$list[$i - 1]['is_del'] = false;
}
}
// 05.05.22
// 답변있는 코멘트는 수정, 삭제 불가
if ($i > 0 && !$is_admin) {
if ($c_row['wr_comment_reply']) {
$tmp_comment_reply = substr($c_row['wr_comment_reply'], 0, strlen($c_row['wr_comment_reply']) - 1);
if ($tmp_comment_reply == $list[$i - 1]['wr_comment_reply']) {
$list[$i - 1]['is_edit'] = false;
$list[$i - 1]['is_del'] = false;
}
}
}
}
// 코멘트수 제한 설정값
if ($is_admin) {
$comment_min = $comment_max = 0;
$comment_min = $comment_max = 0;
} else {
$comment_min = (int) $board['bo_comment_min'];
$comment_max = (int) $board['bo_comment_max'];
$comment_min = (int) $board['bo_comment_min'];
$comment_max = (int) $board['bo_comment_max'];
}
include $board_skin_path . '/view_comment.skin.php';

View file

@ -1,120 +1,122 @@
<?php
if (!defined("_GNUBOARD_"))
exit;
exit;
?>
<script language="JavaScript">
// 글자수 제한
var char_min = parseInt(<?= $comment_min ?>); // 최소
var char_max = parseInt(<?= $comment_max ?>); // 최대
// 글자수 제한
var char_min = parseInt(<?= $comment_min ?>); // 최소
var char_max = parseInt(<?= $comment_max ?>); // 최대
</script>
<!-- 코멘트 쓰기 -->
<?php if ($is_comment_write) {
if ($w == '')
$w = 'c';
?>
<div class="ui-write-area" id="comment_write<?= $lists[$ii]['wr_id'] ?>" style="display:none;">
<!-- 코멘트 입력테이블시작 -->
<form name="fviewcomment" action="<?= G5_BBS_URL ?>/write_comment_update.php" method="post"
enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $lists[$ii]['wr_id'] ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
if ($w == '')
$w = 'c';
?>
<div class="ui-write-area" id="comment_write<?= $lists[$ii]['wr_id'] ?>" style="display:none;">
<!-- 코멘트 입력테이블시작 -->
<form name="fviewcomment" action="<?= G5_BBS_URL ?>/write_comment_update.php" method="post"
enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $lists[$ii]['wr_id'] ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<p class="ui-text-area">
<textarea name="wr_content" required class="frm-input full" value="<?= $list[$i]['wr_content'] ?>" oninput="wr_resize(this);" style="resize: vertical !important; transition: none; min-height: 1em;"></textarea>
<button type="submit" class="ui-btn" accesskey='s'>입력</button>
</p>
<?php if (!$is_member && $is_comment_write) { ?>
<p>
<input type="text" name="wr_name" placeholder="이름" value="<?= $_COOKIE['MMB_NAME'] ?>"
style="max-width:40%" />
<input type="password" name="wr_password" value="<?= $_COOKIE['MMB_PW'] ?>" placeholder="비밀번호"
style="max-width:40%" />
</p>
<?php } ?>
</form>
</div>
<p class="ui-text-area">
<textarea name="wr_content" required class="frm-input full" value="<?= $list[$i]['wr_content'] ?>"
oninput="wr_resize(this);" style="resize: vertical !important; transition: none; min-height: 1em;"></textarea>
<button type="submit" class="ui-btn" accesskey='s'>입력</button>
</p>
<?php if (!$is_member && $is_comment_write) { ?>
<p>
<input type="text" name="wr_name" placeholder="이름" value="<?= $_COOKIE['MMB_NAME'] ?>" style="max-width:40%" />
<input type="password" name="wr_password" value="<?= $_COOKIE['MMB_PW'] ?>" placeholder="비밀번호"
style="max-width:40%" />
</p>
<?php } ?>
</form>
</div>
<?php } ?>
<ul>
<!-- 코멘트 리스트 -->
<?php
for ($i = 0; $i < count($list); $i++) {
$comment_id = $list[$i]['wr_id'];
<!-- 코멘트 리스트 -->
<?php
for ($i = 0; $i < count($list); $i++) {
$comment_id = $list[$i]['wr_id'];
?>
<li id="c_<?= $comment_id ?>">
<a name="c_<?= $comment_id ?>"></a>
<div class="comment-content content-area">
<em></em>
<span class="date"><?= date("Y/m/d", strtotime($list[$i]['wr_datetime'])) ?></span>
<!-- 코멘트 출력 -->
<?php
if (strstr($list[$i]['wr_option'], "secret"))
echo "<span style='color:#ff6600;'>*</span> ";
$str = $list[$i]['content'];
if (strstr($list[$i]['wr_option'], "secret"))
$str = "<span style='color:#ff6600;'>$str</span>";
$str = 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>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
echo "<span class='con'>" . $str . "</span>";
$query_string = clean_query_string($_SERVER['QUERY_STRING']);
if ($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$comment_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql);
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
$cmt['wr_content'] = '';
$c_wr_content = $cmt['wr_content'];
}
$c_edit_href = './board.php?' . $query_string . '&amp;comment_id=' . $comment_id . '&amp;wr_id=' . $wr_id . 'w=cu';
?>
<li id="c_<?= $comment_id ?>">
<a name="c_<?= $comment_id ?>"></a>
<div class="comment-content content-area">
<em></em>
<span class="date"><?= date("Y/m/d", strtotime($list[$i]['wr_datetime'])) ?></span>
<!-- 코멘트 출력 -->
<?php
if (strstr($list[$i]['wr_option'], "secret"))
echo "<span style='color:#ff6600;'>*</span> ";
$str = $list[$i]['content'];
if (strstr($list[$i]['wr_option'], "secret"))
$str = "<span style='color:#ff6600;'>$str</span>";
<?php if ($list[$i]['is_edit'] || $list[$i]['is_del']) { ?>
<p class="control">
<?php
if ($list[$i]['is_edit']) { ?><a
href="javascript:comment_box('<?php echo $comment_id ?>', '<?= $list[$ii]['wr_id'] ?>');">*</a>
<?php }
if ($list[$i]['is_del']) {
echo "<a href=\"javascript:comment_delete('{$list[$i]['del_link']}');\">-</a>";
}
?>
</p>
<?php } ?>
<span id="edit_<?php echo $comment_id ?>"></span><!-- 수정 -->
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'], "secret") ?>"
id="secret_comment_<?php echo $comment_id ?>">
<textarea name="wr_content" required class="frm-input full" value="<?= $list[$i]['wr_content'] ?>"
oninput="wr_resize(this);" id="save_comment_<?php echo $comment_id ?>"
style="display:none; resize: vertical !important; transition: none; min-height: 1em;"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
</div>
$str = 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>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
echo "<span class='con'>" . $str . "</span>";
$query_string = clean_query_string($_SERVER['QUERY_STRING']);
if ($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$comment_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql);
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))
$cmt['wr_content'] = '';
$c_wr_content = $cmt['wr_content'];
}
$c_edit_href = './board.php?' . $query_string . '&amp;comment_id=' . $comment_id . '&amp;wr_id=' . $wr_id . 'w=cu';
?>
<?php if ($list[$i]['is_edit'] || $list[$i]['is_del']) { ?>
<p class="control">
<?php
if ($list[$i]['is_edit']) { ?><a
href="javascript:comment_box('<?php echo $comment_id ?>', '<?= $list[$ii]['wr_id'] ?>');">*</a>
<?php }
if ($list[$i]['is_del']) {
echo "<a href=\"javascript:comment_delete('{$list[$i]['del_link']}');\">-</a>";
}
?>
</p>
<?php } ?>
<span id="edit_<?php echo $comment_id ?>"></span><!-- 수정 -->
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'], "secret") ?>"
id="secret_comment_<?php echo $comment_id ?>">
<input type="text" id="save_comment_<?php echo $comment_id ?>" style="display:none"
value="<?php echo get_text($list[$i]['content1'], 0) ?>">
</div>
<?php if ($list[$i]['is_edit']) { ?>
<div class="modify_area ui-text-area" id="save_comment_<?php echo $comment_id ?>" style="display:none;">
<input type="text" id="save_co_comment_<?php echo $comment_id ?>"
value="<?php echo get_text($list[$i]['wr_content'], 0) ?>" class="full">
<p class="txt-right"><button type="button" class="mod_comment ui-btn"
onclick="mod_comment('<?php echo $comment_id ?>')">수정</button></p>
</div>
<?php } ?> </li>
<?php } ?>
<?php if ($list[$i]['is_edit']) { ?>
<div class="modify_area ui-text-area" id="save_comment_<?php echo $comment_id ?>" style="display:none;">
<textarea type="text" id="save_co_comment_<?php echo $comment_id ?>" oninput="wr_resize(this);"
style="resize: vertical !important; transition: none; min-height: 1em;"><?php echo get_text($list[$i]['wr_content'], 0) ?></textarea>
<p class="txt-right">
<button type="button" class="mod_comment ui-btn" onclick="mod_comment('<?php echo $comment_id ?>')">수정</button>
</p>
</div>
<?php } ?>
</li>
<?php } ?>
</ul>
<script>
function wr_resize(e) {
e.style.height = 'auto';
e.style.height = e.scrollHeight + 'px';
}
function wr_resize(e) {
e.style.height = 'auto';
e.style.height = `calc(${e.scrollHeight}px + 0.25em)`;
}
</script>
<?php
include_once "$board_skin_path/view_skin_js.php";

View file

@ -1,12 +1,12 @@
<script language='JavaScript'>
function comment_wri(name, id) {
$('.modify_area').hide();
$('.qna-comment-content').show();
var layer = document.getElementById(name + id);
layer.style.display = (layer.style.display == "none") ? "block" : "none";
}
function comment_wri(name, id) {
$('.modify_area').hide();
$('.qna-comment-content').show();
var layer = document.getElementById(name + id);
layer.style.display = (layer.style.display == "none") ? "block" : "none";
}
function comment_delete(url) {
if (confirm("이 코멘트를 삭제하시겠습니까?")) location.href = url;
}
function comment_delete(url) {
if (confirm("이 코멘트를 삭제하시겠습니까?")) location.href = url;
}
</script>

466
write.php
View file

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

View file

@ -1,95 +1,91 @@
<?php
if (!defined("_GNUBOARD_"))
exit;
exit;
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css">', 0);
$option = '';
$option_hidden = '';
if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = '';
if ($is_notice) {
// $option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>';
}
$option = '';
if ($is_notice) {
// $option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>';
}
if ($is_html) {
if ($is_dhtml_editor) {
$option_hidden .= '<input type="hidden" value="html1" name="html">';
} else {
//$option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>';
}
if ($is_html) {
if ($is_dhtml_editor) {
$option_hidden .= '<input type="hidden" value="html1" name="html">';
} else {
//$option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>';
}
}
if ($is_secret) {
if ($is_admin || $is_secret == 1) {
$option .= "\n" . '<label for="secret" style="white-space:nowrap;"><input type="checkbox" id="secret" name="secret" value="secret" ' . $secret_checked . '>' . "\n" . '비밀글</label>';
} else {
$option_hidden .= '<input type="hidden" name="secret" value="secret">';
}
if ($is_secret) {
if ($is_admin || $is_secret == 1) {
$option .= "\n" . '<label for="secret" style="white-space:nowrap;"><input type="checkbox" id="secret" name="secret" value="secret" ' . $secret_checked . '>' . "\n" . '비밀글</label>';
} else {
$option_hidden .= '<input type="hidden" name="secret" value="secret">';
}
//if ($is_mail) {
// $option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>';
//}
}
}
echo $option_hidden;
?>
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post"
enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="wr_subject" value="<?= $board['bo_subject'] ?>">
<?= $option_hidden ?>
<div class="ui-write-box ui-text-area<?= $w == 'u' ? " update" : ""; ?>">
<a href="#" class="write_open ui-btn point">+</a>
<p>
<textarea name="wr_content" id="content" class="frm-input full" required value="<?= $content ?>" style="resize: vertical !important; transition: none; min-height: 1em;"></textarea>
<button type="submit" id="btn_submit" class="ui-btn" accesskey='s'>입력</button><?php if ($w == 'u') { ?><a
href="<?= G5_BBS_URL ?>/board.php?bo_table=<?= $bo_table ?>" class="ui-btn etc">뒤로</a><?php } ?>
<?php if (!$is_member) { ?>
<input type="text" maxlength="20" name="wr_name" id="wr_name" placeholder="이름" required
value="<?= $name ?>" />
<input type="password" maxlength="20" id="wr_password" name="wr_password" placeholder="비밀번호"
value="<?= $password ?>" <?= $password_required ?> />
<?php } ?>
<?php if ($option) { ?>
&nbsp;&nbsp;<?php echo $option ?>
<?php } ?>
</p>
</div>
enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="wr_subject" value="<?= $board['bo_subject'] ?>">
<?= $option_hidden ?>
<div class="ui-write-box ui-text-area<?= $w == 'u' ? " update" : ""; ?>">
<a href="#" class="write_open ui-btn point">+</a>
<p>
<textarea name="wr_content" id="content" class="frm-input full" required value="<?= $content ?>"
style="resize: vertical !important; transition: none; min-height: 1em;"><?= $content ?></textarea>
<button type="submit" id="btn_submit" class="ui-btn" accesskey='s'>입력</button><?php if ($w == 'u') { ?><a
href="<?= G5_BBS_URL ?>/board.php?bo_table=<?= $bo_table ?>" class="ui-btn etc">뒤로</a><?php } ?>
<?php if (!$is_member) { ?>
<input type="text" maxlength="20" name="wr_name" id="wr_name" placeholder="이름" required value="<?= $name ?>" />
<input type="password" maxlength="20" id="wr_password" name="wr_password" placeholder="비밀번호"
value="<?= $password ?>" <?= $password_required ?> />
<?php } ?>
<?php if ($option) { ?>
&nbsp;&nbsp;<?php echo $option ?>
<?php } ?>
</p>
</div>
</form>
<script>
<?php if ($write_min || $write_max) { ?>
// 글자수 제한
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
<?php if ($write_min || $write_max) { ?>
// 글자수 제한
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
check_byte("wr_content", "char_count");
$(function () {
$("#wr_content").on("keyup", function () {
check_byte("wr_content", "char_count");
$(function () {
$("#wr_content").on("keyup", function () {
check_byte("wr_content", "char_count");
});
});
<?php } ?>
function fwrite_submit(f) {
return true;
}
document.getElementById("content").addEventListener("input", function() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
});
});
<?php } ?>
function fwrite_submit(f) {
return true;
}
document.getElementById("content").addEventListener("input", function () {
this.style.height = 'auto';
this.style.height = `calc(${this.scrollHeight}px + 0.25em)`;
});
</script>

View file

@ -1,6 +1,6 @@
<?php
if (!defined("_GNUBOARD_"))
exit;
exit;
// 자신만의 코드를 넣어주세요.
goto_url("./board.php?bo_table=$bo_table");