Skip to content

Commit

Permalink
support crypt for lumen
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Mar 20, 2018
1 parent 3ee40c9 commit 6789caf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/controllers/LogViewerController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Rap2hpoutre\LaravelLogViewer;
use Illuminate\Support\Facades\Crypt;

if (class_exists("\\Illuminate\\Routing\\Controller")) {
class BaseController extends \Illuminate\Routing\Controller {}
Expand All @@ -20,13 +21,13 @@ public function index()
{

if ($this->request->input('l')) {
LaravelLogViewer::setFile(\Crypt::decrypt($this->request->input('l')));
LaravelLogViewer::setFile(Crypt::decrypt($this->request->input('l')));
}

if ($this->request->input('dl')) {
return $this->download(LaravelLogViewer::pathToLogFile(\Crypt::decrypt($this->request->input('dl'))));
return $this->download(LaravelLogViewer::pathToLogFile(Crypt::decrypt($this->request->input('dl'))));
} elseif ($this->request->has('del')) {
app('files')->delete(LaravelLogViewer::pathToLogFile(\Crypt::decrypt($this->request->input('del'))));
app('files')->delete(LaravelLogViewer::pathToLogFile(Crypt::decrypt($this->request->input('del'))));
return $this->redirect($this->request->url());
} elseif ($this->request->has('delall')) {
foreach(LaravelLogViewer::getFiles(true) as $file){
Expand Down
4 changes: 2 additions & 2 deletions src/views/log.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<p class="text-muted"><i>by Rap2h</i></p>
<div class="list-group">
@foreach($files as $file)
<a href="?l={{ \Crypt::encrypt($file) }}"
<a href="?l={{ \Illuminate\Support\Facades\Crypt::encrypt($file) }}"
class="list-group-item @if ($current_file == $file) llv-active @endif">
{{$file}}
</a>
Expand Down Expand Up @@ -120,7 +120,7 @@ class="fa fa-search"></span></button>@endif
@endif
<div class="p-3">
@if($current_file)
<a href="?dl={{ \Crypt::encrypt($current_file) }}"><span class="fa fa-download"></span>
<a href="?dl={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}"><span class="fa fa-download"></span>
Download file</a>
-
<a id="delete-log" href="?del={{ \Crypt::encrypt($current_file) }}"><span
Expand Down

0 comments on commit 6789caf

Please sign in to comment.