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

삭제한 게시물을 다른게시판에 쌓아놓고 싶습니다. 채택완료

smltree 1개월 전 조회 311

한 게시판에 삭제를 하면 바로 삭제되지 않고
다른 게시판으로 옮기고 싶습니다.

 

어느 페이지에 어떻게 해야 그게 가능할까요?
도움을 부탁드립니다.

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

답변 4개

채택된 답변
+20 포인트
1개월 전

1. 휴지통 게시판을 하나 만듭니다. ex. 'trash'

2. /bbs/delete.php 에 코드 추가

@include_once($board_skin_path.'/delete.skin.php'); 다음 라인에 추가

</p>

<p>// ========== 휴지통으로 복사 ==========

$trash_bo_table = 'trash';</p>

<p>if ($trash_bo_table) {

  

  $trash_write_table = $g5['write_prefix'] . $trash_bo_table;

  $src_dir = G5_DATA_PATH.'/file/'.$bo_table;

  $dst_dir = G5_DATA_PATH.'/file/'.$trash_bo_table;

  

  $copy_count_write = 0;

  $copy_count_comment = 0;

  $next_wr_num = 0;

  

  // 원글의 wr_num으로 전체 글타래 가져오기

  $sql = " select * from $write_table where wr_num = '{$write['wr_num']}' order by wr_parent, wr_is_comment, wr_comment desc, wr_id ";

  $result = sql_query($sql);

  

  while ($row = sql_fetch_array($result)) {

    

    // 휴지통에 게시글 복사

    $sql = " insert into $trash_write_table set 

                wr_num = " . ($next_wr_num ? "'$next_wr_num'" : "(SELECT IFNULL(MIN(wr_num) - 1, -1) FROM $trash_write_table as sq)") . ",

                wr_reply = '{$row['wr_reply']}',

                wr_is_comment = '{$row['wr_is_comment']}',

                wr_comment = '{$row['wr_comment']}',

                wr_comment_reply = '{$row['wr_comment_reply']}',

                ca_name = '".addslashes($row['ca_name'])."',

                wr_option = '{$row['wr_option']}',

                wr_subject = '".addslashes($row['wr_subject'])."',

                wr_content = '".addslashes($row['wr_content'])."',

                wr_link1 = '".addslashes($row['wr_link1'])."',

                wr_link2 = '".addslashes($row['wr_link2'])."',

                wr_link1_hit = '{$row['wr_link1_hit']}',

                wr_link2_hit = '{$row['wr_link2_hit']}',

                wr_hit = '{$row['wr_hit']}',

                wr_good = '{$row['wr_good']}',

                wr_nogood = '{$row['wr_nogood']}',

                mb_id = '{$row['mb_id']}',

                wr_password = '{$row['wr_password']}',

                wr_name = '".addslashes($row['wr_name'])."',

                wr_email = '".addslashes($row['wr_email'])."',

                wr_homepage = '".addslashes($row['wr_homepage'])."',

                wr_datetime = '{$row['wr_datetime']}',

                wr_file = '{$row['wr_file']}',

                wr_last = '{$row['wr_last']}',

                wr_ip = '{$row['wr_ip']}',

                wr_1 = '".addslashes($row['wr_1'])."',

                wr_2 = '".addslashes($row['wr_2'])."',

                wr_3 = '".addslashes($row['wr_3'])."',

                wr_4 = '".addslashes($row['wr_4'])."',

                wr_5 = '".addslashes($row['wr_5'])."',

                wr_6 = '".addslashes($row['wr_6'])."',

                wr_7 = '".addslashes($row['wr_7'])."',

                wr_8 = '".addslashes($row['wr_8'])."',

                wr_9 = '".addslashes($row['wr_9'])."',

                wr_10 = '".addslashes($row['wr_10'])."' ";

    sql_query($sql);

    

    $insert_id = sql_insert_id();

    

    if ($next_wr_num === 0) {

      $tmp = sql_fetch("select wr_num from $trash_write_table where wr_id = '$insert_id'");

      $next_wr_num = $tmp['wr_num'];

    }

    

    // 원글인 경우만 첨부파일 복사

    if (!$row['wr_is_comment']) {

      $copy_parent = $insert_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)) {

        

        $copy_file_name = '';

        if ($row2['bf_file']) {

          $copy_file_name = 'deleted_'.$row['wr_id'].'_'.$insert_id.'_'.$row2['bf_file'];

          

          // 물리적 파일 복사

          if (is_file($src_dir.'/'.$row2['bf_file'])) {

            @copy($src_dir.'/'.$row2['bf_file'], $dst_dir.'/'.$copy_file_name);

            @chmod($dst_dir.'/'.$copy_file_name, G5_FILE_PERMISSION);

          }

        }

        

        // 파일 테이블에 복사

        $sql3 = " insert into {$g5['board_file_table']} set 

                    bo_table = '$trash_bo_table',

                    wr_id = '$insert_id',

                    bf_no = '{$row2['bf_no']}',

                    bf_source = '".addslashes($row2['bf_source'])."',

                    bf_file = '$copy_file_name',

                    bf_download = '{$row2['bf_download']}',

                    bf_content = '".addslashes($row2['bf_content'])."',

                    bf_fileurl = '".addslashes($row2['bf_fileurl'])."',

                    bf_thumburl = '".addslashes($row2['bf_thumburl'])."',

                    bf_storage = '".addslashes($row2['bf_storage'])."',

                    bf_filesize = '{$row2['bf_filesize']}',

                    bf_width = '{$row2['bf_width']}',

                    bf_height = '{$row2['bf_height']}',

                    bf_type = '{$row2['bf_type']}',

                    bf_datetime = '{$row2['bf_datetime']}' ";

        sql_query($sql3);

      }

      

      $copy_count_write++;

    } else {

      $copy_count_comment++;

    }

    

    // wr_parent 업데이트

    sql_query(" update $trash_write_table set wr_parent = '$copy_parent' where wr_id = '$insert_id' ");

  }

  

  // 휴지통 게시판 카운터 업데이트

  sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write + '$copy_count_write', bo_count_comment = bo_count_comment + '$copy_count_comment' where bo_table = '$trash_bo_table' ");

   

}</p>

<p>

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

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

제로사이다
1개월 전

본인이 직접 삭제하실거면 선택이동 기능 이용!
그누자체에 기능을 넣을 거면 bbs/delete.php 에 HOOK 하면 됩니다!

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

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

s
sinbi Expert
1개월 전

배추베이직 게시판 스킨에 해당 기능이 있습니다.

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

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

1개월 전

게시물 복사 기능을 참고하셔서 삭제하면 게시물을 원하는 게시판으로 이동하는 형태로 하셔야 할 거 같습니다.

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

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

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

로그인