XoopsModules25x/xoopstube

View on GitHub
viewcat.php

Summary

Maintainability
A
3 hrs
Test Coverage

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

        if ('' !== $_image && $GLOBALS['xoopsModuleConfig']['usethumbs']) {
            $_thumb_image = new Thumbnails($_image, $GLOBALS['xoopsModuleConfig']['catimage'], 'thumbs');
            if ($_thumb_image) {
                $_thumb_image->setUseThumbs(1);
                $_thumb_image->setImageType('gd2');
Severity: Major
Found in viewcat.php and 1 other location - About 2 hrs to fix
index.php on lines 140..147

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

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 (empty($_image) || '' == $_image) {
            $imgurl  = $indicator['image'];
            $_width  = 33;
            $_height = 24;
        } else {
Severity: Minor
Found in viewcat.php and 1 other location - About 35 mins to fix
index.php on lines 148..156

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

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\Xoopstube\{Common\LetterChoice,
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 211 characters
Open

             && !empty($_REQUEST['orderby'])) ? Utility::convertOrderByIn(htmlspecialchars($_REQUEST['orderby'], ENT_QUOTES | ENT_HTML5)) : Utility::convertOrderByIn($GLOBALS['xoopsModuleConfig']['linkxorder']);
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 196 characters
Open

$orderby  = Request::getString('orderby', '', 'GET') ? Utility::convertOrderByIn(Request::getString('orderby', '', 'GET')) : Utility::convertOrderByIn($GLOBALS['xoopsModuleConfig']['linkxorder']);
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 137 characters
Open

    $xoopsTpl->assign('selected_date', Utility::getTimestamp(formatTimestamp($selectdate, $GLOBALS['xoopsModuleConfig']['dateformat'])));
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

//$choicebyletter = new LetterChoice($videosHandler, null, null, range('a', 'z'), 'init', XOOPSTUBE_URL . '/letter.php');
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 258 characters
Open

                $infercategories .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $sub_ele['cid'] . '">' . htmlspecialchars($sub_ele['title'], ENT_QUOTES | ENT_HTML5) . '</a> (' . $hassubitems['count'] . ')';
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 286 characters
Open

                $_image = $_thumb_image->createThumbnail($GLOBALS['xoopsModuleConfig']['shotwidth'], $GLOBALS['xoopsModuleConfig']['shotheight'], $GLOBALS['xoopsModuleConfig']['imagequality'], $GLOBALS['xoopsModuleConfig']['updatethumbs'], $GLOBALS['xoopsModuleConfig']['imageAspect']);
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 153 characters
Open

    $query  = ' WHERE published>=' . $stat_begin . ' AND published<=' . $stat_end . ' AND (expired=0 OR expired>' . time() . ') AND offline=0 AND cid>0';
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 218 characters
Open

    $sql    = 'SELECT DISTINCT a.* FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' b ON b.lid=a.lid ' . $query . ' ORDER BY ' . $orderby;
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 198 characters
Open

    $query = 'WHERE a.published>0 AND a.published<=' . time() . ' AND (a.expired=0 OR a.expired>' . time() . ') AND a.offline=0' . ' AND (b.cid=a.cid OR (a.cid=' . $cid . ' OR b.cid=' . $cid . '))';
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 156 characters
Open

    $query = " WHERE title LIKE '$list%' AND (published>0 AND published<=" . time() . ') AND (expired=0 OR expired>' . time() . ') AND offline=0 AND cid>0';
Severity: Minor
Found in viewcat.php by phpcodesniffer

Line exceeds 120 characters; contains 192 characters
Open

    //    $sql2 = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' b ON b.lid=a.lid ' . $query;
Severity: Minor
Found in viewcat.php by phpcodesniffer

There are no issues that match your filters.

Category
Status