Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4502f4e

Browse files
ssklrap2hpoutre
authored andcommittedJul 17, 2018
fix download, clean, delete functions when selected subfolders (#158)
* Refactoring, use encrypt helper method. * Fixes #157. * Rollback encrypt helper method for Lumen support.
1 parent 41b91a1 commit 4502f4e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
 

‎src/controllers/LogViewerController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public function index()
8181
*/
8282
private function earlyReturn()
8383
{
84+
if ($this->request->input('f')) {
85+
$this->log_viewer->setFolder(Crypt::decrypt($this->request->input('f')));
86+
}
87+
8488
if ($this->request->input('dl')) {
8589
return $this->download($this->pathFromInput('dl'));
8690
} elseif ($this->request->has('clean')) {
@@ -90,7 +94,10 @@ private function earlyReturn()
9094
app('files')->delete($this->pathFromInput('del'));
9195
return $this->redirect($this->request->url());
9296
} elseif ($this->request->has('delall')) {
93-
foreach ($this->log_viewer->getFiles(true) as $file) {
97+
$files = ($this->log_viewer->getFolderName())
98+
? $this->log_viewer->getFolderFiles(true)
99+
: $this->log_viewer->getFiles(true);
100+
foreach ($files as $file) {
94101
app('files')->delete($this->log_viewer->pathToLogFile($file));
95102
}
96103
return $this->redirect($this->request->url());

‎src/views/log.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ class="float-right expand btn btn-outline-dark btn-sm mb-2 ml-2"
147147
@endif
148148
<div class="p-3">
149149
@if($current_file)
150-
<a href="?dl={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}">
150+
<a href="?dl={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
151151
<span class="fa fa-download"></span> Download file
152152
</a>
153153
-
154-
<a id="clean-log" href="?clean={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}">
154+
<a id="clean-log" href="?clean={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
155155
<span class="fa fa-sync"></span> Clean file
156156
</a>
157157
-
158-
<a id="delete-log" href="?del={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}">
158+
<a id="delete-log" href="?del={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
159159
<span class="fa fa-trash"></span> Delete file
160160
</a>
161161
@if(count($files) > 1)
162162
-
163-
<a id="delete-all-log" href="?delall=true">
163+
<a id="delete-all-log" href="?delall=true{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
164164
<span class="fa fa-trash-alt"></span> Delete all files
165165
</a>
166166
@endif

0 commit comments

Comments
 (0)
Please sign in to comment.