From 8c9c04eeccadbc4aa4af9dbbd158fa1d3664da13 Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Fri, 31 Jan 2014 00:12:26 +1300 Subject: [PATCH] CRM-14092. Generate blank index.html files in public directories. Conflicts: CRM/Utils/Check/Security.php --- CRM/Utils/Check/Security.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index bacb87184f..6140067b87 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -209,6 +209,17 @@ class CRM_Utils_Check_Security { if ($upload_url = explode($filePathMarker, $config->imageUploadURL)) { if ($files = glob($config->uploadDir . '/*')) { foreach ($paths as $path) { + // Since we're here ... + $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + foreach ($dir as $name => $object) { + if (is_dir($name) && $name != '..') { + $nobrowse = realpath($name) . '/index.html'; + if (!file_exists($nobrowse)) { + @file_put_contents($nobrowse, ''); + } + } + } + // OK, now let's see if it's browseable. if ($dir_path = explode($filePathMarker, $path)) { $url = implode($filePathMarker, array($upload_url[0], $dir_path[1])); if ($files = glob($path . '/*')) { -- 2.25.1