Merge pull request #252 from towards-a-new-leftypol/moving_fix2

Fixes moving threads to a different board
This commit is contained in:
towards-a-new-leftypol 2021-05-09 09:31:22 +00:00 committed by GitHub
commit e111ae0a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -1382,8 +1382,12 @@ function mod_move($originBoard, $postID) {
$post['files'] = json_decode($post['files'], TRUE); $post['files'] = json_decode($post['files'], TRUE);
$post['has_file'] = true; $post['has_file'] = true;
foreach ($post['files'] as $i => &$file) { foreach ($post['files'] as $i => &$file) {
$file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']; if ($file['file'] !== 'deleted') {
$file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']; $file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file'];
}
if (isset($file['thumb']) && !in_array($file['thumb'], array('spoiler', 'deleted', 'file'))) {
$file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
}
} }
} else { } else {
$post['has_file'] = false; $post['has_file'] = false;
@ -1422,8 +1426,12 @@ function mod_move($originBoard, $postID) {
if ($post['has_file']) { if ($post['has_file']) {
// copy image // copy image
foreach ($post['files'] as $i => &$file) { foreach ($post['files'] as $i => &$file) {
clone_wrapped_with_exist_check($clone, $file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']); if ($file['file'] !== 'deleted') {
clone_wrapped_with_exist_check($clone, $file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']); clone_wrapped_with_exist_check($clone, $file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
}
if (isset($file['thumb']) && !in_array($file['thumb'], array('spoiler', 'deleted', 'file'))) {
clone_wrapped_with_exist_check($clone, $file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
}
} }
} }
// insert reply // insert reply