summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrick Brennan <admin@8chan.co>2014-04-29 19:07:13 -0400
committerFredrick Brennan <admin@8chan.co>2014-04-29 19:07:13 -0400
commit2b3942d19d3997da183fc0ab9af5f201f5531af6 (patch)
treed118c3969bfb0129b26c7cbba09668d5d41ef647
parentbb5446a93d05185cc78cc4b61edc99d3035e295e (diff)
Fix mod_move for multi image
-rw-r--r--inc/mod/pages.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 95a6d4db..6f7ba95e 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1193,13 +1193,14 @@ function mod_move($originBoard, $postID) {
// indicate that the post is a thread
$post['op'] = true;
- if ($post['file']) {
+ if ($post['files']) {
+ $post['files'] = json_decode($post['files'], TRUE);
$post['has_file'] = true;
- $post['width'] = &$post['filewidth'];
- $post['height'] = &$post['fileheight'];
-
- $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'];
+ foreach ($post['files'] as $i => &$file) {
+ var_dump($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'];
+ }
} else {
$post['has_file'] = false;
}
@@ -1215,9 +1216,11 @@ function mod_move($originBoard, $postID) {
if ($post['has_file']) {
// copy image
- $clone($file_src, sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $post['file']);
- if (!in_array($post['thumb'], array('spoiler', 'deleted', 'file')))
- $clone($file_thumb, sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $post['thumb']);
+ foreach ($post['files'] as $i => &$file) {
+ $clone($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
+ if (!in_array($file['thumb'], array('spoiler', 'deleted', 'file')))
+ $clone($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
+ }
}
// go back to the original board to fetch replies
@@ -1233,13 +1236,13 @@ function mod_move($originBoard, $postID) {
$post['mod'] = true;
$post['thread'] = $newID;
- if ($post['file']) {
+ if ($post['files']) {
+ $post['files'] = json_decode($post['files'], TRUE);
$post['has_file'] = true;
- $post['width'] = &$post['filewidth'];
- $post['height'] = &$post['fileheight'];
-
- $post['file_src'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $post['file'];
- $post['file_thumb'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $post['thumb'];
+ foreach ($post['files'] as $i => &$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'];
+ }
} else {
$post['has_file'] = false;
}
@@ -1274,14 +1277,16 @@ function mod_move($originBoard, $postID) {
$post['op'] = false;
$post['tracked_cites'] = markup($post['body'], true);
- // insert reply
- $newIDs[$post['id']] = $newPostID = post($post);
-
if ($post['has_file']) {
// copy image
- $clone($post['file_src'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $post['file']);
- $clone($post['file_thumb'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $post['thumb']);
+ foreach ($post['files'] as $i => &$file) {
+ $clone($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
+ $clone($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
+ }
}
+ // insert reply
+ $newIDs[$post['id']] = $newPostID = post($post);
+
if (!empty($post['tracked_cites'])) {
$insert_rows = array();