|
1 | 1 | <?php |
| 2 | + |
2 | 3 | ob_start(); |
3 | 4 | $TAB = 'DNS'; |
4 | 5 |
|
|
39 | 40 | $v_domain = escapeshellarg($v_domain); |
40 | 41 | $v_domain = strtolower($v_domain); |
41 | 42 | $v_ip = $_POST['v_ip']; |
| 43 | + // Change NameServers |
| 44 | + if (empty($_POST['v_ns1'])) { |
| 45 | + $_POST['v_ns1'] = ''; |
| 46 | + } |
| 47 | + if (empty($_POST['v_ns2'])) { |
| 48 | + $_POST['v_ns2'] = ''; |
| 49 | + } |
| 50 | + if (empty($_POST['v_ns3'])) { |
| 51 | + $_POST['v_ns3'] = ''; |
| 52 | + } |
| 53 | + if (empty($_POST['v_ns4'])) { |
| 54 | + $_POST['v_ns4'] = ''; |
| 55 | + } |
| 56 | + if (empty($_POST['v_ns5'])) { |
| 57 | + $_POST['v_ns5'] = ''; |
| 58 | + } |
| 59 | + if (empty($_POST['v_ns6'])) { |
| 60 | + $_POST['v_ns6'] = ''; |
| 61 | + } |
| 62 | + if (empty($_POST['v_ns7'])) { |
| 63 | + $_POST['v_ns7'] = ''; |
| 64 | + } |
| 65 | + if (empty($_POST['v_ns8'])) { |
| 66 | + $_POST['v_ns8'] = ''; |
| 67 | + } |
42 | 68 | $v_ns1 = escapeshellarg($_POST['v_ns1']); |
43 | 69 | $v_ns2 = escapeshellarg($_POST['v_ns2']); |
44 | 70 | $v_ns3 = escapeshellarg($_POST['v_ns3']); |
|
54 | 80 | check_return_code($return_var, $output); |
55 | 81 | unset($output); |
56 | 82 | } |
| 83 | + exec(HESTIA_CMD."v-list-user ".$user." json", $output, $return_var); |
| 84 | + $user_config = json_decode(implode('', $output), true); |
| 85 | + unset($output); |
| 86 | + $v_template = $user_config[$user_plain]['DNS_TEMPLATE']; |
57 | 87 |
|
58 | | - // Change domain template |
59 | 88 | if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { |
60 | 89 | $v_template = escapeshellarg($_POST['v_template']); |
61 | 90 | exec(HESTIA_CMD."v-change-dns-domain-tpl ".$user." ".$v_domain." ".$v_template." 'no'", $output, $return_var); |
|
156 | 185 | } |
157 | 186 | } |
158 | 187 |
|
| 188 | +if (empty($v_ns1)) { |
| 189 | + $v_ns1 = ''; |
| 190 | +} |
| 191 | +if (empty($v_ns2)) { |
| 192 | + $v_ns2 = ''; |
| 193 | +} |
| 194 | +if (empty($v_ns3)) { |
| 195 | + $v_ns3 = ''; |
| 196 | +} |
| 197 | +if (empty($v_ns4)) { |
| 198 | + $v_ns4 = ''; |
| 199 | +} |
| 200 | +if (empty($v_ns5)) { |
| 201 | + $v_ns5 = ''; |
| 202 | +} |
| 203 | +if (empty($v_ns6)) { |
| 204 | + $v_ns6 = ''; |
| 205 | +} |
| 206 | +if (empty($v_ns7)) { |
| 207 | + $v_ns7 = ''; |
| 208 | +} |
| 209 | +if (empty($v_ns8)) { |
| 210 | + $v_ns8 = ''; |
| 211 | +} |
159 | 212 |
|
160 | 213 | $v_ns1 = str_replace("'", "", $v_ns1); |
161 | 214 | $v_ns2 = str_replace("'", "", $v_ns2); |
|
193 | 246 | if (empty($v_ns1)) { |
194 | 247 | exec(HESTIA_CMD."v-list-user-ns ".$user." json", $output, $return_var); |
195 | 248 | $nameservers = json_decode(implode('', $output), true); |
| 249 | + for ($i = 0; $i < 8; $i++) { |
| 250 | + if (empty($nameservers[$i])) { |
| 251 | + $nameservers[$i] = ''; |
| 252 | + } |
| 253 | + } |
196 | 254 | $v_ns1 = str_replace("'", "", $nameservers[0]); |
197 | 255 | $v_ns2 = str_replace("'", "", $nameservers[1]); |
198 | 256 | $v_ns3 = str_replace("'", "", $nameservers[2]); |
|
211 | 269 | if (empty($v_rec)) { |
212 | 270 | $v_rec = '@'; |
213 | 271 | } |
| 272 | + if (empty($v_type)) { |
| 273 | + $v_type = ''; |
| 274 | + } |
| 275 | + if (empty($v_val)) { |
| 276 | + $v_val = ''; |
| 277 | + } |
| 278 | + if (empty($v_priority)) { |
| 279 | + $v_priority = ''; |
| 280 | + } |
| 281 | + if (empty($v_ttl)) { |
| 282 | + $v_ttl = ''; |
| 283 | + } |
214 | 284 | render_page($user, $TAB, 'add_dns_rec'); |
215 | 285 | } |
216 | 286 |
|
|
0 commit comments