From 6073c9e73ad6c7f400c560ce8b9d0e8a93233317 Mon Sep 17 00:00:00 2001 From: clsr Date: Thu, 16 Oct 2014 17:08:39 +0200 Subject: [PATCH 1/2] Fix API: Swap image width/height, make replies an integer, fix original filename --- inc/api.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/api.php b/inc/api.php index 31cf2293..600b1096 100644 --- a/inc/api.php +++ b/inc/api.php @@ -43,10 +43,9 @@ class Api { $this->fileFields = array( 'thumbheight' => 'tn_h', 'thumbwidth' => 'tn_w', - 'height' => 'w', - 'width' => 'h', + 'height' => 'h', + 'width' => 'w', 'size' => 'fsize', - 'file' => 'filename', ); if (isset($config['api']['extra_fields']) && gettype($config['api']['extra_fields']) == 'array'){ @@ -65,6 +64,8 @@ class Api { 'fsize' => 1, 'omitted_posts' => 1, 'omitted_images' => 1, + 'replies' => 1, + 'images' => 1, 'sticky' => 1, 'locked' => 1, 'last_modified' => 1 @@ -108,10 +109,9 @@ class Api { if (isset($post->files) && $post->files && !$threadsPage) { $file = $post->files[0]; $this->translateFields($this->fileFields, $file, $apiPost); + $apiPost['filename'] = substr($file->name, 0, strrpos($file->name, '.')); $dotPos = strrpos($file->file, '.'); - $apiPost['filename'] = substr($file->file, 0, $dotPos); $apiPost['ext'] = substr($file->file, $dotPos); - $dotPos = strrpos($file->file, '.'); $apiPost['tim'] = substr($file->file, 0, $dotPos); $apiPost['md5'] = base64_encode(hex2bin($post->filehash)); } From 7e3fd0dcc590cb6d6b8ef663e27a99e196b0b8d1 Mon Sep 17 00:00:00 2001 From: clsr Date: Thu, 16 Oct 2014 17:26:58 +0200 Subject: [PATCH 2/2] Fix expanded tabs --- inc/api.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/api.php b/inc/api.php index 600b1096..c9608f06 100644 --- a/inc/api.php +++ b/inc/api.php @@ -64,8 +64,8 @@ class Api { 'fsize' => 1, 'omitted_posts' => 1, 'omitted_images' => 1, - 'replies' => 1, - 'images' => 1, + 'replies' => 1, + 'images' => 1, 'sticky' => 1, 'locked' => 1, 'last_modified' => 1 @@ -109,7 +109,7 @@ class Api { if (isset($post->files) && $post->files && !$threadsPage) { $file = $post->files[0]; $this->translateFields($this->fileFields, $file, $apiPost); - $apiPost['filename'] = substr($file->name, 0, strrpos($file->name, '.')); + $apiPost['filename'] = substr($file->name, 0, strrpos($file->name, '.')); $dotPos = strrpos($file->file, '.'); $apiPost['ext'] = substr($file->file, $dotPos); $apiPost['tim'] = substr($file->file, 0, $dotPos);