<?php include_once dirname(__FILE__) . "/../common/common.php"; include_once dirname(__FILE__) . '/../business/AuthB.php'; include_once dirname(__FILE__) . '/../database/Journal.php'; $auth = new AuthB(); if (!$auth->canSynchJournal()) { $response = errorResponse(RESPONSE_UNAUTHORIZED); } else { if (isGetMethod()) { if (isset($_GET['hash'])) { $hash = $_GET['hash']; if ($hash === '') { $response = errorResponse(RESPONSE_BAD_REQUEST, 'hash is blank'); } else { $object = Journal::findByHash($hash); if ($object === null) { $response = errorResponse(RESPONSE_NOT_FOUND); } else { $response = successResponse(); $response['tripId'] = $object->getTripId(); $response['journalId'] = $object->getJournalId(); $response['created'] = $object->getCreated(); $response['updated'] = $object->getUpdated(); $response['userId'] = $object->getUserId(); $response['journalDate'] = $object->getJournalDate(); $response['journalTitle'] = $object->getJournalTitle(); $response['journalText'] = $object->getJournalText(); $response['deleted'] = $object->getDeleted(); $response['hash'] = $object->getHash(); }