XoopsModules25x/xfguestbook

View on GitHub

Showing 56 of 1,027 total issues

Function rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function rcopy($src, $dest)
    {
        // Only continue if user is a 'global' Admin
        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
            return false;
Severity: Minor
Found in class/Common/FilesManagement.php - About 55 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

Avoid deeply nested control flow statements.
Open

                            if (is_file($templateFolder . $v)) {
                                unlink($templateFolder . $v);
                            }
Severity: Major
Found in include/onupdate.php - About 45 mins to fix

    Function badIpDel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function badIpDel($ip_id)
    {
        global $xoopsDB;
        $ip_count = (!empty($_POST['ip_id']) && is_array($_POST['ip_id'])) ? count($_POST['ip_id']) : 0;
        if ($ip_count > 0) {
    Severity: Minor
    Found in admin/ip_manager.php - About 45 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

    Function approve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function approve()
    {
        global $msgHandler;
        $msg_count = (!empty($_POST['msg_id']) && is_array($_POST['msg_id'])) ? count($_POST['msg_id']) : 0;
        if ($msg_count > 0) {
    Severity: Minor
    Found in admin/main.php - About 45 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

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($caption, $name, $value = null, $size = 1, $nullopt = false)
    Severity: Minor
    Found in class/Form/FormSelectCountry.php - About 35 mins to fix

      Method xfguestbook_search has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function xfguestbook_search($queryarray, $andor, $limit, $offset, $user_id)
      Severity: Minor
      Found in include/search.inc.php - About 35 mins to fix

        Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
        Severity: Minor
        Found in class/Common/SysUtility.php - About 35 mins to fix

          Function delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function delete($msg_id)
          {
              global $msgHandler, $xoopsModule;
              $ok = Request::getInt('ok', 0, 'POST');
              if (1 == $ok) {
          Severity: Minor
          Found in index.php - About 35 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

          Function getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getEditor($helper = null, $options = null)
              {
                  /** @var Helper $helper */
                  if (null === $options) {
                      $options           = [];
          Severity: Minor
          Found in class/Common/SysUtility.php - About 35 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

          Function countryShow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function countryShow()
          {
              global $action, $start, $xoopsModule, $pathIcon16;
              /** @var Helper $helper */
              $helper = Helper::getInstance();
          Severity: Minor
          Found in admin/country_manager.php - About 35 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

          Function clear_tmp_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function clear_tmp_files($dir_path, $prefix = 'tmp_')
              {
                  if (!($dir = @\opendir($dir_path))) {
                      return 0;
                  }
          Severity: Minor
          Found in class/Utility.php - About 35 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

          Function insert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function insert(\XoopsObject $msg, $force = true)
              {
                  if (Message::class !== \get_class($msg)) {
                      return false;
                  }
          Severity: Minor
          Found in class/MessageHandler.php - About 35 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

          Function xfguestbook_search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function xfguestbook_search($queryarray, $andor, $limit, $offset, $user_id)
          {
              global $xoopsDB;
              $sql = 'SELECT msg_id,user_id,title,post_time FROM ' . $xoopsDB->prefix('xfguestbook_msg') . ' WHERE moderate=0 ';
              if (0 != $user_id) {
          Severity: Minor
          Found in include/search.inc.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

          Function get_badips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function get_badips($all = null)
              {
                  global $xoopsDB;
                  $ret    = [];
                  $sql    = 'SELECT * FROM ' . $xoopsDB->prefix('xfguestbook_badips');
          Severity: Minor
          Found in class/Utility.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

          Function loadSampleData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function loadSampleData()
          {
              global $xoopsConfig;
              $moduleDirName      = basename(dirname(__DIR__));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
          Severity: Minor
          Found in testdata/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

          Function convertIPAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function convertIPAddresses($tableName, $columnName)
              {
                  if ($this->tableHandler->useTable($tableName)) {
                      $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
                      if (false !== mb_strpos($attributes, ' int(')) {
          Severity: Minor
          Found in class/Common/Migrate.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

          Severity
          Category
          Status
          Source
          Language