|
20 | 20 | if (empty($_POST['v_dbuser'])) $errors[] = __('username'); |
21 | 21 | if (empty($_POST['v_password'])) $errors[] = __('password'); |
22 | 22 | if (empty($_POST['v_type'])) $errors[] = __('type'); |
| 23 | + if (empty($_POST['v_host'])) $errors[] = __('host'); |
23 | 24 | if (empty($_POST['v_charset'])) $errors[] = __('charset'); |
24 | 25 |
|
25 | 26 | // Check for errors |
|
47 | 48 | $v_password = escapeshellarg($_POST['v_password']); |
48 | 49 | $v_type = $_POST['v_type']; |
49 | 50 | $v_charset = $_POST['v_charset']; |
| 51 | + $v_host = $_POST['v_host']; |
50 | 52 | $v_db_email = $_POST['v_db_email']; |
51 | 53 |
|
52 | 54 | // Check password length |
|
59 | 61 | // Add Database |
60 | 62 | $v_type = escapeshellarg($_POST['v_type']); |
61 | 63 | $v_charset = escapeshellarg($_POST['v_charset']); |
62 | | - exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." 'default' ".$v_charset, $output, $return_var); |
| 64 | + $v_host = escapeshellarg($_POST['v_host']); |
| 65 | + exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." ".$v_host." ".$v_charset, $output, $return_var); |
63 | 66 | $v_type = $_POST['v_type']; |
| 67 | + $v_host = $_POST['v_host']; |
64 | 68 | $v_charset = $_POST['v_charset']; |
65 | 69 | check_return_code($return_var,$output); |
66 | 70 | unset($output); |
|
90 | 94 | $db_types = json_decode(implode('', $output), true); |
91 | 95 | unset($output); |
92 | 96 |
|
| 97 | +$db_hosts = array(); |
| 98 | +foreach ($db_types as $db_type ) { |
| 99 | + exec (VESTA_CMD."v-list-database-hosts ".$db_type." 'json'", $output, $return_var); |
| 100 | + $db_hosts_tmp = json_decode(implode('', $output), true); |
| 101 | + $db_hosts = array_merge($db_hosts, $db_hosts_tmp); |
| 102 | + unset($db_hosts_tmp); |
| 103 | + unset($output); |
| 104 | +} |
| 105 | + |
93 | 106 | include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html'); |
94 | 107 | unset($_SESSION['error_msg']); |
95 | 108 | unset($_SESSION['ok_msg']); |
|
0 commit comments