inc/record.inc.php
changeset 98 9c10fd623368
parent 93 92901b76946a
child 106 41d05ff53708
equal deleted inserted replaced
97:090be08858db 98:9c10fd623368
   236 
   236 
   237 function get_record_details_from_record_id($rid) {
   237 function get_record_details_from_record_id($rid) {
   238 
   238 
   239 	global $db;
   239 	global $db;
   240 
   240 
   241 	$query = "SELECT * FROM records WHERE id = " . $db->quote($rid) ;
   241 	$query = "SELECT id AS rid, domain_id AS zid, name, type, content, ttl, prio, change_date FROM records WHERE id = " . $db->quote($rid) ;
   242 
   242 
   243 	$response = $db->query($query);
   243 	$response = $db->query($query);
   244 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   244 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   245 
   245 	
   246 	while ($r = $response->fetchRow()) {
   246 	$return = $response->fetchRow();
   247 		$return[] = array(
       
   248 			"rid"		=>	$r['id'],
       
   249 			"zid"		=>	$r['domain_id'],
       
   250 			"name"		=>	$r['name'],
       
   251 			"type"		=>	$r['type'],
       
   252 			"content"	=>	$r['content'],
       
   253 			"ttl"		=>	$r['ttl'],
       
   254 			"prio"		=>	$r['prio'],
       
   255 			"change_date"	=>	$r['change_date']);
       
   256 	}
       
   257 	return $return;
   247 	return $return;
   258 }
   248 }
   259 
   249 
   260 /*
   250 /*
   261  * Delete a record by a given id.
   251  * Delete a record by a given id.
   275 
   265 
   276 	if ( $perm_content_edit == "all" || ($perm_content_edit == "own" && $user_is_zone_owner == "0" )) {
   266 	if ( $perm_content_edit == "all" || ($perm_content_edit == "own" && $user_is_zone_owner == "0" )) {
   277 		if ($record['type'] == "SOA") {
   267 		if ($record['type'] == "SOA") {
   278 			error(_('You are trying to delete the SOA record. If are not allowed to remove it, unless you remove the entire zone.'));
   268 			error(_('You are trying to delete the SOA record. If are not allowed to remove it, unless you remove the entire zone.'));
   279 		} else {
   269 		} else {
   280 			$quote = "DELETE FROM records WHERE id = " . $db->quote($rid);
   270 			$query = "DELETE FROM records WHERE id = " . $db->quote($rid);
   281 			$response = $db->query($query);
   271 			$response = $db->query($query);
   282 			if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   272 			if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   283 			return true;
   273 			return true;
   284 		}
   274 		}
   285 	} else {
   275 	} else {