src/Controller/HomeController.php line 28
<?phpnamespace App\Controller;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\Mailer\MailerInterface;use Symfony\Component\Mime\Email;use Symfony\Component\Mailer\Exception\TransportExceptionInterface;use Symfony\Component\Form\Extension\Core\Type\TextType;use Symfony\Component\Form\Extension\Core\Type\TextareaType;use App\Entity\Shipment;use App\Entity\Blog;use App\Repository\ShipmentRepository;use App\Repository\BlogRepository;use App\Repository\ImageGalleryRepository;use App\Repository\TrackingUpdateRepository;use App\Repository\SettingsInfoRepository;use App\Service\CookieService;class HomeController extends AbstractController{/*** @Route("/", name="home")*/public function index(): Response{return $this->render('home/index.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/about", name="home_about")*/public function about(): Response{return $this->render('home/about.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/mission-vision", name="home_mission")*/public function mission(): Response{return $this->render('home/mission.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/team", name="home_team")*/public function team(): Response{return $this->render('home/team.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/mdmessage", name="home_mdmessage")*/public function mdmessage(): Response{return $this->render('home/mdmessage.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/guideline", name="home_guideline")*/public function guideline(): Response{return $this->render('home/guideline.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/terms", name="home_terms")*/public function terms(): Response{return $this->render('home/terms.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/all-services", name="home_allservices")*/public function allservices(): Response{return $this->render('home/allservices.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/customs-clearing", name="home_customsclearing")*/public function customsclering(): Response{return $this->render('home/customsclering.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/air-freight", name="home_airfreight")*/public function airfreight(): Response{return $this->render('home/airfreight.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/ocean-freight", name="home_oceanfreight")*/public function oceanfreight(): Response{return $this->render('home/oceanfreight.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/worldwide-express", name="home_express")*/public function express(): Response{return $this->render('home/express.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/hand-carry", name="home_hand_carry")*/public function handCarry(): Response{return $this->render('home/hand_carry.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/saexpress", name="home_saexpress")*/public function saexpress(): Response{return $this->render('home/saexpress.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/sunnyint", name="home_sunnyint")*/public function sunnyint(): Response{return $this->render('home/sunnyint.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/eccf", name="home_eccf")*/public function eccf(): Response{return $this->render('home/eccf.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/volumetric-weight", name="home_volumetricweight")*/public function volumetricweight(): Response{return $this->render('home/volumetricweight.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/contact", name="home_contact")*/public function contact(Request $request, MailerInterface $mailer): Response{$confactform = $this->createFormBuilder(null)->add('fullName', TextType::class, ['attr' => ['placeholder' => 'Full Name*',],'label' => false,])->add('email', TextType::class, ['attr' => ['placeholder' => 'Email*',],'label' => false,])->add('contactno', TextType::class, ['attr' => [ 'placeholder' => 'Phone*',],'label' => false,])->add('subject', TextType::class, ['attr' => ['placeholder' => 'Subject*',],'label' => false,])->add('message', TextareaType::class, ['attr' => ['cols' => '85', 'rows' => '3','placeholder' => 'Message*',],'label' => false,])->getForm();$confactform->handleRequest($request);if ($confactform->isSubmitted() && $confactform->isValid()) {$fullName = $confactform->get('fullName')->getData();$email = $confactform->get('email')->getData();$contactno = $confactform->get('contactno')->getData();$subject = $confactform->get('subject')->getData();$message = $confactform->get('message')->getData();// $strPosition = strpos(strtolower($subject), "sexy");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($subject), "sex");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($subject), "porn");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($subject), "xxx");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($message), "sexy");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($message), "sex");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($message), "porn");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $strPosition = strpos(strtolower($message), "xxx");// if($strPosition > -1)// return $this->redirectToRoute('home_contact');// $email = (new Email())// ->from('contact@ewexltd.com')// ->to('afexsazib@gmail.com')// ->addTo('sunny.int96@gmail.com')// ->cc('ewexltdbd@gmail.com')// ->addCc('ewexltd@gmail.com')// ->bcc('malayaroy99@gmail.com')// //->replyTo('fabien@example.com')// //->priority(Email::PRIORITY_HIGH)// ->subject('Email from Contact of ewexltd.com Website')// ->text('Sending emails is fun again!')// ->html('<p> Sender Details Information: </p> <p> Full Name: '.$fullName.'<br> Email: '.$email.' <br> Contact No: '.$contactno.'<br> Subject : '.$subject .'<br> Message: '.$message.'</p><p>**The Email is a system-generated email.</p>');// try {// $mailer->send($email);// $this->addFlash('notice', 'Email has been sent successfully!');// return $this->redirectToRoute('home_contact');// } catch (TransportExceptionInterface $e) {// $this->addFlash('notice', 'Email not sent, Please try again.');// return $this->redirectToRoute('home_contact');// }return $this->redirectToRoute('home_contact');}return $this->render('home/contact.html.twig', ['controller_name' => 'HomeController','confactform' => $confactform->createView(),]);}/*** @Route("/progress", name="home_progress")*/public function progress(): Response{return $this->render('home/progress.html.twig', ['controller_name' => 'HomeController',]);}/*** @Route("/gallery", name="home_gallery")*/public function gallery(): Response{return $this->render('home/gallery.html.twig', ['controller_name' => 'HomeController',]);}#[Route('/tracking', name: 'home_tracking')]public function tracking(CookieService $cookieService): Response{$beforeAwbno = $cookieService->getLastTrackingId();return $this->render('home/tracking.html.twig', ['controller_name' => 'HomeController','beforeAwbno' => $beforeAwbno,]);}#[Route('/track', name: 'home_track')]public function trackResult(Request $request, ShipmentRepository $shipmentRepository, TrackingUpdateRepository $trackingUpdateRepository, CookieService $cookieService): Response{$data = $request->request->get('awbNo');$shipment = $shipmentRepository->findOneBy(['hawbNo' => $data, 'trackingStatus' => 1 ]);if($shipment !== null){$response = $cookieService->setLastTrackingId($shipment->getHawbNo());}else{$response = null;}$trackingGroupBy = $trackingUpdateRepository->findGroupByTrackingUpdate($data);$beforeAwbno = $cookieService->getLastTrackingId();return $this->render('home/trackResult.html.twig', ['shipments' => $shipment,'trackingGroupBy' => $trackingGroupBy,'beforeAwbno' => $beforeAwbno,],$response );}#[Route('/{hawbNo}/tracklink', name: 'home_tracking_link')]public function trackingResultLink(Shipment $shipment, TrackingUpdateRepository $trackingUpdateRepository, CookieService $cookieService){$beforeAwbno = $cookieService->getLastTrackingId();$trackingGroupBy = $trackingUpdateRepository->findGroupByTrackingUpdate($shipment->getHawbNo());return $this->render('home/trackResult.html.twig', ['shipments' => $shipment,'trackingGroupBy' => $trackingGroupBy,'beforeAwbno' => $beforeAwbno,]);}}