From d84a2dcb1ac84283fc26df96401c8e21f5d39c62 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Wed, 21 Jan 2015 12:38:10 +0100
Subject: [PATCH] fixed sql-queries in dns_dmarc_edit.php

---
 interface/web/dns/dns_dmarc_edit.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/interface/web/dns/dns_dmarc_edit.php b/interface/web/dns/dns_dmarc_edit.php
index c3c219d381..e18e91eba3 100644
--- a/interface/web/dns/dns_dmarc_edit.php
+++ b/interface/web/dns/dns_dmarc_edit.php
@@ -227,14 +227,14 @@ class page_action extends tform_actions {
 		$domain_name = rtrim($soa['origin'], '.');
 		// DMARC requieres at least one active dkim-record...
 		$sql = "SELECT * FROM dns_rr WHERE name LIKE ? AND type='TXT' AND data like 'v=DKIM1;%' AND active='Y'";
-		$temp = $app->db->queryAllRecords($sql, '%._domainkey.$domain_name'.'.');
-		if (!is_array($temp)) {
+		$temp = $app->db->queryAllRecords($sql, '%._domainkey.'.$domain_name.'.');
+		if (empty($temp)) {
 			if (isset($app->tform->errorMessage )) $app->tform->errorMessage = '<br/>' . $app->tform->errorMessage;
 			$app->tform->errorMessage .= $app->tform->wordbook['dmarc_no_dkim_txt'].$email;
 		}
 
 		// ... and an active spf-record (this breaks the current draft but DMARC is useless if you use DKIM or SPF
-		$sql = "SELECT * FROM dns_rr WHERE name LIKE ? AND type='TXT' AND (data LIKE 'v=spf1;%' AND active = 'y')";
+		$sql = "SELECT * FROM dns_rr WHERE name LIKE ? AND type='TXT' AND (data LIKE 'v=spf1%' AND active = 'y')";
 		$temp = $app->db->queryAllRecords($sql, $domain_name.'.');
 		// abort if more than 1 active spf-records (backward-compatibility)
 		if (is_array($temp[1])) {
-- 
GitLab