<?php
require_once(__DIR__ . "/class_session.inc");
require_once(__DIR__ . "/class_layout.inc");

if (isset($symon['layout_dir'])) {
    $layout_dir = dir($symon['layout_dir']);
    $layouts = [];
    while ($layout = $layout_dir->read()) {
        $file_layout = $symon['layout_dir'].'/'.$layout;
        $extension = get_extension($layout);
        $layout = basename($layout, '.layout');
        if (is_file($file_layout) && $extension == 'layout') {
            $symon['defaults']['layout']['namedvalues'][$layout] = $layout;
        }
    }
    $symon['defaults']['layout']['namedvalues']['default'] = 'default';
}

$session->load();

$hidden = '';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>symon statistics</title>
 <link rel="stylesheet" href="symon.css" type="text/css" />
</head>

<body bgcolor="#ffffff">
<?php
$layout = $session->get("layout");

if ($layout == 'default') {
    $layout = '';
}

$l = new Layout($layout);
$l->render();
?>

</body>
</html>
