This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * rmarchiv.tk |
||
5 | * (c) 2016-2017 by Marcel 'ryg' Hering |
||
6 | */ |
||
7 | |||
8 | namespace App\Http\Controllers; |
||
9 | |||
10 | use App\Events\Obyx; |
||
11 | use App\Models\Game; |
||
12 | use App\Models\Screenshot; |
||
13 | use Illuminate\Http\Request; |
||
14 | use Illuminate\Http\UploadedFile; |
||
15 | use Intervention\Image\Facades\Image; |
||
16 | |||
17 | class ScreenshotController extends Controller |
||
18 | { |
||
19 | public function show($gameid, $screenid, $full = null) |
||
20 | { |
||
21 | $s = Screenshot::whereGameId($gameid)->where('screenshot_id', $screenid) |
||
22 | ->first(); |
||
23 | |||
24 | //Prüfen ob Screenshots vorhanden sind |
||
25 | if (!$s) {//Es sind keine Screenshots vorhanden |
||
26 | $storagePath = public_path().'/assets/no_image.png'; |
||
27 | } else {//Es sind Screenshots vorhanden |
||
28 | $storagePath = \Storage::get($s->filename); |
||
29 | } |
||
30 | |||
31 | $img = \Image::make($storagePath); |
||
32 | if (! $full) { |
||
33 | $response = \Response::make($img->encode('jpg', 80)); |
||
34 | $response->header('Content-Type', 'image/jpg'); |
||
35 | } else { |
||
36 | $response = \Response::make($img->encode('png')); |
||
37 | $response->header('Content-Type', 'image/png'); |
||
38 | } |
||
39 | //$response->setMaxAge(604800); |
||
0 ignored issues
–
show
|
|||
40 | //$etag = md5($s->id.'-'.$s->updated_at); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
41 | //$response->setEtag($etag); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
86% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
42 | //$response->setLastModified($s->updated_at); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
78% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
43 | $response->setPublic(); |
||
44 | |||
45 | return $response; |
||
46 | |||
47 | //return Image::make($storagePath)->response(); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
48 | } |
||
49 | |||
50 | View Code Duplication | public function create($gameid, $screenid) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
51 | { |
||
52 | if (\Auth::check()) { |
||
53 | $game = Game::whereId($gameid)->first(); |
||
54 | |||
55 | return view('screenshots.create', [ |
||
56 | 'gameid' => $gameid, |
||
57 | 'screenid' => $screenid, |
||
58 | 'game' => $game, |
||
59 | ]); |
||
60 | } else { |
||
61 | return redirect()->back(); |
||
62 | } |
||
63 | } |
||
64 | |||
65 | public function upload(Request $request, $gameid, $screenid) |
||
66 | { |
||
67 | if (\Auth::check()) { |
||
68 | $this->validate($request, [ |
||
69 | 'file' => 'required|image|mimes:png|max:2048', |
||
70 | ]); |
||
71 | |||
72 | $file = $request->file('file'); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
73 | $extorig = $file->getExtension(); |
||
74 | |||
75 | $imageName = \Storage::putFile('screenshots', new UploadedFile($file->path(), $file->getClientOriginalName())); |
||
76 | //dd($file); |
||
77 | |||
78 | //Löschen des vorhandenen DB Eintrages |
||
79 | $old = Screenshot::whereGameId($gameid)->where('screenshot_id', '=', $screenid)->first(); |
||
80 | if ($old) { |
||
81 | $old->delete(); |
||
82 | } else { |
||
83 | event(new Obyx('screenshot-add', \Auth::id())); |
||
84 | } |
||
85 | |||
86 | //Speichern des Screenshots |
||
87 | $scr = new Screenshot(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 16 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
88 | $scr->game_id = $gameid; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
89 | $scr->user_id = \Auth::id(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
90 | $scr->screenshot_id = $screenid; |
||
91 | $scr->filename = str_replace($extorig, '', $imageName); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
92 | $scr->save(); |
||
93 | |||
94 | return redirect()->route('screenshot.upload.success', $gameid); |
||
95 | } else { |
||
96 | return redirect()->back(); |
||
97 | } |
||
98 | } |
||
99 | } |
||
100 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.