그누보드5 정식버전
This commit is contained in:
3
bbs/_common.php
Normal file
3
bbs/_common.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include_once('../common.php');
|
||||
?>
|
||||
4
bbs/_head.php
Normal file
4
bbs/_head.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_PATH.'/_head.php');
|
||||
?>
|
||||
4
bbs/_head.sub.php
Normal file
4
bbs/_head.sub.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
4
bbs/_tail.php
Normal file
4
bbs/_tail.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_PATH.'/_tail.php');
|
||||
?>
|
||||
4
bbs/_tail.sub.php
Normal file
4
bbs/_tail.sub.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
20
bbs/ajax.autosave.php
Normal file
20
bbs/ajax.autosave.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member) die('0');
|
||||
|
||||
$uid = trim($_REQUEST['uid']);
|
||||
$subject = trim($_REQUEST['subject']);
|
||||
$content = trim($_REQUEST['content']);
|
||||
|
||||
if ($subject && $content) {
|
||||
$sql = " select count(*) as cnt from {$g5['autosave_table']} where mb_id = '{$member['mb_id']}' and as_subject = '$subject' and as_content = '$content' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['cnt']) {
|
||||
$sql = " insert into {$g5['autosave_table']} set mb_id = '{$member['mb_id']}', as_uid = '{$uid}', as_subject = '$subject', as_content = '$content', as_datetime = '".G5_TIME_YMDHIS."' on duplicate key update as_subject = '$subject', as_content = '$content', as_datetime = '".G5_TIME_YMDHIS."' ";
|
||||
$result = sql_query($sql, false);
|
||||
|
||||
echo autosave_count($member['mb_id']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
15
bbs/ajax.autosavedel.php
Normal file
15
bbs/ajax.autosavedel.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
include_once("./_common.php");
|
||||
|
||||
if (!$is_member) die("0");
|
||||
|
||||
$as_id = (int)$_REQUEST['as_id'];
|
||||
|
||||
$sql = " delete from {$g5['autosave_table']} where mb_id = '{$member['mb_id']}' and as_id = {$as_id} ";
|
||||
$result = sql_query($sql);
|
||||
if (!$result) {
|
||||
echo "-1";
|
||||
}
|
||||
|
||||
echo autosave_count($member['mb_id']);
|
||||
?>
|
||||
21
bbs/ajax.autosavelist.php
Normal file
21
bbs/ajax.autosavelist.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member) die('');
|
||||
|
||||
$sql = " select as_id, as_uid, as_subject, as_datetime from {$g5['autosave_table']} where mb_id = '{$member['mb_id']}' order by as_id desc ";
|
||||
$result = sql_query($sql);
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
echo "<list>\n";
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$subject = htmlspecialchars(utf8_strcut($row['as_subject'], 25), ENT_QUOTES);
|
||||
$datetime = substr($row['as_datetime'],2,14);
|
||||
echo "<item>\n";
|
||||
echo "<id>{$row['as_id']}</id>\n";
|
||||
echo "<uid>{$row['as_uid']}</uid>\n";
|
||||
echo "<subject><![CDATA[{$subject}]]></subject>\n";
|
||||
echo "<datetime>{$datetime}</datetime>\n";
|
||||
echo "</item>\n";
|
||||
}
|
||||
echo "</list>";
|
||||
?>
|
||||
18
bbs/ajax.autosaveload.php
Normal file
18
bbs/ajax.autosaveload.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member) die('');
|
||||
|
||||
$as_id = (int)$_REQUEST['as_id'];
|
||||
|
||||
$sql = " select as_subject, as_content from {$g5['autosave_table']} where mb_id = '{$member['mb_id']}' and as_id = {$as_id} ";
|
||||
$row = sql_fetch($sql);
|
||||
$subject = $row['as_subject'];
|
||||
$content = $row['as_content'];
|
||||
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
echo "<item>\n";
|
||||
echo "<subject><![CDATA[{$subject}]]></subject>\n";
|
||||
echo "<content><![CDATA[{$content}]]></content>\n";
|
||||
echo "</item>\n";
|
||||
?>
|
||||
31
bbs/ajax.filter.php
Normal file
31
bbs/ajax.filter.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$subject = strtolower($_POST['subject']);
|
||||
$content = strtolower(strip_tags($_POST['content']));
|
||||
|
||||
//$filter = explode(",", strtolower(trim($config['cf_filter'])));
|
||||
// strtolower 에 의한 한글 변형으로 아래 코드로 대체 (곱슬최씨님이 알려 주셨습니다.)
|
||||
$filter = explode(",", trim($config['cf_filter']));
|
||||
for ($i=0; $i<count($filter); $i++) {
|
||||
$str = $filter[$i];
|
||||
|
||||
// 제목 필터링 (찾으면 중지)
|
||||
$subj = "";
|
||||
$pos = strpos($subject, $str);
|
||||
if ($pos !== false) {
|
||||
$subj = $str;
|
||||
break;
|
||||
}
|
||||
|
||||
// 내용 필터링 (찾으면 중지)
|
||||
$cont = "";
|
||||
$pos = strpos($content, $str);
|
||||
if ($pos !== false) {
|
||||
$cont = $str;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");
|
||||
?>
|
||||
12
bbs/ajax.mb_email.php
Normal file
12
bbs/ajax.mb_email.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/register.lib.php');
|
||||
|
||||
$mb_email = trim($_POST['reg_mb_email']);
|
||||
$mb_id = trim($_POST['reg_mb_id']);
|
||||
|
||||
if ($msg = empty_mb_email($mb_email)) die($msg);
|
||||
if ($msg = valid_mb_email($mb_email)) die($msg);
|
||||
if ($msg = prohibit_mb_email($mb_email)) die($msg);
|
||||
if ($msg = exist_mb_email($mb_email, $mb_id)) die($msg);
|
||||
?>
|
||||
10
bbs/ajax.mb_hp.php
Normal file
10
bbs/ajax.mb_hp.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/register.lib.php');
|
||||
|
||||
$mb_hp = trim($_POST['reg_mb_hp']);
|
||||
$mb_id = trim($_POST['reg_mb_id']);
|
||||
|
||||
if ($msg = valid_mb_hp($mb_hp)) die($msg);
|
||||
//if ($msg = exist_mb_hp($mb_hp, $mb_id)) die($msg);
|
||||
?>
|
||||
12
bbs/ajax.mb_id.php
Normal file
12
bbs/ajax.mb_id.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/register.lib.php');
|
||||
|
||||
$mb_id = trim($_POST['reg_mb_id']);
|
||||
|
||||
if ($msg = empty_mb_id($mb_id)) die($msg);
|
||||
if ($msg = valid_mb_id($mb_id)) die($msg);
|
||||
if ($msg = count_mb_id($mb_id)) die($msg);
|
||||
if ($msg = exist_mb_id($mb_id)) die($msg);
|
||||
if ($msg = reserve_mb_id($mb_id)) die($msg);
|
||||
?>
|
||||
12
bbs/ajax.mb_nick.php
Normal file
12
bbs/ajax.mb_nick.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/register.lib.php');
|
||||
|
||||
$mb_nick = trim($_POST['reg_mb_nick']);
|
||||
$mb_id = trim($_POST['reg_mb_id']);
|
||||
|
||||
if ($msg = empty_mb_nick($mb_nick)) die($msg);
|
||||
if ($msg = valid_mb_nick($mb_nick)) die($msg);
|
||||
if ($msg = count_mb_nick($mb_nick)) die($msg);
|
||||
if ($msg = exist_mb_nick($mb_nick, $mb_id)) die($msg);
|
||||
?>
|
||||
13
bbs/ajax.mb_recommend.php
Normal file
13
bbs/ajax.mb_recommend.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
include_once("./_common.php");
|
||||
include_once(G5_LIB_PATH."/register.lib.php");
|
||||
|
||||
$mb_recommend = trim($_POST["reg_mb_recommend"]);
|
||||
|
||||
if ($msg = valid_mb_id($mb_recommend)) {
|
||||
die("추천인의 아이디는 영문자, 숫자, _ 만 입력하세요.");
|
||||
}
|
||||
if (!($msg = exist_mb_id($mb_recommend))) {
|
||||
die("입력하신 추천인은 존재하지 않는 아이디 입니다.");
|
||||
}
|
||||
?>
|
||||
107
bbs/alert.php
Normal file
107
bbs/alert.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
global $lo_location;
|
||||
global $lo_url;
|
||||
|
||||
include_once('./_common.php');
|
||||
|
||||
if($error) {
|
||||
$g5['title'] = "오류안내 페이지";
|
||||
} else {
|
||||
$g5['title'] = "결과안내 페이지";
|
||||
}
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
// 필수 입력입니다.
|
||||
// 양쪽 공백 없애기
|
||||
// 필수 (선택 혹은 입력)입니다.
|
||||
// 전화번호 형식이 올바르지 않습니다. 하이픈(-)을 포함하여 입력하세요.
|
||||
// 이메일주소 형식이 아닙니다.
|
||||
// 한글이 아닙니다. (자음, 모음만 있는 한글은 처리하지 않습니다.)
|
||||
// 한글이 아닙니다.
|
||||
// 한글, 영문, 숫자가 아닙니다.
|
||||
// 한글, 영문이 아닙니다.
|
||||
// 숫자가 아닙니다.
|
||||
// 영문이 아닙니다.
|
||||
// 영문 또는 숫자가 아닙니다.
|
||||
// 영문, 숫자, _ 가 아닙니다.
|
||||
// 최소 글자 이상 입력하세요.
|
||||
// 이미지 파일이 아닙니다..gif .jpg .png 파일만 가능합니다.
|
||||
// 파일만 가능합니다.
|
||||
// 공백이 없어야 합니다.
|
||||
|
||||
$msg2 = str_replace("\\n", "<br>", $msg);
|
||||
|
||||
if (!$url) $url = $_SERVER['HTTP_REFERER'];
|
||||
|
||||
if($error) {
|
||||
$header2 = "다음 항목에 오류가 있습니다.";
|
||||
} else {
|
||||
$header2 = "다음 내용을 확인해 주세요.";
|
||||
}
|
||||
?>
|
||||
|
||||
<script>
|
||||
alert("<?php echo strip_tags($msg); ?>");
|
||||
//document.location.href = "<?php echo $url; ?>";
|
||||
<?php if ($url) { ?>
|
||||
document.location.replace("<?php echo $url; ?>");
|
||||
<?php } else { ?>
|
||||
//alert('history.back();');
|
||||
history.back();
|
||||
<?php } ?>
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="validation_check">
|
||||
<h1><?php echo $header2 ?></h1>
|
||||
<p class="cbg">
|
||||
<?php echo $msg2 ?>
|
||||
</p>
|
||||
<?php if($post) { ?>
|
||||
<form method="post" action="<?php echo $url ?>">
|
||||
<?php
|
||||
foreach($_POST as $key => $value) {
|
||||
if(strlen($value) < 1)
|
||||
continue;
|
||||
|
||||
if(preg_match("/pass|pwd|capt|url/", $key))
|
||||
continue;
|
||||
?>
|
||||
<input type="hidden" name="<?php echo $key ?>" value="<?php echo $value ?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="submit" value="돌아가기">
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
<div class="btn_confirm">
|
||||
<a href="<?php echo $url ?>">돌아가기</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php /*
|
||||
<article id="validation_check">
|
||||
<header>
|
||||
<hgroup>
|
||||
<!-- <h1>회원가입 정보 입력 확인</h1> --> <!-- 수행 중이던 작업 내용 -->
|
||||
<h1><?php echo $header ?></h1> <!-- 수행 중이던 작업 내용 -->
|
||||
<h2><?php echo $header2 ?></h2>
|
||||
</hgroup>
|
||||
</header>
|
||||
<p>
|
||||
<!-- <strong>항목</strong> 오류내역 -->
|
||||
<!--
|
||||
<strong>이름</strong> 필수 입력입니다. 한글만 입력할 수 있습니다.<br>
|
||||
<strong>이메일</strong> 올바르게 입력하지 않았습니다.<br>
|
||||
-->
|
||||
<?php echo $msg2 ?>
|
||||
</p>
|
||||
|
||||
<a href="<?php echo $url ?>">돌아가기</a>
|
||||
</article>
|
||||
*/ ?>
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
61
bbs/alert_close.php
Normal file
61
bbs/alert_close.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$msg2 = str_replace("\\n", "<br>", $msg);
|
||||
|
||||
if($error) {
|
||||
$header2 = "다음 항목에 오류가 있습니다.";
|
||||
$msg3 = "새창을 닫으시고 이전 작업을 다시 시도해 주세요.";
|
||||
} else {
|
||||
$header2 = "다음 내용을 확인해 주세요.";
|
||||
$msg3 = "새창을 닫으신 후 서비스를 이용해 주세요.";
|
||||
}
|
||||
?>
|
||||
|
||||
<script>
|
||||
alert("<?php echo $msg; ?>");
|
||||
window.close();
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="validation_check">
|
||||
<h1><?php echo $header2 ?></h1>
|
||||
<p class="cbg">
|
||||
<?php echo $msg2 ?>
|
||||
</p>
|
||||
<p class="cbg">
|
||||
<?php echo $msg3 ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php /*
|
||||
<article id="validation_check">
|
||||
<header>
|
||||
<hgroup>
|
||||
<!-- <h1>회원가입 정보 입력 확인</h1> --> <!-- 수행 중이던 작업 내용 -->
|
||||
<h1><?php echo $header ?></h1> <!-- 수행 중이던 작업 내용 -->
|
||||
<h2><?php echo $header2 ?></h2>
|
||||
</hgroup>
|
||||
</header>
|
||||
<p>
|
||||
<!-- <strong>항목</strong> 오류내역 -->
|
||||
<!--
|
||||
<strong>이름</strong> 필수 입력입니다. 한글만 입력할 수 있습니다.<br>
|
||||
<strong>이메일</strong> 올바르게 입력하지 않았습니다.<br>
|
||||
-->
|
||||
<?php echo $msg2 ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php echo $msg3 ?>
|
||||
</p>
|
||||
|
||||
</article>
|
||||
*/ ?>
|
||||
|
||||
</noscript>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
242
bbs/board.php
Normal file
242
bbs/board.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$board['bo_table']) {
|
||||
alert('존재하지 않는 게시판입니다.', G5_URL);
|
||||
}
|
||||
|
||||
check_device($board['bo_device']);
|
||||
|
||||
if (isset($write['wr_is_comment']) && $write['wr_is_comment']) {
|
||||
goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$write['wr_parent'].'#c_'.$wr_id);
|
||||
}
|
||||
|
||||
if (!$bo_table) {
|
||||
$msg = "bo_table 값이 넘어오지 않았습니다.\\n\\nboard.php?bo_table=code 와 같은 방식으로 넘겨 주세요.";
|
||||
alert($msg);
|
||||
}
|
||||
|
||||
// wr_id 값이 있으면 글읽기
|
||||
if (isset($wr_id) && $wr_id) {
|
||||
// 글이 없을 경우 해당 게시판 목록으로 이동
|
||||
if (!$write['wr_id']) {
|
||||
$msg = '글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니다.';
|
||||
alert($msg, './board.php?bo_table='.$bo_table);
|
||||
}
|
||||
|
||||
// 그룹접근 사용
|
||||
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.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr));
|
||||
}
|
||||
|
||||
// 그룹관리자 이상이라면 통과
|
||||
if ($is_admin == "super" || $is_admin == "group") {
|
||||
;
|
||||
} else {
|
||||
// 그룹접근
|
||||
$sql = " select count(*) as cnt from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['cnt']) {
|
||||
alert("접근 권한이 없으므로 글읽기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.", G5_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면
|
||||
if ($member['mb_level'] < $board['bo_read_level']) {
|
||||
if ($is_member)
|
||||
alert('글을 읽을 권한이 없습니다.', G5_URL);
|
||||
else
|
||||
alert('글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr));
|
||||
}
|
||||
|
||||
// 본인확인을 사용한다면
|
||||
if ($config['cf_cert_use'] && !$is_admin) {
|
||||
// 인증된 회원만 가능
|
||||
if ($board['bo_use_cert'] != '' && $is_guest) {
|
||||
alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr));
|
||||
}
|
||||
|
||||
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'] == '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 (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin) {
|
||||
;
|
||||
} else {
|
||||
// 비밀글이라면
|
||||
if (strstr($write['wr_option'], "secret"))
|
||||
{
|
||||
// 회원이 비밀글을 올리고 관리자가 답변글을 올렸을 경우
|
||||
// 회원이 관리자가 올린 답변글을 바로 볼 수 없던 오류를 수정
|
||||
$is_owner = false;
|
||||
if ($write['wr_reply'] && $member['mb_id'])
|
||||
{
|
||||
$sql = " select mb_id from {$write_table}
|
||||
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'])
|
||||
$is_owner = true;
|
||||
}
|
||||
|
||||
$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 (!get_session($ss_name))
|
||||
goto_url('./password.php?w=s&bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr);
|
||||
}
|
||||
|
||||
set_session($ss_name, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음
|
||||
$ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;
|
||||
if (!get_session($ss_name))
|
||||
{
|
||||
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']) {
|
||||
;
|
||||
} else if ($is_guest && $board['bo_read_level'] == 1 && $write['wr_ip'] == $_SERVER['REMOTE_ADDR']) {
|
||||
// 비회원이면서 읽기레벨이 1이고 등록된 아이피가 같다면 자신의 글이므로 통과
|
||||
;
|
||||
} else {
|
||||
// 글읽기 포인트가 설정되어 있다면
|
||||
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']).')가 불가합니다.\\n\\n포인트를 모으신 후 다시 글읽기 해 주십시오.');
|
||||
|
||||
insert_point($member['mb_id'], $board['bo_read_point'], "{$board['bo_subject']} {$wr_id} 글읽기", $bo_table, $wr_id, '읽기');
|
||||
}
|
||||
|
||||
set_session($ss_name, TRUE);
|
||||
}
|
||||
|
||||
$g5['title'] = strip_tags(conv_subject($write['wr_subject'], 255))." > ".$board['bo_subject'];
|
||||
} else {
|
||||
if ($member['mb_level'] < $board['bo_list_level']) {
|
||||
if ($member['mb_id'])
|
||||
alert('목록을 볼 권한이 없습니다.', G5_URL);
|
||||
else
|
||||
alert('목록을 볼 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.($qstr?'&':'')));
|
||||
}
|
||||
|
||||
// 본인확인을 사용한다면
|
||||
if ($config['cf_cert_use'] && !$is_admin) {
|
||||
// 인증된 회원만 가능
|
||||
if ($board['bo_use_cert'] != '' && $is_guest) {
|
||||
alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr));
|
||||
}
|
||||
|
||||
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'] == '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 (!isset($page) || (isset($page) && $page == 0)) $page = 1;
|
||||
|
||||
$g5['title'] = $board['bo_subject']." ".$page." 페이지";
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$width = $board['bo_table_width'];
|
||||
if ($width <= 100)
|
||||
$width .= '%';
|
||||
else
|
||||
$width .='px';
|
||||
|
||||
// IP보이기 사용 여부
|
||||
$ip = "";
|
||||
$is_ip_view = $board['bo_use_ip_view'];
|
||||
if ($is_admin) {
|
||||
$is_ip_view = true;
|
||||
if (array_key_exists('wr_ip', $write)) {
|
||||
$ip = $write['wr_ip'];
|
||||
}
|
||||
} else {
|
||||
// 관리자가 아니라면 IP 주소를 감춘후 보여줍니다.
|
||||
if (isset($write['wr_ip'])) {
|
||||
$ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $write['wr_ip']);
|
||||
}
|
||||
}
|
||||
|
||||
// 분류 사용
|
||||
$is_category = false;
|
||||
$category_name = '';
|
||||
if ($board['bo_use_category']) {
|
||||
$is_category = true;
|
||||
if (array_key_exists('ca_name', $write)) {
|
||||
$category_name = $write['ca_name']; // 분류명
|
||||
}
|
||||
}
|
||||
|
||||
// 추천 사용
|
||||
$is_good = false;
|
||||
if ($board['bo_use_good'])
|
||||
$is_good = true;
|
||||
|
||||
// 비추천 사용
|
||||
$is_nogood = false;
|
||||
if ($board['bo_use_nogood'])
|
||||
$is_nogood = true;
|
||||
|
||||
$admin_href = "";
|
||||
// 최고관리자 또는 그룹관리자라면
|
||||
if ($member['mb_id'] && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id']))
|
||||
$admin_href = G5_ADMIN_URL.'/board_form.php?w=u&bo_table='.$bo_table;
|
||||
|
||||
include_once('./board_head.php');
|
||||
|
||||
// 게시물 아이디가 있다면 게시물 보기를 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');
|
||||
|
||||
echo "\n<!-- 사용스킨 : {$board_skin_url} -->\n";
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
13
bbs/board_head.php
Normal file
13
bbs/board_head.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 게시판 관리의 상단 내용
|
||||
if (G5_IS_MOBILE) {
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
include_once('./_head.php');
|
||||
echo stripslashes($board['bo_mobile_content_head']);
|
||||
} else {
|
||||
@include ($board['bo_include_head']);
|
||||
echo stripslashes($board['bo_content_head']);
|
||||
}
|
||||
?>
|
||||
21
bbs/board_list_update.php
Normal file
21
bbs/board_list_update.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$count = count($_POST['chk_wr_id']);
|
||||
|
||||
if(!$count) {
|
||||
alert($_POST['btn_submit'].' 하실 항목을 하나 이상 선택하세요.');
|
||||
}
|
||||
|
||||
if($_POST['btn_submit'] == '선택삭제') {
|
||||
include './delete_all.php';
|
||||
} else if($_POST['btn_submit'] == '선택복사') {
|
||||
$sw = 'copy';
|
||||
include './move.php';
|
||||
} else if($_POST['btn_submit'] == '선택이동') {
|
||||
$sw = 'move';
|
||||
include './move.php';
|
||||
} else {
|
||||
alert('올바른 방법으로 이용해 주세요.');
|
||||
}
|
||||
?>
|
||||
13
bbs/board_tail.php
Normal file
13
bbs/board_tail.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 게시판 관리의 하단 파일 경로
|
||||
if (G5_IS_MOBILE) {
|
||||
echo stripslashes($board['bo_mobile_content_tail']);
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
include_once('./_tail.php');
|
||||
} else {
|
||||
echo stripslashes($board['bo_content_tail']);
|
||||
@include ($board['bo_include_tail']);
|
||||
}
|
||||
?>
|
||||
35
bbs/confirm.php
Normal file
35
bbs/confirm.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<script>
|
||||
var conf = "<?php echo strip_tags($msg); ?>";
|
||||
if (confirm(conf)) {
|
||||
document.location.replace("<?php echo $url1; ?>");
|
||||
} else {
|
||||
document.location.replace("<?php echo $url2; ?>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<article id="confirm_check">
|
||||
<header>
|
||||
<hgroup>
|
||||
<h1><?php echo $header; ?></h1> <!-- 수행 중이던 작업 내용 -->
|
||||
<h2>아래 내용을 확인해 주세요.</h2>
|
||||
</hgroup>
|
||||
</header>
|
||||
<p>
|
||||
<?php echo $msg; ?>
|
||||
</p>
|
||||
|
||||
<a href="<?php echo $url1; ?>">확인</a>
|
||||
<a href="<?php echo $url2; ?>">취소</a><br><br>
|
||||
<a href="<?php echo $url3; ?>">돌아가기</a>
|
||||
</article>
|
||||
</noscript>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
99
bbs/content.php
Normal file
99
bbs/content.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
//dbconfig파일에 $g5['content_table'] 배열변수가 있는지 체크
|
||||
if( !isset($g5['content_table']) ){
|
||||
die('<meta charset="utf-8">관리자 모드에서 게시판관리->내용 관리를 먼저 확인해 주세요.');
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MOBILE_PATH.'/content.php');
|
||||
return;
|
||||
}
|
||||
|
||||
// 내용
|
||||
$sql = " select * from {$g5['content_table']} where co_id = '$co_id' ";
|
||||
$co = sql_fetch($sql);
|
||||
if (!$co['co_id'])
|
||||
alert('등록된 내용이 없습니다.');
|
||||
|
||||
$g5['title'] = $co['co_subject'];
|
||||
|
||||
if ($co['co_include_head'])
|
||||
@include_once($co['co_include_head']);
|
||||
else
|
||||
include_once('./_head.php');
|
||||
|
||||
$str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']);
|
||||
|
||||
// $src 를 $dst 로 변환
|
||||
unset($src);
|
||||
unset($dst);
|
||||
$src[] = "/{{쇼핑몰명}}|{{홈페이지제목}}/";
|
||||
//$dst[] = $default[de_subject];
|
||||
$dst[] = $config['cf_title'];
|
||||
$src[] = "/{{회사명}}|{{상호}}/";
|
||||
$dst[] = $default['de_admin_company_name'];
|
||||
$src[] = "/{{대표자명}}/";
|
||||
$dst[] = $default['de_admin_company_owner'];
|
||||
$src[] = "/{{사업자등록번호}}/";
|
||||
$dst[] = $default['de_admin_company_saupja_no'];
|
||||
$src[] = "/{{대표전화번호}}/";
|
||||
$dst[] = $default['de_admin_company_tel'];
|
||||
$src[] = "/{{팩스번호}}/";
|
||||
$dst[] = $default['de_admin_company_fax'];
|
||||
$src[] = "/{{통신판매업신고번호}}/";
|
||||
$dst[] = $default['de_admin_company_tongsin_no'];
|
||||
$src[] = "/{{사업장우편번호}}/";
|
||||
$dst[] = $default['de_admin_company_zip'];
|
||||
$src[] = "/{{사업장주소}}/";
|
||||
$dst[] = $default['de_admin_company_addr'];
|
||||
$src[] = "/{{운영자명}}|{{관리자명}}/";
|
||||
$dst[] = $default['de_admin_name'];
|
||||
$src[] = "/{{운영자e-mail}}|{{관리자e-mail}}/i";
|
||||
$dst[] = $default['de_admin_email'];
|
||||
$src[] = "/{{정보관리책임자명}}/";
|
||||
$dst[] = $default['de_admin_info_name'];
|
||||
$src[] = "/{{정보관리책임자e-mail}}|{{정보책임자e-mail}}/i";
|
||||
$dst[] = $default['de_admin_info_email'];
|
||||
|
||||
$str = preg_replace($src, $dst, $str);
|
||||
|
||||
if ($is_admin)
|
||||
echo '<div class="ctt_admin"><a href="'.G5_ADMIN_URL.'/contentform.php?w=u&co_id='.$co_id.'" class="btn_admin">내용 수정</a></div>';
|
||||
?>
|
||||
|
||||
<!-- 등록내용 시작 { -->
|
||||
<?php
|
||||
$himg = G5_DATA_PATH.'/content/'.$co_id.'_h';
|
||||
if (file_exists($himg)) // 상단 이미지
|
||||
echo '<div id="ctt_himg" class="ctt_img"><img src="'.G5_DATA_URL.'/content/'.$co_id.'_h" alt=""></div>';
|
||||
?>
|
||||
|
||||
<article id="ctt" class="ctt_<?php echo $co_id; ?>">
|
||||
<header>
|
||||
<h1><?php echo $g5['title']; ?></h1>
|
||||
</header>
|
||||
|
||||
<div id="ctt_con">
|
||||
<?php echo $str; ?>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
<?php
|
||||
$timg = G5_DATA_PATH.'/content/'.$co_id.'_t';
|
||||
if (file_exists($timg)) // 하단 이미지
|
||||
echo '<div id="ctt_timg" class="ctt_img"><img src="'.G5_DATA_URL.'/content/'.$co_id.'_t" alt=""></div>';
|
||||
|
||||
if ($is_admin)
|
||||
echo '<div class="ctt_admin"><a href="'.G5_ADMIN_URL.'/contentform.php?w=u&co_id='.$co_id.'" class="btn_admin">내용 수정</a></div>';
|
||||
?>
|
||||
<!-- } 등록내용 끝 -->
|
||||
|
||||
<?php
|
||||
if ($co['co_include_tail'])
|
||||
@include_once($co['co_include_tail']);
|
||||
else
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
32
bbs/current_connect.php
Normal file
32
bbs/current_connect.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = '현재접속자';
|
||||
include_once('./_head.php');
|
||||
|
||||
$list = array();
|
||||
|
||||
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
|
||||
from {$g5['login_table']} a left join {$g5['member_table']} b on (a.mb_id = b.mb_id)
|
||||
where a.mb_id <> '{$config['cf_admin']}'
|
||||
order by a.lo_datetime desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$list[$i] = $row;
|
||||
|
||||
if ($row['mb_id']) {
|
||||
$list[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['mb_nick'], $config['cf_cut_name']), $row['mb_email'], $row['mb_homepage']);
|
||||
} else {
|
||||
if ($is_admin)
|
||||
$list[$i]['name'] = $row['lo_ip'];
|
||||
else
|
||||
$list[$i]['name'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['lo_ip']);
|
||||
}
|
||||
|
||||
$list[$i]['num'] = sprintf('%03d',$i+1);
|
||||
}
|
||||
|
||||
include_once($connect_skin_path.'/current_connect.skin.php');
|
||||
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
57
bbs/db_table.optimize.php
Normal file
57
bbs/db_table.optimize.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 최고관리자일 때만 실행
|
||||
if($config['cf_admin'] != $member['mb_id'] || $is_admin != 'super')
|
||||
return;
|
||||
|
||||
// 실행일 비교
|
||||
if(isset($config['cf_optimize_date']) && $config['cf_optimize_date'] >= G5_TIME_YMD)
|
||||
return;
|
||||
|
||||
// 설정일이 지난 접속자로그 삭제
|
||||
if($config['cf_visit_del'] > 0) {
|
||||
$tmp_before_date = date("Y-m-d", G5_SERVER_TIME - ($config['cf_visit_del'] * 86400));
|
||||
$sql = " delete from {$g5['visit_table']} where vi_date < '$tmp_before_date' ";
|
||||
sql_query($sql);
|
||||
sql_query(" OPTIMIZE TABLE `{$g5['visit_table']}`, `{$g5['visit_sum_table']}` ");
|
||||
}
|
||||
|
||||
// 설정일이 지난 인기검색어 삭제
|
||||
if($config['cf_popular_del'] > 0) {
|
||||
$tmp_before_date = date("Y-m-d", G5_SERVER_TIME - ($config['cf_popular_del'] * 86400));
|
||||
$sql = " delete from {$g5['popular_table']} where pp_date < '$tmp_before_date' ";
|
||||
sql_query($sql);
|
||||
sql_query(" OPTIMIZE TABLE `{$g5['popular_table']}` ");
|
||||
}
|
||||
|
||||
// 설정일이 지난 최근게시물 삭제
|
||||
if($config['cf_new_del'] > 0) {
|
||||
$sql = " delete from {$g5['board_new_table']} where (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS(bn_datetime)) > '{$config['cf_new_del']}' ";
|
||||
sql_query($sql);
|
||||
sql_query(" OPTIMIZE TABLE `{$g5['board_new_table']}` ");
|
||||
}
|
||||
|
||||
// 설정일이 지난 쪽지 삭제
|
||||
if($config['cf_memo_del'] > 0) {
|
||||
$sql = " delete from {$g5['memo_table']} where (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS(me_send_datetime)) > '{$config['cf_memo_del']}' ";
|
||||
sql_query($sql);
|
||||
sql_query(" OPTIMIZE TABLE `{$g5['memo_table']}` ");
|
||||
}
|
||||
|
||||
// 탈퇴회원 자동 삭제
|
||||
if($config['cf_leave_day'] > 0) {
|
||||
$sql = " select mb_id from {$g5['member_table']} where (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS(mb_leave_date)) > '{$config['cf_leave_day']}' ";
|
||||
$result = sql_query($sql);
|
||||
while ($row=sql_fetch_array($result))
|
||||
{
|
||||
// 회원자료 삭제
|
||||
member_delete($row['mb_id']);
|
||||
}
|
||||
}
|
||||
|
||||
// 실행일 기록
|
||||
if(isset($config['cf_optimize_date'])) {
|
||||
sql_query(" update {$g5['config_table']} set cf_optimize_date = '".G5_TIME_YMD."' ");
|
||||
}
|
||||
?>
|
||||
142
bbs/delete.php
Normal file
142
bbs/delete.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_admin)
|
||||
{
|
||||
if (!($token && get_session('ss_delete_token') == $token))
|
||||
alert('토큰 에러로 삭제 불가합니다.');
|
||||
}
|
||||
|
||||
//$wr = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
|
||||
|
||||
@include_once($board_skin_path.'/delete.head.skin.php');
|
||||
|
||||
if ($is_admin == 'super') // 최고관리자 통과
|
||||
;
|
||||
else if ($is_admin == 'group') { // 그룹관리자
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가?
|
||||
alert('자신이 관리하는 그룹의 게시판이 아니므로 삭제할 수 없습니다.');
|
||||
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']) // 자신이 관리하는 게시판인가?
|
||||
alert('자신이 관리하는 게시판이 아니므로 삭제할 수 없습니다.');
|
||||
else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 삭제할 수 없습니다.');
|
||||
} else if ($member['mb_id']) {
|
||||
if ($member['mb_id'] != $write['mb_id'])
|
||||
alert('자신의 글이 아니므로 삭제할 수 없습니다.');
|
||||
} else {
|
||||
if ($write['mb_id'])
|
||||
alert('로그인 후 삭제하세요.', './login.php?url='.urlencode('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id));
|
||||
else if (sql_password($wr_password) != $write['wr_password'])
|
||||
alert('비밀번호가 틀리므로 삭제할 수 없습니다.');
|
||||
}
|
||||
|
||||
$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
|
||||
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우선 답변글부터 삭제하여 주십시오.');
|
||||
|
||||
// 코멘트 달린 원글의 삭제 여부
|
||||
$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 ($row['cnt'] >= $board['bo_count_delete'] && !$is_admin)
|
||||
alert('이 글과 관련된 코멘트가 존재하므로 삭제 할 수 없습니다.\\n\\n코멘트가 '.$board['bo_count_delete'].'건 이상 달린 원글은 삭제할 수 없습니다.');
|
||||
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($board_skin_path.'/delete.skin.php');
|
||||
|
||||
|
||||
// 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다.
|
||||
//$sql = " select wr_id, mb_id, wr_comment from $write_table where wr_parent = '$write[wr_id]' order by wr_id ";
|
||||
$sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id ";
|
||||
$result = sql_query($sql);
|
||||
while ($row = sql_fetch_array($result))
|
||||
{
|
||||
// 원글이라면
|
||||
if (!$row['wr_is_comment'])
|
||||
{
|
||||
// 원글 포인트 삭제
|
||||
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기'))
|
||||
insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글삭제");
|
||||
|
||||
// 업로드된 파일이 있다면 파일삭제
|
||||
$sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ";
|
||||
$result2 = sql_query($sql2);
|
||||
while ($row2 = sql_fetch_array($result2)) {
|
||||
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);
|
||||
// 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) {
|
||||
delete_board_thumbnail($bo_table, $row2['bf_file']);
|
||||
}
|
||||
}
|
||||
|
||||
// 에디터 썸네일 삭제
|
||||
delete_editor_thumbnail($row['wr_content']);
|
||||
|
||||
// 파일테이블 행 삭제
|
||||
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
|
||||
|
||||
// syndication ping
|
||||
if(G5_SYNDI_USE)
|
||||
include G5_SYNDI_PATH.'/include/include.bbs.delete.php';
|
||||
|
||||
$count_write++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 코멘트 포인트 삭제
|
||||
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글'))
|
||||
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제");
|
||||
|
||||
$count_comment++;
|
||||
}
|
||||
}
|
||||
|
||||
// 게시글 삭제
|
||||
sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' ");
|
||||
|
||||
// 최근게시물 삭제
|
||||
sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' ");
|
||||
|
||||
// 스크랩 삭제
|
||||
sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' ");
|
||||
|
||||
/*
|
||||
// 공지사항 삭제
|
||||
$notice_array = explode("\n", trim($board['bo_notice']));
|
||||
$bo_notice = "";
|
||||
for ($k=0; $k<count($notice_array); $k++)
|
||||
if ((int)$write[wr_id] != (int)$notice_array[$k])
|
||||
$bo_notice .= $notice_array[$k] . "\n";
|
||||
$bo_notice = trim($bo_notice);
|
||||
*/
|
||||
$bo_notice = board_notice($board['bo_notice'], $write['wr_id']);
|
||||
sql_query(" update {$g5['board_table']} set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
|
||||
|
||||
// 글숫자 감소
|
||||
if ($count_write > 0 || $count_comment > 0)
|
||||
sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");
|
||||
|
||||
@include_once($board_skin_path.'/delete.tail.skin.php');
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
goto_url('./board.php?bo_table='.$bo_table.'&page='.$page.$qstr);
|
||||
?>
|
||||
158
bbs/delete_all.php
Normal file
158
bbs/delete_all.php
Normal file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 4.11
|
||||
@include_once($board_skin_path.'/delete_all.head.skin.php');
|
||||
|
||||
$count_write = 0;
|
||||
$count_comment = 0;
|
||||
|
||||
$tmp_array = array();
|
||||
if ($wr_id) // 건별삭제
|
||||
$tmp_array[0] = $wr_id;
|
||||
else // 일괄삭제
|
||||
$tmp_array = $_POST['chk_wr_id'];
|
||||
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($board_skin_path.'/delete_all.skin.php');
|
||||
|
||||
|
||||
// 거꾸로 읽는 이유는 답변글부터 삭제가 되어야 하기 때문임
|
||||
for ($i=count($tmp_array)-1; $i>=0; $i--)
|
||||
{
|
||||
$write = sql_fetch(" select * from $write_table where wr_id = '$tmp_array[$i]' ");
|
||||
|
||||
if ($is_admin == 'super') // 최고관리자 통과
|
||||
;
|
||||
else if ($is_admin == 'group') // 그룹관리자
|
||||
{
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] == $group['gr_admin']) // 자신이 관리하는 그룹인가?
|
||||
{
|
||||
if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if ($is_admin == 'board') // 게시판관리자이면
|
||||
{
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] == $board['bo_admin']) // 자신이 관리하는 게시판인가?
|
||||
if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
;
|
||||
else
|
||||
continue;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if ($member['mb_id'] && $member['mb_id'] == $write['mb_id']) // 자신의 글이라면
|
||||
{
|
||||
;
|
||||
}
|
||||
else if ($wr_password && !$write['mb_id'] && sql_password($wr_password) == $write['wr_password']) // 비밀번호가 같다면
|
||||
{
|
||||
;
|
||||
}
|
||||
else
|
||||
continue; // 나머지는 삭제 불가
|
||||
|
||||
$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
|
||||
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'])
|
||||
continue;
|
||||
|
||||
// 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다.
|
||||
//$sql = " select wr_id, mb_id, wr_comment from {$write_table} where wr_parent = '{$write[wr_id]}' order by wr_id ";
|
||||
$sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id ";
|
||||
$result = sql_query($sql);
|
||||
while ($row = sql_fetch_array($result))
|
||||
{
|
||||
// 원글이라면
|
||||
if (!$row['wr_is_comment'])
|
||||
{
|
||||
// 원글 포인트 삭제
|
||||
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기'))
|
||||
insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글 삭제");
|
||||
|
||||
// 업로드된 파일이 있다면
|
||||
$sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ";
|
||||
$result2 = sql_query($sql2);
|
||||
while ($row2 = sql_fetch_array($result2)) {
|
||||
// 파일삭제
|
||||
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);
|
||||
|
||||
// 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) {
|
||||
delete_board_thumbnail($bo_table, $row2['bf_file']);
|
||||
}
|
||||
}
|
||||
|
||||
// 에디터 썸네일 삭제
|
||||
delete_editor_thumbnail($row['wr_content']);
|
||||
|
||||
// 파일테이블 행 삭제
|
||||
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
|
||||
|
||||
// syndication ping
|
||||
if(G5_SYNDI_USE)
|
||||
include G5_SYNDI_PATH.'/include/include.bbs.delete_all.php';
|
||||
|
||||
$count_write++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 코멘트 포인트 삭제
|
||||
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글'))
|
||||
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제");
|
||||
|
||||
$count_comment++;
|
||||
}
|
||||
}
|
||||
|
||||
// 게시글 삭제
|
||||
sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' ");
|
||||
|
||||
// 최근게시물 삭제
|
||||
sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' ");
|
||||
|
||||
// 스크랩 삭제
|
||||
sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' ");
|
||||
|
||||
/*
|
||||
// 공지사항 삭제
|
||||
$notice_array = explode(',', trim($board['bo_notice']));
|
||||
$bo_notice = "";
|
||||
for ($k=0; $k<count($notice_array); $k++)
|
||||
if ((int)$write['wr_id'] != (int)$notice_array[$k])
|
||||
$bo_notice .= $notice_array[$k].',';
|
||||
$bo_notice = trim($bo_notice);
|
||||
*/
|
||||
$bo_notice = board_notice($board['bo_notice'], $write['wr_id']);
|
||||
sql_query(" update {$g5['board_table']} set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
|
||||
$board['bo_notice'] = $bo_notice;
|
||||
}
|
||||
|
||||
// 글숫자 감소
|
||||
if ($count_write > 0 || $count_comment > 0)
|
||||
sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");
|
||||
|
||||
// 4.11
|
||||
@include_once($board_skin_path.'/delete_all.tail.skin.php');
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
goto_url('./board.php?bo_table='.$bo_table.'&page='.$page.$qstr);
|
||||
?>
|
||||
88
bbs/delete_comment.php
Normal file
88
bbs/delete_comment.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
// 코멘트 삭제
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_admin)
|
||||
{
|
||||
if (!($token && get_session("ss_delete_token") == $token))
|
||||
alert('토큰 에러로 삭제 불가합니다.');
|
||||
}
|
||||
|
||||
// 4.1
|
||||
@include_once($board_skin_path.'/delete_comment.head.skin.php');
|
||||
|
||||
$write = sql_fetch(" select * from {$write_table} where wr_id = '{$comment_id}' ");
|
||||
|
||||
if (!$write['wr_id'] || !$write['wr_is_comment'])
|
||||
alert('등록된 코멘트가 없거나 코멘트 글이 아닙니다.');
|
||||
|
||||
if ($is_admin == 'super') // 최고관리자 통과
|
||||
;
|
||||
else if ($is_admin == 'group') { // 그룹관리자
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] == $group['gr_admin']) { // 자신이 관리하는 그룹인가?
|
||||
if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
;
|
||||
else
|
||||
alert('그룹관리자의 권한보다 높은 회원의 코멘트이므로 삭제할 수 없습니다.');
|
||||
} else
|
||||
alert('자신이 관리하는 그룹의 게시판이 아니므로 코멘트를 삭제할 수 없습니다.');
|
||||
} else if ($is_admin == 'board') { // 게시판관리자이면
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가?
|
||||
if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
;
|
||||
else
|
||||
alert('게시판관리자의 권한보다 높은 회원의 코멘트이므로 삭제할 수 없습니다.');
|
||||
} else
|
||||
alert('자신이 관리하는 게시판이 아니므로 코멘트를 삭제할 수 없습니다.');
|
||||
} else if ($member['mb_id']) {
|
||||
if ($member['mb_id'] != $write['mb_id'])
|
||||
alert('자신의 글이 아니므로 삭제할 수 없습니다.');
|
||||
} else {
|
||||
if (sql_password($wr_password) != $write['wr_password'])
|
||||
alert('비밀번호가 틀립니다.');
|
||||
}
|
||||
|
||||
$len = strlen($write['wr_comment_reply']);
|
||||
if ($len < 0) $len = 0;
|
||||
$comment_reply = substr($write['wr_comment_reply'], 0, $len);
|
||||
|
||||
$sql = " select count(*) as cnt from {$write_table}
|
||||
where wr_comment_reply like '{$comment_reply}%'
|
||||
and wr_id <> '{$comment_id}'
|
||||
and wr_parent = '{$write[wr_parent]}'
|
||||
and wr_comment = '{$write[wr_comment]}'
|
||||
and wr_is_comment = 1 ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt'] && !$is_admin)
|
||||
alert('이 코멘트와 관련된 답변코멘트가 존재하므로 삭제 할 수 없습니다.');
|
||||
|
||||
// 코멘트 포인트 삭제
|
||||
if (!delete_point($write['mb_id'], $bo_table, $comment_id, '댓글'))
|
||||
insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 댓글삭제");
|
||||
|
||||
// 코멘트 삭제
|
||||
sql_query(" delete from {$write_table} where wr_id = '{$comment_id}' ");
|
||||
|
||||
// 코멘트가 삭제되므로 해당 게시물에 대한 최근 시간을 다시 얻는다.
|
||||
$sql = " select max(wr_datetime) as wr_last from {$write_table} where wr_parent = '{$write['wr_parent']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
// 원글의 코멘트 숫자를 감소
|
||||
sql_query(" update {$write_table} set wr_comment = wr_comment - 1, wr_last = '{$row['wr_last']}' where wr_id = '{$write['wr_parent']}' ");
|
||||
|
||||
// 코멘트 숫자 감소
|
||||
sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment - 1 where bo_table = '{$bo_table}' ");
|
||||
|
||||
// 새글 삭제
|
||||
sql_query(" delete from {$g5['board_new_table']} where bo_table = '{$bo_table}' and wr_id = '{$comment_id}' ");
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($board_skin_path.'/delete_comment.skin.php');
|
||||
@include_once($board_skin_path.'/delete_comment.tail.skin.php');
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$write['wr_parent'].'&page='.$page. $qstr);
|
||||
?>
|
||||
121
bbs/download.php
Normal file
121
bbs/download.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// clean the output buffer
|
||||
ob_end_clean();
|
||||
|
||||
$no = (int)$no;
|
||||
|
||||
@include_once($board_skin_path.'/download.head.skin.php');
|
||||
|
||||
// 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생
|
||||
// 다른곳에서 링크 거는것을 방지하기 위한 코드
|
||||
if (!get_session('ss_view_'.$bo_table.'_'.$wr_id))
|
||||
alert('잘못된 접근입니다.');
|
||||
|
||||
// 다운로드 차감일 때 비회원은 다운로드 불가
|
||||
if($board['bo_download_point'] < 0 && $is_guest)
|
||||
alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.'&'.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id));
|
||||
|
||||
$sql = " select bf_source, bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' ";
|
||||
$file = sql_fetch($sql);
|
||||
if (!$file['bf_file'])
|
||||
alert_close('파일 정보가 존재하지 않습니다.');
|
||||
|
||||
// JavaScript 불가일 때
|
||||
if($js != 'on' && $board['bo_download_point'] < 0) {
|
||||
$msg = $file['bf_source'].' 파일을 다운로드 하시면 포인트가 차감('.number_format($board['bo_download_point']).'점)됩니다.\\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\\n그래도 다운로드 하시겠습니까?';
|
||||
$url1 = G5_BBS_URL.'/download.php?'.$_SERVER['QUERY_STRING'].'&js=on';
|
||||
$url2 = $_SERVER['HTTP_REFERER'];
|
||||
|
||||
//$url1 = 확인link, $url2=취소link
|
||||
// 특정주소로 이동시키려면 $url3 이용
|
||||
confirm($msg, $url1, $url2);
|
||||
}
|
||||
|
||||
if ($member['mb_level'] < $board['bo_download_level']) {
|
||||
$alert_msg = '다운로드 권한이 없습니다.';
|
||||
if ($member['mb_id'])
|
||||
alert($alert_msg);
|
||||
else
|
||||
alert($alert_msg.'\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.'&'.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id));
|
||||
}
|
||||
|
||||
$filepath = G5_DATA_PATH.'/file/'.$bo_table.'/'.$file['bf_file'];
|
||||
$filepath = addslashes($filepath);
|
||||
if (!is_file($filepath) || !file_exists($filepath))
|
||||
alert('파일이 존재하지 않습니다.');
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($board_skin_path.'/download.skin.php');
|
||||
|
||||
// 이미 다운로드 받은 파일인지를 검사한 후 게시물당 한번만 포인트를 차감하도록 수정
|
||||
$ss_name = 'ss_down_'.$bo_table.'_'.$wr_id;
|
||||
if (!get_session($ss_name))
|
||||
{
|
||||
// 자신의 글이라면 통과
|
||||
// 관리자인 경우 통과
|
||||
if (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin)
|
||||
;
|
||||
else if ($board['bo_download_level'] >= 1) // 회원이상 다운로드가 가능하다면
|
||||
{
|
||||
// 다운로드 포인트가 음수이고 회원의 포인트가 0 이거나 작다면
|
||||
if ($member['mb_point'] + $board['bo_download_point'] < 0)
|
||||
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 다운로드('.number_format($board['bo_download_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 다운로드 해 주십시오.');
|
||||
|
||||
// 게시물당 한번만 차감하도록 수정
|
||||
insert_point($member['mb_id'], $board['bo_download_point'], "{$board['bo_subject']} $wr_id 파일 다운로드", $bo_table, $wr_id, "다운로드");
|
||||
}
|
||||
|
||||
// 다운로드 카운트 증가
|
||||
$sql = " update {$g5['board_file_table']} set bf_download = bf_download + 1 where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' ";
|
||||
sql_query($sql);
|
||||
|
||||
set_session($ss_name, TRUE);
|
||||
}
|
||||
|
||||
$g5['title'] = '다운로드 > '.conv_subject($write['wr_subject'], 255);
|
||||
|
||||
$original = urlencode($file['bf_source']);
|
||||
|
||||
@include_once($board_skin_path.'/download.tail.skin.php');
|
||||
|
||||
if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
header("content-type: doesn/matter");
|
||||
header("content-length: ".filesize("$filepath"));
|
||||
header("content-disposition: attachment; filename=\"$original\"");
|
||||
header("content-transfer-encoding: binary");
|
||||
} else {
|
||||
header("content-type: file/unknown");
|
||||
header("content-length: ".filesize("$filepath"));
|
||||
header("content-disposition: attachment; filename=\"$original\"");
|
||||
header("content-description: php generated data");
|
||||
}
|
||||
header("pragma: no-cache");
|
||||
header("expires: 0");
|
||||
flush();
|
||||
|
||||
$fp = fopen($filepath, 'rb');
|
||||
|
||||
// 4.00 대체
|
||||
// 서버부하를 줄이려면 print 나 echo 또는 while 문을 이용한 방법보다는 이방법이...
|
||||
//if (!fpassthru($fp)) {
|
||||
// fclose($fp);
|
||||
//}
|
||||
|
||||
$download_rate = 10;
|
||||
|
||||
while(!feof($fp)) {
|
||||
//echo fread($fp, 100*1024);
|
||||
/*
|
||||
echo fread($fp, 100*1024);
|
||||
flush();
|
||||
*/
|
||||
|
||||
print fread($fp, round($download_rate * 1024));
|
||||
flush();
|
||||
usleep(1000);
|
||||
}
|
||||
fclose ($fp);
|
||||
flush();
|
||||
?>
|
||||
21
bbs/email_certify.php
Normal file
21
bbs/email_certify.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$sql = " select mb_id, mb_email, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['mb_id'])
|
||||
alert('존재하는 회원이 아닙니다.', G5_URL);
|
||||
|
||||
if ($mb_md5)
|
||||
{
|
||||
$tmp_md5 = md5($row['mb_id'].$row['mb_email'].$row['mb_datetime']);
|
||||
if ($mb_md5 == $tmp_md5)
|
||||
{
|
||||
sql_query(" update {$g5['member_table']} set mb_email_certify = '".G5_TIME_YMDHIS."' where mb_id = '{$mb_id}' ");
|
||||
|
||||
alert("메일인증 처리를 완료 하였습니다.\\n\\n지금부터 {$mb_id} 아이디로 로그인 가능합니다.", G5_URL);
|
||||
}
|
||||
}
|
||||
|
||||
alert('제대로 된 값이 넘어오지 않았습니다.', G5_URL);
|
||||
?>
|
||||
19
bbs/email_stop.php
Normal file
19
bbs/email_stop.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$sql = " select mb_id, mb_email, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['mb_id'])
|
||||
alert('존재하는 회원이 아닙니다.', G5_URL);
|
||||
|
||||
if ($mb_md5) {
|
||||
$tmp_md5 = md5($row['mb_id'].$row['mb_email'].$row['mb_datetime']);
|
||||
if ($mb_md5 == $tmp_md5) {
|
||||
sql_query(" update {$g5['member_table']} set mb_mailling = 0 where mb_id = '{$mb_id}' ");
|
||||
|
||||
alert('정보메일을 보내지 않도록 수신거부 하였습니다.', G5_URL);
|
||||
}
|
||||
}
|
||||
|
||||
alert('제대로 된 값이 넘어오지 않았습니다.', G5_URL);
|
||||
?>
|
||||
104
bbs/faq.php
Normal file
104
bbs/faq.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
//dbconfig파일에 $g5['faq_table'] , $g5['faq_master_table'] 배열변수가 있는지 체크
|
||||
if( !isset($g5['faq_table']) || !isset($g5['faq_master_table']) ){
|
||||
die('<meta charset="utf-8">관리자 모드에서 게시판관리->FAQ관리를 먼저 확인해 주세요.');
|
||||
}
|
||||
|
||||
// FAQ MASTER
|
||||
$faq_master_list = array();
|
||||
$sql = " select * from {$g5['faq_master_table']} order by fm_order,fm_id ";
|
||||
$result = sql_query($sql);
|
||||
while ($row=sql_fetch_array($result))
|
||||
{
|
||||
$key = $row['fm_id'];
|
||||
if (!$fm_id) $fm_id = $key;
|
||||
$faq_master_list[$key] = $row;
|
||||
}
|
||||
|
||||
if ($fm_id){
|
||||
$qstr .= '&fm_id=' . $fm_id; // 마스터faq key_id
|
||||
}
|
||||
|
||||
$fm = $faq_master_list[$fm_id];
|
||||
if (!$fm['fm_id'])
|
||||
alert('등록된 내용이 없습니다.');
|
||||
|
||||
$g5['title'] = $fm['fm_subject'];
|
||||
|
||||
if(G5_IS_MOBILE){
|
||||
$faq_skin = $config['cf_mobile_faq_skin'];
|
||||
} else {
|
||||
$faq_skin = $config['cf_faq_skin'];
|
||||
}
|
||||
|
||||
if(!$faq_skin) $faq_skin = 'basic';
|
||||
$faq_skin_path = (G5_IS_MOBILE ? G5_MOBILE_PATH : G5_PATH).'/'.G5_SKIN_DIR.'/faq/'.$faq_skin;
|
||||
$faq_skin_url = (G5_IS_MOBILE ? G5_MOBILE_URL : G5_URL).'/'.G5_SKIN_DIR.'/faq/'.$faq_skin;
|
||||
$skin_file = $faq_skin_path.'/list.skin.php';
|
||||
|
||||
include_once('./_head.php');
|
||||
|
||||
if(is_file($skin_file)) {
|
||||
$admin_href = '';
|
||||
$himg_src = '';
|
||||
$timg_src = '';
|
||||
if($is_admin)
|
||||
$admin_href = G5_ADMIN_URL.'/faqmasterform.php?w=u&fm_id='.$fm_id;
|
||||
|
||||
if(!G5_IS_MOBILE) {
|
||||
$himg = G5_DATA_PATH.'/faq/'.$fm_id.'_h';
|
||||
if (is_file($himg)){
|
||||
$himg_src = G5_DATA_URL.'/faq/'.$fm_id.'_h';
|
||||
}
|
||||
|
||||
$timg = G5_DATA_PATH.'/faq/'.$fm_id.'_t';
|
||||
if (is_file($timg)){
|
||||
$timg_src = G5_DATA_URL.'/faq/'.$fm_id.'_t';
|
||||
}
|
||||
}
|
||||
|
||||
$category_href = G5_BBS_URL.'/faq.php';
|
||||
$category_stx = '';
|
||||
$faq_list = array();
|
||||
|
||||
$stx = trim($stx);
|
||||
$sql_search = '';
|
||||
|
||||
if($stx) {
|
||||
$sql_search = " and ( INSTR(fa_subject, '$stx') > 0 or INSTR(fa_content, '$stx') > 0 ) ";
|
||||
$category_stx = '&stx='.$stx;
|
||||
}
|
||||
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
|
||||
$page_rows = G5_IS_MOBILE ? $config['cf_mobile_page_rows'] : $config['cf_page_rows'];
|
||||
|
||||
$sql = " select count(*) as cnt
|
||||
from {$g5['faq_table']}
|
||||
where fm_id = '$fm_id'
|
||||
$sql_search ";
|
||||
$total = sql_fetch($sql);
|
||||
$total_count = $total['cnt'];
|
||||
|
||||
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
|
||||
$from_record = ($page - 1) * $page_rows; // 시작 열을 구함
|
||||
|
||||
$sql = " select *
|
||||
from {$g5['faq_table']}
|
||||
where fm_id = '$fm_id'
|
||||
$sql_search
|
||||
order by fa_order , fa_id
|
||||
limit $from_record, $page_rows ";
|
||||
$result = sql_query($sql);
|
||||
while ($row=sql_fetch_array($result)){
|
||||
$faq_list[] = $row;
|
||||
}
|
||||
include_once($skin_file);
|
||||
} else {
|
||||
echo '<p>'.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.</p>';
|
||||
}
|
||||
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
43
bbs/formmail.php
Normal file
43
bbs/formmail.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
if (!$config['cf_email_use'])
|
||||
alert_close('환경설정에서 \"메일발송 사용\"에 체크하셔야 메일을 발송할 수 있습니다.\\n\\n관리자에게 문의하시기 바랍니다.');
|
||||
|
||||
if (!$is_member && $config['cf_formmail_is_member'])
|
||||
alert_close('회원만 이용하실 수 있습니다.');
|
||||
|
||||
if ($is_member && !$member['mb_open'] && $is_admin != "super" && $member['mb_id'] != $mb_id)
|
||||
alert_close('자신의 정보를 공개하지 않으면 다른분에게 메일을 보낼 수 없습니다.\\n\\n정보공개 설정은 회원정보수정에서 하실 수 있습니다.');
|
||||
|
||||
if ($mb_id)
|
||||
{
|
||||
$mb = get_member($mb_id);
|
||||
if (!$mb['mb_id'])
|
||||
alert_close('회원정보가 존재하지 않습니다.\\n\\n탈퇴한 회원일 수 있습니다.');
|
||||
|
||||
if (!$mb['mb_open'] && $is_admin != "super")
|
||||
alert_close('정보공개를 하지 않았습니다.');
|
||||
}
|
||||
|
||||
$sendmail_count = (int)get_session('ss_sendmail_count') + 1;
|
||||
if ($sendmail_count > 3)
|
||||
alert_close('한번 접속후 일정수의 메일만 발송할 수 있습니다.\\n\\n계속해서 메일을 보내시려면 다시 로그인 또는 접속하여 주십시오.');
|
||||
|
||||
$g5['title'] = '메일 쓰기';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if (!$name)
|
||||
$name = base64_decode($email);
|
||||
|
||||
if (!isset($type))
|
||||
$type = 0;
|
||||
|
||||
$type_checked[0] = $type_checked[1] = $type_checked[2] = "";
|
||||
$type_checked[$type] = 'checked';
|
||||
|
||||
include_once($member_skin_path.'/formmail.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
51
bbs/formmail_send.php
Normal file
51
bbs/formmail_send.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
if (!$config['cf_email_use'])
|
||||
alert('환경설정에서 "메일발송 사용"에 체크하셔야 메일을 발송할 수 있습니다.\\n\\n관리자에게 문의하시기 바랍니다.');
|
||||
|
||||
if (!$is_member && $config['cf_formmail_is_member'])
|
||||
alert_close('회원만 이용하실 수 있습니다.');
|
||||
|
||||
$to = base64_decode($to);
|
||||
|
||||
if (substr_count($to, "@") > 1)
|
||||
alert_close('한번에 한사람에게만 메일을 발송할 수 있습니다.');
|
||||
|
||||
|
||||
if (!chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
|
||||
for ($i=1; $i<=$attach; $i++) {
|
||||
if ($_FILES['file'.$i]['name'])
|
||||
$file[] = attach_file($_FILES['file'.$i]['name'], $_FILES['file'.$i]['tmp_name']);
|
||||
}
|
||||
|
||||
$content = stripslashes($content);
|
||||
if ($type == 2) {
|
||||
$type = 1;
|
||||
$content = str_replace("\n", "<br>", $content);
|
||||
}
|
||||
|
||||
// html 이면
|
||||
if ($type) {
|
||||
$current_url = G5_URL;
|
||||
$mail_content = '<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>메일보내기</title><link rel="stylesheet" href="'.$current_url.'/style.css"></head><body>'.$content.'</body></html>';
|
||||
}
|
||||
else
|
||||
$mail_content = $content;
|
||||
|
||||
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file);
|
||||
|
||||
//$html_title = $tmp_to . "님께 메일발송";
|
||||
$html_title = '메일 발송중';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
alert_close('메일을 정상적으로 발송하였습니다.');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
155
bbs/good.php
Normal file
155
bbs/good.php
Normal file
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
@include_once($board_skin_path.'/good.head.skin.php');
|
||||
|
||||
// 자바스크립트 사용가능할 때
|
||||
if($_POST['js'] == "on") {
|
||||
$error = $count = "";
|
||||
|
||||
function print_result($error, $count)
|
||||
{
|
||||
echo '{ "error": "' . $error . '", "count": "' . $count . '" }';
|
||||
if($error)
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$is_member)
|
||||
{
|
||||
$error = '회원만 가능합니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
if (!($bo_table && $wr_id)) {
|
||||
$error = '값이 제대로 넘어오지 않았습니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
$ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;
|
||||
if (!get_session($ss_name)) {
|
||||
$error = '해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['write_prefix']}{$bo_table} ", FALSE);
|
||||
if (!$row['cnt']) {
|
||||
$error = '존재하는 게시판이 아닙니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
if ($good == 'good' || $good == 'nogood')
|
||||
{
|
||||
if($write['mb_id'] == $member['mb_id']) {
|
||||
$error = '자신의 글에는 추천 또는 비추천 하실 수 없습니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
if (!$board['bo_use_good'] && $good == 'good') {
|
||||
$error = '이 게시판은 추천 기능을 사용하지 않습니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
if (!$board['bo_use_nogood'] && $good == 'nogood') {
|
||||
$error = '이 게시판은 비추천 기능을 사용하지 않습니다.';
|
||||
print_result($error, $count);
|
||||
}
|
||||
|
||||
$sql = " select bg_flag from {$g5['board_good_table']}
|
||||
where bo_table = '{$bo_table}'
|
||||
and wr_id = '{$wr_id}'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and bg_flag in ('good', 'nogood') ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['bg_flag'])
|
||||
{
|
||||
if ($row['bg_flag'] == 'good')
|
||||
$status = '추천';
|
||||
else
|
||||
$status = '비추천';
|
||||
|
||||
$error = "이미 $status 하신 글 입니다.";
|
||||
print_result($error, $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 추천(찬성), 비추천(반대) 카운트 증가
|
||||
sql_query(" update {$g5['write_prefix']}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '{$wr_id}' ");
|
||||
// 내역 생성
|
||||
sql_query(" insert {$g5['board_good_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member['mb_id']}', bg_flag = '{$good}', bg_datetime = '".G5_TIME_YMDHIS."' ");
|
||||
|
||||
$sql = " select wr_{$good} as count from {$g5['write_prefix']}{$bo_table} where wr_id = '$wr_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$count = $row['count'];
|
||||
|
||||
print_result($error, $count);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if (!$is_member)
|
||||
{
|
||||
$href = './login.php?$qstr&url='.urlencode('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id);
|
||||
|
||||
alert('회원만 가능합니다.', $href);
|
||||
}
|
||||
|
||||
if (!($bo_table && $wr_id))
|
||||
alert('값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
$ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;
|
||||
if (!get_session($ss_name))
|
||||
alert('해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.');
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['write_prefix']}{$bo_table} ", FALSE);
|
||||
if (!$row['cnt'])
|
||||
alert('존재하는 게시판이 아닙니다.');
|
||||
|
||||
if ($good == 'good' || $good == 'nogood')
|
||||
{
|
||||
if($write['mb_id'] == $member['mb_id'])
|
||||
alert('자신의 글에는 추천 또는 비추천 하실 수 없습니다.');
|
||||
|
||||
if (!$board['bo_use_good'] && $good == 'good')
|
||||
alert('이 게시판은 추천 기능을 사용하지 않습니다.');
|
||||
|
||||
if (!$board['bo_use_nogood'] && $good == 'nogood')
|
||||
alert('이 게시판은 비추천 기능을 사용하지 않습니다.');
|
||||
|
||||
$sql = " select bg_flag from {$g5['board_good_table']}
|
||||
where bo_table = '{$bo_table}'
|
||||
and wr_id = '{$wr_id}'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and bg_flag in ('good', 'nogood') ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['bg_flag'])
|
||||
{
|
||||
if ($row['bg_flag'] == 'good')
|
||||
$status = '추천';
|
||||
else
|
||||
$status = '비추천';
|
||||
|
||||
alert("이미 $status 하신 글 입니다.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 추천(찬성), 비추천(반대) 카운트 증가
|
||||
sql_query(" update {$g5['write_prefix']}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '{$wr_id}' ");
|
||||
// 내역 생성
|
||||
sql_query(" insert {$g5['board_good_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member['mb_id']}', bg_flag = '{$good}', bg_datetime = '".G5_TIME_YMDHIS."' ");
|
||||
|
||||
if ($good == 'good')
|
||||
$status = '추천';
|
||||
else
|
||||
$status = '비추천';
|
||||
|
||||
$href = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id;
|
||||
|
||||
alert("이 글을 $status 하셨습니다.", '', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include_once($board_skin_path.'/good.tail.skin.php');
|
||||
?>
|
||||
49
bbs/group.php
Normal file
49
bbs/group.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/latest.lib.php');
|
||||
$g5['title'] = $group['gr_subject'];
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MOBILE_PATH.'/group.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$is_admin && $group['gr_device'] == 'mobile')
|
||||
alert($group['gr_subject'].' 그룹은 모바일에서만 접근할 수 있습니다.');
|
||||
|
||||
include_once('./_head.php');
|
||||
?>
|
||||
|
||||
|
||||
<!-- 메인화면 최신글 시작 -->
|
||||
<?php
|
||||
// 최신글
|
||||
$sql = " select bo_table, bo_subject
|
||||
from {$g5[board_table]}
|
||||
where gr_id = '{$gr_id}'
|
||||
and bo_list_level <= '{$member[mb_level]}'
|
||||
and bo_device <> 'mobile' ";
|
||||
if(!$is_admin)
|
||||
$sql .= " and bo_use_cert = '' ";
|
||||
$sql .= " order by bo_order ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$lt_style = "";
|
||||
if ($i%2==1) $lt_style = "margin-left:20px";
|
||||
else $lt_style = "";
|
||||
?>
|
||||
<div style="float:left;<?php echo $lt_style ?>">
|
||||
<?php
|
||||
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
|
||||
// 사용방법 : latest(스킨, 게시판아이디, 출력라인, 글자수);
|
||||
echo latest('basic', $row['bo_table'], 5, 70);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- 메인화면 최신글 끝 -->
|
||||
|
||||
<?php
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
27
bbs/link.php
Normal file
27
bbs/link.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$html_title = '링크 > '.conv_subject($write['wr_subject'], 255);
|
||||
|
||||
if (!($bo_table && $wr_id && $no))
|
||||
alert_close('값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
// SQL Injection 예방
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['write_prefix']}{$bo_table} ", FALSE);
|
||||
if (!$row['cnt'])
|
||||
alert_close('존재하는 게시판이 아닙니다.');
|
||||
|
||||
if (!$write['wr_link'.$no])
|
||||
alert_close('링크가 없습니다.');
|
||||
|
||||
$ss_name = 'ss_link_'.$bo_table.'_'.$wr_id.'_'.$no;
|
||||
if (empty($_SESSION[$ss_name]))
|
||||
{
|
||||
$sql = " update {$g5['write_prefix']}{$bo_table} set wr_link{$no}_hit = wr_link{$no}_hit + 1 where wr_id = '{$wr_id}' ";
|
||||
sql_query($sql);
|
||||
|
||||
set_session($ss_name, true);
|
||||
}
|
||||
|
||||
goto_url(set_http($write['wr_link'.$no]));
|
||||
?>
|
||||
232
bbs/list.php
Normal file
232
bbs/list.php
Normal file
@ -0,0 +1,232 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 분류 사용 여부
|
||||
$is_category = false;
|
||||
$category_option = '';
|
||||
if ($board['bo_use_category']) {
|
||||
$is_category = true;
|
||||
$category_href = G5_BBS_URL.'/board.php?bo_table='.$bo_table;
|
||||
|
||||
$category_option .= '<li><a href="'.$category_href.'"';
|
||||
if ($sca=='')
|
||||
$category_option .= ' id="bo_cate_on"';
|
||||
$category_option .= '>전체</a></li>';
|
||||
|
||||
$categories = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음
|
||||
for ($i=0; $i<count($categories); $i++) {
|
||||
$category = trim($categories[$i]);
|
||||
if ($category=='') continue;
|
||||
$category_option .= '<li><a href="'.($category_href."&sca=".urlencode($category)).'"';
|
||||
$category_msg = '';
|
||||
if ($category==$sca) { // 현재 선택된 카테고리라면
|
||||
$category_option .= ' id="bo_cate_on"';
|
||||
$category_msg = '<span class="sound_only">열린 분류 </span>';
|
||||
}
|
||||
$category_option .= '>'.$category_msg.$category.'</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
$sop = strtolower($sop);
|
||||
if ($sop != 'and' && $sop != 'or')
|
||||
$sop = 'and';
|
||||
|
||||
// 분류 선택 또는 검색어가 있다면
|
||||
$stx = trim($stx);
|
||||
if ($sca || $stx) {
|
||||
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
|
||||
|
||||
// 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
|
||||
$sql = " select MIN(wr_num) as min_wr_num from {$write_table} ";
|
||||
$row = sql_fetch($sql);
|
||||
$min_spt = (int)$row['min_wr_num'];
|
||||
|
||||
if (!$spt) $spt = $min_spt;
|
||||
|
||||
$sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) ";
|
||||
|
||||
// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
|
||||
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
|
||||
$result = sql_query($sql);
|
||||
$total_count = mysql_num_rows($result);
|
||||
} else {
|
||||
$sql_search = "";
|
||||
|
||||
$total_count = $board['bo_count_write'];
|
||||
}
|
||||
|
||||
if(G5_IS_MOBILE) {
|
||||
$page_rows = $board['bo_mobile_page_rows'];
|
||||
$list_page_rows = $board['bo_mobile_page_rows'];
|
||||
} else {
|
||||
$page_rows = $board['bo_page_rows'];
|
||||
$list_page_rows = $board['bo_page_rows'];
|
||||
}
|
||||
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
|
||||
// 년도 2자리
|
||||
$today2 = G5_TIME_YMD;
|
||||
|
||||
$list = array();
|
||||
$i = 0;
|
||||
$notice_count = 0;
|
||||
$notice_array = array();
|
||||
|
||||
// 공지 처리
|
||||
if (!$sca && !$stx) {
|
||||
$arr_notice = explode(',', trim($board['bo_notice']));
|
||||
$from_notice_idx = ($page - 1) * $page_rows;
|
||||
if($from_notice_idx < 0)
|
||||
$from_notice_idx = 0;
|
||||
$board_notice_count = count($arr_notice);
|
||||
|
||||
for ($k=0; $k<$board_notice_count; $k++) {
|
||||
if (trim($arr_notice[$k]) == '') continue;
|
||||
|
||||
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' ");
|
||||
|
||||
if (!$row['wr_id']) continue;
|
||||
|
||||
$notice_array[] = $row['wr_id'];
|
||||
|
||||
if($k < $from_notice_idx) continue;
|
||||
|
||||
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
|
||||
$list[$i]['is_notice'] = true;
|
||||
|
||||
$i++;
|
||||
$notice_count++;
|
||||
|
||||
if($notice_count >= $list_page_rows)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
|
||||
$from_record = ($page - 1) * $page_rows; // 시작 열을 구함
|
||||
|
||||
// 공지글이 있으면 변수에 반영
|
||||
if(!empty($notice_array)) {
|
||||
$from_record -= count($notice_array);
|
||||
|
||||
if($from_record < 0)
|
||||
$from_record = 0;
|
||||
|
||||
if($notice_count > 0)
|
||||
$page_rows -= $notice_count;
|
||||
|
||||
if($page_rows < 0)
|
||||
$page_rows = $list_page_rows;
|
||||
}
|
||||
|
||||
// 관리자라면 CheckBox 보임
|
||||
$is_checkbox = false;
|
||||
if ($is_member && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']))
|
||||
$is_checkbox = true;
|
||||
|
||||
// 정렬에 사용하는 QUERY_STRING
|
||||
$qstr2 = 'bo_table='.$bo_table.'&sop='.$sop;
|
||||
|
||||
// 0 으로 나눌시 오류를 방지하기 위하여 값이 없으면 1 로 설정
|
||||
$bo_gallery_cols = $board['bo_gallery_cols'] ? $board['bo_gallery_cols'] : 1;
|
||||
$td_width = (int)(100 / $bo_gallery_cols);
|
||||
|
||||
// 정렬
|
||||
// 인덱스 필드가 아니면 정렬에 사용하지 않음
|
||||
//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) {
|
||||
if (!$sst) {
|
||||
if ($board['bo_sort_field']) {
|
||||
$sst = $board['bo_sort_field'];
|
||||
} else {
|
||||
$sst = "wr_num, wr_reply";
|
||||
$sod = "";
|
||||
}
|
||||
} else {
|
||||
// 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)
|
||||
// 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.
|
||||
// $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
|
||||
$sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
|
||||
}
|
||||
|
||||
if ($sst) {
|
||||
$sql_order = " order by {$sst} {$sod} ";
|
||||
}
|
||||
|
||||
if ($sca || $stx) {
|
||||
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
|
||||
} else {
|
||||
$sql = " select * from {$write_table} where wr_is_comment = 0 ";
|
||||
if(!empty($notice_array))
|
||||
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
|
||||
$sql .= " {$sql_order} limit {$from_record}, $page_rows ";
|
||||
}
|
||||
|
||||
// 페이지의 공지개수가 목록수 보다 작을 때만 실행
|
||||
if($page_rows > 0) {
|
||||
$result = sql_query($sql);
|
||||
|
||||
$k = 0;
|
||||
|
||||
while ($row = sql_fetch_array($result))
|
||||
{
|
||||
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
|
||||
if ($sca || $stx)
|
||||
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");
|
||||
|
||||
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
|
||||
if (strstr($sfl, 'subject')) {
|
||||
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
|
||||
}
|
||||
$list[$i]['is_notice'] = false;
|
||||
$list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count;
|
||||
$list[$i]['num'] = $list_num - $k;
|
||||
|
||||
$i++;
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
|
||||
$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table='.$bo_table.$qstr.'&page=');
|
||||
|
||||
$list_href = '';
|
||||
$prev_part_href = '';
|
||||
$next_part_href = '';
|
||||
if ($sca || $stx) {
|
||||
$list_href = './board.php?bo_table='.$bo_table;
|
||||
|
||||
//if ($prev_spt >= $min_spt)
|
||||
$prev_spt = $spt - $config['cf_search_part'];
|
||||
if (isset($min_spt) && $prev_spt >= $min_spt) {
|
||||
$prev_part_href = './board.php?bo_table='.$bo_table.$qstr.'&spt='.$prev_spt.'&page=1';
|
||||
$write_pages = page_insertbefore($write_pages, '<a href="'.$prev_part_href.'" class="pg_page pg_prev">이전검색</a>');
|
||||
}
|
||||
|
||||
$next_spt = $spt + $config['cf_search_part'];
|
||||
if ($next_spt < 0) {
|
||||
$next_part_href = './board.php?bo_table='.$bo_table.$qstr.'&spt='.$next_spt.'&page=1';
|
||||
$write_pages = page_insertafter($write_pages, '<a href="'.$next_part_href.'" class="pg_page pg_end">다음검색</a>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$write_href = '';
|
||||
if ($member['mb_level'] >= $board['bo_write_level']) {
|
||||
$write_href = './write.php?bo_table='.$bo_table;
|
||||
}
|
||||
|
||||
$nobr_begin = $nobr_end = "";
|
||||
if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
$nobr_begin = '<nobr>';
|
||||
$nobr_end = '</nobr>';
|
||||
}
|
||||
|
||||
// RSS 보기 사용에 체크가 되어 있어야 RSS 보기 가능 061106
|
||||
$rss_href = '';
|
||||
if ($board['bo_use_rss_view']) {
|
||||
$rss_href = './rss.php?bo_table='.$bo_table;
|
||||
}
|
||||
|
||||
$stx = get_text(stripslashes($stx));
|
||||
include_once($board_skin_path.'/list.skin.php');
|
||||
?>
|
||||
35
bbs/login.php
Normal file
35
bbs/login.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = '로그인';
|
||||
include_once('./_head.sub.php');
|
||||
|
||||
$url = $_GET['url'];
|
||||
|
||||
$p = parse_url($url);
|
||||
if ((isset($p['scheme']) && $p['scheme']) || (isset($p['host']) && $p['host'])) {
|
||||
//print_r2($p);
|
||||
if ($p['host'].(isset($p['port']) ? ':'.$p['port'] : '') != $_SERVER['HTTP_HOST'])
|
||||
alert('url에 타 도메인을 지정할 수 없습니다.');
|
||||
}
|
||||
|
||||
// 이미 로그인 중이라면
|
||||
if ($is_member) {
|
||||
if ($url)
|
||||
goto_url($url);
|
||||
else
|
||||
goto_url(G5_URL);
|
||||
}
|
||||
|
||||
$login_url = login_url($url);
|
||||
$login_action_url = G5_HTTPS_BBS_URL."/login_check.php";
|
||||
|
||||
// 로그인 스킨이 없는 경우 관리자 페이지 접속이 안되는 것을 막기 위하여 기본 스킨으로 대체
|
||||
$login_file = $member_skin_path.'/login.skin.php';
|
||||
if (!file_exists($login_file))
|
||||
$member_skin_path = G5_SKIN_PATH.'/member/basic';
|
||||
|
||||
include_once($member_skin_path.'/login.skin.php');
|
||||
|
||||
include_once('./_tail.sub.php');
|
||||
?>
|
||||
87
bbs/login_check.php
Normal file
87
bbs/login_check.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = "로그인 검사";
|
||||
|
||||
$mb_id = trim($_POST['mb_id']);
|
||||
$mb_password = trim($_POST['mb_password']);
|
||||
|
||||
if (!$mb_id || !$mb_password)
|
||||
alert('회원아이디나 비밀번호가 공백이면 안됩니다.');
|
||||
|
||||
$mb = get_member($mb_id);
|
||||
|
||||
// 가입된 회원이 아니다. 비밀번호가 틀리다. 라는 메세지를 따로 보여주지 않는 이유는
|
||||
// 회원아이디를 입력해 보고 맞으면 또 비밀번호를 입력해보는 경우를 방지하기 위해서입니다.
|
||||
// 불법사용자의 경우 회원아이디가 틀린지, 비밀번호가 틀린지를 알기까지는 많은 시간이 소요되기 때문입니다.
|
||||
if (!$mb['mb_id'] || (sql_password($mb_password) != $mb['mb_password'])) {
|
||||
alert('가입된 회원아이디가 아니거나 비밀번호가 틀립니다.\\n비밀번호는 대소문자를 구분합니다.');
|
||||
}
|
||||
|
||||
// 차단된 아이디인가?
|
||||
if ($mb['mb_intercept_date'] && $mb['mb_intercept_date'] <= date("Ymd", G5_SERVER_TIME)) {
|
||||
$date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_intercept_date']);
|
||||
alert('회원님의 아이디는 접근이 금지되어 있습니다.\n처리일 : '.$date);
|
||||
}
|
||||
|
||||
// 탈퇴한 아이디인가?
|
||||
if ($mb['mb_leave_date'] && $mb['mb_leave_date'] <= date("Ymd", G5_SERVER_TIME)) {
|
||||
$date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_leave_date']);
|
||||
alert('탈퇴한 아이디이므로 접근하실 수 없습니다.\n탈퇴일 : '.$date);
|
||||
}
|
||||
|
||||
if ($config['cf_use_email_certify'] && !preg_match("/[1-9]/", $mb['mb_email_certify'])) {
|
||||
confirm("{$mb['mb_email']} 메일로 메일인증을 받으셔야 로그인 가능합니다. 다른 메일주소로 변경하여 인증하시려면 취소를 클릭하시기 바랍니다.", G5_URL, G5_BBS_URL.'/register_email.php?mb_id='.$mb_id);
|
||||
}
|
||||
|
||||
@include_once($member_skin_path.'/login_check.skin.php');
|
||||
|
||||
// 회원아이디 세션 생성
|
||||
set_session('ss_mb_id', $mb['mb_id']);
|
||||
// FLASH XSS 공격에 대응하기 위하여 회원의 고유키를 생성해 놓는다. 관리자에서 검사함 - 110106
|
||||
set_session('ss_mb_key', md5($mb['mb_datetime'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
// 포인트 체크
|
||||
if($config['cf_use_point']) {
|
||||
$sum_point = get_point_sum($mb['mb_id']);
|
||||
|
||||
$sql= " update {$g5['member_table']} set mb_point = '$sum_point' where mb_id = '{$mb['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 3.26
|
||||
// 아이디 쿠키에 한달간 저장
|
||||
if ($auto_login) {
|
||||
// 3.27
|
||||
// 자동로그인 ---------------------------
|
||||
// 쿠키 한달간 저장
|
||||
$key = md5($_SERVER['SERVER_ADDR'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $mb['mb_password']);
|
||||
set_cookie('ck_mb_id', $mb['mb_id'], 86400 * 31);
|
||||
set_cookie('ck_auto', $key, 86400 * 31);
|
||||
// 자동로그인 end ---------------------------
|
||||
} else {
|
||||
set_cookie('ck_mb_id', '', 0);
|
||||
set_cookie('ck_auto', '', 0);
|
||||
}
|
||||
|
||||
if ($url) {
|
||||
$link = urldecode($url);
|
||||
// 2003-06-14 추가 (다른 변수들을 넘겨주기 위함)
|
||||
if (preg_match("/\?/", $link))
|
||||
$split= "&";
|
||||
else
|
||||
$split= "?";
|
||||
|
||||
// $_POST 배열변수에서 아래의 이름을 가지지 않은 것만 넘김
|
||||
foreach($_POST as $key=>$value) {
|
||||
if ($key != 'mb_id' && $key != 'mb_password' && $key != 'x' && $key != 'y' && $key != 'url') {
|
||||
$link .= "$split$key=$value";
|
||||
$split = "&";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$link = G5_URL;
|
||||
}
|
||||
|
||||
goto_url($link);
|
||||
?>
|
||||
27
bbs/logout.php
Normal file
27
bbs/logout.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 이호경님 제안 코드
|
||||
session_unset(); // 모든 세션변수를 언레지스터 시켜줌
|
||||
session_destroy(); // 세션해제함
|
||||
|
||||
// 자동로그인 해제 --------------------------------
|
||||
set_cookie('ck_mb_id', '', 0);
|
||||
set_cookie('ck_auto', '', 0);
|
||||
// 자동로그인 해제 end --------------------------------
|
||||
|
||||
if ($url) {
|
||||
$p = parse_url($url);
|
||||
if ($p['scheme'] || $p['host']) {
|
||||
alert('url에 도메인을 지정할 수 없습니다.');
|
||||
}
|
||||
|
||||
$link = $url;
|
||||
} else if ($bo_table) {
|
||||
$link = G5_BBS_URL.'/board.php?bo_table='.$bo_table;
|
||||
} else {
|
||||
$link = G5_URL;
|
||||
}
|
||||
|
||||
goto_url($link);
|
||||
?>
|
||||
29
bbs/member_confirm.php
Normal file
29
bbs/member_confirm.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_guest)
|
||||
alert('로그인 한 회원만 접근하실 수 있습니다.', G5_BBS_URL.'/login.php');
|
||||
|
||||
/*
|
||||
if ($url)
|
||||
$urlencode = urlencode($url);
|
||||
else
|
||||
$urlencode = urlencode($_SERVER[REQUEST_URI]);
|
||||
*/
|
||||
|
||||
$g5['title'] = '회원 비밀번호 확인';
|
||||
include_once('./_head.sub.php');
|
||||
|
||||
$url = $_GET['url'];
|
||||
|
||||
$p = parse_url($url);
|
||||
if ((isset($p['scheme']) && $p['scheme']) || (isset($p['host']) && $p['host'])) {
|
||||
//print_r2($p);
|
||||
if ($p['host'].(isset($p['port']) ? ':'.$p['port'] : '') != $_SERVER['HTTP_HOST'])
|
||||
alert('url에 타 도메인을 지정할 수 없습니다.');
|
||||
}
|
||||
|
||||
include_once($member_skin_path.'/member_confirm.skin.php');
|
||||
|
||||
include_once('./_tail.sub.php');
|
||||
?>
|
||||
25
bbs/member_leave.php
Normal file
25
bbs/member_leave.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$member['mb_id'])
|
||||
alert('회원만 접근하실 수 있습니다.');
|
||||
|
||||
if ($is_admin == 'super')
|
||||
alert('최고 관리자는 탈퇴할 수 없습니다');
|
||||
|
||||
if (!($_POST['mb_password'] && $member['mb_password'] == sql_password($_POST['mb_password'])))
|
||||
alert('비밀번호가 틀립니다.');
|
||||
|
||||
// 회원탈퇴일을 저장
|
||||
$date = date("Ymd");
|
||||
$sql = " update {$g5['member_table']} set mb_leave_date = '{$date}' where mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 3.09 수정 (로그아웃)
|
||||
session_unregister("ss_mb_id");
|
||||
|
||||
if (!$url)
|
||||
$url = G5_URL;
|
||||
|
||||
alert(''.$member['mb_nick'].'님께서는 '. date("Y년 m월 d일") .'에 회원에서 탈퇴 하셨습니다.', $url);
|
||||
?>
|
||||
74
bbs/memo.php
Normal file
74
bbs/memo.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_guest)
|
||||
alert_close('회원만 이용하실 수 있습니다.');
|
||||
|
||||
$g5['title'] = '내 쪽지함';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if (!$kind) $kind = 'recv';
|
||||
|
||||
if ($kind == 'recv')
|
||||
$unkind = 'send';
|
||||
else if ($kind == 'send')
|
||||
$unkind = 'recv';
|
||||
else
|
||||
alert(''.$kind .'값을 넘겨주세요.');
|
||||
|
||||
$sql = " select count(*) as cnt from {$g5['memo_table']} where me_{$kind}_mb_id = '{$member['mb_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = number_format($row['cnt']);
|
||||
|
||||
if ($kind == 'recv')
|
||||
{
|
||||
$kind_title = '받은';
|
||||
$recv_img = 'on';
|
||||
$send_img = 'off';
|
||||
}
|
||||
else
|
||||
{
|
||||
$kind_title = '보낸';
|
||||
$recv_img = 'off';
|
||||
$send_img = 'on';
|
||||
}
|
||||
|
||||
$list = array();
|
||||
|
||||
$sql = " select a.*, b.mb_id, b.mb_nick, b.mb_email, b.mb_homepage
|
||||
from {$g5['memo_table']} a
|
||||
left join {$g5['member_table']} b on (a.me_{$unkind}_mb_id = b.mb_id)
|
||||
where a.me_{$kind}_mb_id = '{$member['mb_id']}'
|
||||
order by a.me_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$list[$i] = $row;
|
||||
|
||||
$mb_id = $row["me_{$unkind}_mb_id"];
|
||||
|
||||
if ($row['mb_nick'])
|
||||
$mb_nick = $row['mb_nick'];
|
||||
else
|
||||
$mb_nick = '정보없음';
|
||||
|
||||
$name = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']);
|
||||
|
||||
if (substr($row['me_read_datetime'],0,1) == 0)
|
||||
$read_datetime = '아직 읽지 않음';
|
||||
else
|
||||
$read_datetime = substr($row['me_read_datetime'],2,14);
|
||||
|
||||
$send_datetime = substr($row['me_send_datetime'],2,14);
|
||||
|
||||
$list[$i]['name'] = $name;
|
||||
$list[$i]['send_datetime'] = $send_datetime;
|
||||
$list[$i]['read_datetime'] = $read_datetime;
|
||||
$list[$i]['view_href'] = './memo_view.php?me_id='.$row['me_id'].'&kind='.$kind;
|
||||
$list[$i]['del_href'] = './memo_delete.php?me_id='.$row['me_id'].'&kind='.$kind;
|
||||
}
|
||||
|
||||
include_once($member_skin_path.'/memo.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
27
bbs/memo_delete.php
Normal file
27
bbs/memo_delete.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member)
|
||||
alert('회원만 이용하실 수 있습니다.');
|
||||
|
||||
$me_id = (int)$_REQUEST['me_id'];
|
||||
|
||||
$sql = " select * from {$g5['memo_table']} where me_id = '{$me_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if (!$row['me_read_datetime'][0]) // 메모 받기전이면
|
||||
{
|
||||
$sql = " update {$g5['member_table']}
|
||||
set mb_memo_call = ''
|
||||
where mb_id = '{$row['me_recv_mb_id']}'
|
||||
and mb_memo_call = '{$row['me_send_mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
$sql = " delete from {$g5['memo_table']}
|
||||
where me_id = '{$me_id}'
|
||||
and (me_recv_mb_id = '{$member['mb_id']}' or me_send_mb_id = '{$member['mb_id']}') ";
|
||||
sql_query($sql);
|
||||
|
||||
goto_url('./memo.php?kind='.$kind);
|
||||
?>
|
||||
42
bbs/memo_form.php
Normal file
42
bbs/memo_form.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
if ($is_guest)
|
||||
alert_close('회원만 이용하실 수 있습니다.');
|
||||
|
||||
if (!$member['mb_open'] && $is_admin != 'super' && $member['mb_id'] != $mb_id)
|
||||
alert_close("자신의 정보를 공개하지 않으면 다른분에게 쪽지를 보낼 수 없습니다. 정보공개 설정은 회원정보수정에서 하실 수 있습니다.");
|
||||
|
||||
$content = "";
|
||||
// 탈퇴한 회원에게 쪽지 보낼 수 없음
|
||||
if ($me_recv_mb_id)
|
||||
{
|
||||
$mb = get_member($me_recv_mb_id);
|
||||
if (!$mb['mb_id'])
|
||||
alert_close('회원정보가 존재하지 않습니다.\\n\\n탈퇴하였을 수 있습니다.');
|
||||
|
||||
if (!$mb['mb_open'] && $is_admin != 'super')
|
||||
alert_close('정보공개를 하지 않았습니다.');
|
||||
|
||||
// 4.00.15
|
||||
$row = sql_fetch(" select me_memo from {$g5['memo_table']} where me_id = '{$me_id}' and (me_recv_mb_id = '{$member['mb_id']}' or me_send_mb_id = '{$member['mb_id']}') ");
|
||||
if ($row['me_memo'])
|
||||
{
|
||||
$content = "\n\n\n".' >'
|
||||
."\n".' >'
|
||||
."\n".' >'.str_replace("\n", "\n> ", get_text($row['me_memo'], 0))
|
||||
."\n".' >'
|
||||
.' >';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$g5['title'] = '쪽지 보내기';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$memo_action_url = G5_HTTPS_BBS_URL."/memo_form_update.php";
|
||||
include_once($member_skin_path.'/memo_form.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
81
bbs/memo_form_update.php
Normal file
81
bbs/memo_form_update.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
if ($is_guest)
|
||||
alert('회원만 이용하실 수 있습니다.');
|
||||
|
||||
if (!chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
$recv_list = explode(',', trim($_POST['me_recv_mb_id']));
|
||||
$str_nick_list = '';
|
||||
$msg = '';
|
||||
$error_list = array();
|
||||
$member_list = array();
|
||||
for ($i=0; $i<count($recv_list); $i++) {
|
||||
$row = sql_fetch(" select mb_id, mb_nick, mb_open, mb_leave_date, mb_intercept_date from {$g5['member_table']} where mb_id = '{$recv_list[$i]}' ");
|
||||
if ($row) {
|
||||
if ($is_admin || ($row['mb_open'] && (!$row['mb_leave_date'] || !$row['mb_intercept_date']))) {
|
||||
$member_list['id'][] = $row['mb_id'];
|
||||
$member_list['nick'][] = $row['mb_nick'];
|
||||
} else {
|
||||
$error_list[] = $recv_list[$i];
|
||||
}
|
||||
}
|
||||
/*
|
||||
// 관리자가 아니면서
|
||||
// 가입된 회원이 아니거나 정보공개를 하지 않았거나 탈퇴한 회원이거나 차단된 회원에게 쪽지를 보내는것은 에러
|
||||
if ((!$row['mb_id'] || !$row['mb_open'] || $row['mb_leave_date'] || $row['mb_intercept_date']) && !$is_admin) {
|
||||
$error_list[] = $recv_list[$i];
|
||||
} else {
|
||||
$member_list['id'][] = $row['mb_id'];
|
||||
$member_list['nick'][] = $row['mb_nick'];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
$error_msg = implode(",", $error_list);
|
||||
|
||||
if ($error_msg && !$is_admin)
|
||||
alert("회원아이디 '{$error_msg}' 은(는) 존재(또는 정보공개)하지 않는 회원아이디 이거나 탈퇴, 접근차단된 회원아이디 입니다.\\n쪽지를 발송하지 않았습니다.");
|
||||
|
||||
if (!$is_admin) {
|
||||
if (count($member_list['id'])) {
|
||||
$point = (int)$config['cf_memo_send_point'] * count($member_list['id']);
|
||||
if ($point) {
|
||||
if ($member['mb_point'] - $point < 0) {
|
||||
alert('보유하신 포인트('.number_format($member['mb_point']).'점)가 모자라서 쪽지를 보낼 수 없습니다.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=0; $i<count($member_list['id']); $i++) {
|
||||
$tmp_row = sql_fetch(" select max(me_id) as max_me_id from {$g5['memo_table']} ");
|
||||
$me_id = $tmp_row['max_me_id'] + 1;
|
||||
|
||||
$recv_mb_id = $member_list['id'][$i];
|
||||
$recv_mb_nick = get_text($member_list['nick'][$i]);
|
||||
|
||||
// 쪽지 INSERT
|
||||
$sql = " insert into {$g5['memo_table']} ( me_id, me_recv_mb_id, me_send_mb_id, me_send_datetime, me_memo ) values ( '$me_id', '$recv_mb_id', '{$member['mb_id']}', '".G5_TIME_YMDHIS."', '{$_POST['me_memo']}' ) ";
|
||||
sql_query($sql);
|
||||
|
||||
// 실시간 쪽지 알림 기능
|
||||
$sql = " update {$g5['member_table']} set mb_memo_call = '{$member['mb_id']}' where mb_id = '$recv_mb_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
if (!$is_admin) {
|
||||
insert_point($member['mb_id'], (int)$config['cf_memo_send_point'] * (-1), $recv_mb_nick.'('.$recv_mb_id.')님께 쪽지 발송', '@memo', $recv_mb_id, $me_id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($member_list) {
|
||||
$str_nick_list = implode(',', $member_list['nick']);
|
||||
alert($str_nick_list." 님께 쪽지를 전달하였습니다.", G5_HTTP_BBS_URL."/memo.php?kind=send", false);
|
||||
} else {
|
||||
alert("회원아이디 오류 같습니다.", G5_HTTP_BBS_URL."/memo_form.php", false);
|
||||
}
|
||||
?>
|
||||
71
bbs/memo_view.php
Normal file
71
bbs/memo_view.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member)
|
||||
alert('회원만 이용하실 수 있습니다.');
|
||||
|
||||
$me_id = (int)$_REQUEST['me_id'];
|
||||
|
||||
if ($kind == 'recv')
|
||||
{
|
||||
$t = '받은';
|
||||
$unkind = 'send';
|
||||
|
||||
$sql = " update {$g5['memo_table']}
|
||||
set me_read_datetime = '".G5_TIME_YMDHIS."'
|
||||
where me_id = '$me_id'
|
||||
and me_recv_mb_id = '{$member['mb_id']}'
|
||||
and me_read_datetime = '0000-00-00 00:00:00' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
else if ($kind == 'send')
|
||||
{
|
||||
$t = '보낸';
|
||||
$unkind = 'recv';
|
||||
}
|
||||
else
|
||||
{
|
||||
alert($kind.' 값을 넘겨주세요.');
|
||||
}
|
||||
|
||||
$g5['title'] = $t.' 쪽지 보기';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$sql = " select * from {$g5['memo_table']}
|
||||
where me_id = '$me_id'
|
||||
and me_{$kind}_mb_id = '{$member['mb_id']}' ";
|
||||
$memo = sql_fetch($sql);
|
||||
|
||||
// 이전 쪽지
|
||||
$sql = " select * from {$g5['memo_table']}
|
||||
where me_id > '{$me_id}'
|
||||
and me_{$kind}_mb_id = '{$member['mb_id']}'
|
||||
order by me_id asc
|
||||
limit 1 ";
|
||||
$prev = sql_fetch($sql);
|
||||
if ($prev['me_id'])
|
||||
$prev_link = './memo_view.php?kind='.$kind.'&me_id='.$prev['me_id'];
|
||||
else
|
||||
//$prev_link = 'javascript:alert(\'쪽지의 처음입니다.\');';
|
||||
$prev_link = '';
|
||||
|
||||
|
||||
// 다음 쪽지
|
||||
$sql = " select * from {$g5[memo_table]}
|
||||
where me_id < '{$me_id}'
|
||||
and me_{$kind}_mb_id = '{$member[mb_id]}'
|
||||
order by me_id desc
|
||||
limit 1 ";
|
||||
$next = sql_fetch($sql);
|
||||
if ($next[me_id])
|
||||
$next_link = './memo_view.php?kind='.$kind.'&me_id='.$next[me_id];
|
||||
else
|
||||
//$next_link = 'javascript:alert(\'쪽지의 마지막입니다.\');';
|
||||
$next_link = '';
|
||||
|
||||
$mb = get_member($memo['me_'.$unkind.'_mb_id']);
|
||||
|
||||
include_once($member_skin_path.'/memo_view.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
159
bbs/move.php
Normal file
159
bbs/move.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($sw == 'move')
|
||||
$act = '이동';
|
||||
else if ($sw == 'copy')
|
||||
$act = '복사';
|
||||
else
|
||||
alert('sw 값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
// 게시판 관리자 이상 복사, 이동 가능
|
||||
if ($is_admin != 'board' && $is_admin != 'group' && $is_admin != 'super')
|
||||
alert_close("게시판 관리자 이상 접근이 가능합니다.");
|
||||
|
||||
$g5['title'] = '게시물 ' . $act;
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$wr_id_list = '';
|
||||
if ($wr_id)
|
||||
$wr_id_list = $wr_id;
|
||||
else {
|
||||
$comma = '';
|
||||
for ($i=0; $i<count($_POST['chk_wr_id']); $i++) {
|
||||
$wr_id_list .= $comma . $_POST['chk_wr_id'][$i];
|
||||
$comma = ',';
|
||||
}
|
||||
}
|
||||
|
||||
//$sql = " select * from {$g5['board_table']} a, {$g5['group_table']} b where a.gr_id = b.gr_id and bo_table <> '$bo_table' ";
|
||||
// 원본 게시판을 선택 할 수 있도록 함.
|
||||
$sql = " select * from {$g5['board_table']} a, {$g5['group_table']} b where a.gr_id = b.gr_id ";
|
||||
if ($is_admin == 'group')
|
||||
$sql .= " and b.gr_admin = '{$member['mb_id']}' ";
|
||||
else if ($is_admin == 'board')
|
||||
$sql .= " and a.bo_admin = '{$member['mb_id']}' ";
|
||||
$sql .= " order by a.gr_id, a.bo_order, a.bo_table ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$list[$i] = $row;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="copymove" class="new_win">
|
||||
<h1 id="win_title"><?php echo $g5['title'] ?></h1>
|
||||
|
||||
<form name="fboardmoveall" method="post" action="./move_update.php" onsubmit="return fboardmoveall_submit(this);">
|
||||
<input type="hidden" name="sw" value="<?php echo $sw ?>">
|
||||
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
|
||||
<input type="hidden" name="wr_id_list" value="<?php echo $wr_id_list ?>">
|
||||
<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="act" value="<?php echo $act ?>">
|
||||
<input type="hidden" name="url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $act ?>할 게시판을 한개 이상 선택하여 주십시오.</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">현재 페이지 게시판 전체</label>
|
||||
<input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
|
||||
</th>
|
||||
<th scope="col">게시판</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i=0; $i<count($list); $i++) {
|
||||
$atc_mark = '';
|
||||
$atc_bg = '';
|
||||
if ($list[$i]['bo_table'] == $bo_table) { // 게시물이 현재 속해 있는 게시판이라면
|
||||
$atc_mark = '<span class="copymove_current">현재<span class="sound_only">게시판</span></span>';
|
||||
$atc_bg = 'copymove_currentbg';
|
||||
}
|
||||
?>
|
||||
<tr class="<?php echo $atc_bg; ?>">
|
||||
<td class="td_chk">
|
||||
<label for="chk<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['bo_table'] ?></label>
|
||||
<input type="checkbox" value="<?php echo $list[$i]['bo_table'] ?>" id="chk<?php echo $i ?>" name="chk_bo_table[]">
|
||||
</td>
|
||||
<td>
|
||||
<label for="chk<?php echo $i ?>">
|
||||
<?php
|
||||
echo $list[$i]['gr_subject'] . ' > ';
|
||||
$save_gr_subject = $list[$i]['gr_subject'];
|
||||
?>
|
||||
<?php echo $list[$i]['bo_subject'] ?> (<?php echo $list[$i]['bo_table'] ?>)
|
||||
<?php echo $atc_mark; ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="win_btn">
|
||||
<input type="submit" value="<?php echo $act ?>" id="btn_submit" class="btn_submit">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$(".win_btn").append("<button type=\"button\" class=\"btn_cancel\">창닫기</button>");
|
||||
|
||||
$(".win_btn button").click(function() {
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
|
||||
function all_checked(sw) {
|
||||
var f = document.fboardmoveall;
|
||||
|
||||
for (var i=0; i<f.length; i++) {
|
||||
if (f.elements[i].name == "chk_bo_table[]")
|
||||
f.elements[i].checked = sw;
|
||||
}
|
||||
}
|
||||
|
||||
function fboardmoveall_submit(f)
|
||||
{
|
||||
var check = false;
|
||||
|
||||
if (typeof(f.elements['chk_bo_table[]']) == 'undefined')
|
||||
;
|
||||
else {
|
||||
if (typeof(f.elements['chk_bo_table[]'].length) == 'undefined') {
|
||||
if (f.elements['chk_bo_table[]'].checked)
|
||||
check = true;
|
||||
} else {
|
||||
for (i=0; i<f.elements['chk_bo_table[]'].length; i++) {
|
||||
if (f.elements['chk_bo_table[]'][i].checked) {
|
||||
check = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!check) {
|
||||
alert('게시물을 '+f.act.value+'할 게시판을 한개 이상 선택해 주십시오.');
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById('btn_submit').disabled = true;
|
||||
|
||||
f.action = './move_update.php';
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
219
bbs/move_update.php
Normal file
219
bbs/move_update.php
Normal file
@ -0,0 +1,219 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 게시판 관리자 이상 복사, 이동 가능
|
||||
if ($is_admin != 'board' && $is_admin != 'group' && $is_admin != 'super')
|
||||
alert_close('게시판 관리자 이상 접근이 가능합니다.');
|
||||
|
||||
if ($sw != 'move' && $sw != 'copy')
|
||||
alert('sw 값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
if(!count($_POST['chk_bo_table']))
|
||||
alert('게시물을 '.$act.'할 게시판을 한개 이상 선택해 주십시오.', $url);
|
||||
|
||||
// 원본 파일 디렉토리
|
||||
$src_dir = G5_DATA_PATH.'/file/'.$bo_table;
|
||||
|
||||
$save = array();
|
||||
$save_count_write = 0;
|
||||
$save_count_comment = 0;
|
||||
$cnt = 0;
|
||||
|
||||
$sql = " select distinct wr_num from $write_table where wr_id in ({$wr_id_list}) order by wr_id ";
|
||||
$result = sql_query($sql);
|
||||
while ($row = sql_fetch_array($result))
|
||||
{
|
||||
$wr_num = $row['wr_num'];
|
||||
for ($i=0; $i<count($_POST['chk_bo_table']); $i++)
|
||||
{
|
||||
$move_bo_table = $_POST['chk_bo_table'][$i];
|
||||
$move_write_table = $g5['write_prefix'] . $move_bo_table;
|
||||
|
||||
$src_dir = G5_DATA_PATH.'/file/'.$bo_table; // 원본 디렉토리
|
||||
$dst_dir = G5_DATA_PATH.'/file/'.$move_bo_table; // 복사본 디렉토리
|
||||
|
||||
$count_write = 0;
|
||||
$count_comment = 0;
|
||||
|
||||
$next_wr_num = get_next_num($move_write_table);
|
||||
|
||||
$sql2 = " select * from $write_table where wr_num = '$wr_num' order by wr_parent, wr_is_comment, wr_comment desc, wr_id ";
|
||||
$result2 = sql_query($sql2);
|
||||
while ($row2 = sql_fetch_array($result2))
|
||||
{
|
||||
$nick = cut_str($member['mb_nick'], $config['cf_cut_name']);
|
||||
if (!$row2['wr_is_comment'] && $config['cf_use_copy_log']) {
|
||||
if(strstr($row2['wr_option'], 'html')) {
|
||||
$log_tag1 = '<div class="content_'.$sw.'">';
|
||||
$log_tag2 = '</div>';
|
||||
} else {
|
||||
$log_tag1 = "\n";
|
||||
$log_tag2 = '';
|
||||
}
|
||||
|
||||
$row2['wr_content'] .= "\n".$log_tag1.'[이 게시물은 '.$nick.'님에 의해 '.G5_TIME_YMDHIS.' '.$board['bo_subject'].'에서 '.($sw == 'copy' ? '복사' : '이동').' 됨]'.$log_tag2;
|
||||
}
|
||||
|
||||
// 게시글 추천, 비추천수
|
||||
$wr_good = $wr_nogood = 0;
|
||||
if ($sw == 'move' && $i == 0) {
|
||||
$wr_good = $row2['wr_good'];
|
||||
$wr_nogood = $row2['wr_nogood'];
|
||||
}
|
||||
|
||||
$sql = " insert into $move_write_table
|
||||
set wr_num = '$next_wr_num',
|
||||
wr_reply = '{$row2['wr_reply']}',
|
||||
wr_is_comment = '{$row2['wr_is_comment']}',
|
||||
wr_comment = '{$row2['wr_comment']}',
|
||||
wr_comment_reply = '{$row2['wr_comment_reply']}',
|
||||
ca_name = '".addslashes($row2['ca_name'])."',
|
||||
wr_option = '{$row2['wr_option']}',
|
||||
wr_subject = '".addslashes($row2['wr_subject'])."',
|
||||
wr_content = '".addslashes($row2['wr_content'])."',
|
||||
wr_link1 = '".addslashes($row2['wr_link1'])."',
|
||||
wr_link2 = '".addslashes($row2['wr_link2'])."',
|
||||
wr_link1_hit = '{$row2['wr_link1_hit']}',
|
||||
wr_link2_hit = '{$row2['wr_link2_hit']}',
|
||||
wr_hit = '{$row2['wr_hit']}',
|
||||
wr_good = '{$wr_good}',
|
||||
wr_nogood = '{$wr_nogood}',
|
||||
mb_id = '{$row2['mb_id']}',
|
||||
wr_password = '{$row2['wr_password']}',
|
||||
wr_name = '".addslashes($row2['wr_name'])."',
|
||||
wr_email = '".addslashes($row2['wr_email'])."',
|
||||
wr_homepage = '".addslashes($row2['wr_homepage'])."',
|
||||
wr_datetime = '{$row2['wr_datetime']}',
|
||||
wr_file = '{$row2['wr_file']}',
|
||||
wr_last = '{$row2['wr_last']}',
|
||||
wr_ip = '{$row2['wr_ip']}',
|
||||
wr_1 = '".addslashes($row2['wr_1'])."',
|
||||
wr_2 = '".addslashes($row2['wr_2'])."',
|
||||
wr_3 = '".addslashes($row2['wr_3'])."',
|
||||
wr_4 = '".addslashes($row2['wr_4'])."',
|
||||
wr_5 = '".addslashes($row2['wr_5'])."',
|
||||
wr_6 = '".addslashes($row2['wr_6'])."',
|
||||
wr_7 = '".addslashes($row2['wr_7'])."',
|
||||
wr_8 = '".addslashes($row2['wr_8'])."',
|
||||
wr_9 = '".addslashes($row2['wr_9'])."',
|
||||
wr_10 = '".addslashes($row2['wr_10'])."' ";
|
||||
sql_query($sql);
|
||||
|
||||
$insert_id = mysql_insert_id();
|
||||
|
||||
// 코멘트가 아니라면
|
||||
if (!$row2['wr_is_comment'])
|
||||
{
|
||||
$save_parent = $insert_id;
|
||||
|
||||
$sql3 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' order by bf_no ";
|
||||
$result3 = sql_query($sql3);
|
||||
for ($k=0; $row3 = sql_fetch_array($result3); $k++)
|
||||
{
|
||||
if ($row3['bf_file'])
|
||||
{
|
||||
// 원본파일을 복사하고 퍼미션을 변경
|
||||
@copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$row3['bf_file']);
|
||||
@chmod($dst_dir/$row3['bf_file'], G5_FILE_PERMISSION);
|
||||
}
|
||||
|
||||
$sql = " insert into {$g5['board_file_table']}
|
||||
set bo_table = '$move_bo_table',
|
||||
wr_id = '$insert_id',
|
||||
bf_no = '{$row3['bf_no']}',
|
||||
bf_source = '{$row3['bf_source']}',
|
||||
bf_file = '{$row3['bf_file']}',
|
||||
bf_download = '{$row3['bf_download']}',
|
||||
bf_content = '".addslashes($row3['bf_content'])."',
|
||||
bf_filesize = '{$row3['bf_filesize']}',
|
||||
bf_width = '{$row3['bf_width']}',
|
||||
bf_height = '{$row3['bf_height']}',
|
||||
bf_type = '{$row3['bf_type']}',
|
||||
bf_datetime = '{$row3['bf_datetime']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
if ($sw == 'move' && $row3['bf_file'])
|
||||
$save[$cnt]['bf_file'][$k] = $src_dir.'/'.$row3['bf_file'];
|
||||
}
|
||||
|
||||
$count_write++;
|
||||
|
||||
if ($sw == 'move' && $i == 0)
|
||||
{
|
||||
// 스크랩 이동
|
||||
sql_query(" update {$g5['scrap_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' ");
|
||||
|
||||
// 최신글 이동
|
||||
sql_query(" update {$g5['board_new_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' ");
|
||||
|
||||
// 추천데이터 이동
|
||||
sql_query(" update {$g5['board_good_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$count_comment++;
|
||||
|
||||
if ($sw == 'move')
|
||||
{
|
||||
// 최신글 이동
|
||||
sql_query(" update {$g5['board_new_table']} set bo_table = '$move_bo_table', wr_id = '$insert_id', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' ");
|
||||
}
|
||||
}
|
||||
|
||||
sql_query(" update $move_write_table set wr_parent = '$save_parent' where wr_id = '$insert_id' ");
|
||||
|
||||
if ($sw == 'move')
|
||||
$save[$cnt]['wr_id'] = $row2['wr_parent'];
|
||||
|
||||
$cnt++;
|
||||
}
|
||||
|
||||
sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write + '$count_write' where bo_table = '$move_bo_table' ");
|
||||
sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + '$count_comment' where bo_table = '$move_bo_table' ");
|
||||
|
||||
delete_cache_latest($move_bo_table);
|
||||
}
|
||||
|
||||
$save_count_write += $count_write;
|
||||
$save_count_comment += $count_comment;
|
||||
}
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
if ($sw == 'move')
|
||||
{
|
||||
for ($i=0; $i<count($save); $i++)
|
||||
{
|
||||
for ($k=0; $k<count($save[$i]['bf_file']); $k++)
|
||||
@unlink($save[$i]['bf_file'][$k]);
|
||||
|
||||
sql_query(" delete from $write_table where wr_parent = '{$save[$i]['wr_id']}' ");
|
||||
sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_id = '{$save[$i]['wr_id']}' ");
|
||||
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$save[$i]['wr_id']}' ");
|
||||
}
|
||||
sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$save_count_write', bo_count_comment = bo_count_comment - '$save_count_comment' where bo_table = '$bo_table' ");
|
||||
}
|
||||
|
||||
// syndication ping
|
||||
if(G5_SYNDI_USE)
|
||||
include G5_SYNDI_PATH.'/include/include.bbs.move_update.php';
|
||||
|
||||
$msg = '해당 게시물을 선택한 게시판으로 '.$act.' 하였습니다.';
|
||||
$opener_href = './board.php?bo_table='.$bo_table.'&page='.$page.'&'.$qstr;
|
||||
|
||||
echo <<<HEREDOC
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<script>
|
||||
alert("$msg");
|
||||
opener.document.location.href = "$opener_href";
|
||||
window.close();
|
||||
</script>
|
||||
<noscript>
|
||||
<p>
|
||||
"$msg"
|
||||
</p>
|
||||
<a href="$opener_href">돌아가기</a>
|
||||
</noscript>
|
||||
HEREDOC;
|
||||
?>
|
||||
112
bbs/new.php
Normal file
112
bbs/new.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = '새글';
|
||||
include_once('./_head.php');
|
||||
|
||||
$sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b, {$g5['group_table']} c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = 1 ";
|
||||
|
||||
$gr_id = isset($_GET['gr_id']) ? $_GET['gr_id'] : "";
|
||||
if ($gr_id) {
|
||||
$sql_common .= " and b.gr_id = '$gr_id' ";
|
||||
}
|
||||
|
||||
$view = isset($_GET['view']) ? $_GET['view'] : "";
|
||||
|
||||
if ($view == "w")
|
||||
$sql_common .= " and a.wr_id = a.wr_parent ";
|
||||
else if ($view == "c")
|
||||
$sql_common .= " and a.wr_id <> a.wr_parent ";
|
||||
|
||||
$mb_id = isset($_GET['mb_id']) ? strip_tags($_GET['mb_id']) : "";
|
||||
if ($mb_id) {
|
||||
$sql_common .= " and a.mb_id = '{$mb_id}' ";
|
||||
}
|
||||
$sql_order = " order by a.bn_id desc ";
|
||||
|
||||
$sql = " select count(*) as cnt {$sql_common} ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = $config['cf_new_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
$group_select = '<label for="gr_id" class="sound_only">그룹</label><select name="gr_id" id="gr_id"><option value="">전체그룹';
|
||||
$sql = " select gr_id, gr_subject from {$g5['group_table']} order by gr_id ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$group_select .= "<option value=\"".$row['gr_id']."\">".$row['gr_subject'];
|
||||
}
|
||||
$group_select .= '</select>';
|
||||
|
||||
$list = array();
|
||||
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id {$sql_common} {$sql_order} limit {$from_record}, {$rows} ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$tmp_write_table = $g5['write_prefix'].$row['bo_table'];
|
||||
|
||||
if ($row['wr_id'] == $row['wr_parent']) {
|
||||
|
||||
// 원글
|
||||
$comment = "";
|
||||
$comment_link = "";
|
||||
$row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");
|
||||
$list[$i] = $row2;
|
||||
|
||||
$name = get_sideview($row2['mb_id'], cut_str($row2['wr_name'], $config['cf_cut_name']), $row2['wr_email'], $row2['wr_homepage']);
|
||||
// 당일인 경우 시간으로 표시함
|
||||
$datetime = substr($row2['wr_datetime'],0,10);
|
||||
$datetime2 = $row2['wr_datetime'];
|
||||
if ($datetime == G5_TIME_YMD) {
|
||||
$datetime2 = substr($datetime2,11,5);
|
||||
} else {
|
||||
$datetime2 = substr($datetime2,5,5);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// 코멘트
|
||||
$comment = '[코] ';
|
||||
$comment_link = '#c_'.$row['wr_id'];
|
||||
$row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_parent']}' ");
|
||||
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");
|
||||
$list[$i] = $row2;
|
||||
$list[$i]['wr_id'] = $row['wr_id'];
|
||||
$list[$i]['mb_id'] = $row3['mb_id'];
|
||||
$list[$i]['wr_name'] = $row3['wr_name'];
|
||||
$list[$i]['wr_email'] = $row3['wr_email'];
|
||||
$list[$i]['wr_homepage'] = $row3['wr_homepage'];
|
||||
|
||||
$name = get_sideview($row3['mb_id'], cut_str($row3['wr_name'], $config['cf_cut_name']), $row3['wr_email'], $row3['wr_homepage']);
|
||||
// 당일인 경우 시간으로 표시함
|
||||
$datetime = substr($row3['wr_datetime'],0,10);
|
||||
$datetime2 = $row3['wr_datetime'];
|
||||
if ($datetime == G5_TIME_YMD) {
|
||||
$datetime2 = substr($datetime2,11,5);
|
||||
} else {
|
||||
$datetime2 = substr($datetime2,5,5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$list[$i]['gr_id'] = $row['gr_id'];
|
||||
$list[$i]['bo_table'] = $row['bo_table'];
|
||||
$list[$i]['name'] = $name;
|
||||
$list[$i]['comment'] = $comment;
|
||||
$list[$i]['href'] = './board.php?bo_table='.$row['bo_table'].'&wr_id='.$row2['wr_id'].$comment_link;
|
||||
$list[$i]['datetime'] = $datetime;
|
||||
$list[$i]['datetime2'] = $datetime2;
|
||||
|
||||
$list[$i]['gr_subject'] = $row['gr_subject'];
|
||||
$list[$i]['bo_subject'] = $row['bo_subject'];
|
||||
$list[$i]['wr_subject'] = $row2['wr_subject'];
|
||||
}
|
||||
|
||||
$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "?gr_id=$gr_id&view=$view&mb_id=$mb_id&page=");
|
||||
|
||||
include_once($new_skin_path.'/new.skin.php');
|
||||
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
147
bbs/new_delete.php
Normal file
147
bbs/new_delete.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
//print_r2($_POST); exit;
|
||||
|
||||
if ($is_admin != 'super')
|
||||
alert("최고관리자만 접근이 가능합니다.");
|
||||
|
||||
$board = array();
|
||||
$save_bo_table = array();
|
||||
|
||||
for($i=0;$i<count($_POST['chk_bn_id']);$i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = $_POST['chk_bn_id'][$i];
|
||||
|
||||
$bo_table = $_POST['bo_table'][$k];
|
||||
$wr_id = $_POST['wr_id'][$k];
|
||||
|
||||
$save_bo_table[] = $bo_table;
|
||||
|
||||
$write_table = $g5['write_prefix'].$bo_table;
|
||||
|
||||
if ($board['bo_table'] != $bo_table)
|
||||
$board = sql_fetch(" select bo_subject, bo_write_point, bo_comment_point, bo_notice from {$g5['board_table']} where bo_table = '$bo_table' ");
|
||||
|
||||
$sql = " select * from $write_table where wr_id = '$wr_id' ";
|
||||
$write = sql_fetch($sql);
|
||||
if (!$write) continue;
|
||||
|
||||
// 원글 삭제
|
||||
if ($write['wr_is_comment']==0)
|
||||
{
|
||||
$len = strlen($write['wr_reply']);
|
||||
if ($len < 0) $len = 0;
|
||||
$reply = substr($write['wr_reply'], 0, $len);
|
||||
|
||||
// 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다.
|
||||
$sql = " select wr_id, mb_id, wr_is_comment from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id ";
|
||||
$result = sql_query($sql);
|
||||
while ($row = sql_fetch_array($result))
|
||||
{
|
||||
// 원글이라면
|
||||
if (!$row['wr_is_comment'])
|
||||
{
|
||||
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기'))
|
||||
insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글삭제");
|
||||
|
||||
// 업로드된 파일이 있다면 파일삭제
|
||||
$sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ";
|
||||
$result2 = sql_query($sql2);
|
||||
while ($row2 = sql_fetch_array($result2))
|
||||
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);
|
||||
|
||||
// 파일테이블 행 삭제
|
||||
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
|
||||
|
||||
$count_write++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 코멘트 포인트 삭제
|
||||
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '코멘트'))
|
||||
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 코멘트삭제");
|
||||
|
||||
$count_comment++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($pressed == '선택내용삭제') {
|
||||
// 게시글 내용만 삭제
|
||||
sql_query(" update $write_table set wr_subject = '{$g5['time_ymdhis']} - 본인 요청으로 인한 삭제 (냉무) ☆', wr_content = '', wr_name='본인요청삭제☆' where wr_id = '{$write['wr_id']}' ");
|
||||
} else {
|
||||
// 게시글 삭제
|
||||
sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' ");
|
||||
}
|
||||
|
||||
// 최근게시물 삭제
|
||||
sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' ");
|
||||
|
||||
// 스크랩 삭제
|
||||
sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' ");
|
||||
|
||||
// 공지사항 삭제
|
||||
$notice_array = explode(",", trim($board['bo_notice']));
|
||||
$bo_notice = "";
|
||||
$lf = '';
|
||||
for ($k=0; $k<count($notice_array); $k++) {
|
||||
if ((int)$write['wr_id'] != (int)$notice_array[$k])
|
||||
$bo_notice .= $nl.$notice_array[$k];
|
||||
|
||||
if($bo_notice)
|
||||
$lf = ',';
|
||||
}
|
||||
$bo_notice = trim($bo_notice);
|
||||
sql_query(" update {$g5['board_table']} set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");
|
||||
|
||||
if ($pressed == '선택삭제') {
|
||||
// 글숫자 감소
|
||||
if ($count_write > 0 || $count_comment > 0) {
|
||||
sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
else // 코멘트 삭제
|
||||
{
|
||||
//--------------------------------------------------------------------
|
||||
// 코멘트 삭제시 답변 코멘트 까지 삭제되지는 않음
|
||||
//--------------------------------------------------------------------
|
||||
//print_r2($write);
|
||||
|
||||
$comment_id = $wr_id;
|
||||
|
||||
$len = strlen($write['wr_comment_reply']);
|
||||
if ($len < 0) $len = 0;
|
||||
$comment_reply = substr($write['wr_comment_reply'], 0, $len);
|
||||
|
||||
// 코멘트 삭제
|
||||
if (!delete_point($write['mb_id'], $bo_table, $comment_id, '코멘트')) {
|
||||
insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write[wr_parent]}-{$comment_id} 코멘트삭제");
|
||||
}
|
||||
|
||||
// 코멘트 삭제
|
||||
sql_query(" delete from $write_table where wr_id = '$comment_id' ");
|
||||
|
||||
// 코멘트가 삭제되므로 해당 게시물에 대한 최근 시간을 다시 얻는다.
|
||||
$sql = " select max(wr_datetime) as wr_last from $write_table where wr_parent = '{$write['wr_parent']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
// 원글의 코멘트 숫자를 감소
|
||||
sql_query(" update $write_table set wr_comment = wr_comment - 1, wr_last = '$row[wr_last]' where wr_id = '{$write['wr_parent']}' ");
|
||||
|
||||
// 코멘트 숫자 감소
|
||||
sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment - 1 where bo_table = '$bo_table' ");
|
||||
|
||||
// 새글 삭제
|
||||
sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_id = '$comment_id' ");
|
||||
}
|
||||
}
|
||||
|
||||
$save_bo_table = array_unique($save_bo_table);
|
||||
foreach ($save_bo_table as $key=>$value) {
|
||||
delete_cache_latest($value);
|
||||
}
|
||||
|
||||
goto_url("new.php?sfl=$sfl&stx=$stx&page=$page");
|
||||
?>
|
||||
56
bbs/newwin.inc.php
Normal file
56
bbs/newwin.inc.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$sql = " select * from {$g5['new_win_table']}
|
||||
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
|
||||
and nw_device IN ( 'both', 'pc' )
|
||||
order by nw_id asc ";
|
||||
$result = sql_query($sql, false);
|
||||
?>
|
||||
|
||||
<!-- 팝업레이어 시작 { -->
|
||||
<div id="hd_pop">
|
||||
<h2>팝업레이어 알림</h2>
|
||||
|
||||
<?php
|
||||
for ($i=0; $row_nw=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 이미 체크 되었다면 Continue
|
||||
if ($_COOKIE["hd_pops_{$row_nw['nw_id']}"])
|
||||
continue;
|
||||
|
||||
$sql = " select * from {$g5['new_win_table']} where nw_id = '{$row_nw['nw_id']}' ";
|
||||
$nw = sql_fetch($sql);
|
||||
?>
|
||||
|
||||
<div id="hd_pops_<?php echo $nw['nw_id'] ?>" class="hd_pops" style="top:<?php echo $nw['nw_top']?>px;left:<?php echo $nw['nw_left']?>px">
|
||||
<div class="hd_pops_con" style="width:<?php echo $nw['nw_width'] ?>px;height:<?php echo $nw['nw_height'] ?>px">
|
||||
<?php echo conv_content($nw['nw_content'], 1); ?>
|
||||
</div>
|
||||
<div class="hd_pops_footer">
|
||||
<button class="hd_pops_reject hd_pops_<?php echo $nw['nw_id']; ?> <?php echo $nw['nw_disable_hours']; ?>"><strong><?php echo $nw['nw_disable_hours']; ?></strong>시간 동안 다시 열람하지 않습니다.</button>
|
||||
<button class="hd_pops_close hd_pops_<?php echo $nw['nw_id']; ?>">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
if ($i == 0) echo '<span class="sound_only">팝업레이어 알림이 없습니다.</span>';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$(".hd_pops_reject").click(function() {
|
||||
var id = $(this).attr('class').split(' ');
|
||||
var ck_name = id[1];
|
||||
var exp_time = parseInt(id[2]);
|
||||
$("#"+id[1]).css("display", "none");
|
||||
set_cookie(ck_name, 1, exp_time, g5_cookie_domain);
|
||||
});
|
||||
$('.hd_pops_close').click(function() {
|
||||
var idb = $(this).attr('class').split(' ');
|
||||
$('#'+idb[1]).css('display','none');
|
||||
});
|
||||
$("#hd").css("z-index", 1000);
|
||||
});
|
||||
</script>
|
||||
<!-- } 팝업레이어 끝 -->
|
||||
53
bbs/password.php
Normal file
53
bbs/password.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = '비밀번호 입력';
|
||||
|
||||
switch ($w) {
|
||||
case 'u' :
|
||||
$action = './write.php';
|
||||
$return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id;
|
||||
break;
|
||||
case 'd' :
|
||||
$action = './delete.php';
|
||||
$return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id;
|
||||
break;
|
||||
case 'x' :
|
||||
$action = './delete_comment.php';
|
||||
$row = sql_fetch(" select wr_parent from $write_table where wr_id = '$comment_id' ");
|
||||
$return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$row['wr_parent'];
|
||||
break;
|
||||
case 's' :
|
||||
// 비밀번호 창에서 로그인 하는 경우 관리자 또는 자신의 글이면 바로 글보기로 감
|
||||
if ($is_admin || ($member['mb_id'] == $write['mb_id'] && $write['mb_id']))
|
||||
goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id);
|
||||
else {
|
||||
$action = './password_check.php';
|
||||
$return_url = './board.php?bo_table='.$bo_table;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
//if ($board['bo_include_head']) { @include ($board['bo_include_head']); }
|
||||
//if ($board['bo_content_head']) { echo stripslashes($board['bo_content_head']); }
|
||||
|
||||
/* 비밀글의 제목을 가져옴 지운아빠 2013-01-29 */
|
||||
$sql = " select wr_subject from {$write_table}
|
||||
where wr_num = '{$write['wr_num']}'
|
||||
and wr_reply = ''
|
||||
and wr_is_comment = 0 ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$g5['title'] = $row['wr_subject'];
|
||||
|
||||
include_once($member_skin_path.'/password.skin.php');
|
||||
|
||||
//if ($board['bo_content_tail']) { echo stripslashes($board['bo_content_tail']); }
|
||||
//if ($board['bo_include_tail']) { @include ($board['bo_include_tail']); }
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
22
bbs/password_check.php
Normal file
22
bbs/password_check.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($w == 's') {
|
||||
$qstr = 'bo_table='.$bo_table.'&sfl='.$sfl.'&stx='.$stx.'&sop='.$sop.'&wr_id='.$wr_id.'&page='.$page;
|
||||
|
||||
$wr = get_write($write_table, $wr_id);
|
||||
|
||||
if (sql_password($wr_password) != $wr['wr_password'])
|
||||
alert('비밀번호가 틀립니다.');
|
||||
|
||||
// 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임.
|
||||
//$ss_name = 'ss_secret.'_'.$bo_table.'_'.$wr_id';
|
||||
$ss_name = 'ss_secret_'.$bo_table.'_'.$wr['wr_num'];
|
||||
//set_session("ss_secret", "$bo_table|$wr[wr_num]");
|
||||
set_session($ss_name, TRUE);
|
||||
|
||||
} else
|
||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
goto_url('./board.php?'.$qstr);
|
||||
?>
|
||||
16
bbs/password_lost.php
Normal file
16
bbs/password_lost.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
if ($is_member) {
|
||||
alert("이미 로그인중입니다.");
|
||||
}
|
||||
|
||||
$g5['title'] = '회원정보 찾기';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$action_url = G5_HTTPS_BBS_URL."/password_lost2.php";
|
||||
include_once($member_skin_path.'/password_lost.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
72
bbs/password_lost2.php
Normal file
72
bbs/password_lost2.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
if ($is_member) {
|
||||
alert('이미 로그인중입니다.');
|
||||
}
|
||||
|
||||
if (!chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
$email = trim($_POST['mb_email']);
|
||||
|
||||
if (!$email)
|
||||
alert_close('메일주소 오류입니다.');
|
||||
|
||||
$sql = " select count(*) as cnt from {$g5['member_table']} where mb_email = '$email' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt'] > 1)
|
||||
alert('동일한 메일주소가 2개 이상 존재합니다.\\n\\n관리자에게 문의하여 주십시오.');
|
||||
|
||||
$sql = " select mb_no, mb_id, mb_name, mb_nick, mb_email, mb_datetime from {$g5['member_table']} where mb_email = '$email' ";
|
||||
$mb = sql_fetch($sql);
|
||||
if (!$mb['mb_id'])
|
||||
alert('존재하지 않는 회원입니다.');
|
||||
else if (is_admin($mb['mb_id']))
|
||||
alert('관리자 아이디는 접근 불가합니다.');
|
||||
|
||||
// 난수 발생
|
||||
srand(time());
|
||||
$change_password = rand(100000, 999999);
|
||||
$mb_lost_certify = sql_password($change_password);
|
||||
$mb_datetime = sql_password($mb['mb_datetime']);
|
||||
|
||||
$sql = " update {$g5['member_table']} set mb_lost_certify = '$mb_lost_certify' where mb_id = '{$mb['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
$href = G5_BBS_URL.'/password_lost_certify.php?mb_no='.$mb['mb_no'].'&mb_datetime='.$mb_datetime.'&mb_lost_certify='.$mb_lost_certify;
|
||||
|
||||
$subject = "[".$config['cf_title']."] 요청하신 회원정보 찾기 안내 메일입니다.";
|
||||
|
||||
$content = "";
|
||||
|
||||
$content .= '<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">';
|
||||
$content .= '<div style="border:1px solid #dedede">';
|
||||
$content .= '<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">';
|
||||
$content .= '회원정보 찾기 안내';
|
||||
$content .= '</h1>';
|
||||
$content .= '<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">';
|
||||
$content .= '<a href="'.G5_URL.'" target="_blank">'.$config['cf_title'].'</a>';
|
||||
$content .= '</span>';
|
||||
$content .= '<p style="margin:20px 0 0;padding:30px 30px 30px;border-bottom:1px solid #eee;line-height:1.7em">';
|
||||
$content .= addslashes($mb['mb_name'])." (".addslashes($mb['mb_nick']).")"." 회원님은 ".G5_TIME_YMDHIS." 에 회원정보 찾기 요청을 하셨습니다.<br>";
|
||||
$content .= '저희 사이트는 관리자라도 회원님의 비밀번호를 알 수 없기 때문에, 비밀번호를 알려드리는 대신 새로운 비밀번호를 생성하여 안내 해드리고 있습니다.<br>';
|
||||
$content .= '아래에서 변경될 비밀번호를 확인하신 후, <span style="color:#ff3061"><strong>비밀번호 변경</strong> 링크를 클릭 하십시오.</span><br>';
|
||||
$content .= '비밀번호가 변경되었다는 인증 메세지가 출력되면, 홈페이지에서 회원아이디와 변경된 비밀번호를 입력하시고 로그인 하십시오.<br>';
|
||||
$content .= '로그인 후에는 정보수정 메뉴에서 새로운 비밀번호로 변경해 주십시오.';
|
||||
$content .= '</p>';
|
||||
$content .= '<p style="margin:0;padding:30px 30px 30px;border-bottom:1px solid #eee;line-height:1.7em">';
|
||||
$content .= '<span style="display:inline-block;width:100px">회원아이디</span> '.$mb['mb_id'].'<br>';
|
||||
$content .= '<span style="display:inline-block;width:100px">변경될 비밀번호</span> <strong style="color:#ff3061">'.$change_password.'</strong>';
|
||||
$content .= '</p>';
|
||||
$content .= '<a href="'.$href.'" target="_blank" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center">비밀번호 변경</a>';
|
||||
$content .= '</div>';
|
||||
$content .= '</div>';
|
||||
|
||||
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb['mb_email'], $subject, $content, 1);
|
||||
|
||||
alert_close($email.' 메일로 회원아이디와 비밀번호를 인증할 수 있는 메일이 발송 되었습니다.\\n\\n메일을 확인하여 주십시오.');
|
||||
?>
|
||||
27
bbs/password_lost_certify.php
Normal file
27
bbs/password_lost_certify.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 오류시 공히 Error 라고 처리하는 것은 회원정보가 있는지? 비밀번호가 틀린지? 를 알아보려는 해킹에 대비한것
|
||||
|
||||
$mb_no = trim($_GET['mb_no']);
|
||||
$mb_datetime = trim($_GET['mb_datetime']);
|
||||
$mb_lost_certify = trim($_GET['mb_lost_certify']);
|
||||
|
||||
// 회원아이디가 아닌 회원고유번호로 회원정보를 구한다.
|
||||
$sql = " select mb_id, mb_datetime, mb_lost_certify from {$g5['member_table']} where mb_no = '$mb_no' ";
|
||||
$mb = sql_fetch($sql);
|
||||
if (!trim($mb['mb_lost_certify']))
|
||||
die("Error");
|
||||
|
||||
// 인증 링크는 한번만 처리가 되게 한다.
|
||||
sql_query(" update {$g5['member_table']} set mb_lost_certify = '' where mb_no = '$mb_no' ");
|
||||
|
||||
// 변경될 비밀번호가 넘어와야하고 저장된 변경비밀번호를 md5 로 변환하여 같으면 정상
|
||||
if ($mb_lost_certify && $mb_datetime === sql_password($mb['mb_datetime']) && $mb_lost_certify === $mb['mb_lost_certify']) {
|
||||
sql_query(" update {$g5['member_table']} set mb_password = '{$mb['mb_lost_certify']}' where mb_no = '$mb_no' ");
|
||||
alert('비밀번호가 변경됐습니다.\\n\\n회원아이디와 변경된 비밀번호로 로그인 하시기 바랍니다.', G5_BBS_URL.'/login.php');
|
||||
}
|
||||
else {
|
||||
die("Error");
|
||||
}
|
||||
?>
|
||||
27
bbs/point.php
Normal file
27
bbs/point.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_guest)
|
||||
alert_close('회원만 조회하실 수 있습니다.');
|
||||
|
||||
$g5['title'] = $member['mb_nick'].' 님의 포인트 내역';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$list = array();
|
||||
|
||||
$sql_common = " from {$g5['point_table']} where mb_id = '".escape_trim($member['mb_id'])."' ";
|
||||
$sql_order = " order by po_id desc ";
|
||||
|
||||
$sql = " select count(*) as cnt {$sql_common} ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
include_once($member_skin_path.'/point.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
55
bbs/poll_etc_update.php
Normal file
55
bbs/poll_etc_update.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
if ($w == '')
|
||||
{
|
||||
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '{$po_id}' ");
|
||||
if (!$po[po_id])
|
||||
alert('po_id 값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
$tmp_row = sql_fetch(" select max(pc_id) as max_pc_id from {$g5['poll_etc_table']} ");
|
||||
$pc_id = $tmp_row['max_pc_id'] + 1;
|
||||
|
||||
$sql = " insert into {$g5['poll_etc_table']}
|
||||
( pc_id, po_id, mb_id, pc_name, pc_idea, pc_datetime )
|
||||
values ( '{$pc_id}', '{$po_id}', '{$member['mb_id']}', '{$pc_name}', '{$pc_idea}', '".G5_TIME_YMDHIS."' ) ";
|
||||
sql_query($sql);
|
||||
|
||||
$pc_idea = stripslashes($pc_idea);
|
||||
|
||||
$name = cut_str($pc_name, $config['cf_cut_name']);
|
||||
$mb_id = '';
|
||||
if ($member['mb_id'])
|
||||
$mb_id = '('.$member['mb_id'].')';
|
||||
|
||||
// 환경설정의 투표 기타의견 작성시 최고관리자에게 메일발송 사용에 체크되어 있을 경우
|
||||
if ($config['cf_email_po_super_admin'])
|
||||
{
|
||||
$subject = $po['po_subject'];
|
||||
$content = $pc_idea;
|
||||
|
||||
ob_start();
|
||||
include_once ('./poll_etc_update_mail.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
// 관리자에게 보내는 메일
|
||||
$admin = get_admin('super');
|
||||
$from_email = $member['mb_email'] ? $member['mb_email'] : $admin['mb_email'];
|
||||
mailer($name, $from_email, $admin['mb_email'], '['.$config['cf_title'].'] 설문조사 기타의견 메일', $content, 1);
|
||||
}
|
||||
}
|
||||
else if ($w == 'd')
|
||||
{
|
||||
if ($member['mb_id'] || $is_admin == 'super')
|
||||
{
|
||||
$sql = " delete from {$g5['poll_etc_table']} where pc_id = '{$pc_id}' ";
|
||||
if (!$is_admin)
|
||||
$sql .= " and mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
goto_url('./poll_result.php?po_id='.$po_id.'&skin_dir='.$skin_dir);
|
||||
?>
|
||||
30
bbs/poll_etc_update_mail.php
Normal file
30
bbs/poll_etc_update_mail.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// 설문조사 기타의견 입력시 관리자께 보내는 메일을 수정하고 싶으시다면 이 파일을 수정하십시오.
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>설문조사 기타의견 메일</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">
|
||||
<div style="border:1px solid #dedede">
|
||||
<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">
|
||||
<?php echo $subject ?>
|
||||
</h1>
|
||||
<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">
|
||||
작성자 <?php echo $name ?> (<?php echo $mb_id ?>)
|
||||
</span>
|
||||
<p style="margin:20px 0 0;padding:30px 30px 50px;min-height:200px;height:auto !important;height:200px;border-bottom:1px solid #eee">
|
||||
<?php echo $content ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
102
bbs/poll_result.php
Normal file
102
bbs/poll_result.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '{$po_id}' ");
|
||||
if (!$po['po_id'])
|
||||
alert('설문조사 정보가 없습니다.');
|
||||
|
||||
if ($member['mb_level'] < $po['po_level'])
|
||||
alert('권한 '.$po['po_level'].' 이상의 회원만 결과를 보실 수 있습니다.');
|
||||
|
||||
$g5['title'] = '설문조사 결과';
|
||||
|
||||
$po_subject = $po['po_subject'];
|
||||
|
||||
$max = 1;
|
||||
$total_po_cnt = 0;
|
||||
for ($i=1; $i<=9; $i++) {
|
||||
$poll = $po['po_poll'.$i];
|
||||
if ($poll == '') break;
|
||||
|
||||
$count = $po['po_cnt'.$i];
|
||||
$total_po_cnt += $count;
|
||||
|
||||
if ($count > $max)
|
||||
$max = $count;
|
||||
}
|
||||
$nf_total_po_cnt = number_format($total_po_cnt);
|
||||
|
||||
$list = array();
|
||||
|
||||
for ($i=1; $i<=9; $i++) {
|
||||
$poll = $po['po_poll'.$i];
|
||||
if ($poll == '') { break; }
|
||||
|
||||
$list[$i]['content'] = $poll;
|
||||
$list[$i]['cnt'] = $po['po_cnt'.$i];
|
||||
if ($total_po_cnt > 0)
|
||||
$list[$i]['rate'] = ($list[$i]['cnt'] / $total_po_cnt) * 100;
|
||||
|
||||
$bar = (int)($list[$i]['cnt'] / $max * 100);
|
||||
|
||||
$list[$i]['bar'] = $bar;
|
||||
$list[$i]['num'] = $i;
|
||||
}
|
||||
|
||||
$list2 = array();
|
||||
|
||||
// 기타의견 리스트
|
||||
$sql = " select a.*, b.mb_open
|
||||
from {$g5['poll_etc_table']} a
|
||||
left join {$g5['member_table']} b on (a.mb_id = b.mb_id)
|
||||
where po_id = '{$po_id}' order by pc_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$list2[$i]['pc_name'] = $row['pc_name'];
|
||||
$list2[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['pc_name'],10), '', '', $row['mb_open']);
|
||||
$list2[$i]['idea'] = get_text(cut_str($row['pc_idea'], 255));
|
||||
$list2[$i]['datetime'] = $row['pc_datetime'];
|
||||
|
||||
$list2[$i]['del'] = '';
|
||||
if ($is_admin == 'super' || ($row['mb_id'] == $member['mb_id'] && $row['mb_id']))
|
||||
$list2[$i]['del'] = '<a href="'.G5_BBS_URL.'/poll_etc_update.php?w=d&pc_id='.$row['pc_id'].'&po_id='.$po_id.'&skin_dir='.$skin_dir.'" class="poll_delete">';
|
||||
}
|
||||
|
||||
// 기타의견 입력
|
||||
$is_etc = false;
|
||||
if ($po['po_etc']) {
|
||||
$is_etc = true;
|
||||
$po_etc = $po['po_etc'];
|
||||
if ($member['mb_id'])
|
||||
$name = '<b>'.$member['mb_nick'].'</b> <input type="hidden" name="pc_name" value="'.$member['mb_nick'].'">';
|
||||
else
|
||||
$name = '<input type="text" name="pc_name" size="10" class="input" required>';
|
||||
}
|
||||
|
||||
$list3 = array();
|
||||
|
||||
// 다른투표
|
||||
$sql = " select po_id, po_subject, po_date from {$g5['poll_table']} order by po_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row2=sql_fetch_array($result); $i++) {
|
||||
$list3[$i]['po_id'] = $row2['po_id'];
|
||||
$list3[$i]['date'] = substr($row2['po_date'],2,8);
|
||||
$list3[$i]['subject'] = cut_str($row2['po_subject'],60,"…");
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
} else {
|
||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if (!file_exists($poll_skin_path.'/poll_result.skin.php')) die('skin error');
|
||||
include_once ($poll_skin_path.'/poll_result.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
60
bbs/poll_update.php
Normal file
60
bbs/poll_update.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '{$_POST['po_id']}' ");
|
||||
if (!$po['po_id'])
|
||||
alert('po_id 값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
if ($member['mb_level'] < $po['po_level'])
|
||||
alert_close('권한 '.$po['po_level'].' 이상 회원만 투표에 참여하실 수 있습니다.');
|
||||
|
||||
if(!$gb_poll)
|
||||
alert_close('항목을 선택하세요.');
|
||||
|
||||
$search_mb_id = false;
|
||||
$search_ip = false;
|
||||
|
||||
if($is_member) {
|
||||
// 투표했던 회원아이디들 중에서 찾아본다
|
||||
$ids = explode(',', trim($po['mb_ids']));
|
||||
for ($i=0; $i<count($ids); $i++) {
|
||||
if ($member['mb_id'] == trim($ids[$i])) {
|
||||
$search_mb_id = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 투표했던 ip들 중에서 찾아본다
|
||||
$ips = explode(',', trim($po['po_ips']));
|
||||
for ($i=0; $i<count($ips); $i++) {
|
||||
if ($_SERVER['REMOTE_ADDR'] == trim($ips[$i])) {
|
||||
$search_ip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result_url = G5_BBS_URL."/poll_result.php?po_id=$po_id&skin_dir={$_POST['skin_dir']}";
|
||||
|
||||
// 없다면 선택한 투표항목을 1증가 시키고 ip, id를 저장
|
||||
if (!($search_ip || $search_mb_id)) {
|
||||
$po_ips = $po['po_ips'] . $_SERVER['REMOTE_ADDR'].",";
|
||||
$mb_ids = $po['mb_ids'];
|
||||
if ($is_member) { // 회원일 때는 id만 추가
|
||||
$mb_ids .= $member['mb_id'].',';
|
||||
$sql = " update {$g5['poll_table']} set po_cnt{$gb_poll} = po_cnt{$gb_poll} + 1, mb_ids = '$mb_ids' where po_id = '$po_id' ";
|
||||
} else {
|
||||
$sql = " update {$g5['poll_table']} set po_cnt{$gb_poll} = po_cnt{$gb_poll} + 1, po_ips = '$po_ips' where po_id = '$po_id' ";
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
} else {
|
||||
alert($po['po_subject'].'에 이미 참여하셨습니다.', $result_url);
|
||||
}
|
||||
|
||||
if (!$search_mb_id)
|
||||
insert_point($member['mb_id'], $po['po_point'], $po['po_id'] . '. ' . cut_str($po['po_subject'],20) . ' 투표 참여 ', '@poll', $po['po_id'], '투표');
|
||||
|
||||
//goto_url($g5['bbs_url'].'/poll_result.php?po_id='.$po_id.'&skin_dir='.$skin_dir);
|
||||
goto_url($result_url);
|
||||
?>
|
||||
33
bbs/profile.php
Normal file
33
bbs/profile.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$member['mb_id'])
|
||||
alert_close('회원만 이용하실 수 있습니다.');
|
||||
|
||||
if (!$member['mb_open'] && $is_admin != 'super' && $member['mb_id'] != $mb_id)
|
||||
alert_close('자신의 정보를 공개하지 않으면 다른분의 정보를 조회할 수 없습니다.\\n\\n정보공개 설정은 회원정보수정에서 하실 수 있습니다.');
|
||||
|
||||
$mb = get_member($mb_id);
|
||||
if (!$mb['mb_id'])
|
||||
alert_close('회원정보가 존재하지 않습니다.\\n\\n탈퇴하였을 수 있습니다.');
|
||||
|
||||
if (!$mb['mb_open'] && $is_admin != 'super' && $member['mb_id'] != $mb_id)
|
||||
alert_close('정보공개를 하지 않았습니다.');
|
||||
|
||||
$g5['title'] = $mb['mb_nick'].'님의 자기소개';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$mb_nick = get_sideview($mb['mb_id'], $mb['mb_nick'], $mb['mb_email'], $mb['mb_homepage'], $mb['mb_open']);
|
||||
|
||||
// 회원가입후 몇일째인지? + 1 은 당일을 포함한다는 뜻
|
||||
$sql = " select (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS('{$mb['mb_datetime']}') + 1) as days ";
|
||||
$row = sql_fetch($sql);
|
||||
$mb_reg_after = $row['days'];
|
||||
|
||||
$mb_homepage = set_http($mb['mb_homepage']);
|
||||
$mb_profile = $mb['mb_profile'] ? conv_content($mb['mb_profile'],0) : '소개 내용이 없습니다.';
|
||||
|
||||
include_once($member_skin_path.'/profile.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
68
bbs/qadelete.php
Normal file
68
bbs/qadelete.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if($is_guest)
|
||||
alert('회원이시라면 로그인 후 이용해 주십시오.', G5_URL);
|
||||
|
||||
$tmp_array = array();
|
||||
if ($qa_id) // 건별삭제
|
||||
$tmp_array[0] = $qa_id;
|
||||
else // 일괄삭제
|
||||
$tmp_array = $_POST['chk_qa_id'];
|
||||
|
||||
$count = count($tmp_array);
|
||||
if(!$count)
|
||||
alert('삭제할 게시글을 하나이상 선택해 주십시오.');
|
||||
|
||||
for($i=0; $i<$count; $i++) {
|
||||
$qa_id = $tmp_array[$i];
|
||||
|
||||
$sql = " select qa_id, qa_type, qa_status, qa_parent, qa_content, qa_file1, qa_file2
|
||||
from {$g5['qa_content_table']}
|
||||
where qa_id = '$qa_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['qa_id'])
|
||||
continue;
|
||||
|
||||
// 첨부파일 삭제
|
||||
for($k=1; $k<=2; $k++) {
|
||||
@unlink(G5_DATA_PATH.'/qa/'.$row['qa_file'.$k]);
|
||||
// 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['qa_file'.$k])) {
|
||||
delete_qa_thumbnail($row['qa_file'.$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// 에디터 썸네일 삭제
|
||||
delete_editor_thumbnail($row['qa_content']);
|
||||
|
||||
// 답변이 있는 질문글이라면 답변글 삭제
|
||||
if(!$row['qa_type'] && $row['qa_status']) {
|
||||
$row2 = sql_fetch(" select qa_content, qa_file1, qa_file2 from {$g5['qa_content_table']} where qa_parent = '$qa_id' ");
|
||||
// 첨부파일 삭제
|
||||
for($k=1; $k<=2; $k++) {
|
||||
@unlink(G5_DATA_PATH.'/qa/'.$row2['qa_file'.$k]);
|
||||
// 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['qa_file'.$k])) {
|
||||
delete_qa_thumbnail($row2['qa_file'.$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// 에디터 썸네일 삭제
|
||||
delete_editor_thumbnail($row2['qa_content']);
|
||||
|
||||
sql_query(" delete from {$g5['qa_content_table']} where qa_type = '1' and qa_parent = '$qa_id' ");
|
||||
}
|
||||
|
||||
// 답변글 삭제시 질문글의 상태변경
|
||||
if($row['qa_type']) {
|
||||
sql_query(" update {$g5['qa_content_table']} set qa_status = '0' where qa_id = '{$row['qa_parent']}' ");
|
||||
}
|
||||
|
||||
// 글삭제
|
||||
sql_query(" delete from {$g5['qa_content_table']} where qa_id = '$qa_id' ");
|
||||
}
|
||||
|
||||
goto_url(G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr));
|
||||
?>
|
||||
70
bbs/qadownload.php
Normal file
70
bbs/qadownload.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// clean the output buffer
|
||||
ob_end_clean();
|
||||
|
||||
$no = (int)$no;
|
||||
|
||||
// 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생
|
||||
// 다른곳에서 링크 거는것을 방지하기 위한 코드
|
||||
if (!get_session('ss_qa_view_'.$qa_id))
|
||||
alert('잘못된 접근입니다.');
|
||||
|
||||
$sql = " select qa_subject, qa_file{$no}, qa_source{$no} from {$g5['qa_content_table']} where qa_id = '$qa_id' ";
|
||||
$file = sql_fetch($sql);
|
||||
if (!$file['qa_file'.$no])
|
||||
alert_close('파일 정보가 존재하지 않습니다.');
|
||||
|
||||
if($is_guest) {
|
||||
alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?url='.urlencode(G5_BBS_URL.'/qaview.php?qa_id='.$qa_id));
|
||||
}
|
||||
|
||||
$filepath = G5_DATA_PATH.'/qa/'.$file['qa_file'.$no];
|
||||
$filepath = addslashes($filepath);
|
||||
if (!is_file($filepath) || !file_exists($filepath))
|
||||
alert('파일이 존재하지 않습니다.');
|
||||
|
||||
$g5['title'] = '다운로드 > '.conv_subject($file['qa_subject'], 255);
|
||||
|
||||
$original = urlencode($file['qa_source'.$no]);
|
||||
|
||||
if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
header("content-type: doesn/matter");
|
||||
header("content-length: ".filesize("$filepath"));
|
||||
header("content-disposition: attachment; filename=\"$original\"");
|
||||
header("content-transfer-encoding: binary");
|
||||
} else {
|
||||
header("content-type: file/unknown");
|
||||
header("content-length: ".filesize("$filepath"));
|
||||
header("content-disposition: attachment; filename=\"$original\"");
|
||||
header("content-description: php generated data");
|
||||
}
|
||||
header("pragma: no-cache");
|
||||
header("expires: 0");
|
||||
flush();
|
||||
|
||||
$fp = fopen($filepath, 'rb');
|
||||
|
||||
// 4.00 대체
|
||||
// 서버부하를 줄이려면 print 나 echo 또는 while 문을 이용한 방법보다는 이방법이...
|
||||
//if (!fpassthru($fp)) {
|
||||
// fclose($fp);
|
||||
//}
|
||||
|
||||
$download_rate = 10;
|
||||
|
||||
while(!feof($fp)) {
|
||||
//echo fread($fp, 100*1024);
|
||||
/*
|
||||
echo fread($fp, 100*1024);
|
||||
flush();
|
||||
*/
|
||||
|
||||
print fread($fp, round($download_rate * 1024));
|
||||
flush();
|
||||
usleep(1000);
|
||||
}
|
||||
fclose ($fp);
|
||||
flush();
|
||||
?>
|
||||
18
bbs/qahead.php
Normal file
18
bbs/qahead.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$qa_skin_path = (G5_IS_MOBILE ? G5_MOBILE_PATH : G5_PATH).'/'.G5_SKIN_DIR.'/qa/'.$qaconfig['qa_skin'];
|
||||
$qa_skin_url = (G5_IS_MOBILE ? G5_MOBILE_URL : G5_URL).'/'.G5_SKIN_DIR.'/qa/'.$qaconfig['qa_skin'];
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
include_once('./_head.php');
|
||||
echo stripslashes($qaconfig['qa_mobile_content_head']);
|
||||
} else {
|
||||
if($qaconfig['qa_include_head'])
|
||||
@include ($qaconfig['qa_include_head']);
|
||||
else
|
||||
include ('./_head.php');
|
||||
echo stripslashes($qaconfig['qa_content_head']);
|
||||
}
|
||||
?>
|
||||
122
bbs/qalist.php
Normal file
122
bbs/qalist.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if($is_guest)
|
||||
alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qalist.php'));
|
||||
|
||||
$qaconfig = get_qa_config();
|
||||
|
||||
$g5['title'] = $qaconfig['qa_title'];
|
||||
include_once('./qahead.php');
|
||||
|
||||
$skin_file = $qa_skin_path.'/list.skin.php';
|
||||
|
||||
$category_option = '';
|
||||
if ($qaconfig['qa_category']) {
|
||||
$category_href = G5_BBS_URL.'/qalist.php';
|
||||
|
||||
$category_option .= '<li><a href="'.$category_href.'"';
|
||||
if ($sca=='')
|
||||
$category_option .= ' id="bo_cate_on"';
|
||||
$category_option .= '>전체</a></li>';
|
||||
|
||||
$categories = explode('|', $qaconfig['qa_category']); // 구분자가 | 로 되어 있음
|
||||
for ($i=0; $i<count($categories); $i++) {
|
||||
$category = trim($categories[$i]);
|
||||
if ($category=='') continue;
|
||||
$category_msg = '';
|
||||
$category_option .= '<li><a href="'.($category_href."?sca=".urlencode($category)).'"';
|
||||
if ($category==$sca) { // 현재 선택된 카테고리라면
|
||||
$category_option .= ' id="bo_cate_on"';
|
||||
$category_msg = '<span class="sound_only">열린 분류 </span>';
|
||||
}
|
||||
$category_option .= '>'.$category_msg.$category.'</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_file($skin_file)) {
|
||||
$sql_common = " from {$g5['qa_content_table']} ";
|
||||
$sql_search = " where qa_type = '0' ";
|
||||
|
||||
if(!$is_admin)
|
||||
$sql_search .= " and mb_id = '{$member['mb_id']}' ";
|
||||
|
||||
if($sca) {
|
||||
if (preg_match("/[a-zA-Z]/", $sca))
|
||||
$sql_search .= " and INSTR(LOWER(qa_category), LOWER('$sca')) > 0 ";
|
||||
else
|
||||
$sql_search .= " and INSTR(qa_category, '$sca') > 0 ";
|
||||
}
|
||||
|
||||
$stx = trim($stx);
|
||||
if($stx) {
|
||||
if (preg_match("/[a-zA-Z]/", $stx))
|
||||
$sql_search .= " and ( INSTR(LOWER(qa_subject), LOWER('$stx')) > 0 or INSTR(LOWER(qa_content), LOWER('$stx')) > 0 )";
|
||||
else
|
||||
$sql_search .= " and ( INSTR(qa_subject, '$stx') > 0 or INSTR(qa_content, '$stx') > 0 ) ";
|
||||
}
|
||||
|
||||
$sql_order = " order by qa_num ";
|
||||
|
||||
$sql = " select count(*) as cnt
|
||||
$sql_common
|
||||
$sql_search ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$page_rows = G5_IS_MOBILE ? $qaconfig['qa_mobile_page_rows'] : $qaconfig['qa_page_rows'];
|
||||
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $page_rows; // 시작 열을 구함
|
||||
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order
|
||||
limit $from_record, $page_rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$list = array();
|
||||
$num = $total_count - ($page - 1) * $page_rows;
|
||||
$subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len'];
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$list[$i] = $row;
|
||||
|
||||
$list[$i]['category'] = get_text($row['qa_category']);
|
||||
$list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
|
||||
if ($stx) {
|
||||
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
|
||||
}
|
||||
|
||||
$list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr;
|
||||
|
||||
$list[$i]['icon_file'] = '';
|
||||
if(trim($row['qa_file1']) || trim($row['qa_file2']))
|
||||
$list[$i]['icon_file'] = '<img src="'.$qa_skin_url.'/img/icon_file.gif">';
|
||||
|
||||
$list[$i]['name'] = get_text($row['qa_name']);
|
||||
$list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
|
||||
|
||||
$list[$i]['num'] = $num - $i;
|
||||
}
|
||||
|
||||
$is_checkbox = false;
|
||||
$admin_href = '';
|
||||
if($is_admin) {
|
||||
$is_checkbox = true;
|
||||
$admin_href = G5_ADMIN_URL.'/qa_config.php';
|
||||
}
|
||||
|
||||
$list_href = G5_BBS_URL.'/qalist.php';
|
||||
$write_href = G5_BBS_URL.'/qawrite.php';
|
||||
|
||||
$list_pages = preg_replace('/(\.php)(&|&)/i', '$1?', get_paging(G5_IS_MOBILE ? $qaconfig['qa_mobile_page_rows'] : $qaconfig['qa_page_rows'], $page, $total_page, './qalist.php'.$qstr.'&page='));
|
||||
|
||||
$stx = get_text(stripslashes($stx));
|
||||
include_once($skin_file);
|
||||
} else {
|
||||
echo '<div>'.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.</div>';
|
||||
}
|
||||
|
||||
include_once('./qatail.php');
|
||||
?>
|
||||
15
bbs/qatail.php
Normal file
15
bbs/qatail.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
echo stripslashes($qaconfig['qa_mobile_content_tail']);
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
include_once('./_tail.php');
|
||||
} else {
|
||||
echo stripslashes($qaconfig['qa_mobile_content_tail']);
|
||||
if($qaconfig['qa_include_tail'])
|
||||
@include ($qaconfig['bo_include_tail']);
|
||||
else
|
||||
include ('./_tail.php');
|
||||
}
|
||||
?>
|
||||
175
bbs/qaview.php
Normal file
175
bbs/qaview.php
Normal file
@ -0,0 +1,175 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
if($is_guest)
|
||||
alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qaview.php?qa_id='.$qa_id));
|
||||
|
||||
$qaconfig = get_qa_config();
|
||||
|
||||
$g5['title'] = $qaconfig['qa_title'];
|
||||
include_once('./qahead.php');
|
||||
|
||||
$skin_file = $qa_skin_path.'/view.skin.php';
|
||||
|
||||
if(is_file($skin_file)) {
|
||||
$sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' ";
|
||||
if(!$is_admin) {
|
||||
$sql .= " and mb_id = '{$member['mb_id']}' ";
|
||||
}
|
||||
|
||||
$view = sql_fetch($sql);
|
||||
|
||||
if(!$view['qa_id'])
|
||||
alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.');
|
||||
|
||||
$subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len'];
|
||||
|
||||
$view['category'] = get_text($view['qa_category']);
|
||||
$view['subject'] = conv_subject($view['qa_subject'], $subject_len, '…');
|
||||
$view['content'] = conv_content($view['qa_content'], $view['qa_html']);
|
||||
$view['name'] = get_text($view['qa_name']);
|
||||
$view['datetime'] = $view['qa_datetime'];
|
||||
$view['email'] = $view['qa_email'];
|
||||
$view['hp'] = $view['qa_hp'];
|
||||
|
||||
if (trim($stx))
|
||||
$view['subject'] = search_font($stx, $view['subject']);
|
||||
|
||||
if (trim($stx))
|
||||
$view['content'] = search_font($stx, $view['content']);
|
||||
|
||||
// 이전글, 다음글
|
||||
$sql = " select qa_id, qa_subject
|
||||
from {$g5['qa_content_table']}
|
||||
where qa_type = '0' ";
|
||||
if(!$is_admin) {
|
||||
$sql .= " and mb_id = '{$member['mb_id']}' ";
|
||||
}
|
||||
|
||||
// 이전글
|
||||
$prev_search = " and qa_num < '{$view['qa_num']}' order by qa_num desc limit 1 ";
|
||||
$prev = sql_fetch($sql.$prev_search);
|
||||
|
||||
$prev_href = '';
|
||||
if (isset($prev['qa_id']) && $prev['qa_id']) {
|
||||
$prev_qa_subject = get_text(cut_str($prev['qa_subject'], 255));
|
||||
$prev_href = G5_BBS_URL.'/qaview.php?qa_id='.$prev['qa_id'].$qstr;
|
||||
}
|
||||
|
||||
// 다음글
|
||||
$next_search = " and qa_num > '{$view['qa_num']}' order by qa_num asc limit 1 ";
|
||||
$next = sql_fetch($sql.$next_search);
|
||||
|
||||
$next_href = '';
|
||||
if (isset($next['qa_id']) && $next['qa_id']) {
|
||||
$next_qa_subject = get_text(cut_str($next['qa_subject'], 255));
|
||||
$next_href = G5_BBS_URL.'/qaview.php?qa_id='.$next['qa_id'].$qstr;
|
||||
}
|
||||
|
||||
|
||||
// 관련질문
|
||||
$rows = 10;
|
||||
$sql = " select *
|
||||
from {$g5['qa_content_table']}
|
||||
where qa_id <> '$qa_id'
|
||||
and qa_related = '{$view['qa_related']}'
|
||||
and qa_type = '0'
|
||||
order by qa_num, qa_type
|
||||
limit 0, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$rel_list = array();
|
||||
$rel_count = 0;
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$rel_list[$i] = $row;
|
||||
$rel_list[$i]['category'] = get_text($row['qa_category']);
|
||||
$rel_list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
|
||||
$rel_list[$i]['name'] = get_text($row['qa_name']);
|
||||
$rel_list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
|
||||
$rel_list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr;
|
||||
$rel_count++;
|
||||
}
|
||||
$view['rel_count'] = $rel_count;
|
||||
|
||||
$update_href = '';
|
||||
$delete_href = '';
|
||||
$write_href = G5_BBS_URL.'/qawrite.php';
|
||||
$rewrite_href = G5_BBS_URL.'/qawrite.php?w=r&qa_id='.$view['qa_id'];
|
||||
$list_href = G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr);
|
||||
|
||||
/*
|
||||
if($view['qa_type']) {
|
||||
if($is_admin)
|
||||
$update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr;
|
||||
} else {
|
||||
if($view['qa_status'] == 0)
|
||||
$update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr;
|
||||
}
|
||||
*/
|
||||
if(($view['qa_type'] && $is_admin) || (!$view['qa_type'] && $view['qa_status'] == 0)) {
|
||||
$update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr;
|
||||
$delete_href = G5_BBS_URL.'/qadelete.php?qa_id='.$view['qa_id'].$qstr;
|
||||
}
|
||||
|
||||
// 질문글이고 등록된 답변이 있다면
|
||||
$answer = array();
|
||||
$answer_update_href = '';
|
||||
$answer_delete_href = '';
|
||||
if(!$view['qa_type'] && $view['qa_status']) {
|
||||
$sql = " select *
|
||||
from {$g5['qa_content_table']}
|
||||
where qa_type = '1'
|
||||
and qa_parent = '{$view['qa_id']}' ";
|
||||
$answer = sql_fetch($sql);
|
||||
|
||||
if($is_admin) {
|
||||
$answer_update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$answer['qa_id'].$qstr;
|
||||
$answer_delete_href = G5_BBS_URL.'/qadelete.php?qa_id='.$answer['qa_id'].$qstr;
|
||||
}
|
||||
}
|
||||
|
||||
$stx = get_text(stripslashes($stx));
|
||||
|
||||
$is_dhtml_editor = false;
|
||||
// 모바일에서는 DHTML 에디터 사용불가
|
||||
if ($config['cf_editor'] && $qaconfig['qa_use_editor'] && !G5_IS_MOBILE) {
|
||||
$is_dhtml_editor = true;
|
||||
}
|
||||
$editor_html = editor_html('qa_content', $content, $is_dhtml_editor);
|
||||
$editor_js = '';
|
||||
$editor_js .= get_editor_js('qa_content', $is_dhtml_editor);
|
||||
$editor_js .= chk_editor_js('qa_content', $is_dhtml_editor);
|
||||
|
||||
$ss_name = 'ss_qa_view_'.$qa_id;
|
||||
if(!get_session($ss_name))
|
||||
set_session($ss_name, TRUE);
|
||||
|
||||
// 첨부파일
|
||||
$view['img_file'] = array();
|
||||
$view['download_href'] = array();
|
||||
$view['download_source'] = array();
|
||||
$view['img_count'] = 0;
|
||||
$view['download_count'] = 0;
|
||||
|
||||
for ($i=1; $i<=2; $i++) {
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $view['qa_file'.$i])) {
|
||||
$view['img_file'][] = '<a href="'.G5_BBS_URL.'/view_image.php?fn='.urlencode('/data/qa/'.$view['qa_file'.$i]).'" target="_blank" class="view_image"><img src="'.G5_DATA_URL.'/qa/'.$view['qa_file'.$i].'"></a>';
|
||||
$view['img_count']++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($view['qa_file'.$i]) {
|
||||
$view['download_href'][] = G5_BBS_URL.'/qadownload.php?qa_id='.$view['qa_id'].'&no='.$i;
|
||||
$view['download_source'][] = $view['qa_source'.$i];
|
||||
$view['download_count']++;
|
||||
}
|
||||
}
|
||||
|
||||
include_once($skin_file);
|
||||
} else {
|
||||
echo '<div>'.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.</div>';
|
||||
}
|
||||
|
||||
include_once('./qatail.php');
|
||||
?>
|
||||
139
bbs/qawrite.php
Normal file
139
bbs/qawrite.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
if($w != '' && $w != 'u' && $w != 'r') {
|
||||
alert('올바른 방법으로 이용해 주십시오.');
|
||||
}
|
||||
|
||||
if($is_guest)
|
||||
alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qalist.php'));
|
||||
|
||||
$qaconfig = get_qa_config();
|
||||
|
||||
$g5['title'] = $qaconfig['qa_title'];
|
||||
include_once('./qahead.php');
|
||||
|
||||
$skin_file = $qa_skin_path.'/write.skin.php';
|
||||
|
||||
if(is_file($skin_file)) {
|
||||
/*==========================
|
||||
$w == a : 답변
|
||||
$w == r : 추가질문
|
||||
$w == u : 수정
|
||||
==========================*/
|
||||
|
||||
if($w == 'u' || $w == 'r') {
|
||||
$sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' ";
|
||||
if(!$is_admin) {
|
||||
$sql .= " and mb_id = '{$member['mb_id']}' ";
|
||||
}
|
||||
|
||||
$write = sql_fetch($sql);
|
||||
|
||||
if($w == 'u') {
|
||||
if(!$write['qa_id'])
|
||||
alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.');
|
||||
|
||||
if(!$is_admin) {
|
||||
if($write['qa_type'] == 0 && $write['qa_status'] == 1)
|
||||
alert('답변이 등록된 문의글은 수정할 수 없습니다.');
|
||||
|
||||
if($write['mb_id'] != $member['mb_id'])
|
||||
alert('게시글을 수정할 권한이 없습니다.\\n\\n올바른 방법으로 이용해 주십시오.', G5_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 분류
|
||||
$category_option = '';
|
||||
if(trim($qaconfig['qa_category'])) {
|
||||
$category = explode('|', $qaconfig['qa_category']);
|
||||
for($i=0; $i<count($category); $i++) {
|
||||
$category_option .= option_selected($category[$i], $write['qa_category']);
|
||||
}
|
||||
} else {
|
||||
alert('1:1문의 설정에서 분류를 설정해 주십시오');
|
||||
}
|
||||
|
||||
$is_dhtml_editor = false;
|
||||
// 모바일에서는 DHTML 에디터 사용불가
|
||||
if ($config['cf_editor'] && $qaconfig['qa_use_editor'] && !G5_IS_MOBILE) {
|
||||
$is_dhtml_editor = true;
|
||||
}
|
||||
|
||||
// 추가질문에서는 제목을 공백으로
|
||||
if($w == 'r')
|
||||
$write['qa_subject'] = '';
|
||||
|
||||
$content = '';
|
||||
if ($w == '') {
|
||||
$content = $qaconfig['qa_insert_content'];
|
||||
} else if($w == 'r') {
|
||||
if($is_dhtml_editor)
|
||||
$content = '<div><br><br><br>====== 이전 답변내용 =======<br></div>';
|
||||
else
|
||||
$content = "\n\n\n\n====== 이전 답변내용 =======\n";
|
||||
|
||||
$content .= get_text($write['qa_content'], 0);
|
||||
} else {
|
||||
$content = get_text($write['qa_content'], 0);
|
||||
}
|
||||
|
||||
$editor_html = editor_html('qa_content', $content, $is_dhtml_editor);
|
||||
$editor_js = '';
|
||||
$editor_js .= get_editor_js('qa_content', $is_dhtml_editor);
|
||||
$editor_js .= chk_editor_js('qa_content', $is_dhtml_editor);
|
||||
|
||||
$upload_max_filesize = number_format($qaconfig['qa_upload_size']) . ' 바이트';
|
||||
|
||||
$html_value = '';
|
||||
if ($write['qa_html']) {
|
||||
$html_checked = 'checked';
|
||||
$html_value = $write['qa_html'];
|
||||
|
||||
if($w == 'r' && $write['qa_html'] == 1 && !$is_dhtml_editor)
|
||||
$html_value = 2;
|
||||
}
|
||||
|
||||
$is_email = false;
|
||||
$req_email = '';
|
||||
if($qaconfig['qa_use_email']) {
|
||||
$is_email = true;
|
||||
|
||||
if($qaconfig['qa_req_email'])
|
||||
$req_email = 'required';
|
||||
|
||||
if($w == '' || $w == 'r')
|
||||
$write['qa_email'] = $member['mb_email'];
|
||||
|
||||
if($w == 'u' && $is_admin && $write['qa_type'])
|
||||
$is_email = false;
|
||||
}
|
||||
|
||||
$is_hp = false;
|
||||
$req_hp = '';
|
||||
if($qaconfig['qa_use_hp']) {
|
||||
$is_hp = true;
|
||||
|
||||
if($qaconfig['qa_req_hp'])
|
||||
$req_hp = 'required';
|
||||
|
||||
if($w == '' || $w == 'r')
|
||||
$write['qa_hp'] = $member['mb_hp'];
|
||||
|
||||
if($w == 'u' && $is_admin && $write['qa_type'])
|
||||
$is_hp = false;
|
||||
}
|
||||
|
||||
$list_href = G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr);
|
||||
|
||||
$action_url = https_url(G5_BBS_DIR).'/qawrite_update.php';
|
||||
|
||||
include_once($skin_file);
|
||||
} else {
|
||||
echo '<div>'.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.</div>';
|
||||
}
|
||||
|
||||
include_once('./qatail.php');
|
||||
?>
|
||||
352
bbs/qawrite_update.php
Normal file
352
bbs/qawrite_update.php
Normal file
@ -0,0 +1,352 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
/*==========================
|
||||
$w == a : 답변
|
||||
$w == r : 추가질문
|
||||
$w == u : 수정
|
||||
==========================*/
|
||||
|
||||
if($is_guest)
|
||||
alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qalist.php'));
|
||||
|
||||
$msg = array();
|
||||
|
||||
$qa_subject = '';
|
||||
if (isset($_POST['qa_subject'])) {
|
||||
$qa_subject = substr(trim($_POST['qa_subject']),0,255);
|
||||
}
|
||||
if ($qa_subject == '') {
|
||||
$msg[] = '<strong>제목</strong>을 입력하세요.';
|
||||
}
|
||||
|
||||
$qa_content = '';
|
||||
if (isset($_POST['qa_content'])) {
|
||||
$qa_content = substr(trim($_POST['qa_content']),0,65536);
|
||||
}
|
||||
if ($qa_content == '') {
|
||||
$msg[] = '<strong>내용</strong>을 입력하세요.';
|
||||
}
|
||||
|
||||
if (!empty($msg)) {
|
||||
$msg = implode('<br>', $msg);
|
||||
alert($msg);
|
||||
}
|
||||
|
||||
if($qa_hp)
|
||||
$qa_hp = preg_replace('/[^0-9\-]/', '', strip_tags($qa_hp));
|
||||
|
||||
// 090710
|
||||
if (substr_count($qa_content, '&#') > 50) {
|
||||
alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.');
|
||||
exit;
|
||||
}
|
||||
|
||||
$upload_max_filesize = ini_get('upload_max_filesize');
|
||||
|
||||
if (empty($_POST)) {
|
||||
alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n게시판관리자 또는 서버관리자에게 문의 바랍니다.");
|
||||
}
|
||||
|
||||
for ($i=1; $i<=5; $i++) {
|
||||
$var = "qa_$i";
|
||||
$$var = "";
|
||||
if (isset($_POST['qa_'.$i]) && $_POST['qa_'.$i]) {
|
||||
$$var = trim($_POST['qa_'.$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 1:1문의 설정값
|
||||
$qaconfig = get_qa_config();
|
||||
|
||||
if($w == 'u' || $w == 'a' || $w == 'r') {
|
||||
if($w == 'a' && !$is_admin)
|
||||
alert('답변은 관리자만 등록할 수 있습니다.');
|
||||
|
||||
$sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' ";
|
||||
if(!$is_admin) {
|
||||
$sql .= " and mb_id = '{$member['mb_id']}' ";
|
||||
}
|
||||
|
||||
$write = sql_fetch($sql);
|
||||
|
||||
if($w == 'u') {
|
||||
if(!$write['qa_id'])
|
||||
alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.');
|
||||
|
||||
if(!$is_admin) {
|
||||
if($write['qa_type'] == 0 && $write['qa_status'] == 1)
|
||||
alert('답변이 등록된 문의글은 수정할 수 없습니다.');
|
||||
|
||||
if($write['mb_id'] != $member['mb_id'])
|
||||
alert('게시글을 수정할 권한이 없습니다.\\n\\n올바른 방법으로 이용해 주십시오.', G5_URL);
|
||||
}
|
||||
}
|
||||
|
||||
if($w == 'a') {
|
||||
if(!$write['qa_id'])
|
||||
alert('문의글이 존재하지 않아 답변글을 등록할 수 없습니다.');
|
||||
|
||||
if($write['qa_type'] == 1)
|
||||
alert('답변글에는 다시 답변을 등록할 수 없습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
|
||||
@mkdir(G5_DATA_PATH.'/qa', G5_DIR_PERMISSION);
|
||||
@chmod(G5_DATA_PATH.'/qa', G5_DIR_PERMISSION);
|
||||
|
||||
$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
|
||||
|
||||
// 가변 파일 업로드
|
||||
$file_upload_msg = '';
|
||||
$upload = array();
|
||||
for ($i=1; $i<=count($_FILES['bf_file']['name']); $i++) {
|
||||
$upload[$i]['file'] = '';
|
||||
$upload[$i]['source'] = '';
|
||||
$upload[$i]['del_check'] = false;
|
||||
|
||||
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
|
||||
if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) {
|
||||
$upload[$i]['del_check'] = true;
|
||||
@unlink(G5_DATA_PATH.'/qa/'.$write['qa_file'.$i]);
|
||||
// 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $write['qa_file'.$i])) {
|
||||
delete_qa_thumbnail($write['qa_file'.$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$tmp_file = $_FILES['bf_file']['tmp_name'][$i];
|
||||
$filesize = $_FILES['bf_file']['size'][$i];
|
||||
$filename = $_FILES['bf_file']['name'][$i];
|
||||
$filename = preg_replace('/(<|>|=)/', '', $filename);
|
||||
|
||||
// 서버에 설정된 값보다 큰파일을 업로드 한다면
|
||||
if ($filename) {
|
||||
if ($_FILES['bf_file']['error'][$i] == 1) {
|
||||
$file_upload_msg .= '\"'.$filename.'\" 파일의 용량이 서버에 설정('.$upload_max_filesize.')된 값보다 크므로 업로드 할 수 없습니다.\\n';
|
||||
continue;
|
||||
}
|
||||
else if ($_FILES['bf_file']['error'][$i] != 0) {
|
||||
$file_upload_msg .= '\"'.$filename.'\" 파일이 정상적으로 업로드 되지 않았습니다.\\n';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_uploaded_file($tmp_file)) {
|
||||
// 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀
|
||||
if (!$is_admin && $filesize > $qaconfig['qa_upload_size']) {
|
||||
$file_upload_msg .= '\"'.$filename.'\" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($qaconfig['qa_upload_size']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n';
|
||||
continue;
|
||||
}
|
||||
|
||||
//=================================================================\
|
||||
// 090714
|
||||
// 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지
|
||||
// 에러메세지는 출력하지 않는다.
|
||||
//-----------------------------------------------------------------
|
||||
$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)
|
||||
continue;
|
||||
}
|
||||
//=================================================================
|
||||
|
||||
if ($w == 'u') {
|
||||
// 존재하는 파일이 있다면 삭제합니다.
|
||||
@unlink(G5_DATA_PATH.'/qa/'.$write['qa_file'.$i]);
|
||||
// 이미지파일이면 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $write['qa_file'.$i])) {
|
||||
delete_qa_thumbnail($row['qa_file'.$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 프로그램 원래 파일명
|
||||
$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);
|
||||
|
||||
shuffle($chars_array);
|
||||
$shuffle = implode('', $chars_array);
|
||||
|
||||
// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
|
||||
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));
|
||||
|
||||
$dest_file = G5_DATA_PATH.'/qa/'.$upload[$i]['file'];
|
||||
|
||||
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
|
||||
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]);
|
||||
|
||||
// 올라간 파일의 퍼미션을 변경합니다.
|
||||
chmod($dest_file, G5_FILE_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
||||
if($w == '' || $w == 'a' || $w == 'r') {
|
||||
if($w == '' || $w == 'r') {
|
||||
$row = sql_fetch(" select MIN(qa_num) as min_qa_num from {$g5['qa_content_table']} ");
|
||||
$qa_num = $row['min_qa_num'] - 1;
|
||||
}
|
||||
|
||||
if($w == 'a') {
|
||||
$qa_num = $write['qa_num'];
|
||||
$qa_parent = $write['qa_id'];
|
||||
$qa_related = $write['qa_related'];
|
||||
$qa_category = $write['qa_category'];
|
||||
$qa_type = 1;
|
||||
$qa_status = 1;
|
||||
}
|
||||
|
||||
$sql = " insert into {$g5['qa_content_table']}
|
||||
set qa_num = '$qa_num',
|
||||
mb_id = '{$member['mb_id']}',
|
||||
qa_name = '{$member['mb_nick']}',
|
||||
qa_email = '$qa_email',
|
||||
qa_hp = '$qa_hp',
|
||||
qa_type = '$qa_type',
|
||||
qa_parent = '$qa_parent',
|
||||
qa_related = '$qa_related',
|
||||
qa_category = '$qa_category',
|
||||
qa_email_recv = '$qa_email_recv',
|
||||
qa_sms_recv = '$qa_sms_recv',
|
||||
qa_html = '$qa_html',
|
||||
qa_subject = '$qa_subject',
|
||||
qa_content = '$qa_content',
|
||||
qa_status = '$qa_status',
|
||||
qa_file1 = '{$upload[1]['file']}',
|
||||
qa_source1 = '{$upload[1]['source']}',
|
||||
qa_file2 = '{$upload[2]['file']}',
|
||||
qa_source2 = '{$upload[2]['source']}',
|
||||
qa_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
qa_datetime = '".G5_TIME_YMDHIS."',
|
||||
qa_1 = '$qa_1',
|
||||
qa_2 = '$qa_2',
|
||||
qa_3 = '$qa_3',
|
||||
qa_4 = '$qa_4',
|
||||
qa_5 = '$qa_5' ";
|
||||
sql_query($sql);
|
||||
|
||||
if($w == '' || $w == 'r') {
|
||||
$qa_id = mysql_insert_id();
|
||||
|
||||
if($w == 'r' && $write['qa_related']) {
|
||||
$qa_related = $write['qa_related'];
|
||||
} else {
|
||||
$qa_related = $qa_id;
|
||||
}
|
||||
|
||||
$sql = " update {$g5['qa_content_table']}
|
||||
set qa_parent = '$qa_id',
|
||||
qa_related = '$qa_related'
|
||||
where qa_id = '$qa_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if($w == 'a') {
|
||||
$sql = " update {$g5['qa_content_table']}
|
||||
set qa_status = '1'
|
||||
where qa_id = '{$write['qa_parent']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
} else if($w == 'u') {
|
||||
if(!$upload[1]['file'] && !$upload[1]['del_check']) {
|
||||
$upload[1]['file'] = $write['qa_file1'];
|
||||
$upload[1]['source'] = $write['qa_source1'];
|
||||
}
|
||||
|
||||
if(!$upload[2]['file'] && !$upload[2]['del_check']) {
|
||||
$upload[2]['file'] = $write['qa_file2'];
|
||||
$upload[2]['source'] = $write['qa_source2'];
|
||||
}
|
||||
|
||||
$sql = " update {$g5['qa_content_table']}
|
||||
set qa_email = '$qa_email',
|
||||
qa_hp = '$qa_hp',
|
||||
qa_category = '$qa_category',
|
||||
qa_html = '$qa_html',
|
||||
qa_subject = '$qa_subject',
|
||||
qa_content = '$qa_content',
|
||||
qa_file1 = '{$upload[1]['file']}',
|
||||
qa_source1 = '{$upload[1]['source']}',
|
||||
qa_file2 = '{$upload[2]['file']}',
|
||||
qa_source2 = '{$upload[2]['source']}',
|
||||
qa_1 = '$qa_1',
|
||||
qa_2 = '$qa_2',
|
||||
qa_3 = '$qa_3',
|
||||
qa_4 = '$qa_4',
|
||||
qa_5 = '$qa_5' ";
|
||||
if($qa_sms_recv)
|
||||
$sql .= ", qa_sms_recv = '$qa_sms_recv' ";
|
||||
$sql .= " where qa_id = '$qa_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// SMS 알림
|
||||
if($config['cf_sms_use'] == 'icode' && $qaconfig['qa_use_sms']) {
|
||||
include_once(G5_LIB_PATH.'/icode.sms.lib.php');
|
||||
|
||||
// 답변글은 질문 등록자에게 전송
|
||||
if($w == 'a' && $write['qa_sms_recv'] && trim($write['qa_hp'])) {
|
||||
$sms_content = $config['cf_title'].' '.$qaconfig['qa_title'].'에 답변이 등록되었습니다.';
|
||||
$send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']);
|
||||
$recv_number = preg_replace('/[^0-9]/', '', $write['qa_hp']);
|
||||
|
||||
if($recv_number) {
|
||||
$SMS = new SMS; // SMS 연결
|
||||
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
|
||||
$SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), "");
|
||||
$SMS->Send();
|
||||
}
|
||||
}
|
||||
|
||||
// 문의글 등록시 관리자에게 전송
|
||||
if(($w == '' || $w == 'r') && trim($qaconfig['qa_admin_hp'])) {
|
||||
$sms_content = $config['cf_title'].' '.$qaconfig['qa_title'].'에 문의글이 등록되었습니다.';
|
||||
$send_number = preg_replace('/[^0-9]/', '', $qa_hp);
|
||||
$recv_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_admin_hp']);
|
||||
|
||||
if($recv_number) {
|
||||
$SMS = new SMS; // SMS 연결
|
||||
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
|
||||
$SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), "");
|
||||
$SMS->Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 답변 이메일전송
|
||||
if($w == 'a' && $write['qa_email_recv'] && trim($write['qa_email'])) {
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
$subject = $config['cf_title'].' '.$qaconfig['qa_title'].' 답변 알림 메일';
|
||||
$content = nl2br(conv_unescape_nl($qa_content));
|
||||
|
||||
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $write['qa_email'], $subject, $content, 1);
|
||||
}
|
||||
|
||||
// 문의글등록 이메일전송
|
||||
if(($w == '' || $w == 'r') && trim($qaconfig['qa_admin_email'])) {
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
$subject = $config['cf_title'].' '.$qaconfig['qa_title'].' 질문 알림 메일';
|
||||
$content = nl2br(conv_unescape_nl($qa_content));
|
||||
|
||||
mailer($config['cf_admin_email_name'], $qa_email, $qaconfig['qa_admin_email'], $subject, $content, 1);
|
||||
}
|
||||
|
||||
if($w == 'a')
|
||||
$result_url = G5_BBS_URL.'/qaview.php?qa_id='.$qa_id.$qstr;
|
||||
else if($w == 'u' && $write['qa_type'])
|
||||
$result_url = G5_BBS_URL.'/qaview.php?qa_id='.$write['qa_parent'].$qstr;
|
||||
else
|
||||
$result_url = G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr);
|
||||
|
||||
if ($file_upload_msg)
|
||||
alert($file_upload_msg, $result_url);
|
||||
else
|
||||
goto_url($result_url);
|
||||
?>
|
||||
19
bbs/register.php
Normal file
19
bbs/register.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 로그인중인 경우 회원가입 할 수 없습니다.
|
||||
if ($is_member) {
|
||||
goto_url(G5_URL);
|
||||
}
|
||||
|
||||
// 세션을 지웁니다.
|
||||
set_session("ss_mb_reg", "");
|
||||
|
||||
$g5['title'] = '회원가입약관';
|
||||
include_once('./_head.php');
|
||||
|
||||
$register_action_url = G5_BBS_URL.'/register_form.php';
|
||||
include_once($member_skin_path.'/register.skin.php');
|
||||
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
51
bbs/register_email.php
Normal file
51
bbs/register_email.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
$sql = " select mb_email, mb_datetime, mb_email_certify from {$g5['member_table']} where mb_id = '{$mb_id}' ";
|
||||
$mb = sql_fetch($sql);
|
||||
if (substr($mb['mb_email_certify'],0,1)!=0) {
|
||||
alert("이미 메일인증 하신 회원입니다.", G5_URL);
|
||||
}
|
||||
|
||||
$g5['title'] = '메일인증 메일주소 변경';
|
||||
include_once('./_head.php');
|
||||
?>
|
||||
|
||||
<p>메일인증을 받지 못한 경우 회원정보의 메일주소를 변경 할 수 있습니다.</p>
|
||||
|
||||
<form method="post" name="fregister_email" action="<?php echo G5_HTTPS_BBS_URL.'/register_email_update.php'; ?>" onsubmit="return fregister_email_submit(this);">
|
||||
<input type="hidden" name="mb_id" value="<?php echo $mb_id; ?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_frm">
|
||||
<table>
|
||||
<caption>사이트 이용정보 입력</caption>
|
||||
<tr>
|
||||
<th scope="row"><label for="reg_mb_email">E-mail<strong class="sound_only">필수</strong></label></th>
|
||||
<td><input type="text" name="mb_email" id="reg_mb_email" required class="frm_input email required" size="50" maxlength="100" value="<?php echo $mb['mb_email']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">자동등록방지</th>
|
||||
<td><?php echo captcha_html(); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm">
|
||||
<input type="submit" id="btn_submit" class="btn_submit" value="인증메일변경">
|
||||
<a href="<?php echo G5_URL ?>" class="btn_cancel">취소</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function fregister_email_submit(f)
|
||||
{
|
||||
<?php echo chk_captcha_js(); ?>
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
44
bbs/register_email_update.php
Normal file
44
bbs/register_email_update.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
$mb_id = trim($_POST['mb_id']);
|
||||
$mb_email = trim($_POST['mb_email']);
|
||||
|
||||
$sql = " select mb_name, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' and mb_email_certify <> '' ";
|
||||
$mb = sql_fetch($sql);
|
||||
if (!$mb) {
|
||||
alert("이미 메일인증 하신 회원입니다.", G5_URL);
|
||||
}
|
||||
|
||||
if (!chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
$sql = " select count(*) as cnt from {$g5['member_table']} where mb_id <> '{$mb_id}' and mb_email = '$mb_email' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt']) {
|
||||
alert("{$mb_email} 메일은 이미 존재하는 메일주소 입니다.\\n\\n다른 메일주소를 입력해 주십시오.");
|
||||
}
|
||||
|
||||
// 인증메일 발송
|
||||
$subject = '['.$config['cf_title'].'] 인증확인 메일입니다.';
|
||||
|
||||
$mb_name = $mb['mb_name'];
|
||||
$mb_datetime = $mb['mb_datetime'] ? $mb['mb_datetime'] : G5_TIME_YMDHIS;
|
||||
$mb_md5 = md5($mb_id.$mb_email.$mb_datetime);
|
||||
$certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&mb_md5='.$mb_md5;
|
||||
|
||||
ob_start();
|
||||
include_once ('./register_form_update_mail3.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1);
|
||||
|
||||
$sql = " update {$g5['member_table']} set mb_email = '$mb_email' where mb_id = '$mb_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
alert("인증메일을 {$mb_email} 메일로 다시 보내 드렸습니다.\\n\\n잠시후 {$mb_email} 메일을 확인하여 주십시오.", G5_URL);
|
||||
?>
|
||||
121
bbs/register_form.php
Normal file
121
bbs/register_form.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
include_once(G5_LIB_PATH.'/register.lib.php');
|
||||
|
||||
// 불법접근을 막도록 토큰생성
|
||||
$token = md5(uniqid(rand(), true));
|
||||
set_session("ss_token", $token);
|
||||
|
||||
set_session("ss_cert_no", "");
|
||||
set_session("ss_cert_hash", "");
|
||||
set_session("ss_cert_type", "");
|
||||
|
||||
if ($w == "") {
|
||||
|
||||
// 회원 로그인을 한 경우 회원가입 할 수 없다
|
||||
// 경고창이 뜨는것을 막기위해 아래의 코드로 대체
|
||||
// alert("이미 로그인중이므로 회원 가입 하실 수 없습니다.", "./");
|
||||
if ($is_member) {
|
||||
goto_url(G5_URL);
|
||||
}
|
||||
|
||||
// 리퍼러 체크
|
||||
referer_check();
|
||||
|
||||
if (!isset($_POST['agree']) || !$_POST['agree']) {
|
||||
alert('회원가입약관의 내용에 동의하셔야 회원가입 하실 수 있습니다.', G5_BBS_URL.'/register.php');
|
||||
}
|
||||
|
||||
if (!isset($_POST['agree2']) || !$_POST['agree2']) {
|
||||
alert('개인정보처리방침안내의 내용에 동의하셔야 회원가입 하실 수 있습니다.', G5_BBS_URL.'/register.php');
|
||||
}
|
||||
|
||||
$member['mb_birth'] = '';
|
||||
$member['mb_sex'] = '';
|
||||
$member['mb_name'] = '';
|
||||
if (isset($_POST['birth'])) {
|
||||
$member['mb_birth'] = $_POST['birth'];
|
||||
}
|
||||
if (isset($_POST['sex'])) {
|
||||
$member['mb_sex'] = $_POST['sex'];
|
||||
}
|
||||
if (isset($_POST['mb_name'])) {
|
||||
$member['mb_name'] = $_POST['mb_name'];
|
||||
}
|
||||
|
||||
$g5['title'] = '회원 가입';
|
||||
|
||||
} else if ($w == 'u') {
|
||||
|
||||
if ($is_admin)
|
||||
alert('관리자의 회원정보는 관리자 화면에서 수정해 주십시오.', G5_URL);
|
||||
|
||||
if (!$is_member)
|
||||
alert('로그인 후 이용하여 주십시오.', G5_URL);
|
||||
|
||||
if ($member['mb_id'] != $mb_id)
|
||||
alert('로그인된 회원과 넘어온 정보가 서로 다릅니다.');
|
||||
|
||||
/*
|
||||
if (!($member[mb_password] == sql_password($_POST[mb_password]) && $_POST[mb_password]))
|
||||
alert("비밀번호가 틀립니다.");
|
||||
|
||||
// 수정 후 다시 이 폼으로 돌아오기 위해 임시로 저장해 놓음
|
||||
set_session("ss_tmp_password", $_POST[mb_password]);
|
||||
*/
|
||||
|
||||
if ($_POST['mb_password']) {
|
||||
// 수정된 정보를 업데이트후 되돌아 온것이라면 비밀번호가 암호화 된채로 넘어온것임
|
||||
if ($_POST['is_update'])
|
||||
$tmp_password = $_POST['mb_password'];
|
||||
else
|
||||
$tmp_password = sql_password($_POST['mb_password']);
|
||||
|
||||
if ($member['mb_password'] != $tmp_password)
|
||||
alert('비밀번호가 틀립니다.');
|
||||
}
|
||||
|
||||
$g5['title'] = '회원 정보 수정';
|
||||
|
||||
set_session("ss_reg_mb_name", $member['mb_name']);
|
||||
set_session("ss_reg_mb_hp", $member['mb_hp']);
|
||||
|
||||
$member['mb_email'] = get_text($member['mb_email']);
|
||||
$member['mb_homepage'] = get_text($member['mb_homepage']);
|
||||
$member['mb_birth'] = get_text($member['mb_birth']);
|
||||
$member['mb_tel'] = get_text($member['mb_tel']);
|
||||
$member['mb_hp'] = get_text($member['mb_hp']);
|
||||
$member['mb_addr1'] = get_text($member['mb_addr1']);
|
||||
$member['mb_addr2'] = get_text($member['mb_addr2']);
|
||||
$member['mb_signature'] = get_text($member['mb_signature']);
|
||||
$member['mb_recommend'] = get_text($member['mb_recommend']);
|
||||
$member['mb_profile'] = get_text($member['mb_profile']);
|
||||
$member['mb_1'] = get_text($member['mb_1']);
|
||||
$member['mb_2'] = get_text($member['mb_2']);
|
||||
$member['mb_3'] = get_text($member['mb_3']);
|
||||
$member['mb_4'] = get_text($member['mb_4']);
|
||||
$member['mb_5'] = get_text($member['mb_5']);
|
||||
$member['mb_6'] = get_text($member['mb_6']);
|
||||
$member['mb_7'] = get_text($member['mb_7']);
|
||||
$member['mb_8'] = get_text($member['mb_8']);
|
||||
$member['mb_9'] = get_text($member['mb_9']);
|
||||
$member['mb_10'] = get_text($member['mb_10']);
|
||||
} else {
|
||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||
}
|
||||
|
||||
include_once('./_head.php');
|
||||
|
||||
// 회원아이콘 경로
|
||||
$mb_icon_path = G5_DATA_PATH.'/member/'.substr($member['mb_id'],0,2).'/'.$member['mb_id'].'.gif';
|
||||
$mb_icon_url = G5_DATA_URL.'/member/'.substr($member['mb_id'],0,2).'/'.$member['mb_id'].'.gif';
|
||||
|
||||
$register_action_url = G5_HTTPS_BBS_URL.'/register_form_update.php';
|
||||
$req_nick = !isset($member['mb_nick_date']) || (isset($member['mb_nick_date']) && $member['mb_nick_date'] <= date("Y-m-d", G5_SERVER_TIME - ($config['cf_nick_modify'] * 86400)));
|
||||
$required = ($w=='') ? 'required' : '';
|
||||
$readonly = ($w=='u') ? 'readonly' : '';
|
||||
|
||||
include_once($member_skin_path.'/register_form.skin.php');
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
401
bbs/register_form_update.php
Normal file
401
bbs/register_form_update.php
Normal file
@ -0,0 +1,401 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
include_once(G5_LIB_PATH.'/register.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
// 리퍼러 체크
|
||||
referer_check();
|
||||
|
||||
if (!($w == '' || $w == 'u')) {
|
||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||
}
|
||||
|
||||
if ($w == 'u' && $is_admin == 'super') {
|
||||
if (file_exists(G5_PATH.'/DEMO'))
|
||||
alert('데모 화면에서는 하실(보실) 수 없는 작업입니다.');
|
||||
}
|
||||
|
||||
if (!chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
$mb_id = trim($_POST['mb_id']);
|
||||
$mb_password = trim($_POST['mb_password']);
|
||||
$mb_password_re = trim($_POST['mb_password_re']);
|
||||
$mb_name = trim($_POST['mb_name']);
|
||||
$mb_nick = trim($_POST['mb_nick']);
|
||||
$mb_email = trim($_POST['mb_email']);
|
||||
$mb_sex = isset($_POST['mb_sex']) ? trim($_POST['mb_sex']) : "";
|
||||
$mb_birth = isset($_POST['mb_birth']) ? trim($_POST['mb_birth']) : "";
|
||||
$mb_homepage = isset($_POST['mb_homepage']) ? trim($_POST['mb_homepage']) : "";
|
||||
$mb_tel = isset($_POST['mb_tel']) ? trim($_POST['mb_tel']) : "";
|
||||
$mb_hp = isset($_POST['mb_hp']) ? trim($_POST['mb_hp']) : "";
|
||||
$mb_zip1 = isset($_POST['mb_zip1']) ? trim($_POST['mb_zip1']) : "";
|
||||
$mb_zip2 = isset($_POST['mb_zip2']) ? trim($_POST['mb_zip2']) : "";
|
||||
$mb_addr1 = isset($_POST['mb_addr1']) ? trim($_POST['mb_addr1']) : "";
|
||||
$mb_addr2 = isset($_POST['mb_addr2']) ? trim($_POST['mb_addr2']) : "";
|
||||
$mb_addr3 = isset($_POST['mb_addr3']) ? trim($_POST['mb_addr3']) : "";
|
||||
$mb_addr_jibeon = isset($_POST['mb_addr_jibeon']) ? trim($_POST['mb_addr_jibeon']) : "";
|
||||
$mb_signature = isset($_POST['mb_signature']) ? trim($_POST['mb_signature']) : "";
|
||||
$mb_profile = isset($_POST['mb_profile']) ? trim($_POST['mb_profile']) : "";
|
||||
$mb_recommend = isset($_POST['mb_recommend']) ? trim($_POST['mb_recommend']) : "";
|
||||
$mb_mailling = isset($_POST['mb_mailling']) ? trim($_POST['mb_mailling']) : "";
|
||||
$mb_sms = isset($_POST['mb_sms']) ? trim($_POST['mb_sms']) : "";
|
||||
$mb_1 = isset($_POST['mb_1']) ? trim($_POST['mb_1']) : "";
|
||||
$mb_2 = isset($_POST['mb_2']) ? trim($_POST['mb_2']) : "";
|
||||
$mb_3 = isset($_POST['mb_3']) ? trim($_POST['mb_3']) : "";
|
||||
$mb_4 = isset($_POST['mb_4']) ? trim($_POST['mb_4']) : "";
|
||||
$mb_5 = isset($_POST['mb_5']) ? trim($_POST['mb_5']) : "";
|
||||
$mb_6 = isset($_POST['mb_6']) ? trim($_POST['mb_6']) : "";
|
||||
$mb_7 = isset($_POST['mb_7']) ? trim($_POST['mb_7']) : "";
|
||||
$mb_8 = isset($_POST['mb_8']) ? trim($_POST['mb_8']) : "";
|
||||
$mb_9 = isset($_POST['mb_9']) ? trim($_POST['mb_9']) : "";
|
||||
$mb_10 = isset($_POST['mb_10']) ? trim($_POST['mb_10']) : "";
|
||||
|
||||
if ($w == '' || $w == 'u') {
|
||||
|
||||
if ($msg = empty_mb_id($mb_id)) alert($msg, "", true, true); // alert($msg, $url, $error, $post);
|
||||
|
||||
if ($w == '' && !$mb_password)
|
||||
alert('비밀번호가 넘어오지 않았습니다.');
|
||||
if($w == '' && $mb_password != $mb_password_re)
|
||||
alert('비밀번호가 일치하지 않습니다.');
|
||||
|
||||
if ($msg = empty_mb_name($mb_id)) alert($msg, "", true, true);
|
||||
if ($msg = empty_mb_nick($mb_nick)) alert($msg, "", true, true);
|
||||
if ($msg = empty_mb_email($mb_email)) alert($msg, "", true, true);
|
||||
if ($msg = reserve_mb_id($mb_id)) alert($msg, "", true, true);
|
||||
if ($msg = reserve_mb_nick($mb_nick)) alert($msg, "", true, true);
|
||||
// 이름에 한글명 체크를 하지 않는다.
|
||||
//if ($msg = valid_mb_name($mb_name)) alert($msg, "", true, true);
|
||||
if ($msg = valid_mb_nick($mb_nick)) alert($msg, "", true, true);
|
||||
if ($msg = valid_mb_email($mb_email)) alert($msg, "", true, true);
|
||||
if ($msg = prohibit_mb_email($mb_email))alert($msg, "", true, true);
|
||||
|
||||
// 휴대폰 필수입력일 경우 휴대폰번호 유효성 체크
|
||||
if (($config['cf_use_hp'] || $config['cf_cert_hp']) && $config['cf_req_hp']) {
|
||||
if ($msg = valid_mb_hp($mb_hp)) alert($msg, "", true, true);
|
||||
}
|
||||
|
||||
if ($w=='') {
|
||||
if ($msg = exist_mb_id($mb_id)) alert($msg);
|
||||
|
||||
// 본인확인 체크
|
||||
if($config['cf_cert_use'] && $config['cf_cert_req']) {
|
||||
if(trim($_POST['cert_no']) != $_SESSION['ss_cert_no'])
|
||||
alert("회원가입을 위해서는 본인확인을 해주셔야 합니다.");
|
||||
}
|
||||
|
||||
if ($config['cf_use_recommend'] && $mb_recommend) {
|
||||
if (!exist_mb_id($mb_recommend))
|
||||
alert("추천인이 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
if (strtolower($mb_id) == strtolower($mb_recommend)) {
|
||||
alert('본인을 추천할 수 없습니다.');
|
||||
}
|
||||
} else {
|
||||
// 자바스크립트로 정보변경이 가능한 버그 수정
|
||||
// 닉네임수정일이 지나지 않았다면
|
||||
if ($member['mb_nick_date'] > date("Y-m-d", G5_SERVER_TIME - ($config['cf_nick_modify'] * 86400)))
|
||||
$mb_nick = $member['mb_nick'];
|
||||
// 회원정보의 메일을 이전 메일로 옮기고 아래에서 비교함
|
||||
$old_email = $member['mb_email'];
|
||||
}
|
||||
|
||||
if ($msg = exist_mb_nick($mb_nick, $mb_id)) alert($msg, "", true, true);
|
||||
if ($msg = exist_mb_email($mb_email, $mb_id)) alert($msg, "", true, true);
|
||||
}
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($member_skin_path.'/register_form_update.head.skin.php');
|
||||
|
||||
$mb_dir = G5_DATA_PATH.'/member/'.substr($mb_id,0,2);
|
||||
|
||||
// 아이콘 삭제
|
||||
if (isset($_POST['del_mb_icon'])) {
|
||||
@unlink($mb_dir.'/'.$mb_id.'.gif');
|
||||
}
|
||||
|
||||
$msg = "";
|
||||
|
||||
// 아이콘 업로드
|
||||
$mb_icon = '';
|
||||
if (isset($_FILES['mb_icon']) && is_uploaded_file($_FILES['mb_icon']['tmp_name'])) {
|
||||
if (preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) {
|
||||
// 아이콘 용량이 설정값보다 이하만 업로드 가능
|
||||
if ($_FILES['mb_icon']['size'] <= $config['cf_member_icon_size']) {
|
||||
@mkdir($mb_dir, G5_DIR_PERMISSION);
|
||||
@chmod($mb_dir, G5_DIR_PERMISSION);
|
||||
$dest_path = $mb_dir.'/'.$mb_id.'.gif';
|
||||
move_uploaded_file($_FILES['mb_icon']['tmp_name'], $dest_path);
|
||||
chmod($dest_path, G5_FILE_PERMISSION);
|
||||
if (file_exists($dest_path)) {
|
||||
//=================================================================\
|
||||
// 090714
|
||||
// gif 파일에 악성코드를 심어 업로드 하는 경우를 방지
|
||||
// 에러메세지는 출력하지 않는다.
|
||||
//-----------------------------------------------------------------
|
||||
$size = getimagesize($dest_path);
|
||||
if ($size[2] != 1) // gif 파일이 아니면 올라간 이미지를 삭제한다.
|
||||
@unlink($dest_path);
|
||||
else
|
||||
// 아이콘의 폭 또는 높이가 설정값 보다 크다면 이미 업로드 된 아이콘 삭제
|
||||
if ($size[0] > $config['cf_member_icon_width'] || $size[1] > $config['cf_member_icon_height'])
|
||||
@unlink($dest_path);
|
||||
//=================================================================\
|
||||
}
|
||||
} else {
|
||||
$msg .= '회원아이콘을 '.number_format($config['cf_member_icon_size']).'바이트 이하로 업로드 해주십시오.';
|
||||
}
|
||||
|
||||
} else {
|
||||
$msg .= $_FILES['mb_icon']['name'].'은(는) gif 파일이 아닙니다.';
|
||||
}
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
// 본인확인
|
||||
//---------------------------------------------------------------
|
||||
$mb_hp = hyphen_hp_number($mb_hp);
|
||||
if($config['cf_cert_use'] && $_SESSION['ss_cert_type'] && $_SESSION['ss_cert_dupinfo']) {
|
||||
// 중복체크
|
||||
$sql = " select mb_id from {$g5['member_table']} where mb_id <> '{$member['mb_id']}' and mb_dupinfo = '{$_SESSION['ss_cert_dupinfo']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['mb_id']) {
|
||||
alert("입력하신 본인확인 정보로 가입된 내역이 존재합니다.\\n회원아이디 : ".$row['mb_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$sql_certify = '';
|
||||
$md5_cert_no = $_SESSION['ss_cert_no'];
|
||||
$cert_type = $_SESSION['ss_cert_type'];
|
||||
if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) {
|
||||
// 해시값이 같은 경우에만 본인확인 값을 저장한다.
|
||||
if ($_SESSION['ss_cert_hash'] == md5($mb_name.$cert_type.$_SESSION['ss_cert_birth'].$md5_cert_no)) {
|
||||
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
|
||||
$sql_certify .= " , mb_certify = '{$cert_type}' ";
|
||||
$sql_certify .= " , mb_adult = '{$_SESSION['ss_cert_adult']}' ";
|
||||
$sql_certify .= " , mb_birth = '{$_SESSION['ss_cert_birth']}' ";
|
||||
$sql_certify .= " , mb_sex = '{$_SESSION['ss_cert_sex']}' ";
|
||||
$sql_certify .= " , mb_dupinfo = '{$_SESSION['ss_cert_dupinfo']}' ";
|
||||
if($w == 'u')
|
||||
$sql_certify .= " , mb_name = '{$mb_name}' ";
|
||||
} else {
|
||||
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
|
||||
$sql_certify .= " , mb_certify = '' ";
|
||||
$sql_certify .= " , mb_adult = 0 ";
|
||||
$sql_certify .= " , mb_birth = '' ";
|
||||
$sql_certify .= " , mb_sex = '' ";
|
||||
}
|
||||
} else {
|
||||
if (get_session("ss_reg_mb_name") != $mb_name || get_session("ss_reg_mb_hp") != $mb_hp) {
|
||||
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
|
||||
$sql_certify .= " , mb_certify = '' ";
|
||||
$sql_certify .= " , mb_adult = 0 ";
|
||||
$sql_certify .= " , mb_birth = '' ";
|
||||
$sql_certify .= " , mb_sex = '' ";
|
||||
}
|
||||
}
|
||||
//===============================================================
|
||||
|
||||
if ($w == '') {
|
||||
|
||||
$sql = " insert into {$g5['member_table']}
|
||||
set mb_id = '{$mb_id}',
|
||||
mb_password = '".sql_password($mb_password)."',
|
||||
mb_name = '{$mb_name}',
|
||||
mb_nick = '{$mb_nick}',
|
||||
mb_nick_date = '".G5_TIME_YMD."',
|
||||
mb_email = '{$mb_email}',
|
||||
mb_homepage = '{$mb_homepage}',
|
||||
mb_tel = '{$mb_tel}',
|
||||
mb_zip1 = '{$mb_zip1}',
|
||||
mb_zip2 = '{$mb_zip2}',
|
||||
mb_addr1 = '{$mb_addr1}',
|
||||
mb_addr2 = '{$mb_addr2}',
|
||||
mb_addr3 = '{$mb_addr3}',
|
||||
mb_addr_jibeon = '{$mb_addr_jibeon}',
|
||||
mb_signature = '{$mb_signature}',
|
||||
mb_profile = '{$mb_profile}',
|
||||
mb_today_login = '".G5_TIME_YMDHIS."',
|
||||
mb_datetime = '".G5_TIME_YMDHIS."',
|
||||
mb_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
mb_level = '{$config['cf_register_level']}',
|
||||
mb_recommend = '{$mb_recommend}',
|
||||
mb_login_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
mb_mailling = '{$mb_mailling}',
|
||||
mb_sms = '{$mb_sms}',
|
||||
mb_open = '{$mb_open}',
|
||||
mb_open_date = '".G5_TIME_YMD."',
|
||||
mb_1 = '{$mb_1}',
|
||||
mb_2 = '{$mb_2}',
|
||||
mb_3 = '{$mb_3}',
|
||||
mb_4 = '{$mb_4}',
|
||||
mb_5 = '{$mb_5}',
|
||||
mb_6 = '{$mb_6}',
|
||||
mb_7 = '{$mb_7}',
|
||||
mb_8 = '{$mb_8}',
|
||||
mb_9 = '{$mb_9}',
|
||||
mb_10 = '{$mb_10}'
|
||||
{$sql_certify} ";
|
||||
|
||||
// 이메일 인증을 사용하지 않는다면 이메일 인증시간을 바로 넣는다
|
||||
if (!$config['cf_use_email_certify'])
|
||||
$sql .= " , mb_email_certify = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 회원가입 포인트 부여
|
||||
insert_point($mb_id, $config['cf_register_point'], '회원가입 축하', '@member', $mb_id, '회원가입');
|
||||
|
||||
// 추천인에게 포인트 부여
|
||||
if ($config['cf_use_recommend'] && $mb_recommend)
|
||||
insert_point($mb_recommend, $config['cf_recommend_point'], $mb_id.'의 추천인', '@member', $mb_recommend, $mb_id.' 추천');
|
||||
|
||||
// 회원님께 메일 발송
|
||||
if ($config['cf_email_mb_member']) {
|
||||
$subject = '['.$config['cf_title'].'] 회원가입을 축하드립니다.';
|
||||
|
||||
$mb_md5 = md5($mb_id.$mb_email.G5_TIME_YMDHIS);
|
||||
$certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&mb_md5='.$mb_md5;
|
||||
|
||||
ob_start();
|
||||
include_once ('./register_form_update_mail1.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1);
|
||||
|
||||
// 메일인증을 사용하는 경우 가입메일에 인증 url이 있으므로 인증메일을 다시 발송되지 않도록 함
|
||||
if($config['cf_use_email_certify'])
|
||||
$old_email = $mb_email;
|
||||
}
|
||||
|
||||
// 최고관리자님께 메일 발송
|
||||
if ($config['cf_email_mb_super_admin']) {
|
||||
$subject = '['.$config['cf_title'].'] '.$mb_nick .' 님께서 회원으로 가입하셨습니다.';
|
||||
|
||||
ob_start();
|
||||
include_once ('./register_form_update_mail2.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
mailer($mb_nick, $mb_email, $config['cf_admin_email'], $subject, $content, 1);
|
||||
}
|
||||
|
||||
// 메일인증 사용하지 않는 경우에만 로그인
|
||||
if (!$config['cf_use_email_certify'])
|
||||
set_session('ss_mb_id', $mb_id);
|
||||
|
||||
set_session('ss_mb_reg', $mb_id);
|
||||
|
||||
} else if ($w == 'u') {
|
||||
|
||||
if (!trim($_SESSION['ss_mb_id']))
|
||||
alert('로그인 되어 있지 않습니다.');
|
||||
|
||||
if ($_SESSION['ss_mb_id'] != $mb_id)
|
||||
alert("로그인된 정보와 수정하려는 정보가 틀리므로 수정할 수 없습니다.\\n만약 올바르지 않은 방법을 사용하신다면 바로 중지하여 주십시오.");
|
||||
|
||||
$sql_password = "";
|
||||
if ($mb_password)
|
||||
$sql_password = " , mb_password = '".sql_password($mb_password)."' ";
|
||||
|
||||
$sql_icon = "";
|
||||
if ($mb_icon)
|
||||
$sql_icon = " , mb_icon = '{$mb_icon}' ";
|
||||
|
||||
$sql_nick_date = "";
|
||||
if ($mb_nick_default != $mb_nick)
|
||||
$sql_nick_date = " , mb_nick_date = '".G5_TIME_YMD."' ";
|
||||
|
||||
$sql_open_date = "";
|
||||
if ($mb_open_default != $mb_open)
|
||||
$sql_open_date = " , mb_open_date = '".G5_TIME_YMD."' ";
|
||||
|
||||
// 이전 메일주소와 수정한 메일주소가 틀리다면 인증을 다시 해야하므로 값을 삭제
|
||||
$sql_email_certify = '';
|
||||
if ($old_email != $mb_email && $config['cf_use_email_certify'])
|
||||
$sql_email_certify = " , mb_email_certify = '' ";
|
||||
|
||||
$sql = " update {$g5['member_table']}
|
||||
set mb_nick = '{$mb_nick}',
|
||||
mb_mailling = '{$mb_mailling}',
|
||||
mb_sms = '{$mb_sms}',
|
||||
mb_open = '{$mb_open}',
|
||||
mb_email = '{$mb_email}',
|
||||
mb_homepage = '{$mb_homepage}',
|
||||
mb_tel = '{$mb_tel}',
|
||||
mb_zip1 = '{$mb_zip1}',
|
||||
mb_zip2 = '{$mb_zip2}',
|
||||
mb_addr1 = '{$mb_addr1}',
|
||||
mb_addr2 = '{$mb_addr2}',
|
||||
mb_addr3 = '{$mb_addr3}',
|
||||
mb_addr_jibeon = '{$mb_addr_jibeon}',
|
||||
mb_signature = '{$mb_signature}',
|
||||
mb_profile = '{$mb_profile}',
|
||||
mb_1 = '{$mb_1}',
|
||||
mb_2 = '{$mb_2}',
|
||||
mb_3 = '{$mb_3}',
|
||||
mb_4 = '{$mb_4}',
|
||||
mb_5 = '{$mb_5}',
|
||||
mb_6 = '{$mb_6}',
|
||||
mb_7 = '{$mb_7}',
|
||||
mb_8 = '{$mb_8}',
|
||||
mb_9 = '{$mb_9}',
|
||||
mb_10 = '{$mb_10}'
|
||||
{$sql_password}
|
||||
{$sql_icon}
|
||||
{$sql_nick_date}
|
||||
{$sql_open_date}
|
||||
{$sql_email_certify}
|
||||
{$sql_certify}
|
||||
where mb_id = '$mb_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// 인증메일 발송
|
||||
if ($config['cf_use_email_certify'] && $old_email != $mb_email) {
|
||||
$subject = '['.$config['cf_title'].'] 인증확인 메일입니다.';
|
||||
|
||||
$mb_datetime = $member['mb_datetime'] ? $member['mb_datetime'] : G5_TIME_YMDHIS;
|
||||
$mb_md5 = md5($mb_id.$mb_email.$mb_datetime);
|
||||
$certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&mb_md5='.$mb_md5;
|
||||
|
||||
ob_start();
|
||||
include_once ('./register_form_update_mail3.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
mailer($config['cf_title'], $config['cf_admin_email'], $mb_email, $subject, $content, 1);
|
||||
}
|
||||
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once ($member_skin_path.'/register_form_update.tail.skin.php');
|
||||
|
||||
unset($_SESSION['ss_cert_type']);
|
||||
unset($_SESSION['ss_cert_no']);
|
||||
unset($_SESSION['ss_cert_hash']);
|
||||
unset($_SESSION['ss_cert_birth']);
|
||||
unset($_SESSION['ss_cert_adult']);
|
||||
|
||||
if ($msg)
|
||||
echo '<script>alert(\''.$msg.'\');</script>';
|
||||
|
||||
if ($w == "") {
|
||||
goto_url(G5_HTTP_BBS_URL.'/register_result.php');
|
||||
} else if ($w == 'u') {
|
||||
$row = sql_fetch(" select mb_password from {$g5['member_table']} where mb_id = '{$member['mb_id']}' ");
|
||||
$tmp_password = $row['mb_password'];
|
||||
|
||||
if ($old_email != $mb_email && $config['cf_use_email_certify']) {
|
||||
set_session("ss_mb_id", "");
|
||||
alert('회원 정보가 수정 되었습니다.\n\nE-mail 주소가 변경되었으므로 다시 인증하셔야 합니다.', G5_URL);
|
||||
} else {
|
||||
alert('회원 정보가 수정 되었습니다.', G5_URL);
|
||||
}
|
||||
}
|
||||
?>
|
||||
39
bbs/register_form_update_mail1.php
Normal file
39
bbs/register_form_update_mail1.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// 회원가입축하 메일 (회원님께 발송)
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>회원가입 축하 메일</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">
|
||||
<div style="border:1px solid #dedede">
|
||||
<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">
|
||||
회원가입을 축하합니다.
|
||||
</h1>
|
||||
<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">
|
||||
<a href="<?php echo G5_URL ?>" target="_blank"><?php echo $config['cf_title'] ?></a>
|
||||
</span>
|
||||
<p style="margin:20px 0 0;padding:30px 30px 50px;min-height:200px;height:auto !important;height:200px;border-bottom:1px solid #eee">
|
||||
<b><?php echo $mb_name ?></b> 님의 회원가입을 진심으로 축하합니다.<br>
|
||||
회원님의 성원에 보답하고자 더욱 더 열심히 하겠습니다.<br>
|
||||
<?php if ($config['cf_use_email_certify']) { ?>아래의 <strong>메일인증</strong>을 클릭하시면 회원가입이 완료됩니다.<br><?php } ?>
|
||||
감사합니다.
|
||||
</p>
|
||||
|
||||
<?php if ($config['cf_use_email_certify']) { ?>
|
||||
<a href="<?php echo $certify_href ?>" target="_blank" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center">메일인증</a>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo G5_URL ?>" target="_blank" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center">사이트바로가기</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
35
bbs/register_form_update_mail2.php
Normal file
35
bbs/register_form_update_mail2.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// 회원가입 메일 (관리자 메일로 발송)
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>회원가입 알림 메일</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">
|
||||
<div style="border:1px solid #dedede">
|
||||
<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">
|
||||
회원가입 알림 메일
|
||||
</h1>
|
||||
<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">
|
||||
<a href="<?php echo G5_URL ?>" target="_blank"><?php echo $config['cf_title'] ?></a>
|
||||
</span>
|
||||
<p style="margin:20px 0 0;padding:30px 30px 50px;min-height:200px;height:auto !important;height:200px;border-bottom:1px solid #eee">
|
||||
<b><?php echo $mb_name ?></b> 님께서 회원가입 하셨습니다.<br>
|
||||
회원 아이디 : <b><?php echo $mb_id ?></b><br>
|
||||
회원 이름 : <?php echo $mb_name ?><br>
|
||||
회원 닉네임 : <?php echo $mb_nick ?><br>
|
||||
추천인아이디 : <?php echo $mb_recommend ?>
|
||||
</p>
|
||||
<a href="<?php echo G5_ADMIN_URL ?>/member_form.php?w=u&mb_id=<?php echo $mb_id ?>" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center">관리자에서 회원정보 확인하기</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
39
bbs/register_form_update_mail3.php
Normal file
39
bbs/register_form_update_mail3.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// E-mail 수정시 인증 메일 (회원님께 발송)
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>회원 인증 메일</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">
|
||||
<div style="border:1px solid #dedede">
|
||||
<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">
|
||||
회원 인증 메일입니다.
|
||||
</h1>
|
||||
<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">
|
||||
<a href="<?php echo G5_URL ?>" target="_blank"><?php echo $config['cf_title'] ?></a>
|
||||
</span>
|
||||
<p style="margin:20px 0 0;padding:30px 30px 50px;min-height:200px;height:auto !important;height:200px;border-bottom:1px solid #eee">
|
||||
<?php if($w == 'u') { ?>
|
||||
<b><?php echo $mb_name ?></b> 님의 E-mail 주소가 변경되었습니다.<br><br>
|
||||
<?php } ?>
|
||||
|
||||
아래의 주소를 클릭하시면 인증이 완료됩니다.<br>
|
||||
<a href="<?php echo $certify_href ?>" target="_blank"><b><?php echo $certify_href ?></b></a><br><br>
|
||||
|
||||
회원님의 성원에 보답하고자 더욱 더 열심히 하겠습니다.<br>
|
||||
감사합니다.
|
||||
</p>
|
||||
<a href="<?php echo G5_BBS_URL ?>/login.php" target="_blank" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center"><?php echo $config['cf_title'] ?> 로그인</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
15
bbs/register_result.php
Normal file
15
bbs/register_result.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (isset($_SESSION['ss_mb_reg']))
|
||||
$mb = get_member($_SESSION['ss_mb_reg']);
|
||||
|
||||
// 회원정보가 없다면 초기 페이지로 이동
|
||||
if (!$mb['mb_id'])
|
||||
goto_url(G5_URL);
|
||||
|
||||
$g5['title'] = '회원가입이 완료되었습니다.';
|
||||
include_once('./_head.php');
|
||||
include_once($member_skin_path.'/register_result.skin.php');
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
90
bbs/rss.php
Normal file
90
bbs/rss.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 특수문자 변환
|
||||
function specialchars_replace($str, $len=0) {
|
||||
if ($len) {
|
||||
$str = substr($str, 0, $len);
|
||||
}
|
||||
|
||||
$str = str_replace(array("&", "<", ">"), array("&", "<", ">"), $str);
|
||||
|
||||
/*
|
||||
$str = preg_replace("/&/", "&", $str);
|
||||
$str = preg_replace("/</", "<", $str);
|
||||
$str = preg_replace("/>/", ">", $str);
|
||||
*/
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
$sql = " select gr_id, bo_subject, bo_page_rows, bo_read_level, bo_use_rss_view from {$g5['board_table']} where bo_table = '$bo_table' ";
|
||||
$row = sql_fetch($sql);
|
||||
$subj2 = specialchars_replace($row['bo_subject'], 255);
|
||||
$lines = $row['bo_page_rows'];
|
||||
|
||||
// 비회원 읽기가 가능한 게시판만 RSS 지원
|
||||
if ($row['bo_read_level'] >= 2) {
|
||||
echo '비회원 읽기가 가능한 게시판만 RSS 지원합니다.';
|
||||
exit;
|
||||
}
|
||||
|
||||
// RSS 사용 체크
|
||||
if (!$row['bo_use_rss_view']) {
|
||||
echo 'RSS 보기가 금지되어 있습니다.';
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-type: text/xml');
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
$sql = " select gr_subject from {$g5['group_table']} where gr_id = '{$row['gr_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
$subj1 = specialchars_replace($row['gr_subject'], 255);
|
||||
|
||||
echo '<?phpxml version="1.0" encoding="utf-8" ?>'."\n";
|
||||
?>
|
||||
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<channel>
|
||||
<title><?php echo specialchars_replace($config['cf_title'].' > '.$subj1.' > '.$subj2) ?></title>
|
||||
<link><?php echo specialchars_replace(G5_BBS_URL.'/board.php?bo_table='.$bo_table) ?></link>
|
||||
<description>테스트 버전 0.2 (2004-04-26)</description>
|
||||
<language>ko</language>
|
||||
|
||||
<?php
|
||||
$sql = " select wr_id, wr_subject, wr_content, wr_name, wr_datetime, wr_option
|
||||
from {$g5['write_prefix']}$bo_table
|
||||
where wr_is_comment = 0
|
||||
and wr_option not like '%secret%'
|
||||
order by wr_num, wr_reply limit 0, $lines ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$file = '';
|
||||
|
||||
if (strstr($row['wr_option'], 'html'))
|
||||
$html = 1;
|
||||
else
|
||||
$html = 0;
|
||||
?>
|
||||
|
||||
<item>
|
||||
<title><?php echo specialchars_replace($row['wr_subject']) ?></title>
|
||||
<link><?php echo specialchars_replace(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$row['wr_id']) ?></link>
|
||||
<description><![CDATA[<?php echo $file ?><?php echo conv_content($row['wr_content'], $html) ?>]]></description>
|
||||
<dc:creator><?php echo specialchars_replace($row['wr_name']) ?></dc:creator>
|
||||
<?php
|
||||
$date = $row['wr_datetime'];
|
||||
// rss 리더 스킨으로 호출하면 날짜가 제대로 표시되지 않음
|
||||
//$date = substr($date,0,10) . "T" . substr($date,11,8) . "+09:00";
|
||||
$date = date('r', strtotime($date));
|
||||
?>
|
||||
<dc:date><?php echo $date ?></dc:date>
|
||||
</item>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '</channel>'."\n";
|
||||
echo '</rss>'."\n";
|
||||
?>
|
||||
60
bbs/scrap.php
Normal file
60
bbs/scrap.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member)
|
||||
alert_close('회원만 조회하실 수 있습니다.');
|
||||
|
||||
$g5['title'] = $member['mb_nick'].'님의 스크랩';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$sql_common = " from {$g5['scrap_table']} where mb_id = '{$member['mb_id']}' ";
|
||||
$sql_order = " order by ms_id desc ";
|
||||
|
||||
$sql = " select count(*) as cnt $sql_common ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
$list = array();
|
||||
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
$sql_order
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
|
||||
$list[$i] = $row;
|
||||
|
||||
// 순차적인 번호 (순번)
|
||||
$num = $total_count - ($page - 1) * $rows - $i;
|
||||
|
||||
// 게시판 제목
|
||||
$sql2 = " select bo_subject from {$g5['board_table']} where bo_table = '{$row['bo_table']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
if (!$row2['bo_subject']) $row2['bo_subject'] = '[게시판 없음]';
|
||||
|
||||
// 게시물 제목
|
||||
$tmp_write_table = $g5['write_prefix'] . $row['bo_table'];
|
||||
$sql3 = " select wr_subject from $tmp_write_table where wr_id = '{$row['wr_id']}' ";
|
||||
$row3 = sql_fetch($sql3, FALSE);
|
||||
$subject = get_text(cut_str($row3['wr_subject'], 100));
|
||||
if (!$row3['wr_subject'])
|
||||
$row3['wr_subject'] = '[글 없음]';
|
||||
|
||||
$list[$i]['num'] = $num;
|
||||
$list[$i]['opener_href'] = './board.php?bo_table='.$row['bo_table'];
|
||||
$list[$i]['opener_href_wr_id'] = './board.php?bo_table='.$row['bo_table'].'&wr_id='.$row['wr_id'];
|
||||
$list[$i]['bo_subject'] = $row2['bo_subject'];
|
||||
$list[$i]['subject'] = $subject;
|
||||
$list[$i]['del_href'] = './scrap_delete.php?ms_id='.$row['ms_id'].'&page='.$page;
|
||||
}
|
||||
|
||||
include_once($member_skin_path.'/scrap.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
11
bbs/scrap_delete.php
Normal file
11
bbs/scrap_delete.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member)
|
||||
alert('회원만 이용하실 수 있습니다.');
|
||||
|
||||
$sql = " delete from {$g5['scrap_table']} where mb_id = '{$member['mb_id']}' and ms_id = '$ms_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
goto_url('./scrap.php?page='.$page);
|
||||
?>
|
||||
59
bbs/scrap_popin.php
Normal file
59
bbs/scrap_popin.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if ($is_guest) {
|
||||
$href = './login.php?'.$qstr.'&url='.urlencode('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id);
|
||||
echo <<<HEREDOC
|
||||
<script>
|
||||
alert('회원만 접근 가능합니다.');
|
||||
opener.location.href = '$href';
|
||||
window.close();
|
||||
</script>
|
||||
<noscript>
|
||||
<p>회원만 접근 가능합니다.</p>
|
||||
<a href="$href">로그인하기</a>
|
||||
</noscript>
|
||||
HEREDOC;
|
||||
exit;
|
||||
}
|
||||
|
||||
echo <<<HEREDOC
|
||||
<script>
|
||||
if (window.name != 'win_scrap') {
|
||||
alert('올바른 방법으로 사용해 주십시오.');
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
HEREDOC;
|
||||
|
||||
if ($write['wr_is_comment'])
|
||||
alert_close('코멘트는 스크랩 할 수 없습니다.');
|
||||
|
||||
$sql = " select count(*) as cnt from {$g5['scrap_table']}
|
||||
where mb_id = '{$member['mb_id']}'
|
||||
and bo_table = '$bo_table'
|
||||
and wr_id = '$wr_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt']) {
|
||||
echo <<<HEREDOC
|
||||
<script>
|
||||
if (confirm('이미 스크랩하신 글 입니다.\\n\\n지금 스크랩을 확인하시겠습니까?'))
|
||||
document.location.href = './scrap.php';
|
||||
else
|
||||
window.close();
|
||||
</script>
|
||||
<noscript>
|
||||
<p>이미 스크랩하신 글 입니다.</p>
|
||||
<a href="./scrap.php">스크랩 확인하기</a>
|
||||
<a href="./board.php?bo_table={$bo_table}&wr_id=$wr_id">돌아가기</a>
|
||||
</noscript>
|
||||
HEREDOC;
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($member_skin_path.'/scrap_popin.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
104
bbs/scrap_popin_update.php
Normal file
104
bbs/scrap_popin_update.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if (!$is_member)
|
||||
{
|
||||
$href = './login.php?'.$qstr.'&url='.urlencode('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id);
|
||||
echo '<script> alert(\'회원만 접근 가능합니다.\'); top.location.href = \''.$href.'\'; </script>';
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = " select count(*) as cnt from {$g5['scrap_table']}
|
||||
where mb_id = '{$member['mb_id']}'
|
||||
and bo_table = '$bo_table'
|
||||
and wr_id = '$wr_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt'])
|
||||
{
|
||||
echo '
|
||||
<script>
|
||||
if (confirm(\'이미 스크랩하신 글 입니다.'."\n\n".'지금 스크랩을 확인하시겠습니까?\'))
|
||||
document.location.href = \'./scrap.php\';
|
||||
else
|
||||
window.close();
|
||||
</script>
|
||||
<noscript>
|
||||
<p>이미 스크랩하신 글 입니다.</p>
|
||||
<a href="./scrap.php">스크랩 확인하기</a>
|
||||
<a href="./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'">돌아가기</a>
|
||||
</noscript>';
|
||||
exit;
|
||||
}
|
||||
|
||||
// 덧글이 넘어오고 코멘트를 쓸 권한이 있다면
|
||||
if ($wr_content && ($member['mb_level'] >= $board['bo_comment_level']))
|
||||
{
|
||||
$wr = get_write($write_table, $wr_id);
|
||||
// 원글이 존재한다면
|
||||
if ($wr['wr_id'])
|
||||
{
|
||||
$mb_id = $member['mb_id'];
|
||||
$wr_name = $member['mb_nick'];
|
||||
$wr_password = $member['mb_password'];
|
||||
$wr_email = $member['mb_email'];
|
||||
$wr_homepage = $member['mb_homepage'];
|
||||
|
||||
$sql = " select max(wr_comment) as max_comment from $write_table
|
||||
where wr_parent = '$wr_id' and wr_is_comment = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$row['max_comment'] += 1;
|
||||
|
||||
$sql = " insert into $write_table
|
||||
set ca_name = '{$wr['ca_name']}',
|
||||
wr_option = '',
|
||||
wr_num = '{$wr['wr_num']}',
|
||||
wr_reply = '',
|
||||
wr_parent = '$wr_id',
|
||||
wr_is_comment = '1',
|
||||
wr_comment = '{$row['max_comment']}',
|
||||
wr_content = '$wr_content',
|
||||
mb_id = '$mb_id',
|
||||
wr_password = '$wr_password',
|
||||
wr_name = '$wr_name',
|
||||
wr_email = '$wr_email',
|
||||
wr_homepage = '$wr_homepage',
|
||||
wr_datetime = '".G5_TIME_YMDHIS."',
|
||||
wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
$comment_id = mysql_insert_id();
|
||||
|
||||
// 원글에 코멘트수 증가
|
||||
sql_query(" update $write_table set wr_comment = wr_comment + 1 where wr_id = '$wr_id' ");
|
||||
|
||||
// 새글 INSERT
|
||||
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
|
||||
|
||||
// 코멘트 1 증가
|
||||
sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ");
|
||||
|
||||
// 포인트 부여
|
||||
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 코멘트쓰기", $bo_table, $comment_id, '코멘트');
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " insert into {$g5['scrap_table']} ( mb_id, bo_table, wr_id, ms_datetime ) values ( '{$member['mb_id']}', '$bo_table', '$wr_id', '".G5_TIME_YMDHIS."' ) ";
|
||||
sql_query($sql);
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
echo <<<HEREDOC
|
||||
<script>
|
||||
if (confirm('이 글을 스크랩 하였습니다.\\n\\n지금 스크랩을 확인하시겠습니까?'))
|
||||
document.location.href = './scrap.php';
|
||||
else
|
||||
window.close();
|
||||
</script>
|
||||
<noscript>
|
||||
<p>이 글을 스크랩 하였습니다.</p>
|
||||
<a href="./scrap.php">스크랩 확인하기</a>
|
||||
</noscript>
|
||||
HEREDOC;
|
||||
?>
|
||||
237
bbs/search.php
Normal file
237
bbs/search.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = '전체검색 결과';
|
||||
include_once('./_head.php');
|
||||
|
||||
$search_table = Array();
|
||||
$table_index = 0;
|
||||
$write_pages = "";
|
||||
$text_stx = "";
|
||||
$srows = 0;
|
||||
|
||||
$stx = strip_tags($stx);
|
||||
//$stx = preg_replace('/[[:punct:]]/u', '', $stx); // 특수문자 제거
|
||||
$stx = get_search_string($stx); // 특수문자 제거
|
||||
if ($stx) {
|
||||
$stx = preg_replace('/\//', '\/', trim($stx));
|
||||
$sop = strtolower($sop);
|
||||
if (!$sop || !($sop == 'and' || $sop == 'or')) $sop = 'and'; // 연산자 and , or
|
||||
$srows = isset($_GET['srows']) ? $_GET['srows'] : 10;
|
||||
if (!$srows) $srows = 10; // 한페이지에 출력하는 검색 행수
|
||||
|
||||
$g5_search['tables'] = Array();
|
||||
$g5_search['read_level'] = Array();
|
||||
$sql = " select gr_id, bo_table, bo_read_level from {$g5['board_table']} where bo_use_search = 1 and bo_list_level <= '{$member['mb_level']}' ";
|
||||
if ($gr_id)
|
||||
$sql .= " and gr_id = '{$gr_id}' ";
|
||||
$onetable = isset($onetable) ? $onetable : "";
|
||||
if ($onetable) // 하나의 게시판만 검색한다면
|
||||
$sql .= " and bo_table = '{$onetable}' ";
|
||||
$sql .= " order by bo_order, gr_id, bo_table ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
if ($is_admin != 'super')
|
||||
{
|
||||
// 그룹접근 사용에 대한 검색 차단
|
||||
$sql2 = " select gr_use_access, gr_admin from {$g5['group_table']} where gr_id = '{$row['gr_id']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
// 그룹접근을 사용한다면
|
||||
if ($row2['gr_use_access']) {
|
||||
// 그룹관리자가 있으며 현재 회원이 그룹관리자라면 통과
|
||||
if ($row2['gr_admin'] && $row2['gr_admin'] == $member['mb_id']) {
|
||||
;
|
||||
} else {
|
||||
$sql3 = " select count(*) as cnt from {$g5['group_member_table']} where gr_id = '{$row['gr_id']}' and mb_id = '{$member['mb_id']}' and mb_id <> '' ";
|
||||
$row3 = sql_fetch($sql3);
|
||||
if (!$row3['cnt'])
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$g5_search['tables'][] = $row['bo_table'];
|
||||
$g5_search['read_level'][] = $row['bo_read_level'];
|
||||
}
|
||||
|
||||
$search_query = 'sfl='.urlencode($sfl).'&stx='.urlencode($stx).'&sop='.$sop;
|
||||
|
||||
|
||||
$text_stx = get_text(stripslashes($stx));
|
||||
|
||||
$op1 = '';
|
||||
|
||||
// 검색어를 구분자로 나눈다. 여기서는 공백
|
||||
$s = explode(' ', strip_tags($stx));
|
||||
|
||||
// 검색필드를 구분자로 나눈다. 여기서는 +
|
||||
$field = explode('||', trim($sfl));
|
||||
|
||||
$str = '(';
|
||||
for ($i=0; $i<count($s); $i++) {
|
||||
if (trim($s[$i]) == '') continue;
|
||||
|
||||
$search_str = $s[$i];
|
||||
$str .= $op1;
|
||||
$str .= "(";
|
||||
|
||||
$op2 = '';
|
||||
// 필드의 수만큼 다중 필드 검색 가능 (필드1+필드2...)
|
||||
for ($k=0; $k<count($field); $k++) {
|
||||
$str .= $op2;
|
||||
switch ($field[$k]) {
|
||||
case 'mb_id' :
|
||||
case 'wr_name' :
|
||||
$str .= "$field[$k] = '$s[$i]'";
|
||||
break;
|
||||
case 'wr_subject' :
|
||||
case 'wr_content' :
|
||||
if (preg_match("/[a-zA-Z]/", $search_str))
|
||||
$str .= "INSTR(LOWER({$field[$k]}), LOWER('{$search_str}'))";
|
||||
else
|
||||
$str .= "INSTR({$field[$k]}, '{$search_str}')";
|
||||
break;
|
||||
default :
|
||||
$str .= "1=0"; // 항상 거짓
|
||||
break;
|
||||
}
|
||||
$op2 = " or ";
|
||||
}
|
||||
$str .= ")";
|
||||
|
||||
$op1 = " {$sop} ";
|
||||
|
||||
// 인기검색어
|
||||
$sql = " insert into {$g5['popular_table']} set pp_word = '{$search_str}', pp_date = '".G5_TIME_YMD."', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
sql_query($sql, FALSE);
|
||||
}
|
||||
$str .= ")";
|
||||
|
||||
$sql_search = $str;
|
||||
|
||||
$str_board_list = "";
|
||||
$board_count = 0;
|
||||
|
||||
$time1 = get_microtime();
|
||||
|
||||
$total_count = 0;
|
||||
for ($i=0; $i<count($g5_search['tables']); $i++) {
|
||||
$tmp_write_table = $g5['write_prefix'] . $g5_search['tables'][$i];
|
||||
|
||||
$sql = " select wr_id from {$tmp_write_table} where {$sql_search} ";
|
||||
$result = sql_query($sql, false);
|
||||
$row['cnt'] = @mysql_num_rows($result);
|
||||
|
||||
$total_count += $row['cnt'];
|
||||
if ($row['cnt']) {
|
||||
$board_count++;
|
||||
$search_table[] = $g5_search['tables'][$i];
|
||||
$read_level[] = $g5_search['read_level'][$i];
|
||||
$search_table_count[] = $total_count;
|
||||
|
||||
$sql2 = " select bo_subject from {$g5['board_table']} where bo_table = '{$g5_search['tables'][$i]}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$sch_class = "";
|
||||
$sch_all = "";
|
||||
if ($onetable == $g5_search['tables'][$i]) $sch_class = "class=sch_on";
|
||||
else $sch_all = "class=sch_on";
|
||||
$str_board_list .= '<li><a href="'.$_SERVER['PHP_SELF'].'?'.$search_query.'&gr_id='.$gr_id.'&onetable='.$g5_search['tables'][$i].'" '.$sch_class.'><strong>'.$row2['bo_subject'].'</strong><span class="cnt_cmt">'.$row['cnt'].'</span></a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
$rows = $srows;
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
for ($i=0; $i<count($search_table); $i++) {
|
||||
if ($from_record < $search_table_count[$i]) {
|
||||
$table_index = $i;
|
||||
$from_record = $from_record - $search_table_count[$i-1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$bo_subject = array();
|
||||
$list = array();
|
||||
|
||||
$k=0;
|
||||
for ($idx=$table_index; $idx<count($search_table); $idx++) {
|
||||
$sql = " select bo_subject from {$g5['board_table']} where bo_table = '{$search_table[$idx]}' ";
|
||||
$row = sql_fetch($sql);
|
||||
$bo_subject[$idx] = $row['bo_subject'];
|
||||
|
||||
$tmp_write_table = $g5['write_prefix'] . $search_table[$idx];
|
||||
|
||||
$sql = " select * from {$tmp_write_table} where {$sql_search} order by wr_id desc limit {$from_record}, {$rows} ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 검색어까지 링크되면 게시판 부하가 일어남
|
||||
$list[$idx][$i] = $row;
|
||||
$list[$idx][$i]['href'] = './board.php?bo_table='.$search_table[$idx].'&wr_id='.$row['wr_parent'];
|
||||
|
||||
if ($row['wr_is_comment'])
|
||||
{
|
||||
$link .= '#c'.$row['wr_id'];
|
||||
$sql2 = " select wr_subject, wr_option from {$tmp_write_table} where wr_id = '{$row['wr_parent']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
//$row['wr_subject'] = $row2['wr_subject'];
|
||||
$row['wr_subject'] = get_text($row2['wr_subject']);
|
||||
}
|
||||
|
||||
// 비밀글은 검색 불가
|
||||
if (strstr($row['wr_option'].$row2['wr_option'], 'secret'))
|
||||
$row['wr_content'] = '[비밀글 입니다.]';
|
||||
|
||||
$subject = get_text($row['wr_subject']);
|
||||
if (strstr($sfl, 'wr_subject'))
|
||||
$subject = search_font($stx, $subject);
|
||||
|
||||
if ($read_level[$idx] <= $member['mb_level'])
|
||||
{
|
||||
//$content = cut_str(get_text(strip_tags($row['wr_content'])), 300, "…");
|
||||
$content = strip_tags($row['wr_content']);
|
||||
$content = get_text($content, 1);
|
||||
$content = strip_tags($content);
|
||||
$content = str_replace(' ', '', $content);
|
||||
$content = cut_str($content, 300, "…");
|
||||
|
||||
if (strstr($sfl, 'wr_content'))
|
||||
$content = search_font($stx, $content);
|
||||
}
|
||||
else
|
||||
$content = '';
|
||||
|
||||
$list[$idx][$i]['subject'] = $subject;
|
||||
$list[$idx][$i]['content'] = $content;
|
||||
$list[$idx][$i]['name'] = get_sideview($row['mb_id'], cut_str($row['wr_name'], $config['cf_cut_name']), $row['wr_email'], $row['wr_homepage']);
|
||||
|
||||
$k++;
|
||||
if ($k >= $rows)
|
||||
break;
|
||||
}
|
||||
sql_free_result($result);
|
||||
|
||||
if ($k >= $rows)
|
||||
break;
|
||||
|
||||
$from_record = 0;
|
||||
}
|
||||
|
||||
$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$search_query.'&gr_id='.$gr_id.'&srows='.$srows.'&onetable='.$onetable.'&page=');
|
||||
}
|
||||
|
||||
$group_select = '<label for="gr_id" class="sound_only">게시판 그룹선택</label><select name="gr_id" id="gr_id" class="select"><option value="">전체 분류';
|
||||
$sql = " select gr_id, gr_subject from {$g5['group_table']} order by gr_id ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
$group_select .= "<option value=\"".$row['gr_id']."\"".get_selected($_GET['gr_id'], $row['gr_id']).">".$row['gr_subject']."</option>";
|
||||
$group_select .= '</select>';
|
||||
|
||||
if (!$sfl) $sfl = 'wr_subject';
|
||||
if (!$sop) $sop = 'or';
|
||||
|
||||
include_once($search_skin_path.'/search.skin.php');
|
||||
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
21
bbs/sns_send.php
Normal file
21
bbs/sns_send.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
include_once("./_common.php");
|
||||
|
||||
$title = str_replace('\"', '"',$_REQUEST['title']);
|
||||
$short_url = googl_short_url($_REQUEST['longurl']);
|
||||
$title_url = $title.' : '.$short_url;
|
||||
|
||||
switch($_REQUEST['sns']) {
|
||||
case 'facebook' :
|
||||
header("Location:http://www.facebook.com/sharer/sharer.php?s=100&p[url]=".$short_url."&p[title]=".$title);
|
||||
break;
|
||||
case 'twitter' :
|
||||
header("Location:http://twitter.com/home?status=".$title_url);
|
||||
break;
|
||||
case 'gplus' :
|
||||
header("Location:https://plus.google.com/share?url=".$short_url);
|
||||
break;
|
||||
default :
|
||||
echo 'Error';
|
||||
}
|
||||
?>
|
||||
146
bbs/view.php
Normal file
146
bbs/view.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 게시판에서 두단어 이상 검색 후 검색된 게시물에 코멘트를 남기면 나오던 오류 수정
|
||||
$sop = strtolower($sop);
|
||||
if ($sop != 'and' && $sop != 'or')
|
||||
$sop = 'and';
|
||||
|
||||
@include_once($board_skin_path.'/view.head.skin.php');
|
||||
|
||||
$sql_search = "";
|
||||
// 검색이면
|
||||
if ($sca || $stx) {
|
||||
// where 문을 얻음
|
||||
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
|
||||
$search_href = './board.php?bo_table='.$bo_table.'&page='.$page.$qstr;
|
||||
$list_href = './board.php?bo_table='.$bo_table;
|
||||
} else {
|
||||
$search_href = '';
|
||||
$list_href = './board.php?bo_table='.$bo_table.'&page='.$page;
|
||||
}
|
||||
|
||||
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 ";
|
||||
$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 ";
|
||||
$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 ";
|
||||
$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 ";
|
||||
$next = sql_fetch($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// 이전글 링크
|
||||
$prev_href = '';
|
||||
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.'&wr_id='.$prev['wr_id'].$qstr;
|
||||
}
|
||||
|
||||
// 다음글 링크
|
||||
$next_href = '';
|
||||
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.'&wr_id='.$next['wr_id'].$qstr;
|
||||
}
|
||||
|
||||
// 쓰기 링크
|
||||
$write_href = '';
|
||||
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'])
|
||||
$reply_href = './write.php?w=r&bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr;
|
||||
|
||||
// 수정, 삭제 링크
|
||||
$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='.$wr_id.'&page='.$page.$qstr;
|
||||
$delete_href = './delete.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.urldecode($qstr);
|
||||
if ($is_admin)
|
||||
{
|
||||
set_session("ss_delete_token", $token = uniqid(time()));
|
||||
$delete_href ='./delete.php?bo_table='.$bo_table.'&wr_id='.$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='.$wr_id.'&page='.$page.$qstr;
|
||||
$delete_href = './password.php?w=d&bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr;
|
||||
}
|
||||
|
||||
// 최고, 그룹관리자라면 글 복사, 이동 가능
|
||||
$copy_href = $move_href = '';
|
||||
if ($write['wr_reply'] == '' && ($is_admin == 'super' || $is_admin == 'group')) {
|
||||
$copy_href = './move.php?sw=copy&bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr;
|
||||
$move_href = './move.php?sw=move&bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr;
|
||||
}
|
||||
|
||||
$scrap_href = '';
|
||||
$good_href = '';
|
||||
$nogood_href = '';
|
||||
if ($is_member) {
|
||||
// 스크랩 링크
|
||||
$scrap_href = './scrap_popin.php?bo_table='.$bo_table.'&wr_id='.$wr_id;
|
||||
|
||||
// 추천 링크
|
||||
if ($board['bo_use_good'])
|
||||
$good_href = './good.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&good=good';
|
||||
|
||||
// 비추천 링크
|
||||
if ($board['bo_use_nogood'])
|
||||
$nogood_href = './good.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&good=nogood';
|
||||
}
|
||||
|
||||
$view = get_view($write, $board, $board_skin_path);
|
||||
|
||||
if (strstr($sfl, 'subject'))
|
||||
$view['subject'] = search_font($stx, $view['subject']);
|
||||
|
||||
$html = 0;
|
||||
if (strstr($view['wr_option'], 'html1'))
|
||||
$html = 1;
|
||||
else if (strstr($view['wr_option'], 'html2'))
|
||||
$html = 2;
|
||||
|
||||
$view['content'] = conv_content($view['wr_content'], $html);
|
||||
if (strstr($sfl, 'content'))
|
||||
$view['content'] = search_font($stx, $view['content']);
|
||||
|
||||
//$view['rich_content'] = preg_replace("/{이미지\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view['content']);
|
||||
function conv_rich_content($matches)
|
||||
{
|
||||
global $view;
|
||||
return view_image($view, $matches[1], $matches[2]);
|
||||
}
|
||||
$view['rich_content'] = preg_replace_callback("/{이미지\:([0-9]+)[:]?([^}]*)}/i", "conv_rich_content", $view['content']);
|
||||
|
||||
$is_signature = false;
|
||||
$signature = '';
|
||||
if ($board['bo_use_signature'] && $view['mb_id']) {
|
||||
$is_signature = true;
|
||||
$mb = get_member($view['mb_id']);
|
||||
$signature = $mb['mb_signature'];
|
||||
|
||||
$signature = conv_content($signature, 1);
|
||||
}
|
||||
|
||||
include_once($board_skin_path.'/view.skin.php');
|
||||
|
||||
@include_once($board_skin_path.'/view.tail.skin.php');
|
||||
?>
|
||||
120
bbs/view_comment.php
Normal file
120
bbs/view_comment.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
$captcha_html = "";
|
||||
if ($is_guest && $board['bo_comment_level'] < 2) {
|
||||
$captcha_html = captcha_html('_comment');
|
||||
}
|
||||
|
||||
@include_once($board_skin_path.'/view_comment.head.skin.php');
|
||||
|
||||
// 코멘트를 새창으로 여는 경우 세션값이 없으므로 생성한다.
|
||||
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'])
|
||||
$is_comment_write = true;
|
||||
|
||||
// 코멘트 출력
|
||||
//$sql = " select * from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply ";
|
||||
$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; $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']);
|
||||
|
||||
$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>';
|
||||
|
||||
|
||||
|
||||
// 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
|
||||
//$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row['wr_content']);
|
||||
|
||||
$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']);
|
||||
}
|
||||
|
||||
$list[$i]['datetime'] = substr($row['wr_datetime'],2,14);
|
||||
|
||||
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
|
||||
$list[$i]['ip'] = $row['wr_ip'];
|
||||
if (!$is_admin)
|
||||
$list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['wr_ip']);
|
||||
|
||||
$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 ($row['mb_id'] == $member['mb_id'] || $is_admin)
|
||||
{
|
||||
$list[$i]['del_link'] = './delete_comment.php?bo_table='.$bo_table.'&comment_id='.$row['wr_id'].'&token='.$token.'&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&bo_table='.$bo_table.'&comment_id='.$row['wr_id'].'&page='.$page.$qstr;
|
||||
$list[$i]['is_del'] = 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'])
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 코멘트수 제한 설정값
|
||||
if ($is_admin)
|
||||
{
|
||||
$comment_min = $comment_max = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$comment_min = (int)$board['bo_comment_min'];
|
||||
$comment_max = (int)$board['bo_comment_max'];
|
||||
}
|
||||
|
||||
include_once($board_skin_path.'/view_comment.skin.php');
|
||||
|
||||
if (!$member['mb_id']) // 비회원일 경우에만
|
||||
echo '<script src="'.G5_JS_URL.'/md5.js"></script>'."\n";
|
||||
|
||||
@include_once($board_skin_path.'/view_comment.tail.skin.php');
|
||||
?>
|
||||
110
bbs/view_image.php
Normal file
110
bbs/view_image.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$g5['title'] = '이미지 크게보기';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$filename = $_GET['fn'];
|
||||
$bo_table = $_GET['bo_table'];
|
||||
|
||||
if(strpos($filename, 'data/editor')) {
|
||||
$editor_file = strstr($filename, 'editor');
|
||||
$filepath = G5_DATA_PATH.'/'.$editor_file;
|
||||
} else if(strpos($filename, 'data/qa')) {
|
||||
$editor_file = strstr($filename, 'qa');
|
||||
$filepath = G5_DATA_PATH.'/'.$editor_file;
|
||||
} else {
|
||||
$editor_file = '';
|
||||
$filepath = G5_DATA_PATH.'/file/'.$bo_table.'/'.$filename;
|
||||
}
|
||||
|
||||
if(is_file($filepath)) {
|
||||
$size = @getimagesize($filepath);
|
||||
if(empty($size))
|
||||
alert_close('이미지 파일이 아닙니다.');
|
||||
|
||||
$width = $size[0];
|
||||
$height = $size[1];
|
||||
|
||||
if($editor_file)
|
||||
$fileurl = G5_DATA_URL.'/'.$editor_file;
|
||||
else
|
||||
$fileurl = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename;
|
||||
|
||||
$img = '<img src="'.$fileurl.'" alt="" width="'.$width.'" height="'.$height.'" class="draggable" style="position:relative;top:0;left:0;cursor:move;">';
|
||||
} else {
|
||||
alert_close('파일이 존재하지 않습니다.');
|
||||
}
|
||||
?>
|
||||
|
||||
<div><?php echo $img ?></div>
|
||||
|
||||
<script>
|
||||
var win_w = <?php echo $width ?>;
|
||||
var win_h = <?php echo $height ?> + 70;
|
||||
var win_l = (screen.width - win_w) / 2;
|
||||
var win_t = (screen.height - win_h) / 2;
|
||||
|
||||
if(win_w > screen.width) {
|
||||
win_l = 0;
|
||||
win_w = screen.width - 20;
|
||||
|
||||
if(win_h > screen.height) {
|
||||
win_t = 0;
|
||||
win_h = screen.height - 40;
|
||||
}
|
||||
}
|
||||
|
||||
if(win_h > screen.height) {
|
||||
win_t = 0;
|
||||
win_h = screen.height - 40;
|
||||
|
||||
if(win_w > screen.width) {
|
||||
win_w = screen.width - 20;
|
||||
win_l = 0;
|
||||
}
|
||||
}
|
||||
|
||||
window.moveTo(win_l, win_t);
|
||||
window.resizeTo(win_w, win_h);
|
||||
|
||||
$(function() {
|
||||
var is_draggable = false;
|
||||
var x = y = 0;
|
||||
var pos_x = pos_y = 0;
|
||||
|
||||
$(".draggable").mousemove(function(e) {
|
||||
if(is_draggable) {
|
||||
x = parseInt($(this).css("left")) - (pos_x - e.pageX);
|
||||
y = parseInt($(this).css("top")) - (pos_y - e.pageY);
|
||||
|
||||
pos_x = e.pageX;
|
||||
pos_y = e.pageY;
|
||||
|
||||
$(this).css({ "left" : x, "top" : y });
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".draggable").mousedown(function(e) {
|
||||
pos_x = e.pageX;
|
||||
pos_y = e.pageY;
|
||||
is_draggable = true;
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".draggable").mouseup(function() {
|
||||
is_draggable = false;
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".draggable").dblclick(function() {
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
63
bbs/visit_insert.inc.php
Normal file
63
bbs/visit_insert.inc.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 컴퓨터의 아이피와 쿠키에 저장된 아이피가 다르다면 테이블에 반영함
|
||||
if (get_cookie('ck_visit_ip') != $_SERVER['REMOTE_ADDR'])
|
||||
{
|
||||
set_cookie('ck_visit_ip', $_SERVER['REMOTE_ADDR'], 86400); // 하루동안 저장
|
||||
|
||||
$tmp_row = sql_fetch(" select max(vi_id) as max_vi_id from {$g5['visit_table']} ");
|
||||
$vi_id = $tmp_row['max_vi_id'] + 1;
|
||||
|
||||
// $_SERVER 배열변수 값의 변조를 이용한 SQL Injection 공격을 막는 코드입니다. 110810
|
||||
$remote_addr = escape_trim($_SERVER['REMOTE_ADDR']);
|
||||
$referer = "";
|
||||
if (isset($_SERVER['HTTP_REFERER']))
|
||||
$referer = escape_trim($_SERVER['HTTP_REFERER']);
|
||||
$user_agent = escape_trim($_SERVER['HTTP_USER_AGENT']);
|
||||
$sql = " insert {$g5['visit_table']} ( vi_id, vi_ip, vi_date, vi_time, vi_referer, vi_agent ) values ( '{$vi_id}', '{$remote_addr}', '".G5_TIME_YMD."', '".G5_TIME_HIS."', '{$referer}', '{$user_agent}' ) ";
|
||||
|
||||
$result = sql_query($sql, FALSE);
|
||||
// 정상으로 INSERT 되었다면 방문자 합계에 반영
|
||||
if ($result) {
|
||||
$sql = " insert {$g5['visit_sum_table']} ( vs_count, vs_date) values ( 1, '".G5_TIME_YMD."' ) ";
|
||||
$result = sql_query($sql, FALSE);
|
||||
|
||||
// DUPLICATE 오류가 발생한다면 이미 날짜별 행이 생성되었으므로 UPDATE 실행
|
||||
if (!$result) {
|
||||
$sql = " update {$g5['visit_sum_table']} set vs_count = vs_count + 1 where vs_date = '".G5_TIME_YMD."' ";
|
||||
$result = sql_query($sql);
|
||||
}
|
||||
|
||||
// INSERT, UPDATE 된건이 있다면 기본환경설정 테이블에 저장
|
||||
// 방문객 접속시마다 따로 쿼리를 하지 않기 위함 (엄청난 쿼리를 줄임 ^^)
|
||||
|
||||
// 오늘
|
||||
$sql = " select vs_count as cnt from {$g5['visit_sum_table']} where vs_date = '".G5_TIME_YMD."' ";
|
||||
$row = sql_fetch($sql);
|
||||
$vi_today = $row['cnt'];
|
||||
|
||||
// 어제
|
||||
$sql = " select vs_count as cnt from {$g5['visit_sum_table']} where vs_date = DATE_SUB('".G5_TIME_YMD."', INTERVAL 1 DAY) ";
|
||||
$row = sql_fetch($sql);
|
||||
$vi_yesterday = $row['cnt'];
|
||||
|
||||
// 최대
|
||||
$sql = " select max(vs_count) as cnt from {$g5['visit_sum_table']} ";
|
||||
$row = sql_fetch($sql);
|
||||
$vi_max = $row['cnt'];
|
||||
|
||||
// 전체
|
||||
$sql = " select sum(vs_count) as total from {$g5['visit_sum_table']} ";
|
||||
$row = sql_fetch($sql);
|
||||
$vi_sum = $row['total'];
|
||||
|
||||
$visit = '오늘:'.$vi_today.',어제:'.$vi_yesterday.',최대:'.$vi_max.',전체:'.$vi_sum;
|
||||
|
||||
// 기본설정 테이블에 방문자수를 기록한 후
|
||||
// 방문자수 테이블을 읽지 않고 출력한다.
|
||||
// 쿼리의 수를 상당부분 줄임
|
||||
sql_query(" update {$g5['config_table']} set cf_visit = '{$visit}' ");
|
||||
}
|
||||
}
|
||||
?>
|
||||
417
bbs/write.php
Normal file
417
bbs/write.php
Normal file
@ -0,0 +1,417 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
set_session('ss_bo_table', $_REQUEST['bo_table']);
|
||||
set_session('ss_wr_id', $_REQUEST['wr_id']);
|
||||
|
||||
if (!$board['bo_table']) {
|
||||
alert('존재하지 않는 게시판입니다.', G5_URL);
|
||||
}
|
||||
|
||||
if (!$bo_table) {
|
||||
alert("bo_table 값이 넘어오지 않았습니다.\\nwrite.php?bo_table=code 와 같은 방식으로 넘겨 주세요.", G5_URL);
|
||||
}
|
||||
|
||||
check_device($board['bo_device']);
|
||||
|
||||
$notice_array = explode(',', trim($board['bo_notice']));
|
||||
|
||||
if (!($w == '' || $w == 'u' || $w == 'r')) {
|
||||
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 ($w == '') {
|
||||
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.'&url='.urlencode($_SERVER['PHP_SELF'].'?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포인트를 적립하신 후 다시 글쓰기 해 주십시오.');
|
||||
}
|
||||
}
|
||||
|
||||
$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.'&url='.urlencode($_SERVER['PHP_SELF'].'?bo_table='.$bo_table));
|
||||
}
|
||||
}
|
||||
|
||||
$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}
|
||||
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답변글이 있는 원글은 수정할 수 없습니다.');
|
||||
|
||||
// 코멘트 달린 원글의 수정 여부
|
||||
$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'].'건 이상 달린 원글은 수정할 수 없습니다.');
|
||||
|
||||
$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&url='.urlencode($_SERVER['PHP_SELF'].'?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개 까지만 가능합니다.');
|
||||
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.'&url='.urlencode($_SERVER['PHP_SELF'].'?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 ($config['cf_cert_use'] && !$is_admin) {
|
||||
// 인증된 회원만 가능
|
||||
if ($board['bo_use_cert'] != '' && $is_guest) {
|
||||
alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', 'login.php?'.$qstr.'&url='.urlencode($_SERVER['PHP_SELF'].'?bo_table='.$bo_table));
|
||||
}
|
||||
|
||||
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'] == '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 ($is_admin || $board['bo_use_dhtml_editor'])
|
||||
{
|
||||
$write_min = $write_max = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$write_min = (int)$board['bo_write_min'];
|
||||
$write_max = (int)$board['bo_write_max'];
|
||||
}
|
||||
|
||||
$g5['title'] = $board['bo_subject']." ".$title_msg;
|
||||
|
||||
$is_notice = false;
|
||||
$notice_checked = '';
|
||||
if ($is_admin && $w != 'r') {
|
||||
$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';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$is_html = false;
|
||||
if ($member['mb_level'] >= $board['bo_html_level'])
|
||||
$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_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;
|
||||
}
|
||||
|
||||
$is_link = false;
|
||||
if ($member['mb_level'] >= $board['bo_link_level']) {
|
||||
$is_link = true;
|
||||
}
|
||||
|
||||
$is_file = false;
|
||||
if ($member['mb_level'] >= $board['bo_upload_level']) {
|
||||
$is_file = true;
|
||||
}
|
||||
|
||||
$is_file_content = false;
|
||||
if ($board['bo_use_file_content']) {
|
||||
$is_file_content = true;
|
||||
}
|
||||
|
||||
$file_count = (int)$board['bo_upload_count'];
|
||||
|
||||
$name = "";
|
||||
$email = "";
|
||||
$homepage = "";
|
||||
if ($w == "" || $w == "r") {
|
||||
if ($is_member) {
|
||||
if (isset($write['wr_name'])) {
|
||||
$name = get_text(cut_str($write['wr_name'],20));
|
||||
}
|
||||
$email = $member['mb_email'];
|
||||
$homepage = get_text($member['mb_homepage']);
|
||||
}
|
||||
}
|
||||
|
||||
$html_checked = "";
|
||||
$html_value = "";
|
||||
$secret_checked = "";
|
||||
|
||||
if ($w == '') {
|
||||
$password_required = 'required';
|
||||
} else if ($w == 'u') {
|
||||
$password_required = '';
|
||||
|
||||
if (!$is_admin) {
|
||||
if (!($is_member && $member['mb_id'] == $write['mb_id'])) {
|
||||
if (sql_password($wr_password) != $write['wr_password']) {
|
||||
alert('비밀번호가 틀립니다.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$name = get_text(cut_str($write['wr_name'],20));
|
||||
$email = $write['wr_email'];
|
||||
$homepage = get_text($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];
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
$file = get_file($bo_table, $wr_id);
|
||||
} else if ($w == 'r') {
|
||||
if (strstr($write['wr_option'], 'secret')) {
|
||||
$is_secret = true;
|
||||
$secret_checked = 'checked';
|
||||
}
|
||||
|
||||
$password_required = "required";
|
||||
|
||||
for ($i=1; $i<=G5_LINK_COUNT; $i++) {
|
||||
$write['wr_link'.$i] = get_text($write['wr_link'.$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$subject = "";
|
||||
if (isset($write['wr_subject'])) {
|
||||
$subject = str_replace("\"", """, get_text(cut_str($write['wr_subject'], 255), 0));
|
||||
}
|
||||
|
||||
$content = '';
|
||||
if ($w == '') {
|
||||
$content = $board['bo_insert_content'];
|
||||
} else if ($w == 'r') {
|
||||
if (!strstr($write['wr_option'], 'html')) {
|
||||
$content = "\n\n\n > "
|
||||
."\n > "
|
||||
."\n > ".str_replace("\n", "\n> ", get_text($write['wr_content'], 0))
|
||||
."\n > "
|
||||
."\n > ";
|
||||
|
||||
}
|
||||
} else {
|
||||
$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 .= '%';
|
||||
else
|
||||
$width .= 'px';
|
||||
|
||||
$captcha_html = '';
|
||||
$captcha_js = '';
|
||||
if ($is_guest) {
|
||||
$captcha_html = captcha_html();
|
||||
$captcha_js = chk_captcha_js();
|
||||
}
|
||||
|
||||
$is_dhtml_editor = false;
|
||||
// 모바일에서는 DHTML 에디터 사용불가
|
||||
if ($config['cf_editor'] && !G5_IS_MOBILE && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) {
|
||||
$is_dhtml_editor = true;
|
||||
}
|
||||
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
|
||||
$editor_js = '';
|
||||
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
|
||||
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);
|
||||
|
||||
// 임시 저장된 글 수
|
||||
$autosave_count = autosave_count($member['mb_id']);
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
@include_once ($board_skin_path.'/write.head.skin.php');
|
||||
include_once('./board_head.php');
|
||||
|
||||
$action_url = https_url(G5_BBS_DIR)."/write_update.php";
|
||||
|
||||
echo '<!-- skin : '.$board_skin_path.' -->';
|
||||
include_once ($board_skin_path.'/write.skin.php');
|
||||
|
||||
include_once('./board_tail.php');
|
||||
@include_once ($board_skin_path.'/write.tail.skin.php');
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
332
bbs/write_comment_update.php
Normal file
332
bbs/write_comment_update.php
Normal file
@ -0,0 +1,332 @@
|
||||
<?php
|
||||
define('G5_CAPTCHA', true);
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
// 090710
|
||||
if (substr_count($wr_content, "&#") > 50) {
|
||||
alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.');
|
||||
exit;
|
||||
}
|
||||
|
||||
@include_once($board_skin_path.'/write_comment_update.head.skin.php');
|
||||
|
||||
$w = $_POST["w"];
|
||||
$wr_name = trim($_POST['wr_name']);
|
||||
$wr_email = '';
|
||||
if (!empty($_POST['wr_email']))
|
||||
$wr_email = trim($_POST['wr_email']);
|
||||
|
||||
// 비회원의 경우 이름이 누락되는 경우가 있음
|
||||
if ($is_guest) {
|
||||
if ($wr_name == '')
|
||||
alert('이름은 필히 입력하셔야 합니다.');
|
||||
if(!chk_captcha())
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
if ($w == "c" || $w == "cu") {
|
||||
if ($member['mb_level'] < $board['bo_comment_level'])
|
||||
alert('댓글을 쓸 권한이 없습니다.');
|
||||
}
|
||||
else
|
||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||
|
||||
// 세션의 시간 검사
|
||||
// 4.00.15 - 댓글 수정시 연속 게시물 등록 메시지로 인한 오류 수정
|
||||
if ($w == 'c' && $_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin)
|
||||
alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.');
|
||||
|
||||
set_session('ss_datetime', G5_SERVER_TIME);
|
||||
|
||||
$wr = get_write($write_table, $wr_id);
|
||||
if (empty($wr['wr_id']))
|
||||
alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다.");
|
||||
|
||||
|
||||
// "인터넷옵션 > 보안 > 사용자정의수준 > 스크립팅 > Action 스크립팅 > 사용 안 함" 일 경우의 오류 처리
|
||||
// 이 옵션을 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다.
|
||||
//if (!trim($_POST["wr_content"])) die ("내용을 입력하여 주십시오.");
|
||||
|
||||
if ($is_member)
|
||||
{
|
||||
$mb_id = $member['mb_id'];
|
||||
// 4.00.13 - 실명 사용일때 댓글에 닉네임으로 입력되던 오류를 수정
|
||||
$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
|
||||
{
|
||||
$mb_id = '';
|
||||
$wr_password = sql_password($wr_password);
|
||||
}
|
||||
|
||||
if ($w == 'c') // 댓글 입력
|
||||
{
|
||||
/*
|
||||
if ($member[mb_point] + $board[bo_comment_point] < 0 && !$is_admin)
|
||||
alert('보유하신 포인트('.number_format($member[mb_point]).')가 없거나 모자라서 댓글쓰기('.number_format($board[bo_comment_point]).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.');
|
||||
*/
|
||||
// 댓글쓰기 포인트설정시 회원의 포인트가 음수인 경우 댓글을 쓰지 못하던 버그를 수정 (곱슬최씨님)
|
||||
$tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0;
|
||||
if ($tmp_point + $board['bo_comment_point'] < 0 && !$is_admin)
|
||||
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 댓글쓰기('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.');
|
||||
|
||||
// 댓글 답변
|
||||
if ($comment_id)
|
||||
{
|
||||
$sql = " select wr_id, wr_comment, wr_comment_reply from $write_table
|
||||
where wr_id = '$comment_id' ";
|
||||
$reply_array = sql_fetch($sql);
|
||||
if (!$reply_array['wr_id'])
|
||||
alert('답변할 댓글이 없습니다.\\n\\n답변하는 동안 댓글이 삭제되었을 수 있습니다.');
|
||||
|
||||
$tmp_comment = $reply_array['wr_comment'];
|
||||
|
||||
if (strlen($reply_array['wr_comment_reply']) == 5)
|
||||
alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 5단계 까지만 가능합니다.');
|
||||
|
||||
$reply_len = strlen($reply_array['wr_comment_reply']) + 1;
|
||||
if ($board['bo_reply_order']) {
|
||||
$begin_reply_char = 'A';
|
||||
$end_reply_char = 'Z';
|
||||
$reply_number = +1;
|
||||
$sql = " select MAX(SUBSTRING(wr_comment_reply, $reply_len, 1)) as reply
|
||||
from $write_table
|
||||
where wr_parent = '$wr_id'
|
||||
and wr_comment = '$tmp_comment'
|
||||
and SUBSTRING(wr_comment_reply, $reply_len, 1) <> '' ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$begin_reply_char = 'Z';
|
||||
$end_reply_char = 'A';
|
||||
$reply_number = -1;
|
||||
$sql = " select MIN(SUBSTRING(wr_comment_reply, $reply_len, 1)) as reply
|
||||
from $write_table
|
||||
where wr_parent = '$wr_id'
|
||||
and wr_comment = '$tmp_comment'
|
||||
and SUBSTRING(wr_comment_reply, $reply_len, 1) <> '' ";
|
||||
}
|
||||
if ($reply_array['wr_comment_reply'])
|
||||
$sql .= " and wr_comment_reply like '{$reply_array['wr_comment_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);
|
||||
|
||||
$tmp_comment_reply = $reply_array['wr_comment_reply'] . $reply_char;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = " select max(wr_comment) as max_comment from $write_table
|
||||
where wr_parent = '$wr_id' and wr_is_comment = 1 ";
|
||||
$row = sql_fetch($sql);
|
||||
//$row[max_comment] -= 1;
|
||||
$row['max_comment'] += 1;
|
||||
$tmp_comment = $row['max_comment'];
|
||||
$tmp_comment_reply = '';
|
||||
}
|
||||
|
||||
$wr_subject = get_text(stripslashes($wr['wr_subject']));
|
||||
|
||||
$sql = " insert into $write_table
|
||||
set ca_name = '{$wr['ca_name']}',
|
||||
wr_option = '$wr_secret',
|
||||
wr_num = '{$wr['wr_num']}',
|
||||
wr_reply = '',
|
||||
wr_parent = '$wr_id',
|
||||
wr_is_comment = 1,
|
||||
wr_comment = '$tmp_comment',
|
||||
wr_comment_reply = '$tmp_comment_reply',
|
||||
wr_subject = '',
|
||||
wr_content = '$wr_content',
|
||||
mb_id = '$mb_id',
|
||||
wr_password = '$wr_password',
|
||||
wr_name = '$wr_name',
|
||||
wr_email = '$wr_email',
|
||||
wr_homepage = '$wr_homepage',
|
||||
wr_datetime = '".G5_TIME_YMDHIS."',
|
||||
wr_last = '',
|
||||
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
wr_1 = '$wr_1',
|
||||
wr_2 = '$wr_2',
|
||||
wr_3 = '$wr_3',
|
||||
wr_4 = '$wr_4',
|
||||
wr_5 = '$wr_5',
|
||||
wr_6 = '$wr_6',
|
||||
wr_7 = '$wr_7',
|
||||
wr_8 = '$wr_8',
|
||||
wr_9 = '$wr_9',
|
||||
wr_10 = '$wr_10' ";
|
||||
sql_query($sql);
|
||||
|
||||
$comment_id = mysql_insert_id();
|
||||
|
||||
// 원글에 댓글수 증가 & 마지막 시간 반영
|
||||
sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '".G5_TIME_YMDHIS."' where wr_id = '$wr_id' ");
|
||||
|
||||
// 새글 INSERT
|
||||
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
|
||||
|
||||
// 댓글 1 증가
|
||||
sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ");
|
||||
|
||||
// 포인트 부여
|
||||
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글');
|
||||
|
||||
// 메일발송 사용
|
||||
if ($config['cf_email_use'] && $board['bo_use_email'])
|
||||
{
|
||||
// 관리자의 정보를 얻고
|
||||
$super_admin = get_admin('super');
|
||||
$group_admin = get_admin('group');
|
||||
$board_admin = get_admin('board');
|
||||
|
||||
$wr_content = nl2br(get_text(stripslashes("원글\n{$wr['wr_subject']}\n\n\n댓글\n$wr_content")));
|
||||
|
||||
$warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'댓글 ', 'cu'=>'댓글 수정' );
|
||||
$str = $warr[$w];
|
||||
|
||||
$subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' 게시판에 '.$str.'글이 올라왔습니다.';
|
||||
// 4.00.15 - 메일로 보내는 댓글의 바로가기 링크 수정
|
||||
$link_url = G5_BBS_URL."/board.php?bo_table=".$bo_table."&wr_id=".$wr_id."&".$qstr."#c_".$comment_id;
|
||||
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
ob_start();
|
||||
include_once ('./write_update_mail.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$array_email = array();
|
||||
// 게시판관리자에게 보내는 메일
|
||||
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_super_admin']) $array_email[] = $super_admin['mb_email'];
|
||||
|
||||
// 원글게시자에게 보내는 메일
|
||||
if ($config['cf_email_wr_write']) $array_email[] = $wr['wr_email'];
|
||||
|
||||
// 댓글 쓴 모든이에게 메일 발송이 되어 있다면 (자신에게는 발송하지 않는다)
|
||||
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']}', '' )
|
||||
and wr_parent = '$wr_id' ";
|
||||
$result = sql_query($sql);
|
||||
while ($row=sql_fetch_array($result))
|
||||
$array_email[] = $row['wr_email'];
|
||||
}
|
||||
|
||||
// 중복된 메일 주소는 제거
|
||||
$unique_email = array_unique($array_email);
|
||||
$unique_email = array_values($unique_email);
|
||||
for ($i=0; $i<count($unique_email); $i++) {
|
||||
mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// SNS 등록
|
||||
include_once("./write_comment_update.sns.php");
|
||||
if($wr_facebook_user || $wr_twitter_user) {
|
||||
$sql = " update $write_table
|
||||
set wr_facebook_user = '$wr_facebook_user',
|
||||
wr_twitter_user = '$wr_twitter_user'
|
||||
where wr_id = '$comment_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
else if ($w == 'cu') // 댓글 수정
|
||||
{
|
||||
$sql = " select mb_id, wr_password, wr_comment, wr_comment_reply from $write_table
|
||||
where wr_id = '$comment_id' ";
|
||||
$comment = $reply_array = sql_fetch($sql);
|
||||
$tmp_comment = $reply_array['wr_comment'];
|
||||
|
||||
$len = strlen($reply_array['wr_comment_reply']);
|
||||
if ($len < 0) $len = 0;
|
||||
$comment_reply = substr($reply_array['wr_comment_reply'], 0, $len);
|
||||
//print_r2($GLOBALS); exit;
|
||||
|
||||
if ($is_admin == 'super') // 최고관리자 통과
|
||||
;
|
||||
else if ($is_admin == 'group') { // 그룹관리자
|
||||
$mb = get_member($comment['mb_id']);
|
||||
if ($member['mb_id'] == $group['gr_admin']) { // 자신이 관리하는 그룹인가?
|
||||
if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
;
|
||||
else
|
||||
alert('그룹관리자의 권한보다 높은 회원의 댓글이므로 수정할 수 없습니다.');
|
||||
} else
|
||||
alert('자신이 관리하는 그룹의 게시판이 아니므로 댓글을 수정할 수 없습니다.');
|
||||
} else if ($is_admin == 'board') { // 게시판관리자이면
|
||||
$mb = get_member($comment['mb_id']);
|
||||
if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가?
|
||||
if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
;
|
||||
else
|
||||
alert('게시판관리자의 권한보다 높은 회원의 댓글이므로 수정할 수 없습니다.');
|
||||
} else
|
||||
alert('자신이 관리하는 게시판이 아니므로 댓글을 수정할 수 없습니다.');
|
||||
} else if ($member['mb_id']) {
|
||||
if ($member['mb_id'] != $comment['mb_id'])
|
||||
alert('자신의 글이 아니므로 수정할 수 없습니다.');
|
||||
} else {
|
||||
if($comment['wr_password'] != $wr_password)
|
||||
alert('댓글을 수정할 권한이 없습니다.');
|
||||
}
|
||||
|
||||
$sql = " select count(*) as cnt from $write_table
|
||||
where wr_comment_reply like '$comment_reply%'
|
||||
and wr_id <> '$comment_id'
|
||||
and wr_parent = '$wr_id'
|
||||
and wr_comment = '$tmp_comment'
|
||||
and wr_is_comment = 1 ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['cnt'] && !$is_admin)
|
||||
alert('이 댓글와 관련된 답변댓글이 존재하므로 수정 할 수 없습니다.');
|
||||
|
||||
$sql_ip = "";
|
||||
if (!$is_admin)
|
||||
$sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
|
||||
$sql_secret = "";
|
||||
if ($wr_secret)
|
||||
$sql_secret = " , wr_option = '$wr_secret' ";
|
||||
|
||||
$sql = " update $write_table
|
||||
set wr_subject = '$wr_subject',
|
||||
wr_content = '$wr_content',
|
||||
wr_1 = '$wr_1',
|
||||
wr_2 = '$wr_2',
|
||||
wr_3 = '$wr_3',
|
||||
wr_4 = '$wr_4',
|
||||
wr_5 = '$wr_5',
|
||||
wr_6 = '$wr_6',
|
||||
wr_7 = '$wr_7',
|
||||
wr_8 = '$wr_8',
|
||||
wr_9 = '$wr_9',
|
||||
wr_10 = '$wr_10',
|
||||
wr_option = '$wr_option'
|
||||
$sql_ip
|
||||
$sql_secret
|
||||
where wr_id = '$comment_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($board_skin_path.'/write_comment_update.skin.php');
|
||||
@include_once($board_skin_path.'/write_comment_update.tail.skin.php');
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&'.$qstr.'&#c_'.$comment_id);
|
||||
?>
|
||||
72
bbs/write_comment_update.sns.php
Normal file
72
bbs/write_comment_update.sns.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if (!$board['bo_use_sns']) return;
|
||||
|
||||
set_cookie('ck_facebook_checked', false, 86400*31);
|
||||
set_cookie('ck_twitter_checked' , false, 86400*31);
|
||||
|
||||
//============================================================================
|
||||
// 페이스북
|
||||
//----------------------------------------------------------------------------
|
||||
$wr_facebook_user = "";
|
||||
if ($_POST['facebook_checked']) {
|
||||
include_once(G5_SNS_PATH."/facebook/src/facebook.php");
|
||||
|
||||
$facebook = new Facebook(array(
|
||||
'appId' => $config['cf_facebook_appid'],
|
||||
'secret' => $config['cf_facebook_secret']
|
||||
));
|
||||
|
||||
$user = $facebook->getUser();
|
||||
|
||||
if ($user) {
|
||||
try {
|
||||
$link = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&#c_'.$comment_id;
|
||||
$attachment = array(
|
||||
'message' => stripslashes($wr_content),
|
||||
'name' => $wr_subject,
|
||||
'link' => $link,
|
||||
'description' => stripslashes(strip_tags($wr['wr_content']))
|
||||
);
|
||||
// 등록
|
||||
$facebook->api('/me/feed/', 'post', $attachment);
|
||||
//$errors = error_get_last(); print_r2($errros); exit;
|
||||
|
||||
set_cookie('ck_facebook_checked', true, 86400*31);
|
||||
} catch(FacebookApiException $e) {
|
||||
;;;
|
||||
}
|
||||
}
|
||||
|
||||
$wr_facebook_user = get_session("ss_facebook_user");
|
||||
}
|
||||
//============================================================================
|
||||
|
||||
|
||||
//============================================================================
|
||||
// 트위터
|
||||
//----------------------------------------------------------------------------
|
||||
$wr_twitter_user = "";
|
||||
if ($_POST['twitter_checked']) {
|
||||
include_once(G5_SNS_PATH."/twitter/twitteroauth/twitteroauth.php");
|
||||
include_once(G5_SNS_PATH."/twitter/twitterconfig.php");
|
||||
|
||||
if ( !(empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) ) {
|
||||
$comment_url = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&#c_'.$comment_id;
|
||||
|
||||
$post = googl_short_url($comment_url).' '.$wr_content;
|
||||
$post = utf8_strcut($post, 140);
|
||||
|
||||
$access_token = $_SESSION['access_token'];
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
|
||||
// 등록
|
||||
$connection->post('statuses/update', array('status' => $post));
|
||||
|
||||
set_cookie('ck_twitter_checked', true, 86400*31);
|
||||
}
|
||||
|
||||
$wr_twitter_user = get_session("ss_twitter_user");
|
||||
}
|
||||
//============================================================================
|
||||
?>
|
||||
638
bbs/write_update.php
Normal file
638
bbs/write_update.php
Normal file
@ -0,0 +1,638 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
$g5['title'] = '게시글 저장';
|
||||
|
||||
$msg = array();
|
||||
|
||||
$wr_subject = '';
|
||||
if (isset($_POST['wr_subject'])) {
|
||||
$wr_subject = substr(trim($_POST['wr_subject']),0,255);
|
||||
}
|
||||
if ($wr_subject == '') {
|
||||
$msg[] = '<strong>제목</strong>을 입력하세요.';
|
||||
}
|
||||
|
||||
$wr_content = '';
|
||||
if (isset($_POST['wr_content'])) {
|
||||
$wr_content = substr(trim($_POST['wr_content']),0,65536);
|
||||
}
|
||||
if ($wr_content == '') {
|
||||
$msg[] = '<strong>내용</strong>을 입력하세요.';
|
||||
}
|
||||
|
||||
$wr_link1 = '';
|
||||
if (isset($_POST['wr_link1'])) {
|
||||
$wr_link1 = substr($_POST['wr_link1'],0,1000);
|
||||
}
|
||||
|
||||
$wr_link2 = '';
|
||||
if (isset($_POST['wr_link2'])) {
|
||||
$wr_link2 = substr($_POST['wr_link2'],0,1000);
|
||||
}
|
||||
|
||||
$msg = implode('<br>', $msg);
|
||||
if ($msg) {
|
||||
alert($msg);
|
||||
}
|
||||
|
||||
// 090710
|
||||
if (substr_count($wr_content, '&#') > 50) {
|
||||
alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.');
|
||||
exit;
|
||||
}
|
||||
|
||||
$upload_max_filesize = ini_get('upload_max_filesize');
|
||||
|
||||
if (empty($_POST)) {
|
||||
alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n게시판관리자 또는 서버관리자에게 문의 바랍니다.");
|
||||
}
|
||||
|
||||
$w = $_POST['w'];
|
||||
$wr_link1 = trim(strip_tags($_POST['wr_link1']));
|
||||
$wr_link2 = trim(strip_tags($_POST['wr_link2']));
|
||||
|
||||
$notice_array = explode(",", $board['bo_notice']);
|
||||
|
||||
if ($w == 'u' || $w == 'r') {
|
||||
$wr = get_write($write_table, $wr_id);
|
||||
if (!$wr['wr_id']) {
|
||||
alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글은 사용일 경우에만 가능해야 함
|
||||
if (!$is_admin && !$board['bo_use_secret'] && $secret) {
|
||||
alert('비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.');
|
||||
}
|
||||
|
||||
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록
|
||||
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 = trim($_POST['wr_'.$i]);
|
||||
}
|
||||
}
|
||||
|
||||
@include_once($board_skin_path.'/write_update.head.skin.php');
|
||||
|
||||
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']) {
|
||||
alert('글을 쓸 권한이 없습니다.');
|
||||
}
|
||||
|
||||
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함
|
||||
if (!$is_admin && $notice) {
|
||||
alert('관리자만 공지할 수 있습니다.');
|
||||
}
|
||||
|
||||
} else if ($w == 'r') {
|
||||
|
||||
if (in_array((int)$wr_id, $notice_array)) {
|
||||
alert('공지에는 답변 할 수 없습니다.');
|
||||
}
|
||||
|
||||
if ($member['mb_level'] < $board['bo_reply_level']) {
|
||||
alert('글을 답변할 권한이 없습니다.');
|
||||
}
|
||||
|
||||
// 게시글 배열 참조
|
||||
$reply_array = &$wr;
|
||||
|
||||
// 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다.
|
||||
if (strlen($reply_array['wr_reply']) == 10) {
|
||||
alert("더 이상 답변하실 수 없습니다.\\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답변은 26개 까지만 가능합니다.");
|
||||
} else {
|
||||
$reply_char = chr(ord($row['reply']) + $reply_number);
|
||||
}
|
||||
|
||||
$reply = $reply_array['wr_reply'] . $reply_char;
|
||||
|
||||
} else {
|
||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||
}
|
||||
|
||||
if ($is_guest && !chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
|
||||
if ($w == '' || $w == 'r') {
|
||||
if (isset($_SESSION['ss_datetime'])) {
|
||||
if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin)
|
||||
alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.');
|
||||
}
|
||||
|
||||
set_session("ss_datetime", G5_SERVER_TIME);
|
||||
}
|
||||
|
||||
if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))
|
||||
alert('제목을 입력하여 주십시오.');
|
||||
|
||||
// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
|
||||
@mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
|
||||
@chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
|
||||
|
||||
$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++) {
|
||||
$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] = '';
|
||||
|
||||
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
|
||||
if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) {
|
||||
$upload[$i]['del_check'] = true;
|
||||
|
||||
$row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
|
||||
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);
|
||||
// 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {
|
||||
delete_board_thumbnail($bo_table, $row['bf_file']);
|
||||
}
|
||||
}
|
||||
else
|
||||
$upload[$i]['del_check'] = false;
|
||||
|
||||
$tmp_file = $_FILES['bf_file']['tmp_name'][$i];
|
||||
$filesize = $_FILES['bf_file']['size'][$i];
|
||||
$filename = $_FILES['bf_file']['name'][$i];
|
||||
$filename = preg_replace('/(<|>|=)/', '', $filename);
|
||||
|
||||
// 서버에 설정된 값보다 큰파일을 업로드 한다면
|
||||
if ($filename) {
|
||||
if ($_FILES['bf_file']['error'][$i] == 1) {
|
||||
$file_upload_msg .= '\"'.$filename.'\" 파일의 용량이 서버에 설정('.$upload_max_filesize.')된 값보다 크므로 업로드 할 수 없습니다.\\n';
|
||||
continue;
|
||||
}
|
||||
else if ($_FILES['bf_file']['error'][$i] != 0) {
|
||||
$file_upload_msg .= '\"'.$filename.'\" 파일이 정상적으로 업로드 되지 않았습니다.\\n';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
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']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n';
|
||||
continue;
|
||||
}
|
||||
|
||||
//=================================================================\
|
||||
// 090714
|
||||
// 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지
|
||||
// 에러메세지는 출력하지 않는다.
|
||||
//-----------------------------------------------------------------
|
||||
$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)
|
||||
continue;
|
||||
}
|
||||
//=================================================================
|
||||
|
||||
$upload[$i]['image'] = $timg;
|
||||
|
||||
// 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정
|
||||
if ($w == 'u') {
|
||||
// 존재하는 파일이 있다면 삭제합니다.
|
||||
$row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
|
||||
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);
|
||||
// 이미지파일이면 썸네일삭제
|
||||
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {
|
||||
delete_board_thumbnail($bo_table, $row['bf_file']);
|
||||
}
|
||||
}
|
||||
|
||||
// 프로그램 원래 파일명
|
||||
$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);
|
||||
|
||||
shuffle($chars_array);
|
||||
$shuffle = implode('', $chars_array);
|
||||
|
||||
// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
|
||||
$upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename)));
|
||||
|
||||
$dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file'];
|
||||
|
||||
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
|
||||
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]);
|
||||
|
||||
// 올라간 파일의 퍼미션을 변경합니다.
|
||||
chmod($dest_file, G5_FILE_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
||||
if ($w == '' || $w == 'r') {
|
||||
|
||||
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'];
|
||||
} else {
|
||||
$mb_id = '';
|
||||
// 비회원의 경우 이름이 누락되는 경우가 있음
|
||||
$wr_name = trim($_POST['wr_name']);
|
||||
if (!$wr_name)
|
||||
alert('이름은 필히 입력하셔야 합니다.');
|
||||
$wr_password = sql_password($wr_password);
|
||||
}
|
||||
|
||||
if ($w == 'r') {
|
||||
// 답변의 원글이 비밀글이라면 비밀번호는 원글과 동일하게 넣는다.
|
||||
if ($secret)
|
||||
$wr_password = $wr['wr_password'];
|
||||
|
||||
$wr_id = $wr_id . $reply;
|
||||
$wr_num = $write['wr_num'];
|
||||
$wr_reply = $reply;
|
||||
} else {
|
||||
$wr_num = get_next_num($write_table);
|
||||
$wr_reply = '';
|
||||
}
|
||||
|
||||
$sql = " insert into $write_table
|
||||
set wr_num = '$wr_num',
|
||||
wr_reply = '$wr_reply',
|
||||
wr_comment = 0,
|
||||
ca_name = '$ca_name',
|
||||
wr_option = '$html,$secret,$mail',
|
||||
wr_subject = '$wr_subject',
|
||||
wr_content = '$wr_content',
|
||||
wr_link1 = '$wr_link1',
|
||||
wr_link2 = '$wr_link2',
|
||||
wr_link1_hit = 0,
|
||||
wr_link2_hit = 0,
|
||||
wr_hit = 0,
|
||||
wr_good = 0,
|
||||
wr_nogood = 0,
|
||||
mb_id = '{$member['mb_id']}',
|
||||
wr_password = '$wr_password',
|
||||
wr_name = '$wr_name',
|
||||
wr_email = '$wr_email',
|
||||
wr_homepage = '$wr_homepage',
|
||||
wr_datetime = '".G5_TIME_YMDHIS."',
|
||||
wr_last = '".G5_TIME_YMDHIS."',
|
||||
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
wr_1 = '$wr_1',
|
||||
wr_2 = '$wr_2',
|
||||
wr_3 = '$wr_3',
|
||||
wr_4 = '$wr_4',
|
||||
wr_5 = '$wr_5',
|
||||
wr_6 = '$wr_6',
|
||||
wr_7 = '$wr_7',
|
||||
wr_8 = '$wr_8',
|
||||
wr_9 = '$wr_9',
|
||||
wr_10 = '$wr_10' ";
|
||||
sql_query($sql);
|
||||
|
||||
$wr_id = mysql_insert_id();
|
||||
|
||||
// 부모 아이디에 UPDATE
|
||||
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
|
||||
|
||||
// 새글 INSERT
|
||||
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
|
||||
|
||||
// 게시글 1 증가
|
||||
sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
|
||||
|
||||
// 쓰기 포인트 부여
|
||||
if ($w == '') {
|
||||
if ($notice) {
|
||||
$bo_notice = $wr_id.",".$board['bo_notice'];
|
||||
sql_query(" update {$g5['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_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기');
|
||||
}
|
||||
} else if ($w == 'u') {
|
||||
if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) {
|
||||
alert('올바른 방법으로 수정하여 주십시오.');
|
||||
}
|
||||
|
||||
$return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id;
|
||||
|
||||
if ($is_admin == 'super') // 최고관리자 통과
|
||||
;
|
||||
else if ($is_admin == 'group') { // 그룹관리자
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가?
|
||||
alert('자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.', $return_url);
|
||||
else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url);
|
||||
} else if ($is_admin == 'board') { // 게시판관리자이면
|
||||
$mb = get_member($write['mb_id']);
|
||||
if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가?
|
||||
alert('자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.', $return_url);
|
||||
else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과
|
||||
alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url);
|
||||
} else if ($member['mb_id']) {
|
||||
if ($member['mb_id'] != $write['mb_id'])
|
||||
alert('자신의 글이 아니므로 수정할 수 없습니다.', $return_url);
|
||||
} else {
|
||||
if ($write['mb_id'])
|
||||
alert('로그인 후 수정하세요.', './login.php?url='.urlencode($return_url));
|
||||
}
|
||||
|
||||
if ($member['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'];
|
||||
} else {
|
||||
$mb_id = $wr['mb_id'];
|
||||
$wr_name = $wr['wr_name'];
|
||||
$wr_email = $wr['wr_email'];
|
||||
$wr_homepage = $wr['wr_homepage'];
|
||||
}
|
||||
} else {
|
||||
$mb_id = "";
|
||||
// 비회원의 경우 이름이 누락되는 경우가 있음
|
||||
//if (!trim($wr_name)) alert("이름은 필히 입력하셔야 합니다.");
|
||||
}
|
||||
|
||||
$sql_password = $wr_password ? " , wr_password = '".sql_password($wr_password)."' " : "";
|
||||
|
||||
$sql_ip = '';
|
||||
if (!$is_admin)
|
||||
$sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
|
||||
$sql = " update {$write_table}
|
||||
set ca_name = '{$ca_name}',
|
||||
wr_option = '{$html},{$secret},{$mail}',
|
||||
wr_subject = '{$wr_subject}',
|
||||
wr_content = '{$wr_content}',
|
||||
wr_link1 = '{$wr_link1}',
|
||||
wr_link2 = '{$wr_link2}',
|
||||
mb_id = '{$mb_id}',
|
||||
wr_name = '{$wr_name}',
|
||||
wr_email = '{$wr_email}',
|
||||
wr_homepage = '{$wr_homepage}',
|
||||
wr_1 = '{$wr_1}',
|
||||
wr_2 = '{$wr_2}',
|
||||
wr_3 = '{$wr_3}',
|
||||
wr_4 = '{$wr_4}',
|
||||
wr_5 = '{$wr_5}',
|
||||
wr_6 = '{$wr_6}',
|
||||
wr_7 = '{$wr_7}',
|
||||
wr_8 = '{$wr_8}',
|
||||
wr_9 = '{$wr_9}',
|
||||
wr_10= '{$wr_10}'
|
||||
{$sql_ip}
|
||||
{$sql_password}
|
||||
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_query($sql);
|
||||
|
||||
/*
|
||||
if ($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 . ',' . $board['bo_notice'];
|
||||
sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
|
||||
}
|
||||
} else {
|
||||
$bo_notice = '';
|
||||
for ($i=0; $i<count($notice_array); $i++)
|
||||
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 {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
|
||||
}
|
||||
*/
|
||||
|
||||
$bo_notice = board_notice($board['bo_notice'], $wr_id, $notice);
|
||||
sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
|
||||
}
|
||||
|
||||
// syndication ping
|
||||
if(G5_SYNDI_USE)
|
||||
include G5_SYNDI_PATH.'/include/include.bbs.write_update.php';
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// 가변 파일 업로드
|
||||
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
|
||||
for ($i=0; $i<count($upload); $i++)
|
||||
{
|
||||
if (!get_magic_quotes_gpc()) {
|
||||
$upload[$i]['source'] = addslashes($upload[$i]['source']);
|
||||
}
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['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'])
|
||||
{
|
||||
$sql = " update {$g5['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 = '".G5_TIME_YMDHIS."'
|
||||
where bo_table = '{$bo_table}'
|
||||
and wr_id = '{$wr_id}'
|
||||
and bf_no = '{$i}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = " update {$g5['board_file_table']}
|
||||
set bf_content = '{$bf_content[$i]}'
|
||||
where bo_table = '{$bo_table}'
|
||||
and wr_id = '{$wr_id}'
|
||||
and bf_no = '{$i}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = " insert into {$g5['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_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 = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서
|
||||
// 파일 정보가 없다면 테이블의 내용을 삭제합니다.
|
||||
$row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['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 {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
|
||||
|
||||
// 정보가 있다면 빠집니다.
|
||||
if ($row2['bf_file']) break;
|
||||
|
||||
// 그렇지 않다면 정보를 삭제합니다.
|
||||
sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
|
||||
}
|
||||
|
||||
// 파일의 개수를 게시물에 업데이트 한다.
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
|
||||
sql_query(" update {$write_table} set wr_file = '{$row['cnt']}' where wr_id = '{$wr_id}' ");
|
||||
|
||||
// 자동저장된 레코드를 삭제한다.
|
||||
sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' ");
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 비밀번호를 묻지 않기 위함
|
||||
if ($secret)
|
||||
set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE);
|
||||
|
||||
// 메일발송 사용 (수정글은 발송하지 않음)
|
||||
if (!($w == 'u' || $w == 'cu') && $config['cf_email_use'] && $board['bo_use_email']) {
|
||||
|
||||
// 관리자의 정보를 얻고
|
||||
$super_admin = get_admin('super');
|
||||
$group_admin = get_admin('group');
|
||||
$board_admin = get_admin('board');
|
||||
|
||||
$wr_subject = get_text(stripslashes($wr_subject));
|
||||
|
||||
$tmp_html = 0;
|
||||
if (strstr($html, 'html1'))
|
||||
$tmp_html = 1;
|
||||
else if (strstr($html, 'html2'))
|
||||
$tmp_html = 2;
|
||||
|
||||
$wr_content = conv_content(conv_unescape_nl($wr_content), $tmp_html);
|
||||
|
||||
$warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'코멘트', 'cu'=>'코멘트 수정' );
|
||||
$str = $warr[$w];
|
||||
|
||||
$subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' 게시판에 '.$str.'글이 올라왔습니다.';
|
||||
|
||||
$link_url = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&'.$qstr;
|
||||
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
ob_start();
|
||||
include_once ('./write_update_mail.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$array_email = array();
|
||||
// 게시판관리자에게 보내는 메일
|
||||
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_super_admin']) $array_email[] = $super_admin['mb_email'];
|
||||
|
||||
// 원글게시자에게 보내는 메일
|
||||
if ($config['cf_email_wr_write']) {
|
||||
if($w == '')
|
||||
$wr['wr_email'] = $wr_email;
|
||||
|
||||
$array_email[] = $wr['wr_email'];
|
||||
}
|
||||
|
||||
// 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면
|
||||
if (strstr($wr['wr_option'], 'mail') && $wr['wr_email'])
|
||||
$array_email[] = $wr['wr_email'];
|
||||
|
||||
// 중복된 메일 주소는 제거
|
||||
$unique_email = array_unique($array_email);
|
||||
$unique_email = array_values($unique_email);
|
||||
for ($i=0; $i<count($unique_email); $i++) {
|
||||
mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 사용자 코드 실행
|
||||
@include_once($board_skin_path.'/write_update.skin.php');
|
||||
@include_once($board_skin_path.'/write_update.tail.skin.php');
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
if ($file_upload_msg)
|
||||
alert($file_upload_msg, G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr);
|
||||
else
|
||||
goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr);
|
||||
?>
|
||||
30
bbs/write_update_mail.php
Normal file
30
bbs/write_update_mail.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// 게시물 입력시 게시자, 관리자에게 드리는 메일을 수정하고 싶으시다면 이 파일을 수정하십시오.
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo $wr_subject ?> 메일</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">
|
||||
<div style="border:1px solid #dedede">
|
||||
<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">
|
||||
<?php echo $wr_subject ?>
|
||||
</h1>
|
||||
<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">
|
||||
작성자 <?php echo $wr_name ?>
|
||||
</span>
|
||||
<div style="margin:20px 0 0;padding:30px 30px 50px;min-height:200px;height:auto !important;height:200px;border-bottom:1px solid #eee">
|
||||
<?php echo $wr_content ?>
|
||||
</div>
|
||||
<a href="<?php echo $link_url ?>" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center">사이트에서 게시물 확인하기</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
73
bbs/zip.php
Normal file
73
bbs/zip.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 메모리를 많이 잡아먹어서 아래의 코드로 대체
|
||||
//ini_set('memory_limit', '20M');
|
||||
//$zipfile = file("./zip.db");
|
||||
|
||||
/*
|
||||
$zipfile = array();
|
||||
$fp = fopen('./zip.db', 'r');
|
||||
while(!feof($fp)) {
|
||||
$zipfile[] = fgets($fp, 4096);
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
$search_count = 0;
|
||||
|
||||
if ($addr1)
|
||||
{
|
||||
while ($zipcode = each($zipfile))
|
||||
{
|
||||
if(strstr(substr($zipcode[1],9,512), $addr1))
|
||||
{
|
||||
$list[$search_count][zip1] = substr($zipcode[1],0,3);
|
||||
$list[$search_count][zip2] = substr($zipcode[1],4,3);
|
||||
$addr = explode(" ", substr($zipcode[1],8));
|
||||
|
||||
if ($addr[sizeof($addr)-1])
|
||||
{
|
||||
$list[$search_count][addr] = str_replace($addr[sizeof($addr)-1], "", substr($zipcode[1],8));
|
||||
$list[$search_count][bunji] = trim($addr[sizeof($addr)-1]);
|
||||
}
|
||||
else
|
||||
$list[$search_count][addr] = substr($zipcode[1],8);
|
||||
|
||||
$list[$search_count][encode_addr] = urlencode($list[$search_count][addr]);
|
||||
$search_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$search_count) alert('찾으시는 주소가 없습니다.');
|
||||
}
|
||||
*/
|
||||
|
||||
/* 기존의 DB에서 불러오는 방식
|
||||
if ($addr1)
|
||||
{
|
||||
//$sql = " select * from $g5[zip_table] where zp_dong like '%$addr1%' order by zp_id ";
|
||||
$sql = " select * from $g5[zip_table] where zp_dong like '%$addr1%' order by zp_sido, zp_gugun, zp_dong ";
|
||||
$result = sql_query($sql);
|
||||
$search_count = 0;
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$list[$i][zip1] = substr($row[zp_code], 0, 3);
|
||||
$list[$i][zip2] = substr($row[zp_code], 3, 3);
|
||||
$list[$i][addr] = "$row[zp_sido] $row[zp_gugun] $row[zp_dong]";
|
||||
$list[$i][bunji] = $row[zp_bunji];
|
||||
$list[$i][encode_addr] = urlencode($list[$i][addr]);
|
||||
$search_count++;
|
||||
}
|
||||
|
||||
if (!$search_count)
|
||||
alert("찾으시는 주소가 없습니다.");
|
||||
}
|
||||
*/
|
||||
|
||||
$g5['title'] = '우편번호 검색';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
include_once($member_skin_path.'/zip.skin.php');
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user