Ejemplo n.º 1
0
 /**
  * @method POST
  */
 function post()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         parse_str($this->request->data, $request);
         // parse request
         $pageTypeId = $request['pageTypeId'];
         $pageType = PageType::GetByPageTypeId($pageTypeId);
         $site = Site::GetBySiteId($pageType['SiteId']);
         // remove page type and pages from DB
         PageType::Remove($pageType['PageTypeId'], $token->SiteId);
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }