ImpressCMS/impresscms

View on GitHub
upgrade/upd-2.0.13-to-2.0.14/index.php

Summary

Maintainability
B
6 hrs
Test Coverage

query accesses the super-global variable $GLOBALS.
Open

    function query( $sql) {
        $db = $GLOBALS['xoopsDB'];
        if (! ( $ret = $db->queryF( $sql ) )) {
            echo $db->error();
        }

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
        );

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) {

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.'/' );
Severity: Minor
Found in upgrade/upd-2.0.13-to-2.0.14/index.php - About 2 hrs to fix

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.'/' );
Severity: Major
Found in upgrade/upd-2.0.13-to-2.0.14/index.php - About 2 hrs to fix

    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) {
    Severity: Minor
    Found in upgrade/upd-2.0.13-to-2.0.14/index.php - About 1 hr to fix

      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) {
      Severity: Minor
      Found in upgrade/upd-2.0.13-to-2.0.14/index.php - About 25 mins to fix

      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.'/' );

      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 ) );
                              

      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();
              }

      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;

      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 ) )) {

      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) {
      Severity: Minor
      Found in upgrade/upd-2.0.13-to-2.0.14/index.php by phan

      Reference to undeclared constant \XOOPS_CONF_AUTH
      Open

                  "`conf_name` = 'ldap_provisionning' AND `conf_catid` = " . XOOPS_CONF_AUTH
      Severity: Minor
      Found in upgrade/upd-2.0.13-to-2.0.14/index.php by phan

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class upgrade_2014 {

      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'" );

      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() {

      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'];

      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' );

      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'];

      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'];

      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() {

      Space found after opening bracket of FOREACH loop
      Open

              foreach ( $lines as $k => $line) {

      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",

      Space found after opening bracket of FOREACH loop
      Open

              foreach ( $data as $name => $value) {

      Visibility must be declared on method "apply_0523patch"
      Open

          function apply_0523patch() {

      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",

      Method name "upgrade_2014::check_0523patch" is not in camel caps format
      Open

          function check_0523patch() {

      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",

      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",

      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",

      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",

      Method name "upgrade_2014::check_auth_db" is not in camel caps format
      Open

          function check_auth_db() {

      Space found after opening bracket of FOREACH loop
      Open

              foreach ( $data as $name => $values) {

      Visibility must be declared on method "apply"
      Open

          function apply() {

      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",

      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",

      Visibility must be declared on method "isApplied"
      Open

          function isApplied() {

      Visibility must be declared on method "query"
      Open

          function query( $sql) {

      Expected 0 spaces between opening bracket and argument "$sql"; 1 found
      Open

          function query( $sql) {

      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",

      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",

      The var keyword must not be used to declare a property
      Open

          var $usedFiles = array( 'mainfile.php' );

      Visibility must be declared on method "apply_auth_db"
      Open

          function apply_auth_db() {

      Visibility must be declared on property "$usedFiles"
      Open

          var $usedFiles = array( 'mainfile.php' );

      Visibility must be declared on method "check_auth_db"
      Open

          function check_auth_db() {

      Expected 1 space after comma in function call; 2 found
      Open

                          fwrite( $fp,  $content );

      Method name "upgrade_2014::apply_auth_db" is not in camel caps format
      Open

          function apply_auth_db() {

      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",

      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",

      Visibility must be declared on method "check_0523patch"
      Open

          function check_0523patch() {

      Space found after opening bracket of FOREACH loop
      Open

              foreach ( $lines as $line) {

      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",

      Only one argument is allowed per line in a multi-line function call
      Open

              $value = getDbValue( $db, 'config', 'conf_id',

      Only one argument is allowed per line in a multi-line function call
      Open

              $value = getDbValue( $db, 'config', 'conf_id',

      Expected 0 spaces before closing bracket; 1 found
      Open

              $lines = file( '../mainfile.php' );

      Space after opening parenthesis of function call prohibited
      Open

              $lines = file( '../mainfile.php' );

      Expected 0 spaces before closing bracket; 1 found
      Open

                  if (!is_writable( '../mainfile.php' )) {

      Space after opening parenthesis of function call prohibited
      Open

                      $fp = fopen( '../mainfile.php', 'wt' );

      Space after opening parenthesis of function call prohibited
      Open

              $table = $db->prefix( 'config' );

      Expected 0 spaces after opening bracket; 1 found
      Open

              foreach ( $data as $name => $values) {

      Space after opening parenthesis of function call prohibited
      Open

              $table = $db->prefix( 'configoption' );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          $newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          $prepend = implode( '', array_slice( $lines, 0, $insert ) );

      Space after opening parenthesis of function call prohibited
      Open

                  if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {

      Space after opening parenthesis of function call prohibited
      Open

                  if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {

      Space after opening parenthesis of function call prohibited
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );

      Expected 0 spaces after opening bracket; 1 found
      Open

              foreach ( $lines as $k => $line) {

      Expected 0 spaces before closing bracket; 1 found
      Open

                  if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {

      Expected 0 spaces before closing bracket; 1 found
      Open

              $manual = "<h2>" . _MANUAL_INSTRUCTIONS . "</h2>\n<p>" . sprintf( _COPY_RED_LINES, "mainfile.php" ) . "</p>

      Expected 0 spaces before closing bracket; 1 found
      Open

                  if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {

      Space after opening parenthesis of function call prohibited
      Open

                  if (!is_writable( '../mainfile.php' )) {

      A closing tag is not permitted at the end of a PHP file
      Open

      ?>

      Space after opening parenthesis of function call prohibited
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );

      Space after opening parenthesis of function call prohibited
      Open

                          $newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );

      Space after opening parenthesis of function call prohibited
      Open

              if (! ( $ret = $db->queryF( $sql ) )) {

      Expected 0 spaces before closing bracket; 1 found
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );

      Space after opening parenthesis of function call prohibited
      Open

              $manual = "<h2>" . _MANUAL_INSTRUCTIONS . "</h2>\n<p>" . sprintf( _COPY_RED_LINES, "mainfile.php" ) . "</p>

      Expected 0 spaces before closing bracket; 1 found
      Open

                      $fp = fopen( '../mainfile.php', 'wt' );

      Space after opening parenthesis of function call prohibited
      Open

                          fwrite( $fp,  $content );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          fclose( $fp );

      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'" );

      Expected 0 spaces before closing bracket; 1 found
      Open

              $this->query( "DELETE FROM `$table` WHERE `conf_id`=$id" );

      Expected 0 spaces before closing bracket; 1 found
      Open

                  $this->query( "INSERT INTO `$table` (confop_name, confop_value, conf_id) VALUES ('$name', '$value', $id)" );

      Space after opening parenthesis of function call prohibited
      Open

              $lines = file( '../mainfile.php' );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          fwrite( $fp,  $content );

      Expected 0 spaces before closing bracket; 1 found
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );

      Class name "upgrade_2014" is not in camel caps format
      Open

      class upgrade_2014 {

      Expected 0 spaces before closing bracket; 1 found
      Open

                  printf( _FAILED_PATCH . "<br />", "mainfile.php" );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          $append = implode( '', array_slice( $lines, $insert ) );

      Expected 0 spaces before closing bracket; 1 found
      Open

              $cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );

      Space after opening parenthesis of function call prohibited
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );

      Expected 0 spaces before closing bracket; 1 found
      Open

              $table = $db->prefix( 'config' );

      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'" )) {

      Expected 0 spaces after opening bracket; 1 found
      Open

              foreach ( $lines as $line) {

      Space after opening parenthesis of function call prohibited
      Open

                          $append = implode( '', array_slice( $lines, $insert ) );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          $append = implode( '', array_slice( $lines, $insert ) );

      Space after opening parenthesis of function call prohibited
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );

      Space after opening parenthesis of function call prohibited
      Open

                  if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {

      Space after opening parenthesis of function call prohibited
      Open

              $cat = getDbValue( $db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'" );

      Expected 0 spaces before closing bracket; 1 found
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'config' ) . " WHERE `conf_modid`=0 AND `conf_catid` = $cat" );

      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'" );

      Expected 0 spaces before closing bracket; 1 found
      Open

              $table = $db->prefix( 'configoption' );

      Expected 1 newline at end of file; 0 found
      Open

      ?>

      Expected 0 spaces before closing bracket; 1 found
      Open

                  if (strpos( $line, "\$_REQUEST[\$bad_global]" ) !== false) {

      Expected 0 spaces before closing bracket; 1 found
      Open

                  if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {

      Space after opening parenthesis of function call prohibited
      Open

                  printf( _FAILED_PATCH . "<br />", "mainfile.php" );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          $content = str_replace( array( "\r\n", "\n" ), $newline, $content );

      Space after opening parenthesis of function call prohibited
      Open

                          fclose( $fp );

      Space after opening parenthesis of function call prohibited
      Open

                  if (strpos( $line, $matchProtector ) || strpos( $line, $matchDefault )) {

      Space after opening parenthesis of function call prohibited
      Open

                          $newline = defined( PHP_EOL ) ? PHP_EOL : ( strpos( php_uname(), 'Windows') ? "\r\n" : "\n" );

      Space after opening parenthesis of function call prohibited
      Open

                          $prepend = implode( '', array_slice( $lines, 0, $insert ) );

      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'" )) {

      Space after opening parenthesis of function call prohibited
      Open

                          $prepend = implode( '', array_slice( $lines, 0, $insert ) );

      Expected 0 spaces before closing bracket; 1 found
      Open

                          $prepend = implode( '', array_slice( $lines, 0, $insert ) );

      Space after opening parenthesis of function call prohibited
      Open

                          $append = implode( '', array_slice( $lines, $insert ) );

      Expected 0 spaces before closing bracket; 1 found
      Open

                  $db->queryF( "DELETE FROM " . $db->prefix( 'configcategory' ) . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' " );

      Space after opening parenthesis of function call prohibited
      Open

              $this->query( "DELETE FROM `$table` WHERE `conf_id`=$id" );

      Expected 0 spaces after opening bracket; 1 found
      Open

              foreach ( $data as $name => $value) {

      Expected 0 spaces before closing bracket; 1 found
      Open

              $lines = file( '../mainfile.php' );

      Space after opening parenthesis of function call prohibited
      Open

                          $content = str_replace( array( "\r\n", "\n" ), $newline, $content );

      Opening parenthesis of a multi-line function call must be the last content on the line
      Open

              $value = getDbValue( $db, 'config', 'conf_id',

      Expected 0 spaces before closing bracket; 1 found
      Open

              if (! ( $ret = $db->queryF( $sql ) )) {

      Space after opening parenthesis of function call prohibited
      Open

                  $this->query( "INSERT INTO `$table` (confop_name, confop_value, conf_id) VALUES ('$name', '$value', $id)" );

      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
              );

      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.'/' );

      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) {

      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

      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 != '') {

      Unexpected trailing spaces found.
      Open

                              

      Unexpected spaces found.
      Open

                     'ldap_filter_person'    => "'_MD_AM_LDAP_FILTER_PERSON', '', '_MD_AM_LDAP_FILTER_PERSON_DESC', 'textbox', 'text', 11",

      Unexpected spaces found.
      Open

                     'ldap_surname_attr'        => "'_MD_AM_LDAP_SURNAME_ATTR', 'sn', '_MD_AM_LDAP_SURNAME_ATTR_DESC', 'textbox', 'text', 17",

      Unexpected spaces found.
      Open

                     'ldap_manager_dn'        => "'_MD_AM_LDAP_MANAGER_DN', 'manager_dn', '_MD_AM_LDAP_MANAGER_DN_DESC', 'textbox', 'text', 5",

      Unexpected spaces found.
      Open

                  header( 'Location: '.XOOPS_URL.'/' );

      Unexpected spaces found.
      Open

                  exit();

      Unexpected spaces found.
      Open

                     'ldap_loginldap_attr'    => "'_MD_AM_LDAP_LOGINLDAP_ATTR', 'uid', '_MD_AM_LDAP_LOGINLDAP_ATTR_D', 'textbox', 'text', 10",

      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) {

      Unexpected trailing spaces found.
      Open

                              

      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",

      Unexpected spaces found.
      Open

                     'ldap_givenname_attr'    => "'_MD_AM_LDAP_GIVENNAME_ATTR', 'givenname', '_MD_AM_LDAP_GIVENNAME_ATTR_DSC', 'textbox', 'text', 16",

      Unexpected spaces found.
      Open

              }

      Unexpected spaces found.
      Open

                     'ldap_mail_attr'        => "'_MD_AM_LDAP_MAIL_ATTR', 'mail', '_MD_AM_LDAP_MAIL_ATTR_DESC', 'textbox', 'text', 15",

      Unexpected spaces found.
      Open

          }

      Unexpected spaces found.
      Open

                     'ldap_manager_pass'        => "'_MD_AM_LDAP_MANAGER_PASS', 'manager_pass', '_MD_AM_LDAP_MANAGER_PASS_DESC', 'textbox', 'text', 6",

      Unexpected spaces found.
      Open

                     'ldap_version'            => "'_MD_AM_LDAP_VERSION', '3', '_MD_AM_LDAP_VERSION_DESC', 'textbox', 'text', 7",

      Unexpected spaces found.
      Open

              if (isset( \$_REQUEST[\$bad_global] )) {

      Unexpected spaces found.
      Open

                     'ldap_domain_name'        => "'_MD_AM_LDAP_DOMAIN_NAME', 'mydomain', '_MD_AM_LDAP_DOMAIN_NAME_DESC', 'textbox', 'text', 12",

      Unexpected spaces found.
      Open

                     'ldap_users_bypass'        => "'_MD_AM_LDAP_USERS_BYPASS', '".serialize(array('admin'))."', '_MD_AM_LDAP_USERS_BYPASS_DESC', 'textarea', 'array', 8",

      Unexpected spaces found.
      Open

              include ICMS_ROOT_PATH.\"/include/common.php\";

      Unexpected spaces found.
      Open

                     'ldap_loginname_asdn'    => "'_MD_AM_LDAP_LOGINNAME_ASDN', 'uid_asdn', '_MD_AM_LDAP_LOGINNAME_ASDN_D', 'yesno', 'int', 9",

      Unexpected spaces found.
      Open

                     'ldap_provisionning'    => "'_MD_AM_LDAP_PROVIS', '0', '_MD_AM_LDAP_PROVIS_DESC', 'yesno', 'int', 13",

      Unexpected spaces found.
      Open

          }

      There are no issues that match your filters.

      Category
      Status