XoopsModules25x/xoopstube

View on GitHub
submit.php

Summary

Maintainability
C
1 day
Test Coverage

File submit.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Module: XoopsTube
 *
Severity: Minor
Found in submit.php - About 3 hrs to fix

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

            if (class_exists('XoopsFormEditor')) {
                $options['name']   = 'descriptionb';
                $options['value']  = $descriptionb;
                $options['rows']   = 5;
                $options['cols']   = '100%';
    Severity: Major
    Found in submit.php and 3 other locations - About 4 hrs to fix
    admin/category.php on lines 135..147
    admin/indexpage.php on lines 111..123
    admin/main.php on lines 177..189

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

    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

            $vidsource_array  = [
                0   => _MD_XOOPSTUBE_YOUTUBE,
                1   => _MD_XOOPSTUBE_METACAFE,
                2   => _MD_XOOPSTUBE_IFILM,
                3   => _MD_XOOPSTUBE_PHOTOBUCKET,
    Severity: Major
    Found in submit.php and 1 other location - About 2 hrs to fix
    admin/main.php on lines 125..142

    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

    There must be one USE keyword per declaration
    Open

    use XoopsModules\Xoopstube\{
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 140 characters
    Open

    $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="' . $moduleDirName . '/assets/css/xtubestyle.css">');
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 153 characters
    Open

                    $tags['VIDEO_URL']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $lid;
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 130 characters
    Open

            $item_tag     = isset($video_array['item_tag']) ? htmlspecialchars($video_array['item_tag'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 148 characters
    Open

                $tags['VIDEO_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $newid;
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 136 characters
    Open

            $descriptionb = isset($video_array['description']) ? htmlspecialchars($video_array['description'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

                        $notificationHandler->subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

            $title        = isset($video_array['title']) ? htmlspecialchars($video_array['title'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

                        $notificationHandler->subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 129 characters
    Open

            $time         = isset($video_array['time']) ? htmlspecialchars($video_array['time'], ENT_QUOTES | ENT_HTML5) : '0:00:00';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 122 characters
    Open

                $editor = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%');
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 273 characters
    Open

                $sql .= " VALUES    (0, $cid, '$title', '$vidid', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')";
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 128 characters
    Open

                    $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 133 characters
    Open

            $picurl       = isset($video_array['picurl']) ? htmlspecialchars($video_array['picurl'], ENT_QUOTES | ENT_HTML5) : 'http://';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 133 characters
    Open

            $submitter2 = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 127 characters
    Open

                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/newvideos.php';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 329 characters
    Open

                               . " SET cid=$cid, title='$title', vidid='$vidid', publisher='$publisher', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', vidrating='$vidrating', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl' WHERE lid ="
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 140 characters
    Open

                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewvideos';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 161 characters
    Open

                $editor            = new \XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea');
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 229 characters
    Open

                        $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' (requestid, lid, cid, title, vidid, publisher, vidsource, description, modifysubmitter, requestdate, time, keywords, item_tag, picurl)';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 129 characters
    Open

            $vidid        = Request::getString('vidid', 0, 'POST'); // $myts->addslashes(ltrim(Request::getInt('vidid', 0, 'POST')));
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

                $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 135 characters
    Open

            $submitter    = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 238 characters
    Open

                       . '  (lid, cid, title, vidid, submitter, publisher, status, date, hits, rating, votes, comments, vidsource, published, expired, offline, description, ipaddress, notifypub, vidrating, time, keywords, item_tag, picurl) ';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 194 characters
    Open

                    $submitter_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query('SELECT submitter FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid));
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

            $vidid        = isset($video_array['vidid']) ? htmlspecialchars($video_array['vidid'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 132 characters
    Open

            $publisher    = isset($video_array['publisher']) ? htmlspecialchars($video_array['publisher'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

            $screenshot   = isset($video_array['screenshot']) ? htmlspecialchars($video_array['screenshot'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 121 characters
    Open

            //        $editor = xtube_getWysiwygForm( _MD_XOOPSTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, '');
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 139 characters
    Open

                echo '<input type="button" onclick="location=\'index.php\'" class="formButton" value="' . _CANCEL . '" alt="' . _CANCEL . '">';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 202 characters
    Open

                        $sql .= " VALUES ('', $lid, $cid, '$title', '$vidid', '$publisher', '$vidsource', '$descriptionb', '$modifysubmitter', '$requestdate', '$time', '$keywords', '$item_tag', '$picurl')";
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 130 characters
    Open

            $keywords     = isset($video_array['keywords']) ? htmlspecialchars($video_array['keywords'], ENT_QUOTES | ENT_HTML5) : '';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 132 characters
    Open

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

    Line exceeds 120 characters; contains 138 characters
    Open

                    $tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 172 characters
    Open

                echo '<input type="button" onclick="location=\'submit.php?agree=1\'" class="formButton" value="' . _MD_XOOPSTUBE_AGREE . '" alt="' . _MD_XOOPSTUBE_AGREE . '">';
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 122 characters
    Open

            $sform = new \XoopsThemeForm(_MD_XOOPSTUBE_SUBMITCATHEAD, 'storyform', xoops_getenv('SCRIPT_NAME'), 'post', true);
    Severity: Minor
    Found in submit.php by phpcodesniffer

    Line exceeds 120 characters; contains 130 characters
    Open

                    $updated         = Request::getInt('up_dated', time(), 'POST'); //cleanRequestVars($_REQUEST, 'up_dated', time());
    Severity: Minor
    Found in submit.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status