XoopsModules25x/userlog

View on GitHub

Showing 1,244 of 1,244 total issues

Function arrayToDisplay has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function arrayToDisplay($logs, $skips = [])
    {
        foreach ($logs as $log_id => $log) {
            $logs[$log_id]['log_time']   = $this->userlog->formatTime($logs[$log_id]['log_time']);
            $logs[$log_id]['last_login'] = $this->userlog->formatTime($logs[$log_id]['last_login']);
Severity: Minor
Found in class/log.php - About 3 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    case 'rename':
        // only one file. 0 file or more than one file => error
        if (1 != $totalFiles) {
            redirect_header('file.php', 5, sprintf(_AM_USERLOG_ERROR, _AM_USERLOG_FILE_SELECT_ONE));
        }
Severity: Major
Found in admin/file.php and 1 other location - About 3 hrs to fix
admin/file.php on lines 61..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 146.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    case 'copy':
        // only one file. 0 file or more than one file => error
        if (1 != $totalFiles) {
            redirect_header('file.php', 5, sprintf(_AM_USERLOG_ERROR, _AM_USERLOG_FILE_SELECT_ONE));
        }
Severity: Major
Found in admin/file.php and 1 other location - About 3 hrs to fix
admin/file.php on lines 51..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 146.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method _getRemoteData has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _getRemoteData($url)
    {
        ini_set('user_agent', $this->_getUserAgent());

        switch ($this->_getUpdateMethod()) {
Severity: Major
Found in class/phpbrowscap/Browscap.php - About 3 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    function update_userlog_v115(XoopsModule $module)
    {
        $userlog  = Userlog::getInstance();
        // Only change the field from INDEX to UNIQUE if it is not unique
        // if (isset($indexArr[0]["Non_unique"]) || $indexArr[0]["Non_unique"] == 1) { }
    Severity: Major
    Found in include/module.php and 1 other location - About 3 hrs to fix
    include/onupdate.php on lines 115..134

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    function update_userlog_v115(XoopsModule $module)
    {
        $userlog  = Userlog::getInstance();
        // Only change the field from INDEX to UNIQUE if it is not unique
        // if (isset($indexArr[0]["Non_unique"]) || $indexArr[0]["Non_unique"] == 1) { }
    Severity: Major
    Found in include/onupdate.php and 1 other location - About 3 hrs to fix
    include/module.php on lines 126..145

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function insertUpdate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function insertUpdate($object, $duplicate = [], $force = true)
        {
            $handler = $this->loadHandler('write');
    
            if (!$object->isDirty()) {
    Severity: Minor
    Found in class/stats.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

    Function loginregHistoryShow has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function loginregHistoryShow($args)
        {
            $criteria = new CriteriaCompo();
            $criteria->add(new Criteria('uid', 0), 'AND');
            $criteria->add(new Criteria('post', '%pass%', 'LIKE'), 'AND'); // login or register
    Severity: Minor
    Found in class/query.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

    Function checkVerXoops has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
        {
            $moduleDirName = basename(dirname(__DIR__));
            if (null === $module) {
                $module = XoopsModule::getByDirname($moduleDirName);
    Severity: Minor
    Found in class/utility.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 userlog_views_edit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function userlog_views_edit($options)
    {
        // require_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6
        xoops_load('XoopsFormLoader');
        // $form = new XoopsBlockForm(); //reserve for 2.6
    Severity: Major
    Found in blocks/views.php - About 2 hrs to fix

      UserlogLog has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class UserlogLog extends XoopsObject
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in class/log.php - About 2 hrs to fix

        Function _getRemoteIniFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _getRemoteIniFile($url, $path)
            {
                // local and remote file are the same, no update possible
                if ($url == $path) {
                    return false;
        Severity: Minor
        Found in class/phpbrowscap/Browscap.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 loginregHistoryShow has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function loginregHistoryShow($args)
            {
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria('uid', 0), 'AND');
                $criteria->add(new Criteria('post', '%pass%', 'LIKE'), 'AND'); // login or register
        Severity: Major
        Found in class/query.php - About 2 hrs to fix

          Method getLogsCounts has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getLogsCounts($criteria = null, $fields = null, $asObject = true, $id_as_key = true)
              {
                  if (is_array($fields) && count($fields) > 0) {
                      if (!in_array($this->keyName, $fields)) {
                          $fields[] = $this->keyName;
          Severity: Major
          Found in class/log.php - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            <?php
            /*
             You may not change or alter any portion of this comment or credits
             of supporting developers from this source code or any supporting source code
             which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Major
            Found in blocks/stats_type.php and 1 other location - About 2 hrs to fix
            blocks/login_reg_history.php on lines 1..59

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 127.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            <?php
            /*
             You may not change or alter any portion of this comment or credits
             of supporting developers from this source code or any supporting source code
             which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Major
            Found in blocks/login_reg_history.php and 1 other location - About 2 hrs to fix
            blocks/stats_type.php on lines 1..56

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 127.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function validate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function validate(elName, elType, prevent, disablecat, elMsg) {
                var i = 0;
                var el = document.getElementsByName(elName);
                var is_valid = true;
                switch (elType) {
            Severity: Major
            Found in assets/js/scripts.js - About 2 hrs to fix

              Function createCacheOldWay has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function createCacheOldWay($iniContent, $actLikeNewVersion = false)
                  {
                      $browsers = parse_ini_string($iniContent, true, INI_SCANNER_RAW);
              
                      if ($actLikeNewVersion) {
              Severity: Minor
              Found in class/phpbrowscap/Browscap.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 _pregUnQuote has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _pregUnQuote($pattern, $matches)
                  {
                      // list of escaped characters: http://www.php.net/manual/en/function.preg-quote.php
                      // to properly unescape '?' which was changed to '.', I replace '\.' (real dot) with '\?',
                      // then change '.' to '?' and then '\?' to '.'.
              Severity: Major
              Found in class/phpbrowscap/Browscap.php - About 2 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        foreach ($not_config['category'] as $category) {
                            if (!empty($category['item_name'])) {
                                $script                                                                      = is_array($category['subscribe_from']) ? implode(':', $category['subscribe_from']) : $category['subscribe_from'];
                                $hasviews[$module->dirname() . ':' . $script . '-' . $category['item_name']] = $module->dirname() . '/' . $script . '?' . $category['item_name'] . '=ITEM_ID';
                            }
                Severity: Major
                Found in blocks/views.php and 1 other location - About 2 hrs to fix
                admin/stats.php on lines 204..209

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 126.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language