From b38d5811a494a8655c9b8f2a02a2eae2707c27e8 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Fri, 10 Mar 2017 12:50:48 -0500 Subject: [PATCH] More work on user profile page --- app/views/me.php | 3 +-- src/API/JsonAPI.php | 13 ++++++++++++- src/Controller.php | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/views/me.php b/app/views/me.php index 09a9a37a..fbe4d8a8 100644 --- a/app/views/me.php +++ b/app/views/me.php @@ -19,8 +19,7 @@ html($attributes['waifuOrHusbando']) ?> a( $url->generate('character', ['slug' => $character['slug']]), $character['name'] diff --git a/src/API/JsonAPI.php b/src/API/JsonAPI.php index 445edfe6..dc0475e0 100644 --- a/src/API/JsonAPI.php +++ b/src/API/JsonAPI.php @@ -182,7 +182,18 @@ class JsonAPI { { if (array_key_exists('data', $block) && is_array($block['data']) && ! empty($block['data'])) { - $output[$key] = $block['data']; + $output[$key] = []; + if (array_key_exists('type', $block['data']) && array_key_exists('id', $block['data'])) + { + $output[$key] = $includes[$block['data']['type']][$block['data']['id']]; + } + else + { + foreach($block['data'] as $dBlock) + { + $output[$key][] = $includes[$dBlock['type']][$dBlock['id']]; + } + } } } diff --git a/src/Controller.php b/src/Controller.php index 0ff3a783..05ab91eb 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -71,6 +71,11 @@ class Controller { $this->baseData['message'] = $this->session->getFlash('message'); } + /** + * Show the user profile page + * + * @return void + */ public function me() { $username = $this->config->get(['kitsu_username']);