XoopsModules25x/xoopstube

View on GitHub
admin/modifications.php

Summary

Maintainability
C
1 day
Test Coverage

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

        foreach ($orig_array as $key => $content) {
            if (in_array($key, $not_allowed)) {
                continue;
            }
            $lang_def = constant('_AM_XOOPSTUBE_MOD_' . mb_strtoupper($key));
Severity: Major
Found in admin/modifications.php and 1 other location - About 5 hrs to fix
admin/modifications.php on lines 81..98

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

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

        foreach ($mod_array as $key => $content) {
            if (in_array($key, $not_allowed)) {
                continue;
            }
            $lang_def = constant('_AM_XOOPSTUBE_MOD_' . mb_strtoupper($key));
Severity: Major
Found in admin/modifications.php and 1 other location - About 5 hrs to fix
admin/modifications.php on lines 55..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 193.

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

The CASE body must start on the line following the statement
Open

    case 'listmodreqshow':
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

The DEFAULT body must start on the line following the statement
Open

    default:
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

There must be one USE keyword per declaration
Open

use XoopsModules\Xoopstube\{
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 129 characters
Open

            echo '<tr style="text-align: center;"><td class="head" colspan="7">' . _AM_XOOPSTUBE_MOD_NOMODREQUEST . '</td></tr>';
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

        $pagenav = new \XoopsPageNav($totalmodrequests, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start, 'start');
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 237 characters
Open

        $sql        = 'SELECT submitter, lid, cid, title, vidid, submitter, publisher, vidsource, description, time, keywords, item_tag, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $mod_array['lid'];
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 264 characters
Open

            . " SET cid = $cid, title='$title', vidid='$vidid', screenshot='', publisher='$publisher', vidsource='$vidsource', description='$descriptionb', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl', updated='$updated' WHERE lid = "
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

                $sql     = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $content;
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 149 characters
Open

                $path        = $xoopstubetree->getNicePathFromId($videoArray['requestid'], 'title', 'modifications.php?op=listmodreqshow&requestid');
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 249 characters
Open

        $sql       = 'SELECT modifysubmitter, requestid, lid, cid, title, vidid, submitter, publisher, vidsource, description, time, keywords, item_tag, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid;
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 123 characters
Open

        $sql              = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' ORDER BY requestdate DESC';
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

                $sql     = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $content;
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 148 characters
Open

                $requestdate = Utility::getTimestamp(formatTimestamp($videoArray['requestdate'], $GLOBALS['xoopsModuleConfig']['dateformatadmin']));
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 134 characters
Open

              <legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_MOD_MODREQUESTSINFO . '</legend>';
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 126 characters
Open

        //        $page = ( $totalmodrequests > $GLOBALS['xoopsModuleConfig']['admin_perpage'] ) ? _AM_xtube_MINDEX_PAGE : '';
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 137 characters
Open

$requestid = Request::getInt('requestid', Request::getInt('requestid', 0, 'POST'), 'GET'); //cleanRequestVars($_REQUEST, 'requestid', 0);
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

        $sql         = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid;
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

        $sql = sprintf('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid);
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

        echo '<div style="padding: 8px;">' . _AM_XOOPSTUBE_MOD_TOTMODREQUESTS . '<b>' . $totalmodrequests . '</b></div>';
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

Line exceeds 120 characters; contains 175 characters
Open

                echo '<td class="even"><a href="modifications.php?op=listmodreqshow&amp;requestid=' . $videoArray['requestid'] . '">' . $xtubeImageArray['view'] . '</a></td>';
Severity: Minor
Found in admin/modifications.php by phpcodesniffer

There are no issues that match your filters.

Category
Status