Skip to content

Commit 3b32cd8

Browse files
author
Kristan Kenney
committed
Change hooks to use login context
1 parent 46407ee commit 3b32cd8

File tree

8 files changed

+12
-9
lines changed

8 files changed

+12
-9
lines changed

web/inc/main.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ function render_page($user, $TAB, $page) {
129129
extract($GLOBALS, EXTR_SKIP);
130130

131131
// Body
132-
if (($_SESSION['user'] !== 'admin') && (@include($__template_dir . "user/$page.html"))) {
132+
// if (($_SESSION['user'] !== 'admin') && (@include($__template_dir . "user/$page.html"))) {
133+
if (($_SESSION['loginContext'] == 'admin') && (@include($__template_dir . "user/$page.html"))) {
133134
// User page loaded
134135
} else {
135136
// Not admin or user page doesn't exist

web/list/server/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
77

88
// Check user
9-
if ($_SESSION['user'] != 'admin') {
9+
if ($_SESSION['userContext'] !== "admin") {
1010
header("Location: /list/user");
1111
exit;
1212
}

web/list/user/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
77

88
// Data
9-
if ($user == 'admin') {
9+
if ($_SESSION['loginContext'] == 'admin') {
1010
exec (HESTIA_CMD . "v-list-users json", $output, $return_var);
1111
} else {
1212
exec (HESTIA_CMD . "v-list-user ".$user." json", $output, $return_var);

web/login/index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ function authenticate_user($user, $password, $twofa = ''){
124124
// exec (HESTIA_CMD . "v-list-user admin json", $output, $return_var);
125125
// $data = json_decode(implode('', $output), true);
126126
// unset($output);
127+
128+
$_SESSION['userContext'] = 'admin';
129+
} else {
130+
$_SESSION['userContext'] = 'user';
127131
}
128132
// Define session user
129133
$_SESSION['user'] = key($data);

web/restart/service/index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
// Init
33
error_reporting(NULL);
4-
ob_start();
5-
session_start();
64
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
75

86
// Check token
@@ -11,7 +9,7 @@
119
exit();
1210
}
1311

14-
if ($_SESSION['user'] == 'admin') {
12+
if ($_SESSION['userContext'] == "admin") {
1513
if (!empty($_GET['srv'])) {
1614
if ($_GET['srv'] == 'iptables') {
1715
exec (HESTIA_CMD."v-update-firewall", $output, $return_var);

web/start/service/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
exit();
1212
}
1313

14-
if ($_SESSION['user'] == 'admin') {
14+
if ($_SESSION['userContext'] == "admin") {
1515
if (!empty($_GET['srv'])) {
1616
if ($_GET['srv'] == 'iptables') {
1717
exec (HESTIA_CMD."v-update-firewall", $output, $return_var);

web/stop/service/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
exit();
1212
}
1313

14-
if ($_SESSION['user'] == 'admin') {
14+
if ($_SESSION['userContext'] == "admin") {
1515
if (!empty($_GET['srv'])) {
1616
if ($_GET['srv'] == 'iptables') {
1717
exec (HESTIA_CMD."v-stop-firewall", $output, $return_var);

web/update/hestia/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
exit();
1212
}
1313

14-
if ($_SESSION['user'] == 'admin') {
14+
if ($_SESSION['userContext'] == "admin") {
1515
if (!empty($_GET['pkg'])) {
1616
$v_pkg = escapeshellarg($_GET['pkg']);
1717
exec (HESTIA_CMD."v-update-sys-hestia ".$v_pkg, $output, $return_var);

0 commit comments

Comments
 (0)