From 1b52881fb5e1573d3d357e4213008aff780050e8 Mon Sep 17 00:00:00 2001 From: Timo Ley Date: Wed, 30 Sep 2020 22:03:52 +0200 Subject: [PATCH] Changing some single response JSON structures (old structures still included) --- jensmemes.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jensmemes.php b/jensmemes.php index 7621292..376aa11 100644 --- a/jensmemes.php +++ b/jensmemes.php @@ -61,9 +61,16 @@ if ($method == "GET") { $obj->status = 200; $path = $row["path"]; $path = str_replace(" ", "%20", $path); + $obj->link = $jmurl . $path; $obj->user = $row["user"]; $obj->category = $row["cat"]; + + $meme = new stdClass(); + $meme->link = $jmurl . $path; + $meme->user = $row["user"]; + $meme->category = $row["cat"]; + $obj->meme = $meme; } } break; @@ -80,9 +87,16 @@ if ($method == "GET") { $meme = $memes[$random]; if (isset($meme->path)) { $obj->status = 200; + $obj->link = $jmurl . $meme->path; $obj->category = $meme->category; $obj->user = $meme->user; + + $img = new stdClass(); + $img->link = $jmurl . $meme->path; + $img->category = $meme->category; + $img->user = $meme->user; + $obj->meme = $img; } break; case "/categories": @@ -97,8 +111,14 @@ if ($method == "GET") { $row = mysqli_fetch_array($res, MYSQLI_ASSOC); if ($row) { $obj->status = 200; + $obj->id = $row["id"]; $obj->name = $row["name"]; + + $cat = new stdClass(); + $cat->id = $row["id"]; + $cat->name = $row["name"]; + $obj->category = $cat; } } break;