44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?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("appName");
|
|
$urlsonde = $url."?appli=$app&profil=$profilsonde&login=$loginsonde&provenance=$provenancesonde&fgdebug=$fgdebug";
|
|
|
|
return $this->render('Sonde/sonde.html.twig',['urlsonde' => $urlsonde]);
|
|
}
|
|
|
|
|
|
}
|