예제 #1
0
파일: index.php 프로젝트: xunxu/meacaga
require_once '../include/db_handler.php';
require_once '../include/validation.php';
require '../libs/Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
/**
 * Listing single place
 * url /place/:id
 * method GET
 * Will return 404 if the place doesn't exist
 */
$app->get('/place/:id', function ($place_id) {
    $response = array();
    $db = new db_handler();
    // fetch task
    $result = $db->getPlaceById($place_id);
    if ($result != NULL) {
        $response["error"] = false;
        $response["name"] = $result["name"];
        $response["description"] = $result["description"];
        $response["address"] = $result["address"];
        $response["lat"] = $result["lat"];
        $response["lng"] = $result["lng"];
        $response["author"] = $result["author"];
        $response["email"] = $result["email"];
        $response["date"] = $result["date"];
        $result = $db->getScoreByPlaceId($place_id);
        if ($result != NULL) {
            $response["error"] = false;
            $response["paper"] = $result["paper"];
            $response["size"] = $result["size"];