<?php
$pages = [
    "me" => "Hem",
    "report" => "Redovisning",
    "multipage" => "Multipage",
    "stylechooser" => "Stylechooser",
    "jetty" => "Jetty",
    "search-comments" => "Search",
    "admin" => "Admin",
    "about" => "Om",
    "login" => "Login"
];
$styles = [
    "default" => "css/themes/default.css",
    "dark" => "css/themes/dark.css",
    "green" => "css/themes/green.css"
];

include("incl/functions.php");

create_session();
$page = get_page($pages);
$style = get_style($styles);

$usagedata = get_usagedata();

ob_start();
?>
<!DOCTYPE html>
<html lang="sv">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="css/layout.css"/>
        <link rel="stylesheet" href="<?= $style["file"] ?>"/>
        <link rel='shortcut icon' href='img/favicon.ico'/>
        <title><?= "Rasmus - " . $page["title"] ?></title>
    </head>
    <body>
        <main>
            <header>
                <div class="site-header-styleopts">
                    <?php include("incl/styleopts.php") ?>
                </div>
                <div class="site-header-info">
                    <a href="?page=me"><img src="img/logo.jpg" alt="logo" /></a>
                    <div class="site-header-info-text">
                        <span class="site-title">Rasmus Steen</span><br />
                        <span class="site-slogan">Potatisguden</span>
                    </div>
                </div>
            </header>
            <nav>
                <?= create_navbar($pages, $page["id"]); ?>
            </nav>
            <div>
                <?php include($page["file"])?>
            </div>
            <footer class="site-footer">
                <div class="links">
                    Validatorer:
                    <a href="http://validator.w3.org/check/referer">HTML5</a>
                    <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>
                    <a href="http://validator.w3.org/unicorn/check?ucn_uri=referer&amp;ucn_task=conformance">Unicorn</a><br />
                    Specificationer:
                    <a href="http://www.w3.org/2009/cheatsheet">Cheatsheet</a>
                    <a href="http://www.w3.org/TR/html5">HTML5</a>
                    <a href="http://www.w3.org/TR/html4">HTML4</a>
                    <a href="http://www.w3.org/Style/CSS/current-work">CSS3</a>
                    <a href="http://dev.w3.org/csswg/css2">CSS2.2</a>
                    <a href="http://www.w3.org/TR/CSS21">CSS2.1</a><br />
                </div>
                <div class="performance">
                    <br />
                    Loadtime: <?= $usagedata["time"] ?> ms. Files: <?= $usagedata["files"] ?>. Memory: <?= $usagedata["memory"] ?> MiB.<br />
                </div>
            </footer>
        </main>
    </body>
</html>
<?php
    ob_end_flush();
