CRM-14092. Generate blank index.html files in public directories.
authorChris Burgess <chris@fuzion.co.nz>
Thu, 30 Jan 2014 11:12:26 +0000 (00:12 +1300)
committerTim Otten <totten@civicrm.org>
Wed, 5 Feb 2014 17:47:41 +0000 (09:47 -0800)
Conflicts:
CRM/Utils/Check/Security.php

CRM/Utils/Check/Security.php

index bacb87184f5ef2737334a7d1c5388d1c7719c261..6140067b87989afce9e5db397c0b7f4d531c48a8 100644 (file)
@@ -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 . '/*')) {