MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

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

    public function yypushstate($state)
    {
        if ($this->yyTraceFILE) {
             fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
        }
include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 112..122

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 smarty_function_mailto has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function smarty_function_mailto($params, $template)
{
    static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
    $extra = '';

Severity: Major
Found in include/smarty/libs/plugins/function.mailto.php - About 3 hrs to fix

    Method updateAccount has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function updateAccount($userID, $address, $threshold, $donate, $email, $timezone, $is_anonymous, $strToken) {
        $this->debug->append("STA " . __METHOD__, 4);
        $bUser = false;
        $donate = round($donate, 2);
        // number validation checks
    Severity: Major
    Found in include/classes/user.class.php - About 3 hrs to fix

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

          protected static function salsa208Core64($b)
          {
              $b32 = array();
              for ($i = 0; $i < 16; $i++) {
                  list(, $b32[$i]) = unpack("V", substr($b, $i * 4, 4));
      Severity: Major
      Found in include/lib/scrypt.php - About 3 hrs to fix

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

            protected static function salsa208Core32($b)
            {
                $b32 = array();
                for ($i = 0; $i < 16; $i++) {
                   list(, $b32[$i]) = unpack("V", substr($b, $i * 4, 4));
        Severity: Major
        Found in include/lib/scrypt.php - About 3 hrs to fix

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

              function yy_r3_1($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
               $this->token = Smarty_Internal_Templateparser::TP_TEXT;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 248..257

          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 145.

          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

              function yy_r1_6($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
               $this->token = Smarty_Internal_Templateparser::TP_TEXT;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 938..947

          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 145.

          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

          File SimpleMessage.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /*
           * This file is part of SwiftMailer.
           * (c) 2004-2009 Chris Corbyn
          Severity: Minor
          Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMessage.php - About 3 hrs to fix

            Function smarty_function_html_checkboxes_output has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

            function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true)
            {
                $_output = '';
            
                if (is_object($value)) {
            Severity: Minor
            Found in include/smarty/libs/plugins/function.html_checkboxes.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

            Function getPlugin has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getPlugin($plugin_name, $plugin_type)
                {
                    $function = null;
                    if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
                        if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {

            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 load has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function load(Smarty $smarty, $type)
                {
                    // try smarty's cache
                    if (isset($smarty->_resource_handlers[$type])) {
                        return $smarty->_resource_handlers[$type];
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_resource.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

            Function getNotificationSettings has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

              public function getNotificationSettings($account_id) {
                // Some defaults, we cover them here so we can avoid adding default settings on user creation
                $aDefaults = array( 'newsletter' => 1 );
                $this->debug->append("STA " . __METHOD__, 4);
                $stmt = $this->mysqli->prepare("SELECT * FROM $this->tableSettings WHERE account_id = ?");
            Severity: Minor
            Found in include/classes/notification.class.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

            Function _canonicalizeBody has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _canonicalizeBody($string)
                {
                    $len = strlen($string);
                    $canon = '';
                    $nofws = ($this->_canon == "nofws");
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Signers/DomainKeySigner.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

              public function getCountAllActiveUsers($interval=120) {
                $this->debug->append("STA " . __METHOD__, 4);
                if ($data = $this->memcache->get(__FUNCTION__)) return $data;
                $stmt = $this->mysqli->prepare("
                  SELECT COUNT(DISTINCT(SUBSTRING_INDEX( `username` , '.', 1 ))) AS total
            Severity: Major
            Found in include/classes/statistics.class.php and 1 other location - About 3 hrs to fix
            include/classes/worker.class.php on lines 243..254

            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 143.

            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

                if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
                  if ($user->generatePin($_SESSION['USERDATA']['id'], $_POST['currentPassword'])) {
                    $_SESSION['POPUP'][] = array('CONTENT' => 'Your PIN # has been sent to your email.', 'TYPE' => 'alert alert-success');
                  } else {
                    $_SESSION['POPUP'][] = array('CONTENT' => $user->getError(), 'TYPE' => 'alert alert-danger');
            Severity: Major
            Found in include/pages/account/edit.inc.php and 1 other location - About 3 hrs to fix
            include/pages/account/workers.inc.php on lines 14..22

            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 143.

            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

              public function getCountAllActiveWorkers($interval=120) {
                $this->debug->append("STA " . __METHOD__, 4);
                if ($data = $this->memcache->get(__FUNCTION__)) return $data;
                $stmt = $this->mysqli->prepare("
                  SELECT COUNT(DISTINCT(username)) AS total
            Severity: Major
            Found in include/classes/worker.class.php and 1 other location - About 3 hrs to fix
            include/classes/statistics.class.php on lines 894..905

            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 143.

            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

                  if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
                    if ($worker->deleteWorker($_SESSION['USERDATA']['id'], $_GET['id'])) {
                      $_SESSION['POPUP'][] = array('CONTENT' => 'Worker removed', 'TYPE' => 'alert alert-success');
                    } else {
                      $_SESSION['POPUP'][] = array('CONTENT' => $worker->getError(), 'TYPE' => 'alert alert-danger');
            Severity: Major
            Found in include/pages/account/workers.inc.php and 1 other location - About 3 hrs to fix
            include/pages/account/edit.inc.php on lines 66..74

            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 143.

            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

            File jquery.metisMenu.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * metismenu - v2.5.2
             * A jQuery menu plugin
             * https://github.com/onokumus/metisMenu#readme
             *
            Severity: Minor
            Found in public/site_assets/bootstrap/js/plugins/metisMenu/jquery.metisMenu.js - About 3 hrs to fix

              Method getTopContributors has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public function getTopContributors($type='shares', $limit=15) {
                  $this->debug->append("STA " . __METHOD__, 4);
                  switch ($type) {
                  case 'shares':
                    if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $type . $limit)) return $data;
              Severity: Major
              Found in include/classes/statistics.class.php - About 3 hrs to fix

                Swift_Mime_SimpleHeaderSet has 26 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
                {
                    /** HeaderFactory */
                    private $_factory;
                
                
                Severity: Minor
                Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language