Merge branch 'master' of github.com:gnuboard/g4s

This commit is contained in:
whitedot
2013-01-15 16:33:01 +09:00
2 changed files with 102 additions and 81 deletions

View File

@ -11,7 +11,7 @@ $tmp_array = array();
if ($wr_id) // 건별삭제
$tmp_array[0] = $wr_id;
else // 일괄삭제
$tmp_array = $_POST[chk_wr_id];
$tmp_array = $_POST['chk_wr_id'];
// 사용자 코드 실행
@ -19,119 +19,119 @@ else // 일괄삭제
// 거꾸로 읽는 이유는 답변글부터 삭제가 되어야 하기 때문임
for ($i=count($tmp_array)-1; $i>=0; $i--)
for ($i=count($tmp_array)-1; $i>=0; $i--)
{
$write = sql_fetch(" select * from {$write_table} where wr_id = '{$tmp_array[$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]) // 자신이 관리하는 그룹인가?
$mb = get_member($write['mb_id']);
if ($member['mb_id'] == $group['gr_admin']) // 자신이 관리하는 그룹인가?
{
if ($member[mb_level] >= $mb[mb_level]) // 자신의 레벨이 크거나 같다면 통과
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]) // 자신의 레벨이 크거나 같다면 통과
$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 ($member['mb_id'] && $member['mb_id'] == $write['mb_id']) // 자신의 글이라면
{
;
}
else if ($wr_password && !$write[mb_id] && sql_password($wr_password) == $write[wr_password]) // 패스워드가 같다면
}
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);
$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]}'
$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])
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 from {$write_table} where wr_parent = '{$write[wr_id]}' order by wr_id ";
$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))
while ($row = sql_fetch_array($result))
{
// 원글이라면
if (!$row[wr_is_comment])
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]} 글 삭제");
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 {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$row[wr_id]}' ";
$sql2 = " select * from {$g4['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($g4['path'].'/data/file/'.$bo_table.'/'.$row2[bf_file]);
@unlink($g4['path'].'/data/file/'.$bo_table.'/'.$row2['bf_file']);
// 파일테이블 행 삭제
sql_query(" delete from {$g4[board_file_table]} where bo_table = '{$bo_table}' and wr_id = '{$row[wr_id]}' ");
sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
$count_write++;
}
else
}
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]} 코멘트삭제");
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 $write_table where wr_parent = '{$write['wr_id']}' ");
// 최근게시물 삭제
sql_query(" delete from {$g4[board_new_table]} where bo_table = '{$bo_table}' and wr_parent = '{$write[wr_id]}' ");
sql_query(" delete from {$g4['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' ");
// 스크랩 삭제
sql_query(" delete from {$g4[scrap_table]} where bo_table = '{$bo_table}' and wr_id = '{$write[wr_id]}' ");
sql_query(" delete from {$g4['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' ");
// 공지사항 삭제
$notice_array = explode(',', trim($board[bo_notice]));
$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])
if ((int)$write['wr_id'] != (int)$notice_array[$k])
$bo_notice .= $notice_array[$k].',';
$bo_notice = trim($bo_notice);
sql_query(" update {$g4[board_table]} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
$board[bo_notice] = $bo_notice;
sql_query(" update {$g4['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 {$g4[board_table]} set bo_count_write = bo_count_write - '{$count_write}', bo_count_comment = bo_count_comment - '{$count_comment}' where bo_table = '{$bo_table}' ");
sql_query(" update {$g4['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');

View File

@ -11,7 +11,32 @@ if ($is_nogood) $colspan++;
<? if (!$wr_id) {?><h1><?=$g4['title']?></h1><?}?>
<div class="bo_fx">
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sca" value="<?=$sca?>">
<select name="sfl" title="검색대상">
<option value="wr_subject">제목</option>
<option value="wr_content">내용</option>
<option value="wr_subject||wr_content">제목+내용</option>
<option value="mb_id,1">회원아이디</option>
<option value="mb_id,0">회원아이디(코)</option>
<option value="wr_name,1">글쓴이</option>
<option value="wr_name,0">글쓴이(코)</option>
</select>
<input name="stx" class="fieldset_input required" maxlength="15" size="15" required value="<?=stripslashes($stx)?>" title="검색어">
<input type="hidden" name="sop" value="and">
<!-- <input type="radio" id="sop_and" name="sop" value="and">
<label for="sop_and">and</label>
<input type="radio" id="sop_or" name="sop" value="or">
<label for="sop_or">or</label> -->
<input type="submit" class="fieldset_submit" value="검색">
</form>
</fieldset>
<div class="bo_link">
<div id="bo_cate">
<? if ($is_category) { ?>
<form id="fcategory" name="fcategory" method="get">
@ -25,27 +50,6 @@ if ($is_nogood) $colspan++;
<?=$page?> 페이지
</div>
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sca" value="<?=$sca?>">
<select name="sfl" title="검색대상">
<option value="wr_subject">제목</option>
<option value="wr_content">내용</option>
<option value="wr_subject||wr_content">제목+내용</option>
<option value="mb_id,1">회원아이디</option>
<option value="mb_id,0">회원아이디(코)</option>
<option value="wr_name,1">글쓴이</option>
<option value="wr_name,0">글쓴이(코)</option>
</select>
<input name="stx" class="fieldset_input required" maxlength="15" size="15" required value="<?=stripslashes($stx)?>" title="검색어">
<input type="hidden" name="sop" value="and">
<input type="submit" class="fieldset_submit" value="검색">
</form>
</fieldset>
<? if ($rss_href || $write_href) {?>
<ul class="btn_bo_user">
<? if ($rss_href) { ?><li><a href="<?=$rss_href?>" class="btn02">RSS</a></li><? } ?>
@ -56,7 +60,7 @@ if ($is_nogood) $colspan++;
</div>
<!-- 게시판 목록 시작 -->
<form id="fboardlist" name="fboardlist" method="post">
<form id="fboardlist" name="fboardlist" method="post" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sfl" value="<?=$sfl?>">
<input type="hidden" name="stx" value="<?=$stx?>">
@ -102,9 +106,10 @@ for ($i=0; $i<count($list); $i++) {
<a href="<?=$list[$i]['ca_name_href']?>" class="bo_cate_link<? if ($wr_id == $list[$i]['wr_id']) echo " bo_current";?>"><?=$list[$i]['ca_name']?></a>
<? } ?>
<a href="<?=$list[$i]['href']?>"<? if ($wr_id == $list[$i]['wr_id']) echo " class=\"bo_current\"";?>>
<?=$list[$i]['subject']?>
<? if ($list[$i]['comment_cnt']) { ?><?=$list[$i]['comment_cnt'];?><? } ?>
<a href="<?=$list[$i]['href']?>"<? if ($wr_id == $list[$i]['wr_id']) echo " class=\"bo_current\"";?>><?=$list[$i]['subject']?>
<? if ($list[$i]['comment_cnt']) { ?><?=$list[$i]['comment_cnt'];?><? } ?>
</a>
<?
@ -128,7 +133,6 @@ for ($i=0; $i<count($list); $i++) {
<? if (count($list) == 0) { echo '<tr><td colspan="'.$colspan.'" class="empty_table">게시물이 없습니다.</td></tr>'; } ?>
</tbody>
</table>
</form>
<div class="bo_fx">
<ul class="btn_bo_adm">
@ -136,9 +140,9 @@ for ($i=0; $i<count($list); $i++) {
<li><a href="<?=$list_href?>" class="btn02">목록</a></li>
<? } ?>
<? if ($is_checkbox) { ?>
<li><a href="javascript:select_delete();" class="btn02">선택삭제</a></li>
<li><a href="javascript:select_copy('copy');" class="btn02">선택복사</a></li>
<li><a href="javascript:select_copy('move');" class="btn02">선택이동</a></li>
<li><input type="submit" name="btn_submit" class="btn02" onclick="document.pressed=this.value" value="선택삭제"></li>
<li><input type="submit" name="btn_submit" class="btn02" onclick="document.pressed=this.value" value="선택복사"></li>
<li><input type="submit" name="btn_submit" class="btn02" onclick="document.pressed=this.value" value="선택이동"></li>
<? } ?>
</ul>
@ -146,6 +150,11 @@ for ($i=0; $i<count($list); $i++) {
<li><? if ($write_href) { ?><a href="<?=$write_href?>" class="btn01">글쓰기</a><? } ?></li>
</ul>
</div>
</form>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택수정 및 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<!-- 페이지 -->
<div class="pg">
@ -170,8 +179,7 @@ function all_checked(sw) {
}
}
function check_confirm(str) {
var f = document.fboardlist;
function fboardlist_submit(f) {
var chk_count = 0;
for (var i=0; i<f.length; i++) {
@ -180,9 +188,25 @@ function check_confirm(str) {
}
if (!chk_count) {
alert(str + "할 게시물을 하나 이상 선택하세요.");
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택복사") {
select_copy("copy");
return;
}
if(document.pressed == "선택이동") {
select_copy("move");
return;
}
if(document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다"))
return false;
}
return true;
}
@ -210,9 +234,6 @@ function select_copy(sw) {
else
str = "이동";
if (!check_confirm(str))
return;
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;