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

$log_ret = _a_log2('image', 'del', array(
	'target_key' => $_POST['d'],
	'detail' => serialize($_POST)
));

if ($log_ret) {
	$ret = $imgManager->delete($_POST['d'], @$_POST['with_post']);
	_a_log_write($log_ret, array('success' => $ret === FALSE ? '0' : '1'));
	echo json_encode($ret);
} else {
	echo json_encode(FALSE);
}
?>