| | |
| | |
|
| | | $parts = explode(".", $field);
|
| | | $i = 0;
|
| | | $empty = 0;
|
| | | foreach ($parts as $part){
|
| | | $i++;
|
| | |
|
| | | if(trim($part) == '') $empty += 1;
|
| | |
|
| | | if(strlen($part) > 63) $error .= $desc." ".$app->tform->wordbook['error_63_characters']."<br>\r\n";
|
| | |
|
| | |
| | | $error .= $desc." ".$app->tform->wordbook['error_no_wildcard_allowed']."<br>\r\n";
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if(substr($field, -1) == '.'){
|
| | | if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
|
| | | } else {
|
| | | if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
|
| | | }
|
| | |
|
| | | if(substr($field, -1) == '.' && $area == 'Name'){
|
| | |
| | | } else {
|
| | | for($n = 0; $n < 4; $n++){
|
| | | $q = $ip_parts[$n];
|
| | | if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
|
| | | if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255 || trim($q) !== $q) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
|
| | | }
|
| | | }
|
| | | $rr['data'] = (int)$ip_parts[0].".".(int)$ip_parts[1].".".(int)$ip_parts[2].".".(int)$ip_parts[3];
|
| | |
| | | break;
|
| | | case "MX":
|
| | | $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
|
| | | $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
|
| | | break;
|
| | | case "NS":
|
| | | $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
|
| | |
| | | break;
|
| | | case "SRV":
|
| | | $error .= $this->validate_srv_data($rr['data'], $rr['zone']);
|
| | | $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
|
| | | break;
|
| | | case "TXT":
|
| | | break;
|
| | | }
|
| | |
|
| | | $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
|
| | |
|
| | | $error .= $this->is_integer($rr['ttl'], $app->tform->wordbook['ttl_txt']);
|
| | |
|
| | |
| | | return $error;
|
| | | }
|
| | |
|
| | | function increase_serial($serial){
|
| | | global $app, $conf;
|
| | |
|
| | | // increase serial
|
| | | $serial_date = substr($serial, 0, 8);
|
| | | $count = intval(substr($serial, 8, 2));
|
| | | $current_date = date("Ymd");
|
| | | if($serial_date >= $current_date){
|
| | | $count += 1;
|
| | | $count = str_pad($count, 2, "0", STR_PAD_LEFT);
|
| | | $new_serial = $serial_date.$count;
|
| | | } else {
|
| | | $new_serial = $current_date.'01';
|
| | | }
|
| | | return $new_serial;
|
| | | }
|
| | |
|
| | | } |