SpamExperts/whmcs-addon

View on GitHub

Showing 72 of 72 total issues

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

  $.fn.dropdown = function (option) {
    return this.each(function () {
      var $this = $(this)
        , data = $this.data('dropdown')
      if (!data) $this.data('dropdown', (data = new Dropdown(this)))
Severity: Major
Found in modules/addons/spamexperts/core/assets/js/bootstrap.js and 1 other location - About 3 hrs to fix
modules/addons/spamexperts/core/assets/js/bootstrap.js on lines 130..137

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

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

  $.fn.alert = function (option) {
    return this.each(function () {
      var $this = $(this)
        , data = $this.data('alert')
      if (!data) $this.data('alert', (data = new Alert(this)))
Severity: Major
Found in modules/addons/spamexperts/core/assets/js/bootstrap.js and 1 other location - About 3 hrs to fix
modules/addons/spamexperts/core/assets/js/bootstrap.js on lines 701..708

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

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 spamexpertsreseller_ConfigOptions()
{
    $configarray = array(
        "SpampanelURL"     => array(
            "Type"         => "text",
Severity: Major
Found in modules/servers/spamexpertsreseller/spamexpertsreseller.php and 1 other location - About 3 hrs to fix
modules/servers/kwspamexperts/spamexpertsreseller.php on lines 48..83

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

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

function spamexpertsreseller_ConfigOptions() 
{
    $configarray = array(
     "SpampanelURL"     => array(
             "Type"         => "text", 
Severity: Major
Found in modules/servers/kwspamexperts/spamexpertsreseller.php and 1 other location - About 3 hrs to fix
modules/servers/spamexpertsreseller/spamexpertsreseller.php on lines 48..83

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

Consider simplifying this complex logical expression.
Open

    if (!$IS_CLIENTAREA && isset($_REQUEST['modsubpage'])
        && in_array($PAGE, $available_pages)
        && in_array($_REQUEST['modsubpage'], $available_pages)
        && file_exists(ADDON_DIR . DS . 'pages' . DS . $PAGE . DS . $_REQUEST['modsubpage'] . '.php')
    ) {
Severity: Critical
Found in modules/addons/spamexperts/core/core.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (!$IS_CLIENTAREA && isset($_REQUEST['modsubpage'])
            && in_array($PAGE, $available_pages)
            && in_array($_REQUEST['modsubpage'], $available_pages)
            && file_exists(ADDON_DIR . DS . 'views' . DS . $PAGE . DS . $_REQUEST['modsubpage'] . '.php')
        ) {
    Severity: Critical
    Found in modules/addons/spamexperts/core/core.php - About 3 hrs to fix

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

        , getTitle: function () {
            var title
              , $e = this.$element
              , o = this.options
      
      
      Severity: Major
      Found in modules/addons/spamexperts/core/assets/js/bootstrap.js and 1 other location - About 2 hrs to fix
      modules/addons/spamexperts/core/assets/js/bootstrap.js on lines 1293..1302

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

      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

        , getContent: function () {
            var content
              , $e = this.$element
              , o = this.options
      
      
      Severity: Major
      Found in modules/addons/spamexperts/core/assets/js/bootstrap.js and 1 other location - About 2 hrs to fix
      modules/addons/spamexperts/core/assets/js/bootstrap.js on lines 1165..1174

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

      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 spamexpertsreseller_ChangePackage($params) {
          // phpcs:ignore PHPCS_SecurityAudit.BadFunctions.EasyRFI.WarnEasyRFI
          include_once(__DIR__.DIRECTORY_SEPARATOR.'class.connection.php');
          $api = new spamexperts_api($params);
          // for update, the optional value needed for api_usage matches the config option to disable api access
      Severity: Major
      Found in modules/servers/kwspamexperts/spamexpertsreseller.php and 1 other location - About 2 hrs to fix
      modules/servers/spamexpertsreseller/spamexpertsreseller.php on lines 148..164

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

      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 spamexpertsreseller_ChangePackage($params) {
          // phpcs:ignore PHPCS_SecurityAudit.BadFunctions.EasyRFI.WarnEasyRFI
          include_once(__DIR__.DIRECTORY_SEPARATOR.'class.connection.php');
          $api = new spamexperts_api($params);
          // for update, the optional value needed for api_usage matches the config option to disable api access
      Severity: Major
      Found in modules/servers/spamexpertsreseller/spamexpertsreseller.php and 1 other location - About 2 hrs to fix
      modules/servers/kwspamexperts/spamexpertsreseller.php on lines 148..164

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

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

              public function query($and = false, $where = false, $limit = true)
              {
                  $query = ' '; 
      
                  if($and && count($this->settings['filters']))
      Severity: Minor
      Found in modules/addons/spamexperts/core/class.MG_Pagination.php - About 1 hr to fix

        Function kwspamexperts_getLang has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            function kwspamexperts_getLang($params){
                global $CONFIG;
                if(!empty($_SESSION['Language']))
                    $language = strtolower($_SESSION['Language']);
                else if(isset($params['clientsdetails']['language']) && strtolower($params['clientsdetails']['language'])!='')
        Severity: Minor
        Found in modules/servers/kwspamexperts/kwspamexperts.php - About 1 hr 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

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

        if($api->isSuccess())
        {
            $result = $api->getResponse();
            // phpcs:ignore PHPCS_SecurityAudit.BadFunctions.CallbackFunctions.WarnFringestuff
            $lines  = array_filter(explode("\n",$result['result']));
        Severity: Major
        Found in modules/servers/kwspamexperts/stats.php and 1 other location - About 1 hr to fix
        modules/servers/spamexpertsreseller/stats.php on lines 57..72

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

        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

            if($api->isSuccess())
            {
                $result = $api->getResponse();
                // phpcs:ignore PHPCS_SecurityAudit.BadFunctions.CallbackFunctions.WarnFringestuff
                $lines  = array_filter(explode("\n",$result['result']));
        Severity: Major
        Found in modules/servers/spamexpertsreseller/stats.php and 1 other location - About 1 hr to fix
        modules/servers/kwspamexperts/stats.php on lines 51..67

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

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

          , show: function () {
              var $tip
                , inside
                , pos
                , actualWidth
        Severity: Minor
        Found in modules/addons/spamexperts/core/assets/js/bootstrap.js - About 1 hr to fix

          Function hide_pass_in_clientarea_spamexperts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function hide_pass_in_clientarea_spamexperts() {
                  global $smarty;
          
                  if (!defined('Smarty::SMARTY_VERSION')) {
                      if($smarty->_tpl_vars['filename'] == 'clientarea' &&
          Severity: Minor
          Found in modules/servers/spamexpertsreseller/hooks.php - About 1 hr 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 spamexpertsreseller_getLang has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function spamexpertsreseller_getLang($params){
                  global $CONFIG;
                  if(!empty($_SESSION['Language']))
                      $language = strtolower($_SESSION['Language']);
                  else if(isset($params['clientsdetails']['language']) && strtolower($params['clientsdetails']['language'])!='')
          Severity: Minor
          Found in modules/servers/spamexpertsreseller/spamexpertsreseller.php - About 1 hr 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 hide_pass_in_clientarea_spamexperts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function hide_pass_in_clientarea_spamexperts() {
                  global $smarty;
          
                  if (!defined('Smarty::SMARTY_VERSION')) {
                      if($smarty->_tpl_vars['filename'] == 'clientarea' &&
          Severity: Minor
          Found in modules/servers/kwspamexperts/hooks.php - About 1 hr 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 spamexpertsreseller_getLang has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function spamexpertsreseller_getLang($params){
                   global $CONFIG;
                   if(!empty($_SESSION['Language']))
                       $language = strtolower($_SESSION['Language']);
                   else if(isset($params['clientsdetails']['language']) && strtolower($params['clientsdetails']['language'])!='')
          Severity: Minor
          Found in modules/servers/kwspamexperts/spamexpertsreseller.php - About 1 hr 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 kwspamexperts_ConfigOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function kwspamexperts_ConfigOptions() {
              $configarray = array(
               "ProductType"      => array(
                       "Type"         => "dropdown",
                       "Options"      => "Incoming,Outgoing,Both",
          Severity: Minor
          Found in modules/servers/kwspamexperts/kwspamexperts.php - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language