PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
beacons.sandbox.dos-group.com
/
app
/
modules
/
api_v1
/
controllers
<?php /** * @Author Mariano.Pirelli * @Copyright (c) 2015 DOS Group. All rights reserved */ namespace App\Api_V1\Controllers; use Dos\Api\Response\JsonResponse; use Dos\Exception\InvalidArgumentException; use Dos\Exception\MethodNotAllowedException; use Dos\Notification\NotificationServiceException; use Dos\Notification\NotificationRegistrationInfo; use Dos\Notification\NotificationService; use Dos\Phalcon\Api\Controller\ControllerApi; class RegistrationController extends ControllerApi { /** * @throws InvalidArgumentException * @throws MethodNotAllowedException * @throws NotificationServiceException */ public function indexAction() { if ($this->request->isPut()) { $rawBodyArray = $this->request->getJsonRawBody(TRUE); if ($rawBodyArray && isset($rawBodyArray['registration'])) { $registrationData = $rawBodyArray['registration']; $updateTags = $this->request->get('updateTags', 'string'); $appIdentifier = $this->filter->sanitize($registrationData['appId'], 'string'); $platformCode = $this->filter->sanitize($registrationData['osName'], 'string'); $currentToken = $this->filter->sanitize($registrationData['currentToken'], 'string'); $previousToken = NULL; if (isset($registrationData['previousToken'])) $previousToken = $this->filter->sanitize($registrationData['previousToken'], 'string'); $tagsArray = $registrationData['tags']; //Registration Data $registrationInfo = new NotificationRegistrationInfo(); $registrationInfo->setUpdateTags($updateTags); $registrationInfo->setAppIdentifier($appIdentifier); $registrationInfo->setPlatformCode($platformCode); $registrationInfo->setCurrentPnsIdentifier($currentToken); $registrationInfo->setPreviousPnsIdentifier($previousToken); $registrationInfo->setTags($tagsArray); //Register to Azure $notificationService = new NotificationService(); $azureRegistration = $notificationService->createOrUpdateAzureRegistration($registrationInfo); //Response $jsonResponse = new JsonResponse(); $jsonResponse->setDataForKey('registration', $azureRegistration->toArray()); $this->response->setContent($jsonResponse->getContent())->send(); } else { throw new InvalidArgumentException('Missing or invalid data body format'); } } else { throw new MethodNotAllowedException(); } } }
[-] AbstractControllerApi.php
[open]
[+]
..
[-] IndexController.php
[open]
[-] ErrorController.php
[open]
[-] RegistrationController.php
[open]