Revision 767a716e
Added by Scott Ullrich over 19 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
46 | 46 |
* null |
47 | 47 |
******/ |
48 | 48 |
function get_dns_servers() { |
49 |
$lastseen = ""; |
|
50 |
$matches = ""; |
|
49 | 51 |
$dns_servers = array(); |
50 | 52 |
$dns = `cat /etc/resolv.conf`; |
51 | 53 |
$dns_s = split("\n", $dns); |
... | ... | |
230 | 232 |
foreach ($iflist as $ifent => $ifname) { |
231 | 233 |
$supported_ints = array('dc', 'em', 'fwe', 'fwip', 'fxp', 'ixgb', 'ste', |
232 | 234 |
'nge', 're', 'rl', 'sf', 'sis', 'ste', 'vge', 'vr', 'xl'); |
233 |
if (in_array($int_family, $supported_ints) and isset($config['system']['polling'])) {
|
|
235 |
if (in_array($ifname, $supported_ints) and isset($config['system']['polling'])) {
|
|
234 | 236 |
mwexec("/sbin/ifconfig {$interface} polling"); |
235 | 237 |
} else { |
236 | 238 |
mwexec("/sbin/ifconfig {$interface} -polling"); |
... | ... | |
760 | 762 |
*/ |
761 | 763 |
function execute_command_return_output($command) { |
762 | 764 |
global $fd_log; |
765 |
$lasttext = ""; |
|
763 | 766 |
$fd = popen($command . " 2>&1 ", "r"); |
764 | 767 |
echo "\n<script language=\"JavaScript\">this.document.forms[0].output.value = \"\";</script>"; |
765 | 768 |
$counter = 0; |
... | ... | |
848 | 851 |
$stats = `/sbin/pfctl -vvsq & /bin/sleep 5;/usr/bin/killall pfctl 2>/dev/null`; |
849 | 852 |
$stats_array = split("\n", $stats); |
850 | 853 |
$queue_stats = array(); |
854 |
$match_array = ""; |
|
851 | 855 |
foreach ($stats_array as $stats_line) { |
852 | 856 |
if (preg_match_all("/queue\s+(\w+)\s+/",$stats_line,$match_array)) |
853 | 857 |
$queue_name = $match_array[1][0]; |
... | ... | |
932 | 936 |
* to disk/cf. |
933 | 937 |
*/ |
934 | 938 |
function restore_config_section($section, $new_contents) { |
935 |
global $config; |
|
939 |
global $config, $g;
|
|
936 | 940 |
conf_mount_rw(); |
937 | 941 |
$fout = fopen("{$g['tmp_path']}/tmpxml","w"); |
938 | 942 |
fwrite($fout, $new_contents); |
... | ... | |
951 | 955 |
* written by nf@bigpond.net.au |
952 | 956 |
*/ |
953 | 957 |
function http_post($server, $port, $url, $vars) { |
958 |
global $errstr; |
|
954 | 959 |
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"; |
955 | 960 |
$urlencoded = ""; |
956 | 961 |
while (list($key,$value) = each($vars)) |
... | ... | |
971 | 976 |
|
972 | 977 |
"; |
973 | 978 |
|
979 |
$errno = ""; |
|
974 | 980 |
$fp = fsockopen($server, $port, $errno, $errstr); |
975 | 981 |
if (!$fp) { |
976 | 982 |
return false; |
... | ... | |
1071 | 1077 |
*/ |
1072 | 1078 |
function get_memory() { |
1073 | 1079 |
if(file_exists("/var/log/dmesg.boot")) { |
1080 |
$matches = ""; |
|
1074 | 1081 |
$mem = `cat /var/log/dmesg.boot | grep memory`; |
1075 | 1082 |
if (preg_match_all("/real memory = .* \((.*) MB/", $mem, $matches)) |
1076 | 1083 |
$real = $matches[1]; |
... | ... | |
1151 | 1158 |
} |
1152 | 1159 |
|
1153 | 1160 |
function get_disk_info() { |
1161 |
$diskout = ""; |
|
1154 | 1162 |
exec("df -h | grep -w '/' | awk '{ print $2, $3, $4, $5 }'", $diskout); |
1155 | 1163 |
return explode(' ', $diskout[0]); |
1156 | 1164 |
// $size, $used, $avail, $cap |
Also available in: Unified diff
Correct warnings and errors found eclipse