From e5c306c24b224f1bce4c3220fca78ea49706dd17 Mon Sep 17 00:00:00 2001 From: Miraty Date: Thu, 19 May 2022 16:59:32 +0200 Subject: [PATCH] SFTPGo authentication --- common/init.php | 19 +++++++++++++++++++ common/top.php | 16 +--------------- dns.php | 2 -- ns.php | 2 -- reg.php | 2 -- sftpgo-auth.php | 14 ++++++++++++++ 6 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 common/init.php create mode 100644 sftpgo-auth.php diff --git a/common/init.php b/common/init.php new file mode 100644 index 0000000..ee0f861 --- /dev/null +++ b/common/init.php @@ -0,0 +1,19 @@ + 2. TLDs for Testing, & Documentation Examples +define("PREFIX", ""); // Prefix in URL, if any +define("ROOT_PATH", "/srv/php/niver"); // niver-php directory +define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1)); +define("PAGE", basename($_SERVER['PHP_SELF'], '.php')); +define("DB_PATH", ROOT_PATH . "/db/niver.db"); // Niver's SQLite database +define("SUDO_PATH", "/usr/bin/sudo"); +define("HT_PATH", "/srv/ht"); + +// Service-specific functions and constants +if (SERVICE === "reg" OR SERVICE === "ns") + require ROOT_PATH . "/dns.php"; +if (SERVICE !== "") + require ROOT_PATH . "/" . SERVICE . ".php"; + +// Page titles definition +require "pages.php"; diff --git a/common/top.php b/common/top.php index eac9092..d452559 100644 --- a/common/top.php +++ b/common/top.php @@ -1,20 +1,6 @@ 2. TLDs for Testing, & Documentation Examples -define("PREFIX", ""); // Prefix in URL, if any -define("ROOT_PATH", "/srv/php/niver"); // niver-php directory -define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1)); -define("PAGE", basename($_SERVER['PHP_SELF'], '.php')); -define("DB_PATH", ROOT_PATH . "/db/niver.db"); // Niver's SQLite database -define("SUDO_PATH", "/usr/bin/sudo"); -define("HT_PATH", "/srv/ht"); - -// Service-specific functions and constants -if (SERVICE !== "") - require ROOT_PATH . "/" . SERVICE . ".php"; - -// Page titles definition -require "pages.php"; +require "init.php"; function antiCSRF() { if (!isset($_SERVER['HTTP_SEC_FETCH_SITE']) OR $_SERVER['HTTP_SEC_FETCH_SITE'] !== "same-origin") diff --git a/dns.php b/dns.php index f847507..443a9a0 100644 --- a/dns.php +++ b/dns.php @@ -1,7 +1,5 @@