示例#1
0
 function err400($errCode = null, $errDescription = null)
 {
     header("HTTP/1.0 400 Bad Request");
     if (isset($errCode) || isset($errDescription)) {
         return FRHTTPError::errorResponse($errCode, $errDescription);
     }
 }
示例#2
0
 function DELETE()
 {
     //Check if the array key exists
     if (!array_key_exists('id', $_GET)) {
         return FRHTTPError::err400(null, 'No ID supplied');
     }
     //Delete the record
     // TODO Add Error checking
     $this->models['User']->del($_GET['id']);
     $xml = new XMLAuthor();
     $xml->push('Status');
     $xml->element('description', 'Record Removed');
     $xml->pop();
 }
示例#3
0
 function POST()
 {
     /*
     		$requiredAttributes = array(
     			'id'
     			);
     */
     if (array_key_exists('id', $_POST)) {
         //Set the id to make the model update rather than insert
         $this->models['Location']->ID = $_POST['id'];
         $this->models['Location']->save($_POST);
         $xml = new XMLAuthor();
         $xml->push('location');
         foreach ($_POST as $k => $v) {
             $xml->element($k, $v);
         }
         $xml->pop();
         return $xml->getXML();
     } else {
         return FRHTTPError::err400(null, 'Invalid Arguments');
     }
 }