servnest/top.inc.php

83 lines
2.0 KiB
PHP
Raw Normal View History

2021-01-22 21:58:46 +01:00
<?php
session_name("niver");
session_start([
'sid_length' => 64,
'cookie_secure' => true,
'cookie_httponly' => true,
'cookie_samesite' => 'Strict',
]);
$rootPath = "/var/www/niver";
$prefixURL = "/capuche";
$address = basename($_SERVER['PHP_SELF'], '.php');
$service = dirname($_SERVER['PHP_SELF']);
if ($service != $prefixURL . "/auth" AND !isset($_SESSION['username'])) {
header('Location: ' . $prefixURL . '/auth/');
exit;
}
$dbPath = $rootPath . $prefixURL . "/db/auth.db";
$red = "#FF0000";
$purple = "#B300FF";
$green = "#00FF00";
$cyan = "#00FFFF";
switch ($service) {
case $prefixURL . "/ht":
$mainColor = $red;
break;
case $prefixURL . "/nic":
$mainColor = $purple;
break;
case $prefixURL . "/auth":
$mainColor = $green;
break;
case $prefixURL . "":
$mainColor = $green;
break;
case $prefixURL . "/ns":
$mainColor = $cyan;
break;
}
$theme = array(
'mainColor' => $mainColor,
'color1' => 'white',
'color2' => '#2a2a2a',
);
require "pages.inc.php";
require_once 'lessphp/lib/Less/Autoloader.php';
Less_Autoloader::register();
$lessFiles = array(
$rootPath . $prefixURL . '/less/main.less' => '',
$rootPath . $prefixURL . '/less/form.less' => ''
);
$options = array('cache_dir' => $rootPath . $prefixURL . '/css/');
$cssFileName = Less_Cache::Get($lessFiles, $options, $theme);
?>
<!DOCTYPE html>
<html>
<head>
<title><?= $page['title'] ?><?php if (isset($page['service'])) { echo " · " . $page['service']; } ?> · Atope</title>
<link type="text/css" rel="stylesheet" href="<?= $prefixURL ?>/css/<?= $cssFileName ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<header>
<?php if (!isset($page['service'])) {
$page['service'] = "Atope";
} ?>
<nav>
<a href="<?= $prefixURL ?>">Niver</a> > <a href="./"><?= $page['service'] ?></a> > <?= $page['title'] ?>
</nav>
<h1><?= $page['title'] ?></h1>
</header>