ImpressCMS/impresscms

View on GitHub
htdocs/modules/system/admin/groups/main.php

Summary

Maintainability
B
4 hrs
Test Coverage

File main.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// $Id: main.php 12313 2013-09-15 21:14:35Z skenow $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
Severity: Minor
Found in htdocs/modules/system/admin/groups/main.php - About 2 hrs to fix

    Reference to static property user from undeclared class \icms
    Open

        || !icms::$user->isAdmin($icmsModule->getVar('mid'))

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_read'), 'OR');

    Call to method handler from undeclared class \icms
    Open

            $member_handler = icms::handler('icms_member');

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'enable_debug'), 'OR');

    Reference to static property security from undeclared class \icms
    Open

                redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));

    Call to method handler from undeclared class \icms
    Open

                $gperm_handler = icms::handler('icms_member_groupperm');

    Variable $icmsModule is undeclared
    Open

        || !is_object($icmsModule)

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                    $criteria2->add(new icms_db_criteria_Item('gperm_name', 'use_wysiwygeditor'), 'OR');

    Call to method handler from undeclared class \icms
    Open

                $gperm_handler = icms::handler('icms_member_groupperm');

    Call to method handler from undeclared class \icms
    Open

            $member_handler = icms::handler('icms_member');

    Reference to static property security from undeclared class \icms
    Open

                redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));

    Call to method handler from undeclared class \icms
    Open

                $member_handler = icms::handler('icms_member');

    Reference to static property security from undeclared class \icms
    Open

            if (!icms::$security->check()) {

    Reference to static property security from undeclared class \icms
    Open

                redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));

    Variable $groupid is undeclared
    Open

            if ((int) $groupid > 0) {

    Variable $groupid is undeclared
    Open

                redirect_header('admin.php?fct=groups&amp;op=modify&amp;g_id=' . $groupid . '&amp;memstart=' . $memstart, 0, _AM_DBUPDATED);

    Call to method __construct from undeclared class \icms_db_criteria_Compo
    Open

                $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('gperm_groupid', $groupid));

    Reference to static property security from undeclared class \icms
    Open

                redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));

    Call to method handler from undeclared class \icms
    Open

                $gperm_handler = icms::handler('icms_member_groupperm');

    Call to method handler from undeclared class \icms
    Open

                $member_handler = icms::handler('icms_member');

    Reference to static property security from undeclared class \icms
    Open

            if (!icms::$security->check()) {

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_admin'), 'OR');

    Variable $name is undeclared
    Open

            if (!$name) {

    Call to method handler from undeclared class \icms
    Open

            $member_handler = icms::handler('icms_member');

    Variable $groupid is undeclared
    Open

                if ($groupid == XOOPS_GROUP_ADMIN) {

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'enable_debug'), 'OR');

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria->add($criteria2);

    Variable $icmsModule is undeclared
    Open

        || !icms::$user->isAdmin($icmsModule->getVar('mid'))

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria->add(new icms_db_criteria_Item('gperm_modid', 1));

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria->add(new icms_db_criteria_Item('gperm_modid', 1));

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_admin'), 'OR');

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'block_read'), 'OR');

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'group_manager'), 'OR');

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'group_manager'), 'OR');

    Reference to static property security from undeclared class \icms
    Open

            if (!icms::$security->check()) {

    Call to method confirm from undeclared class \icms_core_Message
    Open

            icms_core_Message::confirm(array('fct' => 'groups', 'op' => 'delConf', 'g_id' => $g_id), 'admin.php', _AM_AREUSUREDEL);

    Call to method handler from undeclared class \icms
    Open

    $gperm_handler = icms::handler('icms_member_groupperm');

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                    $criteria2->add(new icms_db_criteria_Item('gperm_name', 'use_wysiwygeditor'), 'OR');

    Variable $groupid is undeclared
    Open

            redirect_header("admin.php?fct=groups&amp;op=modify&amp;g_id=" . $groupid . "", 0, _AM_DBUPDATED);

    Reference to static property user from undeclared class \icms
    Open

    if (!is_object(icms::$user)

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria2 = new icms_db_criteria_Compo(new icms_db_criteria_Item('gperm_name', 'system_admin'));

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_read'), 'OR');

    Reference to static property user from undeclared class \icms
    Open

        || (isset($_GET['g_id']) && !$gperm_handler->checkRight('group_manager', $_GET['g_id'], icms::$user->getGroups()))

    Call to method __construct from undeclared class \icms_db_criteria_Item
    Open

                $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('gperm_groupid', $groupid));

    Reference to static property security from undeclared class \icms
    Open

            if (!icms::$security->check()) {

    Reference to static property security from undeclared class \icms
    Open

                redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));

    Call to method __construct from undeclared class \icms_db_criteria_Compo
    Open

                $criteria2 = new icms_db_criteria_Compo(new icms_db_criteria_Item('gperm_name', 'system_admin'));

    Call to method add from undeclared class \icms_db_criteria_Compo
    Open

                $criteria2->add(new icms_db_criteria_Item('gperm_name', 'block_read'), 'OR');

    Reference to static property security from undeclared class \icms
    Open

            if (!icms::$security->check()) {

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

                if (count($system_catids) > 0) {
                    array_push($admin_mids, 1);
                    foreach ($system_catids as $s_cid) {
    
                        $sysperm =& $gperm_handler->create();
    Severity: Major
    Found in htdocs/modules/system/admin/groups/main.php and 1 other location - About 1 hr to fix
    htdocs/modules/system/admin/groups/main.php on lines 117..129

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

    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 (count($system_catids) > 0) {
                    array_push($admin_mids, 1);
                    foreach ($system_catids as $s_cid) {
    
                        $sysperm =& $gperm_handler->create();
    Severity: Major
    Found in htdocs/modules/system/admin/groups/main.php and 1 other location - About 1 hr to fix
    htdocs/modules/system/admin/groups/main.php on lines 234..245

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

    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

    
    

    Blank line found at start of control structure
    Open

                    foreach ($useeditor_mids as $ed_mid) {

    Blank line found at start of control structure
    Open

                foreach ($enabledebug_mids as $ed_mid) {

    Blank line found at start of control structure
    Open

            for ($i = 0; $i < $size; $i++) {

    Blank line found at start of control structure
    Open

                foreach ($admin_mids as $a_mid) {

    Blank line found at start of control structure
    Open

                foreach ($read_mids as $r_mid) {

    Blank line found at start of control structure
    Open

                foreach ($read_bids as $r_bid) {

    Blank line found at end of control structure
    Open

    
    

    Blank line found at start of control structure
    Open

                    foreach ($system_catids as $s_cid) {

    Blank line found at start of control structure
    Open

            if (!$name) {

    Blank line found at start of control structure
    Open

                foreach ($enabledebug_mids as $ed_mid) {

    Blank line found at start of control structure
    Open

                foreach ($groupmanager_gids as $gm_gid) {

    Blank line found at start of control structure
    Open

                foreach ($groupmanager_gids as $gm_gid) {

    Blank line found at end of control structure
    Open

    
    

    Blank line found at start of control structure
    Open

                    foreach ($system_catids as $s_cid) {

    Blank line found at start of control structure
    Open

                foreach ($useeditor_mids as $ed_mid) {

    Blank line found at start of control structure
    Open

                foreach ($read_bids as $r_bid) {

    Inline control structures are not allowed
    Open

        if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);

    Inline control structures are not allowed
    Open

        if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);

    Closing brace must be on a line by itself
    Open

        if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);

    Closing brace must be on a line by itself
    Open

        if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);

    Newline required after opening brace
    Open

        if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);

    Expected 1 space after closing parenthesis; found " $"
    Open

        if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);

    Expected 1 space after closing parenthesis; found " $"
    Open

        if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);

    No space found after comma in function call
    Open

                redirect_header("admin.php?fct=groups", 3,_AM_UNEED2ENTER);

    Newline required after opening brace
    Open

        if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);

    There are no issues that match your filters.

    Category
    Status