refonte sonde

This commit is contained in:
afornerot 2020-10-23 15:21:10 +02:00
parent d4bc3dadd4
commit 54d2049f06
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class SondeController extends AbstractController
{
public function sonde()
{
// Debug sonde
$fgdebug = ($this->getParameter("appEnv")!="PROD");
// Calcul du login
$user=$this->getUser();
if($user) $loginsonde=crypt($user->getUsername(),"dkywqZPYNHtWDnSxACjXVcIsFuaiQT");
else $loginsonde="";
// Calcul du profil
$profilsonde="visiteur";
if($user) {
$profilsonde="utilisateur";
$attributes=$this->get('session')->get('attributes');
if(isset($attributes["ENTPersonProfils"])) $profilsonde=$attributes["ENTPersonProfils"];
}
// Calcul de la provenance
$e = explode('.', $_SERVER["REMOTE_ADDR"]);
$s = sizeof($e);
if(($e[0]=="172"&&$e[1]=="30")||($e[0]=="172"&&$e[1]=="16")||($e[0]=="10"&&($e[1]=="77"||$e[1]=="93"||$e[1]=="94")))
$provenancesonde='interne';
else
$provenancesonde='externe';
$url=$this->getParameter("sondeUrl");
$app=$this->getParameter("appAlias");
$urlsonde = $url."?appli=$app&profil=$profilsonde&login=$loginsonde&provenance=$provenancesonde&fgdebug=$fgdebug";
return $this->render('Sonde/sonde.html.twig',['urlsonde' => $urlsonde]);
}
}

View File

@ -0,0 +1,3 @@
{% if not urlsonde is empty %}
<script src='{{ urlsonde }}'></script>
{% endif %}