From 1935150e8e519799edce6142e7562b3d94847e08 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Mon, 13 May 2024 15:59:20 +0300 Subject: [PATCH] update --- web/app/Livewire/FileManager.php | 30 +++++--- .../livewire/file-manager/index.blade.php | 74 +++++++++++++++---- 2 files changed, 81 insertions(+), 23 deletions(-) diff --git a/web/app/Livewire/FileManager.php b/web/app/Livewire/FileManager.php index cd43847..ca5b511 100644 --- a/web/app/Livewire/FileManager.php +++ b/web/app/Livewire/FileManager.php @@ -83,18 +83,30 @@ class FileManager extends Component if ($scanFile == '.' || $scanFile == '..') { continue; } - $append = [ - 'name' => $scanFile, - 'path' => $this->currentRealPath . '/' . $scanFile, - 'is_dir' => is_dir($this->currentRealPath . '/' . $scanFile) - ]; - if ($append['is_dir']) { - $folders[] = $append; - } else { - $files[] = $append; + try { + $append = [ + 'extension' => pathinfo($scanFile, PATHINFO_EXTENSION), + 'name' => $scanFile, + 'path' => $this->currentRealPath . '/' . $scanFile, + 'is_dir' => is_dir($this->currentRealPath . '/' . $scanFile), + 'permission' => substr(sprintf('%o', fileperms($this->currentRealPath . '/' . $scanFile)), -4), + 'owner' => posix_getpwuid(fileowner($this->currentRealPath . '/' . $scanFile))['name'], + 'group' => posix_getgrgid(filegroup($this->currentRealPath . '/' . $scanFile))['name'], + 'size' => filesize($this->currentRealPath . '/' . $scanFile), + 'last_modified' => filemtime($this->currentRealPath . '/' . $scanFile), + 'type' => filetype($this->currentRealPath . '/' . $scanFile), + ]; + if ($append['is_dir']) { + $folders[] = $append; + } else { + $files[] = $append; + } + } catch (\Exception $e) { + continue; } } } + $all = array_merge($folders, $files); return view('livewire.file-manager.index', [ diff --git a/web/resources/views/livewire/file-manager/index.blade.php b/web/resources/views/livewire/file-manager/index.blade.php index 37fc55e..ef5c9dc 100644 --- a/web/resources/views/livewire/file-manager/index.blade.php +++ b/web/resources/views/livewire/file-manager/index.blade.php @@ -4,21 +4,35 @@ Path: {{$currentRealPath}} -
- +
+ + + Back + + + + Refresh + + + + Create Folder + + + + Upload + +
@if(!empty($files)) - +
- + @@ -34,6 +48,42 @@ + @elseif($file['extension'] == 'zip') + + + + @elseif ($file['extension'] == 'txt') + + + + @elseif($file['extension'] == 'gz') + + + + @elseif($file['extension'] == 'php') + + + + @elseif($file['extension'] == 'html') + + + + @elseif($file['extension'] == 'css') + + + + @elseif($file['extension'] == 'js') + + + + @elseif($file['extension'] == 'json') + + + + @elseif($file['extension'] == 'jpg' || $file['extension'] == 'jpeg' || $file['extension'] == 'png' || $file['extension'] == 'gif') + + + @else @@ -45,20 +95,16 @@ {{ $file['name'] }} - 0.00 KB + {{ $file['size'] }} - - + {{$file['last_modified']}} - @if($file['is_dir']) - Directory - @else - File - @endif + {{$file['owner']}} / {{$file['group']}} - 700 + {{$file['permission']}} @endforeach
# Name Size Last modifiedTypeOwner/Group Permission