inc/record.inc.php
changeset 115 b1d7998a903e
parent 111 0a2342a64b83
child 119 f74e4f88b680
--- a/inc/record.inc.php	Sun Mar 30 12:45:05 2008 +0000
+++ b/inc/record.inc.php	Sun Mar 30 13:50:39 2008 +0000
@@ -732,6 +732,9 @@
 function zone_count_ng($perm, $letterstart=all) {
 	global $db;
 	global $sql_regexp;
+
+	$fromTable = 'domains';
+
 	if ($perm != "own" && $perm != "all") {
 		$zone_count = "0";
 	} 
@@ -740,6 +743,7 @@
 		if ($perm == "own") {
 			$sql_add = " AND zones.domain_id = domains.id
 					AND zones.owner = ".$db->quote($_SESSION['userid']);
+			$fromTable .= ',zones';
 		}
 		if ($letterstart!=all && $letterstart!=1) {
 			$sql_add .=" AND domains.name LIKE ".$db->quote($letterstart."%")." ";
@@ -748,8 +752,7 @@
 		}
 
 		$sqlq = "SELECT COUNT(distinct domains.id) AS count_zones 
-			FROM domains,zones 
-			WHERE 1=1
+			FROM ".$fromTable."	WHERE 1=1
 			".$sql_add.";";
 
 		$zone_count = $db->queryOne($sqlq);