1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

additional measurements for catalog, so it does not throw errors; should fix vichan-devel#84

This commit is contained in:
czaks 2014-09-24 03:21:32 +02:00
parent 92183e8e39
commit a25e5f7839

View File

@ -49,28 +49,30 @@
$post['youtube'] = $matches[2]; $post['youtube'] = $matches[2];
} }
if (isset($post['files'])) { if (isset($post['files']) && $post['files']) {
$files = json_decode($post['files']); $files = json_decode($post['files']);
if ($files[0]->file == 'deleted') { if ($files[0]) {
if (count($files) > 1) { if ($files[0]->file == 'deleted') {
foreach ($files as $file) { if (count($files) > 1) {
if (($file == $files[0]) || ($file->file == 'deleted')) continue; foreach ($files as $file) {
$post['file'] = $config['uri_thumb'] . $file->thumb; if (($file == $files[0]) || ($file->file == 'deleted')) continue;
} $post['file'] = $config['uri_thumb'] . $file->thumb;
}
if (empty($post['file'])) $post['file'] = $config['image_deleted']; if (empty($post['file'])) $post['file'] = $config['image_deleted'];
}
else {
$post['file'] = $config['image_deleted'];
}
}
else if($files[0]->thumb == 'spoiler') {
$post['file'] = '/' . $config['spoiler_image'];
} }
else { else {
$post['file'] = $config['image_deleted']; $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
} }
} }
else if($files[0]->thumb == 'spoiler') {
$post['file'] = '/' . $config['spoiler_image'];
}
else {
$post['file'] = $config['uri_thumb'] . $files[0]->thumb;
}
} }
if (empty($post['image_count'])) $post['image_count'] = 0; if (empty($post['image_count'])) $post['image_count'] = 0;