Beispiel #1
0
     } elseif (empty($difficulty) === false) {
         $reply->data = Trail::getTrailByTrailDifficulty($pdo, $difficulty)->toArray();
     } elseif (empty($distance) === false) {
         $reply->data = Trail::getTrailByTrailDistance($pdo, $distance)->toArray();
     } elseif (empty($name) === false) {
         $reply->data = Trail::getTrailByTrailName($pdo, $name)->toArray();
     } elseif (empty($submission) === false) {
         $reply->data = Trail::getTrailByTrailSubmissionType($pdo, $submission)->toArray();
     } elseif (empty($terrain) === false) {
         $reply->data = Trail::getTrailByTrailTerrain($pdo, $terrain)->toArray();
     } elseif (empty($traffic) === false) {
         $reply->data = Trail::getTrailByTrailTraffic($pdo, $traffic)->toArray();
     } elseif (empty($use) === false) {
         $reply->data = Trail::getTrailByTrailUse($pdo, $use)->toArray();
         //} elseif (empty($uuid) === false) {
         $reply->data = Trail::getTrailByTrailUuid($pdo, $uuid);
     } else {
         $reply->data = Trail::getAllTrails($pdo)->toArray();
     }
 }
 //verify user and verify object is not empty
 // if the session belongs to an active user allow post
 if (empty($_SESSION["user"]) === false && $_SESSION["user"]->getUserAccountType() !== "X") {
     if ($method === "PUT" || $method === "POST") {
         //verify the XSRF cookie is correct
         verifyXsrf();
         $requestContent = file_get_contents("php://input");
         $requestObject = json_decode($requestContent);
         //make sure all fields are present, in order to prevent database issues
         if (empty($requestObject->userId) === true) {
             throw new InvalidArgumentException("user id cannot be empty");