File size: 1.83Kb
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
include_once H . 'panel/inc/settings.php';
function sendJsonResponse($data) {
header('Content-type: apllication/json');
echo json_encode($data);
exit;
}
$data = array('status' => 1);
if (!isset($user)) {
$data['status'] = 0;
sendJsonResponse($data);
}
if (isset($_POST['default'])) {
mysql_query("UPDATE `sidebar_settings` SET `data` = '[]' WHERE `id_user` = '$user[id]'");
sendJsonResponse();
}
include_once H . 'panel/inc/settings.php';
$types = include H . 'panel/inc/style_types.php';
$show_gifts = isset($_POST['show_gifts']) && $_POST['show_gifts'] == 1 ? 1 : 0;
$show_sidebar = isset($_POST['show_sidebar']) && $_POST['show_sidebar'] == 1 ? 1 : 0;
$reload_events = isset($_POST['reload_events']) && $_POST['reload_events'] == 1 ? 1 : 0;
$sidebar_settings_cache = array();
foreach ($types as $key => $value)
if (@$_POST[$key] && mysql_result(mysql_query("SELECT COUNT(*) FROM `sidebar_colors` WHERE `color` = '".my_esc($_POST[$key])."'"), 0))
$sidebar_settings_cache[$key] = array(
'color' => $_POST[$key],
'content' => $value['selector'] . " { " . $value['property'] . ": #" . $_POST[$key] . " !important } "
);
mysql_query("UPDATE `sidebar_settings` SET `data` = '".json_encode($sidebar_settings_cache)."', `show_gifts` = '$show_gifts', `show_sidebar` = '$show_sidebar', `reload_events` = '$reload_events' WHERE `id_user` = '$user[id]'");
echo mysql_error();
$data['cache'] = $sidebar_settings_cache;
sendJsonResponse($data);
?>