src/Controller/HomeController.php line 27
<?phpnamespace App\Controller;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Doctrine\Persistence\ManagerRegistry as PersistenceManagerRegistry;use App\Entity\Settings;use App\Entity\User;use App\Form\UserAgreementType;use Symfony\Component\HttpFoundation\RequestStack;use App\Service\LicenseService;use App\Service\SessionControlService;class HomeController extends AbstractController {public function __construct(private RequestStack $requestStack,private SessionControlService $sessionControlService,private LicenseService $licenseService,) {}#[Route(path: '/', name: 'home')]public function index(PersistenceManagerRegistry $doctrine): Response {$user = $this->getUser();if ($user) {if ($user->getPolicyAgreed() == 0) {$form = $this->createForm(UserAgreementType::class, ['userid' => $user->getId()]);return $this->render('panel/policyagreed.html.twig',['form' => $form]);}if ($this->sessionControlService->checkActiveSessions($user->getEmail()) || $user->isAdmin()) {$this->licenseService->contentsWithLicensesOrGifts($user);}if ($this->sessionControlService->checkTimedoutSessions($user->getEmail())) {return $this->render('panel/timedout.html.twig',[]);}if ($user->getStatus() == User::STATUS_SUSPENDED) {return $this->render('panel/disabled.html.twig',[]);}}$em = $doctrine->getManager();$settingsRepository = $em->getRepository(Settings::class);$allowregister = $settingsRepository->findOneByName('allowregister');$sessionid = 0;$request = $this->requestStack->getCurrentRequest();if ($request && $request->hasSession()) {$session = $request->getSession();$sessionid = $session->getId();}return $this->render('home/index.html.twig', ['allowregister' => (!is_null($allowregister) && $allowregister->getValue() == 1),'sessionid' => $sessionid]);}}