Add bugfix for bug#84: quote TXT and HINFO records properly default tip
authorPeter Gervai <grin@grin.hu>
Fri, 14 Nov 2008 14:51:47 +0100
changeset 200 6bdfaba077cb
parent 199 bb95eaab943d
Add bugfix for bug#84: quote TXT and HINFO records properly
edit.php
inc/dns.inc.php
inc/record.inc.php
--- a/edit.php	Fri Nov 14 14:43:52 2008 +0100
+++ b/edit.php	Fri Nov 14 14:51:47 2008 +0100
@@ -126,7 +126,7 @@
 				}
 				echo "       </select>\n";
 				echo "      </td>\n";
-				echo "      <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][content]\" value=\"" . $r['content'] . "\"></td>\n";
+				echo "      <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][content]\" value=\"" . ereg_replace( "\"","&quot;", $r['content']) . "\"></td>\n";
 				if ($r['type'] == "MX") { 
 					echo "      <td class=\"u\"><input name=\"record[" . $r['id'] . "][prio]\" value=\"" .  $r['prio'] . "\"></td>\n";
 				} else {
--- a/inc/dns.inc.php	Fri Nov 14 14:43:52 2008 +0100
+++ b/inc/dns.inc.php	Fri Nov 14 14:51:47 2008 +0100
@@ -270,7 +270,7 @@
 	}
 
 	for ($i = 0; ($i < 2); $i++) {
-		if (!preg_match("/^([^\s]{1,1000}|\"([^\"]{1,998}\")$/i", $fields[$i])) {
+		if (!preg_match("/^([^\s]{1,1000}|\"([^\"]{1,998}\"))$/i", $fields[$i])) {
 			error(ERR_DNS_HINFO_INV_CONTENT); return false;
 		}
 	}
--- a/inc/record.inc.php	Fri Nov 14 14:43:52 2008 +0100
+++ b/inc/record.inc.php	Fri Nov 14 14:51:47 2008 +0100
@@ -125,7 +125,7 @@
 				$query = "UPDATE records 
 					SET name=".$db->quote($record['name'], 'text').", 
 					type=".$db->quote($record['type'], 'text').", 
-					content=" . $db->quote($record['content'], 'text') . ", 
+					content=" . $db->quote(addslashes($record['content']), 'text') . ",
 					ttl=".$db->quote($record['ttl'], 'integer').", 
 					prio=".$db->quote($record['prio'], 'integer').", 
 					change_date=".$db->quote(time(), 'integer')."