mambax7/adslight

View on GitHub
search.php

Summary

Maintainability
B
6 hrs
Test Coverage

File search.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

/*
 * 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
Severity: Minor
Found in search.php - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                                if (mb_strlen($results[$i]['desctext']) >= 14) {
                                    $results[$i]['desctext'] = $myts->displayTarea(mb_substr($results[$i]['desctext'], 0, 90), 1, 1, 1, 1, 1);
                                }
    Severity: Major
    Found in search.php - About 45 mins to fix

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

                              if (isset($results[$i]['photo'])
                                  && '' !== $results[$i]['photo']) {
                                  echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['photo'] . "' alt='' width='100' ></a></td>&nbsp;";
                              } else {
                                  echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['nophoto'] . "' alt='' width='100' ></a></td>&nbsp;";
      Severity: Major
      Found in search.php and 1 other location - About 1 hr to fix
      search.php on lines 277..282

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

      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 (isset($results[$i]['photo'])
                          && '' !== $results[$i]['photo']) {
                          echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['sphoto'] . "' alt='' width='100' ></a></td>&nbsp;";
                      } else {
                          echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['nophoto'] . "' alt='' width='100' ></a></td>&nbsp;";
      Severity: Major
      Found in search.php and 1 other location - About 1 hr to fix
      search.php on lines 173..178

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

      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

      There must be one USE keyword per declaration
      Open

      use XoopsModules\Adslight\{
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 136 characters
      Open

                              echo '<style type="text/css" media="all">@import url(' . $helper->url('assets/css/adslight.css') . ');</style>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 173 characters
      Open

                              //                        echo '<style type="text/css" media="all">@import url(' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css);</style>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 167 characters
      Open

                                  echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['nophoto'] . "' alt='' width='100' ></a></td>&nbsp;";
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 121 characters
      Open

                              echo !empty($results[$i]['time']) ? ' (' . formatTimestamp((int)$results[$i]['time']) . ')' : '';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 157 characters
      Open

                          echo '&nbsp;&nbsp;' . _ADSLIGHT_FROM . "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $results[$i]['uid'] . "'>" . $uname . '</a><br>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 163 characters
      Open

                                  echo '&nbsp;&nbsp;' . _ADSLIGHT_FROM . "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $results[$i]['uid'] . "'>" . $uname . "</a>\n";
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 126 characters
      Open

                  $search_url = XOOPS_URL . '/modules/adslight/search.php?query=' . urlencode(stripslashes(implode(' ', $queries)));
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 142 characters
      Open

                      echo '<td align="right"><a href="' . htmlspecialchars($search_url_next, ENT_QUOTES | ENT_HTML5) . '">' . _SR_NEXT . '</a></td>
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 151 characters
      Open

                              $sql     = 'SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' WHERE id_price=' . (int)$results[$i]['typeprice'];
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 162 characters
      Open

      ' . htmlspecialchars($results[$i]['price'], ENT_QUOTES | ENT_HTML5) . '</a>&nbsp;' . htmlspecialchars($results[$i]['typeprice'], ENT_QUOTES | ENT_HTML5) . '</a>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 123 characters
      Open

                              echo '<strong>' . htmlspecialchars($results[$i]['type'], ENT_QUOTES | ENT_HTML5) . '</strong><br>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 171 characters
      Open

                              echo "<strong><a href='" . $results[$i]['link'] . "'>" . htmlspecialchars($results[$i]['title'], ENT_QUOTES | ENT_HTML5) . '</a></strong><br><br>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 138 characters
      Open

                              $search_url = XOOPS_URL . '/modules/adslight/search.php?query=' . urlencode(stripslashes(implode(' ', $queries)));
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 128 characters
      Open

                      echo '<a href="' . htmlspecialchars($search_url_prev, ENT_QUOTES | ENT_HTML5) . '">' . _SR_PREVIOUS . '</a></td>
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 165 characters
      Open

                                  echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['photo'] . "' alt='' width='100' ></a></td>&nbsp;";
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 132 characters
      Open

                              echo '<br><a href="' . htmlspecialchars($search_url, ENT_QUOTES | ENT_HTML5) . '">' . _SR_SHOWALLR . '</a>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 123 characters
      Open

                          echo ' "<strong>' . htmlspecialchars(stripslashes($queries[0]), ENT_QUOTES | ENT_HTML5) . '</strong>"';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 158 characters
      Open

                          echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['sphoto'] . "' alt='' width='100' ></a></td>&nbsp;";
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 159 characters
      Open

                          echo "<a href='" . $results[$i]['link'] . "'><img class='thumb' src='" . $results[$i]['nophoto'] . "' alt='' width='100' ></a></td>&nbsp;";
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 138 characters
      Open

                                      $results[$i]['desctext'] = $myts->displayTarea(mb_substr($results[$i]['desctext'], 0, 90), 1, 1, 1, 1, 1);
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 163 characters
      Open

                      echo "<strong><a href='" . $results[$i]['link'] . "'>" . htmlspecialchars($results[$i]['title'], ENT_QUOTES | ENT_HTML5) . '</a></strong><br><br>';
      Severity: Minor
      Found in search.php by phpcodesniffer

      Line exceeds 120 characters; contains 165 characters
      Open

                              $formattedCurrencyUtilityTemp = Utility::formatCurrencyTemp((float)$results[$i]['price'], $currencyCode, $currencySymbol, $currencyPosition);
      Severity: Minor
      Found in search.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status