Fix moving of deleted files

This commit is contained in:
Fredrick Brennan 2014-05-19 14:00:16 -04:00
parent 85136b76ed
commit 65a14a0d39

View File

@ -1199,6 +1199,8 @@ 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) {
if ($file['file'] === 'deleted')
continue;
$file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']; $file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file'];
$file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']; $file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
} }
@ -1218,8 +1220,9 @@ 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($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']); if ($file['file'] !== 'deleted')
if (!in_array($file['thumb'], array('spoiler', 'deleted', 'file'))) $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($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']); $clone($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
} }
} }