XoopsModules25x/adminer

View on GitHub

Showing 307 of 307 total issues

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

preg_match('~char|text|lob|geometry|point|linestring|polygon|string~',$l["type"]);}function
count_rows($R,$Y,$u,$p){global$v;$I=" FROM ".table($R).($Y?" WHERE ".implode(" AND ",$Y):"");return($u&&($v=="sql"||count($p)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$p).")$I":"SELECT COUNT(*)".($u?" FROM (SELECT 1$I$Ub) x":$I));}function
Severity: Major
Found in include/editor.php and 1 other location - About 2 hrs to fix
include/adminer.php on lines 138..139

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

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

get_vals($I,$c=0){global$e;$K=array();$J=$e->query($I);if(is_object($J)){while($L=$J->fetch_row())$K[]=$L[$c];}return$K;}function
get_key_vals($I,$f=null,$cg=0){global$e;if(!is_object($f))$f=$e;$K=array();$f->timeout=$cg;$J=$f->query($I);$f->timeout=0;if(is_object($J)){while($L=$J->fetch_row())$K[$L[0]]=$L[1];}return$K;}function
Severity: Major
Found in include/adminer.php and 1 other location - About 2 hrs to fix
include/editor.php on lines 51..52

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

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){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
unset_permanent(){global$gd;foreach($gd
as$x=>$V){list($X,$O,$T,$h)=array_map('base64_decode',explode("-",$x));if($X==DRIVER&&$O==SERVER&&$T==$_GET["username"]&&$h==DB)unset($gd[$x]);}cookie("adminer_permanent",implode(" ",$gd));}function
Severity: Major
Found in include/editor.php and 1 other location - About 2 hrs to fix
include/adminer.php on lines 518..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 131.

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

get_vals($I,$d=0){global$f;$K=array();$J=$f->query($I);if(is_object($J)){while($L=$J->fetch_row())$K[]=$L[$d];}return$K;}function
get_key_vals($I,$g=null,$ke=0){global$f;if(!is_object($g))$g=$f;$K=array();$g->timeout=$ke;$J=$g->query($I);$g->timeout=0;if(is_object($J)){while($L=$J->fetch_row())$K[$L[0]]=$L[1];}return$K;}function
Severity: Major
Found in include/editor.php and 1 other location - About 2 hrs to fix
include/adminer.php on lines 51..52

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

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$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
unset_permanent(){global$ze;foreach($ze
as$z=>$X){list($Jg,$O,$V,$i)=array_map('base64_decode',explode("-",$z));if($Jg==DRIVER&&$O==SERVER&&$V==$_GET["username"]&&$i==DB)unset($ze[$z]);}cookie("adminer_permanent",implode(" ",$ze));}function
Severity: Major
Found in include/adminer.php and 1 other location - About 2 hrs to fix
include/editor.php on lines 520..522

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

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

File plugin.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/** Adminer customization allowing usage of plugins
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, http://www.vrana.cz/
Severity: Minor
Found in include/plugins/plugin.php - About 2 hrs to fix

    Function editFunctions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    messageQuery($I,$bg){global$y;restart_session();$Ec=&get_session("queries");$u="sql-".count($Ec[$_GET["db"]]);if(strlen($I)>1e6)$I=preg_replace('~[\x80-\xFF]+$~','',substr($I,0,1e6))."\n...";$Ec[$_GET["db"]][]=array($I,time(),$bg);return" <span class='time'>".@date("H:i:s")."</span> <a href='#$u' onclick=\"return !toggle('$u');\">".'SQL command'."</a>"."<div id='$u' class='hidden'><pre><code class='jush-$y'>".shorten_utf8($I,1000).'</code></pre>'.($bg?" <span class='time'>($bg)</span>":'').(support("sql")?'<p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($Ec[$_GET["db"]])-1)).'">'.'Edit'.'</a>':'').'</div>';}function
    editFunctions($l){global$Lb;$K=($l["null"]?"NULL/":"");foreach($Lb
    as$z=>$xc){if(!$z||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($xc
    as$ye=>$X){if(!$ye||preg_match("~$ye~",$l["type"]))$K.="/$X";}if($z&&!preg_match('~set|blob|bytea|raw|file~',$l["type"]))$K.="/SQL";}}if($l["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$K='Auto Increment';return
    explode("/",$K);}function
    Severity: Minor
    Found in include/adminer.php - About 2 hrs 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 tablesPrint has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function tablesPrint($tables) { ?>
    
      <p class="jsonly"><input id="filter-field">
      <style>
        .select-text {
    Severity: Major
    Found in include/plugins/FasterTablesFilter.php - About 2 hrs to fix

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

      preg_replace('~[^a-z0-9_]~i','-',$V);}function
      hidden_fields($pd,$ic=array()){while(list($x,$V)=each($pd)){if(!in_array($x,$ic)){if(is_array($V)){foreach($V
      as$w=>$U)$pd[$x."[$w]"]=$U;}else
      echo'<input type="hidden" name="'.h($x).'" value="'.h($V).'">';}}}function
      Severity: Major
      Found in include/editor.php and 1 other location - About 2 hrs to fix
      include/adminer.php on lines 102..105

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

      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_replace('~[^a-z0-9_]~i','-',$X);}function
      hidden_fields($Me,$Kc=array()){while(list($z,$X)=each($Me)){if(!in_array($z,$Kc)){if(is_array($X)){foreach($X
      as$Zc=>$W)$Me[$z."[$Zc]"]=$W;}else
      echo'<input type="hidden" name="'.h($z).'" value="'.h($X).'">';}}}function
      Severity: Major
      Found in include/adminer.php and 1 other location - About 2 hrs to fix
      include/editor.php on lines 102..105

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

      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

      true;}function
      queries($I){global$f;static$sd=array();static$Td;if(!$Td)$Td=microtime(true);if($I===null)return
      array(implode("\n",$sd),format_time($Td));$sd[]=(preg_match('~;$~',$I)?"DELIMITER ;;\n$I;\nDELIMITER ":$I).";";return$f->query($I);}function
      Severity: Major
      Found in include/editor.php and 1 other location - About 2 hrs to fix
      include/adminer.php on lines 76..78

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

      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

      true;}function
      queries($I){global$e;static$Pe=array();static$Cf;if(!$Cf)$Cf=microtime(true);if($I===null)return
      array(implode("\n",$Pe),format_time($Cf));$Pe[]=(preg_match('~;$~',$I)?"DELIMITER ;;\n$I;\nDELIMITER ":$I).";";return$e->query($I);}function
      Severity: Major
      Found in include/adminer.php and 1 other location - About 2 hrs to fix
      include/editor.php on lines 76..78

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

      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

      false;$K=dirname($Fb);unlink($Fb);}}return$K;}function
      password_file($Va){$Fb=get_temp_dir()."/adminer.key";$K=@file_get_contents($Fb);if($K||!$Va)return$K;$Rb=@fopen($Fb,"w");if($Rb){chmod($Fb,0660);$K=rand_string();fwrite($Rb,$K);fclose($Rb);}return$K;}function
      Severity: Major
      Found in include/editor.php and 1 other location - About 2 hrs to fix
      include/adminer.php on lines 128..129

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

      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

      is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
      redirect($_,$B=null){if($B!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($_!==null?$_:$_SERVER["REQUEST_URI"]))][]=$B;}if($_!==null){if($_=="")$_=".";header("Location: $_");exit;}}function
      Severity: Major
      Found in include/editor.php and 1 other location - About 2 hrs to fix
      include/adminer.php on lines 72..73

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

      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

      is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
      redirect($B,$D=null){if($D!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($B!==null?$B:$_SERVER["REQUEST_URI"]))][]=$D;}if($B!==null){if($B=="")$B=".";header("Location: $B");exit;}}function
      Severity: Major
      Found in include/adminer.php and 1 other location - About 2 hrs to fix
      include/editor.php on lines 72..73

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

      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

      false;$K=dirname($nc);unlink($nc);}}return$K;}function
      password_file($g){$nc=get_temp_dir()."/adminer.key";$K=@file_get_contents($nc);if($K||!$g)return$K;$p=@fopen($nc,"w");if($p){chmod($nc,0660);$K=rand_string();fwrite($p,$K);fclose($p);}return$K;}function
      Severity: Major
      Found in include/adminer.php and 1 other location - About 2 hrs to fix
      include/editor.php on lines 128..129

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

      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

      Function selectEmailProcess has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      selectLengthProcess(){return"100";}function
      selectEmailProcess($Y,$Mb){if($_POST["email_append"])return
      true;if($_POST["email"]){$Jd=0;if($_POST["all"]||$_POST["check"]){$l=idf_escape($_POST["email_field"]);$Yd=$_POST["email_subject"];$B=$_POST["email_message"];preg_match_all('~\\{\\$([a-z0-9_]+)\\}~i',"$Yd.$B",$Bc);$M=get_rows("SELECT DISTINCT $l".($Bc[1]?", ".implode(", ",array_map('idf_escape',array_unique($Bc[1]))):"")." FROM ".table($_GET["select"])." WHERE $l IS NOT NULL AND $l != ''".($Y?" AND ".implode(" AND ",$Y):"").($_POST["all"]?"":" AND ((".implode(") OR (",array_map('where_check',(array)$_POST["check"]))."))"));$m=fields($_GET["select"]);foreach($this->rowDescriptions($M,$Mb)as$L){$_d=array('{\\'=>'{');foreach($Bc[1]as$V)$_d['{$'."$V}"]=$this->editVal($L[$V],$m[$V]);$pb=$L[$_POST["email_field"]];if(is_mail($pb)&&send_mail($pb,strtr($Yd,$_d),strtr($B,$_d),$_POST["email_from"],$_FILES["email_files"]))$Jd++;}}cookie("adminer_email",$_POST["email_from"]);redirect(remove_from_uri(),lang(array('%d e-mail has been sent.','%d e-mails have been sent.'),$Jd));}return
      false;}function
      Severity: Minor
      Found in include/editor.php - About 2 hrs 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 selectOrderProcess has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      selectSearchProcess($m,$t){$K=array();foreach((array)$_GET["where"]as$x=>$Y){$La=$Y["col"];$Uc=$Y["op"];$V=$Y["val"];if(($x<0?"":$La).$V!=""){$Ra=array();foreach(($La!=""?array($La=>$m[$La]):$m)as$D=>$l){if($La!=""||is_numeric($V)||!preg_match('~int|float|double|decimal~',$l["type"])){$D=idf_escape($D);if($La!=""&&$l["type"]=="enum")$Ra[]=(in_array(0,$V)?"$D IS NULL OR ":"")."$D IN (".implode(", ",array_map('intval',$V)).")";else{$ie=preg_match('~char|text|enum|set~',$l["type"]);$W=$this->processInput($l,(!$Uc&&$ie&&preg_match('~^[^%]+$~',$V)?"%$V%":$V));$Ra[]=$D.($W=="NULL"?" IS".($Uc==">="?" NOT":"")." $W":(in_array($Uc,$this->operators)||$Uc=="="?" $Uc $W":($ie?" LIKE $W":" IN (".str_replace(",","', '",$W).")")));if($x<0&&$V=="0")$Ra[]="$D IS NULL";}}}$K[]=($Ra?"(".implode(" OR ",$Ra).")":"0");}}return$K;}function
      selectOrderProcess($m,$t){$jc=$_GET["index_order"];if($jc!="")unset($_GET["order"][1]);if($_GET["order"])return
      array(idf_escape(reset($_GET["order"])).($_GET["desc"]?" DESC":""));foreach(($jc!=""?array($t[$jc]):$t)as$s){if($jc!=""||$s["type"]=="INDEX"){$Xb=array_filter($s["descs"]);$db=false;foreach($s["columns"]as$V){if(preg_match('~date|timestamp~',$m[$V]["type"])){$db=true;break;}}$K=array();foreach($s["columns"]as$x=>$V)$K[]=idf_escape($V).(($Xb?$s["descs"][$x]:$db)?" DESC":"");return$K;}}return
      array();}function
      Severity: Minor
      Found in include/editor.php - About 2 hrs 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 referencable_primary has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      as$z=>$X){if($X===null)$X="<i>NULL</i>";elseif($Fa[$z]&&!is_utf8($X))$X="<i>".lang(array('%d byte','%d bytes'),strlen($X))."</i>";elseif(!strlen($X))$X="&nbsp;";else{$X=h($X);if($tg[$z]==254)$X="<code>$X</code>";}if(isset($od[$z])&&!$d[$od[$z]]){if($ge&&$y=="sql"){$Q=$L[array_search("table=",$od)];$A=$od[$z].urlencode($ge[$Q]!=""?$ge[$Q]:$Q);}else{$A="edit=".urlencode($od[$z]);foreach($w[$od[$z]]as$Ua=>$x)$A.="&where".urlencode("[".bracket_escape($Ua)."]")."=".urlencode($L[$x]);}$X="<a href='".h(ME.$A)."'>$X</a>";}echo"<td>$X";}}echo($t?"</table>":"<p class='message'>".'No rows.')."\n";return$K;}function
      referencable_primary($rf){$K=array();foreach(table_status('',true)as$Pf=>$Q){if($Pf!=$rf&&fk_support($Q)){foreach(fields($Pf)as$l){if($l["primary"]){if($K[$Pf]){unset($K[$Pf]);break;}$K[$Pf]=$l;}}}}return$K;}function
      Severity: Minor
      Found in include/adminer.php - About 2 hrs 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

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

      is_utf8($V){return(preg_match('~~u',$V)&&!preg_match('~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~',$V));}function
      shorten_utf8($Q,$xc=80,$Zd=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{FFFF}]",$xc).")($)?)u",$Q,$A))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$xc).")($)?)",$Q,$A);return
      h($A[1]).$Zd.(isset($A[2])?"":"<i>...</i>");}function
      Severity: Major
      Found in include/editor.php and 1 other location - About 2 hrs to fix
      include/adminer.php on lines 96..98

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

      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