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 | namespace App\Http\Middleware; |
||
4 | |||
5 | use App\Http\Controllers\Update\UpgradeController; |
||
6 | use App\Http\Controllers\Utility\LibraryController as Utility; |
||
7 | use App\Model\Update\BarNotification; |
||
8 | use Closure; |
||
9 | |||
10 | class CheckUpdate |
||
11 | { |
||
12 | /** |
||
13 | * Handle an incoming request. |
||
14 | * |
||
15 | * @param \Illuminate\Http\Request $request |
||
16 | * @param \Closure $next |
||
17 | * |
||
18 | * @return mixed |
||
19 | */ |
||
20 | public function handle($request, Closure $next) |
||
21 | { |
||
22 | $check = $this->process(); |
||
23 | //dd($check); |
||
24 | if ($check == true) { |
||
0 ignored issues
–
show
|
|||
25 | //$this->notificationBar(); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
84% 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. ![]() |
|||
26 | $this->checkNewUpdate(); |
||
27 | // if (Utility::getFileVersion() > Utility::getDatabaseVersion()) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% 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. ![]() |
|||
28 | // return redirect('database-update'); |
||
29 | // } |
||
30 | // if (Utility::getFileVersion() < Utility::getDatabaseVersion()) { |
||
31 | // return redirect('file-update'); |
||
32 | // } |
||
33 | } |
||
34 | |||
35 | return $next($request); |
||
36 | } |
||
37 | |||
38 | public function notificationBar() |
||
39 | { |
||
40 | $notify = new BarNotification(); |
||
41 | $path = base_path('UPDATES'); |
||
42 | if (is_dir($path)) { |
||
43 | $notify->create(['key' => 'update-ready', 'value' => 'New version has downloaded, click <a href='.url('file-update').'>here</a> to update now']); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | public function checkNewUpdate() |
||
48 | { |
||
49 | $notify = new BarNotification(); |
||
50 | if (!\Schema::hasTable('bar_notifications')) { |
||
51 | $url = url('database-upgrade'); |
||
52 | //$string = "Your Database is outdated please upgrade <a href=$url>Now !</a>"; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% 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. ![]() |
|||
53 | echo view('themes.default1.update.database', compact('url')); |
||
54 | exit; |
||
55 | } |
||
56 | $not = $notify->get(); |
||
0 ignored issues
–
show
The method
get does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
57 | if ($not->count() > 0) { |
||
58 | $now = \Carbon\Carbon::now(); |
||
59 | $yesterday = \Carbon\Carbon::yesterday(); |
||
60 | $notifications = $notify->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key'); |
||
0 ignored issues
–
show
The method
whereBetween does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
61 | $todelete = $notify->where('created_at', '<', $yesterday)->get(); |
||
0 ignored issues
–
show
The method
where does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
62 | if ($todelete->count() > 0) { |
||
63 | foreach ($todelete as $delete) { |
||
64 | $delete->delete(); |
||
65 | } |
||
66 | } |
||
67 | if (count($notifications) > 0) { |
||
68 | if (!array_key_exists('new-version', $notifications)) { |
||
69 | $check_version = $this->checkNewVersion(); |
||
70 | if ($check_version == true) { |
||
71 | $notify->create(['key' => 'new-version', 'value' => 'new version found please click <a href='.url('file-update').'><b>here to download</b></a>']); |
||
72 | } |
||
73 | } else { |
||
74 | $n = $notify->where('key', 'new-version')->first(); |
||
0 ignored issues
–
show
The method
where does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
75 | $last = $n->created_at; |
||
76 | $now = \Carbon\Carbon::now(); |
||
77 | $difference = $now->diffInHours($last); |
||
78 | if ($difference >= 24) { |
||
79 | $n->delete(); |
||
80 | $this->checkNewUpdate(); |
||
81 | } |
||
82 | } |
||
83 | } |
||
84 | } else { |
||
85 | $check_version = $this->checkNewVersion(); |
||
86 | |||
87 | if ($check_version == true) { |
||
88 | //dd('if'); |
||
89 | $notify->create(['key' => 'new-version', 'value' => 'new version found please click <a href='.url('file-update').'><b>here to download</b></a>', 'created_at' => \Carbon\Carbon::now()]); |
||
90 | } else { |
||
91 | //dd('else'); |
||
92 | $notify->create(['key' => 'new-version', 'value' => '', 'created_at' => \Carbon\Carbon::now()]); |
||
93 | } |
||
94 | } |
||
95 | } |
||
96 | |||
97 | public function checkNewVersion() |
||
98 | { |
||
99 | $controller = new UpgradeController(); |
||
100 | $version_from_billing = $controller->getLatestVersion(); |
||
101 | $app_version = Utility::getFileVersion(); |
||
102 | if ($version_from_billing > $app_version) { |
||
103 | return true; |
||
104 | } |
||
105 | } |
||
106 | |||
107 | public function process() |
||
108 | { |
||
109 | $notify = new BarNotification(); |
||
110 | $not = $notify->get(); |
||
0 ignored issues
–
show
The method
get does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
111 | if ($not->count() > 0) { |
||
112 | $n = $notify->where('key', 'new-version')->first(); |
||
0 ignored issues
–
show
The method
where does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
113 | |||
114 | if ($n) { |
||
115 | $now = \Carbon\Carbon::now(); |
||
116 | $yesterday = \Carbon\Carbon::yesterday(); |
||
117 | $notifications = $notify->where('key', 'new-version')->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key'); |
||
0 ignored issues
–
show
The method
where does not exist on object<App\Model\Update\BarNotification> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
118 | if ($notifications->count() > 0) { |
||
119 | return false; |
||
120 | } |
||
121 | } |
||
122 | } |
||
123 | |||
124 | return true; |
||
125 | } |
||
126 | } |
||
127 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.