mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
🔒 ♻️ Implement secure exec
wrapper functions.
This commit is contained in:
parent
6e13036780
commit
8e951ac72e
115 changed files with 1345 additions and 1986 deletions
|
@ -9,14 +9,12 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
$user = $_GET['user'];
|
||||
}
|
||||
|
||||
// List backup exclustions
|
||||
exec (VESTA_CMD."v-list-user-backup-exclusions ".$user." 'json'", $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
v_exec('v-list-user-backup-exclusions', [$user, 'json'], true, $output);
|
||||
$data = json_decode($output, true);
|
||||
|
||||
// Parse web
|
||||
$v_username = $user;
|
||||
|
@ -70,9 +68,10 @@ if (!empty($_POST['save'])) {
|
|||
// Check token
|
||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||
header('location: /login/');
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
|
||||
// TODO: Use array?
|
||||
$v_web = $_POST['v_web'];
|
||||
$v_web_tmp = str_replace("\r\n", ",", $_POST['v_web']);
|
||||
$v_web_tmp = rtrim($v_web_tmp, ",");
|
||||
|
@ -112,9 +111,7 @@ if (!empty($_POST['save'])) {
|
|||
unset($mktemp_output);
|
||||
|
||||
// Save changes
|
||||
exec (VESTA_CMD."v-update-user-backup-exclusions ".$user." ".$tmp, $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
v_exec('v-update-user-backup-exclusions', [$user, $tmp]);
|
||||
|
||||
// Set success message
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue