mambax7/alumni-26x

View on GitHub
listing.php

Summary

Maintainability
D
2 days
Test Coverage

File listing.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 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
 which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Minor
Found in listing.php - About 4 hrs to fix

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

            if (!empty($_FILES['photo']['name'])) {
                include_once XOOPS_ROOT_PATH . '/class/uploader.php';
                $uploaddir         = XOOPS_ROOT_PATH . '/modules/alumni/photos/grad_photo';
                $photomax          = $xoops->getModuleConfig('alumni_photomax');
                $maxwide           = $xoops->getModuleConfig('alumni_maxwide');
    Severity: Major
    Found in listing.php and 1 other location - About 1 day to fix
    listing.php on lines 333..353

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

    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 (!empty($_FILES['photo2']['name'])) {
                include_once XOOPS_ROOT_PATH . '/class/uploader.php';
                $uploaddir2        = XOOPS_ROOT_PATH . '/modules/alumni/photos/now_photo';
                $photomax          = $xoops->getModuleConfig('alumni_photomax');
                $maxwide           = $xoops->getModuleConfig('alumni_maxwide');
    Severity: Major
    Found in listing.php and 1 other location - About 1 day to fix
    listing.php on lines 311..331

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

    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

    Line exceeds 120 characters; contains 195 characters
    Open

                $printA = '<a href="print.php?lid=' . addslashes($lid) . '" target="_blank"><img src="images/print.gif" border=0 alt="' . AlumniLocale::THIS_PRINT . '" width=15 height=11></a>&nbsp;';
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 158 characters
    Open

            $path = str_replace('&nbsp;:&nbsp;', " <img src='" . XOOPS_URL . '/modules/alumni/images/arrow.gif' . "' style='border-width: 0px;' alt=''> ", $path);
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 146 characters
    Open

            $itemPath         = "<a href='" . ALUMNI_URL . '/categories.php?cid=' . $catObj->getVar('cid') . "'>" . $catObj->getVar('title') . '</a>';
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 169 characters
    Open

                    $xoops->tpl()->assign('submitter', AlumniLocale::SUBMITTED_BY . "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . addslashes($usid) . "'>$submitter</a>");
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 291 characters
    Open

                                              '<a href="listing.php?op=edit_listing&amp;lid=' . addslashes($lid) . '&amp;cid=' . addslashes($cid) . '">' . AlumniLocale::MODIFY . '</a>  |  <a href="listing.php?op=delete_listing&amp;lid=' . addslashes($lid) . '">' . XoopsLocale::A_DELETE . '</a>'
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 242 characters
    Open

                        $xoops->tpl()->assign('admin', '<a href="admin/alumni.php?op=edit_listing&amp;lid=' . addslashes($lid) . '&amp;cid=' . addslashes($cid) . '"><img src="images/modif.gif" border=0 alt="' . AlumniLocale::MODADMIN . '"></a>');
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 222 characters
    Open

                echo $xoops->confirm(['ok' => 1, 'lid' => $lid, 'op' => 'delete_listing'], 'listing.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br><span class="red">' . $obj->getVar('lname') . '<span>');
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 176 characters
    Open

                $path = "<a href='" . ALUMNI_URL . '/categories.php?cid=' . $catpath_arr[$i]->getVar('cid') . "'>" . $catpath_arr[$i]->getVar('title') . "</a>&nbsp;:&nbsp;{$path}";
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 210 characters
    Open

                $mailA  = "<a href=\"sendfriend.php?op=SendFriend&amp;lid=$lid\"><img src=\"../{$moduleDirName}/images/friend.gif\" border=\"0\" alt=\"" . AlumniLocale::FRIENDSEND . '" width="15" height="11"></a>';
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

                    $xoops->tpl()->assign('contact_email', "<a href=\"contact.php?lid=$lid\">" . AlumniLocale::EMAIL . '</a>');
    Severity: Minor
    Found in listing.php by phpcodesniffer

    Multi-line function call not indented correctly; expected 24 spaces but found 42
    Open

                                              '<a href="listing.php?op=edit_listing&amp;lid=' . addslashes($lid) . '&amp;cid=' . addslashes($cid) . '">' . AlumniLocale::MODIFY . '</a>  |  <a href="listing.php?op=delete_listing&amp;lid=' . addslashes($lid) . '">' . XoopsLocale::A_DELETE . '</a>'
    Severity: Minor
    Found in listing.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status