Merge branch 'stable-3.1' into 'stable-3.1'
FIX #3939: Import TXT resource records with semicolons and respecting it's case
I replace the RegEx that ISPConfig uses to see if it must truncate the line sith a semicolon.
Now the line does not get truncated if the semicolon is between quotes.
Later, when ISPConfig lower the case of the parts of the lines, I changed the condition, so it does not lower the case of parts that begin or finish with quotes (First and last part or TXT RRs) or it has a semicolon, meaning it was between quotes and wasn't replaced previously.
See merge request !351
| | |
| | | $line = trim($line); |
| | | if ($line != '' && substr($line, 0, 1) != ';'){ |
| | | if(strpos($line, ";") !== FALSE) { |
| | | if (!preg_match("/v=DKIM|v=DMARC/",$line)) { |
| | | if(!preg_match("/\"[^\"]+;[^\"]*\"/", $line)) { |
| | | $line = substr($line, 0, strpos($line, ";")); |
| | | } |
| | | } |
| | |
| | | $parts = explode(' ', $line); |
| | | |
| | | // make elements lowercase |
| | | $dkim=@($parts[3]=='"v=DKIM1;')?true:false; |
| | | $dmarc=@($parts[3]=='"v=DMARC1;')?true:false; |
| | | |
| | | $new_parts = array(); |
| | | foreach($parts as $part){ |
| | | if(!$dkim && !$dmarc) { |
| | | if( |
| | | (strpos($part, ';') === false) && |
| | | (!preg_match("/^\"/", $part)) && |
| | | (!preg_match("/\"$/", $part)) |
| | | ) { |
| | | $new_parts[] = strtolower($part); |
| | | } else { |
| | | $new_parts[] = $part; |