94 lines
2.6 KiB
PHP
94 lines
2.6 KiB
PHP
<?php
|
|
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
|
|
exit("This file is meant to be included.");
|
|
|
|
session_start([
|
|
'name' => 'niver',
|
|
'sid_length' => 64,
|
|
'cookie_secure' => true,
|
|
'cookie_httponly' => true,
|
|
'cookie_samesite' => 'Strict',
|
|
'gc_maxlifetime' => 604800,
|
|
]);
|
|
|
|
$usernamePattern = "[a-z]{4,32}";
|
|
$passwordPattern = ".{10,1024}";
|
|
|
|
$prefixURL = "/capuche";
|
|
$rootPath = "/var/www/niver" . $prefixURL;
|
|
|
|
$address = basename($_SERVER['PHP_SELF'], '.php');
|
|
$service = dirname($_SERVER['PHP_SELF']);
|
|
|
|
if ($service != $prefixURL . "/auth" AND !isset($_SESSION['username'])) {
|
|
header('Location: ' . $prefixURL . '/auth/');
|
|
exit;
|
|
}
|
|
|
|
define("DB_PATH", $rootPath . "/db/auth.db");
|
|
$dbPath = $rootPath . "/db/auth.db";
|
|
|
|
$theme = array(
|
|
'htColor' => "#FF0000",
|
|
'nicColor' => "#DA03E5",
|
|
'authColor' => "#00FF00",
|
|
'nsColor' => "#00FFFF",
|
|
'lightColor' => '#FFFFFF',
|
|
'darkColor' => '#2a2a2a',
|
|
);
|
|
|
|
switch ($service) {
|
|
case $prefixURL . "/ht":
|
|
$theme = array('mainColor' => $theme['htColor']) + $theme;
|
|
break;
|
|
case $prefixURL . "/nic":
|
|
$theme = array('mainColor' => $theme['nicColor']) + $theme;
|
|
break;
|
|
case $prefixURL . "/auth":
|
|
$theme = array('mainColor' => $theme['authColor']) + $theme;
|
|
break;
|
|
case $prefixURL . "":
|
|
$theme = array('mainColor' => $theme['authColor']) + $theme;
|
|
break;
|
|
case $prefixURL . "/ns":
|
|
$theme = array('mainColor' => $theme['nsColor']) + $theme;
|
|
break;
|
|
}
|
|
|
|
require "pages.inc.php";
|
|
require "fn.inc.php";
|
|
|
|
require_once 'lessphp/lib/Less/Autoloader.php';
|
|
Less_Autoloader::register();
|
|
|
|
$relativeLessFiles = array_diff(scandir($rootPath . "/less"), array('..', '.'));
|
|
$relativeLessFiles = array_flip($relativeLessFiles);
|
|
|
|
foreach ($relativeLessFiles as $relativeLessFile => $nothing) {
|
|
$absoluteLessFiles[$rootPath . "/less/" . $relativeLessFile] = "";
|
|
}
|
|
|
|
$options = array('cache_dir' => $rootPath . '/css/'); //, 'compress' => true
|
|
$cssFileName = Less_Cache::Get($absoluteLessFiles, $options, $theme);
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<title><?php if ($page['title'] != "Accueil") echo $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>
|