Skip to content

Commit 9264585

Browse files
authored
Resolve multiple PHP errors (hestiacp#3841)
Fixed PHP errors in nginx-error.log: session_start(): Ignoring session_start() because a session is already active in /usr/local/hestia/web/inc/main.php on line 2" Undefined array key "v_credentials" in /usr/local/hestia/web/edit/mail/index.php on line 754; Undefined variable $hostname in /usr/local/hestia/web/edit/mail/index.php on line 1073 Undefined array key "error_msg" in /usr/local/hestia/web/add/key/index.php on line 34" Undefined array key "v_role" in /usr/local/hestia/web/edit/user/index.php on line 346" Undefined variable $return_var in /usr/local/hestia/web/delete/key/index.php on line 17 Undefined variable $v_aliases in /usr/local/hestia/web/templates/pages/generate_ssl.php on line 23" Undefined array key "v_upgrade_send_notification_email" in /usr/local/hestia/web/edit/server/index.php on line 692 Undefined array key "v_upgrade_send_notification_email" in /usr/local/hestia/web/edit/server/index.php on line 693 Undefined array key "v_debug_mode" in /usr/local/hestia/web/edit/server/index.php on line 410 Undefined array key "userTheme" in /usr/local/hestia/web/edit/user/index.php on line 443 Trying to access array offset on value of type null in /usr/local/hestia/web/login/index.php on line 85; * Fix error when using bulk action but nothing selected * Remove unused endpoints * Update /suspend/* endpoint * Fix bug in access-key * Update renovate.json
1 parent fb60352 commit 9264585

File tree

31 files changed

+194
-105
lines changed

31 files changed

+194
-105
lines changed

renovate.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
":pinAllExceptPeerDependencies",
66
":disableDependencyDashboard",
77
"group:allNonMajor",
8-
"schedule:earlyMondays"
8+
"schedule:weekdays"
99
],
1010
"enabledManagers": ["npm", "composer", "github-actions"],
1111
"ignorePaths": ["**/node_modules/**", "install/deb/filemanager/filegator/composer.json"],
12-
"reviewers": ["jaapmarcus"],
12+
"reviewers": ["jaapmarcus", "krismkenn"],
1313
"branchPrefix": "dependencies"
1414
}

web/add/key/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
$user = quoteshellarg($_GET["user"]);
3232
}
3333

34-
if (!$_SESSION["error_msg"]) {
34+
if (empty($_SESSION["error_msg"])) {
3535
if ($_POST) {
3636
//key if key already exists
3737
exec(HESTIA_CMD . "v-list-user-ssh-key " . $user . " json", $output, $return_var);

web/bulk/access-key/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
exit();
2424
}
2525

26+
if (empty($_POST["key"])) {
27+
header("Location: /list/access-key/");
28+
exit();
29+
}
30+
if (empty($_POST["action"])) {
31+
header("Location: /list/access-key/");
32+
exit();
33+
}
34+
2635
$key = $_POST["key"];
2736
$action = $_POST["action"];
2837

web/bulk/backup/exclusions/index.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

web/bulk/backup/index.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22
use function Hestiacp\quoteshellarg\quoteshellarg;
33

44
ob_start();
5-
65
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
76

7+
if (empty($_POST["backup"])) {
8+
header("Location: /list/backup/");
9+
exit();
10+
}
11+
if (empty($_POST["action"])) {
12+
header("Location: /list/backup/");
13+
exit();
14+
}
15+
816
$backup = $_POST["backup"];
917
$action = $_POST["action"];
1018

web/bulk/cron/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77
// Check token
88
verify_csrf($_POST);
99

10+
if (empty($_POST["job"])) {
11+
header("Location: /list/cron/");
12+
exit();
13+
}
1014
$job = $_POST["job"];
15+
16+
if (empty($_POST["action"])) {
17+
header("Location: /list/cron/");
18+
exit();
19+
}
1120
$action = $_POST["action"];
1221

1322
if ($_SESSION["userContext"] === "admin") {

web/bulk/db/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
// Check token
99
verify_csrf($_POST);
1010

11+
if (empty($_POST["database"])) {
12+
header("Location: /list/db/");
13+
exit();
14+
}
15+
16+
if (empty($_POST["action"])) {
17+
header("Location: /list/db/");
18+
exit();
19+
}
1120
$database = $_POST["database"];
1221
$action = $_POST["action"];
1322

web/bulk/dns/index.php

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,26 @@
88
// Check token
99
verify_csrf($_POST);
1010

11+
if (empty($_POST["domain"])) {
12+
header("Location: /list/dns/");
13+
exit();
14+
}
15+
16+
if (empty($_POST["action"])) {
17+
header("Location: /list/dns/");
18+
exit();
19+
}
20+
1121
$domain = $_POST["domain"];
12-
$record = $_POST["record"];
22+
if (empty($_POST["record"])) {
23+
$record = "";
24+
} else {
25+
$record = $_POST["record"];
26+
}
1327
$action = $_POST["action"];
1428

1529
if ($_SESSION["userContext"] === "admin") {
16-
if (empty($record)) {
30+
if (empty($_POST["record"])) {
1731
switch ($action) {
1832
case "rebuild":
1933
$cmd = "v-rebuild-dns-domain";
@@ -48,7 +62,7 @@
4862
}
4963
}
5064
} else {
51-
if (empty($record)) {
65+
if (empty($_POST["record"])) {
5266
switch ($action) {
5367
case "delete":
5468
$cmd = "v-delete-dns-domain";
@@ -69,12 +83,16 @@
6983
}
7084
}
7185

72-
if (empty($record)) {
73-
foreach ($domain as $value) {
74-
// DNS
75-
$value = quoteshellarg($value);
76-
exec(HESTIA_CMD . $cmd . " " . $user . " " . $value . " no", $output, $return_var);
77-
$restart = "yes";
86+
if (empty($_POST["record"])) {
87+
if (is_array($_POST["domain"])) {
88+
foreach ($domain as $value) {
89+
// DNS
90+
$value = quoteshellarg($value);
91+
exec(HESTIA_CMD . $cmd . " " . $user . " " . $value . " no", $output, $return_var);
92+
$restart = "yes";
93+
}
94+
} else {
95+
header("Location: /list/dns/?domain=" . $domain);
7896
}
7997
} else {
8098
foreach ($record as $value) {
@@ -94,7 +112,7 @@
94112
exec(HESTIA_CMD . "v-restart-dns", $output, $return_var);
95113
}
96114

97-
if (empty($record)) {
115+
if (empty($_POST["record"])) {
98116
header("Location: /list/dns/");
99117
exit();
100118
} else {

web/bulk/firewall/banlist/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
exit();
1616
}
1717

18+
if (empty($_POST["ipchain"])) {
19+
header("Location: /list/firewall/banlist/");
20+
exit();
21+
}
22+
if (empty($_POST["action"])) {
23+
header("Location: /list/firewall/banlist/");
24+
exit();
25+
}
26+
1827
$ipchain = $_POST["ipchain"];
1928
$action = $_POST["action"];
2029

web/bulk/firewall/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
exit();
1616
}
1717

18+
if (empty($_POST["rule"])) {
19+
header("Location: /list/firewall/");
20+
exit();
21+
}
22+
if (empty($_POST["action"])) {
23+
header("Location: /list/firewall/");
24+
exit();
25+
}
26+
1827
$rule = $_POST["rule"];
1928
$action = $_POST["action"];
2029

0 commit comments

Comments
 (0)