XoopsModules25x/adminer

View on GitHub

Showing 307 of 307 total issues

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

checkbox($F,$Y,$Na,$dd="",$Xd="",$Ra=""){$K="<input type='checkbox' name='$F' value='".h($Y)."'".($Na?" checked":"").($Xd?' onclick="'.h($Xd).'"':'').">";return($dd!=""||$Ra?"<label".($Ra?" class='$Ra'":"").">$K".h($dd)."</label>":$K);}function
Severity: Minor
Found in include/adminer.php - About 45 mins to fix

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

    selectQueryBuild($N,$Z,$s,$de,$_,$G){return"";}function
    Severity: Minor
    Found in include/adminer.php - About 45 mins to fix

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

      array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU','',$f->result("SHOW CREATE VIEW ".table($D),1)));}function
      collations(){$K=array();foreach(get_rows("SHOW COLLATION")as$L){if($L["Default"])$K[$L["Charset"]][-1]=$L["Collation"];else$K[$L["Charset"]][]=$L["Collation"];}ksort($K);foreach($K
      as$x=>$V)asort($K[$x]);return$K;}function
      Severity: Minor
      Found in include/editor.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 ($csv_add_slashes)
                $dumpline = addslashes($dumpline);
      Severity: Major
      Found in include/bigdump.php - About 45 mins to fix

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

            function login($login, $password) {
                // check if server is allowed
                foreach ($this->servers as $key => $val) {
                    $servers = $val;
                    if (!is_array($val)) {
        Severity: Minor
        Found in include/plugins/login-servers.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 connect has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        connect($O="",$V="",$we="",$qb=null,$Ae=null,$zf=null){mysqli_report(MYSQLI_REPORT_OFF);list($Gc,$Ae)=explode(":",$O,2);$K=@$this->real_connect(($O!=""?$Gc:ini_get("mysqli.default_host")),($O.$V!=""?$V:ini_get("mysqli.default_user")),($O.$V.$we!=""?$we:ini_get("mysqli.default_pw")),$qb,(is_numeric($Ae)?$Ae:ini_get("mysqli.default_port")),(!is_numeric($Ae)?$Ae:$zf));return$K;}function
        Severity: Minor
        Found in include/adminer.php - About 45 mins to fix

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

          connect($O="",$T="",$G="",$Za=null,$id=null,$Qd=null){mysqli_report(MYSQLI_REPORT_OFF);list($dc,$id)=explode(":",$O,2);$K=@$this->real_connect(($O!=""?$dc:ini_get("mysqli.default_host")),($O.$T!=""?$T:ini_get("mysqli.default_user")),($O.$T.$G!=""?$G:ini_get("mysqli.default_pw")),$Za,(is_numeric($id)?$id:ini_get("mysqli.default_port")),(!is_numeric($id)?$id:$Qd));return$K;}function
          Severity: Minor
          Found in include/editor.php - About 45 mins to fix

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

            selectLink($V,$l){}function
            selectVal($V,$z,$l,$ad){$K=($V===null?"&nbsp;":$V);$z=h($z);if(preg_match('~blob|bytea~',$l["type"])&&!is_utf8($V)){$K=lang(array('%d byte','%d bytes'),strlen($ad));if(preg_match("~^(GIF|\xFF\xD8\xFF|\x89PNG\x0D\x0A\x1A\x0A)~",$ad))$K="<img src='$z' alt='$K'>";}if(like_bool($l)&&$K!="&nbsp;")$K=($V?'yes':'no');if($z)$K="<a href='$z'".(is_url($z)?" rel='noreferrer'":"").">$K</a>";if(!$z&&!like_bool($l)&&preg_match('~int|float|double|decimal~',$l["type"]))$K="<div class='number'>$K</div>";elseif(preg_match('~date~',$l["type"]))$K="<div class='datetime'>$K</div>";return$K;}function
            Severity: Minor
            Found in include/editor.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

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

            as$V){if(($V["col"]==""||$e[$V["col"]])&&"$V[col]$V[val]"!=""){echo"<div><select name='where[$q][col]'><option value=''>(".'anywhere'.")".optionlist($e,$V["col"],true)."</select>",html_select("where[$q][op]",array(-1=>"")+$this->operators,$V["op"]),"<input type='search' name='where[$q][val]' value='".h($V["val"])."' onkeydown='selectSearchKeydown(this, event);' onsearch='selectSearchSearch(this);'></div>\n";$q++;}}echo"<div><select name='where[$q][col]' onchange='this.nextSibling.nextSibling.onchange();'><option value=''>(".'anywhere'.")".optionlist($e,null,true)."</select>",html_select("where[$q][op]",array(-1=>"")+$this->operators),"<input type='search' name='where[$q][val]' onchange='selectAddRow(this);' onsearch='selectSearch(this);'></div>\n","</div></fieldset>\n";}function
            selectOrderPrint($E,$e,$t){$Zc=array();foreach($t
            as$x=>$s){$E=array();foreach($s["columns"]as$V)$E[]=$e[$V];if(count(array_filter($E,'strlen'))>1&&$x!="PRIMARY")$Zc[$x]=implode(", ",$E);}if($Zc){echo'<fieldset><legend>'.'Sort'."</legend><div>","<select name='index_order'>".optionlist(array(""=>"")+$Zc,($_GET["order"][0]!=""?"":$_GET["index_order"]),true)."</select>","</div></fieldset>\n";}if($_GET["order"])echo"<div style='display: none;'>".hidden_fields(array("order"=>array(1=>reset($_GET["order"])),"desc"=>($_GET["desc"]?array(1=>1):array()),))."</div>\n";}function
            Severity: Minor
            Found in include/editor.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 selectQueryBuild has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            selectQueryBuild($N,$Y,$p,$E,$y,$F){return"";}function
            Severity: Minor
            Found in include/editor.php - About 45 mins to fix

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

                  function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
              Severity: Minor
              Found in include/plugins/plugin.php - About 45 mins to fix

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

                checkbox($F,$Y,$Na,$dd="",$Xd="",$Ra=""){$K="<input type='checkbox' name='$F' value='".h($Y)."'".($Na?" checked":"").($Xd?' onclick="'.h($Xd).'"':'').">";return($dd!=""||$Ra?"<label".($Ra?" class='$Ra'":"").">$K".h($dd)."</label>":$K);}function
                optionlist($be,$qf=null,$Eg=false){$K="";foreach($be
                as$Zc=>$W){$ce=array($Zc=>$W);if(is_array($W)){$K.='<optgroup label="'.h($Zc).'">';$ce=$W;}foreach($ce
                as$z=>$X)$K.='<option'.($Eg||is_string($z)?' value="'.h($z).'"':'').(($Eg||is_string($z)?(string)$z:$X)===$qf?' selected':'').'>'.h($X);if(is_array($W))$K.='</optgroup>';}return$K;}function
                Severity: Minor
                Found in include/adminer.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

                use_sql($i).";\n\n";$le="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$if){foreach(get_rows("SHOW $if STATUS WHERE Db = ".q($i),null,"-- ")as$L){$g=remove_definer($e->result("SHOW CREATE $if ".idf_escape($L["Name"]),2));set_utf8mb4($g);$le.=($If!='DROP+CREATE'?"DROP $if IF EXISTS ".idf_escape($L["Name"]).";;\n":"")."$g;;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$L){$g=remove_definer($e->result("SHOW CREATE EVENT ".idf_escape($L["Name"]),3));set_utf8mb4($g);$le.=($If!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($L["Name"]).";;\n":"")."$g;;\n\n";}}if($le)echo"DELIMITER ;;\n\n$le"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$Lg=array();foreach(table_status('',true)as$F=>$R){$Q=(DB==""||in_array($F,(array)$_POST["tables"]));$ob=(DB==""||in_array($F,(array)$_POST["data"]));if($Q||$ob){if($gc=="tar"){$ig=new
                TmpFile;ob_start(array($ig,'write'),1e5);}$b->dumpTable($F,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$Lg[]=$F;elseif($ob){$m=fields($F);$b->dumpData($F,$_POST["data_style"],"SELECT *".convert_fields($m,$m)." FROM ".table($F));}if($Wc&&$_POST["triggers"]&&$Q&&($qg=trigger_sql($F,$_POST["table_style"])))echo"\nDELIMITER ;;\n$qg\nDELIMITER ;\n";if($gc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$i/")."$F.csv",$ig);}elseif($Wc)echo"\n";}}foreach($Lg
                Severity: Major
                Found in include/adminer.php - About 45 mins to fix

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

                  fieldName($l,$de=0){return'<span title="'.h($l["full_type"]).'">'.h($l["field"]).'</span>';}function
                  selectLinks($Of,$P=""){echo'<p class="links">';$od=array("select"=>'Select data');if(support("table")||support("indexes"))$od["table"]='Show structure';if(support("table")){if(is_view($Of))$od["view"]='Alter view';else$od["create"]='Alter table';}if($P!==null)$od["edit"]='New item';foreach($od
                  as$z=>$X)echo" <a href='".h(ME)."$z=".urlencode($Of["Name"]).($z=="edit"?$P:"")."'".bold(isset($_GET[$z])).">$X</a>";echo"\n";}function
                  Severity: Minor
                  Found in include/adminer.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

                  TmpFile;ob_start(array($ig,'write'),1e5);}$b->dumpTable($F,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$Lg[]=$F;elseif($ob){$m=fields($F);$b->dumpData($F,$_POST["data_style"],"SELECT *".convert_fields($m,$m)." FROM ".table($F));}if($Wc&&$_POST["triggers"]&&$Q&&($qg=trigger_sql($F,$_POST["table_style"])))echo"\nDELIMITER ;;\n$qg\nDELIMITER ;\n";if($gc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$i/")."$F.csv",$ig);}elseif($Wc)echo"\n";}}foreach($Lg
                  Severity: Major
                  Found in include/adminer.php - About 45 mins to fix

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

                    array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU','',$e->result("SHOW CREATE VIEW ".table($F),1)));}function
                    collations(){$K=array();foreach(get_rows("SHOW COLLATION")as$L){if($L["Default"])$K[$L["Charset"]][-1]=$L["Collation"];else$K[$L["Charset"]][]=$L["Collation"];}ksort($K);foreach($K
                    as$z=>$X)asort($K[$z]);return$K;}function
                    Severity: Minor
                    Found in include/adminer.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

                    TmpFile;ob_start(array($ig,'write'),1e5);}$b->dumpTable($F,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$Lg[]=$F;elseif($ob){$m=fields($F);$b->dumpData($F,$_POST["data_style"],"SELECT *".convert_fields($m,$m)." FROM ".table($F));}if($Wc&&$_POST["triggers"]&&$Q&&($qg=trigger_sql($F,$_POST["table_style"])))echo"\nDELIMITER ;;\n$qg\nDELIMITER ;\n";if($gc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$i/")."$F.csv",$ig);}elseif($Wc)echo"\n";}}foreach($Lg
                    Severity: Major
                    Found in include/adminer.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                      TmpFile;ob_start(array($ig,'write'),1e5);}$b->dumpTable($F,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$Lg[]=$F;elseif($ob){$m=fields($F);$b->dumpData($F,$_POST["data_style"],"SELECT *".convert_fields($m,$m)." FROM ".table($F));}if($Wc&&$_POST["triggers"]&&$Q&&($qg=trigger_sql($F,$_POST["table_style"])))echo"\nDELIMITER ;;\n$qg\nDELIMITER ;\n";if($gc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$i/")."$F.csv",$ig);}elseif($Wc)echo"\n";}}foreach($Lg
                      Severity: Major
                      Found in include/adminer.php - About 45 mins to fix

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

                        as$z=>$X){$X=$_GET["columns"][$z];$c=select_input(" name='columns[$t][col]' onchange='".($z!==""?"selectFieldChange(this.form)":"selectAddRow(this)").";'",$d,$X["col"]);echo"<div>".($xc||$_c?"<select name='columns[$t][fun]' onchange='helpClose();".($z!==""?"":" this.nextSibling.nextSibling.onchange();")."'".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).">".optionlist(array(-1=>"")+array_filter(array('Functions'=>$xc,'Aggregation'=>$_c)),$X["fun"])."</select>"."($c)":$c)."</div>\n";$t++;}echo"</div></fieldset>\n";}function
                        selectSearchPrint($Z,$d,$w){print_fieldset("search",'Search',$Z);foreach($w
                        as$t=>$v){if($v["type"]=="FULLTEXT"){echo"(<i>".implode("</i>, <i>",array_map('h',$v["columns"]))."</i>) AGAINST"," <input type='search' name='fulltext[$t]' value='".h($_GET["fulltext"][$t])."' onchange='selectFieldChange(this.form);'>",checkbox("boolean[$t]",1,isset($_GET["boolean"][$t]),"BOOL"),"<br>\n";}}$_GET["where"]=(array)$_GET["where"];reset($_GET["where"]);$Ka="this.nextSibling.onchange();";for($t=0;$t<=count($_GET["where"]);$t++){list(,$X)=each($_GET["where"]);if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div>".select_input(" name='where[$t][col]' onchange='$Ka'",$d,$X["col"],"(".'anywhere'.")"),html_select("where[$t][op]",$this->operators,$X["op"],$Ka),"<input type='search' name='where[$t][val]' value='".h($X["val"])."' onchange='".($X?"selectFieldChange(this.form)":"selectAddRow(this)").";' onkeydown='selectSearchKeydown(this, event);' onsearch='selectSearchSearch(this);'></div>\n";}}echo"</div></fieldset>\n";}function
                        Severity: Minor
                        Found in include/adminer.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

                        select($J,$f=null,$ge=array(),$_=0){global$y;$od=array();$w=array();$d=array();$Fa=array();$tg=array();$K=array();odd('');for($t=0;(!$_||$t<$_)&&($L=$J->fetch_row());$t++){if(!$t){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($x=0;$x<count($L);$x++){$l=$J->fetch_field();$F=$l->name;$fe=$l->orgtable;$ee=$l->orgname;$K[$l->table]=$fe;if($ge&&$y=="sql")$od[$x]=($F=="table"?"table=":($F=="possible_keys"?"indexes=":null));elseif($fe!=""){if(!isset($w[$fe])){$w[$fe]=array();foreach(indexes($fe,$f)as$v){if($v["type"]=="PRIMARY"){$w[$fe]=array_flip($v["columns"]);break;}}$d[$fe]=$w[$fe];}if(isset($d[$fe][$ee])){unset($d[$fe][$ee]);$w[$fe][$ee]=$x;$od[$x]=$fe;}}if($l->charsetnr==63)$Fa[$x]=true;$tg[$x]=$l->type;echo"<th".($fe!=""||$l->name!=$ee?" title='".h(($fe!=""?"$fe.":"").$ee)."'":"").">".h($F).($ge?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($F))):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($L
                        Severity: Major
                        Found in include/adminer.php - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language