ImpressCMS/impresscms

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

Summary

Maintainability
A
0 mins
Test Coverage

The method editpage has a boolean flag argument $clone, which is a certain sign of a Single Responsibility Principle violation.
Open

function editpage($page_id = 0, $clone = FALSE) {

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method editpage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        $pageObj->setVar('page_type', 'C');
        $sform = $pageObj->getForm (_AM_SYSTEM_PAGES_CREATE, 'addpage');
        $sform->assign ($icmsAdminTpl);

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Variable $icmsModule is undeclared
Open

if (!is_object(icms::$user) || !is_object($icmsModule) || !icms::$user->isAdmin($icmsModule->getVar("mid"))) {

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_moduleid', 'center', FALSE, 'getCustomPageModuleid'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method __construct from undeclared class \icms_ipf_Controller
Open

            $controller = new icms_ipf_Controller ($icms_page_handler);
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method __construct from undeclared class \icms_ipf_view_Table
Open

            $objectTable = new icms_ipf_view_Table($icms_page_handler);
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Saw an @param annotation for post_id, but it was not found in the param list of function editpage(int|mixed $page_id = 0, mixed $clone = null);
Open

 * @param int $post_id Postid to be edited

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_status', 'center', FALSE, 'getCustomPageStatus'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_title', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_url'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method addIntroButton from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addIntroButton('addpost', 'admin.php?fct=pages&op=mod', _AM_SYSTEM_PAGES_CREATE);
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method fetch from undeclared class \icms_ipf_view_Table
Open

            $icmsAdminTpl->assign('icms_page_table', $objectTable->fetch());
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->display('db:system_adm_pagemanager_index.html');

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_url'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method addCustomAction from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addCustomAction('getViewItemLink');
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Reference to static property user from undeclared class \icms
Open

if (!is_object(icms::$user) || !is_object($icmsModule) || !icms::$user->isAdmin($icmsModule->getVar("mid"))) {
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method addQuickSearch from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addQuickSearch(array ('page_title', 'page_url'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->assign('icms_page_table', $objectTable->fetch());

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->assign('icms_page_title', _AM_SYSTEM_PAGES_TITLE);

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_status', 'center', FALSE, 'getCustomPageStatus'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_moduleid', 'center', FALSE, 'getCustomPageModuleid'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method __construct from undeclared class \icms_ipf_Controller
Open

            $controller = new icms_ipf_Controller($icms_page_handler);
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method storeFromDefaultForm from undeclared class \icms_ipf_Controller
Open

            $controller->storeFromDefaultForm(_AM_SYSTEM_PAGES_CREATED, _AM_SYSTEM_PAGES_MODIFIED);
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method handleObjectDeletion from undeclared class \icms_ipf_Controller
Open

            $controller->handleObjectDeletion();
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_title', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

Call to method addFilter from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addFilter('page_moduleid', 'getModulesArray');
Severity: Critical
Found in htdocs/modules/system/admin/pages/main.php by phan

The parameter $page_id is not named in camelCase.
Open

function editpage($page_id = 0, $clone = FALSE) {
    global $icms_page_handler, $icmsAdminTpl;

    $pageObj = $icms_page_handler->get($page_id);

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
Open

if (in_array($clean_op, $valid_op, TRUE)) {

There must be no space before the colon in a CASE statement
Open

        case "mod" :

There must be no space before the colon in a CASE statement
Open

        case "changedField" :

There must be no space before the colon in a CASE statement
Open

        case "clone" :

There must be no space before the colon in a CASE statement
Open

        case "del" :

There must be no space before the colon in a DEFAULT statement
Open

        default :

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

function editpage($page_id = 0, $clone = FALSE) {

TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
Open

            editpage($clean_page_id, TRUE);

There must be no space before the colon in a CASE statement
Open

        case "addpage" :

Blank line found at end of control structure
Open


There must be no space before the colon in a CASE statement
Open

        case 'status' :

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_moduleid', 'center', FALSE, 'getCustomPageModuleid'));

Blank line found at end of control structure
Open


TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_title', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('page_status', 'center', FALSE, 'getCustomPageStatus'));

Inline control structures are not allowed
Open

if (isset($_POST ['op']))

Inline control structures are not allowed
Open

if (isset($_GET['op']))

Space before opening parenthesis of function call prohibited
Open

        $sform->assign ($icmsAdminTpl);

Space before opening parenthesis of function call prohibited
Open

            icms_cp_header ();

Space before opening parenthesis of function call prohibited
Open

            icms_cp_header ();

Space before opening parenthesis of function call prohibited
Open

            $controller = new icms_ipf_Controller ($icms_page_handler);

Space after opening parenthesis of function call prohibited
Open

            $icms_page_handler->changeStatus( $clean_page_id );

Space before opening parenthesis of function call prohibited
Open

        $sform->assign ($icmsAdminTpl);

Space before opening parenthesis of function call prohibited
Open

    exit ("Access Denied");

Space before opening parenthesis of function call prohibited
Open

        $sform = $pageObj->getForm (_AM_SYSTEM_PAGES_CREATE, 'addpage');

Expected 1 newline at end of file; 0 found
Open

}

Expected 0 spaces before closing bracket; 1 found
Open

            $icms_page_handler->changeStatus( $clean_page_id );

Space before opening parenthesis of function call prohibited
Open

        $sform = $pageObj->getForm (_AM_SYSTEM_PAGES_EDIT, 'addpage');

The variable $icms_page_handler is not named in camelCase.
Open

function editpage($page_id = 0, $clone = FALSE) {
    global $icms_page_handler, $icmsAdminTpl;

    $pageObj = $icms_page_handler->get($page_id);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $page_id is not named in camelCase.
Open

function editpage($page_id = 0, $clone = FALSE) {
    global $icms_page_handler, $icmsAdminTpl;

    $pageObj = $icms_page_handler->get($page_id);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $icms_page_handler is not named in camelCase.
Open

function editpage($page_id = 0, $clone = FALSE) {
    global $icms_page_handler, $icmsAdminTpl;

    $pageObj = $icms_page_handler->get($page_id);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $page_id is not named in camelCase.
Open

function editpage($page_id = 0, $clone = FALSE) {
    global $icms_page_handler, $icmsAdminTpl;

    $pageObj = $icms_page_handler->get($page_id);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status