diff --git a/inc/functions.php b/inc/functions.php index 41c4e232..e2e14202 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1510,11 +1510,6 @@ function rebuildPost($id) { return true; } - - - - - // Delete a post (reply or thread) function deletePostShadow($id, $error_if_doesnt_exist=true, $rebuild_after=true, $force_shadow_delete = false) { global $board, $config; @@ -1526,10 +1521,8 @@ function deletePostShadow($id, $error_if_doesnt_exist=true, $rebuild_after=true, return deletePostPermanent($id, $error_if_doesnt_exist, $rebuild_after); } - - // Delete a post (reply or thread) -function deletePostPermanent($id, $error_if_doesnt_exist=true, $rebuild_after=true) { +function deletePostPermanent($id, $error_if_doesnt_exist=true, $rebuild_after=true, $delete_files=true) { global $board, $config; // Select post and replies (if thread) in one query @@ -1564,7 +1557,7 @@ function deletePostPermanent($id, $error_if_doesnt_exist=true, $rebuild_after=tr // Rebuild thread $rebuild = &$post['thread']; } - if ($post['files']) { + if ($post['files'] && $delete_files) { // Delete file foreach (json_decode($post['files']) as $i => $f) { if ($f->file !== 'deleted') { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 8afb88d9..af2613da 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1336,8 +1336,11 @@ function mod_move_reply($originBoard, $postID) { $hashquery->bindValue(':board', $originBoard, PDO::PARAM_STR); $hashquery->bindValue(':post', $postID, PDO::PARAM_INT); $hashquery->execute() or error(db_error($hashquery)); - - if ($post['has_file']) { + + // bool indicator if it is a move from one board to another + $board_move = !($originBoard == $targetBoard); + + if ($post['has_file'] && $board_move) { foreach ($post['files'] as $i => &$file) { // move the image if (isset($file['thumb'])) @@ -1363,7 +1366,7 @@ function mod_move_reply($originBoard, $postID) { openBoard($originBoard); // delete original post - deletePostPermanent($postID); + deletePostPermanent($postID, true, true, $board_move); buildIndex(); // open target board for redirect