mambax7/alumni-26x

View on GitHub
admin/alumni.php

Summary

Maintainability
F
3 days
Test Coverage

File alumni.php has 375 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 admin/alumni.php - About 5 hrs to fix

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

            if (!empty($_FILES['photo']['name'])) {
                include_once XOOPS_ROOT_PATH . '/class/uploader.php';
                $uploaddir        = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/grad_photo";
                $photomax         = $xoops->getModuleConfig('alumni_photomax');
                $maxwide          = $xoops->getModuleConfig('alumni_maxwide');
    Severity: Major
    Found in admin/alumni.php and 2 other locations - About 1 day to fix
    admin/alumni.php on lines 243..263
    admin/category.php on lines 219..239

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

    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 3 locations. Consider refactoring.
    Open

            if (!empty($_FILES['photo2']['name'])) {
                include_once XOOPS_ROOT_PATH . '/class/uploader.php';
                $uploaddir2       = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/now_photo";
                $photomax         = $xoops->getModuleConfig('alumni_photomax');
                $maxwide          = $xoops->getModuleConfig('alumni_maxwide');
    Severity: Major
    Found in admin/alumni.php and 2 other locations - About 1 day to fix
    admin/alumni.php on lines 221..241
    admin/category.php on lines 219..239

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

    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 (isset($ok) && 1 == $ok) {
                if (!$xoops->security()->check()) {
                    $xoops->redirect('alumni.php', 3, implode(',', $xoops->security()->getErrors()));
                }
                if ($listingHandler->delete($obj)) {
    Severity: Major
    Found in admin/alumni.php and 1 other location - About 3 hrs to fix
    admin/category.php on lines 269..280

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

    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 (isset($del_photo2)) {
                if ('1' == $del_photo2) {
                    if (@file_exists('' . $destination2 . '/' . Request::getString('photo2_old') . '')) {
                        unlink('' . $destination2 . '/' . Request::getString('photo2_old') . '');
                    }
    Severity: Minor
    Found in admin/alumni.php and 1 other location - About 55 mins to fix
    admin/alumni.php on lines 172..179

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

    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 (isset($del_photo)) {
                if ('1' == $del_photo) {
                    if (@file_exists('' . $destination . '/' . Request::getString('photo_old') . '')) {
                        unlink('' . $destination . '/' . Request::getString('photo_old') . '');
                    }
    Severity: Minor
    Found in admin/alumni.php and 1 other location - About 55 mins to fix
    admin/alumni.php on lines 182..190

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

    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 ('1' == $xoops->getModuleConfig('alumni_use_captcha') && !$xoops->user->isAdmin()) {
                $xoopsCaptcha = XoopsCaptcha::getInstance();
                if (!$xoopsCaptcha->verify()) {
                    $xoops->redirect(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/addlisting.php', 6, $xoopsCaptcha->getMessage());
                    exit(0);
    Severity: Minor
    Found in admin/alumni.php and 1 other location - About 30 mins to fix
    sendfriend.php on lines 31..37

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

    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

    Blank line found at end of control structure
    Open

    
    
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

            $xoTheme->addStylesheet(ALUMNI_URL . '/media/jquery/tablesorter-master/addons/pager/jquery.tablesorter.pager.css');
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    Line exceeds 120 characters; contains 139 characters
    Open

                    $listing['name']       = "<a href='alumni.php?op=moderated_listing&amp;lid=$lid'><b>$name&nbsp;$mname&nbsp;$lname</b></a>";
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    Line exceeds 120 characters; contains 121 characters
    Open

                        $newitem        = '<img src="' . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/newred.gif\">";
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    Line exceeds 120 characters; contains 221 characters
    Open

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

    Line exceeds 120 characters; contains 144 characters
    Open

                    $xoops->redirect(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/addlisting.php', 6, $xoopsCaptcha->getMessage());
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

            $xoTheme->addStylesheet(ALUMNI_URL . '/media/jquery/tablesorter-master/addons/pager/jquery.tablesorter.pager.css');
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    Line exceeds 120 characters; contains 121 characters
    Open

                        $newitem        = '<img src="' . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/newred.gif\">";
    Severity: Minor
    Found in admin/alumni.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status