<?php
include '../env.php';
require_once(LIB.'common.inc.php');
require_once(LIB.'Post.class.php');
$post = new Post();
if (! can_action('operation') || empty($_POST['id'])) {
	_a_log_fail('url', 'del', 'invalid auth', array('target_key' => @$_POST['id']));
	echo json_encode(FALSE);
	die;
}

$log_ret = _a_log2('url', 'del', array(
	'target_key' => @$_POST['id']
));
if ($log_ret) {
	$ret = $post->deleteUrl($_POST['id']);
	_a_log_write($log_ret, array('success' => $ret === FALSE ? '0' : '1'));
	echo json_encode($ret);
} else {
	echo json_encode(FALSE);
}
?>