|
93 | 93 | $ips = json_decode(implode('', $output), true); |
94 | 94 | unset($output); |
95 | 95 |
|
| 96 | +$v_ip_public = empty($ips[$v_ip]['NAT']) ? $v_ip : $ips[$v_ip]['NAT']; |
| 97 | + |
96 | 98 | // List web templates |
97 | 99 | exec (HESTIA_CMD."v-list-web-templates json", $output, $return_var); |
98 | 100 | $templates = json_decode(implode('', $output), true); |
|
130 | 132 | } |
131 | 133 |
|
132 | 134 | // Change web domain IP |
133 | | - |
| 135 | + $v_newip=''; |
| 136 | + $v_newip_public=''; |
| 137 | + |
| 138 | + if(!empty($_POST['v_ip'])) { |
| 139 | + $v_newip = $_POST['v_ip']; |
| 140 | + $v_newip_public = empty($ips[$v_newip]['NAT']) ? $v_newip : $ips[$v_newip]['NAT']; |
| 141 | + } |
| 142 | + |
134 | 143 | if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) { |
135 | 144 | exec (HESTIA_CMD."v-change-web-domain-ip ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v_ip'])." 'no'", $output, $return_var); |
136 | 145 | check_return_code($return_var,$output); |
|
144 | 153 | exec (HESTIA_CMD."v-list-dns-domain ".$v_username." ".escapeshellarg($v_domain)." json", $output, $return_var); |
145 | 154 | unset($output); |
146 | 155 | if ($return_var == 0 ) { |
147 | | - exec (HESTIA_CMD."v-change-dns-domain-ip ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v_ip'])." 'no'", $output, $return_var); |
| 156 | + exec (HESTIA_CMD."v-change-dns-domain-ip ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_newip_public)." 'no'", $output, $return_var); |
148 | 157 | check_return_code($return_var,$output); |
149 | 158 | unset($output); |
150 | 159 | $restart_dns = 'yes'; |
|
157 | 166 | exec (HESTIA_CMD."v-list-dns-domain ".$v_username." ".escapeshellarg($v_alias)." json", $output, $return_var); |
158 | 167 | unset($output); |
159 | 168 | if ($return_var == 0 ) { |
160 | | - exec (HESTIA_CMD."v-change-dns-domain-ip ".$v_username." ".escapeshellarg($v_alias)." ".escapeshellarg($_POST['v_ip']), $output, $return_var); |
| 169 | + exec (HESTIA_CMD."v-change-dns-domain-ip ".$v_username." ".escapeshellarg($v_alias)." ".escapeshellarg($v_newip_public), $output, $return_var); |
161 | 170 | check_return_code($return_var,$output); |
162 | 171 | unset($output); |
163 | 172 | $restart_dns = 'yes'; |
|
215 | 224 | exec (HESTIA_CMD."v-list-dns-domain ".$v_username." ".escapeshellarg($v_domain), $output, $return_var); |
216 | 225 | unset($output); |
217 | 226 | if ($return_var == 0) { |
218 | | - exec (HESTIA_CMD."v-add-dns-on-web-alias ".$v_username." ".escapeshellarg($alias)." ".$v_ip." no", $output, $return_var); |
| 227 | + exec (HESTIA_CMD."v-add-dns-on-web-alias ".$v_username." ".escapeshellarg($alias)." ".escapeshellarg($v_newip_public ?: $v_ip_public)." no", $output, $return_var); |
219 | 228 | check_return_code($return_var,$output); |
220 | 229 | unset($output); |
221 | 230 | $restart_dns = 'yes'; |
|
0 commit comments