<?php

require_once('config.php');

require_once( CAB_ENGINE . '/libs/template/Smarty.class.php' );
$tmp = new Smarty();

$tmp->setTemplateDir( CAB_TEMPL . $cabinet_config['template'] . '/' );
$tmp->setCompileDir( CAB_TEMPL . '/templates_c/' );
$tmp->setConfigDir( CAB_TEMPL . '/configs/' );
$tmp->setCacheDir( CAB_TEMPL . '/cache/' );

$tmp->assign('cabinet_theme', '/cabinet/templates/' . $cabinet_config['template']);
$tmp->assign('user_login', $member_id['name']);
$tmp->assign('user_email', $member_id['email']);
$tmp->assign('user_balance', $member_id['balance']);
$tmp->assign('user_reg_date', date("d.m.Y в H:i", $member_id['reg_date']));
$tmp->assign('user_last_date', date("d.m.Y в H:i", $member_id['lastdate']));
$tmp->assign('user_days_to_project', days_to_project($member_id['reg_date']) . ' ' . pre_ending(days_to_project($member_id['reg_date']), "день", "дня", "дней"));
$tmp->assign('user_group', $member_id['user_group']);
$tmp->assign('user_skin_path', $member_id['name']);
$tmp->assign('upload_hd_skin', $member_id['hd_skin']);
$tmp->assign('upload_cloak', $member_id['cloak']);
$tmp->assign('upload_hd_cloak', $member_id['hd_cloak']);
$tmp->assign('upload_hd_skin_price', $cabinet_config['shop']['hd_skin']);
$tmp->assign('upload_cloak_price', $cabinet_config['shop']['cloak']);
$tmp->assign('upload_hd_cloak_price', $cabinet_config['shop']['hd_cloak']);

$history_list = $db->super_query("SELECT * FROM `cabinet_logs` WHERE name = '{$member_id['name']}' ORDER BY `id` DESC LIMIT 20", TRUE);
$server_list = $db->super_query("SELECT * FROM `cabinet_servers` WHERE `enable` = 1", TRUE);
$category_list = $db->super_query("SELECT * FROM `cabinet_categories`", TRUE);
$donane_list = $db->super_query("SELECT * FROM `cabinet_privilages`", TRUE);
$basket_list = $db->super_query("SELECT * FROM `cabinet_get_items` INNER JOIN `cabinet_products` ON `cabinet_get_items`.`block_name` = `cabinet_products`.`block_name` AND `cabinet_get_items`.`user` LIKE '{$member_id['name']}'", TRUE);

if (!file_exists($cabinet_config['files']['dir'] . 'skins/' . $member_id['name'] . '.png')) {
	$tmp->assign('user_skin_path', 'default');
}

if ($config['debug'] === true) {
	$tmp->debugging = true;
}
?>
