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 //
Reference to static property user
from undeclared class \icms
Open
|| !icms::$user->isAdmin($icmsModule->getVar('mid'))
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_read'), 'OR');
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$member_handler = icms::handler('icms_member');
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'enable_debug'), 'OR');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$gperm_handler = icms::handler('icms_member_groupperm');
- Exclude checks
Variable $icmsModule
is undeclared Open
|| !is_object($icmsModule)
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'use_wysiwygeditor'), 'OR');
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$gperm_handler = icms::handler('icms_member_groupperm');
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$member_handler = icms::handler('icms_member');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$member_handler = icms::handler('icms_member');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
if (!icms::$security->check()) {
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));
- Exclude checks
Variable $groupid
is undeclared Open
if ((int) $groupid > 0) {
- Exclude checks
Variable $groupid
is undeclared Open
redirect_header('admin.php?fct=groups&op=modify&g_id=' . $groupid . '&memstart=' . $memstart, 0, _AM_DBUPDATED);
- Exclude checks
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));
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$gperm_handler = icms::handler('icms_member_groupperm');
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$member_handler = icms::handler('icms_member');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
if (!icms::$security->check()) {
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_admin'), 'OR');
- Exclude checks
Variable $name
is undeclared Open
if (!$name) {
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$member_handler = icms::handler('icms_member');
- Exclude checks
Variable $groupid
is undeclared Open
if ($groupid == XOOPS_GROUP_ADMIN) {
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'enable_debug'), 'OR');
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria->add($criteria2);
- Exclude checks
Variable $icmsModule
is undeclared Open
|| !icms::$user->isAdmin($icmsModule->getVar('mid'))
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria->add(new icms_db_criteria_Item('gperm_modid', 1));
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria->add(new icms_db_criteria_Item('gperm_modid', 1));
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_admin'), 'OR');
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'block_read'), 'OR');
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'group_manager'), 'OR');
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'group_manager'), 'OR');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
if (!icms::$security->check()) {
- Exclude checks
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);
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$gperm_handler = icms::handler('icms_member_groupperm');
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'use_wysiwygeditor'), 'OR');
- Exclude checks
Variable $groupid
is undeclared Open
redirect_header("admin.php?fct=groups&op=modify&g_id=" . $groupid . "", 0, _AM_DBUPDATED);
- Exclude checks
Reference to static property user
from undeclared class \icms
Open
if (!is_object(icms::$user)
- Exclude checks
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'));
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'module_read'), 'OR');
- Exclude checks
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()))
- Exclude checks
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));
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
if (!icms::$security->check()) {
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
redirect_header("admin.php?fct=groups", 3, implode('<br />', icms::$security->getErrors()));
- Exclude checks
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'));
- Exclude checks
Call to method add
from undeclared class \icms_db_criteria_Compo
Open
$criteria2->add(new icms_db_criteria_Item('gperm_name', 'block_read'), 'OR');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
if (!icms::$security->check()) {
- Exclude checks
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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Blank line found at end of control structure Open
- Exclude checks
Blank line found at start of control structure Open
foreach ($useeditor_mids as $ed_mid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($enabledebug_mids as $ed_mid) {
- Exclude checks
Blank line found at start of control structure Open
for ($i = 0; $i < $size; $i++) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($admin_mids as $a_mid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($read_mids as $r_mid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($read_bids as $r_bid) {
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
Blank line found at start of control structure Open
foreach ($system_catids as $s_cid) {
- Exclude checks
Blank line found at start of control structure Open
if (!$name) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($enabledebug_mids as $ed_mid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($groupmanager_gids as $gm_gid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($groupmanager_gids as $gm_gid) {
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
Blank line found at start of control structure Open
foreach ($system_catids as $s_cid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($useeditor_mids as $ed_mid) {
- Exclude checks
Blank line found at start of control structure Open
foreach ($read_bids as $r_bid) {
- Exclude checks
Inline control structures are not allowed Open
if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
Inline control structures are not allowed Open
if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
Closing brace must be on a line by itself Open
if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
Closing brace must be on a line by itself Open
if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
Newline required after opening brace Open
if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
Expected 1 space after closing parenthesis; found " $" Open
if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
Expected 1 space after closing parenthesis; found " $" Open
if (!empty($_GET)) foreach ($_GET as $k => $v) ${$k} = StopXSS($v);
- Exclude checks
No space found after comma in function call Open
redirect_header("admin.php?fct=groups", 3,_AM_UNEED2ENTER);
- Exclude checks
Newline required after opening brace Open
if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);
- Exclude checks