query accesses the super-global variable $GLOBALS. Open
function query( $sql) {
$db = $GLOBALS['xoopsDB'];
if (! ( $ret = $db->queryF( $sql ) )) {
echo $db->error();
}
- 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
check_auth_db accesses the super-global variable $GLOBALS. Open
function check_auth_db() {
$db = $GLOBALS['xoopsDB'];
$value = getDbValue( $db, 'config', 'conf_id',
"`conf_name` = 'ldap_provisionning' AND `conf_catid` = " . XOOPS_CONF_AUTH
);
- 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
apply_auth_db accesses the super-global variable $GLOBALS. Open
function apply_auth_db() {
$db = $GLOBALS['xoopsDB'];
$cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );
if ($cat !== false && $cat != XOOPS_CONF_AUTH) {
- 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
Function apply_0523patch
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function apply_0523patch() {
$patchCode = "
foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
if (isset( \$_REQUEST[\$bad_global] )) {
header( 'Location: '.XOOPS_URL.'/' );
- 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 apply_0523patch
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function apply_0523patch() {
$patchCode = "
foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
if (isset( \$_REQUEST[\$bad_global] )) {
header( 'Location: '.XOOPS_URL.'/' );
Method apply_auth_db
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function apply_auth_db() {
$db = $GLOBALS['xoopsDB'];
$cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );
if ($cat !== false && $cat != XOOPS_CONF_AUTH) {
Function apply_auth_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function apply_auth_db() {
$db = $GLOBALS['xoopsDB'];
$cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );
if ($cat !== false && $cat != XOOPS_CONF_AUTH) {
- 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 apply_0523patch() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
function apply_0523patch() {
$patchCode = "
foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
if (isset( \$_REQUEST[\$bad_global] )) {
header( 'Location: '.XOOPS_URL.'/' );
- 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 apply_0523patch uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );
$prepend = implode( '', array_slice( $lines, 0, $insert ) );
$append = implode( '', array_slice( $lines, $insert ) );
- 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 '103', column '11'). Open
function query( $sql) {
$db = $GLOBALS['xoopsDB'];
if (! ( $ret = $db->queryF( $sql ) )) {
echo $db->error();
}
- 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 apply_0523patch uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fp = fopen( '../mainfile.php', 'wt' );
if (!$fp) {
echo 'Error opening mainfile.php, please apply the patch manually.';
echo $manual;
- 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 '$ret'. Open
if (! ( $ret = $db->queryF( $sql ) )) {
- 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
Reference to undeclared constant \XOOPS_CONF_AUTH
Open
if ($cat !== false && $cat != XOOPS_CONF_AUTH) {
- Exclude checks
Reference to undeclared constant \XOOPS_CONF_AUTH
Open
"`conf_name` = 'ldap_provisionning' AND `conf_catid` = " . XOOPS_CONF_AUTH
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class upgrade_2014 {
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = getDbValue( $db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='auth_method'" );
- Read upRead up
- Exclude checks
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
The class upgrade_2014 is not named in CamelCase. Open
class upgrade_2014 {
var $usedFiles = array( 'mainfile.php' );
function isApplied() {
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = $GLOBALS['xoopsDB'];
- Read upRead up
- Exclude checks
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
Avoid variables with short names like $fp. Configured minimum length is 3. Open
$fp = fopen( '../mainfile.php', 'wt' );
- Read upRead up
- Exclude checks
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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = $GLOBALS['xoopsDB'];
- Read upRead up
- Exclude checks
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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = $GLOBALS['xoopsDB'];
- Read upRead up
- Exclude checks
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
Method name "upgrade_2014::apply_0523patch" is not in camel caps format Open
function apply_0523patch() {
- Exclude checks
Space found after opening bracket of FOREACH loop Open
foreach ( $lines as $k => $line) {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_provisionning' => "'_MD_AM_LDAP_PROVIS', '0', '_MD_AM_LDAP_PROVIS_DESC', 'yesno', 'int', 13",
- Exclude checks
Space found after opening bracket of FOREACH loop Open
foreach ( $data as $name => $value) {
- Exclude checks
Visibility must be declared on method "apply_0523patch" Open
function apply_0523patch() {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_filter_person' => "'_MD_AM_LDAP_FILTER_PERSON', '', '_MD_AM_LDAP_FILTER_PERSON_DESC', 'textbox', 'text', 11",
- Exclude checks
Method name "upgrade_2014::check_0523patch" is not in camel caps format Open
function check_0523patch() {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_domain_name' => "'_MD_AM_LDAP_DOMAIN_NAME', 'mydomain', '_MD_AM_LDAP_DOMAIN_NAME_DESC', 'textbox', 'text', 12",
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_manager_dn' => "'_MD_AM_LDAP_MANAGER_DN', 'manager_dn', '_MD_AM_LDAP_MANAGER_DN_DESC', 'textbox', 'text', 5",
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_manager_pass' => "'_MD_AM_LDAP_MANAGER_PASS', 'manager_pass', '_MD_AM_LDAP_MANAGER_PASS_DESC', 'textbox', 'text', 6",
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_mail_attr' => "'_MD_AM_LDAP_MAIL_ATTR', 'mail', '_MD_AM_LDAP_MAIL_ATTR_DESC', 'textbox', 'text', 15",
- Exclude checks
Method name "upgrade_2014::check_auth_db" is not in camel caps format Open
function check_auth_db() {
- Exclude checks
Space found after opening bracket of FOREACH loop Open
foreach ( $data as $name => $values) {
- Exclude checks
Visibility must be declared on method "apply" Open
function apply() {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_loginldap_attr' => "'_MD_AM_LDAP_LOGINLDAP_ATTR', 'uid', '_MD_AM_LDAP_LOGINLDAP_ATTR_D', 'textbox', 'text', 10",
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_givenname_attr' => "'_MD_AM_LDAP_GIVENNAME_ATTR', 'givenname', '_MD_AM_LDAP_GIVENNAME_ATTR_DSC', 'textbox', 'text', 16",
- Exclude checks
Visibility must be declared on method "isApplied" Open
function isApplied() {
- Exclude checks
Visibility must be declared on method "query" Open
function query( $sql) {
- Exclude checks
Expected 0 spaces between opening bracket and argument "$sql"; 1 found Open
function query( $sql) {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_provisionning_group' => "'_MD_AM_LDAP_PROVIS_GROUP', 'a:1:{i:0;s:1:\"2\";}', '_MD_AM_LDAP_PROVIS_GROUP_DSC', 'group_multi', 'array', 14",
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_surname_attr' => "'_MD_AM_LDAP_SURNAME_ATTR', 'sn', '_MD_AM_LDAP_SURNAME_ATTR_DESC', 'textbox', 'text', 17",
- Exclude checks
The var keyword must not be used to declare a property Open
var $usedFiles = array( 'mainfile.php' );
- Exclude checks
Visibility must be declared on method "apply_auth_db" Open
function apply_auth_db() {
- Exclude checks
Visibility must be declared on property "$usedFiles" Open
var $usedFiles = array( 'mainfile.php' );
- Exclude checks
Visibility must be declared on method "check_auth_db" Open
function check_auth_db() {
- Exclude checks
Expected 1 space after comma in function call; 2 found Open
fwrite( $fp, $content );
- Exclude checks
Method name "upgrade_2014::apply_auth_db" is not in camel caps format Open
function apply_auth_db() {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_users_bypass' => "'_MD_AM_LDAP_USERS_BYPASS', '".serialize(array('admin'))."', '_MD_AM_LDAP_USERS_BYPASS_DESC', 'textarea', 'array', 8",
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_loginname_asdn' => "'_MD_AM_LDAP_LOGINNAME_ASDN', 'uid_asdn', '_MD_AM_LDAP_LOGINNAME_ASDN_D', 'yesno', 'int', 9",
- Exclude checks
Visibility must be declared on method "check_0523patch" Open
function check_0523patch() {
- Exclude checks
Space found after opening bracket of FOREACH loop Open
foreach ( $lines as $line) {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
'ldap_version' => "'_MD_AM_LDAP_VERSION', '3', '_MD_AM_LDAP_VERSION_DESC', 'textbox', 'text', 7",
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$value = getDbValue( $db, 'config', 'conf_id',
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$value = getDbValue( $db, 'config', 'conf_id',
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$lines = file( '../mainfile.php' );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$lines = file( '../mainfile.php' );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!is_writable( '../mainfile.php' )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$fp = fopen( '../mainfile.php', 'wt' );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$table = $db->prefix( 'config' );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
foreach ( $data as $name => $values) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$table = $db->prefix( 'configoption' );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$prepend = implode( '', array_slice( $lines, 0, $insert ) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
foreach ( $lines as $k => $line) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$manual = "<h2>" . _MANUAL_INSTRUCTIONS . "</h2>\n<p>" . sprintf( _COPY_RED_LINES, "mainfile.php" ) . "</p>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (!is_writable( '../mainfile.php' )) {
- 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
$db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (! ( $ret = $db->queryF( $sql ) )) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$manual = "<h2>" . _MANUAL_INSTRUCTIONS . "</h2>\n<p>" . sprintf( _COPY_RED_LINES, "mainfile.php" ) . "</p>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$fp = fopen( '../mainfile.php', 'wt' );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
fwrite( $fp, $content );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
fclose( $fp );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$id = getDbValue( $db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='auth_method'" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->query( "DELETE FROM `$table` WHERE `conf_id`=$id" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$this->query( "INSERT INTO `$table` (confop_name, confop_value, conf_id) VALUES ('$name', '$value', $id)" );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$lines = file( '../mainfile.php' );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
fwrite( $fp, $content );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );
- Exclude checks
Class name "upgrade_2014" is not in camel caps format Open
class upgrade_2014 {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
printf( _FAILED_PATCH . "<br />", "mainfile.php" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$append = implode( '', array_slice( $lines, $insert ) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$table = $db->prefix( 'config' );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!getDbValue( $db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='$name'" )) {
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
foreach ( $lines as $line) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$append = implode( '', array_slice( $lines, $insert ) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$append = implode( '', array_slice( $lines, $insert ) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$id = getDbValue( $db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='auth_method'" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$table = $db->prefix( 'configoption' );
- Exclude checks
Expected 1 newline at end of file; 0 found Open
?>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
printf( _FAILED_PATCH . "<br />", "mainfile.php" );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$content = str_replace( array( "\r\n", "\n" ), $newline, $content );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
fclose( $fp );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$prepend = implode( '', array_slice( $lines, 0, $insert ) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (!getDbValue( $db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='$name'" )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$prepend = implode( '', array_slice( $lines, 0, $insert ) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$prepend = implode( '', array_slice( $lines, 0, $insert ) );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$append = implode( '', array_slice( $lines, $insert ) );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->query( "DELETE FROM `$table` WHERE `conf_id`=$id" );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
foreach ( $data as $name => $value) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$lines = file( '../mainfile.php' );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$content = str_replace( array( "\r\n", "\n" ), $newline, $content );
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
$value = getDbValue( $db, 'config', 'conf_id',
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (! ( $ret = $db->queryF( $sql ) )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$this->query( "INSERT INTO `$table` (confop_name, confop_value, conf_id) VALUES ('$name', '$value', $id)" );
- Exclude checks
The method check_auth_db is not named in camelCase. Open
function check_auth_db() {
$db = $GLOBALS['xoopsDB'];
$value = getDbValue( $db, 'config', 'conf_id',
"`conf_name` = 'ldap_provisionning' AND `conf_catid` = " . XOOPS_CONF_AUTH
);
- 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 apply_0523patch is not named in camelCase. Open
function apply_0523patch() {
$patchCode = "
foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
if (isset( \$_REQUEST[\$bad_global] )) {
header( 'Location: '.XOOPS_URL.'/' );
- 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 apply_auth_db is not named in camelCase. Open
function apply_auth_db() {
$db = $GLOBALS['xoopsDB'];
$cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );
if ($cat !== false && $cat != XOOPS_CONF_AUTH) {
- 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 check_0523patch is not named in camelCase. Open
function check_0523patch() {
$lines = file( '../mainfile.php' );
foreach ( $lines as $line) {
if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {
// Patch found: do not apply again
- 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
Unexpected spaces found. Open
if (!isset(\$xoopsOption['nocommon']) && ICMS_ROOT_PATH != '') {
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected spaces found. Open
'ldap_filter_person' => "'_MD_AM_LDAP_FILTER_PERSON', '', '_MD_AM_LDAP_FILTER_PERSON_DESC', 'textbox', 'text', 11",
- Exclude checks
Unexpected spaces found. Open
'ldap_surname_attr' => "'_MD_AM_LDAP_SURNAME_ATTR', 'sn', '_MD_AM_LDAP_SURNAME_ATTR_DESC', 'textbox', 'text', 17",
- Exclude checks
Unexpected spaces found. Open
'ldap_manager_dn' => "'_MD_AM_LDAP_MANAGER_DN', 'manager_dn', '_MD_AM_LDAP_MANAGER_DN_DESC', 'textbox', 'text', 5",
- Exclude checks
Unexpected spaces found. Open
header( 'Location: '.XOOPS_URL.'/' );
- Exclude checks
Unexpected spaces found. Open
exit();
- Exclude checks
Unexpected spaces found. Open
'ldap_loginldap_attr' => "'_MD_AM_LDAP_LOGINLDAP_ATTR', 'uid', '_MD_AM_LDAP_LOGINLDAP_ATTR_D', 'textbox', 'text', 10",
- Exclude checks
Unexpected spaces found. Open
foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected spaces found. Open
'ldap_provisionning_group' => "'_MD_AM_LDAP_PROVIS_GROUP', 'a:1:{i:0;s:1:\"2\";}', '_MD_AM_LDAP_PROVIS_GROUP_DSC', 'group_multi', 'array', 14",
- Exclude checks
Unexpected spaces found. Open
'ldap_givenname_attr' => "'_MD_AM_LDAP_GIVENNAME_ATTR', 'givenname', '_MD_AM_LDAP_GIVENNAME_ATTR_DSC', 'textbox', 'text', 16",
- Exclude checks
Unexpected spaces found. Open
}
- Exclude checks
Unexpected spaces found. Open
'ldap_mail_attr' => "'_MD_AM_LDAP_MAIL_ATTR', 'mail', '_MD_AM_LDAP_MAIL_ATTR_DESC', 'textbox', 'text', 15",
- Exclude checks
Unexpected spaces found. Open
}
- Exclude checks
Unexpected spaces found. Open
'ldap_manager_pass' => "'_MD_AM_LDAP_MANAGER_PASS', 'manager_pass', '_MD_AM_LDAP_MANAGER_PASS_DESC', 'textbox', 'text', 6",
- Exclude checks
Unexpected spaces found. Open
'ldap_version' => "'_MD_AM_LDAP_VERSION', '3', '_MD_AM_LDAP_VERSION_DESC', 'textbox', 'text', 7",
- Exclude checks
Unexpected spaces found. Open
if (isset( \$_REQUEST[\$bad_global] )) {
- Exclude checks
Unexpected spaces found. Open
'ldap_domain_name' => "'_MD_AM_LDAP_DOMAIN_NAME', 'mydomain', '_MD_AM_LDAP_DOMAIN_NAME_DESC', 'textbox', 'text', 12",
- Exclude checks
Unexpected spaces found. Open
'ldap_users_bypass' => "'_MD_AM_LDAP_USERS_BYPASS', '".serialize(array('admin'))."', '_MD_AM_LDAP_USERS_BYPASS_DESC', 'textarea', 'array', 8",
- Exclude checks
Unexpected spaces found. Open
include ICMS_ROOT_PATH.\"/include/common.php\";
- Exclude checks
Unexpected spaces found. Open
'ldap_loginname_asdn' => "'_MD_AM_LDAP_LOGINNAME_ASDN', 'uid_asdn', '_MD_AM_LDAP_LOGINNAME_ASDN_D', 'yesno', 'int', 9",
- Exclude checks
Unexpected spaces found. Open
'ldap_provisionning' => "'_MD_AM_LDAP_PROVIS', '0', '_MD_AM_LDAP_PROVIS_DESC', 'yesno', 'int', 13",
- Exclude checks
Unexpected spaces found. Open
}
- Exclude checks