Skip to content

Commit 352d6a4

Browse files
author
Florian Schaal
committed
server_ip_add not working by API (Fixes #4884)
1 parent 2ae1eb7 commit 352d6a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

interface/lib/classes/validate_server.inc.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ function get_error($errmsg) {
4646
* Validator function for server-ip
4747
*/
4848
function check_server_ip($field_name, $field_value, $validator) {
49-
if($_POST['ip_type'] == 'IPv4') {
49+
global $app;
50+
51+
$type=(isset($app->remoting_lib->dataRecord['ip_type']))?$app->remoting_lib->dataRecord['ip_type']:$_POST['ip_type'];
52+
53+
if($type == 'IPv4') {
5054
if(!filter_var($field_value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
5155
return $this->get_error($validator['errmsg']);
5256
}
53-
} elseif ($_POST['ip_type'] == 'IPv6') {
57+
} elseif ($type == 'IPv6') {
5458
if(!filter_var($field_value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
5559
return $this->get_error($validator['errmsg']);
5660
}

0 commit comments

Comments
 (0)