Project

General

Profile

« Previous | Next » 

Revision fa112436

Added by Ermal LUÇI over 14 years ago

Use php calls rather than forking to shell.

View differences:

etc/inc/pfsense-utils.inc
149 149
 ******/
150 150
function get_dns_servers() {
151 151
	$dns_servers = array();
152
	$dns = `cat /etc/resolv.conf`;
153
	$dns_s = split("\n", $dns);
152
	$dns_s = file("/etc/resolv.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
154 153
	foreach($dns_s as $dns) {
155 154
		$matches = "";
156 155
		if (preg_match("/nameserver (.*)/", $dns, $matches))
157 156
			$dns_servers[] = $matches[1];
158 157
	}
159
	$dns_server_master = array();
160
	$lastseen = "";
161
	foreach($dns_servers as $t) {
162
		if($t <> $lastseen)
163
			if($t <> "")
164
				$dns_server_master[] = $t;
165
		$lastseen = $t;
166
	}
167
	return $dns_server_master;
158
	return array_unique($dns_servers);
168 159
}
169 160

  
170 161
/****f* pfsense-utils/enable_hardware_offloading
......
2116 2107
	return "";
2117 2108
}
2118 2109

  
2119
?>
2110
?>

Also available in: Unified diff