OpenSim.VisitorBoard/classes/GridUserInfo.php

366 lines
35 KiB
PHP
Raw Normal View History

2020-11-28 08:19:59 +00:00
<?php
/***********************************************************************
* Script (c) Kubwa (https://kubwa.de)
*
* This script was release under BSD license.
* You are free to use, share or change this code as you wish. This
* header must be kept intact.
***********************************************************************/
class GridUser
{
//Predfined images
private $ErrorImage = "/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMi4xMAAA/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgBAAEAAwEhAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A+y6KACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACkoAhmvre3VmlnjjCjJLMBgVjy+PvDUDbZNf01G9GukH9aALVn4r0XUmAtdVs7g+kU6t/I1pJKkn3HVvoc0APooAKKACigAooAKKACigAooAKKACigAooAKKACigAqC8vrfT7d57qaO3hQZaSRgoH4mgDxzxl+05o2jtJb6LA2qzrkeafliB/ma8X8SfHTxd4klctqJsYWGPJsxsUfj1/WgDiLvVLy/kMlzdTTuerSSFj+tVtxPU5oAVZGXoxH0NbGk+NNd0Jw1jqt1b46BZTj8qAPTvCP7Tuu6SyRazDHqtv0MgGyUD6jg/lXvPgj4seHvHkYFjeLFdgZa1n+WQfQd/woA7KigAooAKKACigAooAKKACigAooAKKACigAooA5L4hfErSfh5prT30u+6YfubVOXkP9B7mvkvx/wDFTW/iBeM95OYbMH93aQkhFHv6mgDjaKACigAooAKkt7mWzmWWCRopVOVdDgigD3r4U/tFzWbQaX4mczQZ2pffxL/v+o96+kLW6hvbeOeCRZoZBuV0OQR6g0AS0UAFFABRQAUUAFFABRQAUUAFFABRQAVyPxK+IVl8PPDst7OyvdMNtvb55kb/AAHU0AfGHibxNf8Ai3V59R1Gdpp5GzyeFHYAdhWTQA+GGS4lWOJGkkY4CqMk16t4J/Zz8Q+Jo1ub8ro9o3K+cMyN9F7fjQB63on7MfhTTwpvWudScdQ8mx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rH76/keZ+OQAdoH5DP416pQAUUAJXgHxy+OQsRP4f8Pz/wCk8pc3cZ+56qp9fegD5tZi7FmJZicknvSUAekfCP4QXnxEvhcTBrbR4WHmTEH95/sr719faPo9poOnQWNjAlvbQqFVEGP8mgC7Xxf8etFXRfiVqQRQqXG2cAD+8Of1zQB55Xt37K+qG38W6hZZ+We23Y91I/xoA+paKACigAooAKKACigAooAKKACuU+Klw1t8OfELqASbORefdSP60AfC9FAH3X8MIxD8PfD6qAB9jj6f7orqKACk6daAPAPjn8chYrP4f0CbNx9y5u4z9z1VT6+9fNrMXYsxLMTkk96AEr0f4Q/CK7+Imoie4D2+jQt+9mxjzP8AYX3/AJUAfYGkaTa6HpsFjZQrBbQqERFGABVygAr5X/aqhWPxtp8gABeyGffDtQB4pXqn7NczR/E23VekkEit9MZ/pQB9f0UAFFABRQAUUAFFABRQAUUAFcx8Trb7X8PfEMff7FKwx7KT/SgD4TooA+5fhLfR6h8N9AlibcotUjP+8o2n9Qa66gBM45PArwD45/HIWKz+HtAmzcH5Lm8jP3PVVPr6mgD5tZi7FmJZicknvSUAeifCT4R3nxE1ISyh7bSIWHmz4+//ALK+/wDKvsHRtGtNA02CxsYVt7aFdqoooAvUUAFfKH7Ul4lx4+tol6wWaq31LMf5EUAeN16v+zTbtN8SonHSO3kY/kB/WgD68ooAKKACigAooAKKACigAooAKhvLdLq0mhkVXSRCrKwyCCOhoA/P/WtPfSdYvbKTG+3meM46cEiqVAH1T+y74jGoeD7nSnfMljMSik/wNz/PP517STjk8CgDwD45fHIWSz+H9AmDTkbLm7jP3
private $BlockedImage = "/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMi4xMAAA/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgBAAEAAwEhAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A+y6KACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigArzzx58cvDfgVpLd5m1LUl4+yWmCVP8AtN0X+ftQB43rP7VXiK6Zhp2n2VhH2MgaVx+OQP0rBH7R/joSbv7SgI/u/ZI8fyzQB0Wi/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P95CKr9OtABRQBo6LrN9o9wJbKYrz8yHlW+or1jwr4rtNcTy2xBeAcxMfve6+tAHSV5z488Yf6zTdJk/2Zpl/VVP8AM0AecV7V8O/+RO0//tp/6MagDo6KACigAooAKKACigAooAKKAMXxRr9voNj5kuHnfiKLPLH1+leMatqV1qt49
private $Uuid;
private $HomeUri;
private $FirstName;
private $LastName;
private $HomeGrid;
private $BirthUnix;
private $ServiceUris;
private $ProfileImageUuid;
private $ProfileImageBlob;
private $ProfileAbout;
private $LastRequest;
private $LastUpdate;
private $UserTitle;
private $HomeRegionUuid;
private $HomeRegionName;
private $HomeRegionUri;
private $HomeRegionPos;
private $OSHeaders = array();
private $MySql;
private $WorkingPath;
private $ImagesPath;
public function __construct($Uuid, $HomeUri, $ImagesPath)
{
if (empty($Uuid) || empty($HomeUri))
{return;}
$this->Uuid = $Uuid;
$this->HomeUri = $HomeUri;
$this->WorkingPath = realpath(dirname(__FILE__));
$this->ImagesPath = $ImagesPath;
$this->MySql = new MySql($GLOBALS["CONFIG"]["mysql"]["user"], $GLOBALS["CONFIG"]["mysql"]["pass"], $GLOBALS["CONFIG"]["mysql"]["db"], $GLOBALS["CONFIG"]["mysql"]["server"]);
//Process OpenSim header fields
foreach ($_SERVER as $k => $v)
{
if (substr($k, 5, 13) == "X_SECONDLIFE_")
{$this->OSHeaders[substr($k, 18)] = $v;}
}
//Remove cached profile images after 60 days but process this cleanup every 5 days only
if ($this->HelpValue("IMAGE.LAST.CLEANTIME") + 86400 * 5 < time())
{
$this->HelpValue("IMAGE.LAST.CLEANTIME", time());
$Files = glob($this->ImagesPath."/UserImage/*.jpg");
foreach ($Files as $File)
{
if (is_file($File) && time() - filemtime($File) >= 86400 * 60)
{unlink($File);}
}
//Also delete the cached metadata
$this->MySql->query("DELETE FROM userdata WHERE lastreq < {0}", array(time() - 86400 * 60));
}
//Process pre defined images
if (!file_exists($this->ImagesPath."/UserImage/00000000-0000-0000-0000-000000000000.jpg"))
{file_put_contents($this->ImagesPath."/UserImage/00000000-0000-0000-0000-000000000000.jpg", base64_decode($this->ErrorImage));}
if (!file_exists($this->ImagesPath."/UserImage/00000000-0000-0000-0000-000000000001.jpg"))
{file_put_contents($this->ImagesPath."/UserImage/00000000-0000-0000-0000-000000000001.jpg", base64_decode($this->BlockedImage));}
if (!file_exists($this->ImagesPath."/UserImage/00000000-0000-0000-0000-000000000002.jpg"))
{file_put_contents($this->ImagesPath."/UserImage/00000000-0000-0000-0000-000000000002.jpg", base64_decode($this->UpdateImage));}
//Do the magic
$this->LastRequest = time();
if ($this->ExistsInCache()) //User exists in cache?
{
$this->GetFromCache(); //Load everything from cache
if ($this->LastUpdate + 3600 * 4 < time())
{
$this->GetFromInternet(); //Get all the data from the users grid
if ($this->HomeGrid == "Unknown" &&
$this->FirstName == "Unknown" &&
$this->LastName == "User")
{$this->GetFromCache();}
}
}
else
{$this->GetFromInternet();}
}
//The user might be unwanted in our system. See mysql table "bans"
private function IsUnwanted($CheckList)
{
$AllBans = $this->MySql->query("SELECT * FROM bans");
while ($Ban = $AllBans->fetch())
{
for ($i = 0; $i < count($CheckList); ++$i)
{
if (stripos($CheckList[$i], $Ban["banvalue"]) !== false)
{
$this->MySql->query("UPDATE bans SET nums = {1}, lastseen = {2} WHERE banvalue = {0} LIMIT 1", array($Ban["banvalue"], $Ban["nums"] + 1, $this->OSHeaders["OBJECT_KEY"]));
return true;
}
}
}
return false;
}
private function ExistsInCache()
{
$InCache = $this->MySql->query("SELECT * FROM userdata WHERE id = {0} LIMIT 1", array($this->Uuid))->fetch();
return !empty($InCache["id"]);
}
private function GetFromCache()
{
$Cache = $this->MySql->query("SELECT * FROM userdata WHERE id = {0} LIMIT 1", array($this->Uuid))->fetch();
$this->FromJson($Cache["userdata"]);
$this->LastUpdate = $Cache["lastreq"];
if (file_exists($this->ImagesPath."/UserImage/".$this->Uuid.".jpg"))
{$this->ProfileImageBlob = file_get_contents($this->ImagesPath."/UserImage/".$this->Uuid.".jpg");}
}
//Magic function
private function GetFromInternet()
{
//First of all, we need to find out what uris the gridservices are having for this user (might be different for each user)
$this->ServiceUris = $this->RequestUserSeviceUris();
if ($this->ServiceUris !== false)
{
//IF this was successfull, we are requesting all required user info from the services
$UserInfo = $this->RequestUserInfo();
if ($UserInfo !== false)
{
$this->FirstName = $UserInfo["user_firstname"];
$this->LastName = $UserInfo["user_lastname"];
/* Ungewollte User in der Auflistung ausschließen */
if ($this->IsUnwanted(array($this->Uuid, $this->HomeUri, $this->FirstName." ".$this->LastName)))
{
$this->BirthUnix = 0;
$this->UserTitle = "Blacklisted";
$this->HomeGrid = "Somewhere";
$this->ProfileImageUuid = "00000000-0000-0000-0000-000000000001";
$this->ProfileAbout = "";
$this->HomeRegionUuid = "00000000-0000-0000-0000-000000000000";
$this->HomeRegionName = "";
$this->HomeRegionUri = "";
$this->HomeRegionPos = "";
$this->HomeRegionUuid = "00000000-0000-0000-0000-000000000000";
$this->HomeRegionName = "Unknown";
$this->HomeRegionUri = "";
$this->HomeRegionPos = "<0, 0, 0>";
$this->ProfileImageBlob = base64_decode($this->BlockedImage);
$this->AddToCache();
return;
}
//We can do more magic: Request the entire user profile, its image and all other cool stuff
$ProfileData = $this->RequestUserProfile();
$GridInfo = $this->RequestHomeGrid();
$this->BirthUnix = $UserInfo["user_created"];
$this->UserTitle = $UserInfo["user_title"];
if (empty($this->UserTitle))
{$this->UserTitle = "Unknown";}
$this->HomeGrid = $GridInfo["gridname"];
$this->ProfileImageUuid = $ProfileData["result"]["ImageId"];
$this->ProfileAbout = $ProfileData["result"]["AboutText"];
$HomeRegion = $this->RequestHomeRegion();
$this->HomeRegionUuid = $HomeRegion["uuid"];
$this->HomeRegionName = $HomeRegion["region_name"];
$this->HomeRegionUri = $HomeRegion["server_uri"];
$this->HomeRegionPos = $HomeRegion["position"];
$this->ProfileImageBlob = $this->RequestUserImageBlob();
$this->AddToCache();
return;
}
}
$this->FirstName = "Unknown";
$this->LastName = "User";
$this->BirthUnix = 0;
$this->UserTitle = "Wrong configured grid";
$this->HomeGrid = "Unknown";
$this->ProfileImageUuid = "00000000-0000-0000-0000-000000000000";
$this->ProfileAbout = "";
$this->HomeRegionUuid = "00000000-0000-0000-0000-000000000000";
$this->HomeRegionName = "";
$this->HomeRegionUri = "";
$this->HomeRegionPos = "";
$this->HomeRegionUuid = "00000000-0000-0000-0000-000000000000";
$this->HomeRegionName = "Unknown";
$this->HomeRegionUri = "";
$this->HomeRegionPos = "<0, 0, 0>";
if (file_exists($this->ImagesPath."/UserImage/".$this->Uuid.".jpg"))
{$this->ProfileImageBlob = file_get_contents($this->ImagesPath."/UserImage/".$this->Uuid.".jpg");}
else
{$this->ProfileImageBlob = base64_decode($this->ErrorImage);}
}
private function RequestUserSeviceUris()
{
$Res = HttpRequest($this->HomeUri, "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>get_server_urls</methodName><params><param><value><struct><member><name>userID</name><value><string>".$this->Uuid."</string></value></member></struct></value></param></params></methodCall>", "", 3, "application/xml");
if (strlen($Res) < 200)
{return false;}
$ServiceURLs = ParseXml($Res);
$ServiceURLList = array();
for ($i = 0; $i < count($ServiceURLs["params"]["param"]["value"]["struct"]["member"]); ++$i)
{
$ServiceURL = $ServiceURLs["params"]["param"]["value"]["struct"]["member"][$i];
$ServiceURLList[$ServiceURL["name"]] = $ServiceURL["value"]["string"];
}
if (count($ServiceURLList) < 7)
{return false;}
return $ServiceURLList;
}
private function RequestUserProfile()
{return json_decode(HttpRequest($this->ServiceUris["SRV_ProfileServerURI"], "{\"jsonrpc\":\"2.0\",\"id\":\"00000000-0000-0000-0000-000000000000\",\"method\":\"avatar_properties_request\",\"params\":{\"UserId\":\"".$this->Uuid."\"}}", "", 3, "application/json-rpc"), true);}
private function RequestUserInfo()
{
$UserInfos = ParseXml(HttpRequest($this->HomeUri, "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>get_user_info</methodName><params><param><value><struct><member><name>userID</name><value><string>".$this->Uuid."</string></value></member></struct></value></param></params></methodCall>", "", 3, "application/xml"));
$UserInfosList = array();
for ($i = 0; $i < count($UserInfos["params"]["param"]["value"]["struct"]["member"]); ++$i)
{
$UserInfo = $UserInfos["params"]["param"]["value"]["struct"]["member"][$i];
$UserInfosList[$UserInfo["name"]] = $UserInfo["value"]["string"]?$UserInfo["value"]["string"]:$UserInfo["value"]["i4"];
}
if (count($UserInfosList) < 6)
{return false;}
return $UserInfosList;
}
private function RequestHomeGrid()
{return ParseXml(HttpRequest($this->HomeUri.((substr($this->HomeUri, -1, 1) == "/")?"":"/")."get_grid_info", "", "", 3), true);}
private function RequestHomeRegion()
{
$HomeInfos = ParseXml(HttpRequest($this->HomeUri, "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>get_home_region</methodName><params><param><value><struct><member><name>userID</name><value><string>".$this->Uuid."</string></value></member></struct></value></param></params></methodCall>", "", 3, "application/xml"));
$HomeInfosList = array();
for ($i = 0; $i < count($HomeInfos["params"]["param"]["value"]["struct"]["member"]); ++$i)
{
$HomeInfo = $HomeInfos["params"]["param"]["value"]["struct"]["member"][$i];
$HomeInfosList[$HomeInfo["name"]] = $HomeInfo["value"]["string"];
}
if (count($HomeInfosList) < 13)
{return false;}
return $HomeInfosList;
}
private function RequestUserImageBlob()
{
if (!empty($this->ProfileImageUuid) && $this->ProfileImageUuid != "00000000-0000-0000-0000-000000000000")
{
$AssetURI = $this->ServiceUris["SRV_AssetServerURI"].((substr($this->ServiceUris["SRV_AssetServerURI"], -1, 1) == "/")?"":"/")."assets/".$this->ProfileImageUuid."/data";
$AssetImageData = HttpRequest($AssetURI, "", "", 3);
$TempName = $this->MySql->id(8);
file_put_contents("binary_helper/".$TempName.".jp2", $AssetImageData);
//Should be the same for Windows and Unix... If not, only God can help you... or Google (which is the same)
shell_exec("binary_helper".DIRECTORY_SEPARATOR."magick convert binary_helper/".$TempName.".jp2 binary_helper/".$TempName.".jpg");
$AssetImageData = file_get_contents("binary_helper/".$TempName.".jpg");
@unlink("binary_helper/".$TempName.".jp2");
@unlink("binary_helper/".$TempName.".jpg");
if (strlen($AssetImageData) < 512)
{return base64_decode($this->ErrorImage);}
$SrcImg = imagecreatefromstring($AssetImageData);
$DstImg = ImageCreateTrueColor(200, 200);
imagecopyresampled($DstImg, $SrcImg, 0, 0, 0, 0, 200, 200, imageSX($SrcImg), imageSY($SrcImg));
ob_start();
imagejpeg($DstImg, null, 90);
$Res = ob_get_contents();
ob_end_clean();
}
else
{$Res = base64_decode($this->ErrorImage);}
return $Res;
}
private function AddToCache()
{
$this->MySql->query("REPLACE INTO userdata(id, userdata, lastreq)VALUES({0}, {1}, {2})", array($this->Uuid, $this->ToJson(), $this->LastRequest));
file_put_contents($this->ImagesPath."/UserImage/".$this->Uuid.".jpg", $this->ProfileImageBlob);
}
public function ToArray()
{
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,
"homeuri" => $this->HomeRegionUri);
}
else
{return false;}
}
public function ToJson()
{
if (!empty($this->FirstName))
{return json_encode($this->ToArray());}
else
{return false;}
}
public function FromJson($Json)
{
$Json = json_decode($Json, true);
$this->Uuid = $Json["uuid"];
$this->FirstName = $Json["firstname"];
$this->LastName = $Json["lastname"];
$this->HomeGrid = $Json["homegrid"];
$this->BirthUnix = $Json["birthunix"];
$this->ProfileImageUuid = $Json["profileimage"];
$this->ProfileAbout = $Json["about"];
$this->UserTitle = $Json["title"];
$this->HomeRegionName = $Json["home"];
$this->HomeRegionPos = $Json["homelocation"];
$this->HomeRegionUri = $Json["homeuri"];
}
public function ToLsl($Glue)
{
if (!empty($this->FirstName))
{
return implode($Glue, array($this->Uuid,
$this->FirstName,
$this->LastName,
($this->HomeGrid==null)?"Unknown":$this->HomeGrid,
($this->BirthUnix==null)?"0":$this->BirthUnix,
($this->ProfileImageUuid==null)?"00000000-0000-0000-0000-000000000000":$this->ProfileImageUuid,
base64_encode($this->ProfileAbout),
($this->UserTitle==null)?"":(is_array($this->UserTitle)?"":$this->UserTitle),
($this->HomeRegionName==null)?"":$this->HomeRegionName,
($this->HomeRegionPos==null)?"<0, 0, 0>":$this->HomeRegionPos,
($this->HomeRegionUri==null)?"":$this->HomeRegionUri));
}
else
{return false;}
}
private function HelpValue($Name, $Value = null)
{
if ($Value === null)
{
$Res = $this->MySql->query("SELECT * FROM helpvals WHERE name = {0} LIMIT 1", array($Name))->fetch();
return $Res["val"];
}
else
{$this->MySql->query("REPLACE INTO helpvals (name, val)VALUES({0}, {1})", array($Name, $Value));}
}
}
?>