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 | function loging($context, $message, $level = 'error', $array = []) |
||
4 | { |
||
5 | \Log::$level($message.':-:-:-'.$context, $array); |
||
6 | } |
||
7 | |||
8 | function checkArray($key, $array) |
||
9 | { |
||
10 | $value = ''; |
||
11 | if (array_key_exists($key, $array)) { |
||
12 | $value = $array[$key]; |
||
13 | } |
||
14 | |||
15 | return $value; |
||
16 | } |
||
17 | |||
18 | function mime($type) |
||
19 | { |
||
20 | if ($type == 'jpg' || |
||
21 | $type == 'png' || |
||
22 | $type == 'PNG' || |
||
23 | $type == 'JPG' || |
||
24 | $type == 'jpeg' || |
||
25 | $type == 'JPEG' || |
||
26 | $type == 'gif' || |
||
27 | $type == 'GIF' || |
||
28 | $type == 'image/jpeg' || |
||
29 | $type == 'image/jpg' || |
||
30 | $type == 'image/gif' || |
||
31 | // $type == "application/octet-stream" || |
||
0 ignored issues
–
show
|
|||
32 | $type == 'image/png' || |
||
33 | starts_with($type, 'image')) { |
||
34 | return 'image'; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | function removeUnderscore($string) |
||
39 | { |
||
40 | if (str_contains($string, '_') === true) { |
||
41 | $string = str_replace('_', ' ', $string); |
||
42 | } |
||
43 | |||
44 | return ucfirst($string); |
||
45 | } |
||
46 | |||
47 | function isItil() |
||
48 | { |
||
49 | $check = false; |
||
50 | if (\Schema::hasTable('sd_releases') && \Schema::hasTable('sd_changes') && \Schema::hasTable('sd_problem')) { |
||
51 | $check = true; |
||
52 | } |
||
53 | |||
54 | return $check; |
||
55 | } |
||
56 | |||
57 | function isAsset() |
||
58 | { |
||
59 | $check = false; |
||
60 | if (\Schema::hasTable('sd_assets')) { |
||
61 | $check = true; |
||
62 | } |
||
63 | |||
64 | return $check; |
||
65 | } |
||
66 | |||
67 | View Code Duplication | function itilEnabled() |
|
0 ignored issues
–
show
This function 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. ![]() |
|||
68 | { |
||
69 | $check = false; |
||
70 | if (\Schema::hasTable('common_settings')) { |
||
71 | $settings = \DB::table('common_settings')->where('option_name', 'itil')->first(); |
||
72 | if ($settings && $settings->status == 1) { |
||
73 | $check = true; |
||
74 | } |
||
75 | } |
||
76 | |||
77 | return $check; |
||
78 | } |
||
79 | |||
80 | View Code Duplication | function isBill() |
|
0 ignored issues
–
show
This function 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. ![]() |
|||
81 | { |
||
82 | $check = false; |
||
83 | if (\Schema::hasTable('common_settings')) { |
||
84 | $settings = \DB::table('common_settings')->where('option_name', 'bill')->first(); |
||
85 | if ($settings && $settings->status == 1) { |
||
86 | $check = true; |
||
87 | } |
||
88 | } |
||
89 | |||
90 | return $check; |
||
91 | } |
||
92 | |||
93 | View Code Duplication | function deletePopUp($id, $url, $title = 'Delete', $class = 'btn btn-sm btn-danger', $btn_name = 'Delete', $button_check = true) |
|
0 ignored issues
–
show
This function 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. ![]() |
|||
94 | { |
||
95 | $button = ''; |
||
96 | if ($button_check == true) { |
||
0 ignored issues
–
show
|
|||
97 | $button = '<a href="#delete" class="'.$class.'" data-toggle="modal" data-target="#delete'.$id.'">'.$btn_name.'</a>'; |
||
98 | } |
||
99 | |||
100 | return $button.'<div class="modal fade" id="delete'.$id.'"> |
||
101 | <div class="modal-dialog"> |
||
102 | <div class="modal-content"> |
||
103 | <div class="modal-header"> |
||
104 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
||
105 | <h4 class="modal-title">'.$title.'</h4> |
||
106 | </div> |
||
107 | <div class="modal-body"> |
||
108 | <div class="row"> |
||
109 | <div class="col-md-12"> |
||
110 | <p>Are you sure ?</p> |
||
111 | </div> |
||
112 | </div> |
||
113 | </div> |
||
114 | <div class="modal-footer"> |
||
115 | <button type="button" id="close" class="btn btn-default pull-left" data-dismiss="modal">Close</button> |
||
116 | <a href="'.$url.'" class="btn btn-danger">Delete</a> |
||
117 | </div> |
||
118 | </div> |
||
119 | </div> |
||
120 | </div>'; |
||
121 | } |
||
122 | |||
123 | function isInstall() |
||
124 | { |
||
125 | $check = false; |
||
126 | $env = base_path('.env'); |
||
127 | if (\File::exists($env) && env('DB_INSTALL') == 1) { |
||
128 | $check = true; |
||
129 | } |
||
130 | |||
131 | return $check; |
||
132 | } |
||
133 | |||
134 | function faveotime($date, $hour = 0, $min = 0, $sec = 0) |
||
135 | { |
||
136 | if (is_bool($hour) && $hour == true) { |
||
0 ignored issues
–
show
|
|||
137 | $hour = $date->hour; |
||
138 | } |
||
139 | if (is_bool($min) && $min == true) { |
||
0 ignored issues
–
show
|
|||
140 | $min = $date->minute; |
||
141 | } |
||
142 | if (is_bool($sec) && $sec == true) { |
||
0 ignored issues
–
show
|
|||
143 | $sec = $date->second; |
||
144 | } |
||
145 | $date1 = \Carbon\Carbon::create($date->year, $date->month, $date->day, $hour, $min, $sec); |
||
146 | |||
147 | return $date1->hour($hour)->minute($min)->second($sec); |
||
148 | } |
||
149 |
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.