YetiForceCompany/YetiForceCRM

View on GitHub
vtlib/Vtiger/Utils.php

Summary

Maintainability
A
0 mins
Test Coverage
F
46%

Missing class import via use statement (line '78', column '15').
Open

                throw new \App\Exceptions\AppException('Sorry! Attempt to access restricted file.');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '115', column '15').
Open

                throw new \App\Exceptions\AppException('Sorry! Attempt to access restricted file.');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method implodestr has a boolean flag argument $suffix, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function implodestr($prefix, $count, $suffix = false)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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

The method checkFileAccessForInclusion has a boolean flag argument $dieOnFail, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function checkFileAccessForInclusion($filepath, $dieOnFail = true)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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

The method checkFileAccess has a boolean flag argument $dieOnFail, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function checkFileAccess($filepath, $dieOnFail = true)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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

Avoid using static access to class '\App\Log' in method 'checkFileAccess'.
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Log' in method 'checkFileAccessForInclusion'.
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Config' in method 'checkFileAccess'.
Open

        $use_root_directory = \App\Config::main('root_directory');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Db' in method 'addColumn'.
Open

        $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Saw possibly unextractable annotation for a fragment of comment '* @param string File path to check': after string, did not see an element name (will guess based on comment order)
Open

     * @param string File path to check
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Call to method error from undeclared class \App\Log
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Critical
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string SQL String': after string, did not see an element name (will guess based on comment order)
Open

     * @param string SQL String
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param mixed String or Integer': after mixed, did not see an element name (will guess based on comment order)
Open

     * @param mixed String or Integer
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string suffix to use (optional)': after string, did not see an element name (will guess based on comment order)
Open

     * @param string suffix to use (optional)
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Call to method error from undeclared class \App\Log
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Critical
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string tablename to check': after string, did not see an element name (will guess based on comment order)
Open

     * @param string tablename to check
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string SQL String': after string, did not see an element name (will guess based on comment order)
Open

     * @param string SQL String
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Call to undeclared method \App\Db::getSchema
Open

                $criteria = $db->getSchema()->createColumnSchemaBuilder($criteria[0], $criteria[1]);
Severity: Critical
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string prefix to use': after string, did not see an element name (will guess based on comment order)
Open

     * @param string prefix to use
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param int Number of times': after int, did not see an element name (will guess based on comment order)
Open

     * @param int Number of times
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Call to undeclared method \App\Db::createCommand
Open

            $db->createCommand()->addColumn($tableName, $columnName, $criteria)->execute();
Severity: Critical
Found in vtlib/Vtiger/Utils.php by phan

Call to undeclared method \App\Db::getSchema
Open

        $tableSchema = $db->getSchema()->getTableSchema($tableName, true);
Severity: Critical
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string File path to check': after string, did not see an element name (will guess based on comment order)
Open

     * @param string File path to check
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool False to avoid die() if check fails': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool False to avoid die() if check fails
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool False to avoid die() if check fails': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool False to avoid die() if check fails
Severity: Info
Found in vtlib/Vtiger/Utils.php by phan

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return is_numeric($value) ? (int) $value == $value : false;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Check if given value is a number or not.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Implode the prefix and suffix as string for given number of times.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function isNumber($value)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Line exceeds 120 characters; contains 158 characters
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (empty($use_root_directory)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return false;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $sql
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $strvalue .= $prefix;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $unsafeDirectories = ['storage', 'cache', 'test'];
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return true;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to check the file access is made within web root directory.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $use_root_directory = \App\Config::main('root_directory');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Add column to existing table.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ($suffix && $index != ($count - 1)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $strvalue .= $suffix;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string File path to check
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $realfilepath = str_replace('\\\\', '\\', $realfilepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string SQL String
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return false;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $prefix
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function implodestr($prefix, $count, $suffix = false)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $relativeFilePath = str_replace($rootdirpath, '', $realfilepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $use_root_directory = realpath(__DIR__ . '/../../.');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string       $tableName  to alter
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $tableSchema = $db->getSchema()->getTableSchema($tableName, true);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $rootdirpath = str_replace('\\', '/', $rootdirpath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $db = \App\Db::getInstance();
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (preg_match('/(CREATE TABLE)/', strtoupper($sql))) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $value
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string prefix to use
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $filepath
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $dieOnFail
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        /** Replace all \\ with \ first */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Check if the given SQL is a CREATE statement.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed String or Integer
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $strvalue = '';
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $rootdirpath = str_replace('\\\\', '\\', ROOT_DIRECTORY . \DIRECTORY_SEPARATOR);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        /** Replace all \ with / now */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $suffix
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $realfilepath = str_replace('\\\\', '\\', $realfilepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                throw new \App\Exceptions\AppException('Sorry! Attempt to access restricted file.');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $rootdirpath = str_replace('\\\\', '\\', $use_root_directory);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int Number of times
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $strvalue;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $rootdirpath = str_replace('\\', '/', $rootdirpath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $realfilepath = str_replace('\\', '/', $realfilepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Line exceeds 120 characters; contains 158 characters
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                throw new \App\Exceptions\AppException('Sorry! Attempt to access restricted file.');
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (null === $tableSchema->getColumn((string) $columnName)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if (is_array($criteria)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $sql
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return false;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string suffix to use (optional)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Check if table is present in database.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return \App\Db::getInstance()->isTableExists($tableName);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        for ($index = 0; $index < $count; ++$index) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to check the file access is made within web root directory as well as is safe for php inclusion.
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        /** Replace all \\ with \ first */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ($dieOnFail) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $count
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $realfilepath = realpath($filepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $realfilepath = str_replace('\\', '/', $realfilepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return false;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        /** Replace all \ with / now */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return true;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string tablename to check
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function checkTable($tableName)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function isCreateSql($sql)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string SQL String
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function isDestructiveSql($sql)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string File path to check
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                \App\Log::error(__METHOD__ . '(' . $filepath . ') - Sorry! Attempt to access restricted file. realfilepath: ' . print_r($realfilepath, true));
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $tableName
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool False to avoid die() if check fails
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $dieOnFail
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Set the base directory to compare with
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (0 !== stripos($realfilepath, $rootdirpath)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string       $columnName to add
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (preg_match('/(DROP TABLE)|(DROP COLUMN)|(DELETE FROM)/', strtoupper($sql))) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $filePathParts = explode('/', $relativeFilePath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ($dieOnFail) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool False to avoid die() if check fails
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param mixed $filepath
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function checkFileAccess($filepath, $dieOnFail = true)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $realfilepath = realpath($filepath);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array|string $criteria   ([\yii\db\Schema::TYPE_STRING, 1024] | string(1024))
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $criteria = $db->getSchema()->createColumnSchemaBuilder($criteria[0], $criteria[1]);
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $db->createCommand()->addColumn($tableName, $columnName, $criteria)->execute();
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function checkFileAccessForInclusion($filepath, $dieOnFail = true)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (0 !== stripos($realfilepath, $rootdirpath) || in_array($filePathParts[0], $unsafeDirectories)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function addColumn($tableName, $columnName, $criteria)
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return true;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Check if the given SQL is destructive (DELETE's DATA).
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return true;
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpcodesniffer

The variable $use_root_directory is not named in camelCase.
Open

    public static function checkFileAccess($filepath, $dieOnFail = true)
    {
        // Set the base directory to compare with
        $use_root_directory = \App\Config::main('root_directory');
        if (empty($use_root_directory)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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 $use_root_directory is not named in camelCase.
Open

    public static function checkFileAccess($filepath, $dieOnFail = true)
    {
        // Set the base directory to compare with
        $use_root_directory = \App\Config::main('root_directory');
        if (empty($use_root_directory)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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 $use_root_directory is not named in camelCase.
Open

    public static function checkFileAccess($filepath, $dieOnFail = true)
    {
        // Set the base directory to compare with
        $use_root_directory = \App\Config::main('root_directory');
        if (empty($use_root_directory)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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 $use_root_directory is not named in camelCase.
Open

    public static function checkFileAccess($filepath, $dieOnFail = true)
    {
        // Set the base directory to compare with
        $use_root_directory = \App\Config::main('root_directory');
        if (empty($use_root_directory)) {
Severity: Minor
Found in vtlib/Vtiger/Utils.php by phpmd

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

There are no issues that match your filters.

Category
Status