refonte sonde
This commit is contained in:
parent
d4bc3dadd4
commit
54d2049f06
43
src/nineskeletor-1.0/src/Controller/SondeController.php
Normal file
43
src/nineskeletor-1.0/src/Controller/SondeController.php
Normal 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]);
|
||||
}
|
||||
|
||||
|
||||
}
|
3
src/nineskeletor-1.0/templates/Sonde/sonde.html.twig
Normal file
3
src/nineskeletor-1.0/templates/Sonde/sonde.html.twig
Normal file
@ -0,0 +1,3 @@
|
||||
{% if not urlsonde is empty %}
|
||||
<script src='{{ urlsonde }}'></script>
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user