Initial
This commit is contained in:
61
web/list/access-key/index.php
Normal file
61
web/list/access-key/index.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
|
||||
$TAB = "Access Key";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
if ($_SESSION["userContext"] === "admin" && !empty($_GET["user"])) {
|
||||
$user = quoteshellarg($_GET["user"]);
|
||||
$user_plain = $_GET["user"];
|
||||
}
|
||||
|
||||
// Checks if API access is enabled
|
||||
$api_status =
|
||||
!empty($_SESSION["API_SYSTEM"]) && is_numeric($_SESSION["API_SYSTEM"])
|
||||
? $_SESSION["API_SYSTEM"]
|
||||
: 0;
|
||||
if (($user_plain == "admin" && $api_status < 1) || ($user_plain != "admin" && $api_status < 2)) {
|
||||
header("Location: /edit/user/");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!empty($_GET["key"])) {
|
||||
$v_key = quoteshellarg(trim($_GET["key"]));
|
||||
|
||||
// Key data
|
||||
exec(HESTIA_CMD . "v-list-access-key " . $v_key . " json", $output, $return_var);
|
||||
$key_data = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
|
||||
if (empty($key_data) || $key_data["USER"] != $user_plain) {
|
||||
header("Location: /list/access-key/");
|
||||
exit();
|
||||
}
|
||||
|
||||
// APIs
|
||||
exec(HESTIA_CMD . "v-list-apis json", $output, $return_var);
|
||||
$apis = json_decode(implode("", $output), true);
|
||||
$apis = array_filter($apis, function ($api) use ($user_plain) {
|
||||
return $user_plain == "admin" || $api["ROLE"] == "user";
|
||||
});
|
||||
ksort($apis);
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_access_key");
|
||||
} else {
|
||||
exec(HESTIA_CMD . "v-list-access-keys $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
|
||||
uasort($data, function ($a, $b) {
|
||||
return $a["DATE"] <=> $b["DATE"] ?: $a["TIME"] <=> $b["TIME"];
|
||||
});
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_access_keys");
|
||||
}
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
16
web/list/backup/exclusions/index.php
Normal file
16
web/list/backup/exclusions/index.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
error_reporting(null);
|
||||
$TAB = "BACKUP";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-user-backup-exclusions $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_backup_exclusions");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
34
web/list/backup/index.php
Normal file
34
web/list/backup/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
$TAB = "BACKUP";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data & Render page
|
||||
if (empty($_GET["backup"])) {
|
||||
exec(HESTIA_CMD . "v-list-user-backups $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_backup");
|
||||
} else {
|
||||
exec(
|
||||
HESTIA_CMD . "v-list-user-backup $user " . quoteshellarg($_GET["backup"]) . " json",
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_backup_detail");
|
||||
}
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
21
web/list/cron/index.php
Normal file
21
web/list/cron/index.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$TAB = "CRON";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-cron-jobs $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_cron");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
21
web/list/db/index.php
Normal file
21
web/list/db/index.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$TAB = "DB";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-databases $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_db");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
108
web/list/dns/index.php
Normal file
108
web/list/dns/index.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
$TAB = "DNS";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data & Render page
|
||||
|
||||
if (empty($_GET["domain"])) {
|
||||
exec(HESTIA_CMD . "v-list-dns-domains " . $user . " 'json'", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_dns");
|
||||
} elseif (!empty($_GET["action"])) {
|
||||
exec(
|
||||
HESTIA_CMD .
|
||||
"v-list-dnssec-public-key " .
|
||||
$user .
|
||||
" " .
|
||||
quoteshellarg($_GET["domain"]) .
|
||||
" 'json'",
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$domain = $_GET["domain"];
|
||||
|
||||
switch ($data[$domain]["FLAG"]) {
|
||||
case 257:
|
||||
$flag = "KSK (257)";
|
||||
break;
|
||||
case 256:
|
||||
$flag = "ZSK (256)";
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($data[$domain]["ALGORITHM"]) {
|
||||
case 3:
|
||||
$algorithm = "3 - DSA";
|
||||
break;
|
||||
case 5:
|
||||
$algorithm = "5 - RSA/SHA1";
|
||||
break;
|
||||
case 6:
|
||||
$algorithm = "6 - DSA-NSEC3-SHA1";
|
||||
break;
|
||||
case 7:
|
||||
$algorithm = "7 - RSA/SHA1-NSEC3-SHA1";
|
||||
break;
|
||||
case 8:
|
||||
$algorithm = "8 - RSA/SHA256";
|
||||
break;
|
||||
case 10:
|
||||
$algorithm = "10 - RSA/SHA512";
|
||||
break;
|
||||
case 12:
|
||||
$algorithm = "12 - ECC-GOST";
|
||||
break;
|
||||
case 13:
|
||||
$algorithm = "13 - ECDSAP256/SHA256";
|
||||
break;
|
||||
case 14:
|
||||
$algorithm = "14 - ECDSAP384/SHA384";
|
||||
break;
|
||||
case 15:
|
||||
$algorithm = "15 - ED25519/SHA512";
|
||||
break;
|
||||
case 16:
|
||||
$algorithm = "16 - ED448/SHA912";
|
||||
break;
|
||||
default:
|
||||
$algorithm = "Unknown";
|
||||
}
|
||||
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_dns_public");
|
||||
} else {
|
||||
exec(
|
||||
HESTIA_CMD .
|
||||
"v-list-dns-records " .
|
||||
$user .
|
||||
" " .
|
||||
quoteshellarg($_GET["domain"]) .
|
||||
" 'json'",
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_dns_rec");
|
||||
}
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
23
web/list/firewall/banlist/index.php
Normal file
23
web/list/firewall/banlist/index.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$TAB = "FIREWALL";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-firewall-ban json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_firewall_banlist");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
27
web/list/firewall/index.php
Normal file
27
web/list/firewall/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
$TAB = "FIREWALL";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-firewall json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_firewall");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
22
web/list/firewall/ipset/index.php
Normal file
22
web/list/firewall/ipset/index.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
$TAB = "FIREWALL";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-firewall-ipset json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
ksort($data);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_firewall_ipset");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
8
web/list/index.php
Normal file
8
web/list/index.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (isset($_SESSION["user"])) {
|
||||
header("Location: /list/user/");
|
||||
} else {
|
||||
header("Location: /login/");
|
||||
}
|
||||
?>
|
||||
28
web/list/ip/index.php
Normal file
28
web/list/ip/index.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
$TAB = "IP";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-sys-ips json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_ip");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
23
web/list/key/index.php
Normal file
23
web/list/key/index.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
$TAB = "USER";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
if ($_SESSION["userContext"] === "admin" && !empty($_GET["user"])) {
|
||||
$user = quoteshellarg($_GET["user"]);
|
||||
}
|
||||
|
||||
exec(HESTIA_CMD . "v-list-user-ssh-key " . $user . " json", $output, $return_var);
|
||||
if ($return_var > 0) {
|
||||
check_return_code_redirect($return_var, $output, "/");
|
||||
}
|
||||
$data = json_decode(implode("", $output), true);
|
||||
|
||||
// Render page\
|
||||
render_page($user, $TAB, "list_key");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
?>
|
||||
29
web/list/log/auth/index.php
Normal file
29
web/list/log/auth/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
|
||||
ob_start();
|
||||
$TAB = "LOG";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Edit as someone else?
|
||||
if ($_SESSION["userContext"] === "admin" && $_SESSION["look"] != "") {
|
||||
$user = quoteshellarg($_SESSION["look"]);
|
||||
} elseif ($_SESSION["userContext"] === "admin" && !empty($_GET["user"])) {
|
||||
$user = quoteshellarg($_GET["user"]);
|
||||
}
|
||||
|
||||
exec(HESTIA_CMD . "v-list-user-auth-log " . $user . " json", $output, $return_var);
|
||||
check_return_code_redirect($return_var, $output, "/");
|
||||
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data);
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_log_auth");
|
||||
|
||||
// Flush session messages
|
||||
unset($_SESSION["error_msg"]);
|
||||
unset($_SESSION["ok_msg"]);
|
||||
50
web/list/log/index.php
Normal file
50
web/list/log/index.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
if (empty($_GET["user"])) {
|
||||
$_GET["user"] = "";
|
||||
}
|
||||
if ($_GET["user"] === "system") {
|
||||
$TAB = "SERVER";
|
||||
} else {
|
||||
$TAB = "LOG";
|
||||
}
|
||||
|
||||
// Redirect non-administrators if they request another user's log
|
||||
if ($_SESSION["userContext"] !== "admin" && !empty($_GET["user"])) {
|
||||
header("location: /login/");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
if ($_SESSION["userContext"] === "admin" && !empty($_GET["user"])) {
|
||||
// Check token
|
||||
verify_csrf($_GET);
|
||||
$user = quoteshellarg($_GET["user"]);
|
||||
}
|
||||
|
||||
exec(HESTIA_CMD . "v-list-user-log $user json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if (is_array($data)) {
|
||||
$data = array_reverse($data);
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
if ($user === "system") {
|
||||
$user = "'" . $_SESSION["user"] . "'";
|
||||
}
|
||||
} else {
|
||||
$data = [];
|
||||
$data[] = [
|
||||
"LEVEL" => "error",
|
||||
"DATE" => date("Y-m-d"),
|
||||
"TIME" => date("H:i:s"),
|
||||
"MESSAGE" => "Unable to load logs",
|
||||
"CATEGORY" => "system",
|
||||
];
|
||||
}
|
||||
render_page($user, $TAB, "list_log");
|
||||
71
web/list/mail/index.php
Normal file
71
web/list/mail/index.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
$TAB = "MAIL";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data & Render page
|
||||
if (empty($_GET["domain"])) {
|
||||
exec(HESTIA_CMD . "v-list-mail-domains $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_mail");
|
||||
} elseif (!empty($_GET["dns"])) {
|
||||
exec(
|
||||
HESTIA_CMD . "v-list-mail-domain " . $user . " " . quoteshellarg($_GET["domain"]) . " json",
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
exec(HESTIA_CMD . "v-list-user-ips " . $user . " json", $output, $return_var);
|
||||
$ips = json_decode(implode("", $output), true);
|
||||
$ips = array_reverse($ips, true);
|
||||
unset($output);
|
||||
exec(
|
||||
HESTIA_CMD .
|
||||
"v-list-mail-domain-dkim-dns " .
|
||||
$user .
|
||||
" " .
|
||||
quoteshellarg($_GET["domain"]) .
|
||||
" json",
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
$dkim = json_decode(implode("", $output), true);
|
||||
$dkim = array_reverse($dkim, true);
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_mail_dns");
|
||||
} else {
|
||||
exec(
|
||||
HESTIA_CMD .
|
||||
"v-list-mail-accounts " .
|
||||
$user .
|
||||
" " .
|
||||
quoteshellarg($_GET["domain"]) .
|
||||
" json",
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
render_page($user, $TAB, "list_mail_acc");
|
||||
}
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
29
web/list/notifications/index.php
Normal file
29
web/list/notifications/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
if ($_REQUEST["ajax"] == 1 && $_REQUEST["token"] == $_SESSION["token"]) {
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-user-notifications $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
foreach ($data as $key => $note) {
|
||||
$note["ID"] = $key;
|
||||
$data[$key] = $note;
|
||||
}
|
||||
echo json_encode($data);
|
||||
exit();
|
||||
}
|
||||
|
||||
$TAB = "NOTIFICATIONS";
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-user-notifications $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_notifications");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
28
web/list/package/index.php
Normal file
28
web/list/package/index.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
$TAB = "PACKAGE";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-user-packages json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_packages");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
63
web/list/rrd/ajax.php
Normal file
63
web/list/rrd/ajax.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
$requestPayload = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
$allowedPeriods = ["daily", "weekly", "monthly", "yearly", "biennially", "triennially"];
|
||||
|
||||
if (!empty($requestPayload["period"]) && in_array($requestPayload["period"], $allowedPeriods)) {
|
||||
$period = $requestPayload["period"];
|
||||
} else {
|
||||
$period = "daily";
|
||||
}
|
||||
|
||||
if (!empty($requestPayload["service"])) {
|
||||
$service = $requestPayload["service"];
|
||||
} else {
|
||||
$service = "la";
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(
|
||||
HESTIA_CMD . "v-export-rrd " . quoteshellarg($service) . " " . quoteshellarg($period),
|
||||
$output,
|
||||
$return_var,
|
||||
);
|
||||
|
||||
if ($return_var != 0) {
|
||||
http_response_code(500);
|
||||
exit("Error fetching RRD data");
|
||||
}
|
||||
|
||||
$serviceUnits = [
|
||||
"la" => "Points",
|
||||
"mem" => "Mbytes",
|
||||
"apache2" => "Connections",
|
||||
"nginx" => "Connections",
|
||||
"mail" => "Queue Size",
|
||||
"ftp" => "Connections",
|
||||
"ssh" => "Connections",
|
||||
];
|
||||
|
||||
if (preg_match("/^net_/", $service)) {
|
||||
$serviceUnits[$service] = "KBytes";
|
||||
}
|
||||
if (preg_match("/^pgsql_/", $service)) {
|
||||
$serviceUnits[$service] = "Queries";
|
||||
}
|
||||
if (preg_match("/^mysql_/", $service)) {
|
||||
$serviceUnits[$service] = "Queries";
|
||||
}
|
||||
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data["service"] = $service;
|
||||
$data["unit"] = $serviceUnits[$service] ?? null;
|
||||
echo json_encode($data);
|
||||
18
web/list/rrd/image.php
Normal file
18
web/list/rrd/image.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
session_start();
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
exit();
|
||||
}
|
||||
$real_path = realpath($_SERVER["DOCUMENT_ROOT"] . $_SERVER["QUERY_STRING"]);
|
||||
if (empty($real_path)) {
|
||||
exit();
|
||||
}
|
||||
$dir_name = dirname($real_path);
|
||||
$dir_name = dirname($dir_name);
|
||||
if ($dir_name != $_SERVER["DOCUMENT_ROOT"] . "/rrd") {
|
||||
exit();
|
||||
}
|
||||
header("X-Accel-Redirect: " . $_SERVER["QUERY_STRING"]);
|
||||
header("Content-Type: image/png");
|
||||
|
||||
?>
|
||||
49
web/list/rrd/index.php
Normal file
49
web/list/rrd/index.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
$TAB = "RRD";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-sys-rrd json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
|
||||
/*
|
||||
if (empty($_GET["period"])) {
|
||||
$period = "day";
|
||||
} elseif (!in_array($_GET["period"], ["day", "week", "month", "year"])) {
|
||||
$period = "day";
|
||||
} else {
|
||||
$period = $_GET["period"];
|
||||
}
|
||||
*/
|
||||
if (empty($_GET["period"])) {
|
||||
$period = "daily";
|
||||
} elseif (
|
||||
!in_array($_GET["period"], [
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly",
|
||||
"yearly",
|
||||
"biennially",
|
||||
"triennially",
|
||||
])
|
||||
) {
|
||||
$period = "daily";
|
||||
} else {
|
||||
$period = $_GET["period"];
|
||||
}
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_rrd");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
140
web/list/server/index.php
Normal file
140
web/list/server/index.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
$TAB = "SERVER";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] !== "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// CPU info
|
||||
if (isset($_GET["cpu"])) {
|
||||
$TAB = "CPU";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-cpu-status", $output, $return_var);
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Memory info
|
||||
if (isset($_GET["mem"])) {
|
||||
$TAB = "MEMORY";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-memory-status", $output, $return_var);
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Disk info
|
||||
if (isset($_GET["disk"])) {
|
||||
$TAB = "DISK";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-disk-status", $output, $return_var);
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Network info
|
||||
if (isset($_GET["net"])) {
|
||||
$TAB = "NETWORK";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-network-status", $output, $return_var);
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Web info
|
||||
if (isset($_GET["web"])) {
|
||||
$TAB = "WEB";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-web-status", $output, $return_var);
|
||||
foreach ($output as $file) {
|
||||
$file = str_replace('border="0"', 'border="1"', $file);
|
||||
$file = str_replace('bgcolor="#ffffff"', "", $file);
|
||||
$file = str_replace('bgcolor="#000000"', 'bgcolor="#282828"', $file);
|
||||
|
||||
echo $file . "\n";
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// DNS info
|
||||
if (isset($_GET["dns"])) {
|
||||
$TAB = "DNS";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-dns-status", $output, $return_var);
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Mail info
|
||||
if (isset($_GET["mail"])) {
|
||||
$TAB = "MAIL";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-mail-status", $output, $return_var);
|
||||
if ($return_var == 0) {
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// DB info
|
||||
if (isset($_GET["db"])) {
|
||||
$TAB = "DB";
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
|
||||
exec(HESTIA_CMD . "v-list-sys-db-status", $output, $return_var);
|
||||
if ($return_var == 0) {
|
||||
foreach ($output as $file) {
|
||||
echo $file . "\n";
|
||||
}
|
||||
}
|
||||
echo "</pre>\n</div>\n</body>\n</html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-sys-info json", $output, $return_var);
|
||||
$sys = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
|
||||
exec(HESTIA_CMD . "v-list-sys-php json", $output, $return_var);
|
||||
$php = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
$phpfpm = [];
|
||||
foreach ($php as $version) {
|
||||
$phpfpm[] = "php" . $version . "-fpm";
|
||||
}
|
||||
|
||||
exec(HESTIA_CMD . "v-list-sys-services json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
ksort($data);
|
||||
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_services");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
11
web/list/server/preview/index.php
Normal file
11
web/list/server/preview/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
$TAB = "SERVER";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_server_preview");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
37
web/list/stats/index.php
Normal file
37
web/list/stats/index.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
$TAB = "STATS";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data
|
||||
if ($_SESSION["userContext"] === "admin" && !isset($_SESSION["look"])) {
|
||||
if (empty($_GET["user"])) {
|
||||
exec(HESTIA_CMD . "v-list-users-stats json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
} else {
|
||||
$v_user = quoteshellarg($_GET["user"]);
|
||||
exec(HESTIA_CMD . "v-list-user-stats $v_user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
exec(HESTIA_CMD . "v-list-sys-users 'json'", $output, $return_var);
|
||||
$users = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
} else {
|
||||
exec(HESTIA_CMD . "v-list-user-stats $user json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_stats");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
25
web/list/updates/index.php
Normal file
25
web/list/updates/index.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$TAB = "UPDATES";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Check user
|
||||
if ($_SESSION["userContext"] != "admin") {
|
||||
header("Location: /list/user");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-sys-hestia-updates json", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
unset($output);
|
||||
exec(HESTIA_CMD . "v-list-sys-hestia-autoupdate plain", $output, $return_var);
|
||||
$autoupdate = $output["0"];
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_updates");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
36
web/list/user/index.php
Normal file
36
web/list/user/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
$TAB = "USER";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Do not show the users list for regular users
|
||||
if ($_SESSION["userContext"] === "user") {
|
||||
header("Location: /login/");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Do not show the users list if user is impersonating another user
|
||||
if (!empty($_SESSION["look"])) {
|
||||
header("Location: /login/");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Data
|
||||
if ($_SESSION["userContext"] === "admin") {
|
||||
exec(HESTIA_CMD . "v-list-users json", $output, $return_var);
|
||||
} else {
|
||||
exec(HESTIA_CMD . "v-list-user " . $user . " json", $output, $return_var);
|
||||
}
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_user");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
26
web/list/web-log/index.php
Normal file
26
web/list/web-log/index.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
use function Hestiacp\quoteshellarg\quoteshellarg;
|
||||
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
$TAB = "WEB";
|
||||
|
||||
$v_domain = quoteshellarg($_GET["domain"]);
|
||||
$type = "access";
|
||||
if ($_GET["type"] == "access") {
|
||||
$type = "access";
|
||||
}
|
||||
if ($_GET["type"] == "error") {
|
||||
$type = "error";
|
||||
}
|
||||
// Header
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_weblog.php";
|
||||
|
||||
exec(HESTIA_CMD . "v-list-web-domain-" . $type . "log $user " . $v_domain, $output, $return_var);
|
||||
|
||||
if ($return_var == 0) {
|
||||
foreach ($output as $file) {
|
||||
echo htmlentities($file) . "\n";
|
||||
}
|
||||
}
|
||||
echo "</pre>\n</body>\n</html>\n";
|
||||
21
web/list/web/index.php
Normal file
21
web/list/web/index.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$TAB = "WEB";
|
||||
|
||||
// Main include
|
||||
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
|
||||
|
||||
// Data
|
||||
exec(HESTIA_CMD . "v-list-web-domains " . $user . " 'json'", $output, $return_var);
|
||||
$data = json_decode(implode("", $output), true);
|
||||
if ($_SESSION["userSortOrder"] == "name") {
|
||||
ksort($data);
|
||||
} else {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
$ips = json_decode(shell_exec(HESTIA_CMD . "v-list-sys-ips json"), true);
|
||||
|
||||
// Render page
|
||||
render_page($user, $TAB, "list_web");
|
||||
|
||||
// Back uri
|
||||
$_SESSION["back"] = $_SERVER["REQUEST_URI"];
|
||||
Reference in New Issue
Block a user