372 lines
35 KiB
PHP
372 lines
35 KiB
PHP
<?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+cMyN9F7fjQB63on7MfhTTwpv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MwW7D/AFI9T/tfyoA9xooAKKACigAooAKKACigAooAKKACigAooAqarpNprdhNZX0CXNtKu143GQa+bPiX+zbeabLcX/hrN3Z/f+xscyJ7L/eH60AeH3VrNZzNDPE8MqnDJIpBH4VFQAUUAFFABXR+D/h9rnji8WDTLKSRM/POwIjT6tQB9Q/C/wCBul+A1S7u9uo6t/z2Zflj9lH9a9PoAKKACigAooAKKACigAooAKKACigAooAKKACigDmPFXw38PeM42Gp6dHLKRgToNsg/wCBCvG/EX7KJG99F1bI5Iiu1/Ibh/hQBwepfs7+NtPZtmnR3iKM74Jl/kSD+lc5N8LfFsD7W8PagT/s27MP0FAFuw+DfjPUmCxaDdIT/wA9gIx/48RXW6N+zD4pvmU3slrp6HqGfew/Lj9aAPUPCP7M/h7Q5Fn1OSTV5x/BJ8sQP0HX8TXrOn6ba6Tarb2dvHbQL0jjUKKALNFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQAUUAFFABRQB/9k=";
|
|
private $BlockedImage = "/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMi4xMAAA/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgBAAEAAwEhAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A+y6KACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigArzzx58cvDfgVpLd5m1LUl4+yWmCVP8AtN0X+ftQB43rP7VXiK6Zh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v8A4CR/4Uf8IfoP/QE03/wEj/woAP8AhD9B/wCgJpv/AICR/wCFH/CH6D/0BNN/8BI/8KAD/hD9B/6Amm/+Akf+FH/CH6D/ANATTf8AwEj/AMKAD/hD9B/6Amm/+Akf+FH/AAh+g/8AQE03/wABI/8ACgCS38L6NaTJNBpFjDMhyskdsisp9QQOK1KACuZ8bfDvQ/iBZiDVrQPIgPlXMfyyx/RvT2PFAHz94q/Zb17TppH0S6h1W26qkh8qUexzwfrn8BXAX3wk8Z6fIUl8Nak5H/PCAyj80zQBJp/we8aanIFi8N38ee9xF5I/8fxXovhH9ljU7yZJfEN9HYWw5a3tT5kre27ov15oA+gfCfgvR/BOmiy0izS2j6u/V5D6s3UmtygAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooA//9k=";
|
|
private $UpdateImage = "/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMi4xMgAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgBAAEAAwEhAAIRAQMRAf/EAB8A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oCqAowAMAUtABRQAUUAFFABRQAUUAFFABTJ4Y7iF4plDxuCrKehFAHi/jLw7JoV8SgZrKU5if0/2T71ztAE1nczWdwk9tI0cqHKsp5Fen+F/HdveIkGrFbe56eb0R/8AA0AdwpDKCpBB5BHeigAooAKKACue8R+K7DRVaMuJ7sDiFD0Pue1AHkuu61ea1dedeyZx9xF4VB7Cs2gC5pGnXGq30draIWkc8nso7k+1e4eH9Ig0XTY7W3HTl37u3c0AaNFABRQAUUAFFABRQAUUAFFABRQBW1Gxt9Rs5La7jEkTjBB/mPevHfFfhe60KcuA0tkx+SUDp7N6GgDnaKANnRvEmp6RhbS4JiH/ACyf5l/LtXaab8SLd1C6jaPG/d4juX8jyP1oA37fxloc4H+mrGfSRSKtjxHoxGRqVr/38FAEM/izQ4R82oRN7Jlv5VjX/wARNNhUi0hnuX7cbF/M8/pQBx2seNtW1HciSC1hP8MPBx7nrXMkkkknJPJJoASr+jaTd6veC3soy7fxN/Cg9SaAPZPDHh+20Gz8uL553H72Ujlj/QVtUAFFABRQAUUAFFABRQAUUAFFABRQAUyeGO4haKdFkjYYZWGQRQB514n8AMGa40Q5XqbdjyP90/0Nef3NvNazNDcxPFKvBVxgigCKigAooAKKAClAJOAMmgDrvDnge+1Fklvg1pa9TuHzsPYdvxr1HSdLtNKtRBYwiNO57sfUnvQBdooAKKACigAooAKKACigAooAKKACigAooAKo6ppNjqkey+to5ewYj5h9D1oA4rVvhwjZfS7sp/0zmGR/30P8K5e98Ga3ak/6IZR6xMGoAyLjTb23P7+zuI/96MiqpBBwQQaAJobS5nOIbeaQ/wCyhNalp4V1q6I8uwmUHvINn86AOj0v4cXMjBtSukhTukQ3Mfx6D9a7XRvDGl6Thra3DSj/AJayfM3/ANb8KANqigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKAP/9k=";
|
|
|
|
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);
|
|
if (extension_loaded("imagick"))
|
|
{
|
|
$Image = new Imagick(realpath("./binary_helper/".$TempName.".jp2"));
|
|
$Image->setImageFormat("jpg");
|
|
$Image->writeImage(realpath("./binary_helper/".$TempName.".jpg"));
|
|
}
|
|
else
|
|
{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));}
|
|
}
|
|
}
|
|
?>
|