98 lines
2.8 KiB
PHP
98 lines
2.8 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',
|
|
'cookie_lifetime' => 604800,
|
|
'gc_maxlifetime' => 604800,
|
|
'use_strict_mode' => true,
|
|
'use_cookies' => true,
|
|
'use_only_cookies' => true,
|
|
]);
|
|
|
|
define("USERNAME_REGEX", "^[a-z]{4,32}$");
|
|
define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$");
|
|
|
|
define("PREFIX", "/malaxe");
|
|
define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1));
|
|
define("ROOT_PATH", "/var/www/niver" . PREFIX);
|
|
define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
|
|
|
|
if (SERVICE != "auth" AND !isset($_SESSION['username'])) {
|
|
header('Location: ' . PREFIX . '/auth/login?redir=' . SERVICE . "/" . PAGE);
|
|
exit;
|
|
}
|
|
|
|
define("DB_PATH", ROOT_PATH . "/db/auth.db");
|
|
$dbPath = DB_PATH;
|
|
|
|
$theme = array(
|
|
'htColor' => "#FF0000",
|
|
'nicColor' => "#DA03E5",
|
|
'authColor' => "#00FF00",
|
|
'nsColor' => "#00FFFF",
|
|
'lightColor' => '#FFFFFF',
|
|
'darkColor' => '#2a2a2a',
|
|
);
|
|
|
|
switch (SERVICE) {
|
|
case "ht":
|
|
require "ht/ht.fn.inc.php";
|
|
$theme = array('mainColor' => $theme['htColor']) + $theme;
|
|
break;
|
|
case "nic":
|
|
$theme = array('mainColor' => $theme['nicColor']) + $theme;
|
|
break;
|
|
case "auth":
|
|
$theme = array('mainColor' => $theme['authColor']) + $theme;
|
|
break;
|
|
case "":
|
|
$theme = array('mainColor' => $theme['authColor']) + $theme;
|
|
break;
|
|
case "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(ROOT_PATH . "/less"), array('..', '.'));
|
|
$relativeLessFiles = array_flip($relativeLessFiles);
|
|
|
|
foreach ($relativeLessFiles as $relativeLessFile => $nothing) {
|
|
$absoluteLessFiles[ROOT_PATH . "/less/" . $relativeLessFile] = "";
|
|
}
|
|
|
|
$options = array('cache_dir' => ROOT_PATH . '/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="<?= PREFIX ?>/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="<?= PREFIX ?>">Niver</a> > <a href="./"><?= $page['service'] ?></a> > <?= $page['title'] ?>
|
|
</nav>
|
|
|
|
<h1><?= $page['title'] ?></h1>
|
|
</header>
|