mambax7/songlist

View on GitHub
admin/songs.php

Summary

Maintainability
F
5 days
Test Coverage

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

                    if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) {
//                        if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) {
//                            foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
//                                foreach (explode('/', $folders) as $folder) {
//                                    $path .= DS . $folder;
Severity: Major
Found in admin/songs.php and 1 other location - About 2 days to fix
admin/songs.php on lines 124..170

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

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 (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) {
//                    if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) {
//                        foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
//                            foreach (explode('/', $folders) as $folder) {
//                                $path .= DS . $folder;
Severity: Major
Found in admin/songs.php and 1 other location - About 2 days to fix
admin/songs.php on lines 202..248

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

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 ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') {
                    redirect_header(
                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
                        10,
                        _AM_SONGLIST_MSG_SONGS_SAVEDOKEY
Severity: Major
Found in admin/songs.php and 1 other location - About 7 hrs to fix
admin/artists.php on lines 124..132

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

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\Songlist\{
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Each PHP statement must be on a line by itself
Open

                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');;
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 297 characters
Open

                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE);
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 247 characters
Open

                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 292 characters
Open

                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_DELETED);
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 278 characters
Open

                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

                                unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3')));
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 168 characters
Open

                        $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName());
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 290 characters
Open

                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_SAVEDOKEY);
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 221 characters
Open

                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $songsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 137 characters
Open

                    $tagHandler->updateByItem($_POST['tags'], $id, $GLOBALS['songlistModule']->getVar('dirname'), $songs->getVar('cid'));
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 294 characters
Open

                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_SAVEDOKEY);
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 142 characters
Open

//                            foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 247 characters
Open

                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 138 characters
Open

//                        foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 270 characters
Open

                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 245 characters
Open

                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 126 characters
Open

                if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 172 characters
Open

                            $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName());
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line exceeds 120 characters; contains 253 characters
Open

                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 24
Open

                        }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 20
Open

                    if (!$songsHandler->insert($songs)) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 20
Open

                    if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 24
Open

                        try {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 20 spaces, found 28
Open

                            if (!$uploader->upload()) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 12 spaces, found 16
Open

                }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 24
Open

                        } catch (Exception $e) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 24
Open

                        } else {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 20
Open

                    }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 24
Open

                        if ($uploader->fetchMedia('mp3' . $id)) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 20 spaces, found 28
Open

                            if (mb_strlen($songs->getVar('mp3'))) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 20
Open

                    }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 20 spaces, found 28
Open

                            }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 16 spaces, found 24
Open

                        }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 12 spaces, found 16
Open

                foreach ($_REQUEST['id'] as $id) {
Severity: Minor
Found in admin/songs.php by phpcodesniffer

Line indented incorrectly; expected 20 spaces, found 28
Open

                            }
Severity: Minor
Found in admin/songs.php by phpcodesniffer

There are no issues that match your filters.

Category
Status