From a8491e0e2a7f887eb075e3235c3b2f30233cea1a Mon Sep 17 00:00:00 2001 From: Stricted Date: Wed, 3 Aug 2016 16:09:02 +0200 Subject: [PATCH] update bind9.php --- bind9.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bind9.php b/bind9.php index 3133c6a..f34bc2a 100644 --- a/bind9.php +++ b/bind9.php @@ -38,14 +38,18 @@ if (is_array($data) && !isset($data['error'])) { else if ($record['type'] == "TXT") { $txt = $record['data']; - if (strpos($txt, " ") !== false) { - if (substr($txt, -1) != '"' && substr($txt, 0, 1) != '"') { - $record['data'] = '"'.$txt.'"'; + if (strpos($txt, " ") !== false && strpos($txt, '" "') !== false && $txt != '" "') { + if (substr($txt, 0, 1) != '(' && substr($txt, -1) != ')') { + if (substr($txt, 0, 1) != '"' && substr($txt, -1) != '"') { + $record['data'] = '("'.$txt.'")'; + } + else { + $record['data'] = '('.$txt.')'; + } } } - - if (strpos($txt, '" "') !== false && $txt != '" "') { - $record['data'] = '('.$record['data'].')'; // for dkim records + else if (substr($txt, 0, 1) != '"' && substr($txt, -1) != '"') { + $record['data'] = '"'.$txt.'"'; } if (strpos($record['data'], "v=spf1") !== false) { -- 2.20.1