<?php
$t = 'Главная';
require_once 'wcore/core.php';
require_once 'wcore/head.php';

$news = array('created' => 0);
$_tmp_news = mysqli_query($mysqli,"SELECT * FROM `modules_news` ORDER BY `id` DESC LIMIT 1") or die("Ошибка запроса: ".mysqli_error($mysqli));

while ($ns = mysqli_fetch_assoc($_tmp_news))
{
    $news = array('created' => 1,'title' => $ns['name'],'msg' => output($ns['txt']),'time' => ptime($ns['time']), 'who' => acc($ns['id_user']));
}

$order_cats = array(
	'vhost' =>  mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM `servers` WHERE `type` = '1'")),
	'ress'  =>  mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM `servers` WHERE `type` = '2'")),
	'vds'   =>  mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM `servers` WHERE `type` = '3'")),
	'dedic' =>  mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM `servers` WHERE `type` = '4'")),
	'domain'=>  mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM `servers` WHERE `type` = '5'")),
);

if ($thecfg['type'] == 1)
{
    echo $twig->render('pages_home.tpl', array('news' => $news,'lang' =>$lang,'main'=>wcore_mmenu(),'orders'=>$order_cats));
} 
else 
{
    go($thecfg['r_url']);
}
require_once 'wcore/foot.php';