From cf6d4b4fec4ccc296bb257638149a5b51fb32b3b Mon Sep 17 00:00:00 2001 From: Igor Kalkov Date: Sat, 14 Jul 2018 10:42:11 +0200 Subject: [PATCH] Use func params instead of global keyword --- index.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index a955ac0..a2069a3 100644 --- a/index.php +++ b/index.php @@ -64,7 +64,7 @@ if($_GET['do'] == 'list') { $directory = $file; $result = []; $files = array_diff(scandir($directory), ['.','..']); - foreach ($files as $entry) if (!is_entry_ignored($entry)) { + foreach ($files as $entry) if (!is_entry_ignored($entry, $allow_show_folders, $hidden_extensions)) { $i = $directory . '/' . $entry; $stat = stat($i); $result[] = [ @@ -120,12 +120,11 @@ if($_GET['do'] == 'list') { exit; } -function is_entry_ignored($entry) { +function is_entry_ignored($entry, $allow_show_folders, $hidden_extensions) { if ($entry === basename(__FILE__)) { return true; } - global $allow_show_folders; if (is_dir($entry) && !$allow_show_folders) { return true; }