MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

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

    function yy_r44(){
    $tag = trim(substr($this->yystack[$this->yyidx + -1]->minor,$this->lex->ldel_length));
    $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + 0]->minor));
    }
include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 2409..2412

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

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

    private function _establishSocketConnection()
    {
        $host = $this->_params['host'];
        if (!empty($this->_params['protocol'])) {
            $host = $this->_params['protocol'] . '://' . $host;
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Transport/StreamBuffer.php - About 1 hr to fix

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

        function yy_r42(){
        $tag = trim(substr($this->yystack[$this->yyidx + -1]->minor,$this->lex->ldel_length)); 
        $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + 0]->minor));
        }
    include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 2421..2424

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

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

    function run_102() {
      // Ugly but haven't found a better way
      global $setting, $config, $coin_address, $user, $mysqli;
    
      // Version information
    Severity: Minor
    Found in upgrade/definitions/1.0.1_to_1.0.2.inc.php - About 1 hr to fix

      Method smarty_modifier_truncate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
      {
          if ($length == 0)
              return '';
      
      
      Severity: Minor
      Found in include/smarty/libs/plugins/modifier.truncate.php - About 1 hr to fix

        Method isTrustedPHPDir has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isTrustedPHPDir($filepath)
            {
                if (empty($this->trusted_dir)) {
                    throw new SmartyException("directory '{$filepath}' not allowed by security setting (no trusted_dir specified)");
                }
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_security.php - About 1 hr to fix

          Method get_debug_vars has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function get_debug_vars($obj)
              {
                  $config_vars = $obj->config_vars;
                  $tpl_vars = array();
                  foreach ($obj->tpl_vars as $key => $var) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_debug.php - About 1 hr to fix

            Method populateCompiledFilepath has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
                {
                    $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
                    $_filepath = $compiled->source->uid;
                    // if use_sub_dirs, break file into directories
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_resource.php - About 1 hr to fix

              Method resetPassword has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public function resetPassword($token, $new1, $new2) {
                  $this->debug->append("STA " . __METHOD__, 4);
                  if ($aToken = $this->token->getToken($token, 'password_reset')) {
                    if ($new1 !== $new2) {
                      $this->setErrorMessage( 'New passwords do not match' );
              Severity: Minor
              Found in include/classes/user.class.php - About 1 hr to fix

                Method check_acl_access has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function check_acl_access($params, $smarty)
                {
                  $isAuthenticated = isset($_SESSION['AUTHENTICATED']) ? true : false;
                  $iAclSetting = $params['acl'];
                  // $params['icon'] is deprecated, only needed for mpos compatibility
                Severity: Minor
                Found in include/lib/smarty_plugins/function.acl.php - About 1 hr to fix

                  Method doHeaders has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function doHeaders($text) {
                      #
                      # Redefined to add id and class attribute support.
                      #
                          # Setext-style headers:
                  Severity: Minor
                  Found in include/lib/Michelf/Markdown.php - About 1 hr to fix

                    Method doFencedCodeBlocks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function doFencedCodeBlocks($text) {
                        #
                        # Adding the fenced code block syntax to regular Markdown:
                        #
                        # ~~~
                    Severity: Minor
                    Found in include/lib/Michelf/Markdown.php - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if (isset($aTransaction['address']) &&
                            $aTransaction['address'] == $aDebitTx['coin_address'] &&
                            ((string)($aTransaction['amount'] + $aTransaction['fee'])    == (string)($aDebitTx['amount'] * -1) ||     // Check against transaction - Fee total
                             (string)($aTransaction['amount'] + $config['txfee_manual']) == (string)($aDebitTx['amount'] * -1) ||     // Check against txfee_manual deducted
                             (string)($aTransaction['amount'] + $config['txfee_auto'])   == (string)($aDebitTx['amount'] * -1) ||     // Check against txfee_auto deducted
                      Severity: Major
                      Found in scripts/validate_payouts.php - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if ($compiler->template->caching && ((!$compiler->inheritance && !$compiler->nocache && !$compiler->tag_nocache) || ($compiler->inheritance && ($compiler->nocache ||$compiler->tag_nocache)))) {
                                    $_caching = self::CACHING_NOCACHE_CODE;
                                }
                        Severity: Major
                        Found in include/smarty/libs/sysplugins/smarty_internal_compile_include.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if ((!$this->_template_dir || $this->_template_dir !== $_template_dir)
                                          || (!$this->_config_dir || $this->_config_dir !== $_config_dir)
                                          || (!empty($this->secure_dir) && (!$this->_secure_dir || $this->_secure_dir !== $this->secure_dir))
                                  ) {
                                      $this->_resource_dir = array();
                          Severity: Major
                          Found in include/smarty/libs/sysplugins/smarty_security.php - About 1 hr to fix

                            Method setupInlineSubTemplate has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function setupInlineSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $hash)
                            Severity: Major
                            Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                            if (empty($filter['type']) || ($filter['type'] != 'Debit_AP' && $filter['type'] != 'Debit_MP' && $filter['type'] != 'TXFee' && $filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) {
                                              $aFilter[] = "( b.confirmations >= " . $this->config['confirmations'] . " OR ISNULL(b.confirmations) )";
                                            }
                              Severity: Major
                              Found in include/classes/transaction.class.php - About 1 hr to fix

                                Method updateAccount has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  public function updateAccount($userID, $address, $threshold, $donate, $email, $timezone, $is_anonymous, $strToken) {
                                Severity: Major
                                Found in include/classes/user.class.php - About 1 hr to fix

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

                                    public function getAll() {
                                      $this->debug->append("STA " . __METHOD__, 4);
                                      $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id ORDER BY time DESC");
                                      if ($stmt && $stmt->execute() && $result = $stmt->get_result())
                                        return $result->fetch_all(MYSQLI_ASSOC);
                                  Severity: Minor
                                  Found in include/classes/news.class.php and 1 other location - About 1 hr to fix
                                  include/classes/news.class.php on lines 42..48

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

                                  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 getAllActive() {
                                      $this->debug->append("STA " . __METHOD__, 4);
                                      $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id WHERE active = 1 ORDER BY time DESC");
                                      if ($stmt && $stmt->execute() && $result = $stmt->get_result())
                                        return $result->fetch_all(MYSQLI_ASSOC);
                                  Severity: Minor
                                  Found in include/classes/news.class.php and 1 other location - About 1 hr to fix
                                  include/classes/news.class.php on lines 53..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 100.

                                  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