<?php include_once dirname(__FILE__) . "/../common/common.php"; include_once dirname(__FILE__) . '/../business/AuthB.php'; include_once dirname(__FILE__) . '/../database/Comment.php'; $auth = new AuthB(); if (!$auth->canSynchComment()) { $response = errorResponse(RESPONSE_UNAUTHORIZED); } else { if (isGetMethod()) { if (isset($_GET['hash'])) { $hash = $_GET['hash']; if ($hash === '') { $response = errorResponse(RESPONSE_BAD_REQUEST, 'need hash'); } else { $object = Comment::findByHash($hash); if ($object === null) { $response = errorResponse(RESPONSE_NOT_FOUND); } else { $response = successResponse(); $response['tripId'] = $object->getTripId(); $response['commentId'] = $object->getCommentId(); $response['created'] = $object->getCreated(); $response['updated'] = $object->getUpdated(); $response['userId'] = $object->getUserId(); $response['referenceId'] = $object->getReferenceId(); $response['commentText'] = $object->getCommentText(); $response['deleted'] = $object->getDeleted(); $response['hash'] = $object->getHash(); } }