Compare commits
No commits in common. "1205ecf37b815efed3a75559e3568e98c6799557" and "e7841d40dea89b4ec0699dbbc9bd2dc255a837fd" have entirely different histories.
1205ecf37b
...
e7841d40de
8
home.php
8
home.php
|
@ -31,14 +31,6 @@ echo '
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="dashboard-minelife">
|
|
||||||
<a href="minelife.html">
|
|
||||||
<span>
|
|
||||||
Manuel
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,14 +75,14 @@ class DAO {
|
||||||
|
|
||||||
'duniter' => 2,
|
'duniter' => 2,
|
||||||
'cesiumplus' => 5,
|
'cesiumplus' => 5,
|
||||||
'gchange' => 1,
|
'gchange' => 10,
|
||||||
];
|
];
|
||||||
|
|
||||||
private $nodeTimeoutIncrement = [
|
private $nodeTimeoutIncrement = [
|
||||||
|
|
||||||
'duniter' => 2,
|
'duniter' => 2,
|
||||||
'cesiumplus' => 10,
|
'cesiumplus' => 10,
|
||||||
'gchange' => 3
|
'gchange' => 10
|
||||||
];
|
];
|
||||||
|
|
||||||
private $node = NULL;
|
private $node = NULL;
|
||||||
|
@ -489,9 +489,7 @@ class DAO {
|
||||||
$out[] = '<pre>'. print_r($queryParams, true) . '<pre>';
|
$out[] = '<pre>'. print_r($queryParams, true) . '<pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->decease($out);
|
$this->decease($out);
|
||||||
|
|
||||||
throw new Exception(implode("\n", $out));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $json;
|
return $json;
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class ErrorsHandler {
|
|
||||||
|
|
||||||
public function __construct () {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function kaput ($errorMsgs) {
|
|
||||||
|
|
||||||
|
|
||||||
ob_get_clean(); // to prevent error message to display inside an HTML container (case of error generated by get method calls)
|
|
||||||
|
|
||||||
|
|
||||||
if (!is_array($errorMsgs)) {
|
|
||||||
|
|
||||||
$errorMsgs = explode("\n", $errorMsgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>'. _('Erreur critique') . '</title>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
div {
|
|
||||||
|
|
||||||
overflow: auto;
|
|
||||||
word-wrap: break-word;
|
|
||||||
background-color: hsl(0, 100%, 69%);
|
|
||||||
color: hsl(0, 100%, 19%);
|
|
||||||
margin: 1em;
|
|
||||||
padding: 1em;
|
|
||||||
border-radius: 1em;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: calc(100% - 4em);
|
|
||||||
max-height: calc(100vh - 4em);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div>';
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($errorMsgs as $msg) {
|
|
||||||
|
|
||||||
echo '<pre>' . print_r($msg, true) . '</pre>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>';
|
|
||||||
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -78,7 +78,6 @@ class Fred {
|
||||||
return json_decode($json);
|
return json_decode($json);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,16 +90,7 @@ class Fred {
|
||||||
|
|
||||||
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
|
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
|
||||||
|
|
||||||
$opts = array(
|
$page1 = file_get_contents($url)
|
||||||
'http'=>array(
|
|
||||||
'method'=>"GET",
|
|
||||||
'header'=>"Accept-language: fr\r\n",
|
|
||||||
'follow_location' => 0
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
|
||||||
$page1 = file_get_contents($url, false, $context)
|
|
||||||
or die('<p>On a fait du sale.</p>');
|
or die('<p>On a fait du sale.</p>');
|
||||||
|
|
||||||
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
|
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
|
||||||
|
@ -118,23 +108,11 @@ class Fred {
|
||||||
|
|
||||||
$page2 = '';
|
$page2 = '';
|
||||||
|
|
||||||
$opts2 = array(
|
|
||||||
'http'=>array(
|
|
||||||
'method'=>"GET",
|
|
||||||
'header'=>"Accept-language: fr\r\n",
|
|
||||||
'follow_location' => 0
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$context2 = stream_context_create($opts2);
|
|
||||||
|
|
||||||
sleep(3);
|
|
||||||
|
|
||||||
while (empty($page2)) {
|
while (empty($page2)) {
|
||||||
|
|
||||||
sleep($this->gatewayDelay);
|
sleep($this->gatewayDelay);
|
||||||
|
|
||||||
$page2 = file_get_contents($url, false, $context2) or die('<pre>'. var_dump($page2, true) . '</pre>');
|
$page2 = @file_get_contents($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches);
|
preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches);
|
||||||
|
|
|
@ -7,7 +7,6 @@ require_once('DAO.class.php');
|
||||||
require_once('GchangeUser.class.php');
|
require_once('GchangeUser.class.php');
|
||||||
require_once('GchangeRecord.class.php');
|
require_once('GchangeRecord.class.php');
|
||||||
require_once('GchangeRating.class.php');
|
require_once('GchangeRating.class.php');
|
||||||
require_once('ErrorsHandler.class.php');
|
|
||||||
|
|
||||||
class Gchange {
|
class Gchange {
|
||||||
|
|
||||||
|
@ -19,13 +18,9 @@ class Gchange {
|
||||||
|
|
||||||
private $cacheLongevity = array(
|
private $cacheLongevity = array(
|
||||||
'placesNearby' => 604800, // 3 jours
|
'placesNearby' => 604800, // 3 jours
|
||||||
'placeDetails' => 2116800, // 7 jours
|
|
||||||
'placeVisitors' => 2116800, // 7 jours
|
|
||||||
|
|
||||||
'usersNearby' => 43200, // 12 heures
|
'usersNearby' => 43200, // 12 heures
|
||||||
'users' => 2116800, // 12 heures
|
'users' => 43200, // 12 heures
|
||||||
|
'records' => 900 // 15 min
|
||||||
'userRecords' => 900 // 15 min
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct () {
|
public function __construct () {
|
||||||
|
@ -33,468 +28,15 @@ class Gchange {
|
||||||
$this->dao = DAO::getInstance();
|
$this->dao = DAO::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchJson ($uri, $queryParams = null) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->dao->fetchJson($uri, 'gchange', $queryParams);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw $errorMsgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $json;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getJsonFromCache ($dir, $file, $cacheLongevity = null) {
|
|
||||||
|
|
||||||
if (!$this->isActivatedCache) {
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$json = null;
|
|
||||||
$jsonFullPath = $this->cacheDir . $dir . $file;
|
|
||||||
|
|
||||||
if (!file_exists($jsonFullPath)) {
|
|
||||||
|
|
||||||
throw new Exception("Le fichier de cache suivant n'existe pas : " . $jsonFullPath);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cacheLongevity !== null and (time() - filemtime($jsonFullPath) > $cacheLongevity)) {
|
|
||||||
|
|
||||||
throw new Exception("Le fichier de cache est expiré.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = file_get_contents($jsonFullPath);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw new Exception($jsonFullPath . " n'a pas été trouvé");
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
|
|
||||||
return $json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function cacheJson ($dir, $file, $json) {
|
|
||||||
|
|
||||||
if (!$this->isActivatedCache) {
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
$jsonCacheDir = $this->cacheDir . $dir;
|
|
||||||
$jsonFullPath = $jsonCacheDir . $file;
|
|
||||||
|
|
||||||
if (!file_exists($jsonCacheDir)) {
|
|
||||||
|
|
||||||
mkdir($jsonCacheDir, 0777, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents($jsonFullPath, $json);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUser ($pubkey) {
|
|
||||||
|
|
||||||
$usersCacheDir = 'users/';
|
|
||||||
$usersCacheFile = $pubkey . '.json';
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($usersCacheDir, $usersCacheFile, $this->cacheLongevity['users']);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/user/profile/'. $pubkey);
|
|
||||||
|
|
||||||
$this->cacheJson($usersCacheDir, $usersCacheFile, $json);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($usersCacheDir, $usersCacheFile, null);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw new Exception("L'utilisateur " . $pubkey . " n'a été trouvé nulle part.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
return new GchangeUser($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNearbyUsers ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
|
||||||
|
|
||||||
$nearbyUsersCacheDir = 'users-nearby/geopoint/' . $maxDistance . 'km/';
|
|
||||||
$nearbyUsersCacheFile = $lat . ',' . $lon . '.json';
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($nearbyUsersCacheDir, $nearbyUsersCacheFile, $this->cacheLongevity['usersNearby']);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
$n = 20;
|
|
||||||
|
|
||||||
$queryParams = [
|
|
||||||
'size' => $n,
|
|
||||||
'query' => [
|
|
||||||
'bool' => [
|
|
||||||
'filter' => [
|
|
||||||
[
|
|
||||||
'geo_distance' => [
|
|
||||||
|
|
||||||
"distance" => $maxDistance . 'km',
|
|
||||||
"geoPoint"=> [
|
|
||||||
"lat" => $lat,
|
|
||||||
"lon" => $lon
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/users/record/_search', $queryParams);
|
|
||||||
|
|
||||||
$this->cacheJson($nearbyUsersCacheDir, $nearbyUsersCacheFile, $json);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($nearbyUsersCacheDir, $nearbyUsersCacheFile, null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
return $result->hits->hits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPlacesNearUser ($user, $radius) {
|
|
||||||
|
|
||||||
return $this->getNearbyPlaces($user->getLat(), $user->getLon(), $radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPlaceDetails ($placeId) {
|
|
||||||
|
|
||||||
$placeDetailsCacheDir = 'place/details/';
|
|
||||||
$placeDetailsCacheFile = $placeId . '.json';
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($placeDetailsCacheDir, $placeDetailsCacheFile, $this->cacheLongevity['placeDetails']);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/page/record/' + $placeId);
|
|
||||||
|
|
||||||
$this->cacheJson($placeDetailsCacheDir, $placeDetailsCacheFile, $json);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($placeDetailsCacheDir, $placeDetailsCacheFile, null);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw new Exception('Pas pu trouver les détails pour la page ' . $placeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return json_decode($json);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNearbyPlaces ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
|
||||||
|
|
||||||
$placesCacheDir = 'places-nearby/geopoint/' . $maxDistance . 'km/';
|
|
||||||
$placesCacheFile = $lat . ',' . $lon . '.json';
|
|
||||||
|
|
||||||
$placeDetailsCacheDir = 'place/details/';
|
|
||||||
|
|
||||||
$nearbyPlaces = [];
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($placesCacheDir, $placesCacheFile, $this->cacheLongevity['placesNearby']);
|
|
||||||
|
|
||||||
$places = json_decode($json);
|
|
||||||
|
|
||||||
foreach ($places->hits->hits as $place) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$p = $this->getPlaceDetails($place->_id);
|
|
||||||
$nearbyPlaces[] = $p;
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// place not found
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$n = 50;
|
|
||||||
|
|
||||||
$queryParams = [
|
|
||||||
'size' => $n,
|
|
||||||
'fields' => ['_id'],
|
|
||||||
'query' => [
|
|
||||||
'bool' => [
|
|
||||||
'filter' => [
|
|
||||||
[
|
|
||||||
'geo_distance' => [
|
|
||||||
|
|
||||||
"distance" => $maxDistance . 'km',
|
|
||||||
"geoPoint"=> [
|
|
||||||
"lat" => $lat,
|
|
||||||
"lon" => $lon
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/page/record/_search', $queryParams);
|
|
||||||
|
|
||||||
// cache nearby places index
|
|
||||||
$this->cacheJson($placesCacheDir, $placesCacheFile, $json);
|
|
||||||
|
|
||||||
// cache each nearby place details
|
|
||||||
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $place) {
|
|
||||||
|
|
||||||
$nearbyPlaces[] = $place;
|
|
||||||
|
|
||||||
$placeDetailsCacheFile = $place->_id . '.json';
|
|
||||||
$this->cacheJson($placeDetailsCacheDir, $placeDetailsCacheFile, json_encode($place));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($placesCacheDir, $placesCacheFile, null);
|
|
||||||
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $place) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$p = $this->getPlaceDetails($place->_id);
|
|
||||||
$nearbyPlaces[] = $p;
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// place not found
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw new Exception('Pas pu récupérer la liste des lieux : ' . $errorMsgs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $nearbyPlaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public function getNearbyRecords ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
|
||||||
|
|
||||||
$n = 20;
|
|
||||||
|
|
||||||
$queryParams = [
|
|
||||||
'size' => $n,
|
|
||||||
'query' => [
|
|
||||||
'bool' => [
|
|
||||||
'must' => [
|
|
||||||
[
|
|
||||||
'geo_distance' => [
|
|
||||||
|
|
||||||
"distance" => $maxDistance . 'km',
|
|
||||||
"geoPoint"=> [
|
|
||||||
"lat" => $lat,
|
|
||||||
"lon" => $lon
|
|
||||||
]
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
'range' => [
|
|
||||||
'stock' => [
|
|
||||||
'gte' => 1
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/market/record/_search?pretty', $queryParams);
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
|
|
||||||
$records = [];
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $hit) {
|
|
||||||
|
|
||||||
$records[] = new GchangeRecord($hit);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $records;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function getUsersInDaPlace ($placeId) {
|
|
||||||
|
|
||||||
$users = [];
|
|
||||||
|
|
||||||
$cacheDir = 'place/visitors/';
|
|
||||||
$cacheFile = $placeId . '.json';
|
|
||||||
$usersCacheDir = 'users/';
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($cacheDir, $cacheFile, $this->cacheLongevity['placeVisitors']);
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $hit) {
|
|
||||||
|
|
||||||
$user = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$user = null;
|
|
||||||
$user = $this->getUser($hit->_id);
|
|
||||||
$users[] = $user;
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// Utilisateur non trouvé
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
$n = 20;
|
|
||||||
|
|
||||||
$queryParams = [
|
|
||||||
'size' => $n
|
|
||||||
,'fields' => ['_id']
|
|
||||||
,'query' => [
|
|
||||||
'nested' => [
|
|
||||||
'path' => 'socials',
|
|
||||||
'query' => [
|
|
||||||
'bool' => [
|
|
||||||
'filter' => [
|
|
||||||
'term' => [
|
|
||||||
'socials.url' => 'https://www.gchange.fr/#/app/page/view/'. $placeId .'/'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/user/profile/_search', $queryParams);
|
|
||||||
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $hit) {
|
|
||||||
|
|
||||||
$user = new GchangeUser($hit);
|
|
||||||
|
|
||||||
$users[] = $user;
|
|
||||||
|
|
||||||
$this->cacheJson($usersCacheDir, $hit->_id . '.json', $user->jsonify());
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($cacheDir, $cacheFile, null);
|
|
||||||
|
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $hit) {
|
|
||||||
|
|
||||||
$user = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$user = null;
|
|
||||||
$user = $this->getUser($hit->_id);
|
|
||||||
$users[] = $user;
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// Utilisateur non trouvé
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw new Exception('Visiteurs trouvés nulle part.');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $users;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRecordsByIssuer ($issuer) {
|
public function getRecordsByIssuer ($issuer) {
|
||||||
|
|
||||||
|
|
||||||
$recordsCacheDir = 'records/user/';
|
$recordsCacheDir = 'records/user/';
|
||||||
$recordsCacheFile = $issuer . '.json';
|
$recordsCacheFile = $issuer . '.json';
|
||||||
|
|
||||||
try {
|
$json = $this->getJsonFromCache($recordsCacheDir, $recordsCacheFile, $this->cacheLongevity['records']);
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($recordsCacheDir, $recordsCacheFile, $this->cacheLongevity['userRecords']);
|
if (empty($json)) {
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$n = 20;
|
$n = 20;
|
||||||
|
|
||||||
|
@ -531,23 +73,9 @@ class Gchange {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
$json = $this->fetchJson('/market/record/_search', $queryParams);
|
$json = $this->dao->fetchJson('/market/record/_search', 'gchange', $queryParams);
|
||||||
|
|
||||||
$this->cacheJson($recordsCacheDir, $recordsCacheFile, $json);
|
$this->cacheJson($recordsCacheDir, $recordsCacheFile, $json);
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$json = $this->getJsonFromCache($recordsCacheDir, $recordsCacheFile, null);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
throw new Exception ("Aucune annonce trouvée pour l'utilisateur " . $issuer);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = json_decode($json);
|
$result = json_decode($json);
|
||||||
|
@ -564,6 +92,206 @@ class Gchange {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getJsonFromCache ($dir, $file, $cacheLongevity) {
|
||||||
|
|
||||||
|
if (!$this->isActivatedCache) {
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = null;
|
||||||
|
$jsonFullPath = $this->cacheDir . $dir . $file;
|
||||||
|
|
||||||
|
if (file_exists($jsonFullPath) and ((time() - filemtime($jsonFullPath)) < $cacheLongevity)) {
|
||||||
|
|
||||||
|
$json = file_get_contents($jsonFullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $json;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cacheJson ($dir, $file, $json) {
|
||||||
|
|
||||||
|
if (!$this->isActivatedCache) {
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jsonCacheDir = $this->cacheDir . $dir;
|
||||||
|
$jsonFullPath = $jsonCacheDir . $file;
|
||||||
|
|
||||||
|
if (!file_exists($jsonCacheDir)) {
|
||||||
|
|
||||||
|
mkdir($jsonCacheDir, 0777, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($jsonFullPath, $json);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser ($pubkey) {
|
||||||
|
|
||||||
|
$usersCacheDir = 'users/';
|
||||||
|
$usersCacheFile = $pubkey . '.json';
|
||||||
|
|
||||||
|
$json = $this->getJsonFromCache($usersCacheDir, $usersCacheFile, $this->cacheLongevity['users']);
|
||||||
|
|
||||||
|
if (empty($json)) {
|
||||||
|
|
||||||
|
$json = $this->dao->fetchJson(('/user/profile/'. $pubkey), 'gchange');
|
||||||
|
|
||||||
|
$this->cacheJson($usersCacheDir, $usersCacheFile, $json);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
return new GchangeUser($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPlacesNearUser ($user, $radius) {
|
||||||
|
|
||||||
|
return $this->getNearbyPlaces($user->getLat(), $user->getLon(), $radius);
|
||||||
|
|
||||||
|
/*
|
||||||
|
$placesCacheDir = 'places-nearby/user/';
|
||||||
|
$placesCacheFile = $user->getUserGchangeId() . '.json';
|
||||||
|
|
||||||
|
$json = $this->getJsonFromCache($placesCacheDir, $placesCacheFile, $this->cacheLongevity['placesNearby']);
|
||||||
|
|
||||||
|
if (empty($json)) {
|
||||||
|
|
||||||
|
$json = $this->getNearbyPlacesJson($user->getLat(), $user->getLon(), $radius);
|
||||||
|
|
||||||
|
$this->cacheJson($placesCacheDir, $placesCacheFile, $json);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
return $result->hits->hits;
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNearbyPlaces ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
||||||
|
|
||||||
|
$placesCacheDir = 'places-nearby/geopoint/';
|
||||||
|
$placesCacheFile = $lat . ',' . $lon . '.json';
|
||||||
|
|
||||||
|
$json = $this->getJsonFromCache($placesCacheDir, $placesCacheFile, $this->cacheLongevity['placesNearby']);
|
||||||
|
|
||||||
|
if (empty($json)) {
|
||||||
|
|
||||||
|
$json = $this->getNearbyPlacesJson($lat, $lon, $maxDistance, $minDistance);
|
||||||
|
|
||||||
|
$this->cacheJson($placesCacheDir, $placesCacheFile, $json);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
return $result->hits->hits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNearbyUsers ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
||||||
|
|
||||||
|
$placesCacheDir = 'users-nearby/geopoint/';
|
||||||
|
$placesCacheFile = $lat . ',' . $lon . '.json';
|
||||||
|
|
||||||
|
$json = $this->getJsonFromCache($placesCacheDir, $placesCacheFile, $this->cacheLongevity['usersNearby']);
|
||||||
|
|
||||||
|
if (empty($json)) {
|
||||||
|
|
||||||
|
$json = $this->getNearbyPlacesJson($lat, $lon, $maxDistance, $minDistance);
|
||||||
|
|
||||||
|
$this->cacheJson($placesCacheDir, $placesCacheFile, $json);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
return $result->hits->hits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImmaterialRecords () {
|
||||||
|
|
||||||
|
$n = 20;
|
||||||
|
|
||||||
|
$queryParams = [
|
||||||
|
'size' => $n,
|
||||||
|
'query' => [
|
||||||
|
'nested' => [
|
||||||
|
'path' => 'category',
|
||||||
|
'query' => [
|
||||||
|
'bool' => [
|
||||||
|
'should' => [
|
||||||
|
[ 'term' => [ 'category.parent' => 'cat31' ] ],
|
||||||
|
[ 'term' => [ 'category.id' => 'cat31' ] ],
|
||||||
|
[ 'term' => [ 'category.parent' => 'cat74' ] ],
|
||||||
|
[ 'term' => [ 'category.id' => 'cat74' ] ]
|
||||||
|
],
|
||||||
|
'must_not' => [
|
||||||
|
[ "term" => ["category.id" => "cat65"] ]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$json = $this->dao->fetchJson('/market/record/_search?pretty', 'gchange', $queryParams);
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
|
||||||
|
$records = [];
|
||||||
|
|
||||||
|
foreach ($result->hits->hits as $hit) {
|
||||||
|
|
||||||
|
$records[] = new GchangeRecord($hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsersInDaPlace ($placeId) {
|
||||||
|
|
||||||
|
$n = 20;
|
||||||
|
|
||||||
|
$queryParams = [
|
||||||
|
'size' => $n,
|
||||||
|
'query' => [
|
||||||
|
'nested' => [
|
||||||
|
'path' => 'socials',
|
||||||
|
'query' => [
|
||||||
|
'bool' => [
|
||||||
|
'filter' => [
|
||||||
|
'term' => [
|
||||||
|
'socials.url' => 'https://www.gchange.fr/#/app/page/view/'. $placeId .'/'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$json = $this->dao->fetchJson('/user/profile/_search', 'gchange', $queryParams);
|
||||||
|
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
|
||||||
|
$users = [];
|
||||||
|
|
||||||
|
foreach ($result->hits->hits as $hit) {
|
||||||
|
|
||||||
|
$users[] = new GchangeUser($hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $users;
|
||||||
|
}
|
||||||
|
|
||||||
public function getRatingsSentBy ($issuer) {
|
public function getRatingsSentBy ($issuer) {
|
||||||
|
|
||||||
$n = 20;
|
$n = 20;
|
||||||
|
@ -582,7 +310,7 @@ class Gchange {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
$json = $this->fetchJson('/like/record/_search', $queryParams);
|
$json = $this->dao->fetchJson('/like/record/_search', 'gchange', $queryParams);
|
||||||
|
|
||||||
$result = json_decode($json);
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
@ -614,7 +342,7 @@ class Gchange {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
$json = $this->fetchJson('/like/record/_search', $queryParams);
|
$json = $this->dao->fetchJson('/like/record/_search', 'gchange', $queryParams);
|
||||||
|
|
||||||
$result = json_decode($json);
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
@ -628,6 +356,79 @@ class Gchange {
|
||||||
return $ratings;
|
return $ratings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNearbyPlacesJson ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
||||||
|
|
||||||
|
$n = 20;
|
||||||
|
|
||||||
|
$queryParams = [
|
||||||
|
'size' => $n,
|
||||||
|
'query' => [
|
||||||
|
'bool' => [
|
||||||
|
'filter' => [
|
||||||
|
[
|
||||||
|
'geo_distance' => [
|
||||||
|
|
||||||
|
"distance" => $maxDistance . 'km',
|
||||||
|
"geoPoint"=> [
|
||||||
|
"lat" => $lat,
|
||||||
|
"lon" => $lon
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$json = $this->dao->fetchJson('/page/record/_search', 'gchange', $queryParams);
|
||||||
|
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNearbyRecords ($lat, $lon, $maxDistance, $minDistance = NULL) {
|
||||||
|
|
||||||
|
$n = 20;
|
||||||
|
|
||||||
|
$queryParams = [
|
||||||
|
'size' => $n,
|
||||||
|
'query' => [
|
||||||
|
'bool' => [
|
||||||
|
'must' => [
|
||||||
|
[
|
||||||
|
'geo_distance' => [
|
||||||
|
|
||||||
|
"distance" => $maxDistance . 'km',
|
||||||
|
"geoPoint"=> [
|
||||||
|
"lat" => $lat,
|
||||||
|
"lon" => $lon
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
'range' => [
|
||||||
|
'stock' => [
|
||||||
|
'gte' => 1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$json = $this->dao->fetchJson('/market/record/_search?pretty', 'gchange', $queryParams);
|
||||||
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
|
||||||
|
$records = [];
|
||||||
|
|
||||||
|
foreach ($result->hits->hits as $hit) {
|
||||||
|
|
||||||
|
$records[] = new GchangeRecord($hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
public function getShippable () {
|
public function getShippable () {
|
||||||
|
|
||||||
$n = 20;
|
$n = 20;
|
||||||
|
@ -641,47 +442,7 @@ class Gchange {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
$json = $this->fetchJson('/market/record/_search?pretty', $queryParams);
|
$json = $this->dao->fetchJson('/market/record/_search?pretty', 'gchange', $queryParams);
|
||||||
$result = json_decode($json);
|
|
||||||
|
|
||||||
|
|
||||||
$records = [];
|
|
||||||
|
|
||||||
foreach ($result->hits->hits as $hit) {
|
|
||||||
|
|
||||||
$records[] = new GchangeRecord($hit);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $records;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getImmaterialRecords () {
|
|
||||||
|
|
||||||
$n = 20;
|
|
||||||
|
|
||||||
$queryParams = [
|
|
||||||
'size' => $n,
|
|
||||||
'query' => [
|
|
||||||
'nested' => [
|
|
||||||
'path' => 'category',
|
|
||||||
'query' => [
|
|
||||||
'bool' => [
|
|
||||||
'should' => [
|
|
||||||
[ 'term' => [ 'category.parent' => 'cat31' ] ],
|
|
||||||
[ 'term' => [ 'category.id' => 'cat31' ] ],
|
|
||||||
[ 'term' => [ 'category.parent' => 'cat74' ] ],
|
|
||||||
[ 'term' => [ 'category.id' => 'cat74' ] ]
|
|
||||||
],
|
|
||||||
'must_not' => [
|
|
||||||
[ "term" => ["category.id" => "cat65"] ]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$json = $this->fetchJson('/market/record/_search?pretty', $queryParams);
|
|
||||||
$result = json_decode($json);
|
$result = json_decode($json);
|
||||||
|
|
||||||
|
|
||||||
|
@ -698,5 +459,10 @@ class Gchange {
|
||||||
public function getHousingOffers () {
|
public function getHousingOffers () {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShippableOffers () {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
class GchangeUser {
|
class GchangeUser {
|
||||||
|
|
||||||
public $userGchangeId;
|
private $userGchangeId;
|
||||||
|
|
||||||
public $userName;
|
private $userName;
|
||||||
|
|
||||||
private $lat = null;
|
private $lat = null;
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ class GchangeUser {
|
||||||
|
|
||||||
public function __construct ($gchangeObject) {
|
public function __construct ($gchangeObject) {
|
||||||
|
|
||||||
$this->gchangeObject = $gchangeObject;
|
|
||||||
|
|
||||||
$this->userGchangeId = $gchangeObject->_id;
|
$this->userGchangeId = $gchangeObject->_id;
|
||||||
|
|
||||||
if (isset($gchangeObject->found) and $gchangeObject->found == false) {
|
if (isset($gchangeObject->found) and $gchangeObject->found == false) {
|
||||||
|
@ -70,9 +68,4 @@ class GchangeUser {
|
||||||
|
|
||||||
return $this->avatarImgSrc;
|
return $this->avatarImgSrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonify () {
|
|
||||||
|
|
||||||
return $this->gchangeObject;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -166,12 +166,7 @@ function storeAtFreds (json) {
|
||||||
var fetchOpts = {
|
var fetchOpts = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'text/html'
|
// 'Accept': 'txt/html'
|
||||||
// ,'Content-Type': 'text/html'
|
|
||||||
// // ,'Access-Control-Allow-Origin': '*',
|
|
||||||
// ,'Origin': 'la-bureautique'
|
|
||||||
// ,'Referrer-Policy': 'unsafe-url'
|
|
||||||
// ,'Redirect': 'manual'
|
|
||||||
},
|
},
|
||||||
signal: controller.signal
|
signal: controller.signal
|
||||||
}
|
}
|
||||||
|
@ -197,18 +192,15 @@ function storeAtFreds (json) {
|
||||||
}, 15000)
|
}, 15000)
|
||||||
var fetchOpts2 = {
|
var fetchOpts2 = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'text/html'
|
'Accept': 'text/html',
|
||||||
,'Content-Type': 'text/html'
|
'Content-Type': 'text/html',
|
||||||
// ,'Access-Control-Allow-Origin': '*',
|
// 'Access-Control-Allow-Origin': '*',
|
||||||
,'Origin': 'la-bureautique'
|
'Origin': 'la-bureautique',
|
||||||
,'Referrer-Policy': 'unsafe-url'
|
'Referrer-Policy': 'unsafe-url'
|
||||||
,'Redirect': 'manual'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
redirect: 'manual',
|
redirect: 'follow',
|
||||||
signal: controller2.signal
|
signal: controller2.signal
|
||||||
}
|
}
|
||||||
fetch(url, fetchOpts2)
|
fetch(url, fetchOpts2)
|
||||||
|
@ -247,7 +239,7 @@ function displayImmaterial (records) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchImmaterial(30)
|
fetchImmaterial(5)
|
||||||
.then(records => {
|
.then(records => {
|
||||||
|
|
||||||
displayImmaterial(records.hits.hits)
|
displayImmaterial(records.hits.hits)
|
||||||
|
@ -259,7 +251,7 @@ fetchImmaterial(30)
|
||||||
console.error(error)
|
console.error(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
fetchShippable(30)
|
fetchShippable(5)
|
||||||
.then(records => {
|
.then(records => {
|
||||||
|
|
||||||
displayShippable(records.hits.hits)
|
displayShippable(records.hits.hits)
|
||||||
|
|
|
@ -9,11 +9,7 @@ if (isset($_POST['salt'], $_POST['pepper'])) {
|
||||||
|
|
||||||
$fred = new Fred();
|
$fred = new Fred();
|
||||||
$keygen = new Keygen();
|
$keygen = new Keygen();
|
||||||
// $playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
|
$playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
|
||||||
|
|
||||||
$toto = 'QP1VkfaFUMdHZmHgPMi7q5wJJHaQhZcEqs5A86NigKr';
|
|
||||||
$boris = '25zB1gSC7Qhwnx463cuDLDCKLRVieLAgFiPbYq6jVHG9';
|
|
||||||
// $playerG1Id = $toto;
|
|
||||||
|
|
||||||
$_SESSION['player_pubkey'] = $playerG1Id;
|
$_SESSION['player_pubkey'] = $playerG1Id;
|
||||||
|
|
||||||
|
|
37
map.php
37
map.php
|
@ -3,7 +3,6 @@
|
||||||
require_once('config.php');
|
require_once('config.php');
|
||||||
require_once('lib/Gchange.class.php');
|
require_once('lib/Gchange.class.php');
|
||||||
require_once('lib/Location.class.php');
|
require_once('lib/Location.class.php');
|
||||||
require_once('lib/ErrorsHandler.class.php');
|
|
||||||
|
|
||||||
if (!isset($_SESSION['player_pubkey'])) {
|
if (!isset($_SESSION['player_pubkey'])) {
|
||||||
|
|
||||||
|
@ -214,25 +213,8 @@ if (isset($selectedPlace)) {
|
||||||
|
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$records_visitors = [];
|
|
||||||
$records_placeCreator = [];
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$records_placeCreator = $gchange->getRecordsByIssuer($place->_source->issuer);
|
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// Pas d'annonce pour le créateur du lieu
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
$visitors = $gchange->getUsersInDaPlace($place->_id);
|
$visitors = $gchange->getUsersInDaPlace($place->_id);
|
||||||
|
$records_visitors = [];
|
||||||
|
|
||||||
if (!empty($visitors)) {
|
if (!empty($visitors)) {
|
||||||
|
|
||||||
|
@ -243,10 +225,7 @@ if (isset($selectedPlace)) {
|
||||||
|
|
||||||
foreach ($visitors as $visitor) {
|
foreach ($visitors as $visitor) {
|
||||||
|
|
||||||
try {
|
$records_visitors = array_merge($records_visitors, $gchange->getRecordsByIssuer($visitor->getUserGchangeId()));
|
||||||
|
|
||||||
$records_visitor = $gchange->getRecordsByIssuer($visitor->getUserGchangeId());
|
|
||||||
$records_visitors = array_merge($records_visitors, $records_visitor);
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<li class="visitor">';
|
<li class="visitor">';
|
||||||
|
@ -261,26 +240,16 @@ if (isset($selectedPlace)) {
|
||||||
width="64"
|
width="64"
|
||||||
height="64" />
|
height="64" />
|
||||||
</li>';
|
</li>';
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// Pas d'annonce pour cet utilisateur
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
</ul>';
|
</ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $errorMsgs) {
|
|
||||||
|
|
||||||
// Visiteurs trouvés nulle part
|
$records_placeCreator = $gchange->getRecordsByIssuer($place->_source->issuer);
|
||||||
}
|
|
||||||
|
|
||||||
$records = array_merge($records_placeCreator, $records_visitors);
|
$records = array_merge($records_placeCreator, $records_visitors);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$offers = [];
|
$offers = [];
|
||||||
$needs = [];
|
$needs = [];
|
||||||
$crowdfundings = [];
|
$crowdfundings = [];
|
||||||
|
|
|
@ -123,6 +123,38 @@ main {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#place-details ul.visitors {
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#place-details ul.visitors li {
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#place-details .visitors {
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#place-details .visitors .visitor {
|
||||||
|
|
||||||
|
margin-right: 1rem;
|
||||||
|
flex-basis: 64px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#place-details .visitors .visitor img {
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
#place-details {
|
#place-details {
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -130,7 +162,6 @@ main {
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 33vw;
|
width: 33vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow-y: auto;
|
|
||||||
|
|
||||||
padding: 0rem;
|
padding: 0rem;
|
||||||
|
|
||||||
|
@ -167,38 +198,6 @@ main {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#place-details ul.visitors {
|
|
||||||
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#place-details ul.visitors li {
|
|
||||||
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#place-details .visitors {
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#place-details .visitors .visitor {
|
|
||||||
|
|
||||||
margin-right: 1rem;
|
|
||||||
flex-basis: 64px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#place-details .visitors .visitor img {
|
|
||||||
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue