forked from leftypol/leftypol
Load board config while generating json
This commit is contained in:
parent
e14df481a6
commit
beede38c6e
2 changed files with 21 additions and 15 deletions
21
inc/api.php
21
inc/api.php
|
@ -108,13 +108,17 @@ class Api {
|
|||
$apiPost['file_path'] = $config['uri_img'] . $file->file;
|
||||
|
||||
// Pick the correct thumbnail
|
||||
if (!isset ($file->thumb) || $file->thumb === 'file') {
|
||||
$thumbFile = $config['file_icons']['default'];
|
||||
if (isset($file->extension) && isset($config['file_icons'][$file->extension])) {
|
||||
$thumbFile = $config['file_icons'][$file->extension];
|
||||
}
|
||||
if (isset($file->thumb)) {
|
||||
if ($file->thumb === 'spoiler') {
|
||||
$apiPost['thumb_path'] = $config['root'] . $config['spoiler_image'];
|
||||
} else if ($file->thumb === 'file') {
|
||||
$thumbFile = $config['file_icons']['default'];
|
||||
if (isset($file->extension) && isset($config['file_icons'][$file->extension])) {
|
||||
$thumbFile = $config['file_icons'][$file->extension];
|
||||
}
|
||||
|
||||
$apiPost['thumb_path'] = $config['root'] . sprintf($config['file_thumb'], $thumbFile);
|
||||
$apiPost['thumb_path'] = $config['root'] . sprintf($config['file_thumb'], $thumbFile);
|
||||
}
|
||||
} else {
|
||||
$apiPost['thumb_path'] = $config['uri_thumb'] . $file->thumb;
|
||||
}
|
||||
|
@ -129,6 +133,11 @@ class Api {
|
|||
if (isset($config['poster_ids']) && $config['poster_ids']) $apiPost['id'] = poster_id($post->ip, $post->thread, $board['uri']);
|
||||
if ($threadsPage) return $apiPost;
|
||||
|
||||
// Load board info
|
||||
if (isset($post->board)) {
|
||||
openBoard($post->board);
|
||||
}
|
||||
|
||||
// Handle special fields
|
||||
if (isset($post->body_nomarkup) && ($this->config['country_flags'] || $this->config['user_flag'])) {
|
||||
$modifiers = extract_modifiers($post->body_nomarkup);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue