Fix mod_move for multi image

This commit is contained in:
Fredrick Brennan 2014-04-29 19:14:10 -04:00
parent 2b3942d19d
commit 53e33d414f

View File

@ -1096,13 +1096,13 @@ function mod_move_reply($originBoard, $postID) {
$post['op'] = true; $post['op'] = true;
} }
if ($post['file']) { if ($post['files']) {
$post['files'] = json_decode($post['files'], TRUE);
$post['has_file'] = true; $post['has_file'] = true;
$post['width'] = &$post['filewidth']; foreach ($post['files'] as $i => &$file) {
$post['height'] = &$post['fileheight']; $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_src = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $post['file']; }
$file_thumb = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $post['thumb'];
} else { } else {
$post['has_file'] = false; $post['has_file'] = false;
} }
@ -1117,10 +1117,12 @@ function mod_move_reply($originBoard, $postID) {
$newID = post($post); $newID = post($post);
if ($post['has_file']) { if ($post['has_file']) {
foreach ($post['files'] as $i => &$file) {
// move the image // move the image
rename($file_src, sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $post['file']); rename($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
if ($post['thumb'] != 'spoiler') { //trying to move/copy the spoiler thumb raises an error if ($file['thumb'] != 'spoiler') { //trying to move/copy the spoiler thumb raises an error
rename($file_thumb, sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $post['thumb']); rename($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
}
} }
} }