|
@@ -2,33 +2,22 @@
|
|
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
|
|
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
|
|
exit("This file is meant to be included.");
|
|
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("USERNAME_REGEX", "^[a-z]{4,32}$");
|
|
define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$");
|
|
define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$");
|
|
define("SUBDOMAIN_REGEX", "^[a-z]{4,63}$");
|
|
define("SUBDOMAIN_REGEX", "^[a-z]{4,63}$");
|
|
|
|
|
|
-define("PREFIX", "/eltrode"); // Prefix in the URL, if any
|
|
|
|
|
|
+define("PREFIX", "/pmkdel"); // Prefix in the URL, if any
|
|
define("ROOT_PATH", "/srv/http/niver" . PREFIX); // Niver directory
|
|
define("ROOT_PATH", "/srv/http/niver" . PREFIX); // Niver directory
|
|
define("DB_PATH", ROOT_PATH . "/db/niver.db"); // Niver SQLite database
|
|
define("DB_PATH", ROOT_PATH . "/db/niver.db"); // Niver SQLite database
|
|
define("KNOTC_PATH", "/usr/sbin/knotc"); // Binary file
|
|
define("KNOTC_PATH", "/usr/sbin/knotc"); // Binary file
|
|
define("KEYMGR_PATH", "/usr/sbin/keymgr"); // Binary file
|
|
define("KEYMGR_PATH", "/usr/sbin/keymgr"); // Binary file
|
|
define("NGINX_CONFIG_PATH", "/etc/nginx/hyper"); // Config directory
|
|
define("NGINX_CONFIG_PATH", "/etc/nginx/hyper"); // Config directory
|
|
define("TOR_CONFIG_PATH", "/etc/tor/torrc"); // Config file
|
|
define("TOR_CONFIG_PATH", "/etc/tor/torrc"); // Config file
|
|
|
|
+define("KNOT_ZONES_PATH", "/var/lib/knot/zones"); // Zones directory
|
|
define("TOR_KEYS_PATH", "/var/lib/tor/niver"); // Keys directory
|
|
define("TOR_KEYS_PATH", "/var/lib/tor/niver"); // Keys directory
|
|
define("SUDO_PATH", "/usr/bin/sudo"); // Binary file
|
|
define("SUDO_PATH", "/usr/bin/sudo"); // Binary file
|
|
define("LS_PATH", "/usr/bin/ls"); // Binary file
|
|
define("LS_PATH", "/usr/bin/ls"); // Binary file
|
|
|
|
+define("NIVER_TEMPLATE_PATH", "/usr/local/share/niver"); // Templates directory (skel, nginx, knot...)
|
|
define("MANIVER_PATH", "/usr/local/bin/maniver"); // Binary file
|
|
define("MANIVER_PATH", "/usr/local/bin/maniver"); // Binary file
|
|
// The mountpoint of the hypertext storage partition (that will be accessed over SFTP)
|
|
// The mountpoint of the hypertext storage partition (that will be accessed over SFTP)
|
|
define("HT_PATH", "/srv/ht");
|
|
define("HT_PATH", "/srv/ht");
|
|
@@ -36,6 +25,20 @@ define("HT_PATH", "/srv/ht");
|
|
define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1));
|
|
define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1));
|
|
define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
|
|
define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
|
|
|
|
|
|
|
|
+session_start([
|
|
|
|
+ 'name' => 'niver',
|
|
|
|
+ 'sid_length' => 64,
|
|
|
|
+ 'cookie_secure' => true,
|
|
|
|
+ 'cookie_httponly' => true,
|
|
|
|
+ 'cookie_samesite' => 'Strict',
|
|
|
|
+ 'cookie_path' => PREFIX . '/',
|
|
|
|
+ 'cookie_lifetime' => 432000, // = 60*60*24*5 = 5 days
|
|
|
|
+ 'gc_maxlifetime' => 10800,
|
|
|
|
+ 'use_strict_mode' => true,
|
|
|
|
+ 'use_cookies' => true,
|
|
|
|
+ 'use_only_cookies' => true,
|
|
|
|
+]);
|
|
|
|
+
|
|
if (SERVICE != "auth" AND !isset($_SESSION['username'])) {
|
|
if (SERVICE != "auth" AND !isset($_SESSION['username'])) {
|
|
header('Location: ' . PREFIX . '/auth/login?redir=' . SERVICE . "/" . PAGE, true, 302);
|
|
header('Location: ' . PREFIX . '/auth/login?redir=' . SERVICE . "/" . PAGE, true, 302);
|
|
exit;
|
|
exit;
|
|
@@ -55,21 +58,6 @@ $theme = array(
|
|
'darkColor' => '#2a2a2a',
|
|
'darkColor' => '#2a2a2a',
|
|
);
|
|
);
|
|
|
|
|
|
-switch (SERVICE) {
|
|
|
|
- case "ht":
|
|
|
|
- $theme = array('mainColor' => $theme['htColor']) + $theme;
|
|
|
|
- break;
|
|
|
|
- case "reg":
|
|
|
|
- $theme = array('mainColor' => $theme['regColor']) + $theme;
|
|
|
|
- break;
|
|
|
|
- case "ns":
|
|
|
|
- $theme = array('mainColor' => $theme['nsColor']) + $theme;
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- $theme = array('mainColor' => $theme['authColor']) + $theme;
|
|
|
|
- break;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
require "inc/all.inc.php";
|
|
require "inc/all.inc.php";
|
|
require "inc/format.inc.php";
|
|
require "inc/format.inc.php";
|
|
require "inc/ht.inc.php";
|
|
require "inc/ht.inc.php";
|
|
@@ -130,3 +118,4 @@ $cssFileName = Less_Cache::Get($absoluteLessFiles, $options, $theme);
|
|
<?php } ?>
|
|
<?php } ?>
|
|
|
|
|
|
</header>
|
|
</header>
|
|
|
|
+ <main>
|