Code Duplication    Length = 26-26 lines in 2 locations

include/adminer.php 1 location

@@ 464-489 (lines=26) @@
461
';hidden_fields_get();$rb=" onmousedown='dbMouseDown(event, this);' onchange='dbChange(this);'";echo"<span title='".'database'."'>DB</span>: ".($h?"<select name='db'$rb>".optionlist(array(""=>"")+$h,DB)."</select>":'<input name="db" value="'.h(DB).'" autocapitalize="off">'),"<input type='submit' value='".'Use'."'".($h?" class='hidden'":"").">\n";if($Dd!="db"&&DB!=""&&$e->select_db(DB)){}echo(isset($_GET["sql"])?'<input type="hidden" name="sql" value="">':(isset($_GET["schema"])?'<input type="hidden" name="schema" value="">':(isset($_GET["dump"])?'<input type="hidden" name="dump" value="">':(isset($_GET["privileges"])?'<input type="hidden" name="privileges" value="">':"")))),"</p></form>\n";}function
462
tablesPrint($S){echo"<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";foreach($S
463
as$Q=>$Df){echo'<a href="'.h(ME).'select='.urlencode($Q).'"'.bold($_GET["select"]==$Q||$_GET["edit"]==$Q,"select").">".'select'."</a> ";$F=$this->tableName($Df);echo(support("table")||support("indexes")?'<a href="'.h(ME).'table='.urlencode($Q).'"'.bold(in_array($Q,array($_GET["table"],$_GET["create"],$_GET["indexes"],$_GET["foreign"],$_GET["trigger"])),(is_view($Df)?"view":""),"structure")." title='".'Show structure'."'>$F</a>":"<span>$F</span>")."<br>\n";}}}$b=(function_exists('adminer_object')?adminer_object():new
464
Adminer);if($b->operators===null)$b->operators=$Zd;function
465
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>
466
<html lang="en" dir="ltr">
467
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
468
<meta http-equiv="Content-Script-Type" content="text/javascript">
469
<meta name="robots" content="noindex">
470
<meta name="referrer" content="origin-when-crossorigin">
471
<title>',$hg,'</title>
472
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME))."?file=default.css&amp;version=4.2.5&amp;driver=mysql",'">
473
<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=functions.js&amp;version=4.2.5&amp;driver=mysql",'"></script>
474
';if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&amp;version=4.2.5&amp;driver=mysql",'">
475
<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&amp;version=4.2.5&amp;driver=mysql",'">
476
';if(file_exists("adminer.css")){echo'<link rel="stylesheet" type="text/css" href="adminer.css">
477
';}}echo'
478
<body class="ltr nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);"',(isset($_COOKIE["adminer_version"])?"":" onload=\"verifyVersion('$ga');\"");?>>
479
<script type="text/javascript">
480
document.body.className = document.body.className.replace(/ nojs/, ' js');
481
var offlineMessage = '<?php echo
482
js_escape('You are offline.'),'\';
483
</script>
484
485
<div id="help" class="jush-',$y,' jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout(this, event);"></div>
486
487
<div id="content">
488
';if($Ha!==null){$A=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($A?$A:".").'">'.$Eb[DRIVER].'</a> &raquo; ';$A=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$O=(SERVER!=""?h(SERVER):'Server');if($Ha===false)echo"$O\n";else{echo"<a href='".($A?h($A):".")."' accesskey='1' title='Alt+Shift+1'>$O</a> &raquo; ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ha)))echo'<a href="'.h($A."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> &raquo; ';if(is_array($Ha)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> &raquo; ';foreach($Ha
489
as$z=>$X){$xb=(is_array($X)?$X[1]:h($X));if($xb!="")echo"<a href='".h(ME."$z=").urlencode(is_array($X)?$X[0]:$X)."'>$xb</a> &raquo; ";}}echo"$eg\n";}}echo"<h2>$gg</h2>\n","<div id='ajaxstatus' class='jsonly hidden'></div>\n";restart_session();page_messages($k);$h=&get_session("dbs");if(DB!=""&&$h&&!in_array(DB,$h,true))$h=null;stop_session();define("PAGE_HEADER",1);}function
490
page_headers(){global$b;header("Content-Type: text/html; charset=utf-8");header("Cache-Control: no-cache");if($b->headers()){header("X-Frame-Options: deny");header("X-XSS-Protection: 0");}}function
491
page_messages($k){$Bg=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Bd=$_SESSION["messages"][$Bg];if($Bd){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Bd)."</div>\n";unset($_SESSION["messages"][$Bg]);}if($k)echo"<div class='error'>$k</div>\n";}function
492
page_footer($Dd=""){global$b,$T;echo'</div>

include/editor.php 1 location

@@ 466-491 (lines=26) @@
463
_foreignColumn($Mb,$d){foreach((array)$Mb[$d]as$Lb){if(count($Lb["source"])==1){$D=$this->rowDescription($Lb["table"]);if($D!=""){$r=idf_escape($Lb["target"][0]);return
464
array($Lb["table"],$r,$D);}}}}function
465
_foreignKeyOptions($R,$d,$W=null){global$f;if(list($fe,$r,$D)=$this->_foreignColumn(column_foreign_keys($R),$d)){$K=&$this->_values[$fe];if($K===null){$S=table_status($fe);$K=($S["Rows"]>1000?"":array(""=>"")+get_key_vals("SELECT $r, $D FROM ".table($fe)." ORDER BY 2"));}if(!$K&&$W!==null)return$f->result("SELECT $D FROM ".table($fe)." WHERE $r = ".q($W));return$K;}}}$b=(function_exists('adminer_object')?adminer_object():new
466
Adminer);function
467
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>
468
<html lang="en" dir="ltr">
469
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
470
<meta http-equiv="Content-Script-Type" content="text/javascript">
471
<meta name="robots" content="noindex">
472
<meta name="referrer" content="origin-when-crossorigin">
473
<title>',$oe,'</title>
474
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME))."?file=default.css&amp;version=4.2.5&amp;driver=mysql",'">
475
<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=functions.js&amp;version=4.2.5&amp;driver=mysql",'"></script>
476
';if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&amp;version=4.2.5&amp;driver=mysql",'">
477
<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&amp;version=4.2.5&amp;driver=mysql",'">
478
';if(file_exists("adminer.css")){echo'<link rel="stylesheet" type="text/css" href="adminer.css">
479
';}}echo'
480
<body class="ltr nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);"',(isset($_COOKIE["adminer_version"])?"":" onload=\"verifyVersion('$ca');\"");?>>
481
<script type="text/javascript">
482
document.body.className = document.body.className.replace(/ nojs/, ' js');
483
var offlineMessage = '<?php echo
484
js_escape('You are offline.'),'\';
485
</script>
486
487
<div id="help" class="jush-',$v,' jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout(this, event);"></div>
488
489
<div id="content">
490
';if($Ca!==null){$z=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($z?$z:".").'">'.$jb[DRIVER].'</a> &raquo; ';$z=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$O=(SERVER!=""?h(SERVER):'Server');if($Ca===false)echo"$O\n";else{echo"<a href='".($z?h($z):".")."' accesskey='1' title='Alt+Shift+1'>$O</a> &raquo; ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ca)))echo'<a href="'.h($z."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> &raquo; ';if(is_array($Ca)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> &raquo; ';foreach($Ca
491
as$x=>$V){$db=(is_array($V)?$V[1]:h($V));if($db!="")echo"<a href='".h(ME."$x=").urlencode(is_array($V)?$V[0]:$V)."'>$db</a> &raquo; ";}}echo"$le\n";}}echo"<h2>$ne</h2>\n","<div id='ajaxstatus' class='jsonly hidden'></div>\n";restart_session();page_messages($k);$ab=&get_session("dbs");if(DB!=""&&$ab&&!in_array(DB,$ab,true))$ab=null;stop_session();define("PAGE_HEADER",1);}function
492
page_headers(){global$b;header("Content-Type: text/html; charset=utf-8");header("Cache-Control: no-cache");if($b->headers()){header("X-Frame-Options: deny");header("X-XSS-Protection: 0");}}function
493
page_messages($k){$Ee=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Hc=$_SESSION["messages"][$Ee];if($Hc){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Hc)."</div>\n";unset($_SESSION["messages"][$Ee]);}if($k)echo"<div class='error'>$k</div>\n";}function
494
page_footer($Ic=""){global$b,$qe;echo'</div>