servnest/top.inc.php

92 lines
2.3 KiB
PHP
Raw Normal View History

2021-01-22 20:58:46 +00:00
<?php
2021-01-23 16:26:46 +00:00
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file can't be executed directly.");
2021-01-22 20:58:46 +00:00
session_name("niver");
session_start([
2021-01-23 16:26:46 +00:00
'sid_length' => 64,
'cookie_secure' => true,
'cookie_httponly' => true,
'cookie_samesite' => 'Strict',
2021-01-22 20:58:46 +00:00
]);
2021-01-23 16:26:46 +00:00
$usernamePattern = "[a-z]{4,32}";
$passwordPattern = ".{10,1024}";
2021-01-22 20:58:46 +00:00
$prefixURL = "/capuche";
2021-01-23 16:26:46 +00:00
$rootPath = "/var/www/niver" . $prefixURL;
2021-01-22 20:58:46 +00: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 16:26:46 +00:00
$dbPath = $rootPath . "/db/auth.db";
2021-01-22 20:58:46 +00:00
$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();
2021-01-23 16:26:46 +00:00
$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/');
$cssFileName = Less_Cache::Get($absoluteLessFiles, $options, $theme);
2021-01-22 20:58:46 +00:00
?>
<!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>