Bugfix with caching. Sorry guys, my fault.

master
Kubwa 2020-12-08 18:18:07 +01:00
parent 7c313535bc
commit b222d739b6
2 changed files with 17 additions and 16 deletions

View File

@ -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;}
}

View File

@ -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