From 365671322b48fe2f7c5b9ca36b9c97119bb4b151 Mon Sep 17 00:00:00 2001 From: Patrick Burns Date: Sun, 7 Apr 2024 12:08:18 -0500 Subject: [PATCH] added sstvimages directory to repo along w/ matching index.html from other image asset directories. Also added some error handling onto the new storage_helper function to check if the directory exists before reading it --- application/helpers/storage_helper.php | 30 +++++++++++++++----------- assets/sstvimages/index.html | 8 +++++++ 2 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 assets/sstvimages/index.html diff --git a/application/helpers/storage_helper.php b/application/helpers/storage_helper.php index c84f44a9..7e99cc13 100644 --- a/application/helpers/storage_helper.php +++ b/application/helpers/storage_helper.php @@ -2,22 +2,26 @@ if (!function_exists('folderSize')) { function folderSize($dir){ - $count_size = 0; - $count = 0; - $dir_array = scandir($dir); - foreach($dir_array as $key=>$filename){ - if($filename!=".." && $filename!="."){ - if(is_dir($dir."/".$filename)){ - $new_foldersize = folderSize($dir."/".$filename); - $count_size = $count_size+ $new_foldersize; - }else if(is_file($dir."/".$filename)){ - $count_size = $count_size + filesize($dir."/".$filename); - $count++; + if (is_dir($dir)) { + $count_size = 0; + $count = 0; + $dir_array = scandir($dir); + foreach($dir_array as $key=>$filename){ + if($filename!=".." && $filename!="."){ + if(is_dir($dir."/".$filename)){ + $new_foldersize = folderSize($dir."/".$filename); + $count_size = $count_size+ $new_foldersize; + }else if(is_file($dir."/".$filename)){ + $count_size = $count_size + filesize($dir."/".$filename); + $count++; + } } } + return $count_size; + } else { + return 0; } - return $count_size; - } + } } if (!function_exists('sizeFormat')) { diff --git a/assets/sstvimages/index.html b/assets/sstvimages/index.html new file mode 100644 index 00000000..f3e161be --- /dev/null +++ b/assets/sstvimages/index.html @@ -0,0 +1,8 @@ + + + 403 Forbidden + + +

Directory access is forbidden.

+ +