This commit is contained in:
afornerot 2024-11-02 20:16:52 +01:00
parent 51a9b9dfd6
commit 571efe1ad9
5 changed files with 45 additions and 10 deletions

6
.env
View File

@ -20,9 +20,9 @@ APP_CRON=1
# NINEGATE
NINEGATE_ACTIVATE=0
NINEGATE_URL=
NINEGATE_SECRET=
NINEGATE_MASTERIDENTITY=
NINEGATE_URL=http://192.168.0.22
NINEGATE_SECRET=changeme
NINEGATE_MASTERIDENTITY=SQL
# CAS
CAS_HOST=

View File

@ -11,8 +11,27 @@ class HomeController extends AbstractController
{
public function home()
{
$em = $this->getDoctrine()->getManager();
$items=null;
if($this->getParameter("appNinegateactivate")) {
// Entete
$headers = ['Accept' => 'application/json', 'key' => $this->getParameter("appNinegatesecret"), 'only'=>'items'];
$query = [];
$url=$this->getParameter("appNinegateurl");
// Paramétrage unirest
\Unirest\Request::verifyPeer(false);
\Unirest\Request::verifyHost(false);
\Unirest\Request::timeout(5);
try {
$response = \Unirest\Request::get($url.'/rest/user/'.($this->getUser()?$this->getUser()->getUsername():"nononononouser"),$headers);
$items=$response->body->items;
}
catch (\Exception $e) {
}
}
dump($items);
$em = $this->getDoctrine()->getManager();
$users = $em->getRepository("App:User")->findBy([],["pseudo"=>"ASC"]);
$illustrations = $em->getRepository("App:Illustration")->findBy([],["submittime"=>"DESC"]);
$links = $em->getRepository("App:Link")->findBy(["user"=>null]);
@ -25,7 +44,8 @@ class HomeController extends AbstractController
"users" => $users,
"illustrations" => $illustrations,
"links" => $links,
"webzines" => $webzines
"webzines" => $webzines,
"items" => $items,
]);
}

View File

@ -168,7 +168,7 @@ class SecurityController extends AbstractController
private function updateNinegate($user) {
if($this->getParameter("appNinegateactivate") && $this->getParameter("appNinegatemasteridentity")=="SQL") {
// Entete
$headers = ['Accept' => 'application/json', 'key' => $this->getParameter("appNinegatesecret")];
$headers = ['Accept' => 'application/json', 'key' => $this->getParameter("appNinegatesecret"), 'only' => 'user'];
$query = [];
$url=$this->getParameter("appNinegateurl");
// Paramétrage unirest
@ -177,7 +177,7 @@ class SecurityController extends AbstractController
\Unirest\Request::verifyHost(false);
\Unirest\Request::timeout(5);
try {
$response = \Unirest\Request::get($url.'/rest/user/'.$user->getUsername(),$headers,["only"=>"user"]);
$response = \Unirest\Request::get($url.'/rest/user/'.$user->getUsername(),$headers);
$em = $this->getDoctrine()->getManager();

View File

@ -259,14 +259,14 @@ class UserController extends AbstractController
private function updateNinegate($user) {
if($this->getParameter("appNinegateactivate") && $this->getParameter("appNinegatemasteridentity")=="SQL") {
// Entete
$headers = ['Accept' => 'application/json', 'key' => $this->getParameter("appNinegatesecret")];
$headers = ['Accept' => 'application/json', 'key' => $this->getParameter("appNinegatesecret"), 'only' => 'user'];
$query = [];
$url=$this->getParameter("appNinegateurl");
\Unirest\Request::verifyPeer(false);
\Unirest\Request::verifyHost(false);
\Unirest\Request::timeout(5);
try {
$response = \Unirest\Request::get($url.'/rest/user/'.$user->getUsername(),$headers,["only"=>"user"]);
$response = \Unirest\Request::get($url.'/rest/user/'.$user->getUsername(),$headers);
$em = $this->getDoctrine()->getManager();
if(property_exists($response->body->user,'lastname')) $user->setLastname($response->body->user->lastname);

View File

@ -180,6 +180,21 @@
<a href="#link"><i class="fa fa-arrow-circle-right fa-fw facatmenu"></i> Liens</a><br>
{% endif %}
</div>
{% if not items is empty %}
<div class="itemmenu" style="width:270px; display:flex; margin:20px auto 0px auto; flex-wrap: wrap;">
{% for item in items %}
{% if item.title|lower != "ninefolio" %}
<a href="{{ item.url }}" target="_blank">
<div class="item" style="display:flex; flex-direction: column; align-items: center; font-size:10px; padding:5px; width:90px;">
<img src="{{ item.icon }}" style="width:50px;height:50px">
<span style="margin-top:10px">{{ item.title }}</span>
</div>
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
</div>
@ -312,7 +327,7 @@
{% endif %}
{% set source=source~"?"~illustration.updatetime|date('ymdHis') %}
<a href="{{ path("app_illustration_view",{"by":"home","idcat":illustration.category.id,"id":illustration.id}) }}">
<div id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} {{classmini}} cssfilter" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");">
<div data-loop="{{loop.index}}" id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} {{classmini}} cssfilter" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");">
</div>
</a>
{% endfor %}