<?php
include '../env.php';
require_once(LIB.'common.inc.php');
require_once(LIB.'Post.class.php');
$post = new Post();
if (! can_action('view')) {
	echo json_encode(FALSE);
	die;
}

if (empty($_GET['t'])) {
	echo json_encode(FALSE);
	die;
}

$ret = array();
if (is_login()) {
	$ret['favorited'] = $post->isFavorited($_GET['t'], @$_GET['key']);
}
$ret['count'] = $post->countFavorite($_GET['t'], @$_GET['key']);

echo json_encode($ret);
?>