Commit 352d6a49 authored by Florian Schaal's avatar Florian Schaal

server_ip_add not working by API (Fixes #4884)

parent 2ae1eb77
......@@ -46,11 +46,15 @@ class validate_server {
* Validator function for server-ip
*/
function check_server_ip($field_name, $field_value, $validator) {
if($_POST['ip_type'] == 'IPv4') {
global $app;
$type=(isset($app->remoting_lib->dataRecord['ip_type']))?$app->remoting_lib->dataRecord['ip_type']:$_POST['ip_type'];
if($type == 'IPv4') {
if(!filter_var($field_value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
return $this->get_error($validator['errmsg']);
}
} elseif ($_POST['ip_type'] == 'IPv6') {
} elseif ($type == 'IPv6') {
if(!filter_var($field_value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
return $this->get_error($validator['errmsg']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment