diff options
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 6ebe247..887994e 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -41,12 +41,15 @@ function log_error($error) { * return_dir_as_array($dir): returns $dir contents as an array */ function return_dir_as_array($dir) { + $dir_array = array(); if (is_dir($dir)) { - $dir_array = array(); if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { - array_push($dir_array, $file); - //echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; + $canadd = 0; + if($file == ".") $canadd = 1; + if($file == "..") $canadd = 1; + if($canadd == 0) + array_push($dir_array, $file); } closedir($dh); } @@ -59,7 +62,7 @@ function return_dir_as_array($dir) { */ function return_filename_as_string($filename) { $tmp = ""; - $fd = popen($filename, "r"); + $fd = fopen($filename, "r"); while(!feof($fd)) { $tmp .= fread($fd,49); } |