<?php
include '../env.php';
require_once(LIB.'common.inc.php');
if (can_action('admin')) {
	require_once(LIB.'Skin.class.php');
	$skin = new Skin();

	$log_ret = _a_log2('skin', 'restore', array(
		'target_key' => 'le-frog'
	));
	if ($log_ret) {
		$ret = $skin->restoreAll();
		_a_log_write($log_ret, array('success' => $ret === FALSE ? '0' : '1'));

		echo json_encode($ret);
		if ($ret) {
			Setting::Set('skin', 'le-frog');
			Setting::Set('admin-color', '#ff0');
			Setting::Set('operator-color', '#f92');
		}
	} else {
		echo json_encode(FALSE);
	}
} else {
	_a_log_fail('skin', 'restore', 'invalid auth', array(
		'target_key' => 'le-frog'
	));
	echo json_encode(FALSE);
}
?>