inc/record.inc.php
changeset 106 41d05ff53708
parent 98 9c10fd623368
child 111 0a2342a64b83
equal deleted inserted replaced
105:df46fd74c2ee 106:41d05ff53708
   150 		error(ERR_PERM_ADD_RECORD);
   150 		error(ERR_PERM_ADD_RECORD);
   151 		return false;
   151 		return false;
   152 	} else {
   152 	} else {
   153 		if (validate_input($zoneid, $type, $content, $name, $prio, $ttl) ) {
   153 		if (validate_input($zoneid, $type, $content, $name, $prio, $ttl) ) {
   154 			$change = time();
   154 			$change = time();
   155 			$query = "INSERT INTO records VALUES ('',"
   155 			$query = "INSERT INTO records (domain_id, name, type, content, ttl, prio, change_date) VALUES ("
   156 						. $db->quote($zoneid) . ","
   156 						. $db->quote($zoneid) . ","
   157 						. $db->quote($name) . "," 
   157 						. $db->quote($name) . "," 
   158 						. $db->quote($type) . "," 
   158 						. $db->quote($type) . "," 
   159 						. $db->quote($content) . ","
   159 						. $db->quote($content) . ","
   160 						. $db->quote($ttl) . ","
   160 						. $db->quote($ttl) . ","
   322 				if ($empty && $domain_id) {
   322 				if ($empty && $domain_id) {
   323 					$ns1 = $GLOBALS['NS1'];
   323 					$ns1 = $GLOBALS['NS1'];
   324 					$hm  = $GLOBALS['HOSTMASTER'];
   324 					$hm  = $GLOBALS['HOSTMASTER'];
   325 					$ttl = $GLOBALS['DEFAULT_TTL'];
   325 					$ttl = $GLOBALS['DEFAULT_TTL'];
   326 
   326 
   327 					$query = "INSERT INTO records VALUES (''," 
   327 					$query = "INSERT INTO records (domain_id, name, content, type, ttl, prio, change_date) VALUES (" 
   328 							. $db->quote($domain_id) . "," 
   328 							. $db->quote($domain_id) . "," 
   329 							. $db->quote($domain) . "," 
   329 							. $db->quote($domain) . "," 
   330 							. "'SOA',"
   330 							. $db->quote('SOA').","
   331 							. $db->quote($ns1.' '.$hm.' 1') . ","
   331 							. $db->quote($ns1.' '.$hm.' 1') . ","
   332 							. $db->quote($ttl) 
   332 							. $db->quote($ttl) 
   333 							. ", 0, "
   333 							. ", 0, "
   334 							. $db->quote($now).")";
   334 							. $db->quote($now).")";
   335 					$response = $db->query($query);
   335 					$response = $db->query($query);
   348 
   348 
   349 							if (!$ttl) {
   349 							if (!$ttl) {
   350 								$ttl = $GLOBALS["DEFAULT_TTL"];
   350 								$ttl = $GLOBALS["DEFAULT_TTL"];
   351 							}
   351 							}
   352 
   352 
   353 							$query = "INSERT INTO records VALUES (''," 
   353 							$query = "INSERT INTO records (domain_id, name, type, content, ttl, prio, change_date) VALUES (" 
   354 									. $db->quote($domain_id) . ","
   354 									. $db->quote($domain_id) . ","
   355 									. $db->quote($name) . ","
   355 									. $db->quote($name) . ","
   356 									. $db->quote($type) . ","
   356 									. $db->quote($type) . ","
   357 									. $db->quote($content) . ","
   357 									. $db->quote($content) . ","
   358 									. $db->quote($ttl) . ","
   358 									. $db->quote($ttl) . ","
   359 									. $db->quote($prio) . ","
   359 									. $db->quote($prio) . ","
   360 									. $db->quote($now) . ")";
   360 									. $db->quote($now) . ")";
   361 							echo "<pre>" . $query . "</pre>";
       
   362 							$response = $db->query($query);
   361 							$response = $db->query($query);
   363 							if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   362 							if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   364 						}
   363 						}
   365 					}
   364 					}
   366 					return true;
   365 					return true;
   707 			COUNT(DISTINCT records.id) AS count_records
   706 			COUNT(DISTINCT records.id) AS count_records
   708 			FROM domains
   707 			FROM domains
   709 			LEFT JOIN zones ON domains.id=zones.domain_id 
   708 			LEFT JOIN zones ON domains.id=zones.domain_id 
   710 			LEFT JOIN records ON records.domain_id=domains.id
   709 			LEFT JOIN records ON records.domain_id=domains.id
   711 			WHERE 1=1".$sql_add." 
   710 			WHERE 1=1".$sql_add." 
   712 			GROUP BY domains.name, domains.id
   711 			GROUP BY domains.name, domains.id, domains.type
   713 			ORDER BY domains.name";
   712 			ORDER BY domains.name";
   714 	
   713 	
   715 	$db->setLimit($rowamount, $rowstart);
   714 	$db->setLimit($rowamount, $rowstart);
   716 	$result = $db->query($sqlq);
   715 	$result = $db->query($sqlq);
   717 
   716