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

fix ban appeals; thanks to sraczynski for reporting

This commit is contained in:
czaks 2014-06-16 11:39:56 +02:00
parent 36d01fdb7d
commit 7d17960f69

View File

@ -962,17 +962,22 @@ function mod_ban_appeals() {
if ($ban['post'] && isset($ban['post']['board'], $ban['post']['id'])) { if ($ban['post'] && isset($ban['post']['board'], $ban['post']['id'])) {
if (openBoard($ban['post']['board'])) { if (openBoard($ban['post']['board'])) {
$query = query(sprintf("SELECT `thumb`, `file` FROM ``posts_%s`` WHERE `id` = " . $query = query(sprintf("SELECT `num_files`, `files` FROM ``posts_%s`` WHERE `id` = " .
(int)$ban['post']['id'], $board['uri'])); (int)$ban['post']['id'], $board['uri']));
if ($_post = $query->fetch(PDO::FETCH_ASSOC)) { if ($_post = $query->fetch(PDO::FETCH_ASSOC)) {
$_post['files'] = $_post['files'] ? json_decode($_post['files']) : array();
$ban['post'] = array_merge($ban['post'], $_post); $ban['post'] = array_merge($ban['post'], $_post);
} else { } else {
$ban['post']['file'] = 'deleted'; $ban['post']['files'] = array(array());
$ban['post']['thumb'] = false; $ban['post']['files'][0]['file'] = 'deleted';
$ban['post']['files'][0]['thumb'] = false;
$ban['post']['num_files'] = 1;
} }
} else { } else {
$ban['post']['file'] = 'deleted'; $ban['post']['files'] = array(array());
$ban['post']['thumb'] = false; $ban['post']['files'][0]['file'] = 'deleted';
$ban['post']['files'][0]['thumb'] = false;
$ban['post']['num_files'] = 1;
} }
if ($ban['post']['thread']) { if ($ban['post']['thread']) {