XoopsModules25x/adminer

View on GitHub

Showing 114 of 307 total issues

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

queries("ROLLBACK");}}$Eb=array("server"=>"MySQL")+$Eb;if(!defined("DRIVER")){$Ee=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
Min_DB
extends
MySQLi{var$extension="MySQLi";function
__construct(){parent::init();}function
Severity: Major
Found in include/adminer.php and 1 other location - About 1 mo to fix
include/editor.php on lines 201..352

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

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

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

queries("ROLLBACK");}}$jb=array("server"=>"MySQL")+$jb;if(!defined("DRIVER")){$kd=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
Min_DB
extends
MySQLi{var$extension="MySQLi";function
__construct(){parent::init();}function
Severity: Major
Found in include/editor.php and 1 other location - About 1 mo to fix
include/adminer.php on lines 201..352

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

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

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

as$x=>$V){if(!$Y)$L[$x]=null;$m[$x]=array("field"=>$x,"null"=>($x!=$i->primary),"auto_increment"=>($x==$i->primary));}}}edit_form($a,$m,$L,$De);}elseif(isset($_GET["select"])){$a=$_GET["select"];$S=table_status1($a);$t=indexes($a);$m=fields($a);$Ob=column_foreign_keys($a);$Qc="";if($S["Oid"]){$Qc=($v=="sqlite"?"rowid":"oid");$t[]=array("type"=>"PRIMARY","columns"=>array($Qc));}parse_str($_COOKIE["adminer_import"],$ia);$Dd=array();$e=array();$he=null;foreach($m
as$x=>$l){$D=$b->fieldName($l);if(isset($l["privileges"]["select"])&&$D!=""){$e[$x]=html_entity_decode(strip_tags($D),ENT_QUOTES);if(is_shortable($l))$he=$b->selectLengthProcess();}$Dd+=$l["privileges"];}list($N,$p)=$b->selectColumnsProcess($e,$t);$u=count($p)<count($N);$Y=$b->selectSearchProcess($m,$t);$E=$b->selectOrderProcess($m,$t);$y=$b->selectLimitProcess();$Sb=($N?implode(", ",$N):"*".($Qc?", $Qc":"")).convert_fields($e,$m,$N)."\nFROM ".table($a);$Ub=($p&&$u?"\nGROUP BY ".implode(", ",$p):"").($E?"\nORDER BY ".implode(", ",$E):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$_e=>$L){$oa=convert_field($m[key($L)]);$N=array($oa?$oa:idf_escape(key($L)));$Y[]=where_check($_e,$m);$K=$i->select($a,$N,$Y,$N);if($K)echo
reset($K->fetch_row());}exit;}if($_POST&&!$k){$Me=$Y;if(!$_POST["all"]&&is_array($_POST["check"])){$Ga=array();foreach($_POST["check"]as$Ea)$Ga[]=where_check($Ea,$m);$Me[]="((".implode(") OR (",$Ga)."))";}$Me=($Me?"\nWHERE ".implode(" AND ",$Me):"");$md=$Be=null;foreach($t
as$s){if($s["type"]=="PRIMARY"){$md=array_flip($s["columns"]);$Be=($N?$md:array());break;}}foreach((array)$Be
as$x=>$V){if(in_array(idf_escape($x),$N))unset($Be[$x]);}if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");if(!is_array($_POST["check"])||$Be===array())$I="SELECT $Sb$Me$Ub";else{$ye=array();foreach($_POST["check"]as$V)$ye[]="(SELECT".limit($Sb,"\nWHERE ".($Y?implode(" AND ",$Y)." AND ":"").where_check($V,$m).$Ub,1).")";$I=implode(" UNION ALL ",$ye);}$b->dumpData($a,"table",$I);exit;}if(!$b->selectEmailProcess($Y,$Ob)){if($_POST["save"]||$_POST["delete"]){$J=true;$ja=0;$P=array();if(!$_POST["delete"]){foreach($e
Severity: Major
Found in include/editor.php and 1 other location - About 1 mo to fix
include/adminer.php on lines 788..811

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

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

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

';}elseif(isset($_GET["select"])){$a=$_GET["select"];$R=table_status1($a);$w=indexes($a);$m=fields($a);$o=column_foreign_keys($a);$Pd="";if($R["Oid"]){$Pd=($y=="sqlite"?"rowid":"oid");$w[]=array("type"=>"PRIMARY","columns"=>array($Pd));}parse_str($_COOKIE["adminer_import"],$ma);$gf=array();$d=array();$ag=null;foreach($m
as$z=>$l){$F=$b->fieldName($l);if(isset($l["privileges"]["select"])&&$F!=""){$d[$z]=html_entity_decode(strip_tags($F),ENT_QUOTES);if(is_shortable($l))$ag=$b->selectLengthProcess();}$gf+=$l["privileges"];}list($N,$s)=$b->selectColumnsProcess($d,$w);$Vc=count($s)<count($N);$Z=$b->selectSearchProcess($m,$w);$de=$b->selectOrderProcess($m,$w);$_=$b->selectLimitProcess();$wc=($N?implode(", ",$N):"*".($Pd?", $Pd":"")).convert_fields($d,$m,$N)."\nFROM ".table($a);$zc=($s&&$Vc?"\nGROUP BY ".implode(", ",$s):"").($de?"\nORDER BY ".implode(", ",$de):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$xg=>$L){$ua=convert_field($m[key($L)]);$N=array($ua?$ua:idf_escape(key($L)));$Z[]=where_check($xg,$m);$K=$j->select($a,$N,$Z,$N);if($K)echo
reset($K->fetch_row());}exit;}if($_POST&&!$k){$Pg=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$Oa=array();foreach($_POST["check"]as$Ma)$Oa[]=where_check($Ma,$m);$Pg[]="((".implode(") OR (",$Oa)."))";}$Pg=($Pg?"\nWHERE ".implode(" AND ",$Pg):"");$He=$zg=null;foreach($w
as$v){if($v["type"]=="PRIMARY"){$He=array_flip($v["columns"]);$zg=($N?$He:array());break;}}foreach((array)$zg
as$z=>$X){if(in_array(idf_escape($z),$N))unset($zg[$z]);}if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");if(!is_array($_POST["check"])||$zg===array())$I="SELECT $wc$Pg$zc";else{$vg=array();foreach($_POST["check"]as$X)$vg[]="(SELECT".limit($wc,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$m).$zc,1).")";$I=implode(" UNION ALL ",$vg);}$b->dumpData($a,"table",$I);exit;}if(!$b->selectEmailProcess($Z,$o)){if($_POST["save"]||$_POST["delete"]){$J=true;$na=0;$P=array();if(!$_POST["delete"]){foreach($d
Severity: Major
Found in include/adminer.php and 1 other location - About 1 mo to fix
include/editor.php on lines 533..556

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

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

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

enum_input($U,$wa,$l,$Y,$Sb=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$l["length"],$rd);$K=($Sb!==null?"<label><input type='$U'$wa value='$Sb'".((is_array($Y)?in_array($Sb,$Y):$Y===0)?" checked":"")."><i>".'empty'."</i></label>":"");foreach($rd[1]as$t=>$X){$X=stripcslashes(str_replace("''","'",$X));$Na=(is_int($Y)?$Y==$t+1:(is_array($Y)?in_array($t+1,$Y):$Y===$X));$K.=" <label><input type='$U'$wa value='".($t+1)."'".($Na?' checked':'').'>'.h($b->editVal($X,$l)).'</label>';}return$K;}function
input($l,$Y,$q){global$e,$tg,$b,$y;$F=h(bracket_escape($l["field"]));echo"<td class='function'>";if(is_array($Y)&&!$q){$ta=array($Y);if(version_compare(PHP_VERSION,5.4)>=0)$ta[]=JSON_PRETTY_PRINT;$Y=call_user_func_array('json_encode',$ta);$q="json";}$cf=($y=="mssql"&&$l["auto_increment"]);if($cf&&!$_POST["save"])$q=null;$xc=(isset($_GET["select"])||$cf?array("orig"=>'original'):array())+$b->editFunctions($l);$wa=" name='fields[$F]'";if($l["type"]=="enum")echo
nbsp($xc[""])."<td>".$b->editInput($_GET["edit"],$l,$wa,$Y);else{$pc=0;foreach($xc
as$z=>$X){if($z===""||!$X)break;$pc++;}$Wd=($pc?" onchange=\"var f = this.form['function[".h(js_escape(bracket_escape($l["field"])))."]']; if ($pc > f.selectedIndex) f.selectedIndex = $pc;\" onkeyup='keyupChange.call(this);'":"");$wa.=$Wd;$Cc=(in_array($q,$xc)||isset($xc[$q]));echo(count($xc)>1?"<select name='function[$F]' onchange='functionChange(this);'".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).">".optionlist($xc,$q===null||$Cc?$q:"")."</select>":nbsp(reset($xc))).'<td>';$Pc=$b->editInput($_GET["edit"],$l,$wa,$Y);if($Pc!="")echo$Pc;elseif($l["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$l["length"],$rd);foreach($rd[1]as$t=>$X){$X=stripcslashes(str_replace("''","'",$X));$Na=(is_int($Y)?($Y>>$t)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$F][$t]' value='".(1<<$t)."'".($Na?' checked':'')."$Wd>".h($b->editVal($X,$l)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$l["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$F'$Wd>";elseif(($Zf=preg_match('~text|lob~',$l["type"]))||preg_match("~\n~",$Y)){if($Zf&&$y!="sqlite")$wa.=" cols='50' rows='12'";else{$M=min(12,substr_count($Y,"\n")+1);$wa.=" cols='30' rows='$M'".($M==1?" style='height: 1.2em;'":"");}echo"<textarea$wa>".h($Y).'</textarea>';}elseif($q=="json")echo"<textarea$wa cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$yd=(!preg_match('~int~',$l["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$l["length"],$C)?((preg_match("~binary~",$l["type"])?2:1)*$C[1]+($C[3]?1:0)+($C[2]&&!$l["unsigned"]?1:0)):($tg[$l["type"]]?$tg[$l["type"]]+($l["unsigned"]?0:1):0));if($y=='sql'&&$e->server_info>=5.6&&preg_match('~time~',$l["type"]))$yd+=7;echo"<input".((!$Cc||$q==="")&&preg_match('~(?<!o)int~',$l["type"])?" type='number'":"")." value='".h($Y)."'".($yd?" maxlength='$yd'":"").(preg_match('~char|binary~',$l["type"])&&$yd>20?" size='40'":"")."$wa>";}}}function
Severity: Major
Found in include/adminer.php and 1 other location - About 1 wk to fix
include/editor.php on lines 109..112

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

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

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

enum_input($ue,$c,$l,$W,$sb=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$l["length"],$Bc);$K=($sb!==null?"<label><input type='$ue'$c value='$sb'".((is_array($W)?in_array($sb,$W):$W===0)?" checked":"")."><i>".'empty'."</i></label>":"");foreach($Bc[1]as$q=>$V){$V=stripcslashes(str_replace("''","'",$V));$Fa=(is_int($W)?$W==$q+1:(is_array($W)?in_array($q+1,$W):$W===$V));$K.=" <label><input type='$ue'$c value='".($q+1)."'".($Fa?' checked':'').'>'.h($b->editVal($V,$l)).'</label>';}return$K;}function
input($l,$W,$o){global$f,$we,$b,$v;$D=h(bracket_escape($l["field"]));echo"<td class='function'>";if(is_array($W)&&!$o){$na=array($W);if(version_compare(PHP_VERSION,5.4)>=0)$na[]=JSON_PRETTY_PRINT;$W=call_user_func_array('json_encode',$na);$o="json";}$Ad=($v=="mssql"&&$l["auto_increment"]);if($Ad&&!$_POST["save"])$o=null;$Tb=(isset($_GET["select"])||$Ad?array("orig"=>'original'):array())+$b->editFunctions($l);$c=" name='fields[$D]'";if($l["type"]=="enum")echo
nbsp($Tb[""])."<td>".$b->editInput($_GET["edit"],$l,$c,$W);else{$Ib=0;foreach($Tb
as$x=>$V){if($x===""||!$V)break;$Ib++;}$Sc=($Ib?" onchange=\"var f = this.form['function[".h(js_escape(bracket_escape($l["field"])))."]']; if ($Ib > f.selectedIndex) f.selectedIndex = $Ib;\" onkeyup='keyupChange.call(this);'":"");$c.=$Sc;$Yb=(in_array($o,$Tb)||isset($Tb[$o]));echo(count($Tb)>1?"<select name='function[$D]' onchange='functionChange(this);'".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).">".optionlist($Tb,$o===null||$Yb?$o:"")."</select>":nbsp(reset($Tb))).'<td>';$mc=$b->editInput($_GET["edit"],$l,$c,$W);if($mc!="")echo$mc;elseif($l["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$l["length"],$Bc);foreach($Bc[1]as$q=>$V){$V=stripcslashes(str_replace("''","'",$V));$Fa=(is_int($W)?($W>>$q)&1:in_array($V,explode(",",$W),true));echo" <label><input type='checkbox' name='fields[$D][$q]' value='".(1<<$q)."'".($Fa?' checked':'')."$Sc>".h($b->editVal($V,$l)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$l["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$D'$Sc>";elseif(($ge=preg_match('~text|lob~',$l["type"]))||preg_match("~\n~",$W)){if($ge&&$v!="sqlite")$c.=" cols='50' rows='12'";else{$M=min(12,substr_count($W,"\n")+1);$c.=" cols='30' rows='$M'".($M==1?" style='height: 1.2em;'":"");}echo"<textarea$c>".h($W).'</textarea>';}elseif($o=="json")echo"<textarea$c cols='50' rows='12' class='jush-js'>".h($W).'</textarea>';else{$Gc=(!preg_match('~int~',$l["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$l["length"],$A)?((preg_match("~binary~",$l["type"])?2:1)*$A[1]+($A[3]?1:0)+($A[2]&&!$l["unsigned"]?1:0)):($we[$l["type"]]?$we[$l["type"]]+($l["unsigned"]?0:1):0));if($v=='sql'&&$f->server_info>=5.6&&preg_match('~time~',$l["type"]))$Gc+=7;echo"<input".((!$Yb||$o==="")&&preg_match('~(?<!o)int~',$l["type"])?" type='number'":"")." value='".h($W)."'".($Gc?" maxlength='$Gc'":"").(preg_match('~char|binary~',$l["type"])&&$Gc>20?" size='40'":"")."$c>";}}}function
Severity: Major
Found in include/editor.php and 1 other location - About 1 wk to fix
include/adminer.php on lines 109..112

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

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

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

preg_match("~bool|(tinyint|bit)\\(1\\)~",$l["full_type"]);}$f->select_db($b->database());$Rc="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";$jb[DRIVER]='Login';if(isset($_GET["select"])&&($_POST["edit"]||$_POST["clone"])&&!$_POST["save"])$_GET["edit"]=$_GET["select"];if(isset($_GET["download"])){$a=$_GET["download"];$m=fields($a);header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));$N=array(idf_escape($_GET["field"]));$J=$i->select($a,$N,array(where($_GET,$m)),$N);$L=($J?$J->fetch_row():array());echo$L[0];exit;}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$m=fields($a);$Y=(isset($_GET["select"])?(count($_POST["check"])==1?where_check($_POST["check"][0],$m):""):where($_GET,$m));$De=(isset($_GET["select"])?$_POST["edit"]:$Y);foreach($m
as$D=>$l){if(!isset($l["privileges"][$De?"update":"insert"])||$b->fieldName($l)=="")unset($m[$D]);}if($_POST&&!$k&&!isset($_GET["select"])){$_=$_POST["referer"];if($_POST["insert"])$_=($De?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$_))$_=ME."select=".urlencode($a);$t=indexes($a);$ze=unique_array($_GET["where"],$t);$ud="\nWHERE $Y";if(isset($_POST["delete"]))queries_redirect($_,'Item has been deleted.',$i->delete($a,$ud,!$ze));else{$P=array();foreach($m
as$D=>$l){$V=process_input($l);if($V!==false&&$V!==null)$P[idf_escape($D)]=$V;}if($De){if(!$P)redirect($_);queries_redirect($_,'Item has been updated.',$i->update($a,$P,$ud,!$ze));if(is_ajax()){page_headers();page_messages($k);exit;}}else{$J=$i->insert($a,$P);$vc=($J?last_id():0);queries_redirect($_,sprintf('Item%s has been inserted.',($vc?" $vc":"")),$J);}}}$L=null;if($_POST["save"])$L=(array)$_POST["fields"];elseif($Y){$N=array();foreach($m
as$D=>$l){if(isset($l["privileges"]["select"])){$oa=convert_field($l);if($_POST["clone"]&&$l["auto_increment"])$oa="''";if($v=="sql"&&preg_match("~enum|set~",$l["type"]))$oa="1*".idf_escape($D);$N[]=($oa?"$oa AS ":"").idf_escape($D);}}$L=array();if(!support("table"))$N=array("*");if($N){$J=$i->select($a,$N,array($Y),$N,array(),(isset($_GET["select"])?2:1));$L=$J->fetch_assoc();if(!$L)$L=false;if(isset($_GET["select"])&&(!$L||$J->fetch_assoc()))$L=null;}}if(!support("table")&&!$m){if(!$Y){$J=$i->select($a,array("*"),$Y,array("*"));$L=($J?$J->fetch_assoc():false);if(!$L)$L=array($i->primary=>"");}if($L){foreach($L
as$x=>$V){if(!$Y)$L[$x]=null;$m[$x]=array("field"=>$x,"null"=>($x!=$i->primary),"auto_increment"=>($x==$i->primary));}}}edit_form($a,$m,$L,$De);}elseif(isset($_GET["select"])){$a=$_GET["select"];$S=table_status1($a);$t=indexes($a);$m=fields($a);$Ob=column_foreign_keys($a);$Qc="";if($S["Oid"]){$Qc=($v=="sqlite"?"rowid":"oid");$t[]=array("type"=>"PRIMARY","columns"=>array($Qc));}parse_str($_COOKIE["adminer_import"],$ia);$Dd=array();$e=array();$he=null;foreach($m
Severity: Major
Found in include/editor.php and 1 other location - About 6 days to fix
include/adminer.php on lines 640..644

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

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

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

';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$m=fields($a);$Z=(isset($_GET["select"])?(count($_POST["check"])==1?where_check($_POST["check"][0],$m):""):where($_GET,$m));$Ag=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($m
as$F=>$l){if(!isset($l["privileges"][$Ag?"update":"insert"])||$b->fieldName($l)=="")unset($m[$F]);}if($_POST&&!$k&&!isset($_GET["select"])){$B=$_POST["referer"];if($_POST["insert"])$B=($Ag?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$B))$B=ME."select=".urlencode($a);$w=indexes($a);$wg=unique_array($_GET["where"],$w);$Re="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($B,'Item has been deleted.',$j->delete($a,$Re,!$wg));else{$P=array();foreach($m
as$F=>$l){$X=process_input($l);if($X!==false&&$X!==null)$P[idf_escape($F)]=$X;}if($Ag){if(!$P)redirect($B);queries_redirect($B,'Item has been updated.',$j->update($a,$P,$Re,!$wg));if(is_ajax()){page_headers();page_messages($k);exit;}}else{$J=$j->insert($a,$P);$gd=($J?last_id():0);queries_redirect($B,sprintf('Item%s has been inserted.',($gd?" $gd":"")),$J);}}}$L=null;if($_POST["save"])$L=(array)$_POST["fields"];elseif($Z){$N=array();foreach($m
as$F=>$l){if(isset($l["privileges"]["select"])){$ua=convert_field($l);if($_POST["clone"]&&$l["auto_increment"])$ua="''";if($y=="sql"&&preg_match("~enum|set~",$l["type"]))$ua="1*".idf_escape($F);$N[]=($ua?"$ua AS ":"").idf_escape($F);}}$L=array();if(!support("table"))$N=array("*");if($N){$J=$j->select($a,$N,array($Z),$N,array(),(isset($_GET["select"])?2:1));$L=$J->fetch_assoc();if(!$L)$L=false;if(isset($_GET["select"])&&(!$L||$J->fetch_assoc()))$L=null;}}if(!support("table")&&!$m){if(!$Z){$J=$j->select($a,array("*"),$Z,array("*"));$L=($J?$J->fetch_assoc():false);if(!$L)$L=array($j->primary=>"");}if($L){foreach($L
as$z=>$X){if(!$Z)$L[$z]=null;$m[$z]=array("field"=>$z,"null"=>($z!=$j->primary),"auto_increment"=>($z==$j->primary));}}}edit_form($a,$m,$L,$Ag);}elseif(isset($_GET["create"])){$a=$_GET["create"];$re=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$z)$re[$z]=$z;$Xe=referencable_primary($a);$o=array();foreach($Xe
Severity: Major
Found in include/adminer.php and 1 other location - About 6 days to fix
include/editor.php on lines 529..533

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

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

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

Adminer);function
page_header($le,$k="",$Ca=array(),$me=""){global$ba,$ca,$b,$jb,$v;page_headers();if(is_ajax()&&$k){page_messages($k);exit;}$ne=$le.($me!=""?": $me":"");$oe=strip_tags($ne.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
Severity: Major
Found in include/editor.php and 1 other location - About 5 days to fix
include/adminer.php on lines 464..489

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

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

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

Adminer);if($b->operators===null)$b->operators=$Zd;function
page_header($eg,$k="",$Ha=array(),$fg=""){global$ca,$ga,$b,$Eb,$y;page_headers();if(is_ajax()&&$k){page_messages($k);exit;}$gg=$eg.($fg!=""?": $fg":"");$hg=strip_tags($gg.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
Severity: Major
Found in include/adminer.php and 1 other location - About 5 days to fix
include/editor.php on lines 466..491

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

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

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

on_help($Pa,$Pd=0){return" onmouseover='helpMouseover(this, event, ".h($Pa).", $Pd);' onmouseout='helpMouseout(this, event);'";}function
edit_form($a,$m,$L,$De){global$b,$v,$qe,$k;$de=$b->tableName(table_status1($a,true));page_header(($De?'Edit':'Insert'),$k,array("select"=>array($a,$de)),$de);if($L===false)echo"<p class='error'>".'No rows.'."\n";echo'<form action="" method="post" enctype="multipart/form-data" id="form">
';if(!$m)echo"<p class='error'>".'You have no privileges to update this table.'."\n";else{echo"<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";foreach($m
as$D=>$l){echo"<tr><th>".$b->fieldName($l);$cb=$_GET["set"][bracket_escape($D)];if($cb===null){$cb=$l["default"];if($l["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$cb,$yd))$cb=$yd[1];}$W=($L!==null?($L[$D]!=""&&$v=="sql"&&preg_match("~enum|set~",$l["type"])?(is_array($L[$D])?array_sum($L[$D]):+$L[$D]):$L[$D]):(!$De&&$l["auto_increment"]?"":(isset($_GET["select"])?false:$cb)));if(!$_POST["save"]&&is_string($W))$W=$b->editVal($W,$l);$o=($_POST["save"]?(string)$_POST["function"][$D]:($De&&$l["on_update"]=="CURRENT_TIMESTAMP"?"now":($W===false?null:($W!==null?'':'NULL'))));if(preg_match("~time~",$l["type"])&&$W=="CURRENT_TIMESTAMP"){$W="";$o="now";}input($l,$W,$o);echo"\n";}if(!support("table"))echo"<tr>"."<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''>"."<td class='function'>".html_select("field_funs[]",$b->editFunctions(array("null"=>isset($_GET["select"]))))."<td><input name='field_vals[]'>"."\n";echo"</table>\n";}echo"<p>\n";if($m){echo"<input type='submit' value='".'Save'."'>\n";if(!isset($_GET["select"]))echo"<input type='submit' name='insert' value='".($De?'Save and continue edit'."' onclick='return !ajaxForm(this.form, \"".'Saving'.'...", this)':'Save and insert next')."' title='Ctrl+Shift+Enter'>\n";}echo($De?"<input type='submit' name='delete' value='".'Delete'."'".confirm().">\n":($_POST||!$m?"":"<script type='text/javascript'>focus(document.getElementById('form').getElementsByTagName('td')[1].firstChild);</script>\n"));if(isset($_GET["select"]))hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo'<input type="hidden" name="referer" value="',h(isset($_POST["referer"])?$_POST["referer"]:$_SERVER["HTTP_REFERER"]),'">
<input type="hidden" name="save" value="1">
Severity: Major
Found in include/editor.php and 1 other location - About 4 days to fix
include/adminer.php on lines 152..159

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

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

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

on_help($Za,$xf=0){return" onmouseover='helpMouseover(this, event, ".h($Za).", $xf);' onmouseout='helpMouseout(this, event);'";}function
edit_form($a,$m,$L,$Ag){global$b,$y,$T,$k;$Pf=$b->tableName(table_status1($a,true));page_header(($Ag?'Edit':'Insert'),$k,array("select"=>array($a,$Pf)),$Pf);if($L===false)echo"<p class='error'>".'No rows.'."\n";echo'<form action="" method="post" enctype="multipart/form-data" id="form">
';if(!$m)echo"<p class='error'>".'You have no privileges to update this table.'."\n";else{echo"<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";foreach($m
as$F=>$l){echo"<tr><th>".$b->fieldName($l);$vb=$_GET["set"][bracket_escape($F)];if($vb===null){$vb=$l["default"];if($l["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$vb,$af))$vb=$af[1];}$Y=($L!==null?($L[$F]!=""&&$y=="sql"&&preg_match("~enum|set~",$l["type"])?(is_array($L[$F])?array_sum($L[$F]):+$L[$F]):$L[$F]):(!$Ag&&$l["auto_increment"]?"":(isset($_GET["select"])?false:$vb)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$l);$q=($_POST["save"]?(string)$_POST["function"][$F]:($Ag&&$l["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$l["type"])&&$Y=="CURRENT_TIMESTAMP"){$Y="";$q="now";}input($l,$Y,$q);echo"\n";}if(!support("table"))echo"<tr>"."<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''>"."<td class='function'>".html_select("field_funs[]",$b->editFunctions(array("null"=>isset($_GET["select"]))))."<td><input name='field_vals[]'>"."\n";echo"</table>\n";}echo"<p>\n";if($m){echo"<input type='submit' value='".'Save'."'>\n";if(!isset($_GET["select"]))echo"<input type='submit' name='insert' value='".($Ag?'Save and continue edit'."' onclick='return !ajaxForm(this.form, \"".'Saving'.'...", this)':'Save and insert next')."' title='Ctrl+Shift+Enter'>\n";}echo($Ag?"<input type='submit' name='delete' value='".'Delete'."'".confirm().">\n":($_POST||!$m?"":"<script type='text/javascript'>focus(document.getElementById('form').getElementsByTagName('td')[1].firstChild);</script>\n"));if(isset($_GET["select"]))hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo'<input type="hidden" name="referer" value="',h(isset($_POST["referer"])?$_POST["referer"]:$_SERVER["HTTP_REFERER"]),'">
<input type="hidden" name="save" value="1">
Severity: Major
Found in include/adminer.php and 1 other location - About 4 days to fix
include/editor.php on lines 152..159

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

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

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

as$Uc=>$X){if($X[0]<$bg)unset($Tc[$Uc]);}}$Sc=&$Tc[$b->bruteForceKey()];if(!$Sc)$Sc=array($bg+30*60,0);$Sc[1]++;$tf=serialize($Tc);rewind($p);fwrite($p,$tf);ftruncate($p,strlen($tf));flock($p,LOCK_UN);fclose($p);}$xa=$_POST["auth"];if($xa){$Tc=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$Sc=$Tc[$b->bruteForceKey()];$Kd=($Sc[1]>30?$Sc[0]-time():0);if($Kd>0)auth_error(lang(array('Too many unsuccessful logins, try again in %d minute.','Too many unsuccessful logins, try again in %d minutes.'),ceil($Kd/60)));session_regenerate_id();$Jg=$xa["driver"];$O=$xa["server"];$V=$xa["username"];$we=(string)$xa["password"];$i=$xa["db"];set_password($Jg,$O,$V,$we);$_SESSION["db"][$Jg][$O][$V][$i]=true;if($xa["permanent"]){$z=base64_encode($Jg)."-".base64_encode($O)."-".base64_encode($V)."-".base64_encode($i);$Je=$b->permanentLogin(true);$ze[$z]="$z:".base64_encode($Je?encrypt_string($we,$Je):"");cookie("adminer_permanent",implode(" ",$ze));}if(count($_POST)==1||DRIVER!=$Jg||SERVER!=$O||$_GET["username"]!==$V||DB!=$i)redirect(auth_url($Jg,$O,$V,$i));}elseif($_POST["logout"]){if($Dc&&!verify_token()){page_header('Logout','Invalid CSRF token. Send the form again.');page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$z)set_session($z,null);unset_permanent();redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1),'Logout successful.');}}elseif($ze&&!$_SESSION["pwds"]){session_regenerate_id();$Je=$b->permanentLogin();foreach($ze
as$z=>$X){list(,$Qa)=explode(":",$X);list($Jg,$O,$V,$i)=array_map('base64_decode',explode("-",$z));set_password($Jg,$O,$V,decrypt_string(base64_decode($Qa),$Je));$_SESSION["db"][$Jg][$O][$V][$i]=true;}}function
Severity: Major
Found in include/adminer.php and 1 other location - About 4 days to fix
include/editor.php on lines 519..520

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

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

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

as$pc=>$V){if($V[0]<$je)unset($oc[$pc]);}}$nc=&$oc[$b->bruteForceKey()];if(!$nc)$nc=array($je+30*60,0);$nc[1]++;$Ld=serialize($oc);rewind($Rb);fwrite($Rb,$Ld);ftruncate($Rb,strlen($Ld));flock($Rb,LOCK_UN);fclose($Rb);}$ra=$_POST["auth"];if($ra){$oc=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$nc=$oc[$b->bruteForceKey()];$Mc=($nc[1]>30?$nc[0]-time():0);if($Mc>0)auth_error(lang(array('Too many unsuccessful logins, try again in %d minute.','Too many unsuccessful logins, try again in %d minutes.'),ceil($Mc/60)));session_regenerate_id();$X=$ra["driver"];$O=$ra["server"];$T=$ra["username"];$G=(string)$ra["password"];$h=$ra["db"];set_password($X,$O,$T,$G);$_SESSION["db"][$X][$O][$T][$h]=true;if($ra["permanent"]){$x=base64_encode($X)."-".base64_encode($O)."-".base64_encode($T)."-".base64_encode($h);$od=$b->permanentLogin(true);$gd[$x]="$x:".base64_encode($od?encrypt_string($G,$od):"");cookie("adminer_permanent",implode(" ",$gd));}if(count($_POST)==1||DRIVER!=$X||SERVER!=$O||$_GET["username"]!==$T||DB!=$h)redirect(auth_url($X,$O,$T,$h));}elseif($_POST["logout"]){if($Zb&&!verify_token()){page_header('Logout','Invalid CSRF token. Send the form again.');page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$x)set_session($x,null);unset_permanent();redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1),'Logout successful.');}}elseif($gd&&!$_SESSION["pwds"]){session_regenerate_id();$od=$b->permanentLogin();foreach($gd
as$x=>$V){list(,$Ha)=explode(":",$V);list($X,$O,$T,$h)=array_map('base64_decode',explode("-",$x));set_password($X,$O,$T,decrypt_string(base64_decode($Ha),$od));$_SESSION["db"][$X][$O][$T][$h]=true;}}function
Severity: Major
Found in include/editor.php and 1 other location - About 4 days to fix
include/adminer.php on lines 517..518

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

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

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

fetch_field(){$L=(object)$this->getColumnMeta($this->_offset++);$L->orgtable=$L->table;$L->orgname=$L->name;$L->charsetnr=(in_array("blob",(array)$L->flags)?63:0);return$L;}}}$jb=array();class
Min_SQL{var$_conn;function
__construct($f){$this->_conn=$f;}function
select($R,$N,$Y,$p,$E=array(),$y=1,$F=0,$nd=false){global$b,$v;$u=(count($p)<count($N));$I=$b->selectQueryBuild($N,$Y,$p,$E,$y,$F);if(!$I)$I="SELECT".limit(($_GET["page"]!="last"&&+$y&&$p&&$u&&$v=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$N)."\nFROM ".table($R),($Y?"\nWHERE ".implode(" AND ",$Y):"").($p&&$u?"\nGROUP BY ".implode(", ",$p):"").($E?"\nORDER BY ".implode(", ",$E):""),($y!=""?+$y:null),($F?$y*$F:0),"\n");$Td=microtime(true);$K=$this->_conn->query($I);if($nd)echo$b->selectQuery($I,format_time($Td));return$K;}function
delete($R,$td,$y=0){$I="FROM ".table($R);return
Severity: Major
Found in include/editor.php and 1 other location - About 3 days to fix
include/adminer.php on lines 183..201

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

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

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

fetch_field(){$L=(object)$this->getColumnMeta($this->_offset++);$L->orgtable=$L->table;$L->orgname=$L->name;$L->charsetnr=(in_array("blob",(array)$L->flags)?63:0);return$L;}}}$Eb=array();class
Min_SQL{var$_conn;function
__construct($e){$this->_conn=$e;}function
select($Q,$N,$Z,$s,$de=array(),$_=1,$G=0,$Ie=false){global$b,$y;$Vc=(count($s)<count($N));$I=$b->selectQueryBuild($N,$Z,$s,$de,$_,$G);if(!$I)$I="SELECT".limit(($_GET["page"]!="last"&&+$_&&$s&&$Vc&&$y=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$N)."\nFROM ".table($Q),($Z?"\nWHERE ".implode(" AND ",$Z):"").($s&&$Vc?"\nGROUP BY ".implode(", ",$s):"").($de?"\nORDER BY ".implode(", ",$de):""),($_!=""?+$_:null),($G?$_*$G:0),"\n");$Cf=microtime(true);$K=$this->_conn->query($I);if($Ie)echo$b->selectQuery($I,format_time($Cf));return$K;}function
delete($Q,$Qe,$_=0){$I="FROM ".table($Q);return
Severity: Major
Found in include/adminer.php and 1 other location - About 3 days to fix
include/editor.php on lines 183..201

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

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

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

sprintf($ng,$Md);}if(extension_loaded('pdo')){class
Min_PDO
extends
PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
__construct(){global$b;$Be=array_search("SQL",$b->operators);if($Be!==false)unset($b->operators[$Be]);}function
Severity: Major
Found in include/adminer.php and 1 other location - About 2 days to fix
include/editor.php on lines 162..183

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

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

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

sprintf($se,$Oc);}if(extension_loaded('pdo')){class
Min_PDO
extends
PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
__construct(){global$b;$jd=array_search("SQL",$b->operators);if($jd!==false)unset($b->operators[$jd]);}function
Severity: Major
Found in include/editor.php and 1 other location - About 2 days to fix
include/adminer.php on lines 162..183

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

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

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

long2str($U,false);}function
decrypt_string($Vd,$x){if($Vd=="")return"";if(!$x)return
false;$x=array_values(unpack("V*",pack("H*",md5($x))));$U=str2long($Vd,false);$C=count($U)-1;$Z=$U[$C];$Oe=$U[0];$rd=floor(6+52/($C+1));$ae=int32($rd*0x9E3779B9);while($ae){$lb=$ae>>2&3;for($cd=$C;$cd>0;$cd--){$Z=$U[$cd-1];$Kc=xxtea_mx($Z,$Oe,$ae,$x[$cd&3^$lb]);$Oe=int32($U[$cd]-$Kc);$U[$cd]=$Oe;}$Z=$U[$C];$Kc=xxtea_mx($Z,$Oe,$ae,$x[$cd&3^$lb]);$Oe=int32($U[0]-$Kc);$U[0]=$Oe;$ae=int32($ae-0x9E3779B9);}return
long2str($U,true);}$f='';$Zb=$_SESSION["token"];if(!$Zb)$_SESSION["token"]=rand(1,1e6);$qe=get_token();$gd=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$V){list($x)=explode(":",$V);$gd[$x]=$V;}}function
Severity: Major
Found in include/editor.php and 1 other location - About 2 days to fix
include/adminer.php on lines 512..515

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

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

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

long2str($W,false);}function
decrypt_string($Ff,$z){if($Ff=="")return"";if(!$z)return
false;$z=array_values(unpack("V*",pack("H*",md5($z))));$W=str2long($Ff,false);$E=count($W)-1;$Sg=$W[$E];$Rg=$W[0];$H=floor(6+52/($E+1));$Lf=int32($H*0x9E3779B9);while($Lf){$Kb=$Lf>>2&3;for($ne=$E;$ne>0;$ne--){$Sg=$W[$ne-1];$Fd=xxtea_mx($Sg,$Rg,$Lf,$z[$ne&3^$Kb]);$Rg=int32($W[$ne]-$Fd);$W[$ne]=$Rg;}$Sg=$W[$E];$Fd=xxtea_mx($Sg,$Rg,$Lf,$z[$ne&3^$Kb]);$Rg=int32($W[0]-$Fd);$W[0]=$Rg;$Lf=int32($Lf-0x9E3779B9);}return
long2str($W,true);}$e='';$Dc=$_SESSION["token"];if(!$Dc)$_SESSION["token"]=rand(1,1e6);$T=get_token();$ze=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($z)=explode(":",$X);$ze[$z]=$X;}}function
Severity: Major
Found in include/adminer.php and 1 other location - About 2 days to fix
include/editor.php on lines 514..517

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

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

Severity
Category
Status
Source
Language