테스트 사이트 - 개발 중인 베타 버전입니다

delete_all.php입니다. 채택완료

닐리리맘보 6년 전 조회 2,378

선택삭제가 되지 않아서

올려봅니다.

 

어떤 부분을 고쳐야 할까요.

 

</p>

<p><?php

if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가</p>

<p>if(!$is_admin)

    alert('접근 권한이 없습니다.', G5_URL);</p>

<p>// 4.11

@include_once($board_skin_path.'/delete_all.head.skin.php');</p>

<p>$count_write = 0;

$count_comment = 0;</p>

<p>$tmp_array = array();

if ($wr_id) // 건별삭제

    $tmp_array[0] = $wr_id;

else // 일괄삭제

    $tmp_array = $_POST['chk_wr_id'];</p>

<p>$chk_count = count($tmp_array);</p>

<p>if($chk_count > (G5_IS_MOBILE ? $board['bo_mobile_page_rows'] : $board['bo_page_rows']))

    alert('올바른 방법으로 이용해 주십시오.');</p>

<p>// 사용자 코드 실행

@include_once($board_skin_path.'/delete_all.skin.php');</p>

<p>// 거꾸로 읽는 이유는 답변글부터 삭제가 되어야 하기 때문임

for ($i=$chk_count-1; $i>=0; $i--)

{

    $write = sql_fetch(" select * from $write_table where wr_id = '$tmp_array[$i]' ");</p>

<p>    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'] && check_password($wr_password, $write['wr_password'])) // 비밀번호가 같다면

    {

        ;

    }

    else

        continue;   // 나머지는 삭제 불가</p>

<p>    $len = strlen($write['wr_reply']);

    if ($len < 0) $len = 0;

    $reply = substr($write['wr_reply'], 0, $len);</p>

<p>    // 원글만 구한다.

    $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;</p>

<p>    // 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다.

    //$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']} 글 삭제");</p>

<p>            // 업로드된 파일이 있다면

            $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']);</p>

<p>                // 썸네일삭제

                if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) {

                    delete_board_thumbnail($bo_table, $row2['bf_file']);

                }

            }</p>

<p>            // 에디터 썸네일 삭제

            delete_editor_thumbnail($row['wr_content']);</p>

<p>            // 파일테이블 행 삭제

            sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");</p>

<p>            $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']} 댓글삭제");</p>

<p>            $count_comment++;

        }

    }</p>

<p>    // 게시글 삭제

    sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' ");</p>

<p>    // 최근게시물 삭제

    sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' ");</p>

<p>    // 스크랩 삭제

    sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' ");</p>

<p>    /*

    // 공지사항 삭제

    $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;

}</p>

<p>// 글숫자 감소

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' ");</p>

<p>// 4.11

@include_once($board_skin_path.'/delete_all.tail.skin.php');</p>

<p>delete_cache_latest($bo_table);</p>

<p>goto_url('./board.php?bo_table='.$bo_table.'&amp;page='.$page.$qstr);

?></p>

<p>

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
6년 전

이건 G5용 화일인데 이전 질문의 list스킨은 G4용 아닌가요?

방법이 바뀌었으니 당연히 안됩니다(글쓰기, 수정/삭제 버튼 출력 등은 문제 없는가요?)

방법은 3가지 입니다

1. 위 소스에서 2번행에 추가

include_once("_common.php");

 

2. G5용 list스킨을 참고해서 list스킨을 변경(특히 하단 자바스크립트 부분)

 

3. list스킨이 수정된 곳이 보이지 않으니 그냥 G5용 list스킨으로 덮어쓰기

 

 

 

 

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

복스리
6년 전

.여기는 서버처리단이구요..submit쪽도 확인해봐야할꺼 같습니다.~

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인