function HTTP_GET()
 {
     $json = new paloSantoJSON();
     $pCore_calendar = new core_Calendar();
     $fields = isset($_GET["fields"]) ? $_GET["fields"] : NULL;
     if (is_null($fields)) {
         header("HTTP/1.1 400 Bad Request");
         $error = "You need to specify by GET the parameter \"fields\"";
         $json->set_status("ERROR");
         $json->set_error($error);
         return $json->createJSON();
     }
     $result = $pCore_calendar->getHash($fields);
     if ($result === FALSE) {
         $error = $pCore_calendar->getError();
         if ($error["fc"] == "DBERROR") {
             header("HTTP/1.1 500 Internal Server Error");
         } else {
             header("HTTP/1.1 400 Bad Request");
         }
         $json->set_status("ERROR");
         $json->set_error($error);
         return $json->createJSON();
     } else {
         $json = new Services_JSON();
         return $json->encode($result);
     }
 }
 function HTTP_GET()
 {
     $json = new paloSantoJSON();
     $pCore_calendar = new core_Calendar();
     $result = $pCore_calendar->getFullSync();
     if ($result === FALSE) {
         $error = $pCore_calendar->getError();
         if ($error["fc"] == "DBERROR") {
             header("HTTP/1.1 500 Internal Server Error");
         } else {
             header("HTTP/1.1 400 Bad Request");
         }
         $json->set_status("ERROR");
         $json->set_error($error);
         return $json->createJSON();
     } else {
         $json = new Services_JSON();
         return $json->encode($result);
     }
 }
 function HTTP_DELETE()
 {
     $pCore_Calendar = new core_Calendar();
     $json = new paloSantoJSON();
     $result = $pCore_Calendar->delCalendarEvent($this->_idNumero);
     if ($result === FALSE) {
         $error = $pCore_Calendar->getError();
         if ($error["fc"] == "DBERROR") {
             header("HTTP/1.1 500 Internal Server Error");
         } elseif ($error['fc'] == 'ADDRESSBOOK') {
             header("HTTP/1.1 404 Not Found");
         } else {
             header("HTTP/1.1 400 Bad Request");
         }
         $json->set_status("ERROR");
         $json->set_error($error);
         return $json->createJSON();
     } else {
         $json = new Services_JSON();
         $response["message"] = "The event was successfully deleted";
         return $json->encode($response);
     }
 }
Ejemplo n.º 4
0
 /**
  * Procedure that implements the SOAP call to remove an existing event calendar of the registered user. If an
  * error exists a SOAP fault is thrown
  * 
  * @param   mixed   $request:
  *                      id: ID of the event to remove
  * @return  mixed   Array with boolean data, true if was successful or false if an error exists
  */
 public function delCalendarEvent($request)
 {
     $return = parent::delCalendarEvent($request->id);
     if (!$return) {
         $eMSG = parent::getError();
         $this->objSOAPServer->fault($eMSG['fc'], $eMSG['fm'], $eMSG['cn'], $eMSG['fd'], 'fault');
     }
     return array("return" => $return);
 }