mambax7/adslight

View on GitHub
members.php

Summary

Maintainability
D
2 days
Test Coverage

File members.php has 305 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 members.php - About 3 hrs to fix

    TODO found
    Open

                'date_created' => \htmlspecialchars($date_created ?? '', ENT_QUOTES | ENT_HTML5), //TODO check date
    Severity: Minor
    Found in members.php by fixme

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

    } else {
        $sql         = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $xoopsDB->escape($usid) . " AND valid='Yes' AND status!='1' {$cat_perms}";
        $countresult = $xoopsDB->query($sql);
        if (!$xoopsDB->isResultSet($countresult)) {
            \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR);
    Severity: Major
    Found in members.php and 1 other location - About 6 hrs to fix
    members.php on lines 107..141

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

    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 (1 === $istheirs) {
        $sql         = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $xoopsDB->escape($usid) . " AND valid='Yes' {$cat_perms}";
        $countresult = $xoopsDB->query($sql);
        if (!$xoopsDB->isResultSet($countresult)) {
            \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR);
    Severity: Major
    Found in members.php and 1 other location - About 6 hrs to fix
    members.php on lines 124..141

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

    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 (1 !== (int)$linkpages && 0 !== (int)$linkpages) {
            $prev = $min - $show;
            if ($prev >= 0) {
                $pagenav .= "<a href='members.php?usid={$usid}&min={$prev}&show={$show}'><strong><u>&laquo;</u></strong></a> ";
            }
    Severity: Major
    Found in members.php and 1 other location - About 5 hrs to fix
    replies.php on lines 136..157

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

    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 members.php by phpcodesniffer

    Line exceeds 120 characters; contains 139 characters
    Open

            // $sql = 'SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 230 characters
    Open

            $sql     = 'SELECT cod_img, lid, uid_owner, url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE  uid_owner=' . $xoopsDB->escape($usid) . ' AND lid=' . $xoopsDB->escape($lid) . ' ORDER BY date_created ASC LIMIT 1';
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 252 characters
    Open

        $sql    = 'SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, date_created, email, submitter, usid, town, country, contactby, premium, valid, photo, hits, item_rating, item_votes, user_rating, user_votes, comments FROM '
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 174 characters
    Open

                    $modify_link = "<a href='modify.php?op=modad&amp;lid=" . $lid . "'><img src='" . $pathIcon16 . "/edit.png'  border=0 alt=\"" . _ADSLIGHT_MODADMIN . '" ></a>';
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 252 characters
    Open

        $sql    = 'SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, date_created, email, submitter, usid, town, country, contactby, premium, valid, photo, hits, item_rating, item_votes, user_rating, user_votes, comments FROM '
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

            $sql         = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_replies') . " WHERE lid='" . $xoopsDB->escape($lid) . "'";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 218 characters
    Open

                $adminlink = "<a href='" . XOOPS_URL . '/modules/adslight/admin/validate_ads.php?op=modifyAds&amp;lid=' . $lid . "'><img src='" . $pathIcon16 . "/edit.png' border=0 alt=\"" . _ADSLIGHT_MODADMIN . '" ></a>';
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 173 characters
    Open

            //        $GLOBALS['xoopsTpl']->assign('price', '<strong>' . _ADSLIGHT_PRICE . "</strong>$price" . $helper->getConfig('adslight_currency_symbol') . " - $typeprice");
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 175 characters
    Open

            $sql     = 'SELECT r_lid, lid, date_created, submitter, message, email, r_usid FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE lid =' . $xoopsDB->escape($lid);
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 137 characters
    Open

            //        $formattedCurrencyUtilityTemp = Utility::formatCurrencyTemp($price, $currencyCode, $currencySymbol, $currencyPosition);
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 142 characters
    Open

            $priceHtml                    = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $formattedCurrencyUtilityTemp . ' - ' . $priceTypeprice;
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 178 characters
    Open

                    $photo = "<a href='viewads.php?lid=" . $lid . "'><img class=\"thumb\" src=\"{$updir}/thumbs/thumb_{$url}\" align=\"left\" width=\"100px\" alt=\"{$title}\" ></a>";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

                $pagenav .= "<a href='members.php?usid={$usid}&min={$prev}&show={$show}'><strong><u>&laquo;</u></strong></a> ";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 174 characters
    Open

    $GLOBALS['xoopsTpl']->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >');
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 127 characters
    Open

            $formattedCurrencyUtilityTemp = Utility::formatCurrencyTemp($price, $currencyCode, $currencySymbol, $currencyPosition);
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 175 characters
    Open

        $sql         = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $xoopsDB->escape($usid) . " AND valid='Yes' AND status!='1' {$cat_perms}";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 294 characters
    Open

        while (false !== [$lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid, $photo, $hits, $item_rating, $item_votes, $user_rating, $user_votes, $comments] = $xoopsDB->fetchRow(
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 147 characters
    Open

            //        $priceHtml                    = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $formattedCurrencyUtilityTemp . ' - ' . $typeprice;
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 170 characters
    Open

            $no_photo = "<a href='viewads.php?lid=" . $lid . "'><img class=\"thumb\" src=\"assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"{$title}\" ></a>";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Line exceeds 120 characters; contains 159 characters
    Open

        $sql         = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $xoopsDB->escape($usid) . " AND valid='Yes' {$cat_perms}";
    Severity: Minor
    Found in members.php by phpcodesniffer

    Multi-line function call not indented correctly; expected 8 spaces but found 12
    Open

                $result
    Severity: Minor
    Found in members.php by phpcodesniffer

    Multi-line function call not indented correctly; expected 4 spaces but found 8
    Open

            )) {
    Severity: Minor
    Found in members.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status