From b222d739b62b7de0ee3b14db416744097ed08941 Mon Sep 17 00:00:00 2001 From: Kubwa Date: Tue, 8 Dec 2020 18:18:07 +0100 Subject: [PATCH] Bugfix with caching. Sorry guys, my fault. --- classes/GridUserInfo.php | 30 ++++++++++++++++-------------- index.php | 3 +-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/classes/GridUserInfo.php b/classes/GridUserInfo.php index cfd2eeb..defde3b 100644 --- a/classes/GridUserInfo.php +++ b/classes/GridUserInfo.php @@ -267,22 +267,24 @@ private function AddToCache() {$this->MySql->query("REPLACE INTO userdata(id, userdata, lastreq, image)VALUES({0}, {1}, {2}, {3})", array($this->Uuid, $this->ToJson(), $this->LastRequest, $this->ProfileImageBlob));} - public function ToArray() + public function ToArray($ExportImage = true) { if (!empty($this->FirstName)) { - return array("uuid" => $this->Uuid, - "firstname" => $this->FirstName, - "lastname" => $this->LastName, - "homegrid" => $this->HomeGrid, - "birthunix" => $this->BirthUnix, - "profileimage" => $this->ProfileImageUuid, - "about" => $this->ProfileAbout, - "title" => $this->UserTitle, - "home" => $this->HomeRegionName, - "homelocation" => $this->HomeRegionPos, - "img" => $this->ProfileImageBlob, - "homeuri" => $this->HomeRegionUri); + $Export = array("uuid" => $this->Uuid, + "firstname" => $this->FirstName, + "lastname" => $this->LastName, + "homegrid" => $this->HomeGrid, + "birthunix" => $this->BirthUnix, + "profileimage" => $this->ProfileImageUuid, + "about" => $this->ProfileAbout, + "title" => $this->UserTitle, + "home" => $this->HomeRegionName, + "homelocation" => $this->HomeRegionPos, + "homeuri" => $this->HomeRegionUri); + if ($ExportImage) + {$Export["img"] = $this->ProfileImageBlob;} + return $Export; } else {return false;} @@ -291,7 +293,7 @@ public function ToJson() { if (!empty($this->FirstName)) - {return json_encode($this->ToArray());} + {return json_encode($this->ToArray(false));} else {return false;} } diff --git a/index.php b/index.php index e88c686..1afb113 100644 --- a/index.php +++ b/index.php @@ -67,8 +67,7 @@ for ($i = 0; $i < count($AllUsers); ++$i) { $SingleUser = explode(",", $AllUsers[$i]); - for ($z = 0; $z < count($SingleUser); ++$z) - {$SingleUser[$z] = trim($SingleUser[$z]);} + for ($z = 0; $z < count($SingleUser); ++$z) {$SingleUser[$z] = trim($SingleUser[$z]);} if (!empty($SingleUser[0]) && !empty($SingleUser[1])) { //The magic is done here