|
13 | 13 | // Panel |
14 | 14 | top_panel($user,$TAB); |
15 | 15 |
|
16 | | - // Check user argument? |
17 | | - if (empty($_GET['database'])) { |
18 | | - header("Location: /list/db/"); |
19 | | - exit; |
20 | | - } |
| 16 | +$lang = 'ru_RU.utf8'; |
| 17 | +setlocale(LC_ALL, $lang); |
21 | 18 |
|
22 | | - // Edit as someone else? |
23 | | - if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { |
24 | | - $user=escapeshellarg($_GET['user']); |
25 | | - } |
| 19 | +if (empty($_GET['database'])) { |
| 20 | + header("Location: /list/db/"); |
| 21 | + exit; |
| 22 | +} |
| 23 | + |
| 24 | +// Edit as someone else? |
| 25 | +if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { |
| 26 | + $user=escapeshellarg($_GET['user']); |
| 27 | +} |
26 | 28 |
|
27 | | - $v_database = escapeshellarg($_GET['database']); |
28 | | - exec (VESTA_CMD."v-list-database ".$user." ".$v_database." 'json'", $output, $return_var); |
29 | | - if ($return_var != 0) { |
30 | | - $error = implode('<br>', $output); |
31 | | - if (empty($error)) $error = _('Error: vesta did not return any output.'); |
32 | | - $_SESSION['error_msg'] = $error; |
| 29 | +$v_database = escapeshellarg($_GET['database']); |
| 30 | +exec (VESTA_CMD."v-list-database ".$user." ".$v_database." 'json'", $output, $return_var); |
| 31 | +if ($return_var != 0) { |
| 32 | + $error = implode('<br>', $output); |
| 33 | + if (empty($error)) $error = _('Error: vesta did not return any output.'); |
| 34 | + $_SESSION['error_msg'] = $error; |
| 35 | +} else { |
| 36 | + $data = json_decode(implode('', $output), true); |
| 37 | + unset($output); |
| 38 | + $v_username = $user; |
| 39 | + $v_database = $_GET['database']; |
| 40 | + $v_dbuser = $data[$v_database]['DBUSER']; |
| 41 | + $v_password = "••••••••"; |
| 42 | + $v_host = $data[$v_database]['HOST']; |
| 43 | + $v_type = $data[$v_database]['TYPE']; |
| 44 | + $v_charset = $data[$v_database]['CHARSET']; |
| 45 | + $v_date = $data[$v_database]['DATE']; |
| 46 | + $v_time = $data[$v_database]['TIME']; |
| 47 | + $v_suspended = $data[$v_database]['SUSPENDED']; |
| 48 | + if ( $v_suspended == 'yes' ) { |
| 49 | + $v_status = 'suspended'; |
33 | 50 | } else { |
34 | | - $data = json_decode(implode('', $output), true); |
35 | | - unset($output); |
36 | | - $v_username = $user; |
37 | | - $v_database = $_GET['database']; |
38 | | - $v_dbuser = $data[$v_database]['DBUSER']; |
39 | | - $v_password = "••••••••"; |
40 | | - $v_host = $data[$v_database]['HOST']; |
41 | | - $v_type = $data[$v_database]['TYPE']; |
42 | | - $v_charset = $data[$v_database]['CHARSET']; |
43 | | - $v_date = $data[$v_database]['DATE']; |
44 | | - $v_time = $data[$v_database]['TIME']; |
45 | | - $v_suspended = $data[$v_database]['SUSPENDED']; |
46 | | - if ( $v_suspended == 'yes' ) { |
47 | | - $v_status = 'suspended'; |
48 | | - } else { |
49 | | - $v_status = 'active'; |
50 | | - } |
| 51 | + $v_status = 'active'; |
| 52 | + } |
51 | 53 |
|
52 | | - // Action |
53 | | - if (!empty($_POST['save'])) { |
54 | | - $v_username = $user; |
55 | | - // Change password |
56 | | - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { |
57 | | - $v_password = escapeshellarg($_POST['v_password']); |
58 | | - exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var); |
59 | | - if ($return_var != 0) { |
60 | | - $error = implode('<br>', $output); |
61 | | - if (empty($error)) $error = _('Error: vesta did not return any output.'); |
62 | | - $_SESSION['error_msg'] = $error; |
63 | | - } |
64 | | - $v_password = "••••••••"; |
65 | | - unset($output); |
66 | | - } |
67 | | - if (empty($_SESSION['error_msg'])) { |
68 | | - $_SESSION['ok_msg'] = _('OK: changes has been saved.'); |
| 54 | + // Action |
| 55 | + if (!empty($_POST['save'])) { |
| 56 | + $v_username = $user; |
| 57 | + // Change password |
| 58 | + if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { |
| 59 | + $v_password = escapeshellarg($_POST['v_password']); |
| 60 | + exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var); |
| 61 | + if ($return_var != 0) { |
| 62 | + $error = implode('<br>', $output); |
| 63 | + if (empty($error)) $error = _('Error: vesta did not return any output.'); |
| 64 | + $_SESSION['error_msg'] = $error; |
69 | 65 | } |
| 66 | + $v_password = "••••••••"; |
| 67 | + unset($output); |
| 68 | + } |
| 69 | + if (empty($_SESSION['error_msg'])) { |
| 70 | + $_SESSION['ok_msg'] = _('OK: changes has been saved.'); |
70 | 71 | } |
71 | 72 | } |
| 73 | +} |
72 | 74 |
|
73 | | - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html'); |
74 | | - unset($_SESSION['error_msg']); |
75 | | - unset($_SESSION['ok_msg']); |
76 | | -//} |
| 75 | +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html'); |
| 76 | +unset($_SESSION['error_msg']); |
| 77 | +unset($_SESSION['ok_msg']); |
77 | 78 |
|
78 | 79 | // Footer |
79 | 80 | include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); |
0 commit comments