<?php include_once dirname(__FILE__) . "/../common/common.php"; include_once dirname(__FILE__) . '/../business/AuthB.php'; include_once dirname(__FILE__) . '/../database/Media.php'; $auth = new AuthB(); if (!$auth->canSynchMedia()) { $response = errorResponse(RESPONSE_UNAUTHORIZED); } else { if (isGetMethod()) { if (isset($_GET['hash'])) { $hash = $_GET['hash']; if ($hash === '') { $response = errorResponse(RESPONSE_BAD_REQUEST); } else { $object = Media::findByHash($hash); if ($object === null) { $response = errorResponse(RESPONSE_NOT_FOUND); } else { $response = successResponse(); $response['tripId'] = $object->getTripId(); $response['mediaId'] = $object->getMediaId(); $response['created'] = $object->getCreated(); $response['updated'] = $object->getUpdated(); $response['type'] = $object->getType(); $response['caption'] = $object->getCaption(); $response['timestamp'] = $object->getTimestamp(); $response['location'] = $object->getLocation(); $response['width'] = $object->getWidth(); $response['height'] = $object->getHeight(); $response['deleted'] = $object->getDeleted();