function _security_review_check_file_perms_scan in Security Review 6
Same name and namespace in other branches
- 7 security_review.inc \_security_review_check_file_perms_scan()
1 call to _security_review_check_file_perms_scan()
- security_review_check_file_perms in ./
security_review.inc - Check that files aren't writeable by the server.
File
- ./
security_review.inc, line 262 - Stand-alone security checks and review system.
Code
function _security_review_check_file_perms_scan($directory, $ignore) {
$items = array();
if (is_readable($directory) && ($handle = opendir($directory))) {
while (($file = readdir($handle)) !== FALSE) {
// Don't check hidden files or ones we said to ignore, or subdir site links.
if ($file[0] != "." && !in_array($file, $ignore) && !(is_link($file) && readlink($file) == '.')) {
$file = $directory . "/" . $file;
if (is_dir($file) && !in_array($file, $ignore)) {
$items = array_merge($items, _security_review_check_file_perms_scan($file, $ignore));
if (is_writable($file)) {
$items[] = preg_replace("/\\/\\//si", "/", $file);
}
}
elseif (is_writable($file) && !in_array($file, $ignore)) {
$items[] = preg_replace("/\\/\\//si", "/", $file);
}
}
}
closedir($handle);
}
return $items;
}