From 4502f4e58e7e86330d09a3190b52d88b9162c69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sava=C5=9F=20KARTAL?= Date: Tue, 17 Jul 2018 11:32:31 +0300 Subject: [PATCH] fix download, clean, delete functions when selected subfolders (#158) * Refactoring, use encrypt helper method. * Fixes #157. * Rollback encrypt helper method for Lumen support. --- src/controllers/LogViewerController.php | 9 ++++++++- src/views/log.blade.php | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/controllers/LogViewerController.php b/src/controllers/LogViewerController.php index 26b34a3..f4272c0 100644 --- a/src/controllers/LogViewerController.php +++ b/src/controllers/LogViewerController.php @@ -81,6 +81,10 @@ public function index() */ private function earlyReturn() { + if ($this->request->input('f')) { + $this->log_viewer->setFolder(Crypt::decrypt($this->request->input('f'))); + } + if ($this->request->input('dl')) { return $this->download($this->pathFromInput('dl')); } elseif ($this->request->has('clean')) { @@ -90,7 +94,10 @@ private function earlyReturn() app('files')->delete($this->pathFromInput('del')); return $this->redirect($this->request->url()); } elseif ($this->request->has('delall')) { - foreach ($this->log_viewer->getFiles(true) as $file) { + $files = ($this->log_viewer->getFolderName()) + ? $this->log_viewer->getFolderFiles(true) + : $this->log_viewer->getFiles(true); + foreach ($files as $file) { app('files')->delete($this->log_viewer->pathToLogFile($file)); } return $this->redirect($this->request->url()); diff --git a/src/views/log.blade.php b/src/views/log.blade.php index efa1322..edd0d4e 100644 --- a/src/views/log.blade.php +++ b/src/views/log.blade.php @@ -147,20 +147,20 @@ class="float-right expand btn btn-outline-dark btn-sm mb-2 ml-2" @endif
@if($current_file) - + Download file - - + Clean file - - + Delete file @if(count($files) > 1) - - + Delete all files @endif