This commit is contained in:
whitedot
2012-12-28 11:16:52 +09:00
17 changed files with 497 additions and 469 deletions

View File

@ -50,6 +50,7 @@ $sql = " insert into {$g4['board_table']}
bo_use_category = '{$board['bo_use_category']}',
bo_category_list = '{$board['bo_category_list']}',
bo_disable_tags = '{$board['bo_disable_tags']}',
<<<<<<< HEAD
bo_use_secret = '{$board['bo_use_secret']}',
bo_use_dhtml_editor = '{$board['bo_use_dhtml_editor']}',
bo_use_sideview = '{$board['bo_use_sideview']}',
@ -59,6 +60,16 @@ $sql = " insert into {$g4['board_table']}
bo_use_signature = '{$board['bo_use_signature']}',
bo_use_ip_view = '{$board['bo_use_ip_view']}',
bo_use_trackback = '{$board['bo_use_trackback']}',
=======
bo_use_secret = '{$board[bo_use_secret]}',
bo_use_dhtml_editor = '{$board[bo_use_dhtml_editor]}',
bo_use_sideview = '{$board[bo_use_sideview]}',
bo_use_good = '{$board[bo_use_good]}',
bo_use_nogood = '{$board[bo_use_nogood]}',
bo_use_signature = '{$board[bo_use_signature]}',
bo_use_ip_view = '{$board[bo_use_ip_view]}',
bo_use_trackback = '{$board[bo_use_trackback]}',
>>>>>>> 35e2a0e57216e9ff77b98266f30f5e8f87800654
bo_use_list_view = '{$board['o_use_list_view']}',
bo_use_list_content = '{$board['bo_use_list_content']}',
bo_table_width = '{$board['bo_table_width']}',

View File

@ -311,16 +311,6 @@ include_once ('./admin.head.php');
<label for="chk_use_file_content">동일그룹 모두 적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bo_use_comment">댓글 새창 사용</label></th>
<td>
<input type="checkbox" id="bo_use_comment" name="bo_use_comment" value="1" <?=$board['bo_use_comment']?'checked':'';?>>사용 (댓글수 클릭시 새창으로 보임)
</td>
<td class="group_setting">
<input type="checkbox" id="chk_use_comment" name="chk_use_comment" value="1">
<label for="chk_use_comment">동일그룹 모두 적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bo_use_secret">비밀글 사용</label></th>
<td>

View File

@ -60,6 +60,7 @@ $src_char = array('&', '=');
$dst_char = array('', '〓');
$bo_category_list = str_replace($src_char, $dst_char, $bo_category_list);
<<<<<<< HEAD
$sql_common = " gr_id = '{$_POST['gr_id']}',
bo_subject = '{$_POST['bo_subject']}',
bo_admin = '{$_POST['bo_admin']}',
@ -140,6 +141,87 @@ $sql_common = " gr_id = '{$_POST['gr_id']}',
bo_8 = '{$_POST['bo_8']}',
bo_9 = '{$_POST['bo_9']}',
bo_10 = '{$_POST['bo_10']}' ";
=======
$sql_common = " gr_id = '{$_POST['gr_id']}',
bo_subject = '{$_POST['bo_subject']}',
bo_admin = '{$_POST['bo_admin']}',
bo_list_level = '{$_POST[bo_list_level]}',
bo_read_level = '{$_POST[bo_read_level]}',
bo_write_level = '{$_POST[bo_write_level]}',
bo_reply_level = '{$_POST[bo_reply_level]}',
bo_comment_level = '{$_POST[bo_comment_level]}',
bo_html_level = '{$_POST[bo_html_level]}',
bo_link_level = '{$_POST[bo_link_level]}',
bo_trackback_level = '{$_POST[bo_trackback_level]}',
bo_count_modify = '{$_POST[bo_count_modify]}',
bo_count_delete = '{$_POST[bo_count_delete]}',
bo_upload_level = '{$_POST[bo_upload_level]}',
bo_download_level = '{$_POST[bo_download_level]}',
bo_read_point = '{$_POST[bo_read_point]}',
bo_write_point = '{$_POST[bo_write_point]}',
bo_comment_point = '{$_POST[bo_comment_point]}',
bo_download_point = '{$_POST[bo_download_point]}',
bo_use_category = '{$_POST[bo_use_category]}',
bo_category_list = '{$_POST['bo_category_list']}',
bo_disable_tags = '{$_POST['bo_disable_tags']}',
bo_use_sideview = '{$_POST[bo_use_sideview]}',
bo_use_file_content = '{$_POST[bo_use_file_content]}',
bo_use_secret = '{$_POST[bo_use_secret]}',
bo_use_dhtml_editor = '{$_POST[bo_use_dhtml_editor]}',
bo_use_rss_view = '{$_POST[bo_use_rss_view]}',
bo_use_good = '{$_POST[bo_use_good]}',
bo_use_nogood = '{$_POST[bo_use_nogood]}',
bo_use_name = '{$_POST[bo_use_name]}',
bo_use_signature = '{$_POST[bo_use_signature]}',
bo_use_ip_view = '{$_POST[bo_use_ip_view]}',
bo_use_trackback = '{$_POST[bo_use_trackback]}',
bo_use_list_view = '{$_POST[bo_use_list_view]}',
bo_use_list_content = '{$_POST[bo_use_list_content]}',
bo_use_email = '{$_POST[bo_use_email]}',
bo_table_width = '{$_POST[bo_table_width]}',
bo_subject_len = '{$_POST[bo_subject_len]}',
bo_page_rows = '{$_POST[bo_page_rows]}',
bo_new = '{$_POST[bo_new]}',
bo_hot = '{$_POST[bo_hot]}',
bo_image_width = '{$_POST[bo_image_width]}',
bo_skin = '{$_POST['bo_skin']}',
bo_include_head = '{$_POST['bo_include_head']}',
bo_include_tail = '{$_POST['bo_include_tail']}',
bo_content_head = '{$_POST['bo_content_head']}',
bo_content_tail = '{$_POST['bo_content_tail']}',
bo_insert_content = '{$_POST['bo_insert_content']}',
bo_gallery_cols = '{$_POST[bo_gallery_cols]}',
bo_upload_count = '{$_POST[bo_upload_count]}',
bo_upload_size = '{$_POST[bo_upload_size]}',
bo_reply_order = '{$_POST[bo_reply_order]}',
bo_use_search = '{$_POST[bo_use_search]}',
bo_order_search = '{$_POST[bo_order_search]}',
bo_write_min = '{$_POST[bo_write_min]}',
bo_write_max = '{$_POST[bo_write_max]}',
bo_comment_min = '{$_POST[bo_comment_min]}',
bo_comment_max = '{$_POST[bo_comment_max]}',
bo_sort_field = '{$_POST['bo_sort_field']}',
bo_1_subj = '{$_POST['bo_1_subj']}',
bo_2_subj = '{$_POST['bo_2_subj']}',
bo_3_subj = '{$_POST['bo_3_subj']}',
bo_4_subj = '{$_POST['bo_4_subj']}',
bo_5_subj = '{$_POST['bo_5_subj']}',
bo_6_subj = '{$_POST['bo_6_subj']}',
bo_7_subj = '{$_POST['bo_7_subj']}',
bo_8_subj = '{$_POST['bo_8_subj']}',
bo_9_subj = '{$_POST['bo_9_subj']}',
bo_10_subj = '{$_POST['bo_10_subj']}',
bo_1 = '{$_POST['bo_1']}',
bo_2 = '{$_POST['bo_2']}',
bo_3 = '{$_POST['bo_3']}',
bo_4 = '{$_POST['bo_4']}',
bo_5 = '{$_POST['bo_5']}',
bo_6 = '{$_POST['bo_6']}',
bo_7 = '{$_POST['bo_7']}',
bo_8 = '{$_POST['bo_8']}',
bo_9 = '{$_POST['bo_9']}',
bo_10 = '{$_POST['bo_10']}' ";
>>>>>>> 35e2a0e57216e9ff77b98266f30f5e8f87800654
if ($bo_image_head_del) {
@unlink($board_path.'/'.$bo_image_head_del);
@ -262,7 +344,6 @@ if ($chk_category_list) {
}
if ($chk_use_sideview) $s .= " , bo_use_sideview = '{$bo_use_sideview}' ";
if ($chk_use_file_content) $s .= " , bo_use_file_content = '{$bo_use_file_content}' ";
if ($chk_use_comment) $s .= " , bo_use_comment = '{$bo_use_comment}' ";
if ($chk_use_secret) $s .= " , bo_use_secret = '{$bo_use_secret}' ";
if ($chk_use_dhtml_editor) $s .= " , bo_use_dhtml_editor = '{$bo_use_dhtml_editor}' ";
if ($chk_use_rss_view) $s .= " , bo_use_rss_view = '{$bo_use_rss_view}' ";

View File

@ -47,9 +47,11 @@ $sql = " select *
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$listall = '';
if ($sfl || $stx) // 검색렬일 때만 처음 버튼을 보여줌
$listall = '<a href="'.$_SERVER['PHP_SELF'].'">전체목록</a>';
$mb = array();
if ($sfl == 'mb_id' && $stx)
$mb = get_member(isset($stx));
@ -82,9 +84,15 @@ function point_clear()
<?=$listall?>
전체 <?=number_format($total_count)?> 건
<?
<<<<<<< HEAD
if ($mb['mb_id'])
echo '&nbsp;(' . $mb['mb_id'] .' 님 포인트 합계 : ' . number_format($mb['mb_point']) . '점)';
else {
=======
if (isset($mb['mb_id']) && $mb['mb_id']) {
echo '&nbsp;(' . $mb['mb_id'] .' 님 포인트 합계 : ' . number_format($mb['mb_point']) . '점)';
} else {
>>>>>>> 35e2a0e57216e9ff77b98266f30f5e8f87800654
$row2 = sql_fetch(" select sum(po_point) as sum_point from {$g4['point_table']} ");
echo '&nbsp;(전체 합계 '.number_format($row2['sum_point']).'점)';
}
@ -127,10 +135,8 @@ function point_clear()
</thead>
<tbody>
<?
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if ($row2['mb_id'] != $row['mb_id'])
{
for ($i=0; $row=sql_fetch_array($result); $i++) {
if ($i==0 || ($row2['mb_id'] != $row['mb_id'])) {
$sql2 = " select mb_id, mb_name, mb_nick, mb_email, mb_homepage, mb_point from {$g4['member_table']} where mb_id = '{$row['mb_id']}' ";
$row2 = sql_fetch($sql2);
}
@ -138,8 +144,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$mb_nick = get_sideview($row['mb_id'], $row2['mb_nick'], $row2['mb_email'], $row2['mb_homepage']);
$link1 = $link2 = '';
if (!preg_match("/^\@/", $row['po_rel_table']) && $row['po_rel_table'])
{
if (!preg_match("/^\@/", $row['po_rel_table']) && $row['po_rel_table']) {
$link1 = '<a href="'.$g4['bbs_path'].'/board.php?bo_table='.$row['po_rel_table'].'&amp;wr_id='.$row['po_rel_id'].'" target="_blank">';
$link2 = '</a>';
}
@ -174,7 +179,11 @@ if ($i == 0)
</div>
<?
<<<<<<< HEAD
$pagelist = get_paging($config['cf_write_pages'], $page, $total_page, "$_SERVER['PHP_SELF']?$qstr&amp;page=");
=======
$pagelist = get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page=");
>>>>>>> 35e2a0e57216e9ff77b98266f30f5e8f87800654
?>
<div class="pg">
<?=$pagelist?>

View File

@ -1,28 +1,17 @@
<?
include_once('./_common.php');
$cwin = "";
if (array_key_exists('cwin', $_GET)) {
$cwin = $_GET['cwin'];
}
if (!$board['bo_table']) {
if ($cwin) // 코멘트 보기
alert_close('존재하지 않는 게시판입니다.', $g4['path']);
else
alert('존재하지 않는 게시판입니다.', $g4['path']);
alert('존재하지 않는 게시판입니다.', $g4['path']);
}
if (array_key_exists('wr_is_comment', $write)) {
if (isset($write['wr_is_comment']) && $write['wr_is_comment']) {
goto_url('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$write['wr_parent'].'#c_'.$wr_id);
}
if (!$bo_table) {
$msg = "bo_table 값이 넘어오지 않았습니다.\\n\\nboard.php?bo_table=code 와 같은 방식으로 넘겨 주세요.";
if ($cwin) // 코멘트 보기
alert_close($msg);
else
alert($msg);
alert($msg);
}
// wr_id 값이 있으면 글읽기
@ -30,78 +19,66 @@ if (isset($wr_id) && $wr_id) {
// 글이 없을 경우 해당 게시판 목록으로 이동
if (!$write['wr_id']) {
$msg = '글이 존재하지 않습니다.'.PHP_EOL.PHP_EOL.'글이 삭제되었거나 이동된 경우입니다.';
if ($cwin)
alert_close($msg);
else
alert($msg, './board.php?bo_table='.$bo_table);
alert($msg, './board.php?bo_table='.$bo_table);
}
// 그룹접근 사용
if ($group[gr_use_access])
{
if (!$member[mb_id]) {
$msg = '비회원은 이 게시판에 접근할 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.';
if ($cwin)
alert_close($msg);
else
alert($msg, './login.php?wr_id='.$wr_id.$qstr.'&amp;url='.urlencode('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id));
if (isset($group['gr_use_access']) && $group['gr_use_access']) {
if ($is_guest) {
$msg = "비회원은 이 게시판에 접근할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.";
alert($msg, './login.php?wr_id='.$wr_id.$qstr.'&amp;url='.urlencode('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id));
}
// 그룹관리자 이상이라면 통과
if ($is_admin == "super" || $is_admin == "group")
if ($is_admin == "super" || $is_admin == "group") {
;
else
{
} else {
// 그룹접근
$sql = " select count(*) as cnt
from {$g4[group_member_table]}
where gr_id = '{$board[gr_id]}' and mb_id = '{$member[mb_id]}' ";
$sql = " select count(*) as cnt from {$g4['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if (!$row[cnt])
alert('접근 권한이 없으므로 글읽기가 불가합니다.'.PHP_EOL.PHP_EOL.'궁금하신 사항은 관리자에게 문의 바랍니다.', $g4['path']);
if (!$row['cnt']) {
alert("접근 권한이 없으므로 글읽기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.", $g4['path']);
}
}
}
// 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면
if ($member[mb_level] < $board[bo_read_level])
{
if ($member[mb_id])
//alert("글을 읽을 권한이 없습니다.");
if ($member['mb_level'] < $board['bo_read_level']) {
if ($is_member)
alert('글을 읽을 권한이 없습니다.', $g4['path']);
else
alert('글을 읽을 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&amp;url='.urlencode('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id));
}
// 자신의 글이거나 관리자라면 통과
if (($write[mb_id] && $write[mb_id] == $member[mb_id]) || $is_admin)
if (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin) {
;
else
{
} else {
// 비밀글이라면
if (strstr($write[wr_option], "secret"))
if (strstr($write['wr_option'], "secret"))
{
// 회원이 비밀글을 올리고 관리자가 답변글을 올렸을 경우
// 회원이 관리자가 올린 답변글을 바로 볼 수 없던 오류를 수정
$is_owner = false;
if ($write[wr_reply] && $member[mb_id])
if ($write['wr_reply'] && $member['mb_id'])
{
$sql = " select mb_id from {$write_table}
where wr_num = '{$write[wr_num]}'
where wr_num = '{$write['wr_num']}'
and wr_reply = ''
and wr_is_comment = 0 ";
$row = sql_fetch($sql);
if ($row[mb_id] == $member[mb_id])
if ($row['mb_id'] == $member['mb_id'])
$is_owner = true;
}
$ss_name = 'ss_secret_'.$bo_table.'_'.$write[wr_num];
$ss_name = 'ss_secret_'.$bo_table.'_'.$write['wr_num'];
if (!$is_owner)
{
//$ss_name = "ss_secret_{$bo_table}_{$wr_id}";
// 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우는 다시 패스워드를 묻지 않습니다.
// 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면
//if ("$bo_table|$write[wr_num]" != get_session("ss_secret"))
//if ("$bo_table|$write['wr_num']" != get_session("ss_secret"))
if (!get_session($ss_name))
goto_url('./password.php?w=s&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.$qstr);
}
@ -117,26 +94,26 @@ if (isset($wr_id) && $wr_id) {
sql_query(" update {$write_table} set wr_hit = wr_hit + 1 where wr_id = '{$wr_id}' ");
// 자신의 글이면 통과
if ($write[mb_id] && $write[mb_id] == $member[mb_id]) {
if ($write['mb_id'] && $write['mb_id'] == $member['mb_id']) {
;
} else if ($is_guest && $board[bo_read_level] == 1 && $write[wr_ip] == $_SERVER['REMOTE_ADDR']) {
} else if ($is_guest && $board['bo_read_level'] == 1 && $write['wr_ip'] == $_SERVER['REMOTE_ADDR']) {
// 비회원이면서 읽기레벨이 1이고 등록된 아이피가 같다면 자신의 글이므로 통과
;
} else {
/*
// 회원이상 글읽기가 가능하다면
if ($board[bo_read_level] > 1) {
if ($member[mb_point] + $board[bo_read_point] < 0)
alert('보유하신 포인트('.number_format($member[mb_point]).')가 없거나 모자라서 글읽기('.number_format($board[bo_read_point]).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 모으신 후 다시 글읽기 해 주십시오.');
if ($board['bo_read_level'] > 1) {
if ($member['mb_point'] + $board['bo_read_point'] < 0)
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글읽기('.number_format($board['bo_read_point']).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 모으신 후 다시 글읽기 해 주십시오.');
insert_point($member[mb_id], $board[bo_read_point], '{$board[bo_subject]} {$wr_id} 글읽기', $bo_table, $wr_id, '읽기');
insert_point($member['mb_id'], $board['bo_read_point'], '{$board['bo_subject']} {$wr_id} 글읽기', $bo_table, $wr_id, '읽기');
}
*/
// 글읽기 포인트가 설정되어 있다면
if ($board[bo_read_point] && $member[mb_point] + $board[bo_read_point] < 0)
alert('보유하신 포인트('.number_format($member[mb_point]).')가 없거나 모자라서 글읽기('.number_format($board[bo_read_point]).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 모으신 후 다시 글읽기 해 주십시오.');
if ($board['bo_read_point'] && $member['mb_point'] + $board['bo_read_point'] < 0)
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글읽기('.number_format($board['bo_read_point']).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 모으신 후 다시 글읽기 해 주십시오.');
insert_point($member[mb_id], $board[bo_read_point], '{$board[bo_subject]} {$wr_id} 글읽기', $bo_table, $wr_id, '읽기');
insert_point($member['mb_id'], $board['bo_read_point'], "{$board['bo_subject']} {$wr_id} 글읽기", $bo_table, $wr_id, '읽기');
}
set_session($ss_name, TRUE);
@ -201,28 +178,23 @@ $admin_href = "";
if ($member['mb_id'] && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id']))
$admin_href = $g4['admin_path'].'/board_form.php?w=u&amp;bo_table='.$bo_table;
if (!($board['bo_use_comment'] && $cwin))
include_once('./board_head.php');
include_once('./board_head.php');
echo '<script src="'.$g4['path'].'/js/sideview.js"></script>';
if (!($board['bo_use_comment'] && $cwin)) {
// 게시물 아이디가 있다면 게시물 보기를 INCLUDE
if (isset($wr_id) && $wr_id) {
include_once('./view.php');
}
// 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임
//if ($board[bo_use_list_view] || empty($wr_id))
if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id))
include_once ('./list.php');
include_once('./board_tail.php');
// 게시물 아이디가 있다면 게시물 보기를 INCLUDE
if (isset($wr_id) && $wr_id) {
include_once('./view.php');
}
else
include_once('./view_comment.php');
echo PHP_EOL.'<!-- 사용스킨 : $board[bo_skin] -->'.PHP_EOL;
// 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임
//if ($board['bo_use_list_view'] || empty($wr_id))
if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id))
include_once ('./list.php');
include_once('./board_tail.php');
echo "\\n<!-- 사용스킨 : {$board['bo_skin']} -->\\n";
include_once($g4['path'].'/tail.sub.php');
?>

View File

@ -83,5 +83,5 @@ sql_query(" delete from {$g4[board_new_table]} where bo_table = '{$bo_table}' an
// 4.1
@include_once($board_skin_path.'/delete_comment.tail.skin.php');
goto_url('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$write[wr_parent].'&amp;cwin='.$cwin.'&amp;page='.$page. $qstr);
goto_url('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$write[wr_parent].'&amp;page='.$page. $qstr);
?>

View File

@ -5,13 +5,13 @@ $g4['title'] = '로그인';
include_once('./_head.php');
$p = parse_url($url);
if ($p['scheme'] || $p['host']) {
if ((isset($p['scheme']) && $p['scheme']) ||
(isset($p['host']) && $p['host'])) {
alert('url에 도메인을 지정할 수 없습니다.');
}
// 이미 로그인 중이라면
if ($member[mb_id])
{
if ($member['mb_id']) {
if ($url)
goto_url($url);
else
@ -21,9 +21,9 @@ if ($member[mb_id])
if ($url)
$urlencode = urlencode($url);
else
$urlencode = urlencode($_SERVER[REQUEST_URI]);
$urlencode = urlencode($_SERVER['REQUEST_URI']);
$member_skin_path = $g4['path'].'/skin/member/'.$config[cf_member_skin];
$member_skin_path = $g4['path'].'/skin/member/'.$config['cf_member_skin'];
include_once($member_skin_path.'/login.skin.php');

View File

@ -20,57 +20,57 @@ if ($sca || $stx) {
$list_href = './board.php?bo_table='.$bo_table.'&amp;page='.$page;
}
if (!$board[bo_use_list_view]) {
if (!$board['bo_use_list_view']) {
if ($sql_search)
$sql_search = " and " . $sql_search;
// 윗글을 얻음
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num = '{$write[wr_num]}' and wr_reply < '{$write[wr_reply]}' {$sql_search} order by wr_num desc, wr_reply desc limit 1 ";
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num = '{$write['wr_num']}' and wr_reply < '{$write['wr_reply']}' {$sql_search} order by wr_num desc, wr_reply desc limit 1 ";
$prev = sql_fetch($sql);
// 위의 쿼리문으로 값을 얻지 못했다면
if (!$prev[wr_id]) {
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num < '{$write[wr_num]}' {$sql_search} order by wr_num desc, wr_reply desc limit 1 ";
if (!$prev['wr_id']) {
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num < '{$write['wr_num']}' {$sql_search} order by wr_num desc, wr_reply desc limit 1 ";
$prev = sql_fetch($sql);
}
// 아래글을 얻음
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num = '{$write[wr_num]}' and wr_reply > '{$write[wr_reply]}' {$sql_search} order by wr_num, wr_reply limit 1 ";
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num = '{$write['wr_num']}' and wr_reply > '{$write['wr_reply']}' {$sql_search} order by wr_num, wr_reply limit 1 ";
$next = sql_fetch($sql);
// 위의 쿼리문으로 값을 얻지 못했다면
if (!$next[wr_id]) {
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num > '{$write[wr_num]}' {$sql_search} order by wr_num, wr_reply limit 1 ";
if (!$next['wr_id']) {
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num > '{$write['wr_num']}' {$sql_search} order by wr_num, wr_reply limit 1 ";
$next = sql_fetch($sql);
}
}
// 이전글 링크
$prev_href = '';
if ($prev[wr_id]) {
$prev_wr_subject = get_text(cut_str($prev[wr_subject], 255));
$prev_href = './board.php?bo_table='.$bo_table.'&amp;wr_id='.$prev[wr_id].'&amp;page='.$page.$qstr;
if (isset($prev['wr_id']) && $prev['wr_id']) {
$prev_wr_subject = get_text(cut_str($prev['wr_subject'], 255));
$prev_href = './board.php?bo_table='.$bo_table.'&amp;wr_id='.$prev['wr_id'].'&amp;page='.$page.$qstr;
}
// 다음글 링크
$next_href = '';
if ($next[wr_id]) {
$next_wr_subject = get_text(cut_str($next[wr_subject], 255));
$next_href = './board.php?bo_table='.$bo_table.'&amp;wr_id='.$next[wr_id].'&amp;page='.$page.$qstr;
if (isset($next['wr_id']) && $next['wr_id']) {
$next_wr_subject = get_text(cut_str($next['wr_subject'], 255));
$next_href = './board.php?bo_table='.$bo_table.'&amp;wr_id='.$next['wr_id'].'&amp;page='.$page.$qstr;
}
// 쓰기 링크
$write_href = '';
if ($member[mb_level] >= $board[bo_write_level])
if ($member['mb_level'] >= $board['bo_write_level'])
$write_href = './write.php?bo_table='.$bo_table;
// 답변 링크
$reply_href = '';
if ($member[mb_level] >= $board[bo_reply_level])
if ($member['mb_level'] >= $board['bo_reply_level'])
$reply_href = './write.php?w=r&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.$qstr;
// 수정, 삭제 링크
$update_href = $delete_href = '';
// 로그인중이고 자신의 글이라면 또는 관리자라면 패스워드를 묻지 않고 바로 수정, 삭제 가능
if (($member[mb_id] && ($member[mb_id] == $write[mb_id])) || $is_admin) {
if (($member['mb_id'] && ($member['mb_id'] == $write['mb_id'])) || $is_admin) {
$update_href = './write.php?w=u&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;page='.$page.$qstr;
$delete_href = 'javascript:del(\'./delete.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;page='.$page.urldecode($qstr).'\');';
if ($is_admin)
@ -79,14 +79,14 @@ if (($member[mb_id] && ($member[mb_id] == $write[mb_id])) || $is_admin) {
$delete_href = 'javascript:del(\'./delete.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;token='.$token.'&amp;page='.$page.urldecode($qstr).'\');';
}
}
else if (!$write[mb_id]) { // 회원이 쓴 글이 아니라면
else if (!$write['mb_id']) { // 회원이 쓴 글이 아니라면
$update_href = './password.php?w=u&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;page='.$page.$qstr;
$delete_href = './password.php?w=d&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;page='.$page.$qstr;
}
// 최고, 그룹관리자라면 글 복사, 이동 가능
$copy_href = $move_href = '';
if ($write[wr_reply] == '' && ($is_admin == 'super' || $is_admin == 'group')) {
if ($write['wr_reply'] == '' && ($is_admin == 'super' || $is_admin == 'group')) {
$copy_href = 'javascript:win_open(\'./move.php?sw=copy&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;page='.$page.$qstr.'\', \'boardcopy\', \'left=50, top=50, width=500, height=550, scrollbars=1\');';
$move_href = 'javascript:win_open(\'./move.php?sw=move&amp;bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;page='.$page.$qstr.'\', \'boardmove\', \'left=50, top=50, width=500, height=550, scrollbars=1\');';
}
@ -94,53 +94,52 @@ if ($write[wr_reply] == '' && ($is_admin == 'super' || $is_admin == 'group')) {
$scrap_href = '';
$good_href = '';
$nogood_href = '';
if ($member[mb_id]) {
if ($member['mb_id']) {
// 스크랩 링크
$scrap_href = './scrap_popin.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id;
// 추천 링크
if ($board[bo_use_good])
if ($board['bo_use_good'])
$good_href = './good.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;good=good';
// 비추천 링크
if ($board[bo_use_nogood])
if ($board['bo_use_nogood'])
$nogood_href = './good.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;good=nogood';
}
$view = get_view($write, $board, $board_skin_path, 255);
if (strstr($sfl, 'subject'))
$view[subject] = search_font($stx, $view[subject]);
$view['subject'] = search_font($stx, $view['subject']);
$html = 0;
if (strstr($view[wr_option], 'html1'))
if (strstr($view['wr_option'], 'html1'))
$html = 1;
else if (strstr($view[wr_option], 'html2'))
else if (strstr($view['wr_option'], 'html2'))
$html = 2;
$view[content] = conv_content($view[wr_content], $html);
$view['content'] = conv_content($view['wr_content'], $html);
if (strstr($sfl, 'content'))
$view[content] = search_font($stx, $view[content]);
$view[content] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1 onclick='image_window(this)'", $view[content]);
$view['content'] = search_font($stx, $view['content']);
//$view['content'] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1 onclick='image_window(this)'", $view['content']);
//$view[rich_content] = preg_replace("/{img\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);
$view[rich_content] = preg_replace("/{이미지\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);
//$view['rich_content'] = preg_replace("/{img\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view['content']);
$view['rich_content'] = preg_replace("/{이미지\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view['content']);
// 트랙백
$trackback_url = '';
if ($member[mb_level] >= $board[bo_trackback_level]) {
if ($member['mb_level'] >= $board['bo_trackback_level']) {
if (isset($g4['token_time']) == false)
$g4['token_time'] = 3;
$trackback_url = $g4[url].'/'.$g4[bbs].'/tb.php/'.$bo_table.'/'.$wr_id;
$trackback_url = $g4['url'].'/'.$g4['bbs'].'/tb.php/'.$bo_table.'/'.$wr_id;
}
$is_signature = false;
$signature = '';
if ($board[bo_use_signature] && $view[mb_id])
{
if ($board['bo_use_signature'] && $view['mb_id']) {
$is_signature = true;
$mb = get_member($view[mb_id]);
$signature = $mb[mb_signature];
$mb = get_member($view['mb_id']);
$signature = $mb['mb_signature'];
//$signature = bad_tag_convert($signature);
// 081022 : CSRF 보안 결함으로 인한 코드 수정

View File

@ -3,19 +3,15 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
@include_once($board_skin_path.'/view_comment.head.skin.php');
// 자동등록방지
include_once ('./norobot.inc.php');
// 코멘트를 새창으로 여는 경우 세션값이 없으므로 생성한다.
if ($is_admin && !$token)
{
if ($is_admin && !$token) {
set_session("ss_delete_token", $token = uniqid(time()));
}
$list = array();
$is_comment_write = false;
if ($member[mb_level] >= $board[bo_comment_level])
if ($member['mb_level'] >= $board['bo_comment_level'])
$is_comment_write = true;
// 코멘트 출력
@ -26,74 +22,74 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
//$list[$i][name] = get_sideview($row[mb_id], cut_str($row[wr_name], 20, ''), $row[wr_email], $row[wr_homepage]);
//$list[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['wr_name'], 20, ''), $row['wr_email'], $row['wr_homepage']);
$tmp_name = get_text(cut_str($row[wr_name], $config[cf_cut_name])); // 설정된 자리수 만큼만 이름 출력
if ($board[bo_use_sideview])
$list[$i][name] = get_sideview($row[mb_id], $tmp_name, $row[wr_email], $row[wr_homepage]);
$tmp_name = get_text(cut_str($row['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력
if ($board['bo_use_sideview'])
$list[$i]['name'] = get_sideview($row['mb_id'], $tmp_name, $row['wr_email'], $row['wr_homepage']);
else
$list[$i][name] = '<span class="'.($row[mb_id]?'member':'guest').'">'.$tmp_name.'</span>';
$list[$i]['name'] = '<span class="'.($row['mb_id']?'member':'guest').'">'.$tmp_name.'</span>';
// 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
//$list[$i][content] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row[wr_content]);
//$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row['wr_content']);
$list[$i][content] = $list[$i][content1]= '비밀글 입니다.';
if (!strstr($row[wr_option], 'secret') ||
$list[$i]['content'] = $list[$i]['content1']= '비밀글 입니다.';
if (!strstr($row['wr_option'], 'secret') ||
$is_admin ||
($write[mb_id]==$member[mb_id] && $member[mb_id]) ||
($row[mb_id]==$member[mb_id] && $member[mb_id])) {
$list[$i][content1] = $row[wr_content];
$list[$i][content] = conv_content($row[wr_content], 0, 'wr_content');
$list[$i][content] = search_font($stx, $list[$i][content]);
($write['mb_id']==$member['mb_id'] && $member['mb_id']) ||
($row['mb_id']==$member['mb_id'] && $member['mb_id'])) {
$list[$i]['content1'] = $row['wr_content'];
$list[$i]['content'] = conv_content($row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
}
$list[$i][trackback] = url_auto_link($row[wr_trackback]);
$list[$i][datetime] = substr($row[wr_datetime],2,14);
$list[$i]['trackback'] = url_auto_link($row['wr_trackback']);
$list[$i]['datetime'] = substr($row['wr_datetime'],2,14);
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
$list[$i][ip] = $row[wr_ip];
$list[$i]['ip'] = $row['wr_ip'];
if (!$is_admin)
$list[$i][ip] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row[wr_ip]);
$list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row['wr_ip']);
$list[$i][is_reply] = false;
$list[$i][is_edit] = false;
$list[$i][is_del] = false;
$list[$i]['is_reply'] = false;
$list[$i]['is_edit'] = false;
$list[$i]['is_del'] = false;
if ($is_comment_write || $is_admin)
{
if ($member[mb_id])
if ($member['mb_id'])
{
if ($row[mb_id] == $member[mb_id] || $is_admin)
if ($row['mb_id'] == $member['mb_id'] || $is_admin)
{
$list[$i][del_link] = './delete_comment.php?bo_table='.$bo_table.'&amp;comment_id='.$row[wr_id].'&amp;token='.$token.'&amp;cwin='.$cwin.'&amp;page='.$page.$qstr;
$list[$i][is_edit] = true;
$list[$i][is_del] = true;
$list[$i]['del_link'] = './delete_comment.php?bo_table='.$bo_table.'&amp;comment_id='.$row['wr_id'].'&amp;token='.$token.'&amp;page='.$page.$qstr;
$list[$i]['is_edit'] = true;
$list[$i]['is_del'] = true;
}
}
else
{
if (!$row[mb_id]) {
$list[$i][del_link] = './password.php?w=x&amp;bo_table='.$bo_table.'&amp;comment_id='.$row[wr_id].'&amp;cwin='.$cwin.'&amp;page='.$page.$qstr;
$list[$i][is_del] = true;
if (!$row['mb_id']) {
$list[$i]['del_link'] = './password.php?w=x&amp;bo_table='.$bo_table.'&amp;comment_id='.$row['wr_id'].'&amp;page='.$page.$qstr;
$list[$i]['is_del'] = true;
}
}
if (strlen($row[wr_comment_reply]) < 5)
$list[$i][is_reply] = true;
if (strlen($row['wr_comment_reply']) < 5)
$list[$i]['is_reply'] = true;
}
// 05.05.22
// 답변있는 코멘트는 수정, 삭제 불가
if ($i > 0 && !$is_admin)
{
if ($row[wr_comment_reply])
if ($row['wr_comment_reply'])
{
$tmp_comment_reply = substr($row[wr_comment_reply], 0, strlen($row[wr_comment_reply]) - 1);
if ($tmp_comment_reply == $list[$i-1][wr_comment_reply])
$tmp_comment_reply = substr($row['wr_comment_reply'], 0, strlen($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;
$list[$i-1]['is_edit'] = false;
$list[$i-1]['is_del'] = false;
}
}
}
@ -106,17 +102,17 @@ if ($is_admin)
}
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_once($board_skin_path.'/view_comment.skin.php');
// 필터
//echo "<script> var g4_cf_filter = '$config[cf_filter]'; </script>\n";
//echo "<script> var g4_cf_filter = '$config['cf_filter']'; </script>\n";
//echo "<script src='$g4['path']/js/filter.js'></script>\n";
if (!$member[mb_id]) // 비회원일 경우에만
if (!$member['mb_id']) // 비회원일 경우에만
echo '<script src="'.$g4['path'].'/js/md5.js"></script>'.PHP_EOL;
@include_once($board_skin_path.'/view_comment.tail.skin.php');

View File

@ -8,10 +8,7 @@ set_session('ss_wr_id', $wr_id);
// 090713
if (!$board['bo_table']) {
if ($cwin) // 코멘트 보기
alert_close('존재하지 않는 게시판입니다.', $g4['path']);
else
alert('존재하지 않는 게시판입니다.', $g4['path']);
alert('존재하지 않는 게시판입니다.', $g4['path']);
}
if (!$bo_table) {
@ -40,7 +37,7 @@ if ($w == '') {
if ($member['mb_id']) {
alert('글을 쓸 권한이 없습니다.');
} else {
alert('글을 쓸 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER[PHP_SELF].'?bo_table='.$bo_table));
alert('글을 쓸 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['PHP_SELF'].'?bo_table='.$bo_table));
}
}
@ -55,73 +52,73 @@ if ($w == '') {
$title_msg = '글쓰기';
} else if ($w == 'u') {
// 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함
//if ($member[mb_level] < $board[bo_write_level]) {
//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('글을 수정할 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER[PHP_SELF].'?bo_table='.$bo_table));
alert('글을 수정할 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&amp;url='.urlencode($_SERVER['PHP_SELF'].'?bo_table='.$bo_table));
}
}
$len = strlen($write[wr_reply]);
$len = strlen($write['wr_reply']);
if ($len < 0) $len = 0;
$reply = substr($write[wr_reply], 0, $len);
$reply = substr($write['wr_reply'], 0, $len);
// 원글만 구한다.
$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_id <> '{$write['wr_id']}'
and wr_num = '{$write['wr_num']}'
and wr_is_comment = 0 ";
$row = sql_fetch($sql);
if ($row[cnt] && !$is_admin)
if ($row['cnt'] && !$is_admin)
alert('이 글과 관련된 답변글이 존재하므로 수정 할 수 없습니다.'.PHP_EOL.PHP_EOL.'답변글이 있는 원글은 수정할 수 없습니다.');
// 코멘트 달린 원글의 수정 여부
$sql = " select count(*) as cnt from {$write_table}
where wr_parent = '{$wr_id}'
and mb_id <> '{$member[mb_id]}'
and mb_id <> '{$member['mb_id']}'
and wr_is_comment = 1 ";
$row = sql_fetch($sql);
if ($row[cnt] >= $board[bo_count_modify] && !$is_admin)
alert('이 글과 관련된 코멘트가 존재하므로 수정 할 수 없습니다.'.PHP_EOL.PHP_EOL.'코멘트가 '.$board[bo_count_modify].'건 이상 달린 원글은 수정할 수 없습니다.');
if ($row['cnt'] >= $board['bo_count_modify'] && !$is_admin)
alert('이 글과 관련된 코멘트가 존재하므로 수정 할 수 없습니다.'.PHP_EOL.PHP_EOL.'코멘트가 '.$board['bo_count_modify'].'건 이상 달린 원글은 수정할 수 없습니다.');
$title_msg = '글수정';
} else if ($w == 'r') {
if ($member[mb_level] < $board[bo_reply_level]) {
if ($member[mb_id])
if ($member['mb_level'] < $board['bo_reply_level']) {
if ($member['mb_id'])
alert('글을 답변할 권한이 없습니다.');
else
alert('글을 답변할 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?$qstr&amp;url='.urlencode($_SERVER[PHP_SELF].'?bo_table='.$bo_table));
alert('글을 답변할 권한이 없습니다.'.PHP_EOL.PHP_EOL.'회원이시라면 로그인 후 이용해 보십시오.', './login.php?$qstr&amp;url='.urlencode($_SERVER['PHP_SELF'].'?bo_table='.$bo_table));
}
/*
if ($member[mb_point] + $board[bo_comment_point] < 0)
alert('보유하신 포인트('.number_format($member[mb_point]).')가 없거나 모자라서 글답변('.number_format($board[bo_comment_point]).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 적립하신 후 다시 글답변 해 주십시오.');
if ($member['mb_point'] + $board['bo_comment_point'] < 0)
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글답변('.number_format($board['bo_comment_point']).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 적립하신 후 다시 글답변 해 주십시오.');
*/
$tmp_point = $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]).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 적립하신 후 다시 글답변 해 주십시오.');
$tmp_point = $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']).')가 불가합니다.'.PHP_EOL.PHP_EOL.'포인트를 적립하신 후 다시 글답변 해 주십시오.');
//if (preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board[bo_notice]))
//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])
if ($write['wr_is_comment'])
alert('정상적인 접근이 아닙니다.');
// 비밀글인지를 검사
if (strstr($write[wr_option], 'secret')) {
if ($write[mb_id]) {
if (strstr($write['wr_option'], 'secret')) {
if ($write['mb_id']) {
// 회원의 경우는 해당 글쓴 회원 및 관리자
if (!($write[mb_id] == $member[mb_id] || $is_admin))
if (!($write['mb_id'] == $member['mb_id'] || $is_admin))
alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.');
} else {
// 비회원의 경우는 비밀글에 답변이 불가함
@ -135,32 +132,32 @@ if ($w == '') {
$reply_array = &$write;
// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
if (strlen($reply_array[wr_reply]) == 10)
if (strlen($reply_array['wr_reply']) == 10)
alert('더 이상 답변하실 수 없습니다.'.PHP_EOL.PHP_EOL.'답변은 10단계 까지만 가능합니다.');
$reply_len = strlen($reply_array[wr_reply]) + 1;
if ($board[bo_reply_order]) {
$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) <> '' ";
$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) <> '' ";
$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]}%' ";
if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' ";
$row = sql_fetch($sql);
if (!$row[reply])
if (!$row['reply'])
$reply_char = $begin_reply_char;
else if ($row[reply] == $end_reply_char) // A~Z은 26 입니다.
else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다.
alert('더 이상 답변하실 수 없습니다.'.PHP_EOL.PHP_EOL.'답변은 26개 까지만 가능합니다.');
else
$reply_char = chr(ord($row[reply]) + $reply_number);
$reply_char = chr(ord($row['reply']) + $reply_number);
$reply = $reply_array[wr_reply] . $reply_char;
$reply = $reply_array['wr_reply'] . $reply_char;
$title_msg = '글답변';
}
@ -175,7 +172,7 @@ if ($group['gr_use_access']) {
; // 통과
} else {
// 그룹접근
$sql = " select gr_id from {$g4[group_member_table]} where gr_id = '{$board[gr_id]}' and mb_id = '{$member[mb_id]}' ";
$sql = " select gr_id from {$g4['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if (!$row['gr_id'])
alert('접근 권한이 없으므로 글쓰기가 불가합니다.'.PHP_EOL.PHP_EOL.'궁금하신 사항은 관리자에게 문의 바랍니다.');
@ -371,29 +368,26 @@ if ($is_dhtml_editor && $editor->js) {
include_once($g4['path'].'/head.sub.php');
include_once('./board_head.php');
// 자동등록방지
//include_once ('./norobot.inc.php');
//--------------------------------------------------------------------------
// 가변 파일
$file_script = '';
$file_length = -1;
// 수정의 경우 파일업로드 필드가 가변적으로 늘어나야 하고 삭제 표시도 해주어야 합니다.
if ($w == 'u') {
for ($i=0; $i<$file[count]; $i++) {
$row = sql_fetch(" select bf_file, bf_content from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
if ($row[bf_file]) {
$file_script .= 'add_file("<input type="checkbox" name="bf_file_del['.$i.']" value="1"><a href="'.$file[$i][href].'">'.$file[$i][source].'('.$file[$i][size].')</a> 파일 삭제';
for ($i=0; $i<$file['count']; $i++) {
$row = sql_fetch(" select bf_file, bf_content from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
if ($row['bf_file']) {
$file_script .= 'add_file("<input type="checkbox" name="bf_file_del['.$i.']" value="1"><a href="'.$file[$i]['href'].'">'.$file[$i]['source'].'('.$file[$i]['size'].')</a> 파일 삭제';
if ($is_file_content)
//$file_script .= '<br><input type="text" class="ed" size="50" name="bf_content['.$i.']" value="'.$row[bf_content].'" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요.">';
//$file_script .= '<br><input type="text" class="ed" size="50" name="bf_content['.$i.']" value="'.$row['bf_content'].'" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요.">';
// 첨부파일설명에서 ' 또는 " 입력되면 오류나는 부분 수정
$file_script .= '<br><input type="text" class="ed" size="50" name="bf_content['.$i.']" value="'.addslashes(get_text($row[bf_content])).'" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요.">';
$file_script .= '<br><input type="text" class="ed" size="50" name="bf_content['.$i.']" value="'.addslashes(get_text($row['bf_content'])).'" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요.">';
$file_script .= '\");'.PHP_EOL;
}
else
$file_script .= 'add_file("");'.PHP_EOL;
}
$file_length = $file[count] - 1;
$file_length = $file['count'] - 1;
}
if ($file_length < 0) {

View File

@ -339,5 +339,5 @@ else if ($w == 'cu') // 코멘트 수정
@include_once($board_skin_path.'/write_comment_update.skin.php');
@include_once($board_skin_path.'/write_comment_update.tail.skin.php');
goto_url('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr[wr_parent].'&amp;page='.$page.$qstr.'&amp;cwin='.$cwin.'#c_'.$comment_id);
goto_url('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr[wr_parent].'&amp;page='.$page.$qstr.'&amp;#c_'.$comment_id);
?>

View File

@ -1,5 +1,4 @@
<?
$g4['title'] = $wr_subject.'글입력';
include_once('./_common.php');
// 090710
@ -12,55 +11,57 @@ if (substr_count($wr_content, '&#') > 50) {
include_once($g4['path'].'/lib/trackback.lib.php');
/*
$filters = explode(",", $config[cf_filter]);
for ($i=0; $i<count($filters); $i++) {
$s = trim($filters[$i]); // 필터단어의 앞뒤 공백을 없앰
if (stristr($wr_subject, $s)) {
alert("제목에 금지단어(\'{$s}\')가 포함되어 있습니다.");
exit;
}
if (stristr($wr_content, $s)) {
alert("내용에 금지단어(\'{$s}\')가 포함되어 있습니다.");
exit;
}
}
*/
$upload_max_filesize = ini_get('upload_max_filesize');
if (empty($_POST))
alert('파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.'.PHP_EOL.PHP_EOL.'post_max_size='.ini_get('post_max_size').' , upload_max_filesize='.$upload_max_filesize.PHP_EOL.PHP_EOL.'게시판관리자 또는 서버관리자에게 문의 바랍니다.');
// 리퍼러 체크
//referer_check();
$w = $_POST['w'];
$wr_link1 = mysql_real_escape_string($_POST['wr_link1']);
$wr_link2 = mysql_real_escape_string($_POST['wr_link2']);
$notice_array = explode(',', trim($board[bo_notice]));
$notice_array = explode(',', trim($board['bo_notice']));
if ($w == 'u' || $w == 'r') {
$wr = get_write($write_table, $wr_id);
if (!$wr[wr_id])
if (!$wr['wr_id'])
alert('글이 존재하지 않습니다.'.PHP_EOL.PHP_EOL.'글이 삭제되었거나 이동하였을 수 있습니다.');
}
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글은 사용일 경우에만 가능해야 함
if (!$is_admin && !$board[bo_use_secret] && $secret)
if (!$is_admin && !$board['bo_use_secret'] && $secret)
alert('비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.');
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록
if (!$is_admin && $board[bo_use_secret] == 2) {
$secret = '';
if (!$is_admin && $board['bo_use_secret'] == 2)
$secret = 'secret';
$html = '';
if (isset($_POST['html']) && $_POST['html'])
$html = $_POST['html'];
$mail = '';
if (isset($_POST['mail']) && $_POST['mail'])
$mail = $_POST['mail'];
$notice = '';
if (isset($_POST['notice']) && $_POST['notice'])
$notice = $_POST['notice'];
for ($i=1; $i<=10; $i++) {
$var = "wr_$i";
$$var = "";
if (isset($_POST['wr_'.$i]) && $_POST['wr_'.$i]) {
$$var = $_POST['wr_'.$i];
}
}
if ($w == '' || $w == 'u') {
// 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함
if($w =='u' && $member['mb_id'] && $wr['mb_id'] == $member['mb_id'])
;
else if ($member[mb_level] < $board[bo_write_level])
else if ($member['mb_level'] < $board['bo_write_level'])
alert('글을 쓸 권한이 없습니다.');
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함
@ -72,54 +73,54 @@ else if ($w == 'r')
if (in_array((int)$wr_id, $notice_array))
alert('공지에는 답변 할 수 없습니다.');
if ($member[mb_level] < $board[bo_reply_level])
if ($member['mb_level'] < $board['bo_reply_level'])
alert('글을 답변할 권한이 없습니다.');
// 게시글 배열 참조
$reply_array = &$wr;
// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
if (strlen($reply_array[wr_reply]) == 10)
if (strlen($reply_array['wr_reply']) == 10)
alert('더 이상 답변하실 수 없습니다.'.PHP_EOL.PHP_EOL.'답변은 10단계 까지만 가능합니다.');
$reply_len = strlen($reply_array[wr_reply]) + 1;
if ($board[bo_reply_order]) {
$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) <> '' ";
$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) <> '' ";
$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]}%' ";
if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' ";
$row = sql_fetch($sql);
if (!$row[reply])
if (!$row['reply'])
$reply_char = $begin_reply_char;
else if ($row[reply] == $end_reply_char) // A~Z은 26 입니다.
else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다.
alert('더 이상 답변하실 수 없습니다.'.PHP_EOL.PHP_EOL.'답변은 26개 까지만 가능합니다.');
else
$reply_char = chr(ord($row[reply]) + $reply_number);
$reply_char = chr(ord($row['reply']) + $reply_number);
$reply = $reply_array[wr_reply] . $reply_char;
$reply = $reply_array['wr_reply'] . $reply_char;
} else
alert('w 값이 제대로 넘어오지 않았습니다.');
if ($w == "" || $w == "r")
{
if ($_SESSION["ss_datetime"] >= ($g4[server_time] - $config[cf_delay_sec]) && !$is_admin)
if ($_SESSION["ss_datetime"] >= ($g4['server_time'] - $config['cf_delay_sec']) && !$is_admin)
alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.');
set_session("ss_datetime", $g4[server_time]);
set_session("ss_datetime", $g4['server_time']);
// 동일내용 연속 등록 불가
$row = sql_fetch(" select MD5(CONCAT(wr_ip, wr_subject, wr_content)) as prev_md5 from $write_table order by wr_id desc limit 1 ");
$curr_md5 = md5($_SERVER[REMOTE_ADDR].$wr_subject.$wr_content);
if ($row[prev_md5] == $curr_md5 && !$is_admin)
$curr_md5 = md5($_SERVER['REMOTE_ADDR'].$wr_subject.$wr_content);
if ($row['prev_md5'] == $curr_md5 && !$is_admin)
alert('동일한 내용을 연속해서 등록할 수 없습니다.');
}
@ -129,14 +130,14 @@ if ($w == "" || $w == "r")
if (!$is_member) {
if ($w=='' || $w=='r') {
$key = get_session("captcha_keystring");
if (!($key && $key == $_POST[wr_key])) {
if (!($key && $key == $_POST['wr_key'])) {
session_unregister("captcha_keystring");
alert('정상적인 접근이 아닌것 같습니다.');
}
}
}
if (!isset($_POST[wr_subject]) || !trim($_POST[wr_subject]))
if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))
alert('제목을 입력하여 주십시오.');
// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
@ -145,7 +146,7 @@ if (!isset($_POST[wr_subject]) || !trim($_POST[wr_subject]))
// "인터넷옵션 > 보안 > 사용자정의수준 > 스크립팅 > Action 스크립팅 > 사용 안 함" 일 경우의 오류 처리
// 이 옵션을 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다.
//if (!$_POST[wr_content]) die ("내용을 입력하여 주십시오.");
//if (!$_POST['wr_content']) die ("내용을 입력하여 주십시오.");
$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
//print_r2($chars_array); exit;
@ -153,44 +154,45 @@ $chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
// 가변 파일 업로드
$file_upload_msg = '';
$upload = array();
for ($i=0; $i<count($_FILES[bf_file][name]); $i++)
{
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
if ($_POST[bf_file_del][$i])
{
$upload[$i][del_check] = true;
for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) {
$upload[$i]['file'] = '';
$upload[$i]['source'] = '';
$upload[$i]['filesize'] = 0;
$upload[$i]['image'] = array();
$upload[$i]['image'][0] = '';
$upload[$i]['image'][1] = '';
$upload[$i]['image'][2] = '';
$row = sql_fetch(" select bf_file from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
@unlink($g4['path'].'/data/file/'.$bo_table.'/'.$row[bf_file]);
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) {
$upload[$i]['del_check'] = true;
$row = sql_fetch(" select bf_file from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
@unlink($g4['path'].'/data/file/'.$bo_table.'/'.$row['bf_file']);
}
else
$upload[$i][del_check] = false;
$upload[$i]['del_check'] = false;
$tmp_file = $_FILES[bf_file][tmp_name][$i];
$filename = $_FILES[bf_file][name][$i];
$filesize = $_FILES[bf_file][size][$i];
$tmp_file = $_FILES['bf_file']['tmp_name'][$i];
$filename = $_FILES['bf_file']['name'][$i];
$filesize = $_FILES['bf_file']['size'][$i];
// 서버에 설정된 값보다 큰파일을 업로드 한다면
if ($filename)
{
if ($_FILES[bf_file][error][$i] == 1)
{
if ($filename) {
if ($_FILES['bf_file']['error'][$i] == 1) {
$file_upload_msg .= '"'.$filename.'" 파일의 용량이 서버에 설정('.$upload_max_filesize.')된 값보다 크므로 업로드 할 수 없습니다.'.PHP_EOL;
continue;
}
else if ($_FILES[bf_file][error][$i] != 0)
{
else if ($_FILES['bf_file']['error'][$i] != 0) {
$file_upload_msg .= '"'.$filename.'" 파일이 정상적으로 업로드 되지 않았습니다.'.PHP_EOL;
continue;
}
}
if (is_uploaded_file($tmp_file))
{
if (is_uploaded_file($tmp_file)) {
// 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀
if (!$is_admin && $filesize > $board[bo_upload_size])
{
$file_upload_msg .= '"'.$filename.'" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($board[bo_upload_size]).' 바이트)된 값보다 크므로 업로드 하지 않습니다.'.PHP_EOL;
if (!$is_admin && $filesize > $board['bo_upload_size']) {
$file_upload_msg .= '"'.$filename.'" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($board['bo_upload_size']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.'.PHP_EOL;
continue;
}
@ -201,67 +203,62 @@ for ($i=0; $i<count($_FILES[bf_file][name]); $i++)
//-----------------------------------------------------------------
$timg = @getimagesize($tmp_file);
// image type
if ( preg_match("/\.($config[cf_image_extension])$/i", $filename) ||
preg_match("/\.($config[cf_flash_extension])$/i", $filename) )
{
if ($timg[2] < 1 || $timg[2] > 16)
{
//$file_upload_msg .= "\'{$filename}\' 파일이 이미지나 플래시 파일이 아닙니다.\\n";
if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) ||
preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) {
if ($timg['2'] < 1 || $timg['2'] > 16)
continue;
}
}
//=================================================================
$upload[$i][image] = $timg;
$upload[$i]['image'] = $timg;
// 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정
if ($w == 'u')
{
if ($w == 'u') {
// 존재하는 파일이 있다면 삭제합니다.
$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink($g4['path'].'/data/file/'.$bo_table.'/'.$row[bf_file]);
$row = sql_fetch(" select bf_file from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink($g4['path'].'/data/file/'.$bo_table.'/'.$row['bf_file']);
}
// 프로그램 원래 파일명
$upload[$i][source] = $filename;
$upload[$i][filesize] = $filesize;
$upload[$i]['source'] = $filename;
$upload[$i]['filesize'] = $filesize;
// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);
// 접미사를 붙인 파일명
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.urlencode($filename);
//$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr(md5(uniqid($g4['server_time'])),0,8).'_'.urlencode($filename);
// 달빛온도님 수정 : 한글파일은 urlencode($filename) 처리를 할경우 '%'를 붙여주게 되는데 '%'표시는 미디어플레이어가 인식을 못하기 때문에 재생이 안됩니다. 그래서 변경한 파일명에서 '%'부분을 빼주면 해결됩니다.
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g4[server_time])),0,8).'_'.str_replace('%', '', urlencode($filename));
//$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr(md5(uniqid($g4['server_time'])),0,8).'_'.str_replace('%', '', urlencode($filename));
shuffle($chars_array);
$shuffle = implode('', $chars_array);
// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
//$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode($filename));
$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));
//$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode($filename));
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));
$dest_file = $g4['path'].'/data/file/'.$bo_table.'/'.$upload[$i][file];
$dest_file = $g4['path'].'/data/file/'.$bo_table.'/'.$upload[$i]['file'];
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES[bf_file][error][$i]);
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]);
// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, 0606);
//$upload[$i][image] = @getimagesize($dest_file);
//$upload[$i]['image'] = @getimagesize($dest_file);
}
}
if ($w == '' || $w == 'r')
{
if ($member[mb_id])
if ($member['mb_id'])
{
$mb_id = $member[mb_id];
$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
$wr_password = $member[mb_password];
$wr_email = $member[mb_email];
$wr_homepage = $member[mb_homepage];
$mb_id = $member['mb_id'];
$wr_name = $board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'];
$wr_password = $member['mb_password'];
$wr_email = $member['mb_email'];
$wr_homepage = $member['mb_homepage'];
}
else
{
@ -277,10 +274,10 @@ if ($w == '' || $w == 'r')
{
// 답변의 원글이 비밀글이라면 패스워드는 원글과 동일하게 넣는다.
if ($secret)
$wr_password = $wr[wr_password];
$wr_password = $wr['wr_password'];
$wr_id = $wr_id . $reply;
$wr_num = $write[wr_num];
$wr_num = $write['wr_num'];
$wr_reply = $reply;
}
else
@ -305,14 +302,14 @@ if ($w == '' || $w == 'r')
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '{$member[mb_id]}',
mb_id = '{$member['mb_id']}',
wr_password = '{$wr_password}',
wr_name = '{$wr_name}',
wr_email = '{$wr_email}',
wr_homepage = '{$wr_homepage}',
wr_datetime = '{$g4[time_ymdhis]}',
wr_last = '{$g4[time_ymdhis]}',
wr_ip = '{$_SERVER[REMOTE_ADDR]}',
wr_datetime = '{$g4['time_ymdhis']}',
wr_last = '{$g4['time_ymdhis']}',
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
wr_1 = '{$wr_1}',
wr_2 = '{$wr_2}',
wr_3 = '{$wr_3}',
@ -331,32 +328,26 @@ if ($w == '' || $w == 'r')
sql_query(" update {$write_table} set wr_parent = '{$wr_id}' where wr_id = '{$wr_id}' ");
// 새글 INSERT
//sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$wr_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" insert into {$g4[board_new_table]} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '{$g4[time_ymdhis]}', '{$member[mb_id]}' ) ");
//sql_query(" insert into $g4['board_new_table'] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$wr_id', '$wr_id', '$g4['time_ymdhis']' ) ");
sql_query(" insert into {$g4['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '{$g4['time_ymdhis']}', '{$member['mb_id']}' ) ");
// 게시글 1 증가
sql_query("update {$g4[board_table]} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
sql_query("update {$g4['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
// 쓰기 포인트 부여
if ($w == '')
{
if ($notice)
{
$bo_notice = $wr_id.PHP_EOL.$board[bo_notice];
sql_query(" update {$g4[board_table]} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
if ($w == '') {
if ($notice) {
$bo_notice = $wr_id.PHP_EOL.$board['bo_notice'];
sql_query(" update {$g4['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
}
insert_point($member[mb_id], $board[bo_write_point], '{$board[bo_subject]} {$wr_id} 글쓰기', $bo_table, $wr_id, '쓰기');
}
else
{
insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기');
} else {
// 답변은 코멘트 포인트를 부여함
// 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음
insert_point($member[mb_id], $board[bo_comment_point], '{$board[bo_subject]} {$wr_id} 글답변', $bo_table, $wr_id, '쓰기');
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기');
}
}
else if ($w == 'u')
{
} else if ($w == 'u') {
if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) {
alert('올바른 방법으로 수정하여 주십시오.');
}
@ -364,41 +355,41 @@ else if ($w == 'u')
if ($is_admin == 'super') // 최고관리자 통과
;
else if ($is_admin == 'group') { // 그룹관리자
$mb = get_member($write[mb_id]);
if ($member[mb_id] != $group[gr_admin]) // 자신이 관리하는 그룹인가?
$mb = get_member($write['mb_id']);
if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가?
alert('자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.');
else if ($member[mb_level] < $mb[mb_level]) // 자신의 레벨이 크거나 같다면 통과
else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.');
} else if ($is_admin == 'board') { // 게시판관리자이면
$mb = get_member($write[mb_id]);
if ($member[mb_id] != $board[bo_admin]) // 자신이 관리하는 게시판인가?
$mb = get_member($write['mb_id']);
if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가?
alert('자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.');
else if ($member[mb_level] < $mb[mb_level]) // 자신의 레벨이 크거나 같다면 통과
else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.');
} else if ($member[mb_id]) {
if ($member[mb_id] != $write[mb_id])
} else if ($member['mb_id']) {
if ($member['mb_id'] != $write['mb_id'])
alert('자신의 글이 아니므로 수정할 수 없습니다.');
} else {
if ($write[mb_id])
if ($write['mb_id'])
alert('로그인 후 수정하세요.', './login.php?url='.urlencode('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id));
}
if ($member[mb_id])
if ($member['mb_id'])
{
// 자신의 글이라면
if ($member[mb_id] == $wr[mb_id])
if ($member['mb_id'] == $wr['mb_id'])
{
$mb_id = $member[mb_id];
$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
$wr_email = $member[mb_email];
$wr_homepage = $member[mb_homepage];
$mb_id = $member['mb_id'];
$wr_name = $board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'];
$wr_email = $member['mb_email'];
$wr_homepage = $member['mb_homepage'];
}
else
{
$mb_id = $wr[mb_id];
$wr_name = $wr[wr_name];
$wr_email = $wr[wr_email];
$wr_homepage = $wr[wr_homepage];
$mb_id = $wr['mb_id'];
$wr_name = $wr['wr_name'];
$wr_email = $wr['wr_email'];
$wr_homepage = $wr['wr_homepage'];
}
}
else
@ -412,7 +403,7 @@ else if ($w == 'u')
$sql_ip = '';
if (!$is_admin)
$sql_ip = " , wr_ip = '{$_SERVER[REMOTE_ADDR]}' ";
$sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$sql = " update {$write_table}
set ca_name = '{$ca_name}',
@ -437,21 +428,21 @@ else if ($w == 'u')
wr_10= '{$wr_10}'
{$sql_ip}
{$sql_password}
where wr_id = '{$wr[wr_id]}' ";
where wr_id = '{$wr['wr_id']}' ";
sql_query($sql);
// 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함
// 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음
$sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr[wr_id]}' ";
$sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' ";
sql_query($sql);
if ($notice)
{
//if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board[bo_notice]))
//if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice']))
if (!in_array((int)$wr_id, $notice_array))
{
$bo_notice = $wr_id . '\n' . $board[bo_notice];
sql_query(" update {$g4[board_table]} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
$bo_notice = $wr_id . '\n' . $board['bo_notice'];
sql_query(" update {$g4['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
}
}
else
@ -461,8 +452,8 @@ else if ($w == 'u')
if ((int)$wr_id != (int)$notice_array[$i])
$bo_notice .= $notice_array[$i] . ',';
$bo_notice = trim($bo_notice);
//$bo_notice = preg_replace("/^".$wr_id."[\n]?$/m", "", $board[bo_notice]);
sql_query(" update {$g4[board_table]} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
//$bo_notice = preg_replace("/^".$wr_id."[\n]?$/m", "", $board['bo_notice']);
sql_query(" update {$g4['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
}
}
@ -476,22 +467,22 @@ for ($i=0; $i<count($upload); $i++)
$upload[$i]['source'] = addslashes($upload[$i]['source']);
}
$row = sql_fetch(" select count(*) as cnt from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
if ($row[cnt])
$row = sql_fetch(" select count(*) as cnt from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
if ($row['cnt'])
{
// 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
// 그렇지 않다면 내용만 업데이트 합니다.
if ($upload[$i][del_check] || $upload[$i][file])
if ($upload[$i]['del_check'] || $upload[$i]['file'])
{
$sql = " update {$g4[board_file_table]}
set bf_source = '{$upload[$i][source]}',
bf_file = '{$upload[$i][file]}',
$sql = " update {$g4['board_file_table']}
set bf_source = '{$upload[$i]['source']}',
bf_file = '{$upload[$i]['file']}',
bf_content = '{$bf_content[$i]}',
bf_filesize = '{$upload[$i][filesize]}',
bf_width = '{$upload[$i][image][0]}',
bf_height = '{$upload[$i][image][1]}',
bf_type = '{$upload[$i][image][2]}',
bf_datetime = '$g4[time_ymdhis]'
bf_filesize = '{$upload[$i]['filesize']}',
bf_width = '{$upload[$i]['image']['0']}',
bf_height = '{$upload[$i]['image']['1']}',
bf_type = '{$upload[$i]['image']['2']}',
bf_datetime = '{$g4['time_ymdhis']}'
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
and bf_no = '{$i}' ";
@ -499,7 +490,7 @@ for ($i=0; $i<count($upload); $i++)
}
else
{
$sql = " update {$g4[board_file_table]}
$sql = " update {$g4['board_file_table']}
set bf_content = '{$bf_content[$i]}'
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
@ -509,35 +500,35 @@ for ($i=0; $i<count($upload); $i++)
}
else
{
$sql = " insert into {$g4[board_file_table]}
$sql = " insert into {$g4['board_file_table']}
set bo_table = '{$bo_table}',
wr_id = '{$wr_id}',
bf_no = '{$i}',
bf_source = '{$upload[$i][source]}',
bf_file = '{$upload[$i][file]}',
bf_source = '{$upload[$i]['source']}',
bf_file = '{$upload[$i]['file']}',
bf_content = '{$bf_content[$i]}',
bf_download = 0,
bf_filesize = '{$upload[$i][filesize]}',
bf_width = '{$upload[$i][image][0]}',
bf_height = '{$upload[$i][image][1]}',
bf_type = '{$upload[$i][image][2]}',
bf_datetime = '{$g4[time_ymdhis]}' ";
bf_filesize = '{$upload[$i]['filesize']}',
bf_width = '{$upload[$i]['image']['0']}',
bf_height = '{$upload[$i]['image']['1']}',
bf_type = '{$upload[$i]['image']['2']}',
bf_datetime = '{$g4['time_ymdhis']}' ";
sql_query($sql);
}
}
// 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서
// 파일 정보가 없다면 테이블의 내용을 삭제합니다.
$row = sql_fetch(" select max(bf_no) as max_bf_no from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
for ($i=(int)$row[max_bf_no]; $i>=0; $i--)
$row = sql_fetch(" select max(bf_no) as max_bf_no from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
for ($i=(int)$row['max_bf_no']; $i>=0; $i--)
{
$row2 = sql_fetch(" select bf_file from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
$row2 = sql_fetch(" select bf_file from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
// 정보가 있다면 빠집니다.
if ($row2[bf_file]) break;
if ($row2['bf_file']) break;
// 그렇지 않다면 정보를 삭제합니다.
sql_query(" delete from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
sql_query(" delete from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
}
//------------------------------------------------------------------------------
@ -546,7 +537,7 @@ if ($secret)
set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE);
// 메일발송 사용 (수정글은 발송하지 않음)
if (!($w == 'u' || $w == 'cu') && $config[cf_email_use] && $board[bo_use_email])
if (!($w == 'u' || $w == 'cu') && $config['cf_email_use'] && $board['bo_use_email'])
{
// 관리자의 정보를 얻고
$super_admin = get_admin('super');
@ -566,8 +557,8 @@ if (!($w == 'u' || $w == 'cu') && $config[cf_email_use] && $board[bo_use_email])
$warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'코멘트', 'cu'=>'코멘트 수정' );
$str = $warr[$w];
$subject = '"'.$board[bo_subject].'" 게시판에 '.$str.'글이 올라왔습니다.';
$link_url = $g4[url].'/'.$g4[bbs].'/board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;'.$qstr;
$subject = '"'.$board['bo_subject'].'" 게시판에 '.$str.'글이 올라왔습니다.';
$link_url = $g4['url'].'/'.$g4['bbs'].'/board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id.'&amp;'.$qstr;
include_once($g4['path'].'/lib/mailer.lib.php');
@ -578,25 +569,25 @@ if (!($w == 'u' || $w == 'cu') && $config[cf_email_use] && $board[bo_use_email])
$array_email = array();
// 게시판관리자에게 보내는 메일
if ($config[cf_email_wr_board_admin]) $array_email[] = $board_admin[mb_email];
if ($config['cf_email_wr_board_admin']) $array_email[] = $board_admin['mb_email'];
// 게시판그룹관리자에게 보내는 메일
if ($config[cf_email_wr_group_admin]) $array_email[] = $group_admin[mb_email];
if ($config['cf_email_wr_group_admin']) $array_email[] = $group_admin['mb_email'];
// 최고관리자에게 보내는 메일
if ($config[cf_email_wr_super_admin]) $array_email[] = $super_admin[mb_email];
if ($config['cf_email_wr_super_admin']) $array_email[] = $super_admin['mb_email'];
// 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면
if (strstr($wr[wr_option], 'mail') && $wr[wr_email]) {
if (strstr($wr['wr_option'], 'mail') && $wr['wr_email']) {
// 원글 메일발송에 체크가 되어 있다면
if ($config[cf_email_wr_write]) $array_email[] = $wr[wr_email];
if ($config['cf_email_wr_write']) $array_email[] = $wr['wr_email'];
// 코멘트 쓴 모든이에게 메일 발송이 되어 있다면 (자신에게는 발송하지 않는다)
if ($config[cf_email_wr_comment_all]) {
if ($config['cf_email_wr_comment_all']) {
$sql = " select distinct wr_email from {$write_table}
where wr_email not in ( '{$wr[wr_email]}', '{$member[mb_email]}', '' )
where wr_email not in ( '{$wr['wr_email']}', '{$member['mb_email']}', '' )
and wr_parent = '{$wr_id}' ";
$result = sql_query($sql);
while ($row=sql_fetch_array($result))
$array_email[] = $row[wr_email];
$array_email[] = $row['wr_email'];
}
}
@ -614,9 +605,9 @@ if (!($w == 'u' || $w == 'cu') && $config[cf_email_use] && $board[bo_use_email])
// 트랙백 주소가 있다면
if (($w != 'u' && $wr_trackback) || ($w=='u' && $wr_trackback && $re_trackback))
{
$trackback_url = $g4[url].'/'.$g4[bbs].'/tb.php/'.$bo_table.'/'.$wr_id;
$trackback_url = $g4['url'].'/'.$g4['bbs'].'/tb.php/'.$bo_table.'/'.$wr_id;
$msg = "";
$msg = send_trackback($wr_trackback, $trackback_url, $wr_subject, $board[bo_subject], $_POST[wr_content]);
$msg = send_trackback($wr_trackback, $trackback_url, $wr_subject, $board['bo_subject'], $_POST['wr_content']);
if ($msg) {
echo '<meta http-equiv="content-type" content="text/html; charset='.$g4['charset'].'">'.PHP_EOL;
echo '<script>alert('.$msg.' '.$wr_trackback.');</script>';
@ -624,9 +615,8 @@ if (($w != 'u' && $wr_trackback) || ($w=='u' && $wr_trackback && $re_trackback))
}
@include_once($board_skin_path.'/write_update.tail.skin.php');
if ($g4[https_url])
$https_url = $g4[url].'/'.$g4[bbs];
if ($g4['https_url'])
$https_url = $g4['url'].'/'.$g4['bbs'];
else
$https_url = '.';

View File

@ -93,9 +93,9 @@ table {margin-bottom:10px;width:100%;border:1px solid #d5dcdf;background:#fff}
caption {padding:10px 0 15px;color:#2f4d59;text-align:left;font-size:1em;font-weight:bold}
caption p {margin:7px 0 0;padding:0;color:#6b8088;font:0.75em normal}
th, td {border-bottom:1px solid #e9ecee;font-size:0.75em}
th {padding:10px;background:#f1f6f7}
th label {display:block}
th a {color:#000}
th {padding:10px;background:#f1f6f7}
td {padding:10px}
/* 폼 테이블 */

View File

@ -66,6 +66,7 @@ function print_r2($var)
// header("location:URL") 을 대체
function goto_url($url)
{
$url = str_replace("&amp;", "&", $url);
echo "<script> location.replace('$url'); </script>";
exit;
}
@ -84,7 +85,7 @@ function set_session($session_name, $value)
// 세션변수값 얻음
function get_session($session_name)
{
return $_SESSION[$session_name];
return isset($_SESSION[$session_name]) ? $_SESSION[$session_name] : '';
}
@ -115,7 +116,7 @@ function alert($msg='', $url='')
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g4[charset]");
//header("Content-Type: text/html; charset=$g4['charset']");
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset={$g4['charset']}\">";
echo "<script>alert('$msg');";
if (!$url)
@ -153,7 +154,7 @@ function url_auto_link($str)
$str = preg_replace("/&quot;/", "\"", $str);
$str = preg_replace("/&nbsp;/", "\t_nbsp_\t", $str);
$str = preg_replace("/([^(http:\/\/)]|\(|^)(www\.[^[:space:]]+)/i", "\\1<A HREF=\"http://\\2\" TARGET='{$config['cf_link_target']}'>\\2</A>", $str);
//$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,]+)/i", "\\1<A HREF=\"\\2\" TARGET='$config[cf_link_target]'>\\2</A>", $str);
//$str = preg_replace("/([^(HREF=\"?'?)|(SRC=\"?'?)]|\(|^)((http|https|ftp|telnet|news|mms):\/\/[a-zA-Z0-9\.-]+\.[\xA1-\xFEa-zA-Z0-9\.:&#=_\?\/~\+%@;\-\|\,]+)/i", "\\1<A HREF=\"\\2\" TARGET='$config['cf_link_target']'>\\2</A>", $str);
// 100825 : () 추가
// 120315 : CHARSET 에 따라 링크시 글자 잘림 현상이 있어 수정
if (strtoupper($g4['charset']) == 'UTF-8') {
@ -215,18 +216,18 @@ function get_file($bo_table, $wr_id)
$file[$no]['download'] = $row['bf_download'];
// 4.00.11 - 파일 path 추가
$file[$no]['path'] = $g4['path'].'/data/file/'.$bo_table;
//$file[$no][size] = get_filesize("{$file[$no][path]}/$row[bf_file]");
//$file[$no]['size'] = get_filesize("{$file[$no]['path']}/$row['bf_file']");
$file[$no]['size'] = get_filesize($row['bf_filesize']);
//$file[$no][datetime] = date("Y-m-d H:i:s", @filemtime("$g4[path]/data/file/$bo_table/$row[bf_file]"));
//$file[$no]['datetime'] = date("Y-m-d H:i:s", @filemtime("$g4['path']/data/file/$bo_table/$row['bf_file']"));
$file[$no]['datetime'] = $row['bf_datetime'];
$file[$no]['source'] = addslashes($row['bf_source']);
$file[$no]['bf_content'] = $row['bf_content'];
$file[$no]['content'] = get_text($row['bf_content']);
//$file[$no][view] = view_file_link($row[bf_file], $file[$no][content]);
//$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);
$file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
$file[$no]['file'] = $row['bf_file'];
// prosper 님 제안
//$file[$no][imgsize] = @getimagesize("{$file[$no][path]}/$row[bf_file]");
//$file[$no]['imgsize'] = @getimagesize("{$file[$no]['path']}/$row['bf_file']");
$file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
$file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
$file[$no]['image_type'] = $row['bf_type'];
@ -338,10 +339,7 @@ function get_list($write_row, $board, $skin_path, $subject_len=40)
$list['ca_name_href'] = $g4['bbs_path'].'/board.php?bo_table='.$board['bo_table'].'&amp;sca='.urlencode($list['ca_name']);
$list['href'] = $g4['bbs_path'].'/board.php?bo_table='.$board['bo_table'].'&amp;wr_id='.$list['wr_id'].$qstr;
if ($board['bo_use_comment'])
$list['comment_href'] = "javascript:win_comment('$g4[bbs_path]/board.php?bo_table=$board[bo_table]&amp;wr_id={$list['wr_id']}&amp;cwin=1');";
else
$list['comment_href'] = $list['href'];
$list['comment_href'] = $list['href'];
$list['icon_new'] = '';
if ($list['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($board['bo_new'] * 3600)))
@ -424,14 +422,14 @@ function conv_subject($subject, $len, $suffix='')
// OBJECT 태그의 XSS 막기
function bad120422($matches)
{
$tag = $matches[1];
$code = $matches[2];
$tag = $matches['1'];
$code = $matches['2'];
if (preg_match("#\bscript\b#i", $code)) {
return "$tag 태그에 스크립트는 사용 불가합니다.";
} else if (preg_match("#\bbase64\b#i", $code)) {
return "$tag 태그에 BASE64는 사용 불가합니다.";
}
return $matches[0];
return $matches['0'];
}
// 내용을 변환
@ -554,8 +552,8 @@ function get_sql_search($search_ca_name, $search_field, $search_text, $search_op
// 검색필드를 구분자로 나눈다. 여기서는 +
$tmp = array();
$tmp = explode(",", trim($search_field));
$field = explode("||", $tmp[0]);
$not_comment = $tmp[1];
$field = explode("||", $tmp['0']);
$not_comment = $tmp['1'];
$str .= "(";
for ($i=0; $i<count($s); $i++) {
@ -697,7 +695,7 @@ function get_admin($admin='super')
$is = false;
if ($admin == 'board') {
$mb = sql_fetch("select * from {$g4['member_table']} where mb_id in ('$board[bo_admin]') limit 1 ");
$mb = sql_fetch("select * from {$g4['member_table']} where mb_id in ('{$board['bo_admin']}') limit 1 ");
$is = true;
}
@ -722,8 +720,8 @@ function is_admin($mb_id)
if (!$mb_id) return;
if ($config['cf_admin'] == $mb_id) return 'super';
if ($group['gr_admin'] == $mb_id) return 'group';
if ($board['bo_admin'] == $mb_id) return 'board';
if (isset($group['gr_admin']) && ($group['gr_admin'] == $mb_id)) return 'group';
if (isset($board['bo_admin']) && ($board['bo_admin'] == $mb_id)) return 'board';
return '';
}
@ -801,7 +799,7 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == '') { return 0; }
$mb = sql_fetch(" select mb_id from {$g4['member_table']} where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
if (!$mb['mb_id']) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
@ -812,7 +810,7 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
if ($row['cnt'])
return -1;
}
@ -890,8 +888,8 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
//if (file_exists($icon_file) && is_file($icon_file)) {
if (file_exists($icon_file)) {
//$size = getimagesize($icon_file);
//$width = $size[0];
//$height = $size[1];
//$width = $size['0'];
//$height = $size['1'];
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_name = '<img src="'.$icon_file.'" width="'.$width.'" height="'.$height.'" border="0" alt="첨부파일">';
@ -945,17 +943,17 @@ function view_file_link($file, $width, $height, $content='')
return "<img src='{$g4['path']}/data/file/{$board['bo_table']}/".urlencode($file)."' onclick='image_window(this);' alt='{$content}'>";
/*
// 110106 : FLASH XSS 공격으로 인하여 코드 자체를 막음
else if (preg_match("/\.($config[cf_flash_extension])$/i", $file))
//return "<embed src='$g4[path]/data/file/$board[bo_table]/$file' $attr></embed>";
return "<script>doc_write(flash_movie('$g4[path]/data/file/$board[bo_table]/$file', '_g4_{$ids}', '$width', '$height', 'transparent'));</script>";
else if (preg_match("/\.($config['cf_flash_extension'])$/i", $file))
//return "<embed src='$g4['path']/data/file/$board['bo_table']/$file' $attr></embed>";
return "<script>doc_write(flash_movie('$g4['path']/data/file/$board['bo_table']/$file', '_g4_{$ids}', '$width', '$height', 'transparent'));</script>";
*/
//=============================================================================================
// 동영상 파일에 악성코드를 심는 경우를 방지하기 위해 경로를 노출하지 않음
//---------------------------------------------------------------------------------------------
/*
else if (preg_match("/\.($config[cf_movie_extension])$/i", $file))
//return "<embed src='$g4[path]/data/file/$board[bo_table]/$file' $attr></embed>";
return "<script>doc_write(obj_movie('$g4[path]/data/file/$board[bo_table]/$file', '_g4_{$ids}', '$width', '$height'));</script>";
else if (preg_match("/\.($config['cf_movie_extension'])$/i", $file))
//return "<embed src='$g4['path']/data/file/$board['bo_table']/$file' $attr></embed>";
return "<script>doc_write(obj_movie('$g4['path']/data/file/$board['bo_table']/$file', '_g4_{$ids}', '$width', '$height'));</script>";
*/
//=============================================================================================
}
@ -979,11 +977,11 @@ function view_link($view, $number, $attribute)
{
global $config;
if ($view[link][$number][link])
if ($view['link'][$number]['link'])
{
if (!preg_match("/target/i", $attribute))
$attribute .= " target='$config[cf_link_target]'";
return "<a href='{$view[link][$number][href]}' $attribute>{$view[link][$number][link]}</a>";
$attribute .= " target='$config['cf_link_target']'";
return "<a href='{$view['link'][$number]['href']}' $attribute>{$view['link'][$number]['link']}</a>";
}
else
return "{".$number."번 링크 없음}";
@ -1113,7 +1111,7 @@ function sql_query($sql, $error=TRUE)
function sql_fetch($sql, $error=TRUE)
{
$result = sql_query($sql, $error);
//$row = @sql_fetch_array($result) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : $_SERVER[PHP_SELF]");
//$row = @sql_fetch_array($result) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : $_SERVER['PHP_SELF']");
$row = sql_fetch_array($result);
return $row;
}
@ -1232,9 +1230,9 @@ function referer_check($url='')
global $g4;
if (!$url)
$url = $g4[url];
$url = $g4['url'];
if (!preg_match("/^http[s]?:\/\/".$_SERVER[HTTP_HOST]."/", $_SERVER[HTTP_REFERER]))
if (!preg_match("/^http['s']?:\/\/".$_SERVER['HTTP_HOST']."/", $_SERVER['HTTP_REFERER']))
alert("제대로 된 접근이 아닌것 같습니다.", $url);
*/
}
@ -1267,9 +1265,9 @@ function date_select($date, $name='')
// 년
$s .= "<select name='{$name}_y'>";
for ($i=$m[0]-3; $i<=$m[0]+3; $i++) {
for ($i=$m['0']-3; $i<=$m['0']+3; $i++) {
$s .= "<option value='$i'";
if ($i == $m[0]) {
if ($i == $m['0']) {
$s .= " selected";
}
$s .= ">$i";
@ -1280,7 +1278,7 @@ function date_select($date, $name='')
$s .= "<select name='{$name}_m'>";
for ($i=1; $i<=12; $i++) {
$s .= "<option value='$i'";
if ($i == $m[2]) {
if ($i == $m['2']) {
$s .= " selected";
}
$s .= ">$i";
@ -1291,7 +1289,7 @@ function date_select($date, $name='')
$s .= "<select name='{$name}_d'>";
for ($i=1; $i<=31; $i++) {
$s .= "<option value='$i'";
if ($i == $m[3]) {
if ($i == $m['3']) {
$s .= " selected";
}
$s .= ">$i";
@ -1313,7 +1311,7 @@ function time_select($time, $name="")
$s .= "<select name='{$name}_h'>";
for ($i=0; $i<=23; $i++) {
$s .= "<option value='$i'";
if ($i == $m[0]) {
if ($i == $m['0']) {
$s .= " selected";
}
$s .= ">$i";
@ -1324,7 +1322,7 @@ function time_select($time, $name="")
$s .= "<select name='{$name}_i'>";
for ($i=0; $i<=59; $i++) {
$s .= "<option value='$i'";
if ($i == $m[2]) {
if ($i == $m['2']) {
$s .= " selected";
}
$s .= ">$i";
@ -1335,7 +1333,7 @@ function time_select($time, $name="")
$s .= "<select name='{$name}_s'>";
for ($i=0; $i<=59; $i++) {
$s .= "<option value='$i'";
if ($i == $m[3]) {
if ($i == $m['3']) {
$s .= " selected";
}
$s .= ">$i";
@ -1449,8 +1447,8 @@ function explain($sql)
$q = "explain $sql";
echo $q;
$row = sql_fetch($q);
if (!$row[key]) $row[key] = "NULL";
echo " <font color=blue>(type=$row[type] , key=$row[key])</font>";
if (!$row['key']) $row['key'] = "NULL";
echo " <font color=blue>(type={$row['type']} , key={$row['key']})</font>";
}
}

View File

@ -8,8 +8,6 @@ var char_min = parseInt(<?=$comment_min?>); // 최소
var char_max = parseInt(<?=$comment_max?>); // 최대
</script>
<? if ($cwin==1) { ?><table width=100% cellpadding=10 align=center><tr><td><?}?>
<!-- 코멘트 리스트 -->
<div id="commentContents">
<?
@ -93,7 +91,6 @@ for ($i=0; $i<count($list); $i++) {
<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=cwin value='<?=$cwin?>'>
<input type=hidden name=is_good value=''>
<table width=100% cellpadding=3 height=156 cellspacing=0 bgcolor="#ffffff" style="border:1px solid #fff; background:url(<?=$board_skin_path?>/img/co_bg.gif) x-repeat;">
@ -315,5 +312,3 @@ function comment_delete(url)
comment_box('', 'c'); // 코멘트 입력폼이 보이도록 처리하기위해서 추가 (root님)
</script>
<? } ?>
<? if($cwin==1) { ?></td><tr></table><p align=center><a href="javascript:window.close();"><img src="<?=$board_skin_path?>/img/btn_close.gif" border="0"></a><br><br><?}?>

View File

@ -49,7 +49,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<h2>게시물 정보</h2>
<dl>
<dt>작성자</dt>
<dd><?=$view[name]?><? if ($is_ip_view) { echo "&nbsp;($ip)"; } ?></dd>
<dd><?=$view['name']?><? if ($is_ip_view) { echo "&nbsp;($ip)"; } ?></dd>
<dt>작성일</dt>
<dd><?=date("y-m-d H:i", strtotime($view['wr_datetime']))?></dd>
<dt>조회</dt>
@ -74,7 +74,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view['file']); $i++) {
if ($view['file'][$i]['source'] && !$view['file'][$i]['view']) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
$cnt++;
?>
<li>
@ -121,7 +121,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<?
// 파일 출력
for ($i=0; $i<=count($view['file']); $i++) {
if ($view['file'][$i]['view'])
if (isset($view['file'][$i]['view']) && $view['file'][$i]['view'])
echo $view['file'][$i]['view'];
}
?>

View File

@ -1,7 +1,5 @@
<?
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// $cwin 은 댓글 새창일 때
?>
<script>
@ -10,8 +8,6 @@ var char_min = parseInt(<?=$comment_min?>); // 최소
var char_max = parseInt(<?=$comment_max?>); // 최대
</script>
<? if ($cwin==1) { ?><?}?>
<!-- 댓글 리스트 -->
<section id="commentContents">
<h2>댓글</h2>
@ -71,7 +67,6 @@ var char_max = parseInt(<?=$comment_max?>); // 최대
<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="cwin" value="<?=$cwin?>">
<input type="hidden" name="is_good" value="">
<div id="comment_write">
@ -278,5 +273,3 @@ var char_max = parseInt(<?=$comment_max?>); // 최대
</script>
<? } ?>
</section>
<? if($cwin==1) { ?><?}?>