servnest/top.inc.php

92 lines
2.5 KiB
PHP
Raw Normal View History

2021-01-22 21:58:46 +01:00
<?php
2021-01-23 17:26:46 +01:00
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file can't be executed directly.");
2021-01-22 21:58:46 +01:00
session_name("niver");
session_start([
2021-01-23 17:26:46 +01:00
'sid_length' => 64,
'cookie_secure' => true,
'cookie_httponly' => true,
'cookie_samesite' => 'Strict',
2021-01-22 21:58:46 +01:00
]);
2021-01-23 17:26:46 +01:00
$usernamePattern = "[a-z]{4,32}";
$passwordPattern = ".{10,1024}";
2021-01-22 21:58:46 +01:00
$prefixURL = "/capuche";
2021-01-23 17:26:46 +01:00
$rootPath = "/var/www/niver" . $prefixURL;
2021-01-22 21:58:46 +01:00
$address = basename($_SERVER['PHP_SELF'], '.php');
$service = dirname($_SERVER['PHP_SELF']);
if ($service != $prefixURL . "/auth" AND !isset($_SESSION['username'])) {
header('Location: ' . $prefixURL . '/auth/');
exit;
}
2021-01-23 17:26:46 +01:00
$dbPath = $rootPath . "/db/auth.db";
2021-01-22 21:58:46 +01:00
2021-01-25 13:39:31 +01:00
$theme = array(
'htColor' => "#FF0000",
'nicColor' => "#da03e5",
'authColor' => "#00FF00",
'nsColor' => "#00FFFF",
'color1' => 'white',
'color2' => '#2a2a2a',
);
2021-01-22 21:58:46 +01:00
switch ($service) {
case $prefixURL . "/ht":
2021-01-25 13:39:31 +01:00
$theme = array('mainColor' => $theme['htColor']) + $theme;
2021-01-22 21:58:46 +01:00
break;
case $prefixURL . "/nic":
2021-01-25 13:39:31 +01:00
$theme = array('mainColor' => $theme['nicColor']) + $theme;
2021-01-22 21:58:46 +01:00
break;
case $prefixURL . "/auth":
2021-01-25 13:39:31 +01:00
$theme = array('mainColor' => $theme['authColor']) + $theme;
2021-01-22 21:58:46 +01:00
break;
case $prefixURL . "":
2021-01-25 13:39:31 +01:00
$theme = array('mainColor' => $theme['authColor']) + $theme;
2021-01-22 21:58:46 +01:00
break;
case $prefixURL . "/ns":
2021-01-25 13:39:31 +01:00
$theme = array('mainColor' => $theme['nsColor']) + $theme;
2021-01-22 21:58:46 +01:00
break;
}
require "pages.inc.php";
require_once 'lessphp/lib/Less/Autoloader.php';
Less_Autoloader::register();
2021-01-23 17:26:46 +01:00
$relativeLessFiles = array_diff(scandir($rootPath . "/less"), array('..', '.'));
$relativeLessFiles = array_flip($relativeLessFiles);
foreach ($relativeLessFiles as $relativeLessFile => $nothing) {
$absoluteLessFiles[$rootPath . "/less/" . $relativeLessFile] = "";
}
2021-01-25 13:39:31 +01:00
$options = array('cache_dir' => $rootPath . '/css/', 'compress' => true);
2021-01-23 17:26:46 +01:00
$cssFileName = Less_Cache::Get($absoluteLessFiles, $options, $theme);
2021-01-22 21:58:46 +01:00
?>
<!DOCTYPE html>
2021-01-25 13:39:31 +01:00
<html lang="fr">
2021-01-22 21:58:46 +01:00
<head>
2021-01-25 13:39:31 +01:00
<title><?php if ($page['title'] != "Accueil") echo $page['title'] . " · "; ?><?php if (isset($page['service'])) { echo $page['service'] . " · "; } ?>Atope</title>
2021-01-22 21:58:46 +01:00
<link type="text/css" rel="stylesheet" href="<?= $prefixURL ?>/css/<?= $cssFileName ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
2021-01-25 13:39:31 +01:00
2021-01-22 21:58:46 +01:00
<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>