1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

Merge pull request #245 from ghost/patch-2

Bug fixing inc.
This commit is contained in:
Fredrick Brennan 2017-10-26 13:35:26 +08:00 committed by GitHub
commit 09b373cf60
2 changed files with 10 additions and 5 deletions

View File

@ -1167,6 +1167,7 @@ function mod_move_reply($originBoard, $postID) {
$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']; $file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file'];
if (isset($file['thumb']))
$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'];
} }
} else { } else {
@ -1185,9 +1186,10 @@ function mod_move_reply($originBoard, $postID) {
if ($post['has_file']) { if ($post['has_file']) {
foreach ($post['files'] as $i => &$file) { foreach ($post['files'] as $i => &$file) {
// move the image // move the image
if (isset($file['thumb']))
if ($file['thumb'] != 'spoiler' || $file['thumb'] != 'deleted') { //trying to move/copy the spoiler thumb raises an error
rename($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']); rename($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
if ($file['thumb'] != 'spoiler') { //trying to move/copy the spoiler thumb raises an error rename($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
rename($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
} }
} }
} }
@ -1355,8 +1357,11 @@ 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 (isset($file['thumb']))
$clone($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']); if ($file['thumb'] != 'spoiler' || $file['thumb'] != 'deleted') { //trying to move/copy the spoiler thumb raises an error
$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 // insert reply

View File

@ -5,7 +5,7 @@
{% for file in post.files %} {% for file in post.files %}
<div class="file{% if post.num_files > 1 %} multifile" style="width:{{ file.thumbwidth + 40 }}px"{% else %}"{% endif %}> <div class="file{% if post.num_files > 1 %} multifile" style="width:{{ file.thumbwidth + 40 }}px"{% else %}"{% endif %}>
{% if file.file == 'deleted' %} {% if file.file == 'deleted' %}
<img class="post-image deleted" src="{{ config.image_deleted }}" alt="" /> <img class="post-image deleted" src="{{ config.root }}{{ config.image_deleted }}" alt="" />
{% else %} {% else %}
<p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}">{{ file.file }}</a> <span class="unimportant"> <p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}">{{ file.file }}</a> <span class="unimportant">
( (