[feladat @ 188]
authorrejo
Wed, 26 Mar 2008 10:02:45 +0000
changeset 88 fa948cc3727e
parent 87 654262e698e2
child 89 61c49e66c9b0
[feladat @ 188] Improved error checking of delete_domain function. The ticket:25 has been opened, this is still a problem.
inc/record.inc.php
--- a/inc/record.inc.php	Wed Mar 26 09:31:12 2008 +0000
+++ b/inc/record.inc.php	Wed Mar 26 10:02:45 2008 +0000
@@ -606,14 +606,21 @@
 					WHERE domains.id = " . $db->quote($zone_id) . "
 					AND domains.id = records.domain_id 
 					GROUP BY domains.id";
+		$result = $db->query($query);
+		if (PEAR::isError($result)) { error($result->getMessage()); return false; }
 
-		$response = $db->queryRow($query);
-		if (PEAR::isError($response)) { error($response->getMessage()); return false; }
-		$return = array(
-			"name"		=>	$response['name'],
-			"type"		=>	$response['type'],
-			"master_ip"	=>	$response['master_ip'],
-			"record_count"	=>	$response['record_count']);
+		if($result->numRows() != 1) {
+			error(_('Function returned an error (multiple zones matching this zone ID).'));
+			return false;
+		} else {
+			$r = $result->fetchRow();
+			$return = array(
+				"name"		=>	$r['name'],
+				"type"		=>	$r['type'],
+				"master_ip"	=>	$r['master_ip'],
+				"record_count"	=>	$r['record_count']
+				);
+		}
 		return $return;
 	}
 }