fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
fetchMedia accesses the super-global variable $_FILES. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
The class XoopsMediaUploader has an overall complexity of 76 which is very high. The configured complexity threshold is 50. Open
class XoopsMediaUploader {
/**
* Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues )
**/
var $allowUnknownTypes = false;
- Exclude checks
File uploader.php
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// $Id: uploader.php 507 2006-05-26 23:39:35Z skalpa $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
XoopsMediaUploader
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class XoopsMediaUploader {
/**
* Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues )
**/
var $allowUnknownTypes = false;
Method fetchMedia
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
The class XoopsMediaUploader has 21 fields. Consider redesigning XoopsMediaUploader to keep the number of fields under 15. Open
class XoopsMediaUploader {
/**
* Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues )
**/
var $allowUnknownTypes = false;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
Method upload
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function upload($chmod = 0644) {
if ($this->uploadDir == '') {
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
return false;
}
Function fetchMedia
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function upload
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function upload($chmod = 0644) {
if ($this->uploadDir == '') {
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _copyFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _copyFile($chmod) {
$matched = array();
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
Function _copyFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function _copyFile($chmod) {
$matched = array();
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method XoopsMediaUploader
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
Function getErrors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function &getErrors($ashtml = true) {
if (!$ashtml) {
return $this->errors;
} else {
$ret = '';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Function checkImageType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function checkImageType() {
if(empty($this->checkImageType)) return true;
if( ("image" == substr($this->mediaType, 0, strpos($this->mediaType, "/"))) ||
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method fetchMedia() has an NPath complexity of 960. The configured NPath complexity threshold is 200. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method upload() has an NPath complexity of 1024. The configured NPath complexity threshold is 200. Open
function upload($chmod = 0644) {
if ($this->uploadDir == '') {
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
return false;
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method fetchMedia() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method upload() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
function upload($chmod = 0644) {
if ($this->uploadDir == '') {
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
return false;
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getErrors has a boolean flag argument $ashtml, which is a certain sign of a Single Responsibility Principle violation. Open
function &getErrors($ashtml = true) {
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Remove error control operator '@' on line 373. Open
function _copyFile($chmod) {
$matched = array();
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 467. Open
function checkImageType() {
if(empty($this->checkImageType)) return true;
if( ("image" == substr($this->mediaType, 0, strpos($this->mediaType, "/"))) ||
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 376. Open
function _copyFile($chmod) {
$matched = array();
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 381. Open
function _copyFile($chmod) {
$matched = array();
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
The method fetchMedia uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$media_name =& $_FILES[$media_name];
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($media_name['name']) : $media_name['name'];
$this->mediaName = $media_name['name'];
$this->mediaType = $media_name['type'];
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '467', column '13'). Open
function checkImageType() {
if(empty($this->checkImageType)) return true;
if( ("image" == substr($this->mediaType, 0, strpos($this->mediaType, "/"))) ||
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '406', column '17'). Open
function checkMaxWidth() {
if (!isset($this->maxWidth)) {
return true;
}
if (false !== $dimension = getimagesize($this->mediaTmpName)) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method _copyFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->savedFileName = strtolower($this->mediaName);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method checkMaxWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
trigger_error(sprintf('Failed fetching image size of %s, skipping max width check..', $this->mediaTmpName), E_USER_WARNING);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '425', column '17'). Open
function checkMaxHeight() {
if (!isset($this->maxHeight)) {
return true;
}
if (false !== $dimension = getimagesize($this->mediaTmpName)) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method getErrors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ret = '';
if (count($this->errors) > 0) {
$ret = '<h4>Errors Returned While Uploading</h4>';
foreach ($this->errors as $error) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused local variables such as '$info'. Open
if ( ! ( $info = @getimagesize( $this->mediaTmpName ) ) ) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid excessively long variable names like $extensionsToBeSanitized. Keep variable name length under 20. Open
var $extensionsToBeSanitized = array( 'php' , 'phtml' , 'phtm' , 'php3' , 'php4' , 'cgi' , 'pl' , 'asp', 'php5' );
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class XoopsMediaUploader {
- Exclude checks
The parameter $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 68 and the first side effect is on line 63. Open
<?php
- Exclude checks
The var keyword must not be used to declare a property Open
var $maxHeight;
- Exclude checks
The var keyword must not be used to declare a property Open
var $savedDestination;
- Exclude checks
Visibility must be declared on property "$allowUnknownTypes" Open
var $allowUnknownTypes = false;
- Exclude checks
Visibility must be declared on property "$mediaTmpName" Open
var $mediaTmpName;
- Exclude checks
The var keyword must not be used to declare a property Open
var $mediaRealType = '';
- Exclude checks
The var keyword must not be used to declare a property Open
var $targetFileName;
- Exclude checks
Visibility must be declared on property "$prefix" Open
var $prefix;
- Exclude checks
Visibility must be declared on property "$mediaRealType" Open
var $mediaRealType = '';
- Exclude checks
Visibility must be declared on property "$savedFileName" Open
var $savedFileName;
- Exclude checks
The var keyword must not be used to declare a property Open
var $uploadDir = '';
- Exclude checks
Visibility must be declared on property "$errors" Open
var $errors = array();
- Exclude checks
The var keyword must not be used to declare a property Open
var $extensionToMime = array();
- Exclude checks
The var keyword must not be used to declare a property Open
var $allowedMimeTypes = array();
- Exclude checks
The var keyword must not be used to declare a property Open
var $errors = array();
- Exclude checks
The var keyword must not be used to declare a property Open
var $allowUnknownTypes = false;
- Exclude checks
Visibility must be declared on property "$mediaError" Open
var $mediaError;
- Exclude checks
Visibility must be declared on property "$checkImageType" Open
var $checkImageType = true;
- Exclude checks
The var keyword must not be used to declare a property Open
var $mediaType;
- Exclude checks
Visibility must be declared on property "$mediaType" Open
var $mediaType;
- Exclude checks
Visibility must be declared on property "$mediaSize" Open
var $mediaSize;
- Exclude checks
The var keyword must not be used to declare a property Open
var $mediaTmpName;
- Exclude checks
The var keyword must not be used to declare a property Open
var $mediaError;
- Exclude checks
Visibility must be declared on property "$maxHeight" Open
var $maxHeight;
- Exclude checks
The var keyword must not be used to declare a property Open
var $prefix;
- Exclude checks
Visibility must be declared on method "fetchMedia" Open
function fetchMedia($media_name, $index = null) {
- Exclude checks
Opening brace of a class must be on the line after the definition Open
class XoopsMediaUploader {
- Exclude checks
Visibility must be declared on property "$extensionsToBeSanitized" Open
var $extensionsToBeSanitized = array( 'php' , 'phtml' , 'phtm' , 'php3' , 'php4' , 'cgi' , 'pl' , 'asp', 'php5' );
- Exclude checks
The var keyword must not be used to declare a property Open
var $imageExtensions = array( 1 => 'gif', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tif', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm' );
- Exclude checks
Visibility must be declared on method "XoopsMediaUploader" Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Visibility must be declared on method "getMediaName" Open
function getMediaName() {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( file_exists(XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/uploader_error.php') ) {
- Exclude checks
The var keyword must not be used to declare a property Open
var $mediaName;
- Exclude checks
Visibility must be declared on property "$uploadDir" Open
var $uploadDir = '';
- Exclude checks
Visibility must be declared on property "$extensionToMime" Open
var $extensionToMime = array();
- Exclude checks
Visibility must be declared on property "$mediaName" Open
var $mediaName;
- Exclude checks
Visibility must be declared on property "$savedDestination" Open
var $savedDestination;
- Exclude checks
The var keyword must not be used to declare a property Open
var $savedFileName;
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$maxWidth"; expected 1 but found 0 Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Incorrect spacing between argument "$maxHeight" and equals sign; expected 1 but found 0 Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
The var keyword must not be used to declare a property Open
var $mediaSize;
- Exclude checks
Visibility must be declared on property "$imageExtensions" Open
var $imageExtensions = array( 1 => 'gif', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tif', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm' );
- Exclude checks
Incorrect spacing between argument "$maxWidth" and equals sign; expected 1 but found 0 Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Visibility must be declared on property "$allowedMimeTypes" Open
var $allowedMimeTypes = array();
- Exclude checks
The var keyword must not be used to declare a property Open
var $maxFileSize = 0;
- Exclude checks
Visibility must be declared on property "$maxFileSize" Open
var $maxFileSize = 0;
- Exclude checks
The var keyword must not be used to declare a property Open
var $maxWidth;
- Exclude checks
Method name "XoopsMediaUploader::XoopsMediaUploader" is not in camel caps format Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Visibility must be declared on method "getMediaType" Open
function getMediaType() {
- Exclude checks
Space found before comma in function call Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Incorrect spacing between argument "$maxFileSize" and equals sign; expected 1 but found 0 Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Visibility must be declared on method "getSavedDestination" Open
function getSavedDestination(){
- Exclude checks
Visibility must be declared on property "$targetFileName" Open
var $targetFileName;
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$maxHeight"; expected 1 but found 0 Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Visibility must be declared on property "$maxWidth" Open
var $maxWidth;
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$maxFileSize"; expected 1 but found 0 Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Visibility must be declared on method "getMediaSize" Open
function getMediaSize() {
- Exclude checks
Visibility must be declared on method "getMediaTmpName" Open
function getMediaTmpName() {
- Exclude checks
Space found before comma in function call Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
The var keyword must not be used to declare a property Open
var $extensionsToBeSanitized = array( 'php' , 'phtml' , 'phtm' , 'php3' , 'php4' , 'cgi' , 'pl' , 'asp', 'php5' );
- Exclude checks
The var keyword must not be used to declare a property Open
var $checkImageType = true;
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( array_key_exists($this->mediaExt, $this->extensionToMime) ) {
- Exclude checks
Visibility must be declared on method "setTargetFileName" Open
function setTargetFileName($value) {
- Exclude checks
Visibility must be declared on method "setPrefix" Open
function setPrefix($value){
- Exclude checks
Visibility must be declared on method "getSavedFileName" Open
function getSavedFileName(){
- Exclude checks
Visibility must be declared on method "upload" Open
function upload($chmod = 0644) {
- Exclude checks
Visibility must be declared on method "checkMaxHeight" Open
function checkMaxHeight() {
- Exclude checks
Visibility must be declared on method "checkImageType" Open
function checkImageType() {
- Exclude checks
Visibility must be declared on method "checkMaxWidth" Open
function checkMaxWidth() {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Visibility must be declared on method "_copyFile" Open
function _copyFile($chmod) {
- Exclude checks
Space found before comma in function call Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( ! ( $info = @getimagesize( $this->mediaTmpName ) ) ) {
- Exclude checks
Blank line found at start of control structure Open
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Exclude checks
Visibility must be declared on method "GetextensionToMime" Open
function GetextensionToMime() {
- Exclude checks
Space found before comma in function call Open
$xoopsDB->prefix("mimetypes") . ' t on p.mperm_mime = t.mime_id' . ' WHERE p.mperm_module=' . $xoopsModule->mid() . ' AND p.mperm_groups IN (' . implode(',' , $groups) . ')' . ' GROUP BY t.mime_ext' ;
- Exclude checks
Visibility must be declared on method "sanitizeMultipleExtensions" Open
function sanitizeMultipleExtensions() {
- Exclude checks
Method name "XoopsMediaUploader::GetextensionToMime" is not in camel caps format Open
function GetextensionToMime() {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
while ( $myrow = $xoopsDB->fetchArray($result) ) {
- Exclude checks
Visibility must be declared on method "setErrors" Open
function setErrors($error) {
- Exclude checks
Visibility must be declared on method "checkMimeType" Open
function checkMimeType() {
- Exclude checks
Method name "_copyFile" should not be prefixed with an underscore to indicate visibility Open
function _copyFile($chmod) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!is_object ( $xoopsModule ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if( $info === false || $this->imageExtensions[ (int)$info[2] ] != $ext ) {
- Exclude checks
Visibility must be declared on method "checkMaxFileSize" Open
function checkMaxFileSize() {
- Exclude checks
Visibility must be declared on method "getErrors" Open
function &getErrors($ashtml = true) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $mediaError;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
include_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/uploader_error.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $mediaType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $mediaTmpName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues )
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $maxHeight;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->allowedMimeTypes =& $allowedMimeTypes;
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$media_name]['name'][$index]) : $_FILES[$media_name]['name'][$index];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaTmpName = $_FILES[$media_name]['tmp_name'][$index];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaTmpName = $media_name['tmp_name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $mediaName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $uploadDir = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $allowedMimeTypes
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_FILENOTFOUND );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_FILENAMEEMPTY );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function getSavedDestination(){
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->uploadDir == '') {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_dir($this->uploadDir)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $allowedMimeTypes = array();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $savedFileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $checkImageType = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (count($this->errors) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $allowUnknownTypes = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int$maxHeight
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_FILEHEIGHTTOOLARGE, $this->maxHeight) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $maxFileSize = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxFileSize = intval($maxFileSize);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function fetchMedia($media_name, $index = null) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_MIMETYPELOAD );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaType = $media_name['type'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->mediaTmpName == 'none' || !is_uploaded_file($this->mediaTmpName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->mediaError > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the type of the uploaded file
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->mediaSize;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->checkMaxHeight()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $imageExtensions = array( 1 => 'gif', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tif', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm' );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_array($allowedMimeTypes)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($_FILES[$media_name])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (is_array($_FILES[$media_name]['name']) && isset($index)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_NOFILEUPLOADED );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->mediaName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the size of the uploaded file
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function getMediaTmpName() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->sanitizeMultipleExtensions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaError = !empty($media_name['error']) ? $media_name['error'] : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->savedFileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_FILEWIDTHTOOLARGE, $this->maxWidth) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $mediaSize;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $savedDestination;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$index = intval($index);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->errors = array();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_writeable($this->uploadDir)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_FAILEDUPLOADFILE, $this->mediaName) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $targetFileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $prefix;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $extensionsToBeSanitized = array( 'php' , 'phtml' , 'phtm' , 'php3' , 'php4' , 'cgi' , 'pl' , 'asp', 'php5' );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int$maxFileSize
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$media_name =& $_FILES[$media_name];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function upload($chmod = 0644) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_FAILEDOPENDIR, $this->uploadDir) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->checkMaxFileSize()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxWidth = intval($maxWidth);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->GetextensionToMime();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaError = !empty($_FILES[$media_name]['error'][$index]) ? $_FILES[$media_name]['error'][$index] : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set the target filename
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function setTargetFileName($value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check the file and copy it to the destination
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->_copyFile($chmod)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $extensionToMime = array();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $uploadDir
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaType = $_FILES[$media_name]['type'][$index];
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
//trigger_error( "XoopsMediaUploader: Set mediaRealType to {$this->mediaRealType} (file extension is $ext)", E_USER_NOTICE );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_INVALIDFILESIZE );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetFileName = strval(trim($value));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function getSavedFileName(){
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->checkImageType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
include_once XOOPS_ROOT_PATH . '/language/english/uploader_error.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $mediaRealType = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $errors = array();
- Exclude checks
Line exceeds 120 characters; contains 235 characters Open
var $imageExtensions = array( 1 => 'gif', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tif', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm' );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Constructor
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
* $uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Fetch the uploaded file
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
var $maxWidth;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaExt = strtolower(substr( $this->mediaName, strrpos( $this->mediaName, '.' ) + 1 ));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ( array_key_exists($this->mediaExt, $this->extensionToMime) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaSize = $media_name['size'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxFileSize = $this->extensionToMime[$this->mediaExt]['maxSize'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_FILESIZETOOLARGE, $this->mediaSize) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_ERROROCCURRED, $this->mediaError) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set the prefix
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->checkMimeType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_MIMETYPENOTALLOWED, $this->mediaType) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// extensions needed image check (anti-IE Content-Type XSS)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int$maxWidth
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int$cmodvalue
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $media_name Name of the file field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($media_name['name']) : $media_name['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaName = $media_name['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxWidth = $this->extensionToMime[$this->mediaExt]['maxWidth'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( sprintf(_ER_UP_FAILEDOPENDIRWRITE, $this->uploadDir) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->checkMaxWidth()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$matched = array();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $dimension = getimagesize($this->mediaTmpName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxHeight = intval($maxHeight);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->uploadDir = $uploadDir;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$media_name]['name'][$index]) : $_FILES[$media_name]['name'][$index];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int$index Index of the file (if more than one uploaded under that name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaSize = $_FILES[$media_name]['size'][$index];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxHeight = $this->extensionToMime[$this->mediaExt]['maxHeight'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (intval($this->mediaSize) < 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->mediaName == '') {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function getMediaName() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function getMediaSize() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the temporary name that the uploaded file was stored under
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->prefix = strval(trim($value));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->mediaTmpName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the saved filename
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the uploaded filename
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function getMediaType() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the destination the file is saved to
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_INVALIDIMAGEFILE );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!move_uploaded_file($this->mediaTmpName, $this->savedDestination)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
@unlink( $this->savedDestination );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ( empty($this->extensionToMime) || array_key_exists($this->mediaExt, $this->extensionToMime) );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dimension[1] > $this->maxHeight) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check whether or not the uploaded file type is allowed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function setPrefix($value){
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->mediaType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->savedDestination;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->savedFileName = $this->targetFileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->savedFileName = uniqid($this->prefix).'.'.strtolower($matched[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dimension[0] > $this->maxWidth) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
trigger_error(sprintf('Failed fetching image size of %s, skipping max width check..', $this->mediaTmpName), E_USER_WARNING);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$xoopsDB->prefix('mimetypes_perms') . ' p LEFT JOIN ' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $error
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Copy the file to its destination
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (isset($this->prefix)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Check IE XSS before returning success
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->maxHeight)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
trigger_error(sprintf('Failed fetching image size of %s, skipping max height check..', $this->mediaTmpName), E_USER_WARNING);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function checkImageType() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if( ("image" == substr($this->mediaType, 0, strpos($this->mediaType, "/"))) ||
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function sanitizeMultipleExtensions() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$replaces = array();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groups = is_object( $xoopsUser ) ? $xoopsUser -> getGroups() : array(XOOPS_GROUP_ANONYMOUS) ;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$ashtml) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Is the picture the right height?
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function GetextensionToMime() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->extensionToMime[$mimeExt] = array( 'maxWidth' => $myrow['mperm_maxwidth'], 'maxHeight' => $myrow['mperm_maxwidth'], 'maxSize' => $myrow['mperm_maxsize'] );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->savedFileName = strtolower($this->mediaName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$info = @getimagesize( $this->savedDestination ) ;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_SUSPICIOUSIMAGE );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Is the file the right size?
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function checkMaxFileSize() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $ashtml Format using HTML?
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->savedDestination = $this->uploadDir.'/'.$this->savedFileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->mediaSize > $this->maxFileSize) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->maxWidth)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add an error
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function &getErrors($ashtml = true) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function checkMaxHeight() {
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
trigger_error(sprintf('Failed fetching image size of %s, skipping max height check..', $this->mediaTmpName), E_USER_WARNING);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array|string Array of array messages OR HTML string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ret = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setErrors( _ER_UP_UNKNOWNFILETYPEREJECTED );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$replaces[] = "_".$ext.".";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mimeExt = $myrow['mime_ext'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ret .= $error.'<br />';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
@chmod($this->savedDestination, $chmod);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check whether or not the uploaded image type is valid
- Exclude checks
Inline control structures are not allowed Open
if(empty($this->checkImageType)) return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if(empty($this->extensionsToBeSanitized)) return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$patterns[] = "/\.".preg_quote($ext)."\./i";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->errors as $error) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $ret;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function checkMaxWidth() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $dimension = getimagesize($this->mediaTmpName)) {
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
trigger_error(sprintf('Failed fetching image size of %s, skipping max width check..', $this->mediaTmpName), E_USER_WARNING);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
global $xoopsModule, $xoopsUser, $xoopsDB;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_object ( $xoopsModule ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sql = 'SELECT t.mime_types, t.mime_ext, p.mperm_maxwidth, p.mperm_maxheight, p.mperm_maxsize FROM ' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (count($this->errors) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ret = '<h4>Errors Returned While Uploading</h4>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function _copyFile($chmod) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sanitize executable filename with multiple extensions
- Exclude checks
Inline control structures are not allowed Open
if(empty($this->extensionsToBeSanitized)) return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->errors[] = trim($error);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($this->targetFileName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function checkMimeType() {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Is the picture the right width?
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 208 characters Open
$xoopsDB->prefix("mimetypes") . ' t on p.mperm_mime = t.mime_id' . ' WHERE p.mperm_module=' . $xoopsModule->mid() . ' AND p.mperm_groups IN (' . implode(',' , $groups) . ')' . ' GROUP BY t.mime_ext' ;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ( $myrow = $xoopsDB->fetchArray($result) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if( $info === false || $this->imageExtensions[ (int)$info[2] ] != $ext ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->errors;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$patterns = array();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$intersect = array_intersect($this->allowedMimeTypes,$mime_types);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
**/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach($this->extensionsToBeSanitized as $ext){
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$xoopsDB->prefix("mimetypes") . ' t on p.mperm_mime = t.mime_id' . ' WHERE p.mperm_module=' . $xoopsModule->mid() . ' AND p.mperm_groups IN (' . implode(',' , $groups) . ')' . ' GROUP BY t.mime_ext' ;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mime_types = explode('|',$myrow['mime_types']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (count($intersect) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get generated errors
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if(empty($this->checkImageType)) return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ( ! ( $info = @getimagesize( $this->mediaTmpName ) ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mediaName = preg_replace($patterns, $replaces, $this->mediaName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$xoopsModule = $hModule->getByDirname('system');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $xoopsDB->query($sql);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
function setErrors($error) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hModule = &xoops_gethandler('module');
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
$this->extensionToMime[$mimeExt] = array( 'maxWidth' => $myrow['mperm_maxwidth'], 'maxHeight' => $myrow['mperm_maxwidth'], 'maxSize' => $myrow['mperm_maxsize'] );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Opening brace should be on a new line Open
function fetchMedia($media_name, $index = null) {
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaName = $media_name['name'];
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->mediaExt = strtolower(substr( $this->mediaName, strrpos( $this->mediaName, '.' ) + 1 ));
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_INVALIDFILESIZE );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
return false;
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
} else {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_FILEHEIGHTTOOLARGE, $this->maxHeight) );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if ( array_key_exists($this->mediaExt, $this->extensionToMime) ) {
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
return false;
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_FILENAMEEMPTY );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
return false;
- Exclude checks
Opening brace should be on a new line Open
function upload($chmod = 0644) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_MIMETYPENOTALLOWED, $this->mediaType) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_FAILEDOPENDIR, $this->uploadDir) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_FILEWIDTHTOOLARGE, $this->maxWidth) );
- Exclude checks
Opening brace should be on a new line Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_MIMETYPELOAD );
- Exclude checks
Closing brace indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if ( array_key_exists($this->mediaExt, $this->extensionToMime) ) {
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->maxWidth = $this->extensionToMime[$this->mediaExt]['maxWidth'];
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if ($this->mediaTmpName == 'none' || !is_uploaded_file($this->mediaTmpName)) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_NOFILEUPLOADED );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
return false;
- Exclude checks
Opening brace should be on a new line Open
function getMediaName() {
- Exclude checks
Opening brace should be on a new line Open
function getSavedFileName(){
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_INVALIDIMAGEFILE );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if ( file_exists(XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/uploader_error.php') ) {
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$index = intval($index);
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$media_name =& $_FILES[$media_name];
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->setErrors( sprintf(_ER_UP_ERROROCCURRED, $this->mediaError) );
- Exclude checks
Opening brace should be on a new line Open
function setPrefix($value){
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_MIMETYPENOTALLOWED, $this->mediaType) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_FILESIZETOOLARGE, $this->mediaSize) );
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->maxHeight = $this->extensionToMime[$this->mediaExt]['maxHeight'];
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->setErrors( _ER_UP_FILENAMEEMPTY );
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_ERROROCCURRED, $this->mediaError) );
- Exclude checks
Opening brace should be on a new line Open
function getMediaTmpName() {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_FILENOTFOUND );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaType = $_FILES[$media_name]['type'][$index];
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
return false;
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaError = !empty($_FILES[$media_name]['error'][$index]) ? $_FILES[$media_name]['error'][$index] : 0;
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaType = $media_name['type'];
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaError = !empty($media_name['error']) ? $media_name['error'] : 0;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if (!isset($_FILES[$media_name])) {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
} elseif (is_array($_FILES[$media_name]['name']) && isset($index)) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_INVALIDFILESIZE );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_FAILEDOPENDIRWRITE, $this->uploadDir) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_MIMETYPELOAD );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$media_name]['name'][$index]) : $_FILES[$media_name]['name'][$index];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->errors = array();
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->setErrors( _ER_UP_NOFILEUPLOADED );
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if ($this->mediaError > 0) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_FAILEDOPENDIRWRITE, $this->uploadDir) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
return false;
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Closing brace indented incorrectly; expected 4 spaces, found 0 Open
}
- Exclude checks
Opening brace should be on a new line Open
function getMediaType() {
- Exclude checks
Opening brace should be on a new line Open
function getMediaSize() {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_FAILEDOPENDIR, $this->uploadDir) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaTmpName = $_FILES[$media_name]['tmp_name'][$index];
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaTmpName = $media_name['tmp_name'];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->mediaExt = strtolower(substr( $this->mediaName, strrpos( $this->mediaName, '.' ) + 1 ));
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->mediaExt = strtolower(substr( $this->mediaName, strrpos( $this->mediaName, '.' ) + 1 ));
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->setErrors( _ER_UP_FILENOTFOUND );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaSize = $media_name['size'];
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_FILENAMEEMPTY );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_NOFILEUPLOADED );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_INVALIDIMAGEFILE );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_FAILEDUPLOADFILE, $this->mediaName) );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->maxFileSize = $this->extensionToMime[$this->mediaExt]['maxSize'];
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->setErrors( _ER_UP_INVALIDFILESIZE );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_ERROROCCURRED, $this->mediaError) );
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return true;
- Exclude checks
Opening brace should be on a new line Open
function setTargetFileName($value) {
- Exclude checks
Opening brace should be on a new line Open
function getSavedDestination(){
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_FILEHEIGHTTOOLARGE, $this->maxHeight) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_FILENOTFOUND );
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($media_name['name']) : $media_name['name'];
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->mediaExt = strtolower(substr( $this->mediaName, strrpos( $this->mediaName, '.' ) + 1 ));
- Exclude checks
Line indented incorrectly; expected at least 12 spaces, found 8 Open
$this->mediaSize = $_FILES[$media_name]['size'][$index];
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->mediaExt = strtolower(substr( $this->mediaName, strrpos( $this->mediaName, '.' ) + 1 ));
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if (intval($this->mediaSize) < 0) {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if ($this->mediaName == '') {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_UPLOADDIRNOTSET );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( sprintf(_ER_UP_FILESIZETOOLARGE, $this->mediaSize) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_SUSPICIOUSIMAGE );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_UNKNOWNFILETYPEREJECTED );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Opening brace should be on a new line Open
function checkImageType() {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_FILEWIDTHTOOLARGE, $this->maxWidth) );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if( $info === false || $this->imageExtensions[ (int)$info[2] ] != $ext ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( ! ( $info = @getimagesize( $this->mediaTmpName ) ) ) {
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($this->extensionsToBeSanitized as $ext){
- Exclude checks
Opening brace should be on a new line Open
function _copyFile($chmod) {
- Exclude checks
Opening brace should be on a new line Open
function checkMaxFileSize() {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
@unlink( $this->savedDestination );
- Exclude checks
Opening brace should be on a new line Open
function checkMaxHeight() {
- Exclude checks
Closing brace indented incorrectly; expected 12 spaces, found 8 Open
}
- Exclude checks
Opening brace should be on a new line Open
function GetextensionToMime() {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (!is_object ( $xoopsModule ) ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
@unlink( $this->savedDestination );
- Exclude checks
Opening brace should be on a new line Open
function sanitizeMultipleExtensions() {
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
while ( $myrow = $xoopsDB->fetchArray($result) ) {
- Exclude checks
Opening brace should be on a new line Open
function setErrors($error) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$info = @getimagesize( $this->savedDestination ) ;
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( _ER_UP_SUSPICIOUSIMAGE );
- Exclude checks
Opening brace should be on a new line Open
function checkMimeType() {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->setErrors( sprintf(_ER_UP_FAILEDUPLOADFILE, $this->mediaName) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$info = @getimagesize( $this->savedDestination ) ;
- Exclude checks
Space before opening parenthesis of function call prohibited Open
if (!is_object ( $xoopsModule ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!is_object ( $xoopsModule ) ) {
- Exclude checks
Opening brace should be on a new line Open
function checkMaxWidth() {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$groups = is_object( $xoopsUser ) ? $xoopsUser -> getGroups() : array(XOOPS_GROUP_ANONYMOUS) ;
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$groups = is_object( $xoopsUser ) ? $xoopsUser -> getGroups() : array(XOOPS_GROUP_ANONYMOUS) ;
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if( in_array( $ext , $this->imageExtensions ) ) {
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if( $info === false || $this->imageExtensions[ (int)$info[2] ] != $ext ) {
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if( ("image" == substr($this->mediaType, 0, strpos($this->mediaType, "/"))) ||
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
(!empty($this->mediaRealType) && "image" == substr($this->mediaRealType, 0, strpos($this->mediaRealType, "/"))) ){
- Exclude checks
No space found after comma in function call Open
$mime_types = explode('|',$myrow['mime_types']);
- Exclude checks
A closing tag is not permitted at the end of a PHP file Open
?>
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if ( ! ( $info = @getimagesize( $this->mediaTmpName ) ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$ext = strtolower( substr( strrchr( $this->savedDestination , '.' ) , 1 ) ) ;
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if( ("image" == substr($this->mediaType, 0, strpos($this->mediaType, "/"))) ||
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if ( count( $this->extensionToMime ) == 0 ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->setErrors( _ER_UP_UNKNOWNFILETYPEREJECTED );
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if(empty($this->checkImageType)) return true;
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
if ( ! ( $info = @getimagesize( $this->mediaTmpName ) ) ) {
- Exclude checks
Expected 1 newline at end of file; 0 found Open
?>
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
foreach($this->extensionsToBeSanitized as $ext){
- Exclude checks
Opening brace should be on a new line Open
function &getErrors($ashtml = true) {
- Exclude checks
No space found after comma in function call Open
$intersect = array_intersect($this->allowedMimeTypes,$mime_types);
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if(empty($this->extensionsToBeSanitized)) return;
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
foreach($this->extensionsToBeSanitized as $ext){
- Exclude checks
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mime_types is not named in camelCase. Open
function GetextensionToMime() {
global $xoopsModule, $xoopsUser, $xoopsDB;
if (!is_object ( $xoopsModule ) ) {
$hModule = &xoops_gethandler('module');
$xoopsModule = $hModule->getByDirname('system');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mime_types is not named in camelCase. Open
function GetextensionToMime() {
global $xoopsModule, $xoopsUser, $xoopsDB;
if (!is_object ( $xoopsModule ) ) {
$hModule = &xoops_gethandler('module');
$xoopsModule = $hModule->getByDirname('system');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $media_name is not named in camelCase. Open
function fetchMedia($media_name, $index = null) {
/*
if ( empty( $this->extensionToMime ) ) {
*/
if ( count( $this->extensionToMime ) == 0 ) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method XoopsMediaUploader is not named in camelCase. Open
function XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null) {
/*
@$this->extensionToMime = include( XOOPS_ROOT_PATH . '/class/mimetypes.inc.php' );
if ( !is_array( $this->extensionToMime ) ) {
$this->extensionToMime = array();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method GetextensionToMime is not named in camelCase. Open
function GetextensionToMime() {
global $xoopsModule, $xoopsUser, $xoopsDB;
if (!is_object ( $xoopsModule ) ) {
$hModule = &xoops_gethandler('module');
$xoopsModule = $hModule->getByDirname('system');
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _copyFile is not named in camelCase. Open
function _copyFile($chmod) {
$matched = array();
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}