xoopscube/altsys

View on GitHub

Showing 115 of 162 total issues

Function smarty_resource_db_tplinfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function smarty_resource_db_tplinfo( $tpl_name ) {
    static $cache = [];
    global $xoopsConfig;

    if ( isset( $cache[ $tpl_name ] ) ) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/smarty_plugins/resource.db.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                if ( ! $tpl_updated && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'template_set' ) {
                    // clear cached/compiled files and regenerate them if default theme has been changed
                    if ( $xoopsConfig['template_set'] != $_POST[ $config->getVar( 'conf_name' ) ] ) {
                        $newtplset = $_POST[ $config->getVar( 'conf_name' ) ];

Severity: Major
Found in xoops_trust_path/libs/altsys/mypreferences.php - About 45 mins to fix

    Function processPost has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function processPost() {
            // Ticket Check
            if ( ! $GLOBALS['xoopsGTicket']->check( true, 'myblocksadmin' ) ) {
                redirect_header( XOOPS_URL . '/', 3, $GLOBALS['xoopsGTicket']->getErrors() );
            }
    Severity: Minor
    Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid deeply nested control flow statements.
    Open

                        if ( '.' == substr( $file, 0, 1 ) ) {
                            continue;
                        }
    Severity: Major
    Found in xoops_trust_path/libs/altsys/oninstall.php - About 45 mins to fix

      Function tplsadmin_import_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function tplsadmin_import_data( $tplset, $tpl_file, $tpl_source, $lastmodified = 0 ) {
      
          $db =& XoopsDatabaseFactory::getDatabaseConnection();
      
          // check the file is valid template
      Severity: Minor
      Found in xoops_trust_path/libs/altsys/include/tpls_functions.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid deeply nested control flow statements.
      Open

                      if ( ! $theme_updated && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'theme_set' ) {
                          $member_handler =& xoops_gethandler( 'member' );
                          $member_handler->updateUsersByField( 'theme', $_POST[ $config->getVar( 'conf_name' ) ] );
                          $theme_updated = true;
                      }
      Severity: Major
      Found in xoops_trust_path/libs/altsys/mypreferences.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if ( is_file( $file_path ) ) {
                                $mtime   = (int) @filemtime( $file_path );
                                $tplfile = $tplfile_handler->create();
                                $tplfile->setVar( 'tpl_source', file_get_contents( $file_path ), true );
                                $tplfile->setVar( 'tpl_refid', $mid );
        Severity: Major
        Found in xoops_trust_path/libs/altsys/oninstall.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if ( ! $startmod_updated && $new_value != '--' && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'startpage' ) {
                              $member_handler     =& xoops_gethandler( 'member' );
                              $groups             =& $member_handler->getGroupList();
                              $moduleperm_handler =& xoops_gethandler( 'groupperm' );
                              $module_handler     =& xoops_gethandler( 'module' );
          Severity: Major
          Found in xoops_trust_path/libs/altsys/mypreferences.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if ( ! $lang_updated && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'language' ) {
                                // regenerate admin menu file
                                $xoopsConfig['language'] = $_POST[ $config->getVar( 'conf_name' ) ];
                                xoops_module_write_admin_menu( xoops_module_get_admin_menu() );
                                $lang_updated = true;
            Severity: Major
            Found in xoops_trust_path/libs/altsys/mypreferences.php - About 45 mins to fix

              Function list_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function list_groups() {
                      $handler = null;
                // query for getting blocks
                      $sql       = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
                      $result    = $this->db->query( $sql );
              Severity: Minor
              Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __construct($mydirname, $table_body, $primary_key, $cols, $page_name, $action_base_hiddens)
              Severity: Minor
              Found in xoops_trust_path/libs/altsys/class/d3utilities.php - About 45 mins to fix

                Method _block has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function _block( $xbeg, $xlen, $ybeg, $ylen, $edits ) {
                Severity: Minor
                Found in xoops_trust_path/libs/altsys/include/Text_Diff_Renderer.php - About 35 mins to fix

                  Method _diag has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) {
                  Severity: Minor
                  Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 35 mins to fix

                    Function tplsadmin_copy_templates_f2db has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function tplsadmin_copy_templates_f2db( $tplset_to, $whr_append = '1' ) {
                        global $db;
                    
                        // get tplsource
                        //$result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . "  WHERE tpl_tplset='default' AND ($whr_append)") ;
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/include/tpls_functions.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function altsys_message_append_oninstall has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                            function altsys_message_append_oninstall( &$module_obj, &$log ) {
                                if ( is_array( @$GLOBALS['ret'] ) ) {
                                    foreach ( $GLOBALS['ret'] as $message ) {
                                        $log->add( strip_tags( $message ) );
                                    }
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/oninstall.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function do_edit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function do_edit( $bid ) {
                            $bid = (int) $bid;
                    
                            if ( $bid <= 0 ) {
                                // new custom block
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function _renderOptionTree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _renderOptionTree( &$tree, $option, $prefix, $parentIds = [] ) {
                            $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="';
                            // If there are parent elements, add javascript that will
                            // make them selected when this element is checked to make
                            // sure permissions to parent items are added as well.
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/include/mygrouppermform.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function altsys_message_append_onuninstall has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                            function altsys_message_append_onuninstall(&$module_obj, &$log)
                            {
                                if (is_array(@$GLOBALS['ret'])) {
                                    foreach ($GLOBALS['ret'] as $message) {
                                        $log->add(strip_tags($message));
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/onuninstall.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function isInstalledXclHtmleditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function isInstalledXclHtmleditor(): bool
                        {
                            if (defined('LEGACY_BASE_VERSION') && version_compare(LEGACY_BASE_VERSION, '2.2', '>=')) {
                                $cNames = self::getDelegateCallbackClassNames('Site.TextareaEditor.HTML.Show');
                                if ($cNames) {
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/class/altsysUtils.class.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function list_blocks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function list_blocks() {
                            $handler = null;
                      global $xoopsGTicket;
                    
                            // main query
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language