Browse Source

Bugfix : If you moved a reply to same board it deleted the image.

main
PupperWoff 6 years ago
committed by discomrade
parent
commit
9406a72d7d
  1. 11
      inc/functions.php
  2. 9
      inc/mod/pages.php

11
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') {

9
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

Loading…
Cancel
Save