mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 07:30:10 +01:00
Fix API: Swap image width/height, make replies an integer, fix original filename
This commit is contained in:
parent
6052ed8d3d
commit
d266908ca9
10
inc/api.php
10
inc/api.php
@ -43,10 +43,9 @@ class Api {
|
|||||||
$this->fileFields = array(
|
$this->fileFields = array(
|
||||||
'thumbheight' => 'tn_h',
|
'thumbheight' => 'tn_h',
|
||||||
'thumbwidth' => 'tn_w',
|
'thumbwidth' => 'tn_w',
|
||||||
'height' => 'w',
|
'height' => 'h',
|
||||||
'width' => 'h',
|
'width' => 'w',
|
||||||
'size' => 'fsize',
|
'size' => 'fsize',
|
||||||
'file' => 'filename',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($config['api']['extra_fields']) && gettype($config['api']['extra_fields']) == 'array'){
|
if (isset($config['api']['extra_fields']) && gettype($config['api']['extra_fields']) == 'array'){
|
||||||
@ -65,6 +64,8 @@ class Api {
|
|||||||
'fsize' => 1,
|
'fsize' => 1,
|
||||||
'omitted_posts' => 1,
|
'omitted_posts' => 1,
|
||||||
'omitted_images' => 1,
|
'omitted_images' => 1,
|
||||||
|
'replies' => 1,
|
||||||
|
'images' => 1,
|
||||||
'sticky' => 1,
|
'sticky' => 1,
|
||||||
'locked' => 1,
|
'locked' => 1,
|
||||||
'last_modified' => 1
|
'last_modified' => 1
|
||||||
@ -108,10 +109,9 @@ class Api {
|
|||||||
if (isset($post->files) && $post->files && !$threadsPage) {
|
if (isset($post->files) && $post->files && !$threadsPage) {
|
||||||
$file = $post->files[0];
|
$file = $post->files[0];
|
||||||
$this->translateFields($this->fileFields, $file, $apiPost);
|
$this->translateFields($this->fileFields, $file, $apiPost);
|
||||||
|
$apiPost['filename'] = substr($file->name, 0, strrpos($file->name, '.'));
|
||||||
$dotPos = strrpos($file->file, '.');
|
$dotPos = strrpos($file->file, '.');
|
||||||
$apiPost['filename'] = substr($file->file, 0, $dotPos);
|
|
||||||
$apiPost['ext'] = substr($file->file, $dotPos);
|
$apiPost['ext'] = substr($file->file, $dotPos);
|
||||||
$dotPos = strrpos($file->file, '.');
|
|
||||||
$apiPost['tim'] = substr($file->file, 0, $dotPos);
|
$apiPost['tim'] = substr($file->file, 0, $dotPos);
|
||||||
$apiPost['md5'] = base64_encode(hex2bin($post->filehash));
|
$apiPost['md5'] = base64_encode(hex2bin($post->filehash));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user