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 Ibonly\PotatoORM; |
||
4 | |||
5 | /** |
||
6 | * This class allows a user to upload and |
||
7 | * validate their files. |
||
8 | * |
||
9 | * @author John Ciacia <[email protected]> |
||
10 | * @version 1.0 |
||
11 | * @copyright Copyright (c) 2007, John Ciacia |
||
12 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
||
13 | */ |
||
14 | trait Upload { |
||
15 | |||
16 | protected $file; |
||
17 | /** |
||
18 | *@var string contains an array of valid extensions which are allowed to be uploaded. |
||
19 | */ |
||
20 | protected $ValidExtensions; |
||
21 | /** |
||
22 | *@var string contains a message which can be used for debugging. |
||
23 | */ |
||
24 | protected $Message; |
||
25 | /** |
||
26 | *@var integer contains maximum size of fiels to be uploaded in bytes. |
||
27 | */ |
||
28 | protected $MaximumFileSize; |
||
29 | /** |
||
30 | *@var bool contains whether or not the files being uploaded are images. |
||
31 | */ |
||
32 | protected $IsImage; |
||
33 | /** |
||
34 | *@var string contains the email address of the recipient of upload logs. |
||
35 | */ |
||
36 | protected $Email; |
||
37 | /** |
||
38 | *@var integer contains maximum width of images to be uploaded. |
||
39 | */ |
||
40 | protected $MaximumWidth; |
||
41 | /** |
||
42 | *@var integer contains maximum height of images to be uploaded. |
||
43 | */ |
||
44 | protected $MaximumHeight; |
||
45 | |||
46 | // public function upload() |
||
0 ignored issues
–
show
|
|||
47 | // { |
||
48 | |||
49 | // } |
||
50 | |||
51 | public function file($file) |
||
52 | { |
||
53 | $this->output = $file; |
||
0 ignored issues
–
show
The property
output does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
54 | |||
55 | return $this; |
||
56 | } |
||
57 | |||
58 | // public function fileSize() |
||
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. ![]() |
|||
59 | // { |
||
60 | // return $this->output['size']; |
||
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. ![]() |
|||
61 | // } |
||
62 | |||
63 | // public function fileTmp() |
||
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. ![]() |
|||
64 | // { |
||
65 | // return $this->output['tmp_name']; |
||
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. ![]() |
|||
66 | // } |
||
67 | |||
68 | // public function fileName() |
||
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. ![]() |
|||
69 | // { |
||
70 | // return $this->output; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% 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. ![]() |
|||
71 | // } |
||
72 | |||
73 | // public function fileMove($destination, $fileName = NULL) |
||
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. ![]() |
|||
74 | // { |
||
75 | // $file_name = ($fileName == null) ? $this->fileName() : $fileName; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
52% 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. ![]() |
|||
76 | // if (move_uploaded_file($this->fileTmp(), $destination.'/'.$file_name)) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% 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. ![]() |
|||
77 | // return 333; |
||
78 | // } else { |
||
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. ![]() |
|||
79 | // return 000; |
||
80 | // } |
||
81 | // } |
||
82 | |||
83 | /** |
||
84 | *@method bool ValidateExtension() returns whether the extension of file to be uploaded |
||
85 | * is allowable or not. |
||
86 | *@return true the extension is valid. |
||
87 | *@return false the extension is invalid. |
||
88 | */ |
||
89 | public function ValidateExtension() |
||
90 | { |
||
91 | |||
92 | $FileName = trim($this->GetFileName()); |
||
93 | $FileParts = pathinfo($FileName); |
||
94 | $Extension = strtolower($FileParts['extension']); |
||
95 | $ValidExtensions = $this->ValidExtensions; |
||
96 | |||
97 | if (!$FileName) { |
||
98 | $this->SetMessage("ERROR: File name is empty."); |
||
99 | return false; |
||
100 | } |
||
101 | |||
102 | if (!$ValidExtensions) { |
||
103 | $this->SetMessage("WARNING: All extensions are valid."); |
||
104 | return true; |
||
105 | } |
||
106 | |||
107 | if (in_array($Extension, $ValidExtensions)) { |
||
108 | $this->SetMessage("MESSAGE: The extension '$Extension' appears to be valid."); |
||
109 | return true; |
||
110 | } else { |
||
111 | $this->SetMessage("Error: The extension '$Extension' is invalid."); |
||
112 | return false; |
||
113 | } |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | *@method bool ValidateSize() returns whether the file size is acceptable. |
||
118 | *@return true the size is smaller than the alloted value. |
||
119 | *@return false the size is larger than the alloted value. |
||
120 | */ |
||
121 | public function ValidateSize() |
||
122 | { |
||
123 | $MaximumFileSize = $this->MaximumFileSize; |
||
124 | $TempFileName = $this->GetTempName(); |
||
125 | $TempFileSize = filesize($TempFileName); |
||
126 | |||
127 | if($MaximumFileSize == "") { |
||
128 | $this->SetMessage("WARNING: There is no size restriction."); |
||
129 | return true; |
||
130 | } |
||
131 | |||
132 | if ($MaximumFileSize >= $TempFileSize) { |
||
133 | $this->SetMessage("ERROR: The file is too big. It must be less than $MaximumFileSize and it is $TempFileSize."); |
||
134 | return false; |
||
135 | } |
||
136 | |||
137 | $this->SetMessage("Message: The file size is less than the MaximumFileSize."); |
||
138 | return true; |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | *@method bool ValidateExistance() determins whether the file already exists. If so, rename $FileName. |
||
143 | *@return true can never be returned as all file names must be unique. |
||
144 | *@return false the file name does not exist. |
||
145 | */ |
||
146 | public function ValidateExistance($uploadDirectory) |
||
147 | { |
||
148 | $FileName = $this->GetFileName(); |
||
149 | $File = $uploadDirectory . $FileName; |
||
150 | |||
151 | if (file_exists($File)) { |
||
152 | $this->SetMessage("Message: The file '$FileName' already exist."); |
||
153 | $UniqueName = rand() . $FileName; |
||
154 | $this->SetFileName($UniqueName); |
||
0 ignored issues
–
show
It seems like
SetFileName() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
155 | $this->ValidateExistance($uploadDirectory); |
||
156 | } else { |
||
157 | $this->SetMessage("Message: The file name '$FileName' does not exist."); |
||
158 | return false; |
||
159 | } |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | *@method bool ValidateDirectory() |
||
164 | *@return true the UploadDirectory exists, writable, and has a traling slash. |
||
165 | *@return false the directory was never set, does not exist, or is not writable. |
||
166 | */ |
||
167 | public function ValidateDirectory($uploadDirectory) |
||
168 | { |
||
169 | if (! $uploadDirectory) { |
||
170 | $this->SetMessage("ERROR: The directory variable is empty."); |
||
171 | return false; |
||
172 | } |
||
173 | |||
174 | if (!is_dir($uploadDirectory)) { |
||
175 | $this->SetMessage("ERROR: The directory '$uploadDirectory' does not exist."); |
||
176 | return false; |
||
177 | } |
||
178 | |||
179 | if (!is_writable($uploadDirectory)) { |
||
180 | $this->SetMessage("ERROR: The directory '$uploadDirectory' does not writable."); |
||
181 | return false; |
||
182 | } |
||
183 | |||
184 | if (substr($uploadDirectory, -1) != "/") { |
||
185 | $this->SetMessage("ERROR: The traling slash does not exist."); |
||
186 | $NewDirectory = $uploadDirectory . "/"; |
||
187 | $this->SetUploadDirectory($NewDirectory); |
||
0 ignored issues
–
show
It seems like
SetUploadDirectory() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
188 | $this->ValidateDirectory($uploadDirectory); |
||
189 | } else { |
||
190 | $this->SetMessage("MESSAGE: The traling slash exist."); |
||
191 | return true; |
||
192 | } |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | *@method bool ValidateImage() |
||
197 | *@return true the image is smaller than the alloted dimensions. |
||
198 | *@return false the width and/or height is larger then the alloted dimensions. |
||
199 | */ |
||
200 | public function ValidateImage() { |
||
201 | $MaximumWidth = $this->MaximumWidth; |
||
202 | $MaximumHeight = $this->MaximumHeight; |
||
203 | $TempFileName = $this->GetTempName(); |
||
204 | |||
205 | if($Size = @getimagesize($TempFileName)) { |
||
206 | $Width = $Size[0]; //$Width is the width in pixels of the image uploaded to the server. |
||
207 | $Height = $Size[1]; //$Height is the height in pixels of the image uploaded to the server. |
||
208 | } |
||
209 | |||
210 | if ($Width > $MaximumWidth) { |
||
211 | $this->SetMessage("The width of the image [$Width] exceeds the maximum amount [$MaximumWidth]."); |
||
0 ignored issues
–
show
The variable
$Width does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
212 | return false; |
||
213 | } |
||
214 | |||
215 | if ($Height > $MaximumHeight) { |
||
216 | $this->SetMessage("The height of the image [$Height] exceeds the maximum amount [$MaximumHeight]."); |
||
0 ignored issues
–
show
The variable
$Height does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
217 | return false; |
||
218 | } |
||
219 | |||
220 | $this->SetMessage("The image height [$Height] and width [$Width] are within their limitations."); |
||
221 | return true; |
||
222 | } |
||
223 | |||
224 | /** |
||
225 | *@method bool UploadFile() uploads the file to the server after passing all the validations. |
||
226 | *@return true the file was uploaded. |
||
227 | *@return false the upload failed. |
||
228 | */ |
||
229 | public function uploadFile($uploadDirectory) |
||
0 ignored issues
–
show
uploadFile uses the super-global variable $_SERVER which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
230 | { |
||
231 | |||
232 | // if (!$this->ValidateExtension()) { |
||
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. ![]() |
|||
233 | // die($this->GetMessage()); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
234 | // } |
||
235 | |||
236 | // else if (!$this->ValidateSize()) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% 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. ![]() |
|||
237 | // die($this->GetMessage()); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
238 | // } |
||
239 | |||
240 | // else if ($this->ValidateExistance($uploadDirectory)) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% 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. ![]() |
|||
241 | // die($this->GetMessage()); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
242 | // } |
||
243 | |||
244 | // elseif (!$this->ValidateDirectory($uploadDirectory)) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
72% 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. ![]() |
|||
245 | // die($this->GetMessage()); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
246 | // } |
||
247 | |||
248 | // else if ($this->IsImage && !$this->ValidateImage()) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
62% 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. ![]() |
|||
249 | // die($this->GetMessage()); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
250 | // } |
||
251 | |||
252 | // else { |
||
253 | |||
254 | $FileName = time()."_".str_replace(' ', '_', $this->GetFileName()); |
||
255 | $TempFileName = $this->GetTempName(); |
||
256 | |||
257 | if (is_uploaded_file($TempFileName)) { |
||
258 | move_uploaded_file($TempFileName, $_SERVER['DOCUMENT_ROOT'].'/'.$uploadDirectory.'/'.$FileName); |
||
259 | return $FileName; |
||
260 | } else { |
||
261 | return 4444; |
||
262 | } |
||
263 | |||
264 | // } |
||
265 | |||
266 | } |
||
267 | |||
268 | #Accessors and Mutators beyond this point. |
||
269 | #Siginificant documentation is not needed. |
||
270 | public function SetValidExtensions($argv) |
||
271 | { |
||
272 | $this->ValidExtensions = $argv; |
||
273 | } |
||
274 | |||
275 | public function SetMessage($argv) |
||
276 | { |
||
277 | $this->Message = $argv; |
||
278 | } |
||
279 | |||
280 | public function SetMaximumFileSize($argv) |
||
281 | { |
||
282 | $this->MaximumFileSize = $argv; |
||
283 | } |
||
284 | |||
285 | public function SetEmail($argv) |
||
286 | { |
||
287 | $this->Email = $argv; |
||
288 | } |
||
289 | |||
290 | public function SetIsImage($argv) |
||
291 | { |
||
292 | $this->IsImage = $argv; |
||
293 | } |
||
294 | |||
295 | public function SetMaximumWidth($argv) |
||
296 | { |
||
297 | $this->MaximumWidth = $argv; |
||
298 | } |
||
299 | |||
300 | public function SetMaximumHeight($argv) |
||
301 | { |
||
302 | $this->MaximumHeight = $argv; |
||
303 | } |
||
304 | public function GetFileName() |
||
305 | { |
||
306 | return $this->output['name']; |
||
307 | } |
||
308 | |||
309 | public function GetUploadDirectory() |
||
310 | { |
||
311 | return $this->UploadDirectory; |
||
0 ignored issues
–
show
The property
UploadDirectory does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
312 | } |
||
313 | |||
314 | public function GetTempName() |
||
315 | { |
||
316 | return $this->output['tmp_name']; |
||
317 | } |
||
318 | |||
319 | public function GetValidExtensions() |
||
320 | { |
||
321 | return $this->ValidExtensions; |
||
322 | } |
||
323 | |||
324 | public function GetMessage() |
||
325 | { |
||
326 | if (!isset($this->Message)) { |
||
327 | $this->SetMessage("No Message"); |
||
328 | } |
||
329 | |||
330 | return $this->Message; |
||
331 | } |
||
332 | |||
333 | public function GetMaximumFileSize() |
||
334 | { |
||
335 | return $this->MaximumFileSize; |
||
336 | } |
||
337 | |||
338 | public function GetIsImage() |
||
339 | { |
||
340 | return $this->IsImage; |
||
341 | } |
||
342 | |||
343 | public function GetMaximumWidth() |
||
344 | { |
||
345 | return $this->MaximumWidth; |
||
346 | } |
||
347 | |||
348 | public function GetMaximumHeight() |
||
349 | { |
||
350 | return $this->MaximumHeight; |
||
351 | } |
||
352 | } |
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.