diff --git a/web/edit/user/index.php b/web/edit/user/index.php index 0fbc9b21..26eb34d6 100644 --- a/web/edit/user/index.php +++ b/web/edit/user/index.php @@ -155,6 +155,113 @@ if ($_SESSION['user'] == 'admin') { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html'); unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); +} else { + // Check user argument? + if (empty($_GET['user'])) { + header("Location: /list/user/"); + exit; + } + + // Check user + $v_username = escapeshellarg($_GET['user']); + exec (VESTA_CMD."v_list_user ".$v_username." json", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = 'Error: vesta did not return any output.'; + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $_GET['user']; + $v_password = "••••••••"; + $v_email = $data[$v_username]['CONTACT']; + $v_fname = $data[$v_username]['FNAME']; + $v_lname = $data[$v_username]['LNAME']; + $v_ns = $data[$v_username]['NS']; + $nameservers = explode(", ", $v_ns); + $v_ns1 = $nameservers[0]; + $v_ns2 = $nameservers[1]; + $v_ns3 = $nameservers[2]; + $v_ns4 = $nameservers[3]; + $v_suspended = $data[$v_username]['SUSPENDED']; + if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; + } else { + $v_status = 'active'; + } + $v_time = $data[$v_username]['TIME']; + $v_date = $data[$v_username]['DATE']; + + } + + // Action + if (!empty($_POST['save'])) { + $v_username = escapeshellarg($_POST['v_username']); + + // Change password + if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + $v_password = escapeshellarg($_POST['v_password']); + exec (VESTA_CMD."v_change_user_password ".$v_username." ".$v_password, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = 'Error: vesta did not return any output.'; + $_SESSION['error_msg'] = $error; + } + $v_password = "••••••••"; + unset($output); + } + + // Change contact email + if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) { + $v_email = escapeshellarg($_POST['v_email']); + exec (VESTA_CMD."v_change_user_contact ".$v_username." ".$v_email, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = 'Error: vesta did not return any output.'; + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Change Name + if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) { + $v_fname = escapeshellarg($_POST['v_fname']); + $v_lname = escapeshellarg($_POST['v_lname']); + exec (VESTA_CMD."v_change_user_name ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = 'Error: vesta did not return any output.'; + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Change NameServers + if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) { + $v_ns1 = escapeshellarg($_POST['v_ns1']); + $v_ns2 = escapeshellarg($_POST['v_ns2']); + $v_ns3 = escapeshellarg($_POST['v_ns3']); + $v_ns4 = escapeshellarg($_POST['v_ns4']); + $ns_cmd = VESTA_CMD."v_change_user_ns ".$v_username." ".$v_ns1." ".$v_ns2; + if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3; + if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4; + exec ($ns_cmd, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = 'Error: vesta did not return any output.'; + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_edit_user.html'); + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); } // Footer diff --git a/web/inc/main.php b/web/inc/main.php index 0f262017..7f17ebeb 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -39,7 +39,7 @@ function top_panel($user, $TAB) { if ( $user == 'admin' ) { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html'); } else { - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html'); + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/panel.html'); } } diff --git a/web/list/user/index.php b/web/list/user/index.php index e691a60b..79dcf385 100644 --- a/web/list/user/index.php +++ b/web/list/user/index.php @@ -26,6 +26,15 @@ if ($_SESSION['user'] == 'admin') { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_user.html'); include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_user.html'); +} else { + exec (VESTA_CMD."v_list_user ".$user." json", $output, $return_var); + check_error($return_var); + $data = json_decode(implode('', $output), true); + $data = array_reverse($data); + unset($output); + + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_user.html'); + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_user.html'); } diff --git a/web/templates/admin/add_dns.html b/web/templates/admin/add_dns.html index bab3b3ec..b825def3 100644 --- a/web/templates/admin/add_dns.html +++ b/web/templates/admin/add_dns.html @@ -60,3 +60,4 @@ +
diff --git a/web/templates/admin/add_mail.html b/web/templates/admin/add_mail.html index fdd48b2d..e09a9223 100644 --- a/web/templates/admin/add_mail.html +++ b/web/templates/admin/add_mail.html @@ -27,3 +27,4 @@ +
\ No newline at end of file diff --git a/web/templates/admin/add_mail_acc.html b/web/templates/admin/add_mail_acc.html index 5ee9853d..d3d14d09 100644 --- a/web/templates/admin/add_mail_acc.html +++ b/web/templates/admin/add_mail_acc.html @@ -59,3 +59,4 @@ +
\ No newline at end of file diff --git a/web/templates/admin/list_backup.html b/web/templates/admin/list_backup.html index abe5ee82..efa2831e 100644 --- a/web/templates/admin/list_backup.html +++ b/web/templates/admin/list_backup.html @@ -130,4 +130,6 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_cron.html b/web/templates/admin/list_cron.html index 6ff3781c..b83f1422 100644 --- a/web/templates/admin/list_cron.html +++ b/web/templates/admin/list_cron.html @@ -146,4 +146,6 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_db.html b/web/templates/admin/list_db.html index 92a0b4e5..6499d845 100644 --- a/web/templates/admin/list_db.html +++ b/web/templates/admin/list_db.html @@ -131,4 +131,6 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_dns.html b/web/templates/admin/list_dns.html index b2608ae2..9e8bfa16 100644 --- a/web/templates/admin/list_dns.html +++ b/web/templates/admin/list_dns.html @@ -128,4 +128,6 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_dns_rec.html b/web/templates/admin/list_dns_rec.html index 90286017..d947ca57 100644 --- a/web/templates/admin/list_dns_rec.html +++ b/web/templates/admin/list_dns_rec.html @@ -111,4 +111,7 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_ip.html b/web/templates/admin/list_ip.html index 02e454c1..ce575db7 100644 --- a/web/templates/admin/list_ip.html +++ b/web/templates/admin/list_ip.html @@ -94,4 +94,6 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_log.html b/web/templates/admin/list_log.html index 81388628..e95ac4f4 100644 --- a/web/templates/admin/list_log.html +++ b/web/templates/admin/list_log.html @@ -44,4 +44,7 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_mail.html b/web/templates/admin/list_mail.html index 26aa48a5..94b30058 100644 --- a/web/templates/admin/list_mail.html +++ b/web/templates/admin/list_mail.html @@ -134,4 +134,6 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_mail_acc.html b/web/templates/admin/list_mail_acc.html index 0e8766ab..789dc1c5 100644 --- a/web/templates/admin/list_mail_acc.html +++ b/web/templates/admin/list_mail_acc.html @@ -124,5 +124,8 @@ foreach ($data as $key => $value) { ?> + -"; ?> +"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_stats.html b/web/templates/admin/list_stats.html index 111995fe..5b3181fb 100644 --- a/web/templates/admin/list_stats.html +++ b/web/templates/admin/list_stats.html @@ -91,4 +91,5 @@ foreach ($data as $key => $value) { listed -"; ?> +"; ?> +"; ?> diff --git a/web/templates/admin/list_user.html b/web/templates/admin/list_user.html index d348b8cc..ce5ad522 100644 --- a/web/templates/admin/list_user.html +++ b/web/templates/admin/list_user.html @@ -191,4 +191,4 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> diff --git a/web/templates/admin/list_web.html b/web/templates/admin/list_web.html index 70d1366f..838b4c73 100644 --- a/web/templates/admin/list_web.html +++ b/web/templates/admin/list_web.html @@ -155,4 +155,5 @@ foreach ($data as $key => $value) { -"; ?> +"; ?> +"; ?> diff --git a/web/templates/header.html b/web/templates/header.html index e3f151d2..c8441ad5 100644 --- a/web/templates/header.html +++ b/web/templates/header.html @@ -261,7 +261,6 @@ if (!empty($_SESSION['look'])) { .data-spacer { margin: 0; width: 990px; - height: 230px; } .data-add {