Changeset 118333 in spip-zone


Ignore:
Timestamp:
Oct 29, 2019, 10:11:56 AM (5 months ago)
Author:
real3t@…
Message:

[Adminer] : Passage en 4.7.4 (avec l'habituel renommage de la fonction is_utf8 en isutf8 pour ne pas avoir de conflit avec la fonction de SPIP du même nom)

Location:
_plugins_/adminer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/adminer/adminer.php

    r116238 r118333  
    66* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
    77* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
    8 * @version 4.7.2
    9 */error_reporting(6135);$Vc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Vc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Hi=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Hi)$$X=$Hi;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");function
     8* @version 4.7.4
     9*/error_reporting(6135);$Wc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Wc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Ji=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Ji)$$X=$Ji;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");function
    1010connection(){global$h;return$h;}function
    1111adminer(){global$b;return$b;}function
    1212version(){global$ia;return$ia;}function
    13 idf_unescape($v){$oe=substr($v,-1);return
    14 str_replace($oe.$oe,$oe,substr($v,1,-1));}function
     13idf_unescape($v){$pe=substr($v,-1);return
     14str_replace($pe.$pe,$pe,substr($v,1,-1));}function
    1515escape_string($X){return
    1616substr(q($X),1,-1);}function
     
    1818preg_replace('~[^0-9]+~','',$X);}function
    1919number_type(){return'((?<!o)int(?!er)|numeric|real|float|double|decimal|money)';}function
    20 remove_slashes($qg,$Vc=false){if(get_magic_quotes_gpc()){while(list($z,$X)=each($qg)){foreach($X
    21 as$de=>$W){unset($qg[$z][$de]);if(is_array($W)){$qg[$z][stripslashes($de)]=$W;$qg[]=&$qg[$z][stripslashes($de)];}else$qg[$z][stripslashes($de)]=($Vc?$W:stripslashes($W));}}}}function
    22 bracket_escape($v,$Oa=false){static$ti=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return
    23 strtr($v,($Oa?array_flip($ti):$ti));}function
    24 min_version($Yi,$Ce="",$i=null){global$h;if(!$i)$i=$h;$lh=$i->server_info;if($Ce&&preg_match('~([\d.]+)-MariaDB~',$lh,$B)){$lh=$B[1];$Yi=$Ce;}return(version_compare($lh,$Yi)>=0);}function
     20remove_slashes($sg,$Wc=false){if(get_magic_quotes_gpc()){while(list($z,$X)=each($sg)){foreach($X
     21as$ee=>$W){unset($sg[$z][$ee]);if(is_array($W)){$sg[$z][stripslashes($ee)]=$W;$sg[]=&$sg[$z][stripslashes($ee)];}else$sg[$z][stripslashes($ee)]=($Wc?$W:stripslashes($W));}}}}function
     22bracket_escape($v,$Pa=false){static$vi=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return
     23strtr($v,($Pa?array_flip($vi):$vi));}function
     24min_version($bj,$De="",$i=null){global$h;if(!$i)$i=$h;$nh=$i->server_info;if($De&&preg_match('~([\d.]+)-MariaDB~',$nh,$B)){$nh=$B[1];$bj=$De;}return(version_compare($nh,$bj)>=0);}function
    2525charset($h){return(min_version("5.5.3",0,$h)?"utf8mb4":"utf8");}function
    26 script($wh,$si="\n"){return"<script".nonce().">$wh</script>$si";}function
    27 script_src($Mi){return"<script src='".h($Mi)."'".nonce()."></script>\n";}function
     26script($yh,$ui="\n"){return"<script".nonce().">$yh</script>$ui";}function
     27script_src($Oi){return"<script src='".h($Oi)."'".nonce()."></script>\n";}function
    2828nonce(){return' nonce="'.get_nonce().'"';}function
    2929target_blank(){return' target="_blank" rel="noreferrer noopener"';}function
     
    3232nl_br($P){return
    3333str_replace("\n","<br>",$P);}function
    34 checkbox($C,$Y,$fb,$ke="",$sf="",$kb="",$le=""){$I="<input type='checkbox' name='$C' value='".h($Y)."'".($fb?" checked":"").($le?" aria-labelledby='$le'":"").">".($sf?script("qsl('input').onclick = function () { $sf };",""):"");return($ke!=""||$kb?"<label".($kb?" class='$kb'":"").">$I".h($ke)."</label>":$I);}function
    35 optionlist($yf,$fh=null,$Qi=false){$I="";foreach($yf
    36 as$de=>$W){$zf=array($de=>$W);if(is_array($W)){$I.='<optgroup label="'.h($de).'">';$zf=$W;}foreach($zf
    37 as$z=>$X)$I.='<option'.($Qi||is_string($z)?' value="'.h($z).'"':'').(($Qi||is_string($z)?(string)$z:$X)===$fh?' selected':'').'>'.h($X);if(is_array($W))$I.='</optgroup>';}return$I;}function
    38 html_select($C,$yf,$Y="",$rf=true,$le=""){if($rf)return"<select name='".h($C)."'".($le?" aria-labelledby='$le'":"").">".optionlist($yf,$Y)."</select>".(is_string($rf)?script("qsl('select').onchange = function () { $rf };",""):"");$I="";foreach($yf
     34checkbox($C,$Y,$gb,$le="",$uf="",$lb="",$me=""){$I="<input type='checkbox' name='$C' value='".h($Y)."'".($gb?" checked":"").($me?" aria-labelledby='$me'":"").">".($uf?script("qsl('input').onclick = function () { $uf };",""):"");return($le!=""||$lb?"<label".($lb?" class='$lb'":"").">$I".h($le)."</label>":$I);}function
     35optionlist($_f,$hh=null,$Ti=false){$I="";foreach($_f
     36as$ee=>$W){$Af=array($ee=>$W);if(is_array($W)){$I.='<optgroup label="'.h($ee).'">';$Af=$W;}foreach($Af
     37as$z=>$X)$I.='<option'.($Ti||is_string($z)?' value="'.h($z).'"':'').(($Ti||is_string($z)?(string)$z:$X)===$hh?' selected':'').'>'.h($X);if(is_array($W))$I.='</optgroup>';}return$I;}function
     38html_select($C,$_f,$Y="",$tf=true,$me=""){if($tf)return"<select name='".h($C)."'".($me?" aria-labelledby='$me'":"").">".optionlist($_f,$Y)."</select>".(is_string($tf)?script("qsl('select').onchange = function () { $tf };",""):"");$I="";foreach($_f
    3939as$z=>$X)$I.="<label><input type='radio' name='".h($C)."' value='".h($z)."'".($z==$Y?" checked":"").">".h($X)."</label>";return$I;}function
    40 select_input($Ka,$yf,$Y="",$rf="",$cg=""){$Xh=($yf?"select":"input");return"<$Xh$Ka".($yf?"><option value=''>$cg".optionlist($yf,$Y,true)."</select>":" size='10' value='".h($Y)."' placeholder='$cg'>").($rf?script("qsl('$Xh').onchange = $rf;",""):"");}function
    41 confirm($Me="",$gh="qsl('input')"){return
    42 script("$gh.onclick = function () { return confirm('".($Me?js_escape($Me):lang(0))."'); };","");}function
    43 print_fieldset($u,$te,$bj=false){echo"<fieldset><legend>","<a href='#fieldset-$u'>$te</a>",script("qsl('a').onclick = partial(toggle, 'fieldset-$u');",""),"</legend>","<div id='fieldset-$u'".($bj?"":" class='hidden'").">\n";}function
    44 bold($Wa,$kb=""){return($Wa?" class='active $kb'":($kb?" class='$kb'":""));}function
     40select_input($Ka,$_f,$Y="",$tf="",$eg=""){$Zh=($_f?"select":"input");return"<$Zh$Ka".($_f?"><option value=''>$eg".optionlist($_f,$Y,true)."</select>":" size='10' value='".h($Y)."' placeholder='$eg'>").($tf?script("qsl('$Zh').onchange = $tf;",""):"");}function
     41confirm($Ne="",$ih="qsl('input')"){return
     42script("$ih.onclick = function () { return confirm('".($Ne?js_escape($Ne):lang(0))."'); };","");}function
     43print_fieldset($u,$ue,$ej=false){echo"<fieldset><legend>","<a href='#fieldset-$u'>$ue</a>",script("qsl('a').onclick = partial(toggle, 'fieldset-$u');",""),"</legend>","<div id='fieldset-$u'".($ej?"":" class='hidden'").">\n";}function
     44bold($Xa,$lb=""){return($Xa?" class='active $lb'":($lb?" class='$lb'":""));}function
    4545odd($I=' class="odd"'){static$t=0;if(!$I)$t=-1;return($t++%2?$I:'');}function
    4646js_escape($P){return
    4747addcslashes($P,"\r\n'\\/");}function
    48 json_row($z,$X=null){static$Wc=true;if($Wc)echo"{";if($z!=""){echo($Wc?"":",")."\n\t\"".addcslashes($z,"\r\n\t\"\\/").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\/").'"':'null');$Wc=false;}else{echo"\n}\n";$Wc=true;}}function
    49 ini_bool($Qd){$X=ini_get($Qd);return(preg_match('~^(on|true|yes)$~i',$X)||(int)$X);}function
     48json_row($z,$X=null){static$Xc=true;if($Xc)echo"{";if($z!=""){echo($Xc?"":",")."\n\t\"".addcslashes($z,"\r\n\t\"\\/").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\/").'"':'null');$Xc=false;}else{echo"\n}\n";$Xc=true;}}function
     49ini_bool($Rd){$X=ini_get($Rd);return(preg_match('~^(on|true|yes)$~i',$X)||(int)$X);}function
    5050sid(){static$I;if($I===null)$I=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));return$I;}function
    51 set_password($Xi,$N,$V,$F){$_SESSION["pwds"][$Xi][$N][$V]=($_COOKIE["adminer_key"]&&is_string($F)?array(encrypt_string($F,$_COOKIE["adminer_key"])):$F);}function
     51set_password($aj,$N,$V,$F){$_SESSION["pwds"][$aj][$N][$V]=($_COOKIE["adminer_key"]&&is_string($F)?array(encrypt_string($F,$_COOKIE["adminer_key"])):$F);}function
    5252get_password(){$I=get_session("pwds");if(is_array($I))$I=($_COOKIE["adminer_key"]?decrypt_string($I[0],$_COOKIE["adminer_key"]):false);return$I;}function
    5353q($P){global$h;return$h->quote($P);}function
    5454get_vals($G,$e=0){global$h;$I=array();$H=$h->query($G);if(is_object($H)){while($J=$H->fetch_row())$I[]=$J[$e];}return$I;}function
    55 get_key_vals($G,$i=null,$oh=true){global$h;if(!is_object($i))$i=$h;$I=array();$H=$i->query($G);if(is_object($H)){while($J=$H->fetch_row()){if($oh)$I[$J[0]]=$J[1];else$I[]=$J[0];}}return$I;}function
    56 get_rows($G,$i=null,$o="<p class='error'>"){global$h;$xb=(is_object($i)?$i:$h);$I=array();$H=$xb->query($G);if(is_object($H)){while($J=$H->fetch_assoc())$I[]=$J;}elseif(!$H&&!is_object($i)&&$o&&defined("PAGE_HEADER"))echo$o.error()."\n";return$I;}function
     55get_key_vals($G,$i=null,$qh=true){global$h;if(!is_object($i))$i=$h;$I=array();$H=$i->query($G);if(is_object($H)){while($J=$H->fetch_row()){if($qh)$I[$J[0]]=$J[1];else$I[]=$J[0];}}return$I;}function
     56get_rows($G,$i=null,$o="<p class='error'>"){global$h;$yb=(is_object($i)?$i:$h);$I=array();$H=$yb->query($G);if(is_object($H)){while($J=$H->fetch_assoc())$I[]=$J;}elseif(!$H&&!is_object($i)&&$o&&defined("PAGE_HEADER"))echo$o.error()."\n";return$I;}function
    5757unique_array($J,$x){foreach($x
    5858as$w){if(preg_match("~PRIMARY|UNIQUE~",$w["type"])){$I=array();foreach($w["columns"]as$z){if(!isset($J[$z]))continue
     
    6060escape_key($z){if(preg_match('(^([\w(]+)('.str_replace("_",".*",preg_quote(idf_escape("_"))).')([ \w)]+)$)',$z,$B))return$B[1].idf_escape(idf_unescape($B[2])).$B[3];return
    6161idf_escape($z);}function
    62 where($Z,$q=array()){global$h,$y;$I=array();foreach((array)$Z["where"]as$z=>$X){$z=bracket_escape($z,1);$e=escape_key($z);$I[]=$e.($y=="sql"&&preg_match('~^[0-9]*\.[0-9]*$~',$X)?" LIKE ".q(addcslashes($X,"%_\\")):($y=="mssql"?" LIKE ".q(preg_replace('~[_%[]~','[\0]',$X)):" = ".unconvert_field($q[$z],q($X))));if($y=="sql"&&preg_match('~char|text~',$q[$z]["type"])&&preg_match("~[^ -@]~",$X))$I[]="$e = ".q($X)." COLLATE ".charset($h)."_bin";}foreach((array)$Z["null"]as$z)$I[]=escape_key($z)." IS NULL";return
     62where($Z,$q=array()){global$h,$y;$I=array();foreach((array)$Z["where"]as$z=>$X){$z=bracket_escape($z,1);$e=escape_key($z);$I[]=$e.($y=="sql"&&is_numeric($X)&&preg_match('~\.~',$X)?" LIKE ".q($X):($y=="mssql"?" LIKE ".q(preg_replace('~[_%[]~','[\0]',$X)):" = ".unconvert_field($q[$z],q($X))));if($y=="sql"&&preg_match('~char|text~',$q[$z]["type"])&&preg_match("~[^ -@]~",$X))$I[]="$e = ".q($X)." COLLATE ".charset($h)."_bin";}foreach((array)$Z["null"]as$z)$I[]=escape_key($z)." IS NULL";return
    6363implode(" AND ",$I);}function
    64 where_check($X,$q=array()){parse_str($X,$db);remove_slashes(array(&$db));return
    65 where($db,$q);}function
    66 where_link($t,$e,$Y,$uf="="){return"&where%5B$t%5D%5Bcol%5D=".urlencode($e)."&where%5B$t%5D%5Bop%5D=".urlencode(($Y!==null?$uf:"IS NULL"))."&where%5B$t%5D%5Bval%5D=".urlencode($Y);}function
     64where_check($X,$q=array()){parse_str($X,$eb);remove_slashes(array(&$eb));return
     65where($eb,$q);}function
     66where_link($t,$e,$Y,$wf="="){return"&where%5B$t%5D%5Bcol%5D=".urlencode($e)."&where%5B$t%5D%5Bop%5D=".urlencode(($Y!==null?$wf:"IS NULL"))."&where%5B$t%5D%5Bval%5D=".urlencode($Y);}function
    6767convert_fields($f,$q,$L=array()){$I="";foreach($f
    6868as$z=>$X){if($L&&!in_array(idf_escape($z),$L))continue;$Ha=convert_field($q[$z]);if($Ha)$I.=", $Ha AS ".idf_escape($z);}return$I;}function
    69 cookie($C,$Y,$we=2592000){global$ba;return
    70 header("Set-Cookie: $C=".urlencode($Y).($we?"; expires=".gmdate("D, d M Y H:i:s",time()+$we)." GMT":"")."; path=".preg_replace('~\?.*~','',$_SERVER["REQUEST_URI"]).($ba?"; secure":"")."; HttpOnly; SameSite=lax",false);}function
     69cookie($C,$Y,$xe=2592000){global$ba;return
     70header("Set-Cookie: $C=".urlencode($Y).($xe?"; expires=".gmdate("D, d M Y H:i:s",time()+$xe)." GMT":"")."; path=".preg_replace('~\?.*~','',$_SERVER["REQUEST_URI"]).($ba?"; secure":"")."; HttpOnly; SameSite=lax",false);}function
    7171restart_session(){if(!ini_bool("session.use_cookies"))session_start();}function
    72 stop_session($bd=false){if(!ini_bool("session.use_cookies")||($bd&&@ini_set("session.use_cookies",false)!==false))session_write_close();}function&get_session($z){return$_SESSION[$z][DRIVER][SERVER][$_GET["username"]];}function
     72stop_session($cd=false){$Si=ini_bool("session.use_cookies");if(!$Si||$cd){session_write_close();if($Si&&@ini_set("session.use_cookies",false)===false)session_start();}}function&get_session($z){return$_SESSION[$z][DRIVER][SERVER][$_GET["username"]];}function
    7373set_session($z,$X){$_SESSION[$z][DRIVER][SERVER][$_GET["username"]]=$X;}function
    74 auth_url($Xi,$N,$V,$m=null){global$ec;preg_match('~([^?]*)\??(.*)~',remove_from_uri(implode("|",array_keys($ec))."|username|".($m!==null?"db|":"").session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($Xi!="server"||$N!=""?urlencode($Xi)."=".urlencode($N)."&":"")."username=".urlencode($V).($m!=""?"&db=".urlencode($m):"").($B[2]?"&$B[2]":"");}function
     74auth_url($aj,$N,$V,$m=null){global$fc;preg_match('~([^?]*)\??(.*)~',remove_from_uri(implode("|",array_keys($fc))."|username|".($m!==null?"db|":"").session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($aj!="server"||$N!=""?urlencode($aj)."=".urlencode($N)."&":"")."username=".urlencode($V).($m!=""?"&db=".urlencode($m):"").($B[2]?"&$B[2]":"");}function
    7575is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
    76 redirect($ye,$Me=null){if($Me!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($ye!==null?$ye:$_SERVER["REQUEST_URI"]))][]=$Me;}if($ye!==null){if($ye=="")$ye=".";header("Location: $ye");exit;}}function
    77 query_redirect($G,$ye,$Me,$Bg=true,$Cc=true,$Nc=false,$fi=""){global$h,$o,$b;if($Cc){$Dh=microtime(true);$Nc=!$h->query($G);$fi=format_time($Dh);}$zh="";if($G)$zh=$b->messageQuery($G,$fi,$Nc);if($Nc){$o=error().$zh.script("messagesPrint();");return
    78 false;}if($Bg)redirect($ye,$Me.$zh);return
     76redirect($ze,$Ne=null){if($Ne!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($ze!==null?$ze:$_SERVER["REQUEST_URI"]))][]=$Ne;}if($ze!==null){if($ze=="")$ze=".";header("Location: $ze");exit;}}function
     77query_redirect($G,$ze,$Ne,$Dg=true,$Dc=true,$Oc=false,$hi=""){global$h,$o,$b;if($Dc){$Fh=microtime(true);$Oc=!$h->query($G);$hi=format_time($Fh);}$Ah="";if($G)$Ah=$b->messageQuery($G,$hi,$Oc);if($Oc){$o=error().$Ah.script("messagesPrint();");return
     78false;}if($Dg)redirect($ze,$Ne.$Ah);return
    7979true;}function
    80 queries($G){global$h;static$vg=array();static$Dh;if(!$Dh)$Dh=microtime(true);if($G===null)return
    81 array(implode("\n",$vg),format_time($Dh));$vg[]=(preg_match('~;$~',$G)?"DELIMITER ;;\n$G;\nDELIMITER ":$G).";";return$h->query($G);}function
    82 apply_queries($G,$S,$zc='table'){foreach($S
    83 as$Q){if(!queries("$G ".$zc($Q)))return
     80queries($G){global$h;static$xg=array();static$Fh;if(!$Fh)$Fh=microtime(true);if($G===null)return
     81array(implode("\n",$xg),format_time($Fh));$xg[]=(preg_match('~;$~',$G)?"DELIMITER ;;\n$G;\nDELIMITER ":$G).";";return$h->query($G);}function
     82apply_queries($G,$S,$_c='table'){foreach($S
     83as$Q){if(!queries("$G ".$_c($Q)))return
    8484false;}return
    8585true;}function
    86 queries_redirect($ye,$Me,$Bg){list($vg,$fi)=queries(null);return
    87 query_redirect($vg,$ye,$Me,$Bg,false,!$Bg,$fi);}function
    88 format_time($Dh){return
    89 lang(1,max(0,microtime(true)-$Dh));}function
    90 remove_from_uri($Nf=""){return
    91 substr(preg_replace("~(?<=[?&])($Nf".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
    92 pagination($E,$Jb){return" ".($E==$Jb?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E".($_GET["next"]?"&next=".urlencode($_GET["next"]):""):"")).'">'.($E+1)."</a>");}function
    93 get_file($z,$Rb=false){$Tc=$_FILES[$z];if(!$Tc)return
    94 null;foreach($Tc
    95 as$z=>$X)$Tc[$z]=(array)$X;$I='';foreach($Tc["error"]as$z=>$o){if($o)return$o;$C=$Tc["name"][$z];$ni=$Tc["tmp_name"][$z];$_b=file_get_contents($Rb&&preg_match('~\.gz$~',$C)?"compress.zlib://$ni":$ni);if($Rb){$Dh=substr($_b,0,3);if(function_exists("iconv")&&preg_match("~^\xFE\xFF|^\xFF\xFE~",$Dh,$Hg))$_b=iconv("utf-16","utf-8",$_b);elseif($Dh=="\xEF\xBB\xBF")$_b=substr($_b,3);$I.=$_b."\n\n";}else$I.=$_b;}return$I;}function
    96 upload_error($o){$Je=($o==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($o?lang(2).($Je?" ".lang(3,$Je):""):lang(4));}function
    97 repeat_pattern($ag,$ue){return
    98 str_repeat("$ag{0,65535}",$ue/65535)."$ag{0,".($ue%65535)."}";}function
     86queries_redirect($ze,$Ne,$Dg){list($xg,$hi)=queries(null);return
     87query_redirect($xg,$ze,$Ne,$Dg,false,!$Dg,$hi);}function
     88format_time($Fh){return
     89lang(1,max(0,microtime(true)-$Fh));}function
     90remove_from_uri($Pf=""){return
     91substr(preg_replace("~(?<=[?&])($Pf".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
     92pagination($E,$Lb){return" ".($E==$Lb?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E".($_GET["next"]?"&next=".urlencode($_GET["next"]):""):"")).'">'.($E+1)."</a>");}function
     93get_file($z,$Tb=false){$Uc=$_FILES[$z];if(!$Uc)return
     94null;foreach($Uc
     95as$z=>$X)$Uc[$z]=(array)$X;$I='';foreach($Uc["error"]as$z=>$o){if($o)return$o;$C=$Uc["name"][$z];$pi=$Uc["tmp_name"][$z];$Ab=file_get_contents($Tb&&preg_match('~\.gz$~',$C)?"compress.zlib://$pi":$pi);if($Tb){$Fh=substr($Ab,0,3);if(function_exists("iconv")&&preg_match("~^\xFE\xFF|^\xFF\xFE~",$Fh,$Jg))$Ab=iconv("utf-16","utf-8",$Ab);elseif($Fh=="\xEF\xBB\xBF")$Ab=substr($Ab,3);$I.=$Ab."\n\n";}else$I.=$Ab;}return$I;}function
     96upload_error($o){$Ke=($o==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($o?lang(2).($Ke?" ".lang(3,$Ke):""):lang(4));}function
     97repeat_pattern($cg,$ve){return
     98str_repeat("$cg{0,65535}",$ve/65535)."$cg{0,".($ve%65535)."}";}function
    9999isutf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\0-\x8\xB\xC\xE-\x1F]~',$X));}function
    100 shorten_utf8($P,$ue=80,$Lh=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{10FFFF}]",$ue).")($)?)u",$P,$B))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$ue).")($)?)",$P,$B);return
    101 h($B[1]).$Lh.(isset($B[2])?"":"<i>…</i>");}function
     100shorten_utf8($P,$ve=80,$Nh=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{10FFFF}]",$ve).")($)?)u",$P,$B))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$ve).")($)?)",$P,$B);return
     101h($B[1]).$Nh.(isset($B[2])?"":"<i>…</i>");}function
    102102format_number($X){return
    103103strtr(number_format($X,0,".",lang(5)),preg_split('~~u',lang(6),-1,PREG_SPLIT_NO_EMPTY));}function
    104104friendly_url($X){return
    105105preg_replace('~[^a-z0-9_]~i','-',$X);}function
    106 hidden_fields($qg,$Fd=array()){$I=false;while(list($z,$X)=each($qg)){if(!in_array($z,$Fd)){if(is_array($X)){foreach($X
    107 as$de=>$W)$qg[$z."[$de]"]=$W;}else{$I=true;echo'<input type="hidden" name="'.h($z).'" value="'.h($X).'">';}}}return$I;}function
     106hidden_fields($sg,$Gd=array()){$I=false;while(list($z,$X)=each($sg)){if(!in_array($z,$Gd)){if(is_array($X)){foreach($X
     107as$ee=>$W)$sg[$z."[$ee]"]=$W;}else{$I=true;echo'<input type="hidden" name="'.h($z).'" value="'.h($X).'">';}}}return$I;}function
    108108hidden_fields_get(){echo(sid()?'<input type="hidden" name="'.session_name().'" value="'.h(session_id()).'">':''),(SERVER!==null?'<input type="hidden" name="'.DRIVER.'" value="'.h(SERVER).'">':""),'<input type="hidden" name="username" value="'.h($_GET["username"]).'">';}function
    109 table_status1($Q,$Oc=false){$I=table_status($Q,$Oc);return($I?$I:array("Name"=>$Q));}function
     109table_status1($Q,$Pc=false){$I=table_status($Q,$Pc);return($I?$I:array("Name"=>$Q));}function
    110110column_foreign_keys($Q){global$b;$I=array();foreach($b->foreignKeys($Q)as$r){foreach($r["source"]as$X)$I[$X][]=$r;}return$I;}function
    111 enum_input($T,$Ka,$p,$Y,$tc=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$p["length"],$Ee);$I=($tc!==null?"<label><input type='$T'$Ka value='$tc'".((is_array($Y)?in_array($tc,$Y):$Y===0)?" checked":"")."><i>".lang(7)."</i></label>":"");foreach($Ee[1]as$t=>$X){$X=stripcslashes(str_replace("''","'",$X));$fb=(is_int($Y)?$Y==$t+1:(is_array($Y)?in_array($t+1,$Y):$Y===$X));$I.=" <label><input type='$T'$Ka value='".($t+1)."'".($fb?' checked':'').'>'.h($b->editVal($X,$p)).'</label>';}return$I;}function
    112 input($p,$Y,$s){global$U,$b,$y;$C=h(bracket_escape($p["field"]));echo"<td class='function'>";if(is_array($Y)&&!$s){$Fa=array($Y);if(version_compare(PHP_VERSION,5.4)>=0)$Fa[]=JSON_PRETTY_PRINT;$Y=call_user_func_array('json_encode',$Fa);$s="json";}$Lg=($y=="mssql"&&$p["auto_increment"]);if($Lg&&!$_POST["save"])$s=null;$kd=(isset($_GET["select"])||$Lg?array("orig"=>lang(8)):array())+$b->editFunctions($p);$Ka=" name='fields[$C]'";if($p["type"]=="enum")echo
    113 h($kd[""])."<td>".$b->editInput($_GET["edit"],$p,$Ka,$Y);else{$ud=(in_array($s,$kd)||isset($kd[$s]));echo(count($kd)>1?"<select name='function[$C]'>".optionlist($kd,$s===null||$ud?$s:"")."</select>".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).script("qsl('select').onchange = functionChange;",""):h(reset($kd))).'<td>';$Sd=$b->editInput($_GET["edit"],$p,$Ka,$Y);if($Sd!="")echo$Sd;elseif(preg_match('~bool~',$p["type"]))echo"<input type='hidden'$Ka value='0'>"."<input type='checkbox'".(preg_match('~^(1|t|true|y|yes|on)$~i',$Y)?" checked='checked'":"")."$Ka value='1'>";elseif($p["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$p["length"],$Ee);foreach($Ee[1]as$t=>$X){$X=stripcslashes(str_replace("''","'",$X));$fb=(is_int($Y)?($Y>>$t)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$C][$t]' value='".(1<<$t)."'".($fb?' checked':'').">".h($b->editVal($X,$p)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$p["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$C'>";elseif(($di=preg_match('~text|lob~',$p["type"]))||preg_match("~\n~",$Y)){if($di&&$y!="sqlite")$Ka.=" cols='50' rows='12'";else{$K=min(12,substr_count($Y,"\n")+1);$Ka.=" cols='30' rows='$K'".($K==1?" style='height: 1.2em;'":"");}echo"<textarea$Ka>".h($Y).'</textarea>';}elseif($s=="json"||preg_match('~^jsonb?$~',$p["type"]))echo"<textarea$Ka cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$Le=(!preg_match('~int~',$p["type"])&&preg_match('~^(\d+)(,(\d+))?$~',$p["length"],$B)?((preg_match("~binary~",$p["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$p["unsigned"]?1:0)):($U[$p["type"]]?$U[$p["type"]]+($p["unsigned"]?0:1):0));if($y=='sql'&&min_version(5.6)&&preg_match('~time~',$p["type"]))$Le+=7;echo"<input".((!$ud||$s==="")&&preg_match('~(?<!o)int(?!er)~',$p["type"])&&!preg_match('~\[\]~',$p["full_type"])?" type='number'":"")." value='".h($Y)."'".($Le?" data-maxlength='$Le'":"").(preg_match('~char|binary~',$p["type"])&&$Le>20?" size='40'":"")."$Ka>";}echo$b->editHint($_GET["edit"],$p,$Y);$Wc=0;foreach($kd
    114 as$z=>$X){if($z===""||!$X)break;$Wc++;}if($Wc)echo
    115 script("mixin(qsl('td'), {onchange: partial(skipOriginal, $Wc), oninput: function () { this.onchange(); }});");}}function
     111enum_input($T,$Ka,$p,$Y,$uc=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$p["length"],$Fe);$I=($uc!==null?"<label><input type='$T'$Ka value='$uc'".((is_array($Y)?in_array($uc,$Y):$Y===0)?" checked":"")."><i>".lang(7)."</i></label>":"");foreach($Fe[1]as$t=>$X){$X=stripcslashes(str_replace("''","'",$X));$gb=(is_int($Y)?$Y==$t+1:(is_array($Y)?in_array($t+1,$Y):$Y===$X));$I.=" <label><input type='$T'$Ka value='".($t+1)."'".($gb?' checked':'').'>'.h($b->editVal($X,$p)).'</label>';}return$I;}function
     112input($p,$Y,$s){global$U,$b,$y;$C=h(bracket_escape($p["field"]));echo"<td class='function'>";if(is_array($Y)&&!$s){$Fa=array($Y);if(version_compare(PHP_VERSION,5.4)>=0)$Fa[]=JSON_PRETTY_PRINT;$Y=call_user_func_array('json_encode',$Fa);$s="json";}$Ng=($y=="mssql"&&$p["auto_increment"]);if($Ng&&!$_POST["save"])$s=null;$ld=(isset($_GET["select"])||$Ng?array("orig"=>lang(8)):array())+$b->editFunctions($p);$Ka=" name='fields[$C]'";if($p["type"]=="enum")echo
     113h($ld[""])."<td>".$b->editInput($_GET["edit"],$p,$Ka,$Y);else{$vd=(in_array($s,$ld)||isset($ld[$s]));echo(count($ld)>1?"<select name='function[$C]'>".optionlist($ld,$s===null||$vd?$s:"")."</select>".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).script("qsl('select').onchange = functionChange;",""):h(reset($ld))).'<td>';$Td=$b->editInput($_GET["edit"],$p,$Ka,$Y);if($Td!="")echo$Td;elseif(preg_match('~bool~',$p["type"]))echo"<input type='hidden'$Ka value='0'>"."<input type='checkbox'".(preg_match('~^(1|t|true|y|yes|on)$~i',$Y)?" checked='checked'":"")."$Ka value='1'>";elseif($p["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$p["length"],$Fe);foreach($Fe[1]as$t=>$X){$X=stripcslashes(str_replace("''","'",$X));$gb=(is_int($Y)?($Y>>$t)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$C][$t]' value='".(1<<$t)."'".($gb?' checked':'').">".h($b->editVal($X,$p)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$p["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$C'>";elseif(($fi=preg_match('~text|lob|memo~i',$p["type"]))||preg_match("~\n~",$Y)){if($fi&&$y!="sqlite")$Ka.=" cols='50' rows='12'";else{$K=min(12,substr_count($Y,"\n")+1);$Ka.=" cols='30' rows='$K'".($K==1?" style='height: 1.2em;'":"");}echo"<textarea$Ka>".h($Y).'</textarea>';}elseif($s=="json"||preg_match('~^jsonb?$~',$p["type"]))echo"<textarea$Ka cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$Me=(!preg_match('~int~',$p["type"])&&preg_match('~^(\d+)(,(\d+))?$~',$p["length"],$B)?((preg_match("~binary~",$p["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$p["unsigned"]?1:0)):($U[$p["type"]]?$U[$p["type"]]+($p["unsigned"]?0:1):0));if($y=='sql'&&min_version(5.6)&&preg_match('~time~',$p["type"]))$Me+=7;echo"<input".((!$vd||$s==="")&&preg_match('~(?<!o)int(?!er)~',$p["type"])&&!preg_match('~\[\]~',$p["full_type"])?" type='number'":"")." value='".h($Y)."'".($Me?" data-maxlength='$Me'":"").(preg_match('~char|binary~',$p["type"])&&$Me>20?" size='40'":"")."$Ka>";}echo$b->editHint($_GET["edit"],$p,$Y);$Xc=0;foreach($ld
     114as$z=>$X){if($z===""||!$X)break;$Xc++;}if($Xc)echo
     115script("mixin(qsl('td'), {onchange: partial(skipOriginal, $Xc), oninput: function () { this.onchange(); }});");}}function
    116116process_input($p){global$b,$n;$v=bracket_escape($p["field"]);$s=$_POST["function"][$v];$Y=$_POST["fields"][$v];if($p["type"]=="enum"){if($Y==-1)return
    117117false;if($Y=="")return"NULL";return+$Y;}if($p["auto_increment"]&&$Y=="")return
    118118null;if($s=="orig")return(preg_match('~^CURRENT_TIMESTAMP~i',$p["on_update"])?idf_escape($p["field"]):false);if($s=="NULL")return"NULL";if($p["type"]=="set")return
    119119array_sum((array)$Y);if($s=="json"){$s="";$Y=json_decode($Y,true);if(!is_array($Y))return
    120 false;return$Y;}if(preg_match('~blob|bytea|raw|file~',$p["type"])&&ini_bool("file_uploads")){$Tc=get_file("fields-$v");if(!is_string($Tc))return
    121 false;return$n->quoteBinary($Tc);}return$b->processInput($p,$Y,$s);}function
     120false;return$Y;}if(preg_match('~blob|bytea|raw|file~',$p["type"])&&ini_bool("file_uploads")){$Uc=get_file("fields-$v");if(!is_string($Uc))return
     121false;return$n->quoteBinary($Uc);}return$b->processInput($p,$Y,$s);}function
    122122fields_from_edit(){global$n;$I=array();foreach((array)$_POST["field_keys"]as$z=>$X){if($X!=""){$X=bracket_escape($X);$_POST["function"][$X]=$_POST["field_funs"][$z];$_POST["fields"][$X]=$_POST["field_vals"][$z];}}foreach((array)$_POST["fields"]as$z=>$X){$C=bracket_escape($z,1);$I[$C]=array("field"=>$C,"privileges"=>array("insert"=>1,"update"=>1),"null"=>1,"auto_increment"=>($z==$n->primary),);}return$I;}function
    123 search_tables(){global$b,$h;$_GET["where"][0]["val"]=$_POST["query"];$ih="<ul>\n";foreach(table_status('',true)as$Q=>$R){$C=$b->tableName($R);if(isset($R["Engine"])&&$C!=""&&(!$_POST["tables"]||in_array($Q,$_POST["tables"]))){$H=$h->query("SELECT".limit("1 FROM ".table($Q)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($Q),array())),1));if(!$H||$H->fetch_row()){$mg="<a href='".h(ME."select=".urlencode($Q)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$C</a>";echo"$ih<li>".($H?$mg:"<p class='error'>$mg: ".error())."\n";$ih="";}}}echo($ih?"<p class='message'>".lang(9):"</ul>")."\n";}function
    124 dump_headers($Cd,$Ve=false){global$b;$I=$b->dumpHeaders($Cd,$Ve);$Kf=$_POST["output"];if($Kf!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($Cd).".$I".($Kf!="file"&&!preg_match('~[^0-9a-z]~',$Kf)?".$Kf":""));session_write_close();ob_flush();flush();return$I;}function
     123search_tables(){global$b,$h;$_GET["where"][0]["val"]=$_POST["query"];$kh="<ul>\n";foreach(table_status('',true)as$Q=>$R){$C=$b->tableName($R);if(isset($R["Engine"])&&$C!=""&&(!$_POST["tables"]||in_array($Q,$_POST["tables"]))){$H=$h->query("SELECT".limit("1 FROM ".table($Q)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($Q),array())),1));if(!$H||$H->fetch_row()){$og="<a href='".h(ME."select=".urlencode($Q)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$C</a>";echo"$kh<li>".($H?$og:"<p class='error'>$og: ".error())."\n";$kh="";}}}echo($kh?"<p class='message'>".lang(9):"</ul>")."\n";}function
     124dump_headers($Dd,$We=false){global$b;$I=$b->dumpHeaders($Dd,$We);$Mf=$_POST["output"];if($Mf!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($Dd).".$I".($Mf!="file"&&!preg_match('~[^0-9a-z]~',$Mf)?".$Mf":""));session_write_close();ob_flush();flush();return$I;}function
    125125dump_csv($J){foreach($J
    126126as$z=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X==="")$J[$z]='"'.str_replace('"','""',$X).'"';}echo
    127127implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$J)."\r\n";}function
    128128apply_sql_function($s,$e){return($s?($s=="unixepoch"?"DATETIME($e, '$s')":($s=="count distinct"?"COUNT(DISTINCT ":strtoupper("$s("))."$e)"):$e);}function
    129 get_temp_dir(){$I=ini_get("upload_tmp_dir");if(!$I){if(function_exists('sys_get_temp_dir'))$I=sys_get_temp_dir();else{$Uc=@tempnam("","");if(!$Uc)return
    130 false;$I=dirname($Uc);unlink($Uc);}}return$I;}function
    131 file_open_lock($Uc){$id=@fopen($Uc,"r+");if(!$id){$id=@fopen($Uc,"w");if(!$id)return;chmod($Uc,0660);}flock($id,LOCK_EX);return$id;}function
    132 file_write_unlock($id,$Lb){rewind($id);fwrite($id,$Lb);ftruncate($id,strlen($Lb));flock($id,LOCK_UN);fclose($id);}function
    133 password_file($j){$Uc=get_temp_dir()."/adminer.key";$I=@file_get_contents($Uc);if($I||!$j)return$I;$id=@fopen($Uc,"w");if($id){chmod($Uc,0660);$I=rand_string();fwrite($id,$I);fclose($id);}return$I;}function
     129get_temp_dir(){$I=ini_get("upload_tmp_dir");if(!$I){if(function_exists('sys_get_temp_dir'))$I=sys_get_temp_dir();else{$Vc=@tempnam("","");if(!$Vc)return
     130false;$I=dirname($Vc);unlink($Vc);}}return$I;}function
     131file_open_lock($Vc){$jd=@fopen($Vc,"r+");if(!$jd){$jd=@fopen($Vc,"w");if(!$jd)return;chmod($Vc,0660);}flock($jd,LOCK_EX);return$jd;}function
     132file_write_unlock($jd,$Nb){rewind($jd);fwrite($jd,$Nb);ftruncate($jd,strlen($Nb));flock($jd,LOCK_UN);fclose($jd);}function
     133password_file($j){$Vc=get_temp_dir()."/adminer.key";$I=@file_get_contents($Vc);if($I||!$j)return$I;$jd=@fopen($Vc,"w");if($jd){chmod($Vc,0660);$I=rand_string();fwrite($jd,$I);fclose($jd);}return$I;}function
    134134rand_string(){return
    135135md5(uniqid(mt_rand(),true));}function
    136 select_value($X,$A,$p,$ei){global$b;if(is_array($X)){$I="";foreach($X
    137 as$de=>$W)$I.="<tr>".($X!=array_values($X)?"<th>".h($de):"")."<td>".select_value($W,$A,$p,$ei);return"<table cellspacing='0'>$I</table>";}if(!$A)$A=$b->selectLink($X,$p);if($A===null){if(is_mail($X))$A="mailto:$X";if(is_url($X))$A=$X;}$I=$b->editVal($X,$p);if($I!==null){if(!isutf8($I))$I="\0";elseif($ei!=""&&is_shortable($p))$I=shorten_utf8($I,max(0,+$ei));else$I=h($I);}return$b->selectVal($I,$A,$p,$X);}function
    138 is_mail($qc){$Ia='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$dc='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$ag="$Ia+(\\.$Ia+)*@($dc?\\.)+$dc";return
    139 is_string($qc)&&preg_match("(^$ag(,\\s*$ag)*\$)i",$qc);}function
    140 is_url($P){$dc='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return
    141 preg_match("~^(https?)://($dc?\\.)+$dc(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$P);}function
     136select_value($X,$A,$p,$gi){global$b;if(is_array($X)){$I="";foreach($X
     137as$ee=>$W)$I.="<tr>".($X!=array_values($X)?"<th>".h($ee):"")."<td>".select_value($W,$A,$p,$gi);return"<table cellspacing='0'>$I</table>";}if(!$A)$A=$b->selectLink($X,$p);if($A===null){if(is_mail($X))$A="mailto:$X";if(is_url($X))$A=$X;}$I=$b->editVal($X,$p);if($I!==null){if(!isutf8($I))$I="\0";elseif($gi!=""&&is_shortable($p))$I=shorten_utf8($I,max(0,+$gi));else$I=h($I);}return$b->selectVal($I,$A,$p,$X);}function
     138is_mail($rc){$Ia='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$ec='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$cg="$Ia+(\\.$Ia+)*@($ec?\\.)+$ec";return
     139is_string($rc)&&preg_match("(^$cg(,\\s*$cg)*\$)i",$rc);}function
     140is_url($P){$ec='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return
     141preg_match("~^(https?)://($ec?\\.)+$ec(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$P);}function
    142142is_shortable($p){return
    143143preg_match('~char|text|json|lob|geometry|point|linestring|polygon|string|bytea~',$p["type"]);}function
    144 count_rows($Q,$Z,$Yd,$nd){global$y;$G=" FROM ".table($Q).($Z?" WHERE ".implode(" AND ",$Z):"");return($Yd&&($y=="sql"||count($nd)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$nd).")$G":"SELECT COUNT(*)".($Yd?" FROM (SELECT 1$G GROUP BY ".implode(", ",$nd).") x":$G));}function
    145 slow_query($G){global$b,$pi,$n;$m=$b->database();$gi=$b->queryTimeout();$th=$n->slowQuery($G,$gi);if(!$th&&support("kill")&&is_object($i=connect())&&($m==""||$i->select_db($m))){$ie=$i->result(connection_id());echo'<script',nonce(),'>
     144count_rows($Q,$Z,$Zd,$od){global$y;$G=" FROM ".table($Q).($Z?" WHERE ".implode(" AND ",$Z):"");return($Zd&&($y=="sql"||count($od)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$od).")$G":"SELECT COUNT(*)".($Zd?" FROM (SELECT 1$G GROUP BY ".implode(", ",$od).") x":$G));}function
     145slow_query($G){global$b,$ri,$n;$m=$b->database();$ii=$b->queryTimeout();$vh=$n->slowQuery($G,$ii);if(!$vh&&support("kill")&&is_object($i=connect())&&($m==""||$i->select_db($m))){$je=$i->result(connection_id());echo'<script',nonce(),'>
    146146var timeout = setTimeout(function () {
    147147        ajax(\'',js_escape(ME),'script=kill\', function () {
    148         }, \'kill=',$ie,'&token=',$pi,'\');
    149 }, ',1000*$gi,');
     148        }, \'kill=',$je,'&token=',$ri,'\');
     149}, ',1000*$ii,');
    150150</script>
    151 ';}else$i=null;ob_flush();flush();$I=@get_key_vals(($th?$th:$G),$i,false);if($i){echo
     151';}else$i=null;ob_flush();flush();$I=@get_key_vals(($vh?$vh:$G),$i,false);if($i){echo
    152152script("clearTimeout(timeout);");ob_flush();flush();}return$I;}function
    153 get_token(){$yg=rand(1,1e6);return($yg^$_SESSION["token"]).":$yg";}function
    154 verify_token(){list($pi,$yg)=explode(":",$_POST["token"]);return($yg^$_SESSION["token"])==$pi;}function
    155 lzw_decompress($Sa){$Zb=256;$Ta=8;$mb=array();$Ng=0;$Og=0;for($t=0;$t<strlen($Sa);$t++){$Ng=($Ng<<8)+ord($Sa[$t]);$Og+=8;if($Og>=$Ta){$Og-=$Ta;$mb[]=$Ng>>$Og;$Ng&=(1<<$Og)-1;$Zb++;if($Zb>>$Ta)$Ta++;}}$Yb=range("\0","\xFF");$I="";foreach($mb
    156 as$t=>$lb){$pc=$Yb[$lb];if(!isset($pc))$pc=$mj.$mj[0];$I.=$pc;if($t)$Yb[]=$mj.$pc[0];$mj=$pc;}return$I;}function
    157 on_help($sb,$qh=0){return
    158 script("mixin(qsl('select, input'), {onmouseover: function (event) { helpMouseover.call(this, event, $sb, $qh) }, onmouseout: helpMouseout});","");}function
    159 edit_form($a,$q,$J,$Ki){global$b,$y,$pi,$o;$Qh=$b->tableName(table_status1($a,true));page_header(($Ki?lang(10):lang(11)),$o,array("select"=>array($a,$Qh)),$Qh);if($J===false)echo"<p class='error'>".lang(12)."\n";echo'<form action="" method="post" enctype="multipart/form-data" id="form">
     153get_token(){$_g=rand(1,1e6);return($_g^$_SESSION["token"]).":$_g";}function
     154verify_token(){list($ri,$_g)=explode(":",$_POST["token"]);return($_g^$_SESSION["token"])==$ri;}function
     155lzw_decompress($Ta){$bc=256;$Ua=8;$nb=array();$Pg=0;$Qg=0;for($t=0;$t<strlen($Ta);$t++){$Pg=($Pg<<8)+ord($Ta[$t]);$Qg+=8;if($Qg>=$Ua){$Qg-=$Ua;$nb[]=$Pg>>$Qg;$Pg&=(1<<$Qg)-1;$bc++;if($bc>>$Ua)$Ua++;}}$ac=range("\0","\xFF");$I="";foreach($nb
     156as$t=>$mb){$qc=$ac[$mb];if(!isset($qc))$qc=$pj.$pj[0];$I.=$qc;if($t)$ac[]=$pj.$qc[0];$pj=$qc;}return$I;}function
     157on_help($tb,$sh=0){return
     158script("mixin(qsl('select, input'), {onmouseover: function (event) { helpMouseover.call(this, event, $tb, $sh) }, onmouseout: helpMouseout});","");}function
     159edit_form($a,$q,$J,$Mi){global$b,$y,$ri,$o;$Sh=$b->tableName(table_status1($a,true));page_header(($Mi?lang(10):lang(11)),$o,array("select"=>array($a,$Sh)),$Sh);if($J===false)echo"<p class='error'>".lang(12)."\n";echo'<form action="" method="post" enctype="multipart/form-data" id="form">
    160160';if(!$q)echo"<p class='error'>".lang(13)."\n";else{echo"<table cellspacing='0' class='layout'>".script("qsl('table').onkeydown = editingKeydown;");foreach($q
    161 as$C=>$p){echo"<tr><th>".$b->fieldName($p);$Sb=$_GET["set"][bracket_escape($C)];if($Sb===null){$Sb=$p["default"];if($p["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$Sb,$Hg))$Sb=$Hg[1];}$Y=($J!==null?($J[$C]!=""&&$y=="sql"&&preg_match("~enum|set~",$p["type"])?(is_array($J[$C])?array_sum($J[$C]):+$J[$C]):$J[$C]):(!$Ki&&$p["auto_increment"]?"":(isset($_GET["select"])?false:$Sb)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$p);$s=($_POST["save"]?(string)$_POST["function"][$C]:($Ki&&preg_match('~^CURRENT_TIMESTAMP~i',$p["on_update"])?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$p["type"])&&preg_match('~^CURRENT_TIMESTAMP~i',$Y)){$Y="";$s="now";}input($p,$Y,$s);echo"\n";}if(!support("table"))echo"<tr>"."<th><input name='field_keys[]'>".script("qsl('input').oninput = fieldChange;")."<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($q){echo"<input type='submit' value='".lang(14)."'>\n";if(!isset($_GET["select"])){echo"<input type='submit' name='insert' value='".($Ki?lang(15):lang(16))."' title='Ctrl+Shift+Enter'>\n",($Ki?script("qsl('input').onclick = function () { return !ajaxForm(this.form, '".lang(17)."…', this); };"):"");}}echo($Ki?"<input type='submit' name='delete' value='".lang(18)."'>".confirm()."\n":($_POST||!$q?"":script("focus(qsa('td', qs('#form'))[1].firstChild);")));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"]),'">
     161as$C=>$p){echo"<tr><th>".$b->fieldName($p);$Ub=$_GET["set"][bracket_escape($C)];if($Ub===null){$Ub=$p["default"];if($p["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$Ub,$Jg))$Ub=$Jg[1];}$Y=($J!==null?($J[$C]!=""&&$y=="sql"&&preg_match("~enum|set~",$p["type"])?(is_array($J[$C])?array_sum($J[$C]):+$J[$C]):$J[$C]):(!$Mi&&$p["auto_increment"]?"":(isset($_GET["select"])?false:$Ub)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$p);$s=($_POST["save"]?(string)$_POST["function"][$C]:($Mi&&preg_match('~^CURRENT_TIMESTAMP~i',$p["on_update"])?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$p["type"])&&preg_match('~^CURRENT_TIMESTAMP~i',$Y)){$Y="";$s="now";}input($p,$Y,$s);echo"\n";}if(!support("table"))echo"<tr>"."<th><input name='field_keys[]'>".script("qsl('input').oninput = fieldChange;")."<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($q){echo"<input type='submit' value='".lang(14)."'>\n";if(!isset($_GET["select"])){echo"<input type='submit' name='insert' value='".($Mi?lang(15):lang(16))."' title='Ctrl+Shift+Enter'>\n",($Mi?script("qsl('input').onclick = function () { return !ajaxForm(this.form, '".lang(17)."…', this); };"):"");}}echo($Mi?"<input type='submit' name='delete' value='".lang(18)."'>".confirm()."\n":($_POST||!$q?"":script("focus(qsa('td', qs('#form'))[1].firstChild);")));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"]),'">
    162162<input type="hidden" name="save" value="1">
    163 <input type="hidden" name="token" value="',$pi,'">
     163<input type="hidden" name="token" value="',$ri,'">
    164164</form>
    165165';}if(isset($_GET["file"])){if($_SERVER["HTTP_IF_MODIFIED_SINCE"]){header("HTTP/1.1 304 Not Modified");exit;}header("Expires: ".gmdate("D, d M Y H:i:s",time()+365*24*60*60)." GMT");header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");header("Cache-Control: immutable");if($_GET["file"]=="favicon.ico"){header("Content-Type: image/x-icon");echo
     
    16281628\0;";break;case"down.gif":echo"GIF89a\0\0\0001îîî\0\0€™™™\0\0\0!ù\0\0\0,\0\0\0\0\0\0 „©ËíMñÌ*)¾[Wþ\\¢ÇL&ٜ
    16291629ƶ•\0Çò
    1630 \0;";break;case"arrow.gif":echo"GIF89a\0\n\0€\0\0€€€ÿÿÿ!ù\0\0\0,\0\0\0\0\0\n\0\0‚i–±‹ž”ªÓ²Þ»\0\0;";break;}}exit;}if($_GET["script"]=="version"){$id=file_open_lock(get_temp_dir()."/adminer.version");if($id)file_write_unlock($id,serialize(array("signature"=>$_POST["signature"],"version"=>$_POST["version"])));exit;}global$b,$h,$n,$ec,$mc,$wc,$o,$kd,$qd,$ba,$Rd,$y,$ca,$ne,$qf,$bg,$Ih,$vd,$pi,$vi,$U,$Ji,$ia;if(!$_SERVER["REQUEST_URI"])$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"];if(!strpos($_SERVER["REQUEST_URI"],'?')&&$_SERVER["QUERY_STRING"]!="")$_SERVER["REQUEST_URI"].="?$_SERVER[QUERY_STRING]";if($_SERVER["HTTP_X_FORWARDED_PREFIX"])$_SERVER["REQUEST_URI"]=$_SERVER["HTTP_X_FORWARDED_PREFIX"].$_SERVER["REQUEST_URI"];$ba=($_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off"))||ini_bool("session.cookie_secure");@ini_set("session.use_trans_sid",false);if(!defined("SID")){session_cache_limiter("");session_name("adminer_sid");$Of=array(0,preg_replace('~\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$Of[]=true;call_user_func_array('session_set_cookie_params',$Of);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Vc);if(get_magic_quotes_runtime())set_magic_quotes_runtime(false);@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",15);$ne=array('en'=>'English','ar'=>'العربية','bg'=>'Български','bn'=>'বাংলা','bs'=>'Bosanski','ca'=>'Català','cs'=>'ČeÅ¡tina','da'=>'Dansk','de'=>'Deutsch','el'=>'Ελληνικά','es'=>'Español','et'=>'Eesti','fa'=>'فارسی','fi'=>'Suomi','fr'=>'Français','gl'=>'Galego','he'=>'עברית','hu'=>'Magyar','id'=>'Bahasa Indonesia','it'=>'Italiano','ja'=>'日本語','ka'=>'ქართული','ko'=>'한국어','lt'=>'Lietuvių','ms'=>'Bahasa Melayu','nl'=>'Nederlands','no'=>'Norsk','pl'=>'Polski','pt'=>'Português','pt-br'=>'Português (Brazil)','ro'=>'Limba Română','ru'=>'Русский','sk'=>'Slovenčina','sl'=>'Slovenski','sr'=>'Српски','ta'=>'த‌மிழ்','th'=>'ภาษาไทย','tr'=>'Türkçe','uk'=>'Українська','vi'=>'Tiếng Việt','zh'=>'简体中文','zh-tw'=>'繁體中文',);function
     1630\0;";break;case"arrow.gif":echo"GIF89a\0\n\0€\0\0€€€ÿÿÿ!ù\0\0\0,\0\0\0\0\0\n\0\0‚i–±‹ž”ªÓ²Þ»\0\0;";break;}}exit;}if($_GET["script"]=="version"){$jd=file_open_lock(get_temp_dir()."/adminer.version");if($jd)file_write_unlock($jd,serialize(array("signature"=>$_POST["signature"],"version"=>$_POST["version"])));exit;}global$b,$h,$n,$fc,$nc,$xc,$o,$ld,$rd,$ba,$Sd,$y,$ca,$oe,$sf,$dg,$Kh,$wd,$ri,$xi,$U,$Li,$ia;if(!$_SERVER["REQUEST_URI"])$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"];if(!strpos($_SERVER["REQUEST_URI"],'?')&&$_SERVER["QUERY_STRING"]!="")$_SERVER["REQUEST_URI"].="?$_SERVER[QUERY_STRING]";if($_SERVER["HTTP_X_FORWARDED_PREFIX"])$_SERVER["REQUEST_URI"]=$_SERVER["HTTP_X_FORWARDED_PREFIX"].$_SERVER["REQUEST_URI"];$ba=($_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off"))||ini_bool("session.cookie_secure");@ini_set("session.use_trans_sid",false);if(!defined("SID")){session_cache_limiter("");session_name("adminer_sid");$Qf=array(0,preg_replace('~\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$Qf[]=true;call_user_func_array('session_set_cookie_params',$Qf);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Wc);if(get_magic_quotes_runtime())set_magic_quotes_runtime(false);@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",15);$oe=array('en'=>'English','ar'=>'العربية','bg'=>'Български','bn'=>'বাংলা','bs'=>'Bosanski','ca'=>'Català','cs'=>'ČeÅ¡tina','da'=>'Dansk','de'=>'Deutsch','el'=>'Ελληνικά','es'=>'Español','et'=>'Eesti','fa'=>'فارسی','fi'=>'Suomi','fr'=>'Français','gl'=>'Galego','he'=>'עברית','hu'=>'Magyar','id'=>'Bahasa Indonesia','it'=>'Italiano','ja'=>'日本語','ka'=>'ქართული','ko'=>'한국어','lt'=>'Lietuvių','ms'=>'Bahasa Melayu','nl'=>'Nederlands','no'=>'Norsk','pl'=>'Polski','pt'=>'Português','pt-br'=>'Português (Brazil)','ro'=>'Limba Română','ru'=>'Русский','sk'=>'Slovenčina','sl'=>'Slovenski','sr'=>'Српски','ta'=>'த‌மிழ்','th'=>'ภาษาไทย','tr'=>'Türkçe','uk'=>'Українська','vi'=>'Tiếng Việt','zh'=>'简体中文','zh-tw'=>'繁體中文',);function
    16311631get_lang(){global$ca;return$ca;}function
    1632 lang($v,$hf=null){if(is_string($v)){$eg=array_search($v,get_translations("en"));if($eg!==false)$v=$eg;}global$ca,$vi;$ui=($vi[$v]?$vi[$v]:$v);if(is_array($ui)){$eg=($hf==1?0:($ca=='cs'||$ca=='sk'?($hf&&$hf<5?1:2):($ca=='fr'?(!$hf?0:1):($ca=='pl'?($hf%10>1&&$hf%10<5&&$hf/10%10!=1?1:2):($ca=='sl'?($hf%100==1?0:($hf%100==2?1:($hf%100==3||$hf%100==4?2:3))):($ca=='lt'?($hf%10==1&&$hf%100!=11?0:($hf%10>1&&$hf/10%10!=1?1:2)):($ca=='bs'||$ca=='ru'||$ca=='sr'||$ca=='uk'?($hf%10==1&&$hf%100!=11?0:($hf%10>1&&$hf%10<5&&$hf/10%10!=1?1:2)):1)))))));$ui=$ui[$eg];}$Fa=func_get_args();array_shift($Fa);$fd=str_replace("%d","%s",$ui);if($fd!=$ui)$Fa[0]=format_number($hf);return
    1633 vsprintf($fd,$Fa);}function
    1634 switch_lang(){global$ca,$ne;echo"<form action='' method='post'>\n<div id='lang'>",lang(19).": ".html_select("lang",$ne,$ca,"this.form.submit();")," <input type='submit' value='".lang(20)."' class='hidden'>\n","<input type='hidden' name='token' value='".get_token()."'>\n";echo"</div>\n</form>\n";}if(isset($_POST["lang"])&&verify_token()){cookie("adminer_lang",$_POST["lang"]);$_SESSION["lang"]=$_POST["lang"];$_SESSION["translations"]=array();redirect(remove_from_uri());}$ca="en";if(isset($ne[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($ne[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$va=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$Ee,PREG_SET_ORDER);foreach($Ee
     1632lang($v,$jf=null){if(is_string($v)){$gg=array_search($v,get_translations("en"));if($gg!==false)$v=$gg;}global$ca,$xi;$wi=($xi[$v]?$xi[$v]:$v);if(is_array($wi)){$gg=($jf==1?0:($ca=='cs'||$ca=='sk'?($jf&&$jf<5?1:2):($ca=='fr'?(!$jf?0:1):($ca=='pl'?($jf%10>1&&$jf%10<5&&$jf/10%10!=1?1:2):($ca=='sl'?($jf%100==1?0:($jf%100==2?1:($jf%100==3||$jf%100==4?2:3))):($ca=='lt'?($jf%10==1&&$jf%100!=11?0:($jf%10>1&&$jf/10%10!=1?1:2)):($ca=='bs'||$ca=='ru'||$ca=='sr'||$ca=='uk'?($jf%10==1&&$jf%100!=11?0:($jf%10>1&&$jf%10<5&&$jf/10%10!=1?1:2)):1)))))));$wi=$wi[$gg];}$Fa=func_get_args();array_shift($Fa);$gd=str_replace("%d","%s",$wi);if($gd!=$wi)$Fa[0]=format_number($jf);return
     1633vsprintf($gd,$Fa);}function
     1634switch_lang(){global$ca,$oe;echo"<form action='' method='post'>\n<div id='lang'>",lang(19).": ".html_select("lang",$oe,$ca,"this.form.submit();")," <input type='submit' value='".lang(20)."' class='hidden'>\n","<input type='hidden' name='token' value='".get_token()."'>\n";echo"</div>\n</form>\n";}if(isset($_POST["lang"])&&verify_token()){cookie("adminer_lang",$_POST["lang"]);$_SESSION["lang"]=$_POST["lang"];$_SESSION["translations"]=array();redirect(remove_from_uri());}$ca="en";if(isset($oe[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($oe[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$va=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$Fe,PREG_SET_ORDER);foreach($Fe
    16351635as$B)$va[$B[1]]=(isset($B[3])?$B[3]:1);arsort($va);foreach($va
    1636 as$z=>$ug){if(isset($ne[$z])){$ca=$z;break;}$z=preg_replace('~-.*~','',$z);if(!isset($va[$z])&&isset($ne[$z])){$ca=$z;break;}}}$vi=$_SESSION["translations"];if($_SESSION["translations_version"]!=1761515769){$vi=array();$_SESSION["translations_version"]=1761515769;}function
    1637 get_translations($me){switch($me){case"en":$g="A9D“yÔ@s:ÀGà¡(¸ffƒ‚Š¦ã ˆÙ:ÄS°Þa2
     1636as$z=>$wg){if(isset($oe[$z])){$ca=$z;break;}$z=preg_replace('~-.*~','',$z);if(!isset($va[$z])&&isset($oe[$z])){$ca=$z;break;}}}$xi=$_SESSION["translations"];if($_SESSION["translations_version"]!=1761515769){$xi=array();$_SESSION["translations_version"]=1761515769;}function
     1637get_translations($ne){switch($ne){case"en":$g="A9D“yÔ@s:ÀGà¡(¸ffƒ‚Š¦ã ˆÙ:ÄS°Þa2
    16381638\"1¦..L'ƒI´êm‘#Çs,†KƒšOP#IÌ@%9¥i4Èo2ύÆó €Ë,9%ÀPÀb2£a¸àr\n2›NCÈ(Þr4™Í1C`(:Ebç9AÈi:‰&㙔åy·ˆFó½ÐY‚ˆ\r´\n– 8ZÔS=\$Aœ
    16391639†¤`Ñ=Ë܌²‚ž0Ê\nÒãdFé   ŒÞn:Zΰ)­ãQ¦ÕÈmwÛø€ÝO¼êmfpQË΂‰†qœêaÊį±#q®–w7SŽX3” ‰œŠ˜o¢\n>Z—M„
     
    51895189
    51905190C4`ÞÅXàä\r&j%фB2Mp%®
    5191 Á›¢èñâøÁL";break;}$vi=array();foreach(explode("\n",lzw_decompress($g))as$X)$vi[]=(strpos($X,"\t")?explode("\t",$X):$X);return$vi;}if(!$vi){$vi=get_translations($ca);$_SESSION["translations"]=$vi;}if(extension_loaded('pdo')){class
     5191Á›¢èñâøÁL";break;}$xi=array();foreach(explode("\n",lzw_decompress($g))as$X)$xi[]=(strpos($X,"\t")?explode("\t",$X):$X);return$xi;}if(!$xi){$xi=get_translations($ca);$_SESSION["translations"]=$xi;}if(extension_loaded('pdo')){class
    51925192Min_PDO
    51935193extends
    51945194PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
    5195 __construct(){global$b;$eg=array_search("SQL",$b->operators);if($eg!==false)unset($b->operators[$eg]);}function
    5196 dsn($jc,$V,$F,$yf=array()){try{parent::__construct($jc,$V,$F,$yf);}catch(Exception$Ac){auth_error(h($Ac->getMessage()));}$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=@$this->getAttribute(4);}function
    5197 query($G,$Di=false){$H=parent::query($G);$this->error="";if(!$H){list(,$this->errno,$this->error)=$this->errorInfo();if(!$this->error)$this->error=lang(21);return
     5195__construct(){global$b;$gg=array_search("SQL",$b->operators);if($gg!==false)unset($b->operators[$gg]);}function
     5196dsn($kc,$V,$F,$_f=array()){try{parent::__construct($kc,$V,$F,$_f);}catch(Exception$Bc){auth_error(h($Bc->getMessage()));}$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=@$this->getAttribute(4);}function
     5197query($G,$Fi=false){$H=parent::query($G);$this->error="";if(!$H){list(,$this->errno,$this->error)=$this->errorInfo();if(!$this->error)$this->error=lang(21);return
    51985198false;}$this->store_result($H);return$H;}function
    51995199multi_query($G){return$this->_result=$this->query($G);}function
     
    52105210fetch_assoc(){return$this->fetch(2);}function
    52115211fetch_row(){return$this->fetch(3);}function
    5212 fetch_field(){$J=(object)$this->getColumnMeta($this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=(in_array("blob",(array)$J->flags)?63:0);return$J;}}}$ec=array();class
     5212fetch_field(){$J=(object)$this->getColumnMeta($this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=(in_array("blob",(array)$J->flags)?63:0);return$J;}}}$fc=array();class
    52135213Min_SQL{var$_conn;function
    52145214__construct($h){$this->_conn=$h;}function
    5215 select($Q,$L,$Z,$nd,$_f=array(),$_=1,$E=0,$mg=false){global$b,$y;$Yd=(count($nd)<count($L));$G=$b->selectQueryBuild($L,$Z,$nd,$_f,$_,$E);if(!$G)$G="SELECT".limit(($_GET["page"]!="last"&&$_!=""&&$nd&&$Yd&&$y=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$L)."\nFROM ".table($Q),($Z?"\nWHERE ".implode(" AND ",$Z):"").($nd&&$Yd?"\nGROUP BY ".implode(", ",$nd):"").($_f?"\nORDER BY ".implode(", ",$_f):""),($_!=""?+$_:null),($E?$_*$E:0),"\n");$Dh=microtime(true);$I=$this->_conn->query($G);if($mg)echo$b->selectQuery($G,$Dh,!$I);return$I;}function
    5216 delete($Q,$wg,$_=0){$G="FROM ".table($Q);return
    5217 queries("DELETE".($_?limit1($Q,$G,$wg):" $G$wg"));}function
    5218 update($Q,$O,$wg,$_=0,$M="\n"){$Vi=array();foreach($O
    5219 as$z=>$X)$Vi[]="$z = $X";$G=table($Q)." SET$M".implode(",$M",$Vi);return
    5220 queries("UPDATE".($_?limit1($Q,$G,$wg,$M):" $G$wg"));}function
     5215select($Q,$L,$Z,$od,$Bf=array(),$_=1,$E=0,$og=false){global$b,$y;$Zd=(count($od)<count($L));$G=$b->selectQueryBuild($L,$Z,$od,$Bf,$_,$E);if(!$G)$G="SELECT".limit(($_GET["page"]!="last"&&$_!=""&&$od&&$Zd&&$y=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$L)."\nFROM ".table($Q),($Z?"\nWHERE ".implode(" AND ",$Z):"").($od&&$Zd?"\nGROUP BY ".implode(", ",$od):"").($Bf?"\nORDER BY ".implode(", ",$Bf):""),($_!=""?+$_:null),($E?$_*$E:0),"\n");$Fh=microtime(true);$I=$this->_conn->query($G);if($og)echo$b->selectQuery($G,$Fh,!$I);return$I;}function
     5216delete($Q,$yg,$_=0){$G="FROM ".table($Q);return
     5217queries("DELETE".($_?limit1($Q,$G,$yg):" $G$yg"));}function
     5218update($Q,$O,$yg,$_=0,$M="\n"){$Yi=array();foreach($O
     5219as$z=>$X)$Yi[]="$z = $X";$G=table($Q)." SET$M".implode(",$M",$Yi);return
     5220queries("UPDATE".($_?limit1($Q,$G,$yg,$M):" $G$yg"));}function
    52215221insert($Q,$O){return
    52225222queries("INSERT INTO ".table($Q).($O?" (".implode(", ",array_keys($O)).")\nVALUES (".implode(", ",$O).")":" DEFAULT VALUES"));}function
    5223 insertUpdate($Q,$K,$kg){return
     5223insertUpdate($Q,$K,$mg){return
    52245224false;}function
    52255225begin(){return
     
    52295229rollback(){return
    52305230queries("ROLLBACK");}function
    5231 slowQuery($G,$gi){}function
     5231slowQuery($G,$ii){}function
    52325232convertSearch($v,$X,$p){return$v;}function
    52335233value($X,$p){return(method_exists($this->_conn,'value')?$this->_conn->value($X,$p):(is_resource($X)?stream_get_contents($X):$X));}function
    5234 quoteBinary($Yg){return
    5235 q($Yg);}function
     5234quoteBinary($ah){return
     5235q($ah);}function
    52365236warnings(){return'';}function
    5237 tableHelp($C){}}$ec["sqlite"]="SQLite 3";$ec["sqlite2"]="SQLite 2";if(isset($_GET["sqlite"])||isset($_GET["sqlite2"])){$hg=array((isset($_GET["sqlite"])?"SQLite3":"SQLite"),"PDO_SQLite");define("DRIVER",(isset($_GET["sqlite"])?"sqlite":"sqlite2"));if(class_exists(isset($_GET["sqlite"])?"SQLite3":"SQLiteDatabase")){if(isset($_GET["sqlite"])){class
     5237tableHelp($C){}}$fc["sqlite"]="SQLite 3";$fc["sqlite2"]="SQLite 2";if(isset($_GET["sqlite"])||isset($_GET["sqlite2"])){$jg=array((isset($_GET["sqlite"])?"SQLite3":"SQLite"),"PDO_SQLite");define("DRIVER",(isset($_GET["sqlite"])?"sqlite":"sqlite2"));if(class_exists(isset($_GET["sqlite"])?"SQLite3":"SQLiteDatabase")){if(isset($_GET["sqlite"])){class
    52385238Min_SQLite{var$extension="SQLite3",$server_info,$affected_rows,$errno,$error,$_link;function
    5239 __construct($Uc){$this->_link=new
    5240 SQLite3($Uc);$Yi=$this->_link->version();$this->server_info=$Yi["versionString"];}function
     5239__construct($Vc){$this->_link=new
     5240SQLite3($Vc);$bj=$this->_link->version();$this->server_info=$bj["versionString"];}function
    52415241query($G){$H=@$this->_link->query($G);$this->error="";if(!$H){$this->errno=$this->_link->lastErrorCode();$this->error=$this->_link->lastErrorMsg();return
    52425242false;}elseif($H->numColumns())return
     
    52555255__desctruct(){return$this->_result->finalize();}}}else{class
    52565256Min_SQLite{var$extension="SQLite",$server_info,$affected_rows,$error,$_link;function
    5257 __construct($Uc){$this->server_info=sqlite_libversion();$this->_link=new
    5258 SQLiteDatabase($Uc);}function
    5259 query($G,$Di=false){$Se=($Di?"unbufferedQuery":"query");$H=@$this->_link->$Se($G,SQLITE_BOTH,$o);$this->error="";if(!$H){$this->error=$o;return
     5257__construct($Vc){$this->server_info=sqlite_libversion();$this->_link=new
     5258SQLiteDatabase($Vc);}function
     5259query($G,$Fi=false){$Te=($Fi?"unbufferedQuery":"query");$H=@$this->_link->$Te($G,SQLITE_BOTH,$o);$this->error="";if(!$H){$this->error=$o;return
    52605260false;}elseif($H===true){$this->affected_rows=$this->changes();return
    52615261true;}return
     
    52725272as$z=>$X)$I[($z[0]=='"'?idf_unescape($z):$z)]=$X;return$I;}function
    52735273fetch_row(){return$this->_result->fetch(SQLITE_NUM);}function
    5274 fetch_field(){$C=$this->_result->fieldName($this->_offset++);$ag='(\[.*]|"(?:[^"]|"")*"|(.+))';if(preg_match("~^($ag\\.)?$ag\$~",$C,$B)){$Q=($B[3]!=""?$B[3]:idf_unescape($B[2]));$C=($B[5]!=""?$B[5]:idf_unescape($B[4]));}return(object)array("name"=>$C,"orgname"=>$C,"orgtable"=>$Q,);}}}}elseif(extension_loaded("pdo_sqlite")){class
     5274fetch_field(){$C=$this->_result->fieldName($this->_offset++);$cg='(\[.*]|"(?:[^"]|"")*"|(.+))';if(preg_match("~^($cg\\.)?$cg\$~",$C,$B)){$Q=($B[3]!=""?$B[3]:idf_unescape($B[2]));$C=($B[5]!=""?$B[5]:idf_unescape($B[4]));}return(object)array("name"=>$C,"orgname"=>$C,"orgtable"=>$Q,);}}}}elseif(extension_loaded("pdo_sqlite")){class
    52755275Min_SQLite
    52765276extends
    52775277Min_PDO{var$extension="PDO_SQLite";function
    5278 __construct($Uc){$this->dsn(DRIVER.":$Uc","","");}}}if(class_exists("Min_SQLite")){class
     5278__construct($Vc){$this->dsn(DRIVER.":$Vc","","");}}}if(class_exists("Min_SQLite")){class
    52795279Min_DB
    52805280extends
    52815281Min_SQLite{function
    52825282__construct(){parent::__construct(":memory:");$this->query("PRAGMA foreign_keys = 1");}function
    5283 select_db($Uc){if(is_readable($Uc)&&$this->query("ATTACH ".$this->quote(preg_match("~(^[/\\\\]|:)~",$Uc)?$Uc:dirname($_SERVER["SCRIPT_FILENAME"])."/$Uc")." AS a")){parent::__construct($Uc);$this->query("PRAGMA foreign_keys = 1");return
     5283select_db($Vc){if(is_readable($Vc)&&$this->query("ATTACH ".$this->quote(preg_match("~(^[/\\\\]|:)~",$Vc)?$Vc:dirname($_SERVER["SCRIPT_FILENAME"])."/$Vc")." AS a")){parent::__construct($Vc);$this->query("PRAGMA foreign_keys = 1");return
    52845284true;}return
    52855285false;}function
     
    52905290extends
    52915291Min_SQL{function
    5292 insertUpdate($Q,$K,$kg){$Vi=array();foreach($K
    5293 as$O)$Vi[]="(".implode(", ",$O).")";return
    5294 queries("REPLACE INTO ".table($Q)." (".implode(", ",array_keys(reset($K))).") VALUES\n".implode(",\n",$Vi));}function
     5292insertUpdate($Q,$K,$mg){$Yi=array();foreach($K
     5293as$O)$Yi[]="(".implode(", ",$O).")";return
     5294queries("REPLACE INTO ".table($Q)." (".implode(", ",array_keys(reset($K))).") VALUES\n".implode(",\n",$Yi));}function
    52955295tableHelp($C){if($C=="sqlite_sequence")return"fileformat2.html#seqtab";if($C=="sqlite_master")return"fileformat2.html#$C";}}function
    52965296idf_escape($v){return'"'.str_replace('"','""',$v).'"';}function
     
    53055305limit($G,$Z,$_,$D=0,$M=" "){return" $G$Z".($_!==null?$M."LIMIT $_".($D?" OFFSET $D":""):"");}function
    53065306limit1($Q,$G,$Z,$M="\n"){global$h;return(preg_match('~^INTO~',$G)||$h->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')")?limit($G,$Z,1,0,$M):" $G WHERE rowid = (SELECT rowid FROM ".table($Q).$Z.$M."LIMIT 1)");}function
    5307 db_collation($m,$pb){global$h;return$h->result("PRAGMA encoding");}function
     5307db_collation($m,$qb){global$h;return$h->result("PRAGMA encoding");}function
    53085308engines(){return
    53095309array();}function
     
    53175317is_view($R){return$R["Engine"]=="view";}function
    53185318fk_support($R){global$h;return!$h->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");}function
    5319 fields($Q){global$h;$I=array();$kg="";foreach(get_rows("PRAGMA table_info(".table($Q).")")as$J){$C=$J["name"];$T=strtolower($J["type"]);$Sb=$J["dflt_value"];$I[$C]=array("field"=>$C,"type"=>(preg_match('~int~i',$T)?"integer":(preg_match('~char|clob|text~i',$T)?"text":(preg_match('~blob~i',$T)?"blob":(preg_match('~real|floa|doub~i',$T)?"real":"numeric")))),"full_type"=>$T,"default"=>(preg_match("~'(.*)'~",$Sb,$B)?str_replace("''","'",$B[1]):($Sb=="NULL"?null:$Sb)),"null"=>!$J["notnull"],"privileges"=>array("select"=>1,"insert"=>1,"update"=>1),"primary"=>$J["pk"],);if($J["pk"]){if($kg!="")$I[$kg]["auto_increment"]=false;elseif(preg_match('~^integer$~i',$T))$I[$C]["auto_increment"]=true;$kg=$C;}}$zh=$h->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));preg_match_all('~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i',$zh,$Ee,PREG_SET_ORDER);foreach($Ee
     5319fields($Q){global$h;$I=array();$mg="";foreach(get_rows("PRAGMA table_info(".table($Q).")")as$J){$C=$J["name"];$T=strtolower($J["type"]);$Ub=$J["dflt_value"];$I[$C]=array("field"=>$C,"type"=>(preg_match('~int~i',$T)?"integer":(preg_match('~char|clob|text~i',$T)?"text":(preg_match('~blob~i',$T)?"blob":(preg_match('~real|floa|doub~i',$T)?"real":"numeric")))),"full_type"=>$T,"default"=>(preg_match("~'(.*)'~",$Ub,$B)?str_replace("''","'",$B[1]):($Ub=="NULL"?null:$Ub)),"null"=>!$J["notnull"],"privileges"=>array("select"=>1,"insert"=>1,"update"=>1),"primary"=>$J["pk"],);if($J["pk"]){if($mg!="")$I[$mg]["auto_increment"]=false;elseif(preg_match('~^integer$~i',$T))$I[$C]["auto_increment"]=true;$mg=$C;}}$Ah=$h->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));preg_match_all('~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i',$Ah,$Fe,PREG_SET_ORDER);foreach($Fe
    53205320as$B){$C=str_replace('""','"',preg_replace('~^"|"$~','',$B[1]));if($I[$C])$I[$C]["collation"]=trim($B[3],"'");}return$I;}function
    5321 indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$I=array();$zh=$i->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));if(preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*"|`[^`]*`)++)~i',$zh,$B)){$I[""]=array("type"=>"PRIMARY","columns"=>array(),"lengths"=>array(),"descs"=>array());preg_match_all('~((("[^"]*+")+|(?:`[^`]*+`)+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i',$B[1],$Ee,PREG_SET_ORDER);foreach($Ee
    5322 as$B){$I[""]["columns"][]=idf_unescape($B[2]).$B[4];$I[""]["descs"][]=(preg_match('~DESC~i',$B[5])?'1':null);}}if(!$I){foreach(fields($Q)as$C=>$p){if($p["primary"])$I[""]=array("type"=>"PRIMARY","columns"=>array($C),"lengths"=>array(),"descs"=>array(null));}}$Bh=get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ".q($Q),$i);foreach(get_rows("PRAGMA index_list(".table($Q).")",$i)as$J){$C=$J["name"];$w=array("type"=>($J["unique"]?"UNIQUE":"INDEX"));$w["lengths"]=array();$w["descs"]=array();foreach(get_rows("PRAGMA index_info(".idf_escape($C).")",$i)as$Xg){$w["columns"][]=$Xg["name"];$w["descs"][]=null;}if(preg_match('~^CREATE( UNIQUE)? INDEX '.preg_quote(idf_escape($C).' ON '.idf_escape($Q),'~').' \((.*)\)$~i',$Bh[$C],$Hg)){preg_match_all('/("[^"]*+")+( DESC)?/',$Hg[2],$Ee);foreach($Ee[2]as$z=>$X){if($X)$w["descs"][$z]='1';}}if(!$I[""]||$w["type"]!="UNIQUE"||$w["columns"]!=$I[""]["columns"]||$w["descs"]!=$I[""]["descs"]||!preg_match("~^sqlite_~",$C))$I[$C]=$w;}return$I;}function
     5321indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$I=array();$Ah=$i->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));if(preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*"|`[^`]*`)++)~i',$Ah,$B)){$I[""]=array("type"=>"PRIMARY","columns"=>array(),"lengths"=>array(),"descs"=>array());preg_match_all('~((("[^"]*+")+|(?:`[^`]*+`)+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i',$B[1],$Fe,PREG_SET_ORDER);foreach($Fe
     5322as$B){$I[""]["columns"][]=idf_unescape($B[2]).$B[4];$I[""]["descs"][]=(preg_match('~DESC~i',$B[5])?'1':null);}}if(!$I){foreach(fields($Q)as$C=>$p){if($p["primary"])$I[""]=array("type"=>"PRIMARY","columns"=>array($C),"lengths"=>array(),"descs"=>array(null));}}$Dh=get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ".q($Q),$i);foreach(get_rows("PRAGMA index_list(".table($Q).")",$i)as$J){$C=$J["name"];$w=array("type"=>($J["unique"]?"UNIQUE":"INDEX"));$w["lengths"]=array();$w["descs"]=array();foreach(get_rows("PRAGMA index_info(".idf_escape($C).")",$i)as$Zg){$w["columns"][]=$Zg["name"];$w["descs"][]=null;}if(preg_match('~^CREATE( UNIQUE)? INDEX '.preg_quote(idf_escape($C).' ON '.idf_escape($Q),'~').' \((.*)\)$~i',$Dh[$C],$Jg)){preg_match_all('/("[^"]*+")+( DESC)?/',$Jg[2],$Fe);foreach($Fe[2]as$z=>$X){if($X)$w["descs"][$z]='1';}}if(!$I[""]||$w["type"]!="UNIQUE"||$w["columns"]!=$I[""]["columns"]||$w["descs"]!=$I[""]["descs"]||!preg_match("~^sqlite_~",$C))$I[$C]=$w;}return$I;}function
    53235323foreign_keys($Q){$I=array();foreach(get_rows("PRAGMA foreign_key_list(".table($Q).")")as$J){$r=&$I[$J["id"]];if(!$r)$r=$J;$r["source"][]=$J["from"];$r["target"][]=$J["to"];}return$I;}function
    53245324view($C){global$h;return
     
    53295329error(){global$h;return
    53305330h($h->error);}function
    5331 check_sqlite_name($C){global$h;$Kc="db|sdb|sqlite";if(!preg_match("~^[^\\0]*\\.($Kc)\$~",$C)){$h->error=lang(23,str_replace("|",", ",$Kc));return
     5331check_sqlite_name($C){global$h;$Lc="db|sdb|sqlite";if(!preg_match("~^[^\\0]*\\.($Lc)\$~",$C)){$h->error=lang(23,str_replace("|",", ",$Lc));return
    53325332false;}return
    53335333true;}function
     
    53355335false;}if(!check_sqlite_name($m))return
    53365336false;try{$A=new
    5337 Min_SQLite($m);}catch(Exception$Ac){$h->error=$Ac->getMessage();return
     5337Min_SQLite($m);}catch(Exception$Bc){$h->error=$Bc->getMessage();return
    53385338false;}$A->query('PRAGMA encoding = "UTF-8"');$A->query('CREATE TABLE adminer (i)');$A->query('DROP TABLE adminer');return
    53395339true;}function
     
    53455345false;$h->__construct(":memory:");$h->error=lang(24);return@rename(DB,$C);}function
    53465346auto_increment(){return" PRIMARY KEY".(DRIVER=="sqlite"?" AUTOINCREMENT":"");}function
    5347 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){$Pi=($Q==""||$cd);foreach($q
    5348 as$p){if($p[0]!=""||!$p[1]||$p[2]){$Pi=true;break;}}$c=array();$If=array();foreach($q
    5349 as$p){if($p[1]){$c[]=($Pi?$p[1]:"ADD ".implode($p[1]));if($p[0]!="")$If[$p[0]]=$p[1][0];}}if(!$Pi){foreach($c
     5347alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){global$h;$Ri=($Q==""||$dd);foreach($q
     5348as$p){if($p[0]!=""||!$p[1]||$p[2]){$Ri=true;break;}}$c=array();$Kf=array();foreach($q
     5349as$p){if($p[1]){$c[]=($Ri?$p[1]:"ADD ".implode($p[1]));if($p[0]!="")$Kf[$p[0]]=$p[1][0];}}if(!$Ri){foreach($c
    53505350as$X){if(!queries("ALTER TABLE ".table($Q)." $X"))return
    53515351false;}if($Q!=$C&&!queries("ALTER TABLE ".table($Q)." RENAME TO ".table($C)))return
    5352 false;}elseif(!recreate_table($Q,$C,$c,$If,$cd))return
    5353 false;if($Ma)queries("UPDATE sqlite_sequence SET seq = $Ma WHERE name = ".q($C));return
     5352false;}elseif(!recreate_table($Q,$C,$c,$Kf,$dd,$Na))return
     5353false;if($Na){queries("BEGIN");queries("UPDATE sqlite_sequence SET seq = $Na WHERE name = ".q($C));if(!$h->affected_rows)queries("INSERT INTO sqlite_sequence (name, seq) VALUES (".q($C).", $Na)");queries("COMMIT");}return
    53545354true;}function
    5355 recreate_table($Q,$C,$q,$If,$cd,$x=array()){if($Q!=""){if(!$q){foreach(fields($Q)as$z=>$p){if($x)$p["auto_increment"]=0;$q[]=process_field($p,$p);$If[$z]=idf_escape($z);}}$lg=false;foreach($q
    5356 as$p){if($p[6])$lg=true;}$hc=array();foreach($x
    5357 as$z=>$X){if($X[2]=="DROP"){$hc[$X[1]]=true;unset($x[$z]);}}foreach(indexes($Q)as$ge=>$w){$f=array();foreach($w["columns"]as$z=>$e){if(!$If[$e])continue
    5358 2;$f[]=$If[$e].($w["descs"][$z]?" DESC":"");}if(!$hc[$ge]){if($w["type"]!="PRIMARY"||!$lg)$x[]=array($w["type"],$ge,$f);}}foreach($x
    5359 as$z=>$X){if($X[0]=="PRIMARY"){unset($x[$z]);$cd[]="  PRIMARY KEY (".implode(", ",$X[2]).")";}}foreach(foreign_keys($Q)as$ge=>$r){foreach($r["source"]as$z=>$e){if(!$If[$e])continue
    5360 2;$r["source"][$z]=idf_unescape($If[$e]);}if(!isset($cd[" $ge"]))$cd[]=" ".format_foreign_key($r);}queries("BEGIN");}foreach($q
    5361 as$z=>$p)$q[$z]="  ".implode($p);$q=array_merge($q,array_filter($cd));if(!queries("CREATE TABLE ".table($Q!=""?"adminer_$C":$C)." (\n".implode(",\n",$q)."\n)"))return
    5362 false;if($Q!=""){if($If&&!queries("INSERT INTO ".table("adminer_$C")." (".implode(", ",$If).") SELECT ".implode(", ",array_map('idf_escape',array_keys($If)))." FROM ".table($Q)))return
    5363 false;$Ai=array();foreach(triggers($Q)as$zi=>$hi){$yi=trigger($zi);$Ai[]="CREATE TRIGGER ".idf_escape($zi)." ".implode(" ",$hi)." ON ".table($C)."\n$yi[Statement]";}if(!queries("DROP TABLE ".table($Q)))return
    5364 false;queries("ALTER TABLE ".table("adminer_$C")." RENAME TO ".table($C));if(!alter_indexes($C,$x))return
    5365 false;foreach($Ai
    5366 as$yi){if(!queries($yi))return
     5355recreate_table($Q,$C,$q,$Kf,$dd,$Na,$x=array()){global$h;if($Q!=""){if(!$q){foreach(fields($Q)as$z=>$p){if($x)$p["auto_increment"]=0;$q[]=process_field($p,$p);$Kf[$z]=idf_escape($z);}}$ng=false;foreach($q
     5356as$p){if($p[6])$ng=true;}$ic=array();foreach($x
     5357as$z=>$X){if($X[2]=="DROP"){$ic[$X[1]]=true;unset($x[$z]);}}foreach(indexes($Q)as$he=>$w){$f=array();foreach($w["columns"]as$z=>$e){if(!$Kf[$e])continue
     53582;$f[]=$Kf[$e].($w["descs"][$z]?" DESC":"");}if(!$ic[$he]){if($w["type"]!="PRIMARY"||!$ng)$x[]=array($w["type"],$he,$f);}}foreach($x
     5359as$z=>$X){if($X[0]=="PRIMARY"){unset($x[$z]);$dd[]="  PRIMARY KEY (".implode(", ",$X[2]).")";}}foreach(foreign_keys($Q)as$he=>$r){foreach($r["source"]as$z=>$e){if(!$Kf[$e])continue
     53602;$r["source"][$z]=idf_unescape($Kf[$e]);}if(!isset($dd[" $he"]))$dd[]=" ".format_foreign_key($r);}queries("BEGIN");}foreach($q
     5361as$z=>$p)$q[$z]="  ".implode($p);$q=array_merge($q,array_filter($dd));$ci=($Q==$C?"adminer_$C":$C);if(!queries("CREATE TABLE ".table($ci)." (\n".implode(",\n",$q)."\n)"))return
     5362false;if($Q!=""){if($Kf&&!queries("INSERT INTO ".table($ci)." (".implode(", ",$Kf).") SELECT ".implode(", ",array_map('idf_escape',array_keys($Kf)))." FROM ".table($Q)))return
     5363false;$Ci=array();foreach(triggers($Q)as$Ai=>$ji){$_i=trigger($Ai);$Ci[]="CREATE TRIGGER ".idf_escape($Ai)." ".implode(" ",$ji)." ON ".table($C)."\n$_i[Statement]";}$Na=$Na?0:$h->result("SELECT seq FROM sqlite_sequence WHERE name = ".q($Q));if(!queries("DROP TABLE ".table($Q))||($Q==$C&&!queries("ALTER TABLE ".table($ci)." RENAME TO ".table($C)))||!alter_indexes($C,$x))return
     5364false;if($Na)queries("UPDATE sqlite_sequence SET seq = $Na WHERE name = ".q($C));foreach($Ci
     5365as$_i){if(!queries($_i))return
    53675366false;}queries("COMMIT");}return
    53685367true;}function
    53695368index_sql($Q,$T,$C,$f){return"CREATE $T ".($T!="INDEX"?"INDEX ":"").idf_escape($C!=""?$C:uniqid($Q."_"))." ON ".table($Q)." $f";}function
    53705369alter_indexes($Q,$c){foreach($c
    5371 as$kg){if($kg[0]=="PRIMARY")return
    5372 recreate_table($Q,$Q,array(),array(),array(),$c);}foreach(array_reverse($c)as$X){if(!queries($X[2]=="DROP"?"DROP INDEX ".idf_escape($X[1]):index_sql($Q,$X[0],$X[1],"(".implode(", ",$X[2]).")")))return
     5370as$mg){if($mg[0]=="PRIMARY")return
     5371recreate_table($Q,$Q,array(),array(),array(),0,$c);}foreach(array_reverse($c)as$X){if(!queries($X[2]=="DROP"?"DROP INDEX ".idf_escape($X[1]):index_sql($Q,$X[0],$X[1],"(".implode(", ",$X[2]).")")))return
    53735372false;}return
    53745373true;}function
    53755374truncate_tables($S){return
    53765375apply_queries("DELETE FROM",$S);}function
    5377 drop_views($aj){return
    5378 apply_queries("DROP VIEW",$aj);}function
     5376drop_views($dj){return
     5377apply_queries("DROP VIEW",$dj);}function
    53795378drop_tables($S){return
    53805379apply_queries("DROP TABLE",$S);}function
    5381 move_tables($S,$aj,$Yh){return
     5380move_tables($S,$dj,$ai){return
    53825381false;}function
    53835382trigger($C){global$h;if($C=="")return
    5384 array("Statement"=>"BEGIN\n\t;\nEND");$v='(?:[^`"\s]+|`[^`]*`|"[^"]*")+';$_i=trigger_options();preg_match("~^CREATE\\s+TRIGGER\\s*$v\\s*(".implode("|",$_i["Timing"]).")\\s+([a-z]+)(?:\\s+OF\\s+($v))?\\s+ON\\s*$v\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",$h->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ".q($C)),$B);$jf=$B[3];return
    5385 array("Timing"=>strtoupper($B[1]),"Event"=>strtoupper($B[2]).($jf?" OF":""),"Of"=>($jf[0]=='`'||$jf[0]=='"'?idf_unescape($jf):$jf),"Trigger"=>$C,"Statement"=>$B[4],);}function
    5386 triggers($Q){$I=array();$_i=trigger_options();foreach(get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q))as$J){preg_match('~^CREATE\s+TRIGGER\s*(?:[^`"\s]+|`[^`]*`|"[^"]*")+\s*('.implode("|",$_i["Timing"]).')\s*(.*)\s+ON\b~iU',$J["sql"],$B);$I[$J["name"]]=array($B[1],$B[2]);}return$I;}function
     5383array("Statement"=>"BEGIN\n\t;\nEND");$v='(?:[^`"\s]+|`[^`]*`|"[^"]*")+';$Bi=trigger_options();preg_match("~^CREATE\\s+TRIGGER\\s*$v\\s*(".implode("|",$Bi["Timing"]).")\\s+([a-z]+)(?:\\s+OF\\s+($v))?\\s+ON\\s*$v\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",$h->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ".q($C)),$B);$lf=$B[3];return
     5384array("Timing"=>strtoupper($B[1]),"Event"=>strtoupper($B[2]).($lf?" OF":""),"Of"=>($lf[0]=='`'||$lf[0]=='"'?idf_unescape($lf):$lf),"Trigger"=>$C,"Statement"=>$B[4],);}function
     5385triggers($Q){$I=array();$Bi=trigger_options();foreach(get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q))as$J){preg_match('~^CREATE\s+TRIGGER\s*(?:[^`"\s]+|`[^`]*`|"[^"]*")+\s*('.implode("|",$Bi["Timing"]).')\s*(.*?)\s+ON\b~i',$J["sql"],$B);$I[$J["name"]]=array($B[1],$B[2]);}return$I;}function
    53875386trigger_options(){return
    53885387array("Timing"=>array("BEFORE","AFTER","INSTEAD OF"),"Event"=>array("INSERT","UPDATE","UPDATE OF","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
     
    53975396array();}function
    53985397get_schema(){return"";}function
    5399 set_schema($bh){return
     5398set_schema($dh){return
    54005399true;}function
    5401 create_sql($Q,$Ma,$Jh){global$h;$I=$h->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = ".q($Q));foreach(indexes($Q)as$C=>$w){if($C=='')continue;$I.=";\n\n".index_sql($Q,$w['type'],$C,"(".implode(", ",array_map('idf_escape',$w['columns'])).")");}return$I;}function
     5400create_sql($Q,$Na,$Lh){global$h;$I=$h->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = ".q($Q));foreach(indexes($Q)as$C=>$w){if($C=='')continue;$I.=";\n\n".index_sql($Q,$w['type'],$C,"(".implode(", ",array_map('idf_escape',$w['columns'])).")");}return$I;}function
    54025401truncate_sql($Q){return"DELETE FROM ".table($Q);}function
    54035402use_sql($k){}function
     
    54055404implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q)));}function
    54065405show_variables(){global$h;$I=array();foreach(array("auto_vacuum","cache_size","count_changes","default_cache_size","empty_result_callbacks","encoding","foreign_keys","full_column_names","fullfsync","journal_mode","journal_size_limit","legacy_file_format","locking_mode","page_size","max_page_count","read_uncommitted","recursive_triggers","reverse_unordered_selects","secure_delete","short_column_names","synchronous","temp_store","temp_store_directory","schema_version","integrity_check","quick_check")as$z)$I[$z]=$h->result("PRAGMA $z");return$I;}function
    5407 show_status(){$I=array();foreach(get_vals("PRAGMA compile_options")as$xf){list($z,$X)=explode("=",$xf,2);$I[$z]=$X;}return$I;}function
     5406show_status(){$I=array();foreach(get_vals("PRAGMA compile_options")as$zf){list($z,$X)=explode("=",$zf,2);$I[$z]=$X;}return$I;}function
    54085407convert_field($p){}function
    54095408unconvert_field($p,$I){return$I;}function
    5410 support($Pc){return
    5411 preg_match('~^(columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~',$Pc);}$y="sqlite";$U=array("integer"=>0,"real"=>0,"numeric"=>0,"text"=>0,"blob"=>0);$Ih=array_keys($U);$Ji=array();$vf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$kd=array("hex","length","lower","round","unixepoch","upper");$qd=array("avg","count","count distinct","group_concat","max","min","sum");$mc=array(array(),array("integer|real|numeric"=>"+/-","text"=>"||",));}$ec["pgsql"]="PostgreSQL";if(isset($_GET["pgsql"])){$hg=array("PgSQL","PDO_PgSQL");define("DRIVER","pgsql");if(extension_loaded("pgsql")){class
     5409support($Qc){return
     5410preg_match('~^(columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~',$Qc);}$y="sqlite";$U=array("integer"=>0,"real"=>0,"numeric"=>0,"text"=>0,"blob"=>0);$Kh=array_keys($U);$Li=array();$xf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$ld=array("hex","length","lower","round","unixepoch","upper");$rd=array("avg","count","count distinct","group_concat","max","min","sum");$nc=array(array(),array("integer|real|numeric"=>"+/-","text"=>"||",));}$fc["pgsql"]="PostgreSQL";if(isset($_GET["pgsql"])){$jg=array("PgSQL","PDO_PgSQL");define("DRIVER","pgsql");if(extension_loaded("pgsql")){class
    54125411Min_DB{var$extension="PgSQL",$_link,$_result,$_string,$_database=true,$server_info,$affected_rows,$error,$timeout;function
    5413 _error($xc,$o){if(ini_bool("html_errors"))$o=html_entity_decode(strip_tags($o));$o=preg_replace('~^[^:]*: ~','',$o);$this->error=$o;}function
    5414 connect($N,$V,$F){global$b;$m=$b->database();set_error_handler(array($this,'_error'));$this->_string="host='".str_replace(":","' port='",addcslashes($N,"'\\"))."' user='".addcslashes($V,"'\\")."' password='".addcslashes($F,"'\\")."'";$this->_link=@pg_connect("$this->_string dbname='".($m!=""?addcslashes($m,"'\\"):"postgres")."'",PGSQL_CONNECT_FORCE_NEW);if(!$this->_link&&$m!=""){$this->_database=false;$this->_link=@pg_connect("$this->_string dbname='postgres'",PGSQL_CONNECT_FORCE_NEW);}restore_error_handler();if($this->_link){$Yi=pg_version($this->_link);$this->server_info=$Yi["server"];pg_set_client_encoding($this->_link,"UTF8");}return(bool)$this->_link;}function
     5412_error($yc,$o){if(ini_bool("html_errors"))$o=html_entity_decode(strip_tags($o));$o=preg_replace('~^[^:]*: ~','',$o);$this->error=$o;}function
     5413connect($N,$V,$F){global$b;$m=$b->database();set_error_handler(array($this,'_error'));$this->_string="host='".str_replace(":","' port='",addcslashes($N,"'\\"))."' user='".addcslashes($V,"'\\")."' password='".addcslashes($F,"'\\")."'";$this->_link=@pg_connect("$this->_string dbname='".($m!=""?addcslashes($m,"'\\"):"postgres")."'",PGSQL_CONNECT_FORCE_NEW);if(!$this->_link&&$m!=""){$this->_database=false;$this->_link=@pg_connect("$this->_string dbname='postgres'",PGSQL_CONNECT_FORCE_NEW);}restore_error_handler();if($this->_link){$bj=pg_version($this->_link);$this->server_info=$bj["server"];pg_set_client_encoding($this->_link,"UTF8");}return(bool)$this->_link;}function
    54155414quote($P){return"'".pg_escape_string($this->_link,$P)."'";}function
    54165415value($X,$p){return($p["type"]=="bytea"?pg_unescape_bytea($X):$X);}function
     
    54185417select_db($k){global$b;if($k==$b->database())return$this->_database;$I=@pg_connect("$this->_string dbname='".addcslashes($k,"'\\")."'",PGSQL_CONNECT_FORCE_NEW);if($I)$this->_link=$I;return$I;}function
    54195418close(){$this->_link=@pg_connect("$this->_string dbname='postgres'");}function
    5420 query($G,$Di=false){$H=@pg_query($this->_link,$G);$this->error="";if(!$H){$this->error=pg_last_error($this->_link);$I=false;}elseif(!pg_num_fields($H)){$this->affected_rows=pg_affected_rows($H);$I=true;}else$I=new
     5419query($G,$Fi=false){$H=@pg_query($this->_link,$G);$this->error="";if(!$H){$this->error=pg_last_error($this->_link);$I=false;}elseif(!pg_num_fields($H)){$this->affected_rows=pg_affected_rows($H);$I=true;}else$I=new
    54215420Min_Result($H);if($this->timeout){$this->timeout=0;$this->query("RESET statement_timeout");}return$I;}function
    54225421multi_query($G){return$this->_result=$this->query($G);}function
     
    54445443true;}function
    54455444select_db($k){global$b;return($b->database()==$k);}function
    5446 quoteBinary($Yg){return
    5447 q($Yg);}function
    5448 query($G,$Di=false){$I=parent::query($G,$Di);if($this->timeout){$this->timeout=0;parent::query("RESET statement_timeout");}return$I;}function
     5445quoteBinary($ah){return
     5446q($ah);}function
     5447query($G,$Fi=false){$I=parent::query($G,$Fi);if($this->timeout){$this->timeout=0;parent::query("RESET statement_timeout");}return$I;}function
    54495448warnings(){return'';}function
    54505449close(){}}}class
     
    54525451extends
    54535452Min_SQL{function
    5454 insertUpdate($Q,$K,$kg){global$h;foreach($K
    5455 as$O){$Ki=array();$Z=array();foreach($O
    5456 as$z=>$X){$Ki[]="$z = $X";if(isset($kg[idf_unescape($z)]))$Z[]="$z = $X";}if(!(($Z&&queries("UPDATE ".table($Q)." SET ".implode(", ",$Ki)." WHERE ".implode(" AND ",$Z))&&$h->affected_rows)||queries("INSERT INTO ".table($Q)." (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).")")))return
     5453insertUpdate($Q,$K,$mg){global$h;foreach($K
     5454as$O){$Mi=array();$Z=array();foreach($O
     5455as$z=>$X){$Mi[]="$z = $X";if(isset($mg[idf_unescape($z)]))$Z[]="$z = $X";}if(!(($Z&&queries("UPDATE ".table($Q)." SET ".implode(", ",$Mi)." WHERE ".implode(" AND ",$Z))&&$h->affected_rows)||queries("INSERT INTO ".table($Q)." (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).")")))return
    54575456false;}return
    54585457true;}function
    5459 slowQuery($G,$gi){$this->_conn->query("SET statement_timeout = ".(1000*$gi));$this->_conn->timeout=1000*$gi;return$G;}function
     5458slowQuery($G,$ii){$this->_conn->query("SET statement_timeout = ".(1000*$ii));$this->_conn->timeout=1000*$ii;return$G;}function
    54605459convertSearch($v,$X,$p){return(preg_match('~char|text'.(!preg_match('~LIKE~',$X["op"])?'|date|time(stamp)?|boolean|uuid|'.number_type():'').'~',$p["type"])?$v:"CAST($v AS text)");}function
    5461 quoteBinary($Yg){return$this->_conn->quoteBinary($Yg);}function
     5460quoteBinary($ah){return$this->_conn->quoteBinary($ah);}function
    54625461warnings(){return$this->_conn->warnings();}function
    5463 tableHelp($C){$xe=array("information_schema"=>"infoschema","pg_catalog"=>"catalog",);$A=$xe[$_GET["ns"]];if($A)return"$A-".str_replace("_","-",$C).".html";}}function
     5462tableHelp($C){$ye=array("information_schema"=>"infoschema","pg_catalog"=>"catalog",);$A=$ye[$_GET["ns"]];if($A)return"$A-".str_replace("_","-",$C).".html";}}function
    54645463idf_escape($v){return'"'.str_replace('"','""',$v).'"';}function
    54655464table($v){return
    54665465idf_escape($v);}function
    5467 connect(){global$b,$U,$Ih;$h=new
    5468 Min_DB;$Gb=$b->credentials();if($h->connect($Gb[0],$Gb[1],$Gb[2])){if(min_version(9,0,$h)){$h->query("SET application_name = 'Adminer'");if(min_version(9.2,0,$h)){$Ih[lang(25)][]="json";$U["json"]=4294967295;if(min_version(9.4,0,$h)){$Ih[lang(25)][]="jsonb";$U["jsonb"]=4294967295;}}}return$h;}return$h->error;}function
     5466connect(){global$b,$U,$Kh;$h=new
     5467Min_DB;$Ib=$b->credentials();if($h->connect($Ib[0],$Ib[1],$Ib[2])){if(min_version(9,0,$h)){$h->query("SET application_name = 'Adminer'");if(min_version(9.2,0,$h)){$Kh[lang(25)][]="json";$U["json"]=4294967295;if(min_version(9.4,0,$h)){$Kh[lang(25)][]="jsonb";$U["jsonb"]=4294967295;}}}return$h;}return$h->error;}function
    54695468get_databases(){return
    54705469get_vals("SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname");}function
    54715470limit($G,$Z,$_,$D=0,$M=" "){return" $G$Z".($_!==null?$M."LIMIT $_".($D?" OFFSET $D":""):"");}function
    54725471limit1($Q,$G,$Z,$M="\n"){return(preg_match('~^INTO~',$G)?limit($G,$Z,1,0,$M):" $G".(is_view(table_status1($Q))?$Z:" WHERE ctid = (SELECT ctid FROM ".table($Q).$Z.$M."LIMIT 1)"));}function
    5473 db_collation($m,$pb){global$h;return$h->result("SHOW LC_COLLATE");}function
     5472db_collation($m,$qb){global$h;return$h->result("SHOW LC_COLLATE");}function
    54745473engines(){return
    54755474array();}function
     
    54935492fk_support($R){return
    54945493true;}function
    5495 fields($Q){$I=array();$Da=array('timestamp without time zone'=>'timestamp','timestamp with time zone'=>'timestamptz',);$Dd=min_version(10)?"(a.attidentity = 'd')::int":'0';foreach(get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment, $Dd AS identity
     5494fields($Q){$I=array();$Da=array('timestamp without time zone'=>'timestamp','timestamp with time zone'=>'timestamptz',);$Ed=min_version(10)?"(a.attidentity = 'd')::int":'0';foreach(get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment, $Ed AS identity
    54965495FROM pg_class c
    54975496JOIN pg_namespace n ON c.relnamespace = n.oid
     
    55025501AND NOT a.attisdropped
    55035502AND a.attnum > 0
    5504 ORDER BY a.attnum")as$J){preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~',$J["full_type"],$B);list(,$T,$ue,$J["length"],$xa,$Ga)=$B;$J["length"].=$Ga;$eb=$T.$xa;if(isset($Da[$eb])){$J["type"]=$Da[$eb];$J["full_type"]=$J["type"].$ue.$Ga;}else{$J["type"]=$T;$J["full_type"]=$J["type"].$ue.$xa.$Ga;}if($J['identity'])$J['default']='GENERATED BY DEFAULT AS IDENTITY';$J["null"]=!$J["attnotnull"];$J["auto_increment"]=$J['identity']||preg_match('~^nextval\(~i',$J["default"]);$J["privileges"]=array("insert"=>1,"select"=>1,"update"=>1);if(preg_match('~(.+)::[^)]+(.*)~',$J["default"],$B))$J["default"]=($B[1]=="NULL"?null:(($B[1][0]=="'"?idf_unescape($B[1]):$B[1]).$B[2]));$I[$J["field"]]=$J;}return$I;}function
    5505 indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$I=array();$Rh=$i->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = ".q($Q));$f=get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Rh AND attnum > 0",$i);foreach(get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption , (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $Rh AND ci.oid = i.indexrelid",$i)as$J){$Ig=$J["relname"];$I[$Ig]["type"]=($J["indispartial"]?"INDEX":($J["indisprimary"]?"PRIMARY":($J["indisunique"]?"UNIQUE":"INDEX")));$I[$Ig]["columns"]=array();foreach(explode(" ",$J["indkey"])as$Nd)$I[$Ig]["columns"][]=$f[$Nd];$I[$Ig]["descs"]=array();foreach(explode(" ",$J["indoption"])as$Od)$I[$Ig]["descs"][]=($Od&1?'1':null);$I[$Ig]["lengths"]=array();}return$I;}function
    5506 foreign_keys($Q){global$qf;$I=array();foreach(get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
     5503ORDER BY a.attnum")as$J){preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~',$J["full_type"],$B);list(,$T,$ve,$J["length"],$xa,$Ga)=$B;$J["length"].=$Ga;$fb=$T.$xa;if(isset($Da[$fb])){$J["type"]=$Da[$fb];$J["full_type"]=$J["type"].$ve.$Ga;}else{$J["type"]=$T;$J["full_type"]=$J["type"].$ve.$xa.$Ga;}if($J['identity'])$J['default']='GENERATED BY DEFAULT AS IDENTITY';$J["null"]=!$J["attnotnull"];$J["auto_increment"]=$J['identity']||preg_match('~^nextval\(~i',$J["default"]);$J["privileges"]=array("insert"=>1,"select"=>1,"update"=>1);if(preg_match('~(.+)::[^)]+(.*)~',$J["default"],$B))$J["default"]=($B[1]=="NULL"?null:(($B[1][0]=="'"?idf_unescape($B[1]):$B[1]).$B[2]));$I[$J["field"]]=$J;}return$I;}function
     5504indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$I=array();$Th=$i->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = ".q($Q));$f=get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Th AND attnum > 0",$i);foreach(get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption , (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $Th AND ci.oid = i.indexrelid",$i)as$J){$Kg=$J["relname"];$I[$Kg]["type"]=($J["indispartial"]?"INDEX":($J["indisprimary"]?"PRIMARY":($J["indisunique"]?"UNIQUE":"INDEX")));$I[$Kg]["columns"]=array();foreach(explode(" ",$J["indkey"])as$Od)$I[$Kg]["columns"][]=$f[$Od];$I[$Kg]["descs"]=array();foreach(explode(" ",$J["indoption"])as$Pd)$I[$Kg]["descs"][]=($Pd&1?'1':null);$I[$Kg]["lengths"]=array();}return$I;}function
     5505foreign_keys($Q){global$sf;$I=array();foreach(get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
    55075506FROM pg_constraint
    55085507WHERE conrelid = (SELECT pc.oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON (pn.oid = pc.relnamespace) WHERE pc.relname = ".q($Q)." AND pn.nspname = current_schema())
    55095508AND contype = 'f'::char
    5510 ORDER BY conkey, conname")as$J){if(preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA',$J['definition'],$B)){$J['source']=array_map('trim',explode(',',$B[1]));if(preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~',$B[2],$De)){$J['ns']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$De[2]));$J['table']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$De[4]));}$J['target']=array_map('trim',explode(',',$B[3]));$J['on_delete']=(preg_match("~ON DELETE ($qf)~",$B[4],$De)?$De[1]:'NO ACTION');$J['on_update']=(preg_match("~ON UPDATE ($qf)~",$B[4],$De)?$De[1]:'NO ACTION');$I[$J['conname']]=$J;}}return$I;}function
     5509ORDER BY conkey, conname")as$J){if(preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA',$J['definition'],$B)){$J['source']=array_map('trim',explode(',',$B[1]));if(preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~',$B[2],$Ee)){$J['ns']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$Ee[2]));$J['table']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$Ee[4]));}$J['target']=array_map('trim',explode(',',$B[3]));$J['on_delete']=(preg_match("~ON DELETE ($sf)~",$B[4],$Ee)?$Ee[1]:'NO ACTION');$J['on_update']=(preg_match("~ON UPDATE ($sf)~",$B[4],$Ee)?$Ee[1]:'NO ACTION');$I[$J['conname']]=$J;}}return$I;}function
    55115510view($C){global$h;return
    55125511array("select"=>trim($h->result("SELECT pg_get_viewdef(".$h->result("SELECT oid FROM pg_class WHERE relname = ".q($C)).")")));}function
     
    55235522queries("ALTER DATABASE ".idf_escape(DB)." RENAME TO ".idf_escape($C));}function
    55245523auto_increment(){return"";}function
    5525 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){$c=array();$vg=array();if($Q!=""&&$Q!=$C)$vg[]="ALTER TABLE ".table($Q)." RENAME TO ".table($C);foreach($q
    5526 as$p){$e=idf_escape($p[0]);$X=$p[1];if(!$X)$c[]="DROP $e";else{$Ui=$X[5];unset($X[5]);if(isset($X[6])&&$p[0]=="")$X[1]=($X[1]=="bigint"?" big":" ")."serial";if($p[0]=="")$c[]=($Q!=""?"ADD ":"  ").implode($X);else{if($e!=$X[0])$vg[]="ALTER TABLE ".table($C)." RENAME $e TO $X[0]";$c[]="ALTER $e TYPE$X[1]";if(!$X[6]){$c[]="ALTER $e ".($X[3]?"SET$X[3]":"DROP DEFAULT");$c[]="ALTER $e ".($X[2]==" NULL"?"DROP NOT":"SET").$X[2];}}if($p[0]!=""||$Ui!="")$vg[]="COMMENT ON COLUMN ".table($C).".$X[0] IS ".($Ui!=""?substr($Ui,9):"''");}}$c=array_merge($c,$cd);if($Q=="")array_unshift($vg,"CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");elseif($c)array_unshift($vg,"ALTER TABLE ".table($Q)."\n".implode(",\n",$c));if($Q!=""||$ub!="")$vg[]="COMMENT ON TABLE ".table($C)." IS ".q($ub);if($Ma!=""){}foreach($vg
     5524alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){$c=array();$xg=array();if($Q!=""&&$Q!=$C)$xg[]="ALTER TABLE ".table($Q)." RENAME TO ".table($C);foreach($q
     5525as$p){$e=idf_escape($p[0]);$X=$p[1];if(!$X)$c[]="DROP $e";else{$Xi=$X[5];unset($X[5]);if(isset($X[6])&&$p[0]=="")$X[1]=($X[1]=="bigint"?" big":" ")."serial";if($p[0]=="")$c[]=($Q!=""?"ADD ":"  ").implode($X);else{if($e!=$X[0])$xg[]="ALTER TABLE ".table($C)." RENAME $e TO $X[0]";$c[]="ALTER $e TYPE$X[1]";if(!$X[6]){$c[]="ALTER $e ".($X[3]?"SET$X[3]":"DROP DEFAULT");$c[]="ALTER $e ".($X[2]==" NULL"?"DROP NOT":"SET").$X[2];}}if($p[0]!=""||$Xi!="")$xg[]="COMMENT ON COLUMN ".table($C).".$X[0] IS ".($Xi!=""?substr($Xi,9):"''");}}$c=array_merge($c,$dd);if($Q=="")array_unshift($xg,"CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");elseif($c)array_unshift($xg,"ALTER TABLE ".table($Q)."\n".implode(",\n",$c));if($Q!=""||$vb!="")$xg[]="COMMENT ON TABLE ".table($C)." IS ".q($vb);if($Na!=""){}foreach($xg
    55275526as$G){if(!queries($G))return
    55285527false;}return
    55295528true;}function
    5530 alter_indexes($Q,$c){$j=array();$fc=array();$vg=array();foreach($c
    5531 as$X){if($X[0]!="INDEX")$j[]=($X[2]=="DROP"?"\nDROP CONSTRAINT ".idf_escape($X[1]):"\nADD".($X[1]!=""?" CONSTRAINT ".idf_escape($X[1]):"")." $X[0] ".($X[0]=="PRIMARY"?"KEY ":"")."(".implode(", ",$X[2]).")");elseif($X[2]=="DROP")$fc[]=idf_escape($X[1]);else$vg[]="CREATE INDEX ".idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q)." (".implode(", ",$X[2]).")";}if($j)array_unshift($vg,"ALTER TABLE ".table($Q).implode(",",$j));if($fc)array_unshift($vg,"DROP INDEX ".implode(", ",$fc));foreach($vg
     5529alter_indexes($Q,$c){$j=array();$gc=array();$xg=array();foreach($c
     5530as$X){if($X[0]!="INDEX")$j[]=($X[2]=="DROP"?"\nDROP CONSTRAINT ".idf_escape($X[1]):"\nADD".($X[1]!=""?" CONSTRAINT ".idf_escape($X[1]):"")." $X[0] ".($X[0]=="PRIMARY"?"KEY ":"")."(".implode(", ",$X[2]).")");elseif($X[2]=="DROP")$gc[]=idf_escape($X[1]);else$xg[]="CREATE INDEX ".idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q)." (".implode(", ",$X[2]).")";}if($j)array_unshift($xg,"ALTER TABLE ".table($Q).implode(",",$j));if($gc)array_unshift($xg,"DROP INDEX ".implode(", ",$gc));foreach($xg
    55325531as$G){if(!queries($G))return
    55335532false;}return
     
    55365535queries("TRUNCATE ".implode(", ",array_map('table',$S)));return
    55375536true;}function
    5538 drop_views($aj){return
    5539 drop_tables($aj);}function
     5537drop_views($dj){return
     5538drop_tables($dj);}function
    55405539drop_tables($S){foreach($S
    5541 as$Q){$Fh=table_status($Q);if(!queries("DROP ".strtoupper($Fh["Engine"])." ".table($Q)))return
     5540as$Q){$Hh=table_status($Q);if(!queries("DROP ".strtoupper($Hh["Engine"])." ".table($Q)))return
    55425541false;}return
    55435542true;}function
    5544 move_tables($S,$aj,$Yh){foreach(array_merge($S,$aj)as$Q){$Fh=table_status($Q);if(!queries("ALTER ".strtoupper($Fh["Engine"])." ".table($Q)." SET SCHEMA ".idf_escape($Yh)))return
     5543move_tables($S,$dj,$ai){foreach(array_merge($S,$dj)as$Q){$Hh=table_status($Q);if(!queries("ALTER ".strtoupper($Hh["Engine"])." ".table($Q)." SET SCHEMA ".idf_escape($ai)))return
    55455544false;}return
    55465545true;}function
     
    556955680;}function
    55705569explain($h,$G){return$h->query("EXPLAIN $G");}function
    5571 found_rows($R,$Z){global$h;if(preg_match("~ rows=([0-9]+)~",$h->result("EXPLAIN SELECT * FROM ".idf_escape($R["Name"]).($Z?" WHERE ".implode(" AND ",$Z):"")),$Hg))return$Hg[1];return
     5570found_rows($R,$Z){global$h;if(preg_match("~ rows=([0-9]+)~",$h->result("EXPLAIN SELECT * FROM ".idf_escape($R["Name"]).($Z?" WHERE ".implode(" AND ",$Z):"")),$Jg))return$Jg[1];return
    55725571false;}function
    55735572types(){return
     
    55805579get_vals("SELECT nspname FROM pg_namespace ORDER BY nspname");}function
    55815580get_schema(){global$h;return$h->result("SELECT current_schema()");}function
    5582 set_schema($ah){global$h,$U,$Ih;$I=$h->query("SET search_path TO ".idf_escape($ah));foreach(types()as$T){if(!isset($U[$T])){$U[$T]=0;$Ih[lang(26)][]=$T;}}return$I;}function
    5583 create_sql($Q,$Ma,$Jh){global$h;$I='';$Qg=array();$kh=array();$Fh=table_status($Q);$q=fields($Q);$x=indexes($Q);ksort($x);$Zc=foreign_keys($Q);ksort($Zc);if(!$Fh||empty($q))return
    5584 false;$I="CREATE TABLE ".idf_escape($Fh['nspname']).".".idf_escape($Fh['Name'])." (\n    ";foreach($q
    5585 as$Rc=>$p){$Rf=idf_escape($p['field']).' '.$p['full_type'].default_value($p).($p['attnotnull']?" NOT NULL":"");$Qg[]=$Rf;if(preg_match('~nextval\(\'([^\']+)\'\)~',$p['default'],$Ee)){$jh=$Ee[1];$yh=reset(get_rows(min_version(10)?"SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = ".q($jh):"SELECT * FROM $jh"));$kh[]=($Jh=="DROP+CREATE"?"DROP SEQUENCE IF EXISTS $jh;\n":"")."CREATE SEQUENCE $jh INCREMENT $yh[increment_by] MINVALUE $yh[min_value] MAXVALUE $yh[max_value] START ".($Ma?$yh['last_value']:1)." CACHE $yh[cache_value];";}}if(!empty($kh))$I=implode("\n\n",$kh)."\n\n$I";foreach($x
    5586 as$Id=>$w){switch($w['type']){case'UNIQUE':$Qg[]="CONSTRAINT ".idf_escape($Id)." UNIQUE (".implode(', ',array_map('idf_escape',$w['columns'])).")";break;case'PRIMARY':$Qg[]="CONSTRAINT ".idf_escape($Id)." PRIMARY KEY (".implode(', ',array_map('idf_escape',$w['columns'])).")";break;}}foreach($Zc
    5587 as$Yc=>$Xc)$Qg[]="CONSTRAINT ".idf_escape($Yc)." $Xc[definition] ".($Xc['deferrable']?'DEFERRABLE':'NOT DEFERRABLE');$I.=implode(",\n    ",$Qg)."\n) WITH (oids = ".($Fh['Oid']?'true':'false').");";foreach($x
    5588 as$Id=>$w){if($w['type']=='INDEX'){$f=array();foreach($w['columns']as$z=>$X)$f[]=idf_escape($X).($w['descs'][$z]?" DESC":"");$I.="\n\nCREATE INDEX ".idf_escape($Id)." ON ".idf_escape($Fh['nspname']).".".idf_escape($Fh['Name'])." USING btree (".implode(', ',$f).");";}}if($Fh['Comment'])$I.="\n\nCOMMENT ON TABLE ".idf_escape($Fh['nspname']).".".idf_escape($Fh['Name'])." IS ".q($Fh['Comment']).";";foreach($q
    5589 as$Rc=>$p){if($p['comment'])$I.="\n\nCOMMENT ON COLUMN ".idf_escape($Fh['nspname']).".".idf_escape($Fh['Name']).".".idf_escape($Rc)." IS ".q($p['comment']).";";}return
     5581set_schema($ch){global$h,$U,$Kh;$I=$h->query("SET search_path TO ".idf_escape($ch));foreach(types()as$T){if(!isset($U[$T])){$U[$T]=0;$Kh[lang(26)][]=$T;}}return$I;}function
     5582create_sql($Q,$Na,$Lh){global$h;$I='';$Sg=array();$mh=array();$Hh=table_status($Q);$q=fields($Q);$x=indexes($Q);ksort($x);$ad=foreign_keys($Q);ksort($ad);if(!$Hh||empty($q))return
     5583false;$I="CREATE TABLE ".idf_escape($Hh['nspname']).".".idf_escape($Hh['Name'])." (\n    ";foreach($q
     5584as$Sc=>$p){$Tf=idf_escape($p['field']).' '.$p['full_type'].default_value($p).($p['attnotnull']?" NOT NULL":"");$Sg[]=$Tf;if(preg_match('~nextval\(\'([^\']+)\'\)~',$p['default'],$Fe)){$lh=$Fe[1];$_h=reset(get_rows(min_version(10)?"SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = ".q($lh):"SELECT * FROM $lh"));$mh[]=($Lh=="DROP+CREATE"?"DROP SEQUENCE IF EXISTS $lh;\n":"")."CREATE SEQUENCE $lh INCREMENT $_h[increment_by] MINVALUE $_h[min_value] MAXVALUE $_h[max_value] START ".($Na?$_h['last_value']:1)." CACHE $_h[cache_value];";}}if(!empty($mh))$I=implode("\n\n",$mh)."\n\n$I";foreach($x
     5585as$Jd=>$w){switch($w['type']){case'UNIQUE':$Sg[]="CONSTRAINT ".idf_escape($Jd)." UNIQUE (".implode(', ',array_map('idf_escape',$w['columns'])).")";break;case'PRIMARY':$Sg[]="CONSTRAINT ".idf_escape($Jd)." PRIMARY KEY (".implode(', ',array_map('idf_escape',$w['columns'])).")";break;}}foreach($ad
     5586as$Zc=>$Yc)$Sg[]="CONSTRAINT ".idf_escape($Zc)." $Yc[definition] ".($Yc['deferrable']?'DEFERRABLE':'NOT DEFERRABLE');$I.=implode(",\n    ",$Sg)."\n) WITH (oids = ".($Hh['Oid']?'true':'false').");";foreach($x
     5587as$Jd=>$w){if($w['type']=='INDEX'){$f=array();foreach($w['columns']as$z=>$X)$f[]=idf_escape($X).($w['descs'][$z]?" DESC":"");$I.="\n\nCREATE INDEX ".idf_escape($Jd)." ON ".idf_escape($Hh['nspname']).".".idf_escape($Hh['Name'])." USING btree (".implode(', ',$f).");";}}if($Hh['Comment'])$I.="\n\nCOMMENT ON TABLE ".idf_escape($Hh['nspname']).".".idf_escape($Hh['Name'])." IS ".q($Hh['Comment']).";";foreach($q
     5588as$Sc=>$p){if($p['comment'])$I.="\n\nCOMMENT ON COLUMN ".idf_escape($Hh['nspname']).".".idf_escape($Hh['Name']).".".idf_escape($Sc)." IS ".q($p['comment']).";";}return
    55905589rtrim($I,';');}function
    55915590truncate_sql($Q){return"TRUNCATE ".table($Q);}function
    5592 trigger_sql($Q){$Fh=table_status($Q);$I="";foreach(triggers($Q)as$xi=>$wi){$yi=trigger($xi,$Fh['Name']);$I.="\nCREATE TRIGGER ".idf_escape($yi['Trigger'])." $yi[Timing] $yi[Events] ON ".idf_escape($Fh["nspname"]).".".idf_escape($Fh['Name'])." $yi[Type] $yi[Statement];;\n";}return$I;}function
     5591trigger_sql($Q){$Hh=table_status($Q);$I="";foreach(triggers($Q)as$zi=>$yi){$_i=trigger($zi,$Hh['Name']);$I.="\nCREATE TRIGGER ".idf_escape($_i['Trigger'])." $_i[Timing] $_i[Events] ON ".idf_escape($Hh["nspname"]).".".idf_escape($Hh['Name'])." $_i[Type] $_i[Statement];;\n";}return$I;}function
    55935592use_sql($k){return"\connect ".idf_escape($k);}function
    55945593show_variables(){return
     
    55995598convert_field($p){}function
    56005599unconvert_field($p,$I){return$I;}function
    5601 support($Pc){return
    5602 preg_match('~^(database|table|columns|sql|indexes|descidx|comment|view|'.(min_version(9.3)?'materializedview|':'').'scheme|routine|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~',$Pc);}function
     5600support($Qc){return
     5601preg_match('~^(database|table|columns|sql|indexes|descidx|comment|view|'.(min_version(9.3)?'materializedview|':'').'scheme|routine|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~',$Qc);}function
    56035602kill_process($X){return
    56045603queries("SELECT pg_terminate_backend(".number($X).")");}function
    56055604connection_id(){return"SELECT pg_backend_pid()";}function
    5606 max_connections(){global$h;return$h->result("SHOW max_connections");}$y="pgsql";$U=array();$Ih=array();foreach(array(lang(27)=>array("smallint"=>5,"integer"=>10,"bigint"=>19,"boolean"=>1,"numeric"=>0,"real"=>7,"double precision"=>16,"money"=>20),lang(28)=>array("date"=>13,"time"=>17,"timestamp"=>20,"timestamptz"=>21,"interval"=>0),lang(25)=>array("character"=>0,"character varying"=>0,"text"=>0,"tsquery"=>0,"tsvector"=>0,"uuid"=>0,"xml"=>0),lang(29)=>array("bit"=>0,"bit varying"=>0,"bytea"=>0),lang(30)=>array("cidr"=>43,"inet"=>43,"macaddr"=>17,"txid_snapshot"=>0),lang(31)=>array("box"=>0,"circle"=>0,"line"=>0,"lseg"=>0,"path"=>0,"point"=>0,"polygon"=>0),)as$z=>$X){$U+=$X;$Ih[$z]=array_keys($X);}$Ji=array();$vf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","ILIKE","ILIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$kd=array("char_length","lower","round","to_hex","to_timestamp","upper");$qd=array("avg","count","count distinct","max","min","sum");$mc=array(array("char"=>"md5","date|time"=>"now",),array(number_type()=>"+/-","date|time"=>"+ interval/- interval","char|text"=>"||",));}$ec["oracle"]="Oracle (beta)";if(isset($_GET["oracle"])){$hg=array("OCI8","PDO_OCI");define("DRIVER","oracle");if(extension_loaded("oci8")){class
     5605max_connections(){global$h;return$h->result("SHOW max_connections");}$y="pgsql";$U=array();$Kh=array();foreach(array(lang(27)=>array("smallint"=>5,"integer"=>10,"bigint"=>19,"boolean"=>1,"numeric"=>0,"real"=>7,"double precision"=>16,"money"=>20),lang(28)=>array("date"=>13,"time"=>17,"timestamp"=>20,"timestamptz"=>21,"interval"=>0),lang(25)=>array("character"=>0,"character varying"=>0,"text"=>0,"tsquery"=>0,"tsvector"=>0,"uuid"=>0,"xml"=>0),lang(29)=>array("bit"=>0,"bit varying"=>0,"bytea"=>0),lang(30)=>array("cidr"=>43,"inet"=>43,"macaddr"=>17,"txid_snapshot"=>0),lang(31)=>array("box"=>0,"circle"=>0,"line"=>0,"lseg"=>0,"path"=>0,"point"=>0,"polygon"=>0),)as$z=>$X){$U+=$X;$Kh[$z]=array_keys($X);}$Li=array();$xf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","ILIKE","ILIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$ld=array("char_length","lower","round","to_hex","to_timestamp","upper");$rd=array("avg","count","count distinct","max","min","sum");$nc=array(array("char"=>"md5","date|time"=>"now",),array(number_type()=>"+/-","date|time"=>"+ interval/- interval","char|text"=>"||",));}$fc["oracle"]="Oracle (beta)";if(isset($_GET["oracle"])){$jg=array("OCI8","PDO_OCI");define("DRIVER","oracle");if(extension_loaded("oci8")){class
    56075606Min_DB{var$extension="oci8",$_link,$_result,$server_info,$affected_rows,$errno,$error;function
    5608 _error($xc,$o){if(ini_bool("html_errors"))$o=html_entity_decode(strip_tags($o));$o=preg_replace('~^[^:]*: ~','',$o);$this->error=$o;}function
     5607_error($yc,$o){if(ini_bool("html_errors"))$o=html_entity_decode(strip_tags($o));$o=preg_replace('~^[^:]*: ~','',$o);$this->error=$o;}function
    56095608connect($N,$V,$F){$this->_link=@oci_new_connect($V,$F,$N,"AL32UTF8");if($this->_link){$this->server_info=oci_server_version($this->_link);return
    56105609true;}$o=oci_error();$this->error=$o["message"];return
     
    56135612select_db($k){return
    56145613true;}function
    5615 query($G,$Di=false){$H=oci_parse($this->_link,$G);$this->error="";if(!$H){$o=oci_error($this->_link);$this->errno=$o["code"];$this->error=$o["message"];return
     5614query($G,$Fi=false){$H=oci_parse($this->_link,$G);$this->error="";if(!$H){$o=oci_error($this->_link);$this->errno=$o["code"];$this->error=$o["message"];return
    56165615false;}set_error_handler(array($this,'_error'));$I=@oci_execute($H);restore_error_handler();if($I){if(oci_num_fields($H))return
    56175616new
     
    56495648idf_escape($v);}function
    56505649connect(){global$b;$h=new
    5651 Min_DB;$Gb=$b->credentials();if($h->connect($Gb[0],$Gb[1],$Gb[2]))return$h;return$h->error;}function
     5650Min_DB;$Ib=$b->credentials();if($h->connect($Ib[0],$Ib[1],$Ib[2]))return$h;return$h->error;}function
    56525651get_databases(){return
    56535652get_vals("SELECT tablespace_name FROM user_tablespaces");}function
    56545653limit($G,$Z,$_,$D=0,$M=" "){return($D?" * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $G$Z) t WHERE rownum <= ".($_+$D).") WHERE rnum > $D":($_!==null?" * FROM (SELECT $G$Z) WHERE rownum <= ".($_+$D):" $G$Z"));}function
    56555654limit1($Q,$G,$Z,$M="\n"){return" $G$Z";}function
    5656 db_collation($m,$pb){global$h;return$h->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'");}function
     5655db_collation($m,$qb){global$h;return$h->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'");}function
    56575656engines(){return
    56585657array();}function
     
    56645663count_tables($l){return
    56655664array();}function
    5666 table_status($C=""){$I=array();$ch=q($C);foreach(get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = '.q(DB).($C!=""?" AND table_name = $ch":"")."
    5667 UNION SELECT view_name, 'view', 0, 0 FROM user_views".($C!=""?" WHERE view_name = $ch":"")."
     5665table_status($C=""){$I=array();$eh=q($C);foreach(get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = '.q(DB).($C!=""?" AND table_name = $eh":"")."
     5666UNION SELECT view_name, 'view', 0, 0 FROM user_views".($C!=""?" WHERE view_name = $eh":"")."
    56685667ORDER BY 1")as$J){if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
    56695668is_view($R){return$R["Engine"]=="view";}function
    56705669fk_support($R){return
    56715670true;}function
    5672 fields($Q){$I=array();foreach(get_rows("SELECT * FROM all_tab_columns WHERE table_name = ".q($Q)." ORDER BY column_id")as$J){$T=$J["DATA_TYPE"];$ue="$J[DATA_PRECISION],$J[DATA_SCALE]";if($ue==",")$ue=$J["DATA_LENGTH"];$I[$J["COLUMN_NAME"]]=array("field"=>$J["COLUMN_NAME"],"full_type"=>$T.($ue?"($ue)":""),"type"=>strtolower($T),"length"=>$ue,"default"=>$J["DATA_DEFAULT"],"null"=>($J["NULLABLE"]=="Y"),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$I;}function
     5671fields($Q){$I=array();foreach(get_rows("SELECT * FROM all_tab_columns WHERE table_name = ".q($Q)." ORDER BY column_id")as$J){$T=$J["DATA_TYPE"];$ve="$J[DATA_PRECISION],$J[DATA_SCALE]";if($ve==",")$ve=$J["DATA_LENGTH"];$I[$J["COLUMN_NAME"]]=array("field"=>$J["COLUMN_NAME"],"full_type"=>$T.($ve?"($ve)":""),"type"=>strtolower($T),"length"=>$ve,"default"=>$J["DATA_DEFAULT"],"null"=>($J["NULLABLE"]=="Y"),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$I;}function
    56735672indexes($Q,$i=null){$I=array();foreach(get_rows("SELECT uic.*, uc.constraint_type
    56745673FROM user_ind_columns uic
    56755674LEFT JOIN user_constraints uc ON uic.index_name = uc.constraint_name AND uic.table_name = uc.table_name
    56765675WHERE uic.table_name = ".q($Q)."
    5677 ORDER BY uc.constraint_type, uic.column_position",$i)as$J){$Id=$J["INDEX_NAME"];$I[$Id]["type"]=($J["CONSTRAINT_TYPE"]=="P"?"PRIMARY":($J["CONSTRAINT_TYPE"]=="U"?"UNIQUE":"INDEX"));$I[$Id]["columns"][]=$J["COLUMN_NAME"];$I[$Id]["lengths"][]=($J["CHAR_LENGTH"]&&$J["CHAR_LENGTH"]!=$J["COLUMN_LENGTH"]?$J["CHAR_LENGTH"]:null);$I[$Id]["descs"][]=($J["DESCEND"]?'1':null);}return$I;}function
     5676ORDER BY uc.constraint_type, uic.column_position",$i)as$J){$Jd=$J["INDEX_NAME"];$I[$Jd]["type"]=($J["CONSTRAINT_TYPE"]=="P"?"PRIMARY":($J["CONSTRAINT_TYPE"]=="U"?"UNIQUE":"INDEX"));$I[$Jd]["columns"][]=$J["COLUMN_NAME"];$I[$Jd]["lengths"][]=($J["CHAR_LENGTH"]&&$J["CHAR_LENGTH"]!=$J["COLUMN_LENGTH"]?$J["CHAR_LENGTH"]:null);$I[$Jd]["descs"][]=($J["DESCEND"]?'1':null);}return$I;}function
    56785677view($C){$K=get_rows('SELECT text "select" FROM user_views WHERE view_name = '.q($C));return
    56795678reset($K);}function
     
    56865685explain($h,$G){$h->query("EXPLAIN PLAN FOR $G");return$h->query("SELECT * FROM plan_table");}function
    56875686found_rows($R,$Z){}function
    5688 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){$c=$fc=array();foreach($q
    5689 as$p){$X=$p[1];if($X&&$p[0]!=""&&idf_escape($p[0])!=$X[0])queries("ALTER TABLE ".table($Q)." RENAME COLUMN ".idf_escape($p[0])." TO $X[0]");if($X)$c[]=($Q!=""?($p[0]!=""?"MODIFY (":"ADD ("):"  ").implode($X).($Q!=""?")":"");else$fc[]=idf_escape($p[0]);}if($Q=="")return
    5690 queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");return(!$c||queries("ALTER TABLE ".table($Q)."\n".implode("\n",$c)))&&(!$fc||queries("ALTER TABLE ".table($Q)." DROP (".implode(", ",$fc).")"))&&($Q==$C||queries("ALTER TABLE ".table($Q)." RENAME TO ".table($C)));}function
     5687alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){$c=$gc=array();foreach($q
     5688as$p){$X=$p[1];if($X&&$p[0]!=""&&idf_escape($p[0])!=$X[0])queries("ALTER TABLE ".table($Q)." RENAME COLUMN ".idf_escape($p[0])." TO $X[0]");if($X)$c[]=($Q!=""?($p[0]!=""?"MODIFY (":"ADD ("):"  ").implode($X).($Q!=""?")":"");else$gc[]=idf_escape($p[0]);}if($Q=="")return
     5689queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");return(!$c||queries("ALTER TABLE ".table($Q)."\n".implode("\n",$c)))&&(!$gc||queries("ALTER TABLE ".table($Q)." DROP (".implode(", ",$gc).")"))&&($Q==$C||queries("ALTER TABLE ".table($Q)." RENAME TO ".table($C)));}function
    56915690foreign_keys($Q){$I=array();$G="SELECT c_list.CONSTRAINT_NAME as NAME,
    56925691c_src.COLUMN_NAME as SRC_COLUMN,
     
    57025701truncate_tables($S){return
    57035702apply_queries("TRUNCATE TABLE",$S);}function
    5704 drop_views($aj){return
    5705 apply_queries("DROP VIEW",$aj);}function
     5703drop_views($dj){return
     5704apply_queries("DROP VIEW",$dj);}function
    57065705drop_tables($S){return
    57075706apply_queries("DROP TABLE",$S);}function
     
    57115710get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX'))");}function
    57125711get_schema(){global$h;return$h->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");}function
    5713 set_schema($bh){global$h;return$h->query("ALTER SESSION SET CURRENT_SCHEMA = ".idf_escape($bh));}function
     5712set_schema($dh){global$h;return$h->query("ALTER SESSION SET CURRENT_SCHEMA = ".idf_escape($dh));}function
    57145713show_variables(){return
    57155714get_key_vals('SELECT name, display_value FROM v$parameter');}function
     
    57255724convert_field($p){}function
    57265725unconvert_field($p,$I){return$I;}function
    5727 support($Pc){return
    5728 preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view|view_trigger)$~',$Pc);}$y="oracle";$U=array();$Ih=array();foreach(array(lang(27)=>array("number"=>38,"binary_float"=>12,"binary_double"=>21),lang(28)=>array("date"=>10,"timestamp"=>29,"interval year"=>12,"interval day"=>28),lang(25)=>array("char"=>2000,"varchar2"=>4000,"nchar"=>2000,"nvarchar2"=>4000,"clob"=>4294967295,"nclob"=>4294967295),lang(29)=>array("raw"=>2000,"long raw"=>2147483648,"blob"=>4294967295,"bfile"=>4294967296),)as$z=>$X){$U+=$X;$Ih[$z]=array_keys($X);}$Ji=array();$vf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$kd=array("length","lower","round","upper");$qd=array("avg","count","count distinct","max","min","sum");$mc=array(array("date"=>"current_date","timestamp"=>"current_timestamp",),array("number|float|double"=>"+/-","date|timestamp"=>"+ interval/- interval","char|clob"=>"||",));}$ec["mssql"]="MS SQL (beta)";if(isset($_GET["mssql"])){$hg=array("SQLSRV","MSSQL","PDO_DBLIB");define("DRIVER","mssql");if(extension_loaded("sqlsrv")){class
     5726support($Qc){return
     5727preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view|view_trigger)$~',$Qc);}$y="oracle";$U=array();$Kh=array();foreach(array(lang(27)=>array("number"=>38,"binary_float"=>12,"binary_double"=>21),lang(28)=>array("date"=>10,"timestamp"=>29,"interval year"=>12,"interval day"=>28),lang(25)=>array("char"=>2000,"varchar2"=>4000,"nchar"=>2000,"nvarchar2"=>4000,"clob"=>4294967295,"nclob"=>4294967295),lang(29)=>array("raw"=>2000,"long raw"=>2147483648,"blob"=>4294967295,"bfile"=>4294967296),)as$z=>$X){$U+=$X;$Kh[$z]=array_keys($X);}$Li=array();$xf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$ld=array("length","lower","round","upper");$rd=array("avg","count","count distinct","max","min","sum");$nc=array(array("date"=>"current_date","timestamp"=>"current_timestamp",),array("number|float|double"=>"+/-","date|timestamp"=>"+ interval/- interval","char|clob"=>"||",));}$fc["mssql"]="MS SQL (beta)";if(isset($_GET["mssql"])){$jg=array("SQLSRV","MSSQL","PDO_DBLIB");define("DRIVER","mssql");if(extension_loaded("sqlsrv")){class
    57295728Min_DB{var$extension="sqlsrv",$_link,$_result,$server_info,$affected_rows,$errno,$error;function
    57305729_get_error(){$this->error="";foreach(sqlsrv_errors()as$o){$this->errno=$o["code"];$this->error.="$o[message]\n";}$this->error=rtrim($this->error);}function
    5731 connect($N,$V,$F){global$b;$m=$b->database();$yb=array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8");if($m!="")$yb["Database"]=$m;$this->_link=@sqlsrv_connect(preg_replace('~:~',',',$N),$yb);if($this->_link){$Pd=sqlsrv_server_info($this->_link);$this->server_info=$Pd['SQLServerVersion'];}else$this->_get_error();return(bool)$this->_link;}function
     5730connect($N,$V,$F){global$b;$m=$b->database();$zb=array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8");if($m!="")$zb["Database"]=$m;$this->_link=@sqlsrv_connect(preg_replace('~:~',',',$N),$zb);if($this->_link){$Qd=sqlsrv_server_info($this->_link);$this->server_info=$Qd['SQLServerVersion'];}else$this->_get_error();return(bool)$this->_link;}function
    57325731quote($P){return"'".str_replace("'","''",$P)."'";}function
    57335732select_db($k){return$this->query("USE ".idf_escape($k));}function
    5734 query($G,$Di=false){$H=sqlsrv_query($this->_link,$G);$this->error="";if(!$H){$this->_get_error();return
     5733query($G,$Fi=false){$H=sqlsrv_query($this->_link,$G);$this->error="";if(!$H){$this->_get_error();return
    57355734false;}return$this->store_result($H);}function
    57365735multi_query($G){$this->_result=sqlsrv_query($this->_link,$G);$this->error="";if(!$this->_result){$this->_get_error();return
     
    57605759select_db($k){return
    57615760mssql_select_db($k);}function
    5762 query($G,$Di=false){$H=@mssql_query($G,$this->_link);$this->error="";if(!$H){$this->error=mssql_get_last_message();return
     5761query($G,$Fi=false){$H=@mssql_query($G,$this->_link);$this->error="";if(!$H){$this->error=mssql_get_last_message();return
    57635762false;}if($H===true){$this->affected_rows=mssql_rows_affected($this->_link);return
    57645763true;}return
     
    57925791extends
    57935792Min_SQL{function
    5794 insertUpdate($Q,$K,$kg){foreach($K
    5795 as$O){$Ki=array();$Z=array();foreach($O
    5796 as$z=>$X){$Ki[]="$z = $X";if(isset($kg[idf_unescape($z)]))$Z[]="$z = $X";}if(!queries("MERGE ".table($Q)." USING (VALUES(".implode(", ",$O).")) AS source (c".implode(", c",range(1,count($O))).") ON ".implode(" AND ",$Z)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$Ki)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).");"))return
     5793insertUpdate($Q,$K,$mg){foreach($K
     5794as$O){$Mi=array();$Z=array();foreach($O
     5795as$z=>$X){$Mi[]="$z = $X";if(isset($mg[idf_unescape($z)]))$Z[]="$z = $X";}if(!queries("MERGE ".table($Q)." USING (VALUES(".implode(", ",$O).")) AS source (c".implode(", c",range(1,count($O))).") ON ".implode(" AND ",$Z)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$Mi)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).");"))return
    57975796false;}return
    57985797true;}function
     
    58025801table($v){return($_GET["ns"]!=""?idf_escape($_GET["ns"]).".":"").idf_escape($v);}function
    58035802connect(){global$b;$h=new
    5804 Min_DB;$Gb=$b->credentials();if($h->connect($Gb[0],$Gb[1],$Gb[2]))return$h;return$h->error;}function
     5803Min_DB;$Ib=$b->credentials();if($h->connect($Ib[0],$Ib[1],$Ib[2]))return$h;return$h->error;}function
    58055804get_databases(){return
    58065805get_vals("SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')");}function
     
    58085807limit1($Q,$G,$Z,$M="\n"){return
    58095808limit($G,$Z,1,0,$M);}function
    5810 db_collation($m,$pb){global$h;return$h->result("SELECT collation_name FROM sys.databases WHERE name = ".q($m));}function
     5809db_collation($m,$qb){global$h;return$h->result("SELECT collation_name FROM sys.databases WHERE name = ".q($m));}function
    58115810engines(){return
    58125811array();}function
     
    58205819fk_support($R){return
    58215820true;}function
    5822 fields($Q){$vb=get_key_vals("SELECT objname, cast(value as varchar) FROM fn_listextendedproperty('MS_DESCRIPTION', 'schema', ".q(get_schema()).", 'table', ".q($Q).", 'column', NULL)");$I=array();foreach(get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default]
     5821fields($Q){$wb=get_key_vals("SELECT objname, cast(value as varchar) FROM fn_listextendedproperty('MS_DESCRIPTION', 'schema', ".q(get_schema()).", 'table', ".q($Q).", 'column', NULL)");$I=array();foreach(get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default]
    58235822FROM sys.all_columns c
    58245823JOIN sys.all_objects o ON c.object_id = o.object_id
    58255824JOIN sys.types t ON c.user_type_id = t.user_type_id
    58265825LEFT JOIN sys.default_constraints d ON c.default_object_id = d.parent_column_id
    5827 WHERE o.schema_id = SCHEMA_ID(".q(get_schema()).") AND o.type IN ('S', 'U', 'V') AND o.name = ".q($Q))as$J){$T=$J["type"];$ue=(preg_match("~char|binary~",$T)?$J["max_length"]:($T=="decimal"?"$J[precision],$J[scale]":""));$I[$J["name"]]=array("field"=>$J["name"],"full_type"=>$T.($ue?"($ue)":""),"type"=>$T,"length"=>$ue,"default"=>$J["default"],"null"=>$J["is_nullable"],"auto_increment"=>$J["is_identity"],"collation"=>$J["collation_name"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"primary"=>$J["is_identity"],"comment"=>$vb[$J["name"]],);}return$I;}function
     5826WHERE o.schema_id = SCHEMA_ID(".q(get_schema()).") AND o.type IN ('S', 'U', 'V') AND o.name = ".q($Q))as$J){$T=$J["type"];$ve=(preg_match("~char|binary~",$T)?$J["max_length"]:($T=="decimal"?"$J[precision],$J[scale]":""));$I[$J["name"]]=array("field"=>$J["name"],"full_type"=>$T.($ve?"($ve)":""),"type"=>$T,"length"=>$ve,"default"=>$J["default"],"null"=>$J["is_nullable"],"auto_increment"=>$J["is_identity"],"collation"=>$J["collation_name"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"primary"=>$J["is_identity"],"comment"=>$wb[$J["name"]],);}return$I;}function
    58285827indexes($Q,$i=null){$I=array();foreach(get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
    58295828FROM sys.indexes i
     
    58455844true;}function
    58465845auto_increment(){return" IDENTITY".($_POST["Auto_increment"]!=""?"(".number($_POST["Auto_increment"]).",1)":"")." PRIMARY KEY";}function
    5847 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){$c=array();$vb=array();foreach($q
    5848 as$p){$e=idf_escape($p[0]);$X=$p[1];if(!$X)$c["DROP"][]=" COLUMN $e";else{$X[1]=preg_replace("~( COLLATE )'(\\w+)'~",'\1\2',$X[1]);$vb[$p[0]]=$X[5];unset($X[5]);if($p[0]=="")$c["ADD"][]="\n  ".implode("",$X).($Q==""?substr($cd[$X[0]],16+strlen($X[0])):"");else{unset($X[6]);if($e!=$X[0])queries("EXEC sp_rename ".q(table($Q).".$e").", ".q(idf_unescape($X[0])).", 'COLUMN'");$c["ALTER COLUMN ".implode("",$X)][]="";}}}if($Q=="")return
    5849 queries("CREATE TABLE ".table($C)." (".implode(",",(array)$c["ADD"])."\n)");if($Q!=$C)queries("EXEC sp_rename ".q(table($Q)).", ".q($C));if($cd)$c[""]=$cd;foreach($c
     5846alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){$c=array();$wb=array();foreach($q
     5847as$p){$e=idf_escape($p[0]);$X=$p[1];if(!$X)$c["DROP"][]=" COLUMN $e";else{$X[1]=preg_replace("~( COLLATE )'(\\w+)'~",'\1\2',$X[1]);$wb[$p[0]]=$X[5];unset($X[5]);if($p[0]=="")$c["ADD"][]="\n  ".implode("",$X).($Q==""?substr($dd[$X[0]],16+strlen($X[0])):"");else{unset($X[6]);if($e!=$X[0])queries("EXEC sp_rename ".q(table($Q).".$e").", ".q(idf_unescape($X[0])).", 'COLUMN'");$c["ALTER COLUMN ".implode("",$X)][]="";}}}if($Q=="")return
     5848queries("CREATE TABLE ".table($C)." (".implode(",",(array)$c["ADD"])."\n)");if($Q!=$C)queries("EXEC sp_rename ".q(table($Q)).", ".q($C));if($dd)$c[""]=$dd;foreach($c
    58505849as$z=>$X){if(!queries("ALTER TABLE ".idf_escape($C)." $z".implode(",",$X)))return
    5851 false;}foreach($vb
    5852 as$z=>$X){$ub=substr($X,9);queries("EXEC sp_dropextendedproperty @name = N'MS_Description', @level0type = N'Schema', @level0name = ".q(get_schema()).", @level1type = N'Table',  @level1name = ".q($C).", @level2type = N'Column', @level2name = ".q($z));queries("EXEC sp_addextendedproperty @name = N'MS_Description', @value = ".$ub.", @level0type = N'Schema', @level0name = ".q(get_schema()).", @level1type = N'Table',  @level1name = ".q($C).", @level2type = N'Column', @level2name = ".q($z));}return
     5850false;}foreach($wb
     5851as$z=>$X){$vb=substr($X,9);queries("EXEC sp_dropextendedproperty @name = N'MS_Description', @level0type = N'Schema', @level0name = ".q(get_schema()).", @level1type = N'Table',  @level1name = ".q($C).", @level2type = N'Column', @level2name = ".q($z));queries("EXEC sp_addextendedproperty @name = N'MS_Description', @value = ".$vb.", @level0type = N'Schema', @level0name = ".q(get_schema()).", @level1type = N'Table',  @level1name = ".q($C).", @level2type = N'Column', @level2name = ".q($z));}return
    58535852true;}function
    5854 alter_indexes($Q,$c){$w=array();$fc=array();foreach($c
    5855 as$X){if($X[2]=="DROP"){if($X[0]=="PRIMARY")$fc[]=idf_escape($X[1]);else$w[]=idf_escape($X[1])." ON ".table($Q);}elseif(!queries(($X[0]!="PRIMARY"?"CREATE $X[0] ".($X[0]!="INDEX"?"INDEX ":"").idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q):"ALTER TABLE ".table($Q)." ADD PRIMARY KEY")." (".implode(", ",$X[2]).")"))return
    5856 false;}return(!$w||queries("DROP INDEX ".implode(", ",$w)))&&(!$fc||queries("ALTER TABLE ".table($Q)." DROP ".implode(", ",$fc)));}function
     5853alter_indexes($Q,$c){$w=array();$gc=array();foreach($c
     5854as$X){if($X[2]=="DROP"){if($X[0]=="PRIMARY")$gc[]=idf_escape($X[1]);else$w[]=idf_escape($X[1])." ON ".table($Q);}elseif(!queries(($X[0]!="PRIMARY"?"CREATE $X[0] ".($X[0]!="INDEX"?"INDEX ":"").idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q):"ALTER TABLE ".table($Q)." ADD PRIMARY KEY")." (".implode(", ",$X[2]).")"))return
     5855false;}return(!$w||queries("DROP INDEX ".implode(", ",$w)))&&(!$gc||queries("ALTER TABLE ".table($Q)." DROP ".implode(", ",$gc)));}function
    58575856last_id(){global$h;return$h->result("SELECT SCOPE_IDENTITY()");}function
    58585857explain($h,$G){$h->query("SET SHOWPLAN_ALL ON");$I=$h->query($G);$h->query("SET SHOWPLAN_ALL OFF");return$I;}function
    58595858found_rows($R,$Z){}function
    5860 foreign_keys($Q){$I=array();foreach(get_rows("EXEC sp_fkeys @fktable_name = ".q($Q))as$J){$r=&$I[$J["FK_NAME"]];$r["table"]=$J["PKTABLE_NAME"];$r["source"][]=$J["FKCOLUMN_NAME"];$r["target"][]=$J["PKCOLUMN_NAME"];}return$I;}function
     5859foreign_keys($Q){$I=array();foreach(get_rows("EXEC sp_fkeys @fktable_name = ".q($Q))as$J){$r=&$I[$J["FK_NAME"]];$r["db"]=$J["PKTABLE_QUALIFIER"];$r["table"]=$J["PKTABLE_NAME"];$r["source"][]=$J["FKCOLUMN_NAME"];$r["target"][]=$J["PKCOLUMN_NAME"];}return$I;}function
    58615860truncate_tables($S){return
    58625861apply_queries("TRUNCATE TABLE",$S);}function
    5863 drop_views($aj){return
    5864 queries("DROP VIEW ".implode(", ",array_map('table',$aj)));}function
     5862drop_views($dj){return
     5863queries("DROP VIEW ".implode(", ",array_map('table',$dj)));}function
    58655864drop_tables($S){return
    58665865queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
    5867 move_tables($S,$aj,$Yh){return
    5868 apply_queries("ALTER SCHEMA ".idf_escape($Yh)." TRANSFER",array_merge($S,$aj));}function
     5866move_tables($S,$dj,$ai){return
     5867apply_queries("ALTER SCHEMA ".idf_escape($ai)." TRANSFER",array_merge($S,$dj));}function
    58695868trigger($C){if($C=="")return
    58705869array();$K=get_rows("SELECT s.name [Trigger],
     
    58865885get_vals("SELECT name FROM sys.schemas");}function
    58875886get_schema(){global$h;if($_GET["ns"]!="")return$_GET["ns"];return$h->result("SELECT SCHEMA_NAME()");}function
    5888 set_schema($ah){return
     5887set_schema($ch){return
    58895888true;}function
    58905889use_sql($k){return"USE ".idf_escape($k);}function
     
    58955894convert_field($p){}function
    58965895unconvert_field($p,$I){return$I;}function
    5897 support($Pc){return
    5898 preg_match('~^(comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~',$Pc);}$y="mssql";$U=array();$Ih=array();foreach(array(lang(27)=>array("tinyint"=>3,"smallint"=>5,"int"=>10,"bigint"=>20,"bit"=>1,"decimal"=>0,"real"=>12,"float"=>53,"smallmoney"=>10,"money"=>20),lang(28)=>array("date"=>10,"smalldatetime"=>19,"datetime"=>19,"datetime2"=>19,"time"=>8,"datetimeoffset"=>10),lang(25)=>array("char"=>8000,"varchar"=>8000,"text"=>2147483647,"nchar"=>4000,"nvarchar"=>4000,"ntext"=>1073741823),lang(29)=>array("binary"=>8000,"varbinary"=>8000,"image"=>2147483647),)as$z=>$X){$U+=$X;$Ih[$z]=array_keys($X);}$Ji=array();$vf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$kd=array("len","lower","round","upper");$qd=array("avg","count","count distinct","max","min","sum");$mc=array(array("date|time"=>"getdate",),array("int|decimal|real|float|money|datetime"=>"+/-","char|text"=>"+",));}$ec['firebird']='Firebird (alpha)';if(isset($_GET["firebird"])){$hg=array("interbase");define("DRIVER","firebird");if(extension_loaded("interbase")){class
     5896support($Qc){return
     5897preg_match('~^(comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~',$Qc);}$y="mssql";$U=array();$Kh=array();foreach(array(lang(27)=>array("tinyint"=>3,"smallint"=>5,"int"=>10,"bigint"=>20,"bit"=>1,"decimal"=>0,"real"=>12,"float"=>53,"smallmoney"=>10,"money"=>20),lang(28)=>array("date"=>10,"smalldatetime"=>19,"datetime"=>19,"datetime2"=>19,"time"=>8,"datetimeoffset"=>10),lang(25)=>array("char"=>8000,"varchar"=>8000,"text"=>2147483647,"nchar"=>4000,"nvarchar"=>4000,"ntext"=>1073741823),lang(29)=>array("binary"=>8000,"varbinary"=>8000,"image"=>2147483647),)as$z=>$X){$U+=$X;$Kh[$z]=array_keys($X);}$Li=array();$xf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$ld=array("len","lower","round","upper");$rd=array("avg","count","count distinct","max","min","sum");$nc=array(array("date|time"=>"getdate",),array("int|decimal|real|float|money|datetime"=>"+/-","char|text"=>"+",));}$fc['firebird']='Firebird (alpha)';if(isset($_GET["firebird"])){$jg=array("interbase");define("DRIVER","firebird");if(extension_loaded("interbase")){class
    58995898Min_DB{var$extension="Firebird",$server_info,$affected_rows,$errno,$error,$_link,$_result;function
    5900 connect($N,$V,$F){$this->_link=ibase_connect($N,$V,$F);if($this->_link){$Ni=explode(':',$N);$this->service_link=ibase_service_attach($Ni[0],$V,$F);$this->server_info=ibase_server_info($this->service_link,IBASE_SVC_SERVER_VERSION);}else{$this->errno=ibase_errcode();$this->error=ibase_errmsg();}return(bool)$this->_link;}function
     5899connect($N,$V,$F){$this->_link=ibase_connect($N,$V,$F);if($this->_link){$Pi=explode(':',$N);$this->service_link=ibase_service_attach($Pi[0],$V,$F);$this->server_info=ibase_server_info($this->service_link,IBASE_SVC_SERVER_VERSION);}else{$this->errno=ibase_errcode();$this->error=ibase_errmsg();}return(bool)$this->_link;}function
    59015900quote($P){return"'".str_replace("'","''",$P)."'";}function
    59025901select_db($k){return($k=="domain");}function
    5903 query($G,$Di=false){$H=ibase_query($G,$this->_link);if(!$H){$this->errno=ibase_errcode();$this->error=ibase_errmsg();return
     5902query($G,$Fi=false){$H=ibase_query($G,$this->_link);if(!$H){$this->errno=ibase_errcode();$this->error=ibase_errmsg();return
    59045903false;}$this->error="";if($H===true){$this->affected_rows=ibase_affected_rows($this->_link);return
    59055904true;}return
     
    59275926idf_escape($v);}function
    59285927connect(){global$b;$h=new
    5929 Min_DB;$Gb=$b->credentials();if($h->connect($Gb[0],$Gb[1],$Gb[2]))return$h;return$h->error;}function
    5930 get_databases($ad){return
     5928Min_DB;$Ib=$b->credentials();if($h->connect($Ib[0],$Ib[1],$Ib[2]))return$h;return$h->error;}function
     5929get_databases($bd){return
    59315930array("domain");}function
    59325931limit($G,$Z,$_,$D=0,$M=" "){$I='';$I.=($_!==null?$M."FIRST $_".($D?" SKIP $D":""):"");$I.=" $G$Z";return$I;}function
    59335932limit1($Q,$G,$Z,$M="\n"){return
    59345933limit($G,$Z,1,0,$M);}function
    5935 db_collation($m,$pb){}function
     5934db_collation($m,$qb){}function
    59365935engines(){return
    59375936array();}function
    5938 logged_user(){global$b;$Gb=$b->credentials();return$Gb[1];}function
     5937logged_user(){global$b;$Ib=$b->credentials();return$Ib[1];}function
    59395938tables_list(){global$h;$G='SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0';$H=ibase_query($h->_link,$G);$I=array();while($J=ibase_fetch_assoc($H))$I[$J['RDB$RELATION_NAME']]='table';ksort($I);return$I;}function
    59405939count_tables($l){return
    59415940array();}function
    5942 table_status($C="",$Oc=false){global$h;$I=array();$Lb=tables_list();foreach($Lb
     5941table_status($C="",$Pc=false){global$h;$I=array();$Nb=tables_list();foreach($Nb
    59435942as$w=>$X){$w=trim($w);$I[$w]=array('Name'=>$w,'Engine'=>'standard',);if($C==$w)return$I[$w];}return$I;}function
    59445943is_view($R){return
     
    59935992array();}function
    59945993get_schema(){return"";}function
    5995 set_schema($ah){return
     5994set_schema($ch){return
    59965995true;}function
    5997 support($Pc){return
    5998 preg_match("~^(columns|sql|status|table)$~",$Pc);}$y="firebird";$vf=array("=");$kd=array();$qd=array();$mc=array();}$ec["simpledb"]="SimpleDB";if(isset($_GET["simpledb"])){$hg=array("SimpleXML + allow_url_fopen");define("DRIVER","simpledb");if(class_exists('SimpleXMLElement')&&ini_bool('allow_url_fopen')){class
     5996support($Qc){return
     5997preg_match("~^(columns|sql|status|table)$~",$Qc);}$y="firebird";$xf=array("=");$ld=array();$rd=array();$nc=array();}$fc["simpledb"]="SimpleDB";if(isset($_GET["simpledb"])){$jg=array("SimpleXML + allow_url_fopen");define("DRIVER","simpledb");if(class_exists('SimpleXMLElement')&&ini_bool('allow_url_fopen')){class
    59995998Min_DB{var$extension="SimpleXML",$server_info='2009-04-15',$error,$timeout,$next,$affected_rows,$_result;function
    60005999select_db($k){return($k=="domain");}function
    6001 query($G,$Di=false){$Of=array('SelectExpression'=>$G,'ConsistentRead'=>'true');if($this->next)$Of['NextToken']=$this->next;$H=sdb_request_all('Select','Item',$Of,$this->timeout);$this->timeout=0;if($H===false)return$H;if(preg_match('~^\s*SELECT\s+COUNT\(~i',$G)){$Mh=0;foreach($H
    6002 as$be)$Mh+=$be->Attribute->Value;$H=array((object)array('Attribute'=>array((object)array('Name'=>'Count','Value'=>$Mh,))));}return
     6000query($G,$Fi=false){$Qf=array('SelectExpression'=>$G,'ConsistentRead'=>'true');if($this->next)$Qf['NextToken']=$this->next;$H=sdb_request_all('Select','Item',$Qf,$this->timeout);$this->timeout=0;if($H===false)return$H;if(preg_match('~^\s*SELECT\s+COUNT\(~i',$G)){$Oh=0;foreach($H
     6001as$ce)$Oh+=$ce->Attribute->Value;$H=array((object)array('Attribute'=>array((object)array('Name'=>'Count','Value'=>$Oh,))));}return
    60036002new
    60046003Min_Result($H);}function
     
    60106009Min_Result{var$num_rows,$_rows=array(),$_offset=0;function
    60116010__construct($H){foreach($H
    6012 as$be){$J=array();if($be->Name!='')$J['itemName()']=(string)$be->Name;foreach($be->Attribute
     6011as$ce){$J=array();if($ce->Name!='')$J['itemName()']=(string)$ce->Name;foreach($ce->Attribute
    60136012as$Ja){$C=$this->_processValue($Ja->Name);$Y=$this->_processValue($Ja->Value);if(isset($J[$C])){$J[$C]=(array)$J[$C];$J[$C][]=$Y;}else$J[$C]=$Y;}$this->_rows[]=$J;foreach($J
    60146013as$z=>$X){if(!isset($this->_rows[0][$z]))$this->_rows[0][$z]=null;}}$this->num_rows=count($this->_rows);}function
    6015 _processValue($pc){return(is_object($pc)&&$pc['encoding']=='base64'?base64_decode($pc):(string)$pc);}function
     6014_processValue($qc){return(is_object($qc)&&$qc['encoding']=='base64'?base64_decode($qc):(string)$qc);}function
    60166015fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$z=>$X)$I[$z]=$J[$z];next($this->_rows);return$I;}function
    60176016fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
    60186017array_values($I);}function
    6019 fetch_field(){$he=array_keys($this->_rows[0]);return(object)array('name'=>$he[$this->_offset++]);}}}class
     6018fetch_field(){$ie=array_keys($this->_rows[0]);return(object)array('name'=>$ie[$this->_offset++]);}}}class
    60206019Min_Driver
    60216020extends
    6022 Min_SQL{public$kg="itemName()";function
    6023 _chunkRequest($Ed,$wa,$Of,$Ec=array()){global$h;foreach(array_chunk($Ed,25)as$ib){$Pf=$Of;foreach($ib
    6024 as$t=>$u){$Pf["Item.$t.ItemName"]=$u;foreach($Ec
    6025 as$z=>$X)$Pf["Item.$t.$z"]=$X;}if(!sdb_request($wa,$Pf))return
    6026 false;}$h->affected_rows=count($Ed);return
     6021Min_SQL{public$mg="itemName()";function
     6022_chunkRequest($Fd,$wa,$Qf,$Fc=array()){global$h;foreach(array_chunk($Fd,25)as$jb){$Rf=$Qf;foreach($jb
     6023as$t=>$u){$Rf["Item.$t.ItemName"]=$u;foreach($Fc
     6024as$z=>$X)$Rf["Item.$t.$z"]=$X;}if(!sdb_request($wa,$Rf))return
     6025false;}$h->affected_rows=count($Fd);return
    60276026true;}function
    6028 _extractIds($Q,$wg,$_){$I=array();if(preg_match_all("~itemName\(\) = (('[^']*+')+)~",$wg,$Ee))$I=array_map('idf_unescape',$Ee[1]);else{foreach(sdb_request_all('Select','Item',array('SelectExpression'=>'SELECT itemName() FROM '.table($Q).$wg.($_?" LIMIT 1":"")))as$be)$I[]=$be->Name;}return$I;}function
    6029 select($Q,$L,$Z,$nd,$_f=array(),$_=1,$E=0,$mg=false){global$h;$h->next=$_GET["next"];$I=parent::select($Q,$L,$Z,$nd,$_f,$_,$E,$mg);$h->next=0;return$I;}function
    6030 delete($Q,$wg,$_=0){return$this->_chunkRequest($this->_extractIds($Q,$wg,$_),'BatchDeleteAttributes',array('DomainName'=>$Q));}function
    6031 update($Q,$O,$wg,$_=0,$M="\n"){$Ub=array();$Td=array();$t=0;$Ed=$this->_extractIds($Q,$wg,$_);$u=idf_unescape($O["`itemName()`"]);unset($O["`itemName()`"]);foreach($O
    6032 as$z=>$X){$z=idf_unescape($z);if($X=="NULL"||($u!=""&&array($u)!=$Ed))$Ub["Attribute.".count($Ub).".Name"]=$z;if($X!="NULL"){foreach((array)$X
    6033 as$de=>$W){$Td["Attribute.$t.Name"]=$z;$Td["Attribute.$t.Value"]=(is_array($X)?$W:idf_unescape($W));if(!$de)$Td["Attribute.$t.Replace"]="true";$t++;}}}$Of=array('DomainName'=>$Q);return(!$Td||$this->_chunkRequest(($u!=""?array($u):$Ed),'BatchPutAttributes',$Of,$Td))&&(!$Ub||$this->_chunkRequest($Ed,'BatchDeleteAttributes',$Of,$Ub));}function
    6034 insert($Q,$O){$Of=array("DomainName"=>$Q);$t=0;foreach($O
    6035 as$C=>$Y){if($Y!="NULL"){$C=idf_unescape($C);if($C=="itemName()")$Of["ItemName"]=idf_unescape($Y);else{foreach((array)$Y
    6036 as$X){$Of["Attribute.$t.Name"]=$C;$Of["Attribute.$t.Value"]=(is_array($Y)?$X:idf_unescape($Y));$t++;}}}}return
    6037 sdb_request('PutAttributes',$Of);}function
    6038 insertUpdate($Q,$K,$kg){foreach($K
     6027_extractIds($Q,$yg,$_){$I=array();if(preg_match_all("~itemName\(\) = (('[^']*+')+)~",$yg,$Fe))$I=array_map('idf_unescape',$Fe[1]);else{foreach(sdb_request_all('Select','Item',array('SelectExpression'=>'SELECT itemName() FROM '.table($Q).$yg.($_?" LIMIT 1":"")))as$ce)$I[]=$ce->Name;}return$I;}function
     6028select($Q,$L,$Z,$od,$Bf=array(),$_=1,$E=0,$og=false){global$h;$h->next=$_GET["next"];$I=parent::select($Q,$L,$Z,$od,$Bf,$_,$E,$og);$h->next=0;return$I;}function
     6029delete($Q,$yg,$_=0){return$this->_chunkRequest($this->_extractIds($Q,$yg,$_),'BatchDeleteAttributes',array('DomainName'=>$Q));}function
     6030update($Q,$O,$yg,$_=0,$M="\n"){$Wb=array();$Ud=array();$t=0;$Fd=$this->_extractIds($Q,$yg,$_);$u=idf_unescape($O["`itemName()`"]);unset($O["`itemName()`"]);foreach($O
     6031as$z=>$X){$z=idf_unescape($z);if($X=="NULL"||($u!=""&&array($u)!=$Fd))$Wb["Attribute.".count($Wb).".Name"]=$z;if($X!="NULL"){foreach((array)$X
     6032as$ee=>$W){$Ud["Attribute.$t.Name"]=$z;$Ud["Attribute.$t.Value"]=(is_array($X)?$W:idf_unescape($W));if(!$ee)$Ud["Attribute.$t.Replace"]="true";$t++;}}}$Qf=array('DomainName'=>$Q);return(!$Ud||$this->_chunkRequest(($u!=""?array($u):$Fd),'BatchPutAttributes',$Qf,$Ud))&&(!$Wb||$this->_chunkRequest($Fd,'BatchDeleteAttributes',$Qf,$Wb));}function
     6033insert($Q,$O){$Qf=array("DomainName"=>$Q);$t=0;foreach($O
     6034as$C=>$Y){if($Y!="NULL"){$C=idf_unescape($C);if($C=="itemName()")$Qf["ItemName"]=idf_unescape($Y);else{foreach((array)$Y
     6035as$X){$Qf["Attribute.$t.Name"]=$C;$Qf["Attribute.$t.Value"]=(is_array($Y)?$X:idf_unescape($Y));$t++;}}}}return
     6036sdb_request('PutAttributes',$Qf);}function
     6037insertUpdate($Q,$K,$mg){foreach($K
    60396038as$O){if(!$this->update($Q,$O,"WHERE `itemName()` = ".q($O["`itemName()`"])))return
    60406039false;}return
     
    60466045rollback(){return
    60476046false;}function
    6048 slowQuery($G,$gi){$this->_conn->timeout=$gi;return$G;}}function
     6047slowQuery($G,$ii){$this->_conn->timeout=$ii;return$G;}}function
    60496048connect(){global$b;list(,,$F)=$b->credentials();if($F!="")return
    60506049lang(22);return
    60516050new
    60526051Min_DB;}function
    6053 support($Pc){return
    6054 preg_match('~sql~',$Pc);}function
    6055 logged_user(){global$b;$Gb=$b->credentials();return$Gb[1];}function
     6052support($Qc){return
     6053preg_match('~sql~',$Qc);}function
     6054logged_user(){global$b;$Ib=$b->credentials();return$Ib[1];}function
    60566055get_databases(){return
    60576056array("domain");}function
    60586057collations(){return
    60596058array();}function
    6060 db_collation($m,$pb){}function
     6059db_collation($m,$qb){}function
    60616060tables_list(){global$h;$I=array();foreach(sdb_request_all('ListDomains','DomainName')as$Q)$I[(string)$Q]='table';if($h->error&&defined("PAGE_HEADER"))echo"<p class='error'>".error()."\n";return$I;}function
    6062 table_status($C="",$Oc=false){$I=array();foreach(($C!=""?array($C=>true):tables_list())as$Q=>$T){$J=array("Name"=>$Q,"Auto_increment"=>"");if(!$Oc){$Re=sdb_request('DomainMetadata',array('DomainName'=>$Q));if($Re){foreach(array("Rows"=>"ItemCount","Data_length"=>"ItemNamesSizeBytes","Index_length"=>"AttributeValuesSizeBytes","Data_free"=>"AttributeNamesSizeBytes",)as$z=>$X)$J[$z]=(string)$Re->$X;}}if($C!="")return$J;$I[$Q]=$J;}return$I;}function
     6061table_status($C="",$Pc=false){$I=array();foreach(($C!=""?array($C=>true):tables_list())as$Q=>$T){$J=array("Name"=>$Q,"Auto_increment"=>"");if(!$Pc){$Se=sdb_request('DomainMetadata',array('DomainName'=>$Q));if($Se){foreach(array("Rows"=>"ItemCount","Data_length"=>"ItemNamesSizeBytes","Index_length"=>"AttributeValuesSizeBytes","Data_free"=>"AttributeNamesSizeBytes",)as$z=>$X)$J[$z]=(string)$Se->$X;}}if($C!="")return$J;$I[$Q]=$J;}return$I;}function
    60636062explain($h,$G){}function
    60646063error(){global$h;return
     
    60806079engines(){return
    60816080array();}function
    6082 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){return($Q==""&&sdb_request('CreateDomain',array('DomainName'=>$C)));}function
     6081alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){return($Q==""&&sdb_request('CreateDomain',array('DomainName'=>$C)));}function
    60836082drop_tables($S){foreach($S
    60846083as$Q){if(!sdb_request('DeleteDomain',array('DomainName'=>$Q)))return
     
    60906089found_rows($R,$Z){return($Z?null:$R["Rows"]);}function
    60916090last_id(){}function
    6092 hmac($Ca,$Lb,$z,$_g=false){$Va=64;if(strlen($z)>$Va)$z=pack("H*",$Ca($z));$z=str_pad($z,$Va,"\0");$ee=$z^str_repeat("\x36",$Va);$fe=$z^str_repeat("\x5C",$Va);$I=$Ca($fe.pack("H*",$Ca($ee.$Lb)));if($_g)$I=pack("H*",$I);return$I;}function
    6093 sdb_request($wa,$Of=array()){global$b,$h;list($Ad,$Of['AWSAccessKeyId'],$dh)=$b->credentials();$Of['Action']=$wa;$Of['Timestamp']=gmdate('Y-m-d\TH:i:s+00:00');$Of['Version']='2009-04-15';$Of['SignatureVersion']=2;$Of['SignatureMethod']='HmacSHA1';ksort($Of);$G='';foreach($Of
    6094 as$z=>$X)$G.='&'.rawurlencode($z).'='.rawurlencode($X);$G=str_replace('%7E','~',substr($G,1));$G.="&Signature=".urlencode(base64_encode(hmac('sha1',"POST\n".preg_replace('~^https?://~','',$Ad)."\n/\n$G",$dh,true)));@ini_set('track_errors',1);$Tc=@file_get_contents((preg_match('~^https?://~',$Ad)?$Ad:"http://$Ad"),false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$G,'ignore_errors'=>1,))));if(!$Tc){$h->error=$php_errormsg;return
    6095 false;}libxml_use_internal_errors(true);$nj=simplexml_load_string($Tc);if(!$nj){$o=libxml_get_last_error();$h->error=$o->message;return
    6096 false;}if($nj->Errors){$o=$nj->Errors->Error;$h->error="$o->Message ($o->Code)";return
    6097 false;}$h->error='';$Xh=$wa."Result";return($nj->$Xh?$nj->$Xh:true);}function
    6098 sdb_request_all($wa,$Xh,$Of=array(),$gi=0){$I=array();$Dh=($gi?microtime(true):0);$_=(preg_match('~LIMIT\s+(\d+)\s*$~i',$Of['SelectExpression'],$B)?$B[1]:0);do{$nj=sdb_request($wa,$Of);if(!$nj)break;foreach($nj->$Xh
    6099 as$pc)$I[]=$pc;if($_&&count($I)>=$_){$_GET["next"]=$nj->NextToken;break;}if($gi&&microtime(true)-$Dh>$gi)return
    6100 false;$Of['NextToken']=$nj->NextToken;if($_)$Of['SelectExpression']=preg_replace('~\d+\s*$~',$_-count($I),$Of['SelectExpression']);}while($nj->NextToken);return$I;}$y="simpledb";$vf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","IS NOT NULL");$kd=array();$qd=array("count");$mc=array(array("json"));}$ec["mongo"]="MongoDB";if(isset($_GET["mongo"])){$hg=array("mongo","mongodb");define("DRIVER","mongo");if(class_exists('MongoDB')){class
     6091hmac($Ca,$Nb,$z,$Bg=false){$Wa=64;if(strlen($z)>$Wa)$z=pack("H*",$Ca($z));$z=str_pad($z,$Wa,"\0");$fe=$z^str_repeat("\x36",$Wa);$ge=$z^str_repeat("\x5C",$Wa);$I=$Ca($ge.pack("H*",$Ca($fe.$Nb)));if($Bg)$I=pack("H*",$I);return$I;}function
     6092sdb_request($wa,$Qf=array()){global$b,$h;list($Bd,$Qf['AWSAccessKeyId'],$fh)=$b->credentials();$Qf['Action']=$wa;$Qf['Timestamp']=gmdate('Y-m-d\TH:i:s+00:00');$Qf['Version']='2009-04-15';$Qf['SignatureVersion']=2;$Qf['SignatureMethod']='HmacSHA1';ksort($Qf);$G='';foreach($Qf
     6093as$z=>$X)$G.='&'.rawurlencode($z).'='.rawurlencode($X);$G=str_replace('%7E','~',substr($G,1));$G.="&Signature=".urlencode(base64_encode(hmac('sha1',"POST\n".preg_replace('~^https?://~','',$Bd)."\n/\n$G",$fh,true)));@ini_set('track_errors',1);$Uc=@file_get_contents((preg_match('~^https?://~',$Bd)?$Bd:"http://$Bd"),false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$G,'ignore_errors'=>1,))));if(!$Uc){$h->error=$php_errormsg;return
     6094false;}libxml_use_internal_errors(true);$qj=simplexml_load_string($Uc);if(!$qj){$o=libxml_get_last_error();$h->error=$o->message;return
     6095false;}if($qj->Errors){$o=$qj->Errors->Error;$h->error="$o->Message ($o->Code)";return
     6096false;}$h->error='';$Zh=$wa."Result";return($qj->$Zh?$qj->$Zh:true);}function
     6097sdb_request_all($wa,$Zh,$Qf=array(),$ii=0){$I=array();$Fh=($ii?microtime(true):0);$_=(preg_match('~LIMIT\s+(\d+)\s*$~i',$Qf['SelectExpression'],$B)?$B[1]:0);do{$qj=sdb_request($wa,$Qf);if(!$qj)break;foreach($qj->$Zh
     6098as$qc)$I[]=$qc;if($_&&count($I)>=$_){$_GET["next"]=$qj->NextToken;break;}if($ii&&microtime(true)-$Fh>$ii)return
     6099false;$Qf['NextToken']=$qj->NextToken;if($_)$Qf['SelectExpression']=preg_replace('~\d+\s*$~',$_-count($I),$Qf['SelectExpression']);}while($qj->NextToken);return$I;}$y="simpledb";$xf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","IS NOT NULL");$ld=array();$rd=array("count");$nc=array(array("json"));}$fc["mongo"]="MongoDB";if(isset($_GET["mongo"])){$jg=array("mongo","mongodb");define("DRIVER","mongo");if(class_exists('MongoDB')){class
    61016100Min_DB{var$extension="Mongo",$server_info=MongoClient::VERSION,$error,$last_id,$_link,$_db;function
    6102 connect($Li,$yf){return@new
    6103 MongoClient($Li,$yf);}function
     6101connect($Ni,$_f){return@new
     6102MongoClient($Ni,$_f);}function
    61046103query($G){return
    61056104false;}function
    61066105select_db($k){try{$this->_db=$this->_link->selectDB($k);return
    6107 true;}catch(Exception$Ac){$this->error=$Ac->getMessage();return
     6106true;}catch(Exception$Bc){$this->error=$Bc->getMessage();return
    61086107false;}}function
    61096108quote($P){return$P;}}class
    61106109Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
    61116110__construct($H){foreach($H
    6112 as$be){$J=array();foreach($be
     6111as$ce){$J=array();foreach($ce
    61136112as$z=>$X){if(is_a($X,'MongoBinData'))$this->_charset[$z]=63;$J[$z]=(is_a($X,'MongoId')?'ObjectId("'.strval($X).'")':(is_a($X,'MongoDate')?gmdate("Y-m-d H:i:s",$X->sec)." GMT":(is_a($X,'MongoBinData')?$X->bin:(is_a($X,'MongoRegex')?strval($X):(is_object($X)?get_class($X):$X)))));}$this->_rows[]=$J;foreach($J
    61146113as$z=>$X){if(!isset($this->_rows[0][$z]))$this->_rows[0][$z]=null;}}$this->num_rows=count($this->_rows);}function
     
    61166115fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
    61176116array_values($I);}function
    6118 fetch_field(){$he=array_keys($this->_rows[0]);$C=$he[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
     6117fetch_field(){$ie=array_keys($this->_rows[0]);$C=$ie[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
    61196118Min_Driver
    61206119extends
    6121 Min_SQL{public$kg="_id";function
    6122 select($Q,$L,$Z,$nd,$_f=array(),$_=1,$E=0,$mg=false){$L=($L==array("*")?array():array_fill_keys($L,true));$vh=array();foreach($_f
    6123 as$X){$X=preg_replace('~ DESC$~','',$X,1,$Eb);$vh[$X]=($Eb?-1:1);}return
     6120Min_SQL{public$mg="_id";function
     6121select($Q,$L,$Z,$od,$Bf=array(),$_=1,$E=0,$og=false){$L=($L==array("*")?array():array_fill_keys($L,true));$xh=array();foreach($Bf
     6122as$X){$X=preg_replace('~ DESC$~','',$X,1,$Fb);$xh[$X]=($Fb?-1:1);}return
    61246123new
    6125 Min_Result($this->_conn->_db->selectCollection($Q)->find(array(),$L)->sort($vh)->limit($_!=""?+$_:0)->skip($E*$_));}function
    6126 insert($Q,$O){try{$I=$this->_conn->_db->selectCollection($Q)->insert($O);$this->_conn->errno=$I['code'];$this->_conn->error=$I['err'];$this->_conn->last_id=$O['_id'];return!$I['err'];}catch(Exception$Ac){$this->_conn->error=$Ac->getMessage();return
     6124Min_Result($this->_conn->_db->selectCollection($Q)->find(array(),$L)->sort($xh)->limit($_!=""?+$_:0)->skip($E*$_));}function
     6125insert($Q,$O){try{$I=$this->_conn->_db->selectCollection($Q)->insert($O);$this->_conn->errno=$I['code'];$this->_conn->error=$I['err'];$this->_conn->last_id=$O['_id'];return!$I['err'];}catch(Exception$Bc){$this->_conn->error=$Bc->getMessage();return
    61276126false;}}}function
    6128 get_databases($ad){global$h;$I=array();$Qb=$h->_link->listDBs();foreach($Qb['databases']as$m)$I[]=$m['name'];return$I;}function
     6127get_databases($bd){global$h;$I=array();$Sb=$h->_link->listDBs();foreach($Sb['databases']as$m)$I[]=$m['name'];return$I;}function
    61296128count_tables($l){global$h;$I=array();foreach($l
    61306129as$m)$I[$m]=count($h->_link->selectDB($m)->getCollectionNames(true));return$I;}function
     
    61326131array_fill_keys($h->_db->getCollectionNames(true),'table');}function
    61336132drop_databases($l){global$h;foreach($l
    6134 as$m){$Mg=$h->_link->selectDB($m)->drop();if(!$Mg['ok'])return
     6133as$m){$Og=$h->_link->selectDB($m)->drop();if(!$Og['ok'])return
    61356134false;}return
    61366135true;}function
    6137 indexes($Q,$i=null){global$h;$I=array();foreach($h->_db->selectCollection($Q)->getIndexInfo()as$w){$Xb=array();foreach($w["key"]as$e=>$T)$Xb[]=($T==-1?'1':null);$I[$w["name"]]=array("type"=>($w["name"]=="_id_"?"PRIMARY":($w["unique"]?"UNIQUE":"INDEX")),"columns"=>array_keys($w["key"]),"lengths"=>array(),"descs"=>$Xb,);}return$I;}function
     6136indexes($Q,$i=null){global$h;$I=array();foreach($h->_db->selectCollection($Q)->getIndexInfo()as$w){$Zb=array();foreach($w["key"]as$e=>$T)$Zb[]=($T==-1?'1':null);$I[$w["name"]]=array("type"=>($w["name"]=="_id_"?"PRIMARY":($w["unique"]?"UNIQUE":"INDEX")),"columns"=>array_keys($w["key"]),"lengths"=>array(),"descs"=>$Zb,);}return$I;}function
    61386137fields($Q){return
    61396138fields_from_edit();}function
    6140 found_rows($R,$Z){global$h;return$h->_db->selectCollection($_GET["select"])->count($Z);}$vf=array("=");}elseif(class_exists('MongoDB\Driver\Manager')){class
     6139found_rows($R,$Z){global$h;return$h->_db->selectCollection($_GET["select"])->count($Z);}$xf=array("=");}elseif(class_exists('MongoDB\Driver\Manager')){class
    61416140Min_DB{var$extension="MongoDB",$server_info=MONGODB_VERSION,$error,$last_id;var$_link;var$_db,$_db_name;function
    6142 connect($Li,$yf){$kb='MongoDB\Driver\Manager';return
    6143 new$kb($Li,$yf);}function
     6141connect($Ni,$_f){$lb='MongoDB\Driver\Manager';return
     6142new$lb($Ni,$_f);}function
    61446143query($G){return
    61456144false;}function
     
    61496148Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
    61506149__construct($H){foreach($H
    6151 as$be){$J=array();foreach($be
     6150as$ce){$J=array();foreach($ce
    61526151as$z=>$X){if(is_a($X,'MongoDB\BSON\Binary'))$this->_charset[$z]=63;$J[$z]=(is_a($X,'MongoDB\BSON\ObjectID')?'MongoDB\BSON\ObjectID("'.strval($X).'")':(is_a($X,'MongoDB\BSON\UTCDatetime')?$X->toDateTime()->format('Y-m-d H:i:s'):(is_a($X,'MongoDB\BSON\Binary')?$X->bin:(is_a($X,'MongoDB\BSON\Regex')?strval($X):(is_object($X)?json_encode($X,256):$X)))));}$this->_rows[]=$J;foreach($J
    61536152as$z=>$X){if(!isset($this->_rows[0][$z]))$this->_rows[0][$z]=null;}}$this->num_rows=$H->count;}function
     
    61556154fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
    61566155array_values($I);}function
    6157 fetch_field(){$he=array_keys($this->_rows[0]);$C=$he[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
     6156fetch_field(){$ie=array_keys($this->_rows[0]);$C=$ie[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
    61586157Min_Driver
    61596158extends
    6160 Min_SQL{public$kg="_id";function
    6161 select($Q,$L,$Z,$nd,$_f=array(),$_=1,$E=0,$mg=false){global$h;$L=($L==array("*")?array():array_fill_keys($L,1));if(count($L)&&!isset($L['_id']))$L['_id']=0;$Z=where_to_query($Z);$vh=array();foreach($_f
    6162 as$X){$X=preg_replace('~ DESC$~','',$X,1,$Eb);$vh[$X]=($Eb?-1:1);}if(isset($_GET['limit'])&&is_numeric($_GET['limit'])&&$_GET['limit']>0)$_=$_GET['limit'];$_=min(200,max(1,(int)$_));$sh=$E*$_;$kb='MongoDB\Driver\Query';$G=new$kb($Z,array('projection'=>$L,'limit'=>$_,'skip'=>$sh,'sort'=>$vh));$Pg=$h->_link->executeQuery("$h->_db_name.$Q",$G);return
     6159Min_SQL{public$mg="_id";function
     6160select($Q,$L,$Z,$od,$Bf=array(),$_=1,$E=0,$og=false){global$h;$L=($L==array("*")?array():array_fill_keys($L,1));if(count($L)&&!isset($L['_id']))$L['_id']=0;$Z=where_to_query($Z);$xh=array();foreach($Bf
     6161as$X){$X=preg_replace('~ DESC$~','',$X,1,$Fb);$xh[$X]=($Fb?-1:1);}if(isset($_GET['limit'])&&is_numeric($_GET['limit'])&&$_GET['limit']>0)$_=$_GET['limit'];$_=min(200,max(1,(int)$_));$uh=$E*$_;$lb='MongoDB\Driver\Query';$G=new$lb($Z,array('projection'=>$L,'limit'=>$_,'skip'=>$uh,'sort'=>$xh));$Rg=$h->_link->executeQuery("$h->_db_name.$Q",$G);return
    61636162new
    6164 Min_Result($Pg);}function
    6165 update($Q,$O,$wg,$_=0,$M="\n"){global$h;$m=$h->_db_name;$Z=sql_query_where_parser($wg);$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());if(isset($O['_id']))unset($O['_id']);$Jg=array();foreach($O
    6166 as$z=>$Y){if($Y=='NULL'){$Jg[$z]=1;unset($O[$z]);}}$Ki=array('$set'=>$O);if(count($Jg))$Ki['$unset']=$Jg;$Za->update($Z,$Ki,array('upsert'=>false));$Pg=$h->_link->executeBulkWrite("$m.$Q",$Za);$h->affected_rows=$Pg->getModifiedCount();return
     6163Min_Result($Rg);}function
     6164update($Q,$O,$yg,$_=0,$M="\n"){global$h;$m=$h->_db_name;$Z=sql_query_where_parser($yg);$lb='MongoDB\Driver\BulkWrite';$ab=new$lb(array());if(isset($O['_id']))unset($O['_id']);$Lg=array();foreach($O
     6165as$z=>$Y){if($Y=='NULL'){$Lg[$z]=1;unset($O[$z]);}}$Mi=array('$set'=>$O);if(count($Lg))$Mi['$unset']=$Lg;$ab->update($Z,$Mi,array('upsert'=>false));$Rg=$h->_link->executeBulkWrite("$m.$Q",$ab);$h->affected_rows=$Rg->getModifiedCount();return
    61676166true;}function
    6168 delete($Q,$wg,$_=0){global$h;$m=$h->_db_name;$Z=sql_query_where_parser($wg);$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());$Za->delete($Z,array('limit'=>$_));$Pg=$h->_link->executeBulkWrite("$m.$Q",$Za);$h->affected_rows=$Pg->getDeletedCount();return
     6167delete($Q,$yg,$_=0){global$h;$m=$h->_db_name;$Z=sql_query_where_parser($yg);$lb='MongoDB\Driver\BulkWrite';$ab=new$lb(array());$ab->delete($Z,array('limit'=>$_));$Rg=$h->_link->executeBulkWrite("$m.$Q",$ab);$h->affected_rows=$Rg->getDeletedCount();return
    61696168true;}function
    6170 insert($Q,$O){global$h;$m=$h->_db_name;$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());if(isset($O['_id'])&&empty($O['_id']))unset($O['_id']);$Za->insert($O);$Pg=$h->_link->executeBulkWrite("$m.$Q",$Za);$h->affected_rows=$Pg->getInsertedCount();return
     6169insert($Q,$O){global$h;$m=$h->_db_name;$lb='MongoDB\Driver\BulkWrite';$ab=new$lb(array());if(isset($O['_id'])&&empty($O['_id']))unset($O['_id']);$ab->insert($O);$Rg=$h->_link->executeBulkWrite("$m.$Q",$ab);$h->affected_rows=$Rg->getInsertedCount();return
    61716170true;}}function
    6172 get_databases($ad){global$h;$I=array();$kb='MongoDB\Driver\Command';$sb=new$kb(array('listDatabases'=>1));$Pg=$h->_link->executeCommand('admin',$sb);foreach($Pg
    6173 as$Qb){foreach($Qb->databases
     6171get_databases($bd){global$h;$I=array();$lb='MongoDB\Driver\Command';$tb=new$lb(array('listDatabases'=>1));$Rg=$h->_link->executeCommand('admin',$tb);foreach($Rg
     6172as$Sb){foreach($Sb->databases
    61746173as$m)$I[]=$m->name;}return$I;}function
    61756174count_tables($l){$I=array();return$I;}function
    6176 tables_list(){global$h;$kb='MongoDB\Driver\Command';$sb=new$kb(array('listCollections'=>1));$Pg=$h->_link->executeCommand($h->_db_name,$sb);$qb=array();foreach($Pg
    6177 as$H)$qb[$H->name]='table';return$qb;}function
     6175tables_list(){global$h;$lb='MongoDB\Driver\Command';$tb=new$lb(array('listCollections'=>1));$Rg=$h->_link->executeCommand($h->_db_name,$tb);$rb=array();foreach($Rg
     6176as$H)$rb[$H->name]='table';return$rb;}function
    61786177drop_databases($l){return
    61796178false;}function
    6180 indexes($Q,$i=null){global$h;$I=array();$kb='MongoDB\Driver\Command';$sb=new$kb(array('listIndexes'=>$Q));$Pg=$h->_link->executeCommand($h->_db_name,$sb);foreach($Pg
    6181 as$w){$Xb=array();$f=array();foreach(get_object_vars($w->key)as$e=>$T){$Xb[]=($T==-1?'1':null);$f[]=$e;}$I[$w->name]=array("type"=>($w->name=="_id_"?"PRIMARY":(isset($w->unique)?"UNIQUE":"INDEX")),"columns"=>$f,"lengths"=>array(),"descs"=>$Xb,);}return$I;}function
     6179indexes($Q,$i=null){global$h;$I=array();$lb='MongoDB\Driver\Command';$tb=new$lb(array('listIndexes'=>$Q));$Rg=$h->_link->executeCommand($h->_db_name,$tb);foreach($Rg
     6180as$w){$Zb=array();$f=array();foreach(get_object_vars($w->key)as$e=>$T){$Zb[]=($T==-1?'1':null);$f[]=$e;}$I[$w->name]=array("type"=>($w->name=="_id_"?"PRIMARY":(isset($w->unique)?"UNIQUE":"INDEX")),"columns"=>$f,"lengths"=>array(),"descs"=>$Zb,);}return$I;}function
    61826181fields($Q){$q=fields_from_edit();if(!count($q)){global$n;$H=$n->select($Q,array("*"),null,null,array(),10);while($J=$H->fetch_assoc()){foreach($J
    61836182as$z=>$X){$J[$z]=null;$q[$z]=array("field"=>$z,"type"=>"string","null"=>($z!=$n->primary),"auto_increment"=>($z==$n->primary),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1,),);}}}return$q;}function
    6184 found_rows($R,$Z){global$h;$Z=where_to_query($Z);$kb='MongoDB\Driver\Command';$sb=new$kb(array('count'=>$R['Name'],'query'=>$Z));$Pg=$h->_link->executeCommand($h->_db_name,$sb);$oi=$Pg->toArray();return$oi[0]->n;}function
    6185 sql_query_where_parser($wg){$wg=trim(preg_replace('/WHERE[\s]?[(]?\(?/','',$wg));$wg=preg_replace('/\)\)\)$/',')',$wg);$kj=explode(' AND ',$wg);$lj=explode(') OR (',$wg);$Z=array();foreach($kj
    6186 as$ij)$Z[]=trim($ij);if(count($lj)==1)$lj=array();elseif(count($lj)>1)$Z=array();return
    6187 where_to_query($Z,$lj);}function
    6188 where_to_query($gj=array(),$hj=array()){global$b;$Lb=array();foreach(array('and'=>$gj,'or'=>$hj)as$T=>$Z){if(is_array($Z)){foreach($Z
    6189 as$Hc){list($nb,$tf,$X)=explode(" ",$Hc,3);if($nb=="_id"){$X=str_replace('MongoDB\BSON\ObjectID("',"",$X);$X=str_replace('")',"",$X);$kb='MongoDB\BSON\ObjectID';$X=new$kb($X);}if(!in_array($tf,$b->operators))continue;if(preg_match('~^\(f\)(.+)~',$tf,$B)){$X=(float)$X;$tf=$B[1];}elseif(preg_match('~^\(date\)(.+)~',$tf,$B)){$Nb=new
    6190 DateTime($X);$kb='MongoDB\BSON\UTCDatetime';$X=new$kb($Nb->getTimestamp()*1000);$tf=$B[1];}switch($tf){case'=':$tf='$eq';break;case'!=':$tf='$ne';break;case'>':$tf='$gt';break;case'<':$tf='$lt';break;case'>=':$tf='$gte';break;case'<=':$tf='$lte';break;case'regex':$tf='$regex';break;default:continue
    6191 2;}if($T=='and')$Lb['$and'][]=array($nb=>array($tf=>$X));elseif($T=='or')$Lb['$or'][]=array($nb=>array($tf=>$X));}}}return$Lb;}$vf=array("=","!=",">","<",">=","<=","regex","(f)=","(f)!=","(f)>","(f)<","(f)>=","(f)<=","(date)=","(date)!=","(date)>","(date)<","(date)>=","(date)<=",);}function
     6183found_rows($R,$Z){global$h;$Z=where_to_query($Z);$lb='MongoDB\Driver\Command';$tb=new$lb(array('count'=>$R['Name'],'query'=>$Z));$Rg=$h->_link->executeCommand($h->_db_name,$tb);$qi=$Rg->toArray();return$qi[0]->n;}function
     6184sql_query_where_parser($yg){$yg=trim(preg_replace('/WHERE[\s]?[(]?\(?/','',$yg));$yg=preg_replace('/\)\)\)$/',')',$yg);$nj=explode(' AND ',$yg);$oj=explode(') OR (',$yg);$Z=array();foreach($nj
     6185as$lj)$Z[]=trim($lj);if(count($oj)==1)$oj=array();elseif(count($oj)>1)$Z=array();return
     6186where_to_query($Z,$oj);}function
     6187where_to_query($jj=array(),$kj=array()){global$b;$Nb=array();foreach(array('and'=>$jj,'or'=>$kj)as$T=>$Z){if(is_array($Z)){foreach($Z
     6188as$Ic){list($ob,$vf,$X)=explode(" ",$Ic,3);if($ob=="_id"){$X=str_replace('MongoDB\BSON\ObjectID("',"",$X);$X=str_replace('")',"",$X);$lb='MongoDB\BSON\ObjectID';$X=new$lb($X);}if(!in_array($vf,$b->operators))continue;if(preg_match('~^\(f\)(.+)~',$vf,$B)){$X=(float)$X;$vf=$B[1];}elseif(preg_match('~^\(date\)(.+)~',$vf,$B)){$Pb=new
     6189DateTime($X);$lb='MongoDB\BSON\UTCDatetime';$X=new$lb($Pb->getTimestamp()*1000);$vf=$B[1];}switch($vf){case'=':$vf='$eq';break;case'!=':$vf='$ne';break;case'>':$vf='$gt';break;case'<':$vf='$lt';break;case'>=':$vf='$gte';break;case'<=':$vf='$lte';break;case'regex':$vf='$regex';break;default:continue
     61902;}if($T=='and')$Nb['$and'][]=array($ob=>array($vf=>$X));elseif($T=='or')$Nb['$or'][]=array($ob=>array($vf=>$X));}}}return$Nb;}$xf=array("=","!=",">","<",">=","<=","regex","(f)=","(f)!=","(f)>","(f)<","(f)>=","(f)<=","(date)=","(date)!=","(date)>","(date)<","(date)>=","(date)<=",);}function
    61926191table($v){return$v;}function
    61936192idf_escape($v){return$v;}function
    6194 table_status($C="",$Oc=false){$I=array();foreach(tables_list()as$Q=>$T){$I[$Q]=array("Name"=>$Q);if($C==$Q)return$I[$Q];}return$I;}function
     6193table_status($C="",$Pc=false){$I=array();foreach(tables_list()as$Q=>$T){$I[$Q]=array("Name"=>$Q);if($C==$Q)return$I[$Q];}return$I;}function
    61956194create_database($m,$d){return
    61966195true;}function
     
    62006199collations(){return
    62016200array();}function
    6202 logged_user(){global$b;$Gb=$b->credentials();return$Gb[1];}function
     6201logged_user(){global$b;$Ib=$b->credentials();return$Ib[1];}function
    62036202connect(){global$b;$h=new
    6204 Min_DB;list($N,$V,$F)=$b->credentials();$yf=array();if($V.$F!=""){$yf["username"]=$V;$yf["password"]=$F;}$m=$b->database();if($m!="")$yf["db"]=$m;try{$h->_link=$h->connect("mongodb://$N",$yf);if($F!=""){$yf["password"]="";try{$h->connect("mongodb://$N",$yf);return
    6205 lang(22);}catch(Exception$Ac){}}return$h;}catch(Exception$Ac){return$Ac->getMessage();}}function
     6203Min_DB;list($N,$V,$F)=$b->credentials();$_f=array();if($V.$F!=""){$_f["username"]=$V;$_f["password"]=$F;}$m=$b->database();if($m!="")$_f["db"]=$m;if(($Ma=getenv("MONGO_AUTH_SOURCE")))$_f["authSource"]=$Ma;try{$h->_link=$h->connect("mongodb://$N",$_f);if($F!=""){$_f["password"]="";try{$h->connect("mongodb://$N",$_f);return
     6204lang(22);}catch(Exception$Bc){}}return$h;}catch(Exception$Bc){return$Bc->getMessage();}}function
    62066205alter_indexes($Q,$c){global$h;foreach($c
    62076206as$X){list($T,$C,$O)=$X;if($O=="DROP")$I=$h->_db->command(array("deleteIndexes"=>$Q,"index"=>$C));else{$f=array();foreach($O
    6208 as$e){$e=preg_replace('~ DESC$~','',$e,1,$Eb);$f[$e]=($Eb?-1:1);}$I=$h->_db->selectCollection($Q)->ensureIndex($f,array("unique"=>($T=="UNIQUE"),"name"=>$C,));}if($I['errmsg']){$h->error=$I['errmsg'];return
     6207as$e){$e=preg_replace('~ DESC$~','',$e,1,$Fb);$f[$e]=($Fb?-1:1);}$I=$h->_db->selectCollection($Q)->ensureIndex($f,array("unique"=>($T=="UNIQUE"),"name"=>$C,));}if($I['errmsg']){$h->error=$I['errmsg'];return
    62096208false;}}return
    62106209true;}function
    6211 support($Pc){return
    6212 preg_match("~database|indexes|descidx~",$Pc);}function
    6213 db_collation($m,$pb){}function
     6210support($Qc){return
     6211preg_match("~database|indexes|descidx~",$Qc);}function
     6212db_collation($m,$qb){}function
    62146213information_schema(){}function
    62156214is_view($R){}function
     
    62216220engines(){return
    62226221array();}function
    6223 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){global$h;if($Q==""){$h->_db->createCollection($C);return
     6222alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){global$h;if($Q==""){$h->_db->createCollection($C);return
    62246223true;}}function
    62256224drop_tables($S){global$h;foreach($S
    6226 as$Q){$Mg=$h->_db->selectCollection($Q)->drop();if(!$Mg['ok'])return
     6225as$Q){$Og=$h->_db->selectCollection($Q)->drop();if(!$Og['ok'])return
    62276226false;}return
    62286227true;}function
    62296228truncate_tables($S){global$h;foreach($S
    6230 as$Q){$Mg=$h->_db->selectCollection($Q)->remove();if(!$Mg['ok'])return
     6229as$Q){$Og=$h->_db->selectCollection($Q)->remove();if(!$Og['ok'])return
    62316230false;}return
    6232 true;}$y="mongo";$kd=array();$qd=array();$mc=array(array("json"));}$ec["elastic"]="Elasticsearch (beta)";if(isset($_GET["elastic"])){$hg=array("json + allow_url_fopen");define("DRIVER","elastic");if(function_exists('json_decode')&&ini_bool('allow_url_fopen')){class
     6231true;}$y="mongo";$ld=array();$rd=array();$nc=array(array("json"));}$fc["elastic"]="Elasticsearch (beta)";if(isset($_GET["elastic"])){$jg=array("json + allow_url_fopen");define("DRIVER","elastic");if(function_exists('json_decode')&&ini_bool('allow_url_fopen')){class
    62336232Min_DB{var$extension="JSON",$server_info,$errno,$error,$_url;function
    6234 rootQuery($Yf,$_b=array(),$Se='GET'){@ini_set('track_errors',1);$Tc=@file_get_contents("$this->_url/".ltrim($Yf,'/'),false,stream_context_create(array('http'=>array('method'=>$Se,'content'=>$_b===null?$_b:json_encode($_b),'header'=>'Content-Type: application/json','ignore_errors'=>1,))));if(!$Tc){$this->error=$php_errormsg;return$Tc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Tc;return
    6235 false;}$I=json_decode($Tc,true);if($I===null){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$zb=get_defined_constants(true);foreach($zb['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return$I;}function
    6236 query($Yf,$_b=array(),$Se='GET'){return$this->rootQuery(($this->_db!=""?"$this->_db/":"/").ltrim($Yf,'/'),$_b,$Se);}function
     6233rootQuery($ag,$Ab=array(),$Te='GET'){@ini_set('track_errors',1);$Uc=@file_get_contents("$this->_url/".ltrim($ag,'/'),false,stream_context_create(array('http'=>array('method'=>$Te,'content'=>$Ab===null?$Ab:json_encode($Ab),'header'=>'Content-Type: application/json','ignore_errors'=>1,))));if(!$Uc){$this->error=$php_errormsg;return$Uc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Uc;return
     6234false;}$I=json_decode($Uc,true);if($I===null){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$_b=get_defined_constants(true);foreach($_b['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return$I;}function
     6235query($ag,$Ab=array(),$Te='GET'){return$this->rootQuery(($this->_db!=""?"$this->_db/":"/").ltrim($ag,'/'),$Ab,$Te);}function
    62376236connect($N,$V,$F){preg_match('~^(https?://)?(.*)~',$N,$B);$this->_url=($B[1]?$B[1]:"http://")."$V:$F@$B[2]";$I=$this->query('');if($I)$this->server_info=$I['version']['number'];return(bool)$I;}function
    62386237select_db($k){$this->_db=$k;return
     
    62476246extends
    62486247Min_SQL{function
    6249 select($Q,$L,$Z,$nd,$_f=array(),$_=1,$E=0,$mg=false){global$b;$Lb=array();$G="$Q/_search";if($L!=array("*"))$Lb["fields"]=$L;if($_f){$vh=array();foreach($_f
    6250 as$nb){$nb=preg_replace('~ DESC$~','',$nb,1,$Eb);$vh[]=($Eb?array($nb=>"desc"):$nb);}$Lb["sort"]=$vh;}if($_){$Lb["size"]=+$_;if($E)$Lb["from"]=($E*$_);}foreach($Z
    6251 as$X){list($nb,$tf,$X)=explode(" ",$X,3);if($nb=="_id")$Lb["query"]["ids"]["values"][]=$X;elseif($nb.$X!=""){$bi=array("term"=>array(($nb!=""?$nb:"_all")=>$X));if($tf=="=")$Lb["query"]["filtered"]["filter"]["and"][]=$bi;else$Lb["query"]["filtered"]["query"]["bool"]["must"][]=$bi;}}if($Lb["query"]&&!$Lb["query"]["filtered"]["query"]&&!$Lb["query"]["ids"])$Lb["query"]["filtered"]["query"]=array("match_all"=>array());$Dh=microtime(true);$ch=$this->_conn->query($G,$Lb);if($mg)echo$b->selectQuery("$G: ".json_encode($Lb),$Dh,!$ch);if(!$ch)return
    6252 false;$I=array();foreach($ch['hits']['hits']as$_d){$J=array();if($L==array("*"))$J["_id"]=$_d["_id"];$q=$_d['_source'];if($L!=array("*")){$q=array();foreach($L
    6253 as$z)$q[$z]=$_d['fields'][$z];}foreach($q
    6254 as$z=>$X){if($Lb["fields"])$X=$X[0];$J[$z]=(is_array($X)?json_encode($X):$X);}$I[]=$J;}return
     6248select($Q,$L,$Z,$od,$Bf=array(),$_=1,$E=0,$og=false){global$b;$Nb=array();$G="$Q/_search";if($L!=array("*"))$Nb["fields"]=$L;if($Bf){$xh=array();foreach($Bf
     6249as$ob){$ob=preg_replace('~ DESC$~','',$ob,1,$Fb);$xh[]=($Fb?array($ob=>"desc"):$ob);}$Nb["sort"]=$xh;}if($_){$Nb["size"]=+$_;if($E)$Nb["from"]=($E*$_);}foreach($Z
     6250as$X){list($ob,$vf,$X)=explode(" ",$X,3);if($ob=="_id")$Nb["query"]["ids"]["values"][]=$X;elseif($ob.$X!=""){$di=array("term"=>array(($ob!=""?$ob:"_all")=>$X));if($vf=="=")$Nb["query"]["filtered"]["filter"]["and"][]=$di;else$Nb["query"]["filtered"]["query"]["bool"]["must"][]=$di;}}if($Nb["query"]&&!$Nb["query"]["filtered"]["query"]&&!$Nb["query"]["ids"])$Nb["query"]["filtered"]["query"]=array("match_all"=>array());$Fh=microtime(true);$eh=$this->_conn->query($G,$Nb);if($og)echo$b->selectQuery("$G: ".json_encode($Nb),$Fh,!$eh);if(!$eh)return
     6251false;$I=array();foreach($eh['hits']['hits']as$Ad){$J=array();if($L==array("*"))$J["_id"]=$Ad["_id"];$q=$Ad['_source'];if($L!=array("*")){$q=array();foreach($L
     6252as$z)$q[$z]=$Ad['fields'][$z];}foreach($q
     6253as$z=>$X){if($Nb["fields"])$X=$X[0];$J[$z]=(is_array($X)?json_encode($X):$X);}$I[]=$J;}return
    62556254new
    62566255Min_Result($I);}function
    6257 update($T,$Ag,$wg,$_=0,$M="\n"){$Wf=preg_split('~ *= *~',$wg);if(count($Wf)==2){$u=trim($Wf[1]);$G="$T/$u";return$this->_conn->query($G,$Ag,'POST');}return
     6256update($T,$Cg,$yg,$_=0,$M="\n"){$Yf=preg_split('~ *= *~',$yg);if(count($Yf)==2){$u=trim($Yf[1]);$G="$T/$u";return$this->_conn->query($G,$Cg,'POST');}return
    62586257false;}function
    6259 insert($T,$Ag){$u="";$G="$T/$u";$Mg=$this->_conn->query($G,$Ag,'POST');$this->_conn->last_id=$Mg['_id'];return$Mg['created'];}function
    6260 delete($T,$wg,$_=0){$Ed=array();if(is_array($_GET["where"])&&$_GET["where"]["_id"])$Ed[]=$_GET["where"]["_id"];if(is_array($_POST['check'])){foreach($_POST['check']as$db){$Wf=preg_split('~ *= *~',$db);if(count($Wf)==2)$Ed[]=trim($Wf[1]);}}$this->_conn->affected_rows=0;foreach($Ed
    6261 as$u){$G="{$T}/{$u}";$Mg=$this->_conn->query($G,'{}','DELETE');if(is_array($Mg)&&$Mg['found']==true)$this->_conn->affected_rows++;}return$this->_conn->affected_rows;}}function
     6258insert($T,$Cg){$u="";$G="$T/$u";$Og=$this->_conn->query($G,$Cg,'POST');$this->_conn->last_id=$Og['_id'];return$Og['created'];}function
     6259delete($T,$yg,$_=0){$Fd=array();if(is_array($_GET["where"])&&$_GET["where"]["_id"])$Fd[]=$_GET["where"]["_id"];if(is_array($_POST['check'])){foreach($_POST['check']as$eb){$Yf=preg_split('~ *= *~',$eb);if(count($Yf)==2)$Fd[]=trim($Yf[1]);}}$this->_conn->affected_rows=0;foreach($Fd
     6260as$u){$G="{$T}/{$u}";$Og=$this->_conn->query($G,'{}','DELETE');if(is_array($Og)&&$Og['found']==true)$this->_conn->affected_rows++;}return$this->_conn->affected_rows;}}function
    62626261connect(){global$b;$h=new
    62636262Min_DB;list($N,$V,$F)=$b->credentials();if($F!=""&&$h->connect($N,$V,""))return
    62646263lang(22);if($h->connect($N,$V,$F))return$h;return$h->error;}function
    6265 support($Pc){return
    6266 preg_match("~database|table|columns~",$Pc);}function
    6267 logged_user(){global$b;$Gb=$b->credentials();return$Gb[1];}function
     6264support($Qc){return
     6265preg_match("~database|table|columns~",$Qc);}function
     6266logged_user(){global$b;$Ib=$b->credentials();return$Ib[1];}function
    62686267get_databases(){global$h;$I=$h->rootQuery('_aliases');if($I){$I=array_keys($I);sort($I,SORT_STRING);}return$I;}function
    62696268collations(){return
    62706269array();}function
    6271 db_collation($m,$pb){}function
     6270db_collation($m,$qb){}function
    62726271engines(){return
    62736272array();}function
    6274 count_tables($l){global$h;$I=array();$H=$h->query('_stats');if($H&&$H['indices']){$Md=$H['indices'];foreach($Md
    6275 as$Ld=>$Eh){$Kd=$Eh['total']['indexing'];$I[$Ld]=$Kd['index_total'];}}return$I;}function
     6273count_tables($l){global$h;$I=array();$H=$h->query('_stats');if($H&&$H['indices']){$Nd=$H['indices'];foreach($Nd
     6274as$Md=>$Gh){$Ld=$Gh['total']['indexing'];$I[$Md]=$Ld['index_total'];}}return$I;}function
    62766275tables_list(){global$h;$I=$h->query('_mapping');if($I)$I=array_fill_keys(array_keys($I[$h->_db]["mappings"]),'table');return$I;}function
    6277 table_status($C="",$Oc=false){global$h;$ch=$h->query("_search",array("size"=>0,"aggregations"=>array("count_by_type"=>array("terms"=>array("field"=>"_type")))),"POST");$I=array();if($ch){$S=$ch["aggregations"]["count_by_type"]["buckets"];foreach($S
     6276table_status($C="",$Pc=false){global$h;$eh=$h->query("_search",array("size"=>0,"aggregations"=>array("count_by_type"=>array("terms"=>array("field"=>"_type")))),"POST");$I=array();if($eh){$S=$eh["aggregations"]["count_by_type"]["buckets"];foreach($S
    62786277as$Q){$I[$Q["key"]]=array("Name"=>$Q["key"],"Engine"=>"table","Rows"=>$Q["doc_count"],);if($C!=""&&$C==$Q["key"])return$I[$C];}}return$I;}function
    62796278error(){global$h;return
     
    62836282indexes($Q,$i=null){return
    62846283array(array("type"=>"PRIMARY","columns"=>array("_id")),);}function
    6285 fields($Q){global$h;$H=$h->query("$Q/_mapping");$I=array();if($H){$Ae=$H[$Q]['properties'];if(!$Ae)$Ae=$H[$h->_db]['mappings'][$Q]['properties'];if($Ae){foreach($Ae
     6284fields($Q){global$h;$H=$h->query("$Q/_mapping");$I=array();if($H){$Be=$H[$Q]['properties'];if(!$Be)$Be=$H[$h->_db]['mappings'][$Q]['properties'];if($Be){foreach($Be
    62866285as$C=>$p){$I[$C]=array("field"=>$C,"full_type"=>$p["type"],"type"=>$p["type"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);if($p["properties"]){unset($I[$C]["privileges"]["insert"]);unset($I[$C]["privileges"]["update"]);}}}}return$I;}function
    62876286foreign_keys($Q){return
     
    62966295create_database($m){global$h;return$h->rootQuery(urlencode($m),null,'PUT');}function
    62976296drop_databases($l){global$h;return$h->rootQuery(urlencode(implode(',',$l)),array(),'DELETE');}function
    6298 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){global$h;$sg=array();foreach($q
    6299 as$Mc){$Rc=trim($Mc[1][0]);$Sc=trim($Mc[1][1]?$Mc[1][1]:"text");$sg[$Rc]=array('type'=>$Sc);}if(!empty($sg))$sg=array('properties'=>$sg);return$h->query("_mapping/{$C}",$sg,'PUT');}function
     6297alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){global$h;$ug=array();foreach($q
     6298as$Nc){$Sc=trim($Nc[1][0]);$Tc=trim($Nc[1][1]?$Nc[1][1]:"text");$ug[$Sc]=array('type'=>$Tc);}if(!empty($ug))$ug=array('properties'=>$ug);return$h->query("_mapping/{$C}",$ug,'PUT');}function
    63006299drop_tables($S){global$h;$I=true;foreach($S
    63016300as$Q)$I=$I&&$h->query(urlencode($Q),array(),'DELETE');return$I;}function
    6302 last_id(){global$h;return$h->last_id;}$y="elastic";$vf=array("=","query");$kd=array();$qd=array();$mc=array(array("json"));$U=array();$Ih=array();foreach(array(lang(27)=>array("long"=>3,"integer"=>5,"short"=>8,"byte"=>10,"double"=>20,"float"=>66,"half_float"=>12,"scaled_float"=>21),lang(28)=>array("date"=>10),lang(25)=>array("string"=>65535,"text"=>65535),lang(29)=>array("binary"=>255),)as$z=>$X){$U+=$X;$Ih[$z]=array_keys($X);}}$ec["clickhouse"]="ClickHouse (alpha)";if(isset($_GET["clickhouse"])){define("DRIVER","clickhouse");class
     6301last_id(){global$h;return$h->last_id;}$y="elastic";$xf=array("=","query");$ld=array();$rd=array();$nc=array(array("json"));$U=array();$Kh=array();foreach(array(lang(27)=>array("long"=>3,"integer"=>5,"short"=>8,"byte"=>10,"double"=>20,"float"=>66,"half_float"=>12,"scaled_float"=>21),lang(28)=>array("date"=>10),lang(25)=>array("string"=>65535,"text"=>65535),lang(29)=>array("binary"=>255),)as$z=>$X){$U+=$X;$Kh[$z]=array_keys($X);}}$fc["clickhouse"]="ClickHouse (alpha)";if(isset($_GET["clickhouse"])){define("DRIVER","clickhouse");class
    63036302Min_DB{var$extension="JSON",$server_info,$errno,$_result,$error,$_url;var$_db='default';function
    6304 rootQuery($m,$G){@ini_set('track_errors',1);$Tc=@file_get_contents("$this->_url/?database=$m",false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$this->isQuerySelectLike($G)?"$G FORMAT JSONCompact":$G,'header'=>'Content-type: application/x-www-form-urlencoded','ignore_errors'=>1,))));if($Tc===false){$this->error=$php_errormsg;return$Tc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Tc;return
    6305 false;}$I=json_decode($Tc,true);if($I===null){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$zb=get_defined_constants(true);foreach($zb['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return
     6303rootQuery($m,$G){@ini_set('track_errors',1);$Uc=@file_get_contents("$this->_url/?database=$m",false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$this->isQuerySelectLike($G)?"$G FORMAT JSONCompact":$G,'header'=>'Content-type: application/x-www-form-urlencoded','ignore_errors'=>1,))));if($Uc===false){$this->error=$php_errormsg;return$Uc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Uc;return
     6304false;}$I=json_decode($Uc,true);if($I===null){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$_b=get_defined_constants(true);foreach($_b['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return
    63066305new
    63076306Min_Result($I);}function
     
    63266325extends
    63276326Min_SQL{function
    6328 delete($Q,$wg,$_=0){return
    6329 queries("ALTER TABLE ".table($Q)." DELETE $wg");}function
    6330 update($Q,$O,$wg,$_=0,$M="\n"){$Vi=array();foreach($O
    6331 as$z=>$X)$Vi[]="$z = $X";$G=$M.implode(",$M",$Vi);return
    6332 queries("ALTER TABLE ".table($Q)." UPDATE $G$wg");}}function
     6327delete($Q,$yg,$_=0){return
     6328queries("ALTER TABLE ".table($Q)." DELETE $yg");}function
     6329update($Q,$O,$yg,$_=0,$M="\n"){$Yi=array();foreach($O
     6330as$z=>$X)$Yi[]="$z = $X";$G=$M.implode(",$M",$Yi);return
     6331queries("ALTER TABLE ".table($Q)." UPDATE $G$yg");}}function
    63336332idf_escape($v){return"`".str_replace("`","``",$v)."`";}function
    63346333table($v){return
     
    63376336found_rows($R,$Z){$K=get_vals("SELECT COUNT(*) FROM ".idf_escape($R["Name"]).($Z?" WHERE ".implode(" AND ",$Z):""));return
    63386337empty($K)?false:$K[0];}function
    6339 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){foreach($q
     6338alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){foreach($q
    63406339as$p){if($p[1][2]===" NULL")$p[1][1]=" Nullable({$p[1][1]})";unset($p[1][2]);}}function
    63416340truncate_tables($S){return
    63426341apply_queries("TRUNCATE TABLE",$S);}function
    6343 drop_views($aj){return
    6344 drop_tables($aj);}function
     6342drop_views($dj){return
     6343drop_tables($dj);}function
    63456344drop_tables($S){return
    63466345apply_queries("DROP TABLE",$S);}function
    63476346connect(){global$b;$h=new
    6348 Min_DB;$Gb=$b->credentials();if($h->connect($Gb[0],$Gb[1],$Gb[2]))return$h;return$h->error;}function
    6349 get_databases($ad){global$h;$H=get_rows('SHOW DATABASES');$I=array();foreach($H
     6347Min_DB;$Ib=$b->credentials();if($h->connect($Ib[0],$Ib[1],$Ib[2]))return$h;return$h->error;}function
     6348get_databases($bd){global$h;$H=get_rows('SHOW DATABASES');$I=array();foreach($H
    63506349as$J)$I[]=$J['name'];sort($I);return$I;}function
    63516350limit($G,$Z,$_,$D=0,$M=" "){return" $G$Z".($_!==null?$M."LIMIT $_".($D?", $D":""):"");}function
    63526351limit1($Q,$G,$Z,$M="\n"){return
    63536352limit($G,$Z,1,0,$M);}function
    6354 db_collation($m,$pb){}function
     6353db_collation($m,$qb){}function
    63556354engines(){return
    63566355array('MergeTree');}function
    6357 logged_user(){global$b;$Gb=$b->credentials();return$Gb[1];}function
     6356logged_user(){global$b;$Ib=$b->credentials();return$Ib[1];}function
    63586357tables_list(){$H=get_rows('SHOW TABLES');$I=array();foreach($H
    63596358as$J)$I[$J['name']]='table';ksort($I);return$I;}function
    63606359count_tables($l){return
    63616360array();}function
    6362 table_status($C="",$Oc=false){global$h;$I=array();$S=get_rows("SELECT name, engine FROM system.tables WHERE database = ".q($h->_db));foreach($S
     6361table_status($C="",$Pc=false){global$h;$I=array();$S=get_rows("SELECT name, engine FROM system.tables WHERE database = ".q($h->_db));foreach($S
    63636362as$Q){$I[$Q['name']]=array('Name'=>$Q['name'],'Engine'=>$Q['engine'],);if($C===$Q['name'])return$I[$Q['name']];}return$I;}function
    63646363is_view($R){return
     
    63696368unconvert_field($p,$I){if(in_array($p['type'],array("Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Float32","Float64")))return"to$p[type]($I)";return$I;}function
    63706369fields($Q){$I=array();$H=get_rows("SELECT name, type, default_expression FROM system.columns WHERE ".idf_escape('table')." = ".q($Q));foreach($H
    6371 as$J){$T=trim($J['type']);$ff=strpos($T,'Nullable(')===0;$I[trim($J['name'])]=array("field"=>trim($J['name']),"full_type"=>$T,"type"=>$T,"default"=>trim($J['default_expression']),"null"=>$ff,"auto_increment"=>'0',"privileges"=>array("insert"=>1,"select"=>1,"update"=>0),);}return$I;}function
     6370as$J){$T=trim($J['type']);$hf=strpos($T,'Nullable(')===0;$I[trim($J['name'])]=array("field"=>trim($J['name']),"full_type"=>$T,"type"=>$T,"default"=>trim($J['default_expression']),"null"=>$hf,"auto_increment"=>'0',"privileges"=>array("insert"=>1,"select"=>1,"update"=>0),);}return$I;}function
    63726371indexes($Q,$i=null){return
    63736372array();}function
     
    63856384array();}function
    63866385get_schema(){return"";}function
    6387 set_schema($ah){return
     6386set_schema($ch){return
    63886387true;}function
    63896388auto_increment(){return'';}function
    63906389last_id(){return
    639163900;}function
    6392 support($Pc){return
    6393 preg_match("~^(columns|sql|status|table)$~",$Pc);}$y="clickhouse";$U=array();$Ih=array();foreach(array(lang(27)=>array("Int8"=>3,"Int16"=>5,"Int32"=>10,"Int64"=>19,"UInt8"=>3,"UInt16"=>5,"UInt32"=>10,"UInt64"=>20,"Float32"=>7,"Float64"=>16,'Decimal'=>38,'Decimal32'=>9,'Decimal64'=>18,'Decimal128'=>38),lang(28)=>array("Date"=>13,"DateTime"=>20),lang(25)=>array("String"=>0),lang(29)=>array("FixedString"=>0),)as$z=>$X){$U+=$X;$Ih[$z]=array_keys($X);}$Ji=array();$vf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$kd=array();$qd=array("avg","count","count distinct","max","min","sum");$mc=array();}$ec=array("server"=>"MySQL")+$ec;if(!defined("DRIVER")){$hg=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
     6391support($Qc){return
     6392preg_match("~^(columns|sql|status|table)$~",$Qc);}$y="clickhouse";$U=array();$Kh=array();foreach(array(lang(27)=>array("Int8"=>3,"Int16"=>5,"Int32"=>10,"Int64"=>19,"UInt8"=>3,"UInt16"=>5,"UInt32"=>10,"UInt64"=>20,"Float32"=>7,"Float64"=>16,'Decimal'=>38,'Decimal32'=>9,'Decimal64'=>18,'Decimal128'=>38),lang(28)=>array("Date"=>13,"DateTime"=>20),lang(25)=>array("String"=>0),lang(29)=>array("FixedString"=>0),)as$z=>$X){$U+=$X;$Kh[$z]=array_keys($X);}$Li=array();$xf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$ld=array();$rd=array("avg","count","count distinct","max","min","sum");$nc=array();}$fc=array("server"=>"MySQL")+$fc;if(!defined("DRIVER")){$jg=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
    63946393Min_DB
    63956394extends
    63966395MySQLi{var$extension="MySQLi";function
    63976396__construct(){parent::init();}function
    6398 connect($N="",$V="",$F="",$k=null,$dg=null,$uh=null){global$b;mysqli_report(MYSQLI_REPORT_OFF);list($Ad,$dg)=explode(":",$N,2);$Ch=$b->connectSsl();if($Ch)$this->ssl_set($Ch['key'],$Ch['cert'],$Ch['ca'],'','');$I=@$this->real_connect(($N!=""?$Ad:ini_get("mysqli.default_host")),($N.$V!=""?$V:ini_get("mysqli.default_user")),($N.$V.$F!=""?$F:ini_get("mysqli.default_pw")),$k,(is_numeric($dg)?$dg:ini_get("mysqli.default_port")),(!is_numeric($dg)?$dg:$uh),($Ch?64:0));$this->options(MYSQLI_OPT_LOCAL_INFILE,false);return$I;}function
    6399 set_charset($cb){if(parent::set_charset($cb))return
    6400 true;parent::set_charset('utf8');return$this->query("SET NAMES $cb");}function
     6397connect($N="",$V="",$F="",$k=null,$fg=null,$wh=null){global$b;mysqli_report(MYSQLI_REPORT_OFF);list($Bd,$fg)=explode(":",$N,2);$Eh=$b->connectSsl();if($Eh)$this->ssl_set($Eh['key'],$Eh['cert'],$Eh['ca'],'','');$I=@$this->real_connect(($N!=""?$Bd:ini_get("mysqli.default_host")),($N.$V!=""?$V:ini_get("mysqli.default_user")),($N.$V.$F!=""?$F:ini_get("mysqli.default_pw")),$k,(is_numeric($fg)?$fg:ini_get("mysqli.default_port")),(!is_numeric($fg)?$fg:$wh),($Eh?64:0));$this->options(MYSQLI_OPT_LOCAL_INFILE,false);return$I;}function
     6398set_charset($db){if(parent::set_charset($db))return
     6399true;parent::set_charset('utf8');return$this->query("SET NAMES $db");}function
    64016400result($G,$p=0){$H=$this->query($G);if(!$H)return
    64026401false;$J=$H->fetch_array();return$J[$p];}function
     
    64056404connect($N,$V,$F){if(ini_bool("mysql.allow_local_infile")){$this->error=lang(32,"'mysql.allow_local_infile'","MySQLi","PDO_MySQL");return
    64066405false;}$this->_link=@mysql_connect(($N!=""?$N:ini_get("mysql.default_host")),("$N$V"!=""?$V:ini_get("mysql.default_user")),("$N$V$F"!=""?$F:ini_get("mysql.default_password")),true,131072);if($this->_link)$this->server_info=mysql_get_server_info($this->_link);else$this->error=mysql_error();return(bool)$this->_link;}function
    6407 set_charset($cb){if(function_exists('mysql_set_charset')){if(mysql_set_charset($cb,$this->_link))return
    6408 true;mysql_set_charset('utf8',$this->_link);}return$this->query("SET NAMES $cb");}function
     6406set_charset($db){if(function_exists('mysql_set_charset')){if(mysql_set_charset($db,$this->_link))return
     6407true;mysql_set_charset('utf8',$this->_link);}return$this->query("SET NAMES $db");}function
    64096408quote($P){return"'".mysql_real_escape_string($P,$this->_link)."'";}function
    64106409select_db($k){return
    64116410mysql_select_db($k,$this->_link);}function
    6412 query($G,$Di=false){$H=@($Di?mysql_unbuffered_query($G,$this->_link):mysql_query($G,$this->_link));$this->error="";if(!$H){$this->errno=mysql_errno($this->_link);$this->error=mysql_error($this->_link);return
     6411query($G,$Fi=false){$H=@($Fi?mysql_unbuffered_query($G,$this->_link):mysql_query($G,$this->_link));$this->error="";if(!$H){$this->errno=mysql_errno($this->_link);$this->error=mysql_error($this->_link);return
    64136412false;}if($H===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
    64146413true;}return
     
    64336432extends
    64346433Min_PDO{var$extension="PDO_MySQL";function
    6435 connect($N,$V,$F){global$b;$yf=array(PDO::MYSQL_ATTR_LOCAL_INFILE=>false);$Ch=$b->connectSsl();if($Ch){if(!empty($Ch['key']))$yf[PDO::MYSQL_ATTR_SSL_KEY]=$Ch['key'];if(!empty($Ch['cert']))$yf[PDO::MYSQL_ATTR_SSL_CERT]=$Ch['cert'];if(!empty($Ch['ca']))$yf[PDO::MYSQL_ATTR_SSL_CA]=$Ch['ca'];}$this->dsn("mysql:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\d)~',';port=\1',$N)),$V,$F,$yf);return
     6434connect($N,$V,$F){global$b;$_f=array(PDO::MYSQL_ATTR_LOCAL_INFILE=>false);$Eh=$b->connectSsl();if($Eh){if(!empty($Eh['key']))$_f[PDO::MYSQL_ATTR_SSL_KEY]=$Eh['key'];if(!empty($Eh['cert']))$_f[PDO::MYSQL_ATTR_SSL_CERT]=$Eh['cert'];if(!empty($Eh['ca']))$_f[PDO::MYSQL_ATTR_SSL_CA]=$Eh['ca'];}$this->dsn("mysql:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\d)~',';port=\1',$N)),$V,$F,$_f);return
    64366435true;}function
    6437 set_charset($cb){$this->query("SET NAMES $cb");}function
     6436set_charset($db){$this->query("SET NAMES $db");}function
    64386437select_db($k){return$this->query("USE ".idf_escape($k));}function
    6439 query($G,$Di=false){$this->setAttribute(1000,!$Di);return
    6440 parent::query($G,$Di);}}}class
     6438query($G,$Fi=false){$this->setAttribute(1000,!$Fi);return
     6439parent::query($G,$Fi);}}}class
    64416440Min_Driver
    64426441extends
    64436442Min_SQL{function
    64446443insert($Q,$O){return($O?parent::insert($Q,$O):queries("INSERT INTO ".table($Q)." ()\nVALUES ()"));}function
    6445 insertUpdate($Q,$K,$kg){$f=array_keys(reset($K));$ig="INSERT INTO ".table($Q)." (".implode(", ",$f).") VALUES\n";$Vi=array();foreach($f
    6446 as$z)$Vi[$z]="$z = VALUES($z)";$Lh="\nON DUPLICATE KEY UPDATE ".implode(", ",$Vi);$Vi=array();$ue=0;foreach($K
    6447 as$O){$Y="(".implode(", ",$O).")";if($Vi&&(strlen($ig)+$ue+strlen($Y)+strlen($Lh)>1e6)){if(!queries($ig.implode(",\n",$Vi).$Lh))return
    6448 false;$Vi=array();$ue=0;}$Vi[]=$Y;$ue+=strlen($Y)+2;}return
    6449 queries($ig.implode(",\n",$Vi).$Lh);}function
    6450 slowQuery($G,$gi){if(min_version('5.7.8','10.1.2')){if(preg_match('~MariaDB~',$this->_conn->server_info))return"SET STATEMENT max_statement_time=$gi FOR $G";elseif(preg_match('~^(SELECT\b)(.+)~is',$G,$B))return"$B[1] /*+ MAX_EXECUTION_TIME(".($gi*1000).") */ $B[2]";}}function
     6444insertUpdate($Q,$K,$mg){$f=array_keys(reset($K));$kg="INSERT INTO ".table($Q)." (".implode(", ",$f).") VALUES\n";$Yi=array();foreach($f
     6445as$z)$Yi[$z]="$z = VALUES($z)";$Nh="\nON DUPLICATE KEY UPDATE ".implode(", ",$Yi);$Yi=array();$ve=0;foreach($K
     6446as$O){$Y="(".implode(", ",$O).")";if($Yi&&(strlen($kg)+$ve+strlen($Y)+strlen($Nh)>1e6)){if(!queries($kg.implode(",\n",$Yi).$Nh))return
     6447false;$Yi=array();$ve=0;}$Yi[]=$Y;$ve+=strlen($Y)+2;}return
     6448queries($kg.implode(",\n",$Yi).$Nh);}function
     6449slowQuery($G,$ii){if(min_version('5.7.8','10.1.2')){if(preg_match('~MariaDB~',$this->_conn->server_info))return"SET STATEMENT max_statement_time=$ii FOR $G";elseif(preg_match('~^(SELECT\b)(.+)~is',$G,$B))return"$B[1] /*+ MAX_EXECUTION_TIME(".($ii*1000).") */ $B[2]";}}function
    64516450convertSearch($v,$X,$p){return(preg_match('~char|text|enum|set~',$p["type"])&&!preg_match("~^utf8~",$p["collation"])&&preg_match('~[\x80-\xFF]~',$X['val'])?"CONVERT($v USING ".charset($this->_conn).")":$v);}function
    64526451warnings(){$H=$this->_conn->query("SHOW WARNINGS");if($H&&$H->num_rows){ob_start();select($H);return
    64536452ob_get_clean();}}function
    6454 tableHelp($C){$Be=preg_match('~MariaDB~',$this->_conn->server_info);if(information_schema(DB))return
    6455 strtolower(($Be?"information-schema-$C-table/":str_replace("_","-",$C)."-table.html"));if(DB=="mysql")return($Be?"mysql$C-table/":"system-database.html");}}function
     6453tableHelp($C){$Ce=preg_match('~MariaDB~',$this->_conn->server_info);if(information_schema(DB))return
     6454strtolower(($Ce?"information-schema-$C-table/":str_replace("_","-",$C)."-table.html"));if(DB=="mysql")return($Ce?"mysql$C-table/":"system-database.html");}}function
    64566455idf_escape($v){return"`".str_replace("`","``",$v)."`";}function
    64576456table($v){return
    64586457idf_escape($v);}function
    6459 connect(){global$b,$U,$Ih;$h=new
    6460 Min_DB;$Gb=$b->credentials();if($h->connect($Gb[0],$Gb[1],$Gb[2])){$h->set_charset(charset($h));$h->query("SET sql_quote_show_create = 1, autocommit = 1");if(min_version('5.7.8',10.2,$h)){$Ih[lang(25)][]="json";$U["json"]=4294967295;}return$h;}$I=$h->error;if(function_exists('iconv')&&!isutf8($I)&&strlen($Yg=iconv("windows-1250","utf-8",$I))>strlen($I))$I=$Yg;return$I;}function
    6461 get_databases($ad){$I=get_session("dbs");if($I===null){$G=(min_version(5)?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME":"SHOW DATABASES");$I=($ad?slow_query($G):get_vals($G));restart_session();set_session("dbs",$I);stop_session();}return$I;}function
     6458connect(){global$b,$U,$Kh;$h=new
     6459Min_DB;$Ib=$b->credentials();if($h->connect($Ib[0],$Ib[1],$Ib[2])){$h->set_charset(charset($h));$h->query("SET sql_quote_show_create = 1, autocommit = 1");if(min_version('5.7.8',10.2,$h)){$Kh[lang(25)][]="json";$U["json"]=4294967295;}return$h;}$I=$h->error;if(function_exists('iconv')&&!isutf8($I)&&strlen($ah=iconv("windows-1250","utf-8",$I))>strlen($I))$I=$ah;return$I;}function
     6460get_databases($bd){$I=get_session("dbs");if($I===null){$G=(min_version(5)?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME":"SHOW DATABASES");$I=($bd?slow_query($G):get_vals($G));restart_session();set_session("dbs",$I);stop_session();}return$I;}function
    64626461limit($G,$Z,$_,$D=0,$M=" "){return" $G$Z".($_!==null?$M."LIMIT $_".($D?" OFFSET $D":""):"");}function
    64636462limit1($Q,$G,$Z,$M="\n"){return
    64646463limit($G,$Z,1,0,$M);}function
    6465 db_collation($m,$pb){global$h;$I=null;$j=$h->result("SHOW CREATE DATABASE ".idf_escape($m),1);if(preg_match('~ COLLATE ([^ ]+)~',$j,$B))$I=$B[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$j,$B))$I=$pb[$B[1]][-1];return$I;}function
     6464db_collation($m,$qb){global$h;$I=null;$j=$h->result("SHOW CREATE DATABASE ".idf_escape($m),1);if(preg_match('~ COLLATE ([^ ]+)~',$j,$B))$I=$B[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$j,$B))$I=$qb[$B[1]][-1];return$I;}function
    64666465engines(){$I=array();foreach(get_rows("SHOW ENGINES")as$J){if(preg_match("~YES|DEFAULT~",$J["Support"]))$I[]=$J["Engine"];}return$I;}function
    64676466logged_user(){global$h;return$h->result("SELECT USER()");}function
     
    64706469count_tables($l){$I=array();foreach($l
    64716470as$m)$I[$m]=count(get_vals("SHOW TABLES IN ".idf_escape($m)));return$I;}function
    6472 table_status($C="",$Oc=false){$I=array();foreach(get_rows($Oc&&min_version(5)?"SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ".($C!=""?"AND TABLE_NAME = ".q($C):"ORDER BY Name"):"SHOW TABLE STATUS".($C!=""?" LIKE ".q(addcslashes($C,"%_\\")):""))as$J){if($J["Engine"]=="InnoDB")$J["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\1',$J["Comment"]);if(!isset($J["Engine"]))$J["Comment"]="";if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
     6471table_status($C="",$Pc=false){$I=array();foreach(get_rows($Pc&&min_version(5)?"SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ".($C!=""?"AND TABLE_NAME = ".q($C):"ORDER BY Name"):"SHOW TABLE STATUS".($C!=""?" LIKE ".q(addcslashes($C,"%_\\")):""))as$J){if($J["Engine"]=="InnoDB")$J["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\1',$J["Comment"]);if(!isset($J["Engine"]))$J["Comment"]="";if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
    64736472is_view($R){return$R["Engine"]===null;}function
    64746473fk_support($R){return
    64756474preg_match('~InnoDB|IBMDB2I~i',$R["Engine"])||(preg_match('~NDB~i',$R["Engine"])&&min_version(5.6));}function
    6476 fields($Q){$I=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($Q))as$J){preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~',$J["Type"],$B);$I[$J["Field"]]=array("field"=>$J["Field"],"full_type"=>$J["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($J["Default"]!=""||preg_match("~char|set~",$B[1])?$J["Default"]:null),"null"=>($J["Null"]=="YES"),"auto_increment"=>($J["Extra"]=="auto_increment"),"on_update"=>(preg_match('~^on update (.+)~i',$J["Extra"],$B)?$B[1]:""),"collation"=>$J["Collation"],"privileges"=>array_flip(preg_split('~, *~',$J["Privileges"])),"comment"=>$J["Comment"],"primary"=>($J["Key"]=="PRI"),);}return$I;}function
     6475fields($Q){$I=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($Q))as$J){preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~',$J["Type"],$B);$I[$J["Field"]]=array("field"=>$J["Field"],"full_type"=>$J["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($J["Default"]!=""||preg_match("~char|set~",$B[1])?$J["Default"]:null),"null"=>($J["Null"]=="YES"),"auto_increment"=>($J["Extra"]=="auto_increment"),"on_update"=>(preg_match('~^on update (.+)~i',$J["Extra"],$B)?$B[1]:""),"collation"=>$J["Collation"],"privileges"=>array_flip(preg_split('~, *~',$J["Privileges"])),"comment"=>$J["Comment"],"primary"=>($J["Key"]=="PRI"),"generated"=>preg_match('~^(VIRTUAL|PERSISTENT|STORED)~',$J["Extra"]),);}return$I;}function
    64776476indexes($Q,$i=null){$I=array();foreach(get_rows("SHOW INDEX FROM ".table($Q),$i)as$J){$C=$J["Key_name"];$I[$C]["type"]=($C=="PRIMARY"?"PRIMARY":($J["Index_type"]=="FULLTEXT"?"FULLTEXT":($J["Non_unique"]?($J["Index_type"]=="SPATIAL"?"SPATIAL":"INDEX"):"UNIQUE")));$I[$C]["columns"][]=$J["Column_name"];$I[$C]["lengths"][]=($J["Index_type"]=="SPATIAL"?null:$J["Sub_part"]);$I[$C]["descs"][]=null;}return$I;}function
    6478 foreign_keys($Q){$I=array();foreach(get_rows("SELECT * FROM information_schema.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA = DATABASE() AND TABLE_NAME = ".q($Q))as$J){$f=get_key_vals("SELECT COLUMN_NAME, REFERENCED_COLUMN_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE CONSTRAINT_SCHEMA = DATABASE() AND CONSTRAINT_NAME = ".q($J["CONSTRAINT_NAME"])." ORDER BY ORDINAL_POSITION");$m=$J["UNIQUE_CONSTRAINT_SCHEMA"];$I[$J["CONSTRAINT_NAME"]]=array("db"=>($m==DB?"":$m),"table"=>$J["REFERENCED_TABLE_NAME"],"source"=>array_keys($f),"target"=>array_values($f),"on_delete"=>$J["DELETE_RULE"],"on_update"=>$J["UPDATE_RULE"],);}return$I;}function
     6477foreign_keys($Q){global$h,$sf;static$cg='(?:`(?:[^`]|``)+`|"(?:[^"]|"")+")';$I=array();$Gb=$h->result("SHOW CREATE TABLE ".table($Q),1);if($Gb){preg_match_all("~CONSTRAINT ($cg) FOREIGN KEY ?\\(((?:$cg,? ?)+)\\) REFERENCES ($cg)(?:\\.($cg))? \\(((?:$cg,? ?)+)\\)(?: ON DELETE ($sf))?(?: ON UPDATE ($sf))?~",$Gb,$Fe,PREG_SET_ORDER);foreach($Fe
     6478as$B){preg_match_all("~$cg~",$B[2],$yh);preg_match_all("~$cg~",$B[5],$ai);$I[idf_unescape($B[1])]=array("db"=>idf_unescape($B[4]!=""?$B[3]:$B[4]),"table"=>idf_unescape($B[4]!=""?$B[4]:$B[3]),"source"=>array_map('idf_unescape',$yh[0]),"target"=>array_map('idf_unescape',$ai[0]),"on_delete"=>($B[6]?$B[6]:"RESTRICT"),"on_update"=>($B[7]?$B[7]:"RESTRICT"),);}}return$I;}function
    64796479view($C){global$h;return
    64806480array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU','',$h->result("SHOW CREATE VIEW ".table($C),1)));}function
     
    64876487queries("CREATE DATABASE ".idf_escape($m).($d?" COLLATE ".q($d):""));}function
    64886488drop_databases($l){$I=apply_queries("DROP DATABASE",$l,'idf_escape');restart_session();set_session("dbs",null);return$I;}function
    6489 rename_database($C,$d){$I=false;if(create_database($C,$d)){$Kg=array();foreach(tables_list()as$Q=>$T)$Kg[]=table($Q)." TO ".idf_escape($C).".".table($Q);$I=(!$Kg||queries("RENAME TABLE ".implode(", ",$Kg)));if($I)queries("DROP DATABASE ".idf_escape(DB));restart_session();set_session("dbs",null);}return$I;}function
    6490 auto_increment(){$Na=" PRIMARY KEY";if($_GET["create"]!=""&&$_POST["auto_increment_col"]){foreach(indexes($_GET["create"])as$w){if(in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"],$w["columns"],true)){$Na="";break;}if($w["type"]=="PRIMARY")$Na=" UNIQUE";}}return" AUTO_INCREMENT$Na";}function
    6491 alter_table($Q,$C,$q,$cd,$ub,$uc,$d,$Ma,$Uf){$c=array();foreach($q
    6492 as$p)$c[]=($p[1]?($Q!=""?($p[0]!=""?"CHANGE ".idf_escape($p[0]):"ADD"):" ")." ".implode($p[1]).($Q!=""?$p[2]:""):"DROP ".idf_escape($p[0]));$c=array_merge($c,$cd);$Fh=($ub!==null?" COMMENT=".q($ub):"").($uc?" ENGINE=".q($uc):"").($d?" COLLATE ".q($d):"").($Ma!=""?" AUTO_INCREMENT=$Ma":"");if($Q=="")return
    6493 queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)$Fh$Uf");if($Q!=$C)$c[]="RENAME TO ".table($C);if($Fh)$c[]=ltrim($Fh);return($c||$Uf?queries("ALTER TABLE ".table($Q)."\n".implode(",\n",$c).$Uf):true);}function
     6489rename_database($C,$d){$I=false;if(create_database($C,$d)){$Mg=array();foreach(tables_list()as$Q=>$T)$Mg[]=table($Q)." TO ".idf_escape($C).".".table($Q);$I=(!$Mg||queries("RENAME TABLE ".implode(", ",$Mg)));if($I)queries("DROP DATABASE ".idf_escape(DB));restart_session();set_session("dbs",null);}return$I;}function
     6490auto_increment(){$Oa=" PRIMARY KEY";if($_GET["create"]!=""&&$_POST["auto_increment_col"]){foreach(indexes($_GET["create"])as$w){if(in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"],$w["columns"],true)){$Oa="";break;}if($w["type"]=="PRIMARY")$Oa=" UNIQUE";}}return" AUTO_INCREMENT$Oa";}function
     6491alter_table($Q,$C,$q,$dd,$vb,$vc,$d,$Na,$Wf){$c=array();foreach($q
     6492as$p)$c[]=($p[1]?($Q!=""?($p[0]!=""?"CHANGE ".idf_escape($p[0]):"ADD"):" ")." ".implode($p[1]).($Q!=""?$p[2]:""):"DROP ".idf_escape($p[0]));$c=array_merge($c,$dd);$Hh=($vb!==null?" COMMENT=".q($vb):"").($vc?" ENGINE=".q($vc):"").($d?" COLLATE ".q($d):"").($Na!=""?" AUTO_INCREMENT=$Na":"");if($Q=="")return
     6493queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)$Hh$Wf");if($Q!=$C)$c[]="RENAME TO ".table($C);if($Hh)$c[]=ltrim($Hh);return($c||$Wf?queries("ALTER TABLE ".table($Q)."\n".implode(",\n",$c).$Wf):true);}function
    64946494alter_indexes($Q,$c){foreach($c
    64956495as$z=>$X)$c[$z]=($X[2]=="DROP"?"\nDROP INDEX ".idf_escape($X[1]):"\nADD $X[0] ".($X[0]=="PRIMARY"?"KEY ":"").($X[1]!=""?idf_escape($X[1])." ":"")."(".implode(", ",$X[2]).")");return
     
    64976497truncate_tables($S){return
    64986498apply_queries("TRUNCATE TABLE",$S);}function
    6499 drop_views($aj){return
    6500 queries("DROP VIEW ".implode(", ",array_map('table',$aj)));}function
     6499drop_views($dj){return
     6500queries("DROP VIEW ".implode(", ",array_map('table',$dj)));}function
    65016501drop_tables($S){return
    65026502queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
    6503 move_tables($S,$aj,$Yh){$Kg=array();foreach(array_merge($S,$aj)as$Q)$Kg[]=table($Q)." TO ".idf_escape($Yh).".".table($Q);return
    6504 queries("RENAME TABLE ".implode(", ",$Kg));}function
    6505 copy_tables($S,$aj,$Yh){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($S
    6506 as$Q){$C=($Yh==DB?table("copy_$Q"):idf_escape($Yh).".".table($Q));if(($_POST["overwrite"]&&!queries("\nDROP TABLE IF EXISTS $C"))||!queries("CREATE TABLE $C LIKE ".table($Q))||!queries("INSERT INTO $C SELECT * FROM ".table($Q)))return
    6507 false;foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")))as$J){$yi=$J["Trigger"];if(!queries("CREATE TRIGGER ".($Yh==DB?idf_escape("copy_$yi"):idf_escape($Yh).".".idf_escape($yi))." $J[Timing] $J[Event] ON $C FOR EACH ROW\n$J[Statement];"))return
    6508 false;}}foreach($aj
    6509 as$Q){$C=($Yh==DB?table("copy_$Q"):idf_escape($Yh).".".table($Q));$Zi=view($Q);if(($_POST["overwrite"]&&!queries("DROP VIEW IF EXISTS $C"))||!queries("CREATE VIEW $C AS $Zi[select]"))return
     6503move_tables($S,$dj,$ai){$Mg=array();foreach(array_merge($S,$dj)as$Q)$Mg[]=table($Q)." TO ".idf_escape($ai).".".table($Q);return
     6504queries("RENAME TABLE ".implode(", ",$Mg));}function
     6505copy_tables($S,$dj,$ai){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($S
     6506as$Q){$C=($ai==DB?table("copy_$Q"):idf_escape($ai).".".table($Q));if(($_POST["overwrite"]&&!queries("\nDROP TABLE IF EXISTS $C"))||!queries("CREATE TABLE $C LIKE ".table($Q))||!queries("INSERT INTO $C SELECT * FROM ".table($Q)))return
     6507false;foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")))as$J){$_i=$J["Trigger"];if(!queries("CREATE TRIGGER ".($ai==DB?idf_escape("copy_$_i"):idf_escape($ai).".".idf_escape($_i))." $J[Timing] $J[Event] ON $C FOR EACH ROW\n$J[Statement];"))return
     6508false;}}foreach($dj
     6509as$Q){$C=($ai==DB?table("copy_$Q"):idf_escape($ai).".".table($Q));$cj=view($Q);if(($_POST["overwrite"]&&!queries("DROP VIEW IF EXISTS $C"))||!queries("CREATE VIEW $C AS $cj[select]"))return
    65106510false;}return
    65116511true;}function
     
    65166516trigger_options(){return
    65176517array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
    6518 routine($C,$T){global$h,$wc,$Rd,$U;$Da=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$xh="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Ci="((".implode("|",array_merge(array_keys($U),$Da)).")\\b(?:\\s*\\(((?:[^'\")]|$wc)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";$ag="$xh*(".($T=="FUNCTION"?"":$Rd).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$Ci";$j=$h->result("SHOW CREATE $T ".idf_escape($C),2);preg_match("~\\(((?:$ag\\s*,?)*)\\)\\s*".($T=="FUNCTION"?"RETURNS\\s+$Ci\\s+":"")."(.*)~is",$j,$B);$q=array();preg_match_all("~$ag\\s*,?~is",$B[1],$Ee,PREG_SET_ORDER);foreach($Ee
    6519 as$Nf){$C=str_replace("``","`",$Nf[2]).$Nf[3];$q[]=array("field"=>$C,"type"=>strtolower($Nf[5]),"length"=>preg_replace_callback("~$wc~s",'normalize_enum',$Nf[6]),"unsigned"=>strtolower(preg_replace('~\s+~',' ',trim("$Nf[8] $Nf[7]"))),"null"=>1,"full_type"=>$Nf[4],"inout"=>strtoupper($Nf[1]),"collation"=>strtolower($Nf[9]),);}if($T!="FUNCTION")return
     6518routine($C,$T){global$h,$xc,$Sd,$U;$Da=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$zh="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Ei="((".implode("|",array_merge(array_keys($U),$Da)).")\\b(?:\\s*\\(((?:[^'\")]|$xc)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";$cg="$zh*(".($T=="FUNCTION"?"":$Sd).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$Ei";$j=$h->result("SHOW CREATE $T ".idf_escape($C),2);preg_match("~\\(((?:$cg\\s*,?)*)\\)\\s*".($T=="FUNCTION"?"RETURNS\\s+$Ei\\s+":"")."(.*)~is",$j,$B);$q=array();preg_match_all("~$cg\\s*,?~is",$B[1],$Fe,PREG_SET_ORDER);foreach($Fe
     6519as$Pf){$C=str_replace("``","`",$Pf[2]).$Pf[3];$q[]=array("field"=>$C,"type"=>strtolower($Pf[5]),"length"=>preg_replace_callback("~$xc~s",'normalize_enum',$Pf[6]),"unsigned"=>strtolower(preg_replace('~\s+~',' ',trim("$Pf[8] $Pf[7]"))),"null"=>1,"full_type"=>$Pf[4],"inout"=>strtoupper($Pf[1]),"collation"=>strtolower($Pf[9]),);}if($T!="FUNCTION")return
    65206520array("fields"=>$q,"definition"=>$B[11]);return
    65216521array("fields"=>$q,"returns"=>array("type"=>$B[12],"length"=>$B[13],"unsigned"=>$B[15],"collation"=>$B[16]),"definition"=>$B[17],"language"=>"SQL",);}function
     
    65346534array();}function
    65356535get_schema(){return"";}function
    6536 set_schema($ah){return
     6536set_schema($ch){return
    65376537true;}function
    6538 create_sql($Q,$Ma,$Jh){global$h;$I=$h->result("SHOW CREATE TABLE ".table($Q),1);if(!$Ma)$I=preg_replace('~ AUTO_INCREMENT=\d+~','',$I);return$I;}function
     6538create_sql($Q,$Na,$Lh){global$h;$I=$h->result("SHOW CREATE TABLE ".table($Q),1);if(!$Na)$I=preg_replace('~ AUTO_INCREMENT=\d+~','',$I);return$I;}function
    65396539truncate_sql($Q){return"TRUNCATE ".table($Q);}function
    65406540use_sql($k){return"USE ".idf_escape($k);}function
     
    65486548convert_field($p){if(preg_match("~binary~",$p["type"]))return"HEX(".idf_escape($p["field"]).")";if($p["type"]=="bit")return"BIN(".idf_escape($p["field"])." + 0)";if(preg_match("~geometry|point|linestring|polygon~",$p["type"]))return(min_version(8)?"ST_":"")."AsWKT(".idf_escape($p["field"]).")";}function
    65496549unconvert_field($p,$I){if(preg_match("~binary~",$p["type"]))$I="UNHEX($I)";if($p["type"]=="bit")$I="CONV($I, 2, 10) + 0";if(preg_match("~geometry|point|linestring|polygon~",$p["type"]))$I=(min_version(8)?"ST_":"")."GeomFromText($I, SRID($p[field]))";return$I;}function
    6550 support($Pc){return!preg_match("~scheme|sequence|type|view_trigger|materializedview".(min_version(8)?"":"|descidx".(min_version(5.1)?"":"|event|partitioning".(min_version(5)?"":"|routine|trigger|view")))."~",$Pc);}function
     6550support($Qc){return!preg_match("~scheme|sequence|type|view_trigger|materializedview".(min_version(8)?"":"|descidx".(min_version(5.1)?"":"|event|partitioning".(min_version(5)?"":"|routine|trigger|view")))."~",$Qc);}function
    65516551kill_process($X){return
    65526552queries("KILL ".number($X));}function
    65536553connection_id(){return"SELECT CONNECTION_ID()";}function
    6554 max_connections(){global$h;return$h->result("SELECT @@max_connections");}$y="sql";$U=array();$Ih=array();foreach(array(lang(27)=>array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"decimal"=>66,"float"=>12,"double"=>21),lang(28)=>array("date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4),lang(25)=>array("char"=>255,"varchar"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295),lang(33)=>array("enum"=>65535,"set"=>64),lang(29)=>array("bit"=>20,"binary"=>255,"varbinary"=>65535,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295),lang(31)=>array("geometry"=>0,"point"=>0,"linestring"=>0,"polygon"=>0,"multipoint"=>0,"multilinestring"=>0,"multipolygon"=>0,"geometrycollection"=>0),)as$z=>$X){$U+=$X;$Ih[$z]=array_keys($X);}$Ji=array("unsigned","zerofill","unsigned zerofill");$vf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","FIND_IN_SET","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$kd=array("char_length","date","from_unixtime","lower","round","floor","ceil","sec_to_time","time_to_sec","upper");$qd=array("avg","count","count distinct","group_concat","max","min","sum");$mc=array(array("char"=>"md5/sha1/password/encrypt/uuid","binary"=>"md5/sha1","date|time"=>"now",),array(number_type()=>"+/-","date"=>"+ interval/- interval","time"=>"addtime/subtime","char|text"=>"concat",));}define("SERVER",$_GET[DRIVER]);define("DB",$_GET["db"]);define("ME",preg_replace('~^[^?]*/([^?]*).*~','\1',$_SERVER["REQUEST_URI"]).'?'.(sid()?SID.'&':'').(SERVER!==null?DRIVER."=".urlencode(SERVER).'&':'').(isset($_GET["username"])?"username=".urlencode($_GET["username"]).'&':'').(DB!=""?'db='.urlencode(DB).'&'.(isset($_GET["ns"])?"ns=".urlencode($_GET["ns"])."&":""):''));$ia="4.7.2";class
     6554max_connections(){global$h;return$h->result("SELECT @@max_connections");}$y="sql";$U=array();$Kh=array();foreach(array(lang(27)=>array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"decimal"=>66,"float"=>12,"double"=>21),lang(28)=>array("date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4),lang(25)=>array("char"=>255,"varchar"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295),lang(33)=>array("enum"=>65535,"set"=>64),lang(29)=>array("bit"=>20,"binary"=>255,"varbinary"=>65535,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295),lang(31)=>array("geometry"=>0,"point"=>0,"linestring"=>0,"polygon"=>0,"multipoint"=>0,"multilinestring"=>0,"multipolygon"=>0,"geometrycollection"=>0),)as$z=>$X){$U+=$X;$Kh[$z]=array_keys($X);}$Li=array("unsigned","zerofill","unsigned zerofill");$xf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","FIND_IN_SET","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$ld=array("char_length","date","from_unixtime","lower","round","floor","ceil","sec_to_time","time_to_sec","upper");$rd=array("avg","count","count distinct","group_concat","max","min","sum");$nc=array(array("char"=>"md5/sha1/password/encrypt/uuid","binary"=>"md5/sha1","date|time"=>"now",),array(number_type()=>"+/-","date"=>"+ interval/- interval","time"=>"addtime/subtime","char|text"=>"concat",));}define("SERVER",$_GET[DRIVER]);define("DB",$_GET["db"]);define("ME",str_replace(":","%3a",preg_replace('~^[^?]*/([^?]*).*~','\1',$_SERVER["REQUEST_URI"])).'?'.(sid()?SID.'&':'').(SERVER!==null?DRIVER."=".urlencode(SERVER).'&':'').(isset($_GET["username"])?"username=".urlencode($_GET["username"]).'&':'').(DB!=""?'db='.urlencode(DB).'&'.(isset($_GET["ns"])?"ns=".urlencode($_GET["ns"])."&":""):''));$ia="4.7.4";class
    65556555Adminer{var$operators;function
    65566556name(){return"<a href='https://www.adminer.org/'".target_blank()." id='h1'>Adminer</a>";}function
     
    65656565database(){return
    65666566DB;}function
    6567 databases($ad=true){return
    6568 get_databases($ad);}function
     6567databases($bd=true){return
     6568get_databases($bd);}function
    65696569schemas(){return
    65706570schemas();}function
     
    65766576head(){return
    65776577true;}function
    6578 css(){$I=array();$Uc="adminer.css";if(file_exists($Uc))$I[]="$Uc?v=".crc32(file_get_contents($Uc));return$I;}function
    6579 loginForm(){global$ec;echo"<table cellspacing='0' class='layout'>\n",$this->loginFormField('driver','<tr><th>'.lang(34).'<td>',html_select("auth[driver]",$ec,DRIVER,"loginDriver(this);")."\n"),$this->loginFormField('server','<tr><th>'.lang(35).'<td>','<input name="auth[server]" value="'.h(SERVER).'" title="hostname[:port]" placeholder="localhost" autocapitalize="off">'."\n"),$this->loginFormField('username','<tr><th>'.lang(36).'<td>','<input name="auth[username]" id="username" value="'.h($_GET["username"]).'" autocomplete="username" autocapitalize="off">'.script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();")),$this->loginFormField('password','<tr><th>'.lang(37).'<td>','<input type="password" name="auth[password]" autocomplete="current-password">'."\n"),$this->loginFormField('db','<tr><th>'.lang(38).'<td>','<input name="auth[db]" value="'.h($_GET["db"]).'" autocapitalize="off">'."\n"),"</table>\n","<p><input type='submit' value='".lang(39)."'>\n",checkbox("auth[permanent]",1,$_COOKIE["adminer_permanent"],lang(40))."\n";}function
    6580 loginFormField($C,$xd,$Y){return$xd.$Y;}function
    6581 login($ze,$F){if($F=="")return
     6578css(){$I=array();$Vc="adminer.css";if(file_exists($Vc))$I[]="$Vc?v=".crc32(file_get_contents($Vc));return$I;}function
     6579loginForm(){global$fc;echo"<table cellspacing='0' class='layout'>\n",$this->loginFormField('driver','<tr><th>'.lang(34).'<td>',html_select("auth[driver]",$fc,DRIVER,"loginDriver(this);")."\n"),$this->loginFormField('server','<tr><th>'.lang(35).'<td>','<input name="auth[server]" value="'.h(SERVER).'" title="hostname[:port]" placeholder="localhost" autocapitalize="off">'."\n"),$this->loginFormField('username','<tr><th>'.lang(36).'<td>','<input name="auth[username]" id="username" value="'.h($_GET["username"]).'" autocomplete="username" autocapitalize="off">'.script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();")),$this->loginFormField('password','<tr><th>'.lang(37).'<td>','<input type="password" name="auth[password]" autocomplete="current-password">'."\n"),$this->loginFormField('db','<tr><th>'.lang(38).'<td>','<input name="auth[db]" value="'.h($_GET["db"]).'" autocapitalize="off">'."\n"),"</table>\n","<p><input type='submit' value='".lang(39)."'>\n",checkbox("auth[permanent]",1,$_COOKIE["adminer_permanent"],lang(40))."\n";}function
     6580loginFormField($C,$yd,$Y){return$yd.$Y;}function
     6581login($_e,$F){if($F=="")return
    65826582lang(41,target_blank());return
    65836583true;}function
    6584 tableName($Ph){return
    6585 h($Ph["Name"]);}function
    6586 fieldName($p,$_f=0){return'<span title="'.h($p["full_type"]).'">'.h($p["field"]).'</span>';}function
    6587 selectLinks($Ph,$O=""){global$y,$n;echo'<p class="links">';$xe=array("select"=>lang(42));if(support("table")||support("indexes"))$xe["table"]=lang(43);if(support("table")){if(is_view($Ph))$xe["view"]=lang(44);else$xe["create"]=lang(45);}if($O!==null)$xe["edit"]=lang(46);$C=$Ph["Name"];foreach($xe
     6584tableName($Rh){return
     6585h($Rh["Name"]);}function
     6586fieldName($p,$Bf=0){return'<span title="'.h($p["full_type"]).'">'.h($p["field"]).'</span>';}function
     6587selectLinks($Rh,$O=""){global$y,$n;echo'<p class="links">';$ye=array("select"=>lang(42));if(support("table")||support("indexes"))$ye["table"]=lang(43);if(support("table")){if(is_view($Rh))$ye["view"]=lang(44);else$ye["create"]=lang(45);}if($O!==null)$ye["edit"]=lang(46);$C=$Rh["Name"];foreach($ye
    65886588as$z=>$X)echo" <a href='".h(ME)."$z=".urlencode($C).($z=="edit"?$O:"")."'".bold(isset($_GET[$z])).">$X</a>";echo
    65896589doc_link(array($y=>$n->tableHelp($C)),"?"),"\n";}function
    65906590foreignKeys($Q){return
    65916591foreign_keys($Q);}function
    6592 backwardKeys($Q,$Oh){return
     6592backwardKeys($Q,$Qh){return
    65936593array();}function
    6594 backwardKeysPrint($Pa,$J){}function
    6595 selectQuery($G,$Dh,$Nc=false){global$y,$n;$I="</p>\n";if(!$Nc&&($dj=$n->warnings())){$u="warnings";$I=", <a href='#$u'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$u');","")."$I<div id='$u' class='hidden'>\n$dj</div>\n";}return"<p><code class='jush-$y'>".h(str_replace("\n"," ",$G))."</code> <span class='time'>(".format_time($Dh).")</span>".(support("sql")?" <a href='".h(ME)."sql=".urlencode($G)."'>".lang(10)."</a>":"").$I;}function
     6594backwardKeysPrint($Qa,$J){}function
     6595selectQuery($G,$Fh,$Oc=false){global$y,$n;$I="</p>\n";if(!$Oc&&($gj=$n->warnings())){$u="warnings";$I=", <a href='#$u'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$u');","")."$I<div id='$u' class='hidden'>\n$gj</div>\n";}return"<p><code class='jush-$y'>".h(str_replace("\n"," ",$G))."</code> <span class='time'>(".format_time($Fh).")</span>".(support("sql")?" <a href='".h(ME)."sql=".urlencode($G)."'>".lang(10)."</a>":"").$I;}function
    65966596sqlCommandQuery($G){return
    65976597shorten_utf8(trim($G),1000);}function
    65986598rowDescription($Q){return"";}function
    6599 rowDescriptions($K,$dd){return$K;}function
     6599rowDescriptions($K,$ed){return$K;}function
    66006600selectLink($X,$p){}function
    6601 selectVal($X,$A,$p,$Hf){$I=($X===null?"<i>NULL</i>":(preg_match("~char|binary|boolean~",$p["type"])&&!preg_match("~var~",$p["type"])?"<code>$X</code>":$X));if(preg_match('~blob|bytea|raw|file~',$p["type"])&&!isutf8($X))$I="<i>".lang(48,strlen($Hf))."</i>";if(preg_match('~json~',$p["type"]))$I="<code class='jush-js'>$I</code>";return($A?"<a href='".h($A)."'".(is_url($A)?target_blank():"").">$I</a>":$I);}function
     6601selectVal($X,$A,$p,$Jf){$I=($X===null?"<i>NULL</i>":(preg_match("~char|binary|boolean~",$p["type"])&&!preg_match("~var~",$p["type"])?"<code>$X</code>":$X));if(preg_match('~blob|bytea|raw|file~',$p["type"])&&!isutf8($X))$I="<i>".lang(48,strlen($Jf))."</i>";if(preg_match('~json~',$p["type"]))$I="<code class='jush-js'>$I</code>";return($A?"<a href='".h($A)."'".(is_url($A)?target_blank():"").">$I</a>":$I);}function
    66026602editVal($X,$p){return$X;}function
    66036603tableStructurePrint($q){echo"<div class='scrollable'>\n","<table cellspacing='0' class='nowrap'>\n","<thead><tr><th>".lang(49)."<td>".lang(50).(support("comment")?"<td>".lang(51):"")."</thead>\n";foreach($q
    66046604as$p){echo"<tr".odd()."><th>".h($p["field"]),"<td><span title='".h($p["collation"])."'>".h($p["full_type"])."</span>",($p["null"]?" <i>NULL</i>":""),($p["auto_increment"]?" <i>".lang(52)."</i>":""),(isset($p["default"])?" <span title='".lang(53)."'>[<b>".h($p["default"])."</b>]</span>":""),(support("comment")?"<td>".h($p["comment"]):""),"\n";}echo"</table>\n","</div>\n";}function
    66056605tableIndexesPrint($x){echo"<table cellspacing='0'>\n";foreach($x
    6606 as$C=>$w){ksort($w["columns"]);$mg=array();foreach($w["columns"]as$z=>$X)$mg[]="<i>".h($X)."</i>".($w["lengths"][$z]?"(".$w["lengths"][$z].")":"").($w["descs"][$z]?" DESC":"");echo"<tr title='".h($C)."'><th>$w[type]<td>".implode(", ",$mg)."\n";}echo"</table>\n";}function
    6607 selectColumnsPrint($L,$f){global$kd,$qd;print_fieldset("select",lang(54),$L);$t=0;$L[""]=array();foreach($L
    6608 as$z=>$X){$X=$_GET["columns"][$z];$e=select_input(" name='columns[$t][col]'",$f,$X["col"],($z!==""?"selectFieldChange":"selectAddRow"));echo"<div>".($kd||$qd?"<select name='columns[$t][fun]'>".optionlist(array(-1=>"")+array_filter(array(lang(55)=>$kd,lang(56)=>$qd)),$X["fun"])."</select>".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).script("qsl('select').onchange = function () { helpClose();".($z!==""?"":" qsl('select, input', this.parentNode).onchange();")." };","")."($e)":$e)."</div>\n";$t++;}echo"</div></fieldset>\n";}function
     6606as$C=>$w){ksort($w["columns"]);$og=array();foreach($w["columns"]as$z=>$X)$og[]="<i>".h($X)."</i>".($w["lengths"][$z]?"(".$w["lengths"][$z].")":"").($w["descs"][$z]?" DESC":"");echo"<tr title='".h($C)."'><th>$w[type]<td>".implode(", ",$og)."\n";}echo"</table>\n";}function
     6607selectColumnsPrint($L,$f){global$ld,$rd;print_fieldset("select",lang(54),$L);$t=0;$L[""]=array();foreach($L
     6608as$z=>$X){$X=$_GET["columns"][$z];$e=select_input(" name='columns[$t][col]'",$f,$X["col"],($z!==""?"selectFieldChange":"selectAddRow"));echo"<div>".($ld||$rd?"<select name='columns[$t][fun]'>".optionlist(array(-1=>"")+array_filter(array(lang(55)=>$ld,lang(56)=>$rd)),$X["fun"])."</select>".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).script("qsl('select').onchange = function () { helpClose();".($z!==""?"":" qsl('select, input', this.parentNode).onchange();")." };","")."($e)":$e)."</div>\n";$t++;}echo"</div></fieldset>\n";}function
    66096609selectSearchPrint($Z,$f,$x){print_fieldset("search",lang(57),$Z);foreach($x
    6610 as$t=>$w){if($w["type"]=="FULLTEXT"){echo"<div>(<i>".implode("</i>, <i>",array_map('h',$w["columns"]))."</i>) AGAINST"," <input type='search' name='fulltext[$t]' value='".h($_GET["fulltext"][$t])."'>",script("qsl('input').oninput = selectFieldChange;",""),checkbox("boolean[$t]",1,isset($_GET["boolean"][$t]),"BOOL"),"</div>\n";}}$bb="this.parentNode.firstChild.onchange();";foreach(array_merge((array)$_GET["where"],array(array()))as$t=>$X){if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div>".select_input(" name='where[$t][col]'",$f,$X["col"],($X?"selectFieldChange":"selectAddRow"),"(".lang(58).")"),html_select("where[$t][op]",$this->operators,$X["op"],$bb),"<input type='search' name='where[$t][val]' value='".h($X["val"])."'>",script("mixin(qsl('input'), {oninput: function () { $bb }, onkeydown: selectSearchKeydown, onsearch: selectSearchSearch});",""),"</div>\n";}}echo"</div></fieldset>\n";}function
    6611 selectOrderPrint($_f,$f,$x){print_fieldset("sort",lang(59),$_f);$t=0;foreach((array)$_GET["order"]as$z=>$X){if($X!=""){echo"<div>".select_input(" name='order[$t]'",$f,$X,"selectFieldChange"),checkbox("desc[$t]",1,isset($_GET["desc"][$z]),lang(60))."</div>\n";$t++;}}echo"<div>".select_input(" name='order[$t]'",$f,"","selectAddRow"),checkbox("desc[$t]",1,false,lang(60))."</div>\n","</div></fieldset>\n";}function
     6610as$t=>$w){if($w["type"]=="FULLTEXT"){echo"<div>(<i>".implode("</i>, <i>",array_map('h',$w["columns"]))."</i>) AGAINST"," <input type='search' name='fulltext[$t]' value='".h($_GET["fulltext"][$t])."'>",script("qsl('input').oninput = selectFieldChange;",""),checkbox("boolean[$t]",1,isset($_GET["boolean"][$t]),"BOOL"),"</div>\n";}}$cb="this.parentNode.firstChild.onchange();";foreach(array_merge((array)$_GET["where"],array(array()))as$t=>$X){if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div>".select_input(" name='where[$t][col]'",$f,$X["col"],($X?"selectFieldChange":"selectAddRow"),"(".lang(58).")"),html_select("where[$t][op]",$this->operators,$X["op"],$cb),"<input type='search' name='where[$t][val]' value='".h($X["val"])."'>",script("mixin(qsl('input'), {oninput: function () { $cb }, onkeydown: selectSearchKeydown, onsearch: selectSearchSearch});",""),"</div>\n";}}echo"</div></fieldset>\n";}function
     6611selectOrderPrint($Bf,$f,$x){print_fieldset("sort",lang(59),$Bf);$t=0;foreach((array)$_GET["order"]as$z=>$X){if($X!=""){echo"<div>".select_input(" name='order[$t]'",$f,$X,"selectFieldChange"),checkbox("desc[$t]",1,isset($_GET["desc"][$z]),lang(60))."</div>\n";$t++;}}echo"<div>".select_input(" name='order[$t]'",$f,"","selectAddRow"),checkbox("desc[$t]",1,false,lang(60))."</div>\n","</div></fieldset>\n";}function
    66126612selectLimitPrint($_){echo"<fieldset><legend>".lang(61)."</legend><div>";echo"<input type='number' name='limit' class='size' value='".h($_)."'>",script("qsl('input').oninput = selectFieldChange;",""),"</div></fieldset>\n";}function
    6613 selectLengthPrint($ei){if($ei!==null){echo"<fieldset><legend>".lang(62)."</legend><div>","<input type='number' name='text_length' class='size' value='".h($ei)."'>","</div></fieldset>\n";}}function
     6613selectLengthPrint($gi){if($gi!==null){echo"<fieldset><legend>".lang(62)."</legend><div>","<input type='number' name='text_length' class='size' value='".h($gi)."'>","</div></fieldset>\n";}}function
    66146614selectActionPrint($x){echo"<fieldset><legend>".lang(63)."</legend><div>","<input type='submit' value='".lang(54)."'>"," <span id='noindex' title='".lang(64)."'></span>","<script".nonce().">\n","var indexColumns = ";$f=array();foreach($x
    6615 as$w){$Kb=reset($w["columns"]);if($w["type"]!="FULLTEXT"&&$Kb)$f[$Kb]=1;}$f[""]=1;foreach($f
     6615as$w){$Mb=reset($w["columns"]);if($w["type"]!="FULLTEXT"&&$Mb)$f[$Mb]=1;}$f[""]=1;foreach($f
    66166616as$z=>$X)json_row($z);echo";\n","selectFieldChange.call(qs('#form')['select']);\n","</script>\n","</div></fieldset>\n";}function
    66176617selectCommandPrint(){return!information_schema(DB);}function
    66186618selectImportPrint(){return!information_schema(DB);}function
    6619 selectEmailPrint($rc,$f){}function
    6620 selectColumnsProcess($f,$x){global$kd,$qd;$L=array();$nd=array();foreach((array)$_GET["columns"]as$z=>$X){if($X["fun"]=="count"||($X["col"]!=""&&(!$X["fun"]||in_array($X["fun"],$kd)||in_array($X["fun"],$qd)))){$L[$z]=apply_sql_function($X["fun"],($X["col"]!=""?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$qd))$nd[]=$L[$z];}}return
    6621 array($L,$nd);}function
     6619selectEmailPrint($sc,$f){}function
     6620selectColumnsProcess($f,$x){global$ld,$rd;$L=array();$od=array();foreach((array)$_GET["columns"]as$z=>$X){if($X["fun"]=="count"||($X["col"]!=""&&(!$X["fun"]||in_array($X["fun"],$ld)||in_array($X["fun"],$rd)))){$L[$z]=apply_sql_function($X["fun"],($X["col"]!=""?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$rd))$od[]=$L[$z];}}return
     6621array($L,$od);}function
    66226622selectSearchProcess($q,$x){global$h,$n;$I=array();foreach($x
    6623 as$t=>$w){if($w["type"]=="FULLTEXT"&&$_GET["fulltext"][$t]!="")$I[]="MATCH (".implode(", ",array_map('idf_escape',$w["columns"])).") AGAINST (".q($_GET["fulltext"][$t]).(isset($_GET["boolean"][$t])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$z=>$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$ig="";$wb=" $X[op]";if(preg_match('~IN$~',$X["op"])){$Hd=process_length($X["val"]);$wb.=" ".($Hd!=""?$Hd:"(NULL)");}elseif($X["op"]=="SQL")$wb=" $X[val]";elseif($X["op"]=="LIKE %%")$wb=" LIKE ".$this->processInput($q[$X["col"]],"%$X[val]%");elseif($X["op"]=="ILIKE %%")$wb=" ILIKE ".$this->processInput($q[$X["col"]],"%$X[val]%");elseif($X["op"]=="FIND_IN_SET"){$ig="$X[op](".q($X["val"]).", ";$wb=")";}elseif(!preg_match('~NULL$~',$X["op"]))$wb.=" ".$this->processInput($q[$X["col"]],$X["val"]);if($X["col"]!="")$I[]=$ig.$n->convertSearch(idf_escape($X["col"]),$X,$q[$X["col"]]).$wb;else{$rb=array();foreach($q
    6624 as$C=>$p){if((preg_match('~^[-\d.'.(preg_match('~IN$~',$X["op"])?',':'').']+$~',$X["val"])||!preg_match('~'.number_type().'|bit~',$p["type"]))&&(!preg_match("~[\x80-\xFF]~",$X["val"])||preg_match('~char|text|enum|set~',$p["type"])))$rb[]=$ig.$n->convertSearch(idf_escape($C),$X,$p).$wb;}$I[]=($rb?"(".implode(" OR ",$rb).")":"1 = 0");}}}return$I;}function
     6623as$t=>$w){if($w["type"]=="FULLTEXT"&&$_GET["fulltext"][$t]!="")$I[]="MATCH (".implode(", ",array_map('idf_escape',$w["columns"])).") AGAINST (".q($_GET["fulltext"][$t]).(isset($_GET["boolean"][$t])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$z=>$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$kg="";$xb=" $X[op]";if(preg_match('~IN$~',$X["op"])){$Id=process_length($X["val"]);$xb.=" ".($Id!=""?$Id:"(NULL)");}elseif($X["op"]=="SQL")$xb=" $X[val]";elseif($X["op"]=="LIKE %%")$xb=" LIKE ".$this->processInput($q[$X["col"]],"%$X[val]%");elseif($X["op"]=="ILIKE %%")$xb=" ILIKE ".$this->processInput($q[$X["col"]],"%$X[val]%");elseif($X["op"]=="FIND_IN_SET"){$kg="$X[op](".q($X["val"]).", ";$xb=")";}elseif(!preg_match('~NULL$~',$X["op"]))$xb.=" ".$this->processInput($q[$X["col"]],$X["val"]);if($X["col"]!="")$I[]=$kg.$n->convertSearch(idf_escape($X["col"]),$X,$q[$X["col"]]).$xb;else{$sb=array();foreach($q
     6624as$C=>$p){if((preg_match('~^[-\d.'.(preg_match('~IN$~',$X["op"])?',':'').']+$~',$X["val"])||!preg_match('~'.number_type().'|bit~',$p["type"]))&&(!preg_match("~[\x80-\xFF]~",$X["val"])||preg_match('~char|text|enum|set~',$p["type"])))$sb[]=$kg.$n->convertSearch(idf_escape($C),$X,$p).$xb;}$I[]=($sb?"(".implode(" OR ",$sb).")":"1 = 0");}}}return$I;}function
    66256625selectOrderProcess($q,$x){$I=array();foreach((array)$_GET["order"]as$z=>$X){if($X!="")$I[]=(preg_match('~^((COUNT\(DISTINCT |[A-Z0-9_]+\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\)|COUNT\(\*\))$~',$X)?$X:idf_escape($X)).(isset($_GET["desc"][$z])?" DESC":"");}return$I;}function
    66266626selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"50");}function
    66276627selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
    6628 selectEmailProcess($Z,$dd){return
     6628selectEmailProcess($Z,$ed){return
    66296629false;}function
    6630 selectQueryBuild($L,$Z,$nd,$_f,$_,$E){return"";}function
    6631 messageQuery($G,$fi,$Nc=false){global$y,$n;restart_session();$yd=&get_session("queries");if(!$yd[$_GET["db"]])$yd[$_GET["db"]]=array();if(strlen($G)>1e6)$G=preg_replace('~[\x80-\xFF]+$~','',substr($G,0,1e6))."\n…";$yd[$_GET["db"]][]=array($G,time(),$fi);$Ah="sql-".count($yd[$_GET["db"]]);$I="<a href='#$Ah' class='toggle'>".lang(65)."</a>\n";if(!$Nc&&($dj=$n->warnings())){$u="warnings-".count($yd[$_GET["db"]]);$I="<a href='#$u' class='toggle'>".lang(47)."</a>, $I<div id='$u' class='hidden'>\n$dj</div>\n";}return" <span class='time'>".@date("H:i:s")."</span>"." $I<div id='$Ah' class='hidden'><pre><code class='jush-$y'>".shorten_utf8($G,1000)."</code></pre>".($fi?" <span class='time'>($fi)</span>":'').(support("sql")?'<p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($yd[$_GET["db"]])-1)).'">'.lang(10).'</a>':'').'</div>';}function
    6632 editFunctions($p){global$mc;$I=($p["null"]?"NULL/":"");foreach($mc
    6633 as$z=>$kd){if(!$z||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($kd
    6634 as$ag=>$X){if(!$ag||preg_match("~$ag~",$p["type"]))$I.="/$X";}if($z&&!preg_match('~set|blob|bytea|raw|file~',$p["type"]))$I.="/SQL";}}if($p["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$I=lang(52);return
     6630selectQueryBuild($L,$Z,$od,$Bf,$_,$E){return"";}function
     6631messageQuery($G,$hi,$Oc=false){global$y,$n;restart_session();$zd=&get_session("queries");if(!$zd[$_GET["db"]])$zd[$_GET["db"]]=array();if(strlen($G)>1e6)$G=preg_replace('~[\x80-\xFF]+$~','',substr($G,0,1e6))."\n…";$zd[$_GET["db"]][]=array($G,time(),$hi);$Ch="sql-".count($zd[$_GET["db"]]);$I="<a href='#$Ch' class='toggle'>".lang(65)."</a>\n";if(!$Oc&&($gj=$n->warnings())){$u="warnings-".count($zd[$_GET["db"]]);$I="<a href='#$u' class='toggle'>".lang(47)."</a>, $I<div id='$u' class='hidden'>\n$gj</div>\n";}return" <span class='time'>".@date("H:i:s")."</span>"." $I<div id='$Ch' class='hidden'><pre><code class='jush-$y'>".shorten_utf8($G,1000)."</code></pre>".($hi?" <span class='time'>($hi)</span>":'').(support("sql")?'<p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($zd[$_GET["db"]])-1)).'">'.lang(10).'</a>':'').'</div>';}function
     6632editFunctions($p){global$nc;$I=($p["null"]?"NULL/":"");foreach($nc
     6633as$z=>$ld){if(!$z||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($ld
     6634as$cg=>$X){if(!$cg||preg_match("~$cg~",$p["type"]))$I.="/$X";}if($z&&!preg_match('~set|blob|bytea|raw|file~',$p["type"]))$I.="/SQL";}}if($p["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$I=lang(52);return
    66356635explode("/",$I);}function
    66366636editInput($Q,$p,$Ka,$Y){if($p["type"]=="enum")return(isset($_GET["select"])?"<label><input type='radio'$Ka value='-1' checked><i>".lang(8)."</i></label> ":"").($p["null"]?"<label><input type='radio'$Ka value=''".($Y!==null||isset($_GET["select"])?"":" checked")."><i>NULL</i></label> ":"").enum_input("radio",$Ka,$p,$Y,0);return"";}function
     
    66426642array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
    66436643dumpDatabase($m){}function
    6644 dumpTable($Q,$Jh,$ae=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($Jh)dump_csv(array_keys(fields($Q)));}else{if($ae==2){$q=array();foreach(fields($Q)as$C=>$p)$q[]=idf_escape($C)." $p[full_type]";$j="CREATE TABLE ".table($Q)." (".implode(", ",$q).")";}else$j=create_sql($Q,$_POST["auto_increment"],$Jh);set_utf8mb4($j);if($Jh&&$j){if($Jh=="DROP+CREATE"||$ae==1)echo"DROP ".($ae==2?"VIEW":"TABLE")." IF EXISTS ".table($Q).";\n";if($ae==1)$j=remove_definer($j);echo"$j;\n\n";}}}function
    6645 dumpData($Q,$Jh,$G){global$h,$y;$Ge=($y=="sqlite"?0:1048576);if($Jh){if($_POST["format"]=="sql"){if($Jh=="TRUNCATE+INSERT")echo
    6646 truncate_sql($Q).";\n";$q=fields($Q);}$H=$h->query($G,1);if($H){$Td="";$Ya="";$he=array();$Lh="";$Qc=($Q!=''?'fetch_assoc':'fetch_row');while($J=$H->$Qc()){if(!$he){$Vi=array();foreach($J
    6647 as$X){$p=$H->fetch_field();$he[]=$p->name;$z=idf_escape($p->name);$Vi[]="$z = VALUES($z)";}$Lh=($Jh=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Vi):"").";\n";}if($_POST["format"]!="sql"){if($Jh=="table"){dump_csv($he);$Jh="INSERT";}dump_csv($J);}else{if(!$Td)$Td="INSERT INTO ".table($Q)." (".implode(", ",array_map('idf_escape',$he)).") VALUES";foreach($J
    6648 as$z=>$X){$p=$q[$z];$J[$z]=($X!==null?unconvert_field($p,preg_match(number_type(),$p["type"])&&$X!=''&&!preg_match('~\[~',$p["full_type"])?$X:q(($X===false?0:$X))):"NULL");}$Yg=($Ge?"\n":" ")."(".implode(",\t",$J).")";if(!$Ya)$Ya=$Td.$Yg;elseif(strlen($Ya)+4+strlen($Yg)+strlen($Lh)<$Ge)$Ya.=",$Yg";else{echo$Ya.$Lh;$Ya=$Td.$Yg;}}}if($Ya)echo$Ya.$Lh;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$h->error)."\n";}}function
    6649 dumpFilename($Cd){return
    6650 friendly_url($Cd!=""?$Cd:(SERVER!=""?SERVER:"localhost"));}function
    6651 dumpHeaders($Cd,$Ve=false){$Kf=$_POST["output"];$Ic=(preg_match('~sql~',$_POST["format"])?"sql":($Ve?"tar":"csv"));header("Content-Type: ".($Kf=="gz"?"application/x-gzip":($Ic=="tar"?"application/x-tar":($Ic=="sql"||$Kf!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($Kf=="gz")ob_start('ob_gzencode',1e6);return$Ic;}function
     6644dumpTable($Q,$Lh,$be=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($Lh)dump_csv(array_keys(fields($Q)));}else{if($be==2){$q=array();foreach(fields($Q)as$C=>$p)$q[]=idf_escape($C)." $p[full_type]";$j="CREATE TABLE ".table($Q)." (".implode(", ",$q).")";}else$j=create_sql($Q,$_POST["auto_increment"],$Lh);set_utf8mb4($j);if($Lh&&$j){if($Lh=="DROP+CREATE"||$be==1)echo"DROP ".($be==2?"VIEW":"TABLE")." IF EXISTS ".table($Q).";\n";if($be==1)$j=remove_definer($j);echo"$j;\n\n";}}}function
     6645dumpData($Q,$Lh,$G){global$h,$y;$He=($y=="sqlite"?0:1048576);if($Lh){if($_POST["format"]=="sql"){if($Lh=="TRUNCATE+INSERT")echo
     6646truncate_sql($Q).";\n";$q=fields($Q);}$H=$h->query($G,1);if($H){$Ud="";$Za="";$ie=array();$Nh="";$Rc=($Q!=''?'fetch_assoc':'fetch_row');while($J=$H->$Rc()){if(!$ie){$Yi=array();foreach($J
     6647as$X){$p=$H->fetch_field();$ie[]=$p->name;$z=idf_escape($p->name);$Yi[]="$z = VALUES($z)";}$Nh=($Lh=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Yi):"").";\n";}if($_POST["format"]!="sql"){if($Lh=="table"){dump_csv($ie);$Lh="INSERT";}dump_csv($J);}else{if(!$Ud)$Ud="INSERT INTO ".table($Q)." (".implode(", ",array_map('idf_escape',$ie)).") VALUES";foreach($J
     6648as$z=>$X){$p=$q[$z];$J[$z]=($X!==null?unconvert_field($p,preg_match(number_type(),$p["type"])&&!preg_match('~\[~',$p["full_type"])&&is_numeric($X)?$X:q(($X===false?0:$X))):"NULL");}$ah=($He?"\n":" ")."(".implode(",\t",$J).")";if(!$Za)$Za=$Ud.$ah;elseif(strlen($Za)+4+strlen($ah)+strlen($Nh)<$He)$Za.=",$ah";else{echo$Za.$Nh;$Za=$Ud.$ah;}}}if($Za)echo$Za.$Nh;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$h->error)."\n";}}function
     6649dumpFilename($Dd){return
     6650friendly_url($Dd!=""?$Dd:(SERVER!=""?SERVER:"localhost"));}function
     6651dumpHeaders($Dd,$We=false){$Mf=$_POST["output"];$Jc=(preg_match('~sql~',$_POST["format"])?"sql":($We?"tar":"csv"));header("Content-Type: ".($Mf=="gz"?"application/x-gzip":($Jc=="tar"?"application/x-tar":($Jc=="sql"||$Mf!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($Mf=="gz")ob_start('ob_gzencode',1e6);return$Jc;}function
    66526652importServerPath(){return"adminer.sql";}function
    66536653homepage(){echo'<p class="links">'.($_GET["ns"]==""&&support("database")?'<a href="'.h(ME).'database=">'.lang(68)."</a>\n":""),(support("scheme")?"<a href='".h(ME)."scheme='>".($_GET["ns"]!=""?lang(69):lang(70))."</a>\n":""),($_GET["ns"]!==""?'<a href="'.h(ME).'schema=">'.lang(71)."</a>\n":""),(support("privileges")?"<a href='".h(ME)."privileges='>".lang(72)."</a>\n":"");return
    66546654true;}function
    6655 navigation($Ue){global$ia,$y,$ec,$h;echo'<h1>
     6655navigation($Ve){global$ia,$y,$fc,$h;echo'<h1>
    66566656',$this->name(),' <span class="version">',$ia,'</span>
    66576657<a href="https://www.adminer.org/#download"',target_blank(),' id="version">',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'</a>
    66586658</h1>
    6659 ';if($Ue=="auth"){$Wc=true;foreach((array)$_SESSION["pwds"]as$Xi=>$mh){foreach($mh
    6660 as$N=>$Si){foreach($Si
    6661 as$V=>$F){if($F!==null){if($Wc){echo"<ul id='logins'>".script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});");$Wc=false;}$Qb=$_SESSION["db"][$Xi][$N][$V];foreach(($Qb?array_keys($Qb):array(""))as$m)echo"<li><a href='".h(auth_url($Xi,$N,$V,$m))."'>($ec[$Xi]) ".h($V.($N!=""?"@".$this->serverName($N):"").($m!=""?" - $m":""))."</a>\n";}}}}}else{if($_GET["ns"]!==""&&!$Ue&&DB!=""){$h->select_db(DB);$S=table_status('',true);}echo
    6662 script_src(preg_replace("~\\?.*~","",ME)."?file=jush.js&version=4.7.2");if(support("sql")){echo'<script',nonce(),'>
    6663 ';if($S){$xe=array();foreach($S
    6664 as$Q=>$T)$xe[]=preg_quote($Q,'/');echo"var jushLinks = { $y: [ '".js_escape(ME).(support("table")?"table=":"select=")."\$&', /\\b(".implode("|",$xe).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$y;\n";}$lh=$h->server_info;echo'bodyLoad(\'',(is_object($h)?preg_replace('~^(\d\.?\d).*~s','\1',$lh):""),'\'',(preg_match('~MariaDB~',$lh)?", true":""),');
     6659';if($Ve=="auth"){$Mf="";foreach((array)$_SESSION["pwds"]as$aj=>$oh){foreach($oh
     6660as$N=>$Vi){foreach($Vi
     6661as$V=>$F){if($F!==null){$Sb=$_SESSION["db"][$aj][$N][$V];foreach(($Sb?array_keys($Sb):array(""))as$m)$Mf.="<li><a href='".h(auth_url($aj,$N,$V,$m))."'>($fc[$aj]) ".h($V.($N!=""?"@".$this->serverName($N):"").($m!=""?" - $m":""))."</a>\n";}}}}if($Mf)echo"<ul id='logins'>\n$Mf</ul>\n".script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});");}else{if($_GET["ns"]!==""&&!$Ve&&DB!=""){$h->select_db(DB);$S=table_status('',true);}echo
     6662script_src(preg_replace("~\\?.*~","",ME)."?file=jush.js&version=4.7.4");if(support("sql")){echo'<script',nonce(),'>
     6663';if($S){$ye=array();foreach($S
     6664as$Q=>$T)$ye[]=preg_quote($Q,'/');echo"var jushLinks = { $y: [ '".js_escape(ME).(support("table")?"table=":"select=")."\$&', /\\b(".implode("|",$ye).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$y;\n";}$nh=$h->server_info;echo'bodyLoad(\'',(is_object($h)?preg_replace('~^(\d\.?\d).*~s','\1',$nh):""),'\'',(preg_match('~MariaDB~',$nh)?", true":""),');
    66656665</script>
    6666 ';}$this->databasesPrint($Ue);if(DB==""||!$Ue){echo"<p class='links'>".(support("sql")?"<a href='".h(ME)."sql='".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(65)."</a>\n<a href='".h(ME)."import='".bold(isset($_GET["import"])).">".lang(73)."</a>\n":"")."";if(support("dump"))echo"<a href='".h(ME)."dump=".urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"])."' id='dump'".bold(isset($_GET["dump"])).">".lang(74)."</a>\n";}if($_GET["ns"]!==""&&!$Ue&&DB!=""){echo'<a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".lang(75)."</a>\n";if(!$S)echo"<p class='message'>".lang(9)."\n";else$this->tablesPrint($S);}}}function
    6667 databasesPrint($Ue){global$b,$h;$l=$this->databases();if($l&&!in_array(DB,$l))array_unshift($l,DB);echo'<form action="">
     6666';}$this->databasesPrint($Ve);if(DB==""||!$Ve){echo"<p class='links'>".(support("sql")?"<a href='".h(ME)."sql='".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(65)."</a>\n<a href='".h(ME)."import='".bold(isset($_GET["import"])).">".lang(73)."</a>\n":"")."";if(support("dump"))echo"<a href='".h(ME)."dump=".urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"])."' id='dump'".bold(isset($_GET["dump"])).">".lang(74)."</a>\n";}if($_GET["ns"]!==""&&!$Ve&&DB!=""){echo'<a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".lang(75)."</a>\n";if(!$S)echo"<p class='message'>".lang(9)."\n";else$this->tablesPrint($S);}}}function
     6667databasesPrint($Ve){global$b,$h;$l=$this->databases();if($l&&!in_array(DB,$l))array_unshift($l,DB);echo'<form action="">
    66686668<p id="dbs">
    6669 ';hidden_fields_get();$Ob=script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});");echo"<span title='".lang(76)."'>".lang(77)."</span>: ".($l?"<select name='db'>".optionlist(array(""=>"")+$l,DB)."</select>$Ob":"<input name='db' value='".h(DB)."' autocapitalize='off'>\n"),"<input type='submit' value='".lang(20)."'".($l?" class='hidden'":"").">\n";if($Ue!="db"&&DB!=""&&$h->select_db(DB)){if(support("scheme")){echo"<br>".lang(78).": <select name='ns'>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>$Ob";if($_GET["ns"]!="")set_schema($_GET["ns"]);}}foreach(array("import","sql","schema","dump","privileges")as$X){if(isset($_GET[$X])){echo"<input type='hidden' name='$X' value=''>";break;}}echo"</p></form>\n";}function
     6669';hidden_fields_get();$Qb=script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});");echo"<span title='".lang(76)."'>".lang(77)."</span>: ".($l?"<select name='db'>".optionlist(array(""=>"")+$l,DB)."</select>$Qb":"<input name='db' value='".h(DB)."' autocapitalize='off'>\n"),"<input type='submit' value='".lang(20)."'".($l?" class='hidden'":"").">\n";if($Ve!="db"&&DB!=""&&$h->select_db(DB)){if(support("scheme")){echo"<br>".lang(78).": <select name='ns'>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>$Qb";if($_GET["ns"]!="")set_schema($_GET["ns"]);}}foreach(array("import","sql","schema","dump","privileges")as$X){if(isset($_GET[$X])){echo"<input type='hidden' name='$X' value=''>";break;}}echo"</p></form>\n";}function
    66706670tablesPrint($S){echo"<ul id='tables'>".script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");foreach($S
    6671 as$Q=>$Fh){$C=$this->tableName($Fh);if($C!=""){echo'<li><a href="'.h(ME).'select='.urlencode($Q).'"'.bold($_GET["select"]==$Q||$_GET["edit"]==$Q,"select").">".lang(79)."</a> ",(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($Fh)?"view":"structure"))." title='".lang(43)."'>$C</a>":"<span>$C</span>")."\n";}}echo"</ul>\n";}}$b=(function_exists('adminer_object')?adminer_object():new
    6672 Adminer);if($b->operators===null)$b->operators=$vf;function
    6673 page_header($ii,$o="",$Xa=array(),$ji=""){global$ca,$ia,$b,$ec,$y;page_headers();if(is_ajax()&&$o){page_messages($o);exit;}$ki=$ii.($ji!=""?": $ji":"");$li=strip_tags($ki.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
     6671as$Q=>$Hh){$C=$this->tableName($Hh);if($C!=""){echo'<li><a href="'.h(ME).'select='.urlencode($Q).'"'.bold($_GET["select"]==$Q||$_GET["edit"]==$Q,"select").">".lang(79)."</a> ",(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($Hh)?"view":"structure"))." title='".lang(43)."'>$C</a>":"<span>$C</span>")."\n";}}echo"</ul>\n";}}$b=(function_exists('adminer_object')?adminer_object():new
     6672Adminer);if($b->operators===null)$b->operators=$xf;function
     6673page_header($ki,$o="",$Ya=array(),$li=""){global$ca,$ia,$b,$fc,$y;page_headers();if(is_ajax()&&$o){page_messages($o);exit;}$mi=$ki.($li!=""?": $li":"");$ni=strip_tags($mi.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
    66746674<html lang="',$ca,'" dir="',lang(80),'">
    66756675<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    66766676<meta name="robots" content="noindex">
    6677 <title>',$li,'</title>
    6678 <link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME)."?file=default.css&version=4.7.2"),'">
    6679 ',script_src(preg_replace("~\\?.*~","",ME)."?file=functions.js&version=4.7.2");if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.7.2"),'">
    6680 <link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.7.2"),'">
    6681 ';foreach($b->css()as$Ib){echo'<link rel="stylesheet" type="text/css" href="',h($Ib),'">
     6677<title>',$ni,'</title>
     6678<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME)."?file=default.css&version=4.7.4"),'">
     6679',script_src(preg_replace("~\\?.*~","",ME)."?file=functions.js&version=4.7.4");if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.7.4"),'">
     6680<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.7.4"),'">
     6681';foreach($b->css()as$Kb){echo'<link rel="stylesheet" type="text/css" href="',h($Kb),'">
    66826682';}}echo'
    66836683<body class="',lang(80),' nojs">
    6684 ';$Uc=get_temp_dir()."/adminer.version";if(!$_COOKIE["adminer_version"]&&function_exists('openssl_verify')&&file_exists($Uc)&&filemtime($Uc)+86400>time()){$Yi=unserialize(file_get_contents($Uc));$tg="-----BEGIN PUBLIC KEY-----
     6684';$Vc=get_temp_dir()."/adminer.version";if(!$_COOKIE["adminer_version"]&&function_exists('openssl_verify')&&file_exists($Vc)&&filemtime($Vc)+86400>time()){$bj=unserialize(file_get_contents($Vc));$vg="-----BEGIN PUBLIC KEY-----
    66856685MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwqWOVuF5uw7/+Z70djoK
    66866686RlHIZFZPO0uYRezq90+7Amk+FDNd7KkL5eDve+vHRJBLAszF/7XKXe11xwliIsFs
     
    66916691fQIDAQAB
    66926692-----END PUBLIC KEY-----
    6693 ";if(openssl_verify($Yi["version"],base64_decode($Yi["signature"]),$tg)==1)$_COOKIE["adminer_version"]=$Yi["version"];}echo'<script',nonce(),'>
     6693";if(openssl_verify($bj["version"],base64_decode($bj["signature"]),$vg)==1)$_COOKIE["adminer_version"]=$bj["version"];}echo'<script',nonce(),'>
    66946694mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick',(isset($_COOKIE["adminer_version"])?"":", onload: partial(verifyVersion, '$ia', '".js_escape(ME)."', '".get_token()."')");?>});
    66956695document.body.className = document.body.className.replace(/ nojs/, ' js');
     
    67026702',script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"),'
    67036703<div id="content">
    6704 ';if($Xa!==null){$A=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($A?$A:".").'">'.$ec[DRIVER].'</a> &raquo; ';$A=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$N=$b->serverName(SERVER);$N=($N!=""?$N:lang(35));if($Xa===false)echo"$N\n";else{echo"<a href='".($A?h($A):".")."' accesskey='1' title='Alt+Shift+1'>$N</a> &raquo; ";if($_GET["ns"]!=""||(DB!=""&&is_array($Xa)))echo'<a href="'.h($A."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> &raquo; ';if(is_array($Xa)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> &raquo; ';foreach($Xa
    6705 as$z=>$X){$Wb=(is_array($X)?$X[1]:h($X));if($Wb!="")echo"<a href='".h(ME."$z=").urlencode(is_array($X)?$X[0]:$X)."'>$Wb</a> &raquo; ";}}echo"$ii\n";}}echo"<h2>$ki</h2>\n","<div id='ajaxstatus' class='jsonly hidden'></div>\n";restart_session();page_messages($o);$l=&get_session("dbs");if(DB!=""&&$l&&!in_array(DB,$l,true))$l=null;stop_session();define("PAGE_HEADER",1);}function
    6706 page_headers(){global$b;header("Content-Type: text/html; charset=utf-8");header("Cache-Control: no-cache");header("X-Frame-Options: deny");header("X-XSS-Protection: 0");header("X-Content-Type-Options: nosniff");header("Referrer-Policy: origin-when-cross-origin");foreach($b->csp()as$Hb){$wd=array();foreach($Hb
    6707 as$z=>$X)$wd[]="$z $X";header("Content-Security-Policy: ".implode("; ",$wd));}$b->headers();}function
     6704';if($Ya!==null){$A=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($A?$A:".").'">'.$fc[DRIVER].'</a> &raquo; ';$A=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$N=$b->serverName(SERVER);$N=($N!=""?$N:lang(35));if($Ya===false)echo"$N\n";else{echo"<a href='".($A?h($A):".")."' accesskey='1' title='Alt+Shift+1'>$N</a> &raquo; ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ya)))echo'<a href="'.h($A."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> &raquo; ';if(is_array($Ya)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> &raquo; ';foreach($Ya
     6705as$z=>$X){$Yb=(is_array($X)?$X[1]:h($X));if($Yb!="")echo"<a href='".h(ME."$z=").urlencode(is_array($X)?$X[0]:$X)."'>$Yb</a> &raquo; ";}}echo"$ki\n";}}echo"<h2>$mi</h2>\n","<div id='ajaxstatus' class='jsonly hidden'></div>\n";restart_session();page_messages($o);$l=&get_session("dbs");if(DB!=""&&$l&&!in_array(DB,$l,true))$l=null;stop_session();define("PAGE_HEADER",1);}function
     6706page_headers(){global$b;header("Content-Type: text/html; charset=utf-8");header("Cache-Control: no-cache");header("X-Frame-Options: deny");header("X-XSS-Protection: 0");header("X-Content-Type-Options: nosniff");header("Referrer-Policy: origin-when-cross-origin");foreach($b->csp()as$Jb){$xd=array();foreach($Jb
     6707as$z=>$X)$xd[]="$z $X";header("Content-Security-Policy: ".implode("; ",$xd));}$b->headers();}function
    67086708csp(){return
    67096709array(array("script-src"=>"'self' 'unsafe-inline' 'nonce-".get_nonce()."' 'strict-dynamic'","connect-src"=>"'self'","frame-src"=>"https://www.adminer.org","object-src"=>"'none'","base-uri"=>"'none'","form-action"=>"'self'",),);}function
    6710 get_nonce(){static$ef;if(!$ef)$ef=base64_encode(rand_string());return$ef;}function
    6711 page_messages($o){$Li=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Qe=$_SESSION["messages"][$Li];if($Qe){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Qe)."</div>".script("messagesPrint();");unset($_SESSION["messages"][$Li]);}if($o)echo"<div class='error'>$o</div>\n";}function
    6712 page_footer($Ue=""){global$b,$pi;echo'</div>
    6713 
    6714 ';switch_lang();if($Ue!="auth"){echo'<form action="" method="post">
     6710get_nonce(){static$ff;if(!$ff)$ff=base64_encode(rand_string());return$ff;}function
     6711page_messages($o){$Ni=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Re=$_SESSION["messages"][$Ni];if($Re){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Re)."</div>".script("messagesPrint();");unset($_SESSION["messages"][$Ni]);}if($o)echo"<div class='error'>$o</div>\n";}function
     6712page_footer($Ve=""){global$b,$ri;echo'</div>
     6713
     6714';switch_lang();if($Ve!="auth"){echo'<form action="" method="post">
    67156715<p class="logout">
    67166716<input type="submit" name="logout" value="',lang(82),'" id="logout">
    6717 <input type="hidden" name="token" value="',$pi,'">
     6717<input type="hidden" name="token" value="',$ri,'">
    67186718</p>
    67196719</form>
    67206720';}echo'<div id="menu">
    6721 ';$b->navigation($Ue);echo'</div>
     6721';$b->navigation($Ve);echo'</div>
    67226722',script("setupSubmitHighlight(document);");}function
    6723 int32($Xe){while($Xe>=2147483648)$Xe-=4294967296;while($Xe<=-2147483649)$Xe+=4294967296;return(int)$Xe;}function
    6724 long2str($W,$cj){$Yg='';foreach($W
    6725 as$X)$Yg.=pack('V',$X);if($cj)return
    6726 substr($Yg,0,end($W));return$Yg;}function
    6727 str2long($Yg,$cj){$W=array_values(unpack('V*',str_pad($Yg,4*ceil(strlen($Yg)/4),"\0")));if($cj)$W[]=strlen($Yg);return$W;}function
    6728 xxtea_mx($pj,$oj,$Mh,$de){return
    6729 int32((($pj>>5&0x7FFFFFF)^$oj<<2)+(($oj>>3&0x1FFFFFFF)^$pj<<4))^int32(($Mh^$oj)+($de^$pj));}function
    6730 encrypt_string($Hh,$z){if($Hh=="")return"";$z=array_values(unpack("V*",pack("H*",md5($z))));$W=str2long($Hh,true);$Xe=count($W)-1;$pj=$W[$Xe];$oj=$W[0];$ug=floor(6+52/($Xe+1));$Mh=0;while($ug-->0){$Mh=int32($Mh+0x9E3779B9);$lc=$Mh>>2&3;for($Lf=0;$Lf<$Xe;$Lf++){$oj=$W[$Lf+1];$We=xxtea_mx($pj,$oj,$Mh,$z[$Lf&3^$lc]);$pj=int32($W[$Lf]+$We);$W[$Lf]=$pj;}$oj=$W[0];$We=xxtea_mx($pj,$oj,$Mh,$z[$Lf&3^$lc]);$pj=int32($W[$Xe]+$We);$W[$Xe]=$pj;}return
     6723int32($Ye){while($Ye>=2147483648)$Ye-=4294967296;while($Ye<=-2147483649)$Ye+=4294967296;return(int)$Ye;}function
     6724long2str($W,$fj){$ah='';foreach($W
     6725as$X)$ah.=pack('V',$X);if($fj)return
     6726substr($ah,0,end($W));return$ah;}function
     6727str2long($ah,$fj){$W=array_values(unpack('V*',str_pad($ah,4*ceil(strlen($ah)/4),"\0")));if($fj)$W[]=strlen($ah);return$W;}function
     6728xxtea_mx($sj,$rj,$Oh,$ee){return
     6729int32((($sj>>5&0x7FFFFFF)^$rj<<2)+(($rj>>3&0x1FFFFFFF)^$sj<<4))^int32(($Oh^$rj)+($ee^$sj));}function
     6730encrypt_string($Jh,$z){if($Jh=="")return"";$z=array_values(unpack("V*",pack("H*",md5($z))));$W=str2long($Jh,true);$Ye=count($W)-1;$sj=$W[$Ye];$rj=$W[0];$wg=floor(6+52/($Ye+1));$Oh=0;while($wg-->0){$Oh=int32($Oh+0x9E3779B9);$mc=$Oh>>2&3;for($Nf=0;$Nf<$Ye;$Nf++){$rj=$W[$Nf+1];$Xe=xxtea_mx($sj,$rj,$Oh,$z[$Nf&3^$mc]);$sj=int32($W[$Nf]+$Xe);$W[$Nf]=$sj;}$rj=$W[0];$Xe=xxtea_mx($sj,$rj,$Oh,$z[$Nf&3^$mc]);$sj=int32($W[$Ye]+$Xe);$W[$Ye]=$sj;}return
    67316731long2str($W,false);}function
    6732 decrypt_string($Hh,$z){if($Hh=="")return"";if(!$z)return
    6733 false;$z=array_values(unpack("V*",pack("H*",md5($z))));$W=str2long($Hh,false);$Xe=count($W)-1;$pj=$W[$Xe];$oj=$W[0];$ug=floor(6+52/($Xe+1));$Mh=int32($ug*0x9E3779B9);while($Mh){$lc=$Mh>>2&3;for($Lf=$Xe;$Lf>0;$Lf--){$pj=$W[$Lf-1];$We=xxtea_mx($pj,$oj,$Mh,$z[$Lf&3^$lc]);$oj=int32($W[$Lf]-$We);$W[$Lf]=$oj;}$pj=$W[$Xe];$We=xxtea_mx($pj,$oj,$Mh,$z[$Lf&3^$lc]);$oj=int32($W[0]-$We);$W[0]=$oj;$Mh=int32($Mh-0x9E3779B9);}return
    6734 long2str($W,true);}$h='';$vd=$_SESSION["token"];if(!$vd)$_SESSION["token"]=rand(1,1e6);$pi=get_token();$bg=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($z)=explode(":",$X);$bg[$z]=$X;}}function
    6735 add_invalid_login(){global$b;$id=file_open_lock(get_temp_dir()."/adminer.invalid");if(!$id)return;$Wd=unserialize(stream_get_contents($id));$fi=time();if($Wd){foreach($Wd
    6736 as$Xd=>$X){if($X[0]<$fi)unset($Wd[$Xd]);}}$Vd=&$Wd[$b->bruteForceKey()];if(!$Vd)$Vd=array($fi+30*60,0);$Vd[1]++;file_write_unlock($id,serialize($Wd));}function
    6737 check_invalid_login(){global$b;$Wd=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$Vd=$Wd[$b->bruteForceKey()];$df=($Vd[1]>29?$Vd[0]-time():0);if($df>0)auth_error(lang(83,ceil($df/60)));}$La=$_POST["auth"];if($La){session_regenerate_id();$Xi=$La["driver"];$N=$La["server"];$V=$La["username"];$F=(string)$La["password"];$m=$La["db"];set_password($Xi,$N,$V,$F);$_SESSION["db"][$Xi][$N][$V][$m]=true;if($La["permanent"]){$z=base64_encode($Xi)."-".base64_encode($N)."-".base64_encode($V)."-".base64_encode($m);$ng=$b->permanentLogin(true);$bg[$z]="$z:".base64_encode($ng?encrypt_string($F,$ng):"");cookie("adminer_permanent",implode(" ",$bg));}if(count($_POST)==1||DRIVER!=$Xi||SERVER!=$N||$_GET["username"]!==$V||DB!=$m)redirect(auth_url($Xi,$N,$V,$m));}elseif($_POST["logout"]){if($vd&&!verify_token()){page_header(lang(82),lang(84));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),lang(85).' '.lang(86));}}elseif($bg&&!$_SESSION["pwds"]){session_regenerate_id();$ng=$b->permanentLogin();foreach($bg
    6738 as$z=>$X){list(,$jb)=explode(":",$X);list($Xi,$N,$V,$m)=array_map('base64_decode',explode("-",$z));set_password($Xi,$N,$V,decrypt_string(base64_decode($jb),$ng));$_SESSION["db"][$Xi][$N][$V][$m]=true;}}function
    6739 unset_permanent(){global$bg;foreach($bg
    6740 as$z=>$X){list($Xi,$N,$V,$m)=array_map('base64_decode',explode("-",$z));if($Xi==DRIVER&&$N==SERVER&&$V==$_GET["username"]&&$m==DB)unset($bg[$z]);}cookie("adminer_permanent",implode(" ",$bg));}function
    6741 auth_error($o){global$b,$vd;$nh=session_name();if(isset($_GET["username"])){header("HTTP/1.1 403 Forbidden");if(($_COOKIE[$nh]||$_GET[$nh])&&!$vd)$o=lang(87);else{restart_session();add_invalid_login();$F=get_password();if($F!==null){if($F===false)$o.='<br>'.lang(88,target_blank(),'<code>permanentLogin()</code>');set_password(DRIVER,SERVER,$_GET["username"],null);}unset_permanent();}}if(!$_COOKIE[$nh]&&$_GET[$nh]&&ini_bool("session.use_only_cookies"))$o=lang(89);$Of=session_get_cookie_params();cookie("adminer_key",($_COOKIE["adminer_key"]?$_COOKIE["adminer_key"]:rand_string()),$Of["lifetime"]);page_header(lang(39),$o,null);echo"<form action='' method='post'>\n","<div>";if(hidden_fields($_POST,array("auth")))echo"<p class='message'>".lang(90)."\n";echo"</div>\n";$b->loginForm();echo"</form>\n";page_footer("auth");exit;}if(isset($_GET["username"])&&!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);unset_permanent();page_header(lang(91),lang(92,implode(", ",$hg)),false);page_footer("auth");exit;}stop_session(true);if(isset($_GET["username"])&&is_string(get_password())){list($Ad,$dg)=explode(":",SERVER,2);if(is_numeric($dg)&&$dg<1024)auth_error(lang(93));check_invalid_login();$h=connect();$n=new
    6742 Min_Driver($h);}$ze=null;if(!is_object($h)||($ze=$b->login($_GET["username"],get_password()))!==true){$o=(is_string($h)?h($h):(is_string($ze)?$ze:lang(94)));auth_error($o.(preg_match('~^ | $~',get_password())?'<br>'.lang(95):''));}if($La&&$_POST["token"])$_POST["token"]=$pi;$o='';if($_POST){if(!verify_token()){$Qd="max_input_vars";$Ke=ini_get($Qd);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$z){$X=ini_get($z);if($X&&(!$Ke||$X<$Ke)){$Qd=$z;$Ke=$X;}}}$o=(!$_POST["token"]&&$Ke?lang(96,"'$Qd'"):lang(84).' '.lang(97));}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$o=lang(98,"'post_max_size'");if(isset($_GET["sql"]))$o.=' '.lang(99);}function
    6743 select($H,$i=null,$Cf=array(),$_=0){global$y;$xe=array();$x=array();$f=array();$Ua=array();$U=array();$I=array();odd('');for($t=0;(!$_||$t<$_)&&($J=$H->fetch_row());$t++){if(!$t){echo"<div class='scrollable'>\n","<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($ce=0;$ce<count($J);$ce++){$p=$H->fetch_field();$C=$p->name;$Bf=$p->orgtable;$Af=$p->orgname;$I[$p->table]=$Bf;if($Cf&&$y=="sql")$xe[$ce]=($C=="table"?"table=":($C=="possible_keys"?"indexes=":null));elseif($Bf!=""){if(!isset($x[$Bf])){$x[$Bf]=array();foreach(indexes($Bf,$i)as$w){if($w["type"]=="PRIMARY"){$x[$Bf]=array_flip($w["columns"]);break;}}$f[$Bf]=$x[$Bf];}if(isset($f[$Bf][$Af])){unset($f[$Bf][$Af]);$x[$Bf][$Af]=$ce;$xe[$ce]=$Bf;}}if($p->charsetnr==63)$Ua[$ce]=true;$U[$ce]=$p->type;echo"<th".($Bf!=""||$p->name!=$Af?" title='".h(($Bf!=""?"$Bf.":"").$Af)."'":"").">".h($C).($Cf?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($C),'mariadb'=>"explain/#the-columns-in-explain-select",)):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($J
    6744 as$z=>$X){if($X===null)$X="<i>NULL</i>";elseif($Ua[$z]&&!isutf8($X))$X="<i>".lang(48,strlen($X))."</i>";else{$X=h($X);if($U[$z]==254)$X="<code>$X</code>";}if(isset($xe[$z])&&!$f[$xe[$z]]){if($Cf&&$y=="sql"){$Q=$J[array_search("table=",$xe)];$A=$xe[$z].urlencode($Cf[$Q]!=""?$Cf[$Q]:$Q);}else{$A="edit=".urlencode($xe[$z]);foreach($x[$xe[$z]]as$nb=>$ce)$A.="&where".urlencode("[".bracket_escape($nb)."]")."=".urlencode($J[$ce]);}$X="<a href='".h(ME.$A)."'>$X</a>";}echo"<td>$X";}}echo($t?"</table>\n</div>":"<p class='message'>".lang(12))."\n";return$I;}function
    6745 referencable_primary($hh){$I=array();foreach(table_status('',true)as$Qh=>$Q){if($Qh!=$hh&&fk_support($Q)){foreach(fields($Qh)as$p){if($p["primary"]){if($I[$Qh]){unset($I[$Qh]);break;}$I[$Qh]=$p;}}}}return$I;}function
    6746 adminer_settings(){parse_str($_COOKIE["adminer_settings"],$ph);return$ph;}function
    6747 adminer_setting($z){$ph=adminer_settings();return$ph[$z];}function
    6748 set_adminer_settings($ph){return
    6749 cookie("adminer_settings",http_build_query($ph+adminer_settings()));}function
    6750 textarea($C,$Y,$K=10,$rb=80){global$y;echo"<textarea name='$C' rows='$K' cols='$rb' class='sqlarea jush-$y' spellcheck='false' wrap='off'>";if(is_array($Y)){foreach($Y
     6732decrypt_string($Jh,$z){if($Jh=="")return"";if(!$z)return
     6733false;$z=array_values(unpack("V*",pack("H*",md5($z))));$W=str2long($Jh,false);$Ye=count($W)-1;$sj=$W[$Ye];$rj=$W[0];$wg=floor(6+52/($Ye+1));$Oh=int32($wg*0x9E3779B9);while($Oh){$mc=$Oh>>2&3;for($Nf=$Ye;$Nf>0;$Nf--){$sj=$W[$Nf-1];$Xe=xxtea_mx($sj,$rj,$Oh,$z[$Nf&3^$mc]);$rj=int32($W[$Nf]-$Xe);$W[$Nf]=$rj;}$sj=$W[$Ye];$Xe=xxtea_mx($sj,$rj,$Oh,$z[$Nf&3^$mc]);$rj=int32($W[0]-$Xe);$W[0]=$rj;$Oh=int32($Oh-0x9E3779B9);}return
     6734long2str($W,true);}$h='';$wd=$_SESSION["token"];if(!$wd)$_SESSION["token"]=rand(1,1e6);$ri=get_token();$dg=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($z)=explode(":",$X);$dg[$z]=$X;}}function
     6735add_invalid_login(){global$b;$jd=file_open_lock(get_temp_dir()."/adminer.invalid");if(!$jd)return;$Xd=unserialize(stream_get_contents($jd));$hi=time();if($Xd){foreach($Xd
     6736as$Yd=>$X){if($X[0]<$hi)unset($Xd[$Yd]);}}$Wd=&$Xd[$b->bruteForceKey()];if(!$Wd)$Wd=array($hi+30*60,0);$Wd[1]++;file_write_unlock($jd,serialize($Xd));}function
     6737check_invalid_login(){global$b;$Xd=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$Wd=$Xd[$b->bruteForceKey()];$ef=($Wd[1]>29?$Wd[0]-time():0);if($ef>0)auth_error(lang(83,ceil($ef/60)));}$La=$_POST["auth"];if($La){session_regenerate_id();$aj=$La["driver"];$N=$La["server"];$V=$La["username"];$F=(string)$La["password"];$m=$La["db"];set_password($aj,$N,$V,$F);$_SESSION["db"][$aj][$N][$V][$m]=true;if($La["permanent"]){$z=base64_encode($aj)."-".base64_encode($N)."-".base64_encode($V)."-".base64_encode($m);$pg=$b->permanentLogin(true);$dg[$z]="$z:".base64_encode($pg?encrypt_string($F,$pg):"");cookie("adminer_permanent",implode(" ",$dg));}if(count($_POST)==1||DRIVER!=$aj||SERVER!=$N||$_GET["username"]!==$V||DB!=$m)redirect(auth_url($aj,$N,$V,$m));}elseif($_POST["logout"]){if($wd&&!verify_token()){page_header(lang(82),lang(84));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),lang(85).' '.lang(86));}}elseif($dg&&!$_SESSION["pwds"]){session_regenerate_id();$pg=$b->permanentLogin();foreach($dg
     6738as$z=>$X){list(,$kb)=explode(":",$X);list($aj,$N,$V,$m)=array_map('base64_decode',explode("-",$z));set_password($aj,$N,$V,decrypt_string(base64_decode($kb),$pg));$_SESSION["db"][$aj][$N][$V][$m]=true;}}function
     6739unset_permanent(){global$dg;foreach($dg
     6740as$z=>$X){list($aj,$N,$V,$m)=array_map('base64_decode',explode("-",$z));if($aj==DRIVER&&$N==SERVER&&$V==$_GET["username"]&&$m==DB)unset($dg[$z]);}cookie("adminer_permanent",implode(" ",$dg));}function
     6741auth_error($o){global$b,$wd;$ph=session_name();if(isset($_GET["username"])){header("HTTP/1.1 403 Forbidden");if(($_COOKIE[$ph]||$_GET[$ph])&&!$wd)$o=lang(87);else{restart_session();add_invalid_login();$F=get_password();if($F!==null){if($F===false)$o.='<br>'.lang(88,target_blank(),'<code>permanentLogin()</code>');set_password(DRIVER,SERVER,$_GET["username"],null);}unset_permanent();}}if(!$_COOKIE[$ph]&&$_GET[$ph]&&ini_bool("session.use_only_cookies"))$o=lang(89);$Qf=session_get_cookie_params();cookie("adminer_key",($_COOKIE["adminer_key"]?$_COOKIE["adminer_key"]:rand_string()),$Qf["lifetime"]);page_header(lang(39),$o,null);echo"<form action='' method='post'>\n","<div>";if(hidden_fields($_POST,array("auth")))echo"<p class='message'>".lang(90)."\n";echo"</div>\n";$b->loginForm();echo"</form>\n";page_footer("auth");exit;}if(isset($_GET["username"])&&!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);unset_permanent();page_header(lang(91),lang(92,implode(", ",$jg)),false);page_footer("auth");exit;}stop_session(true);if(isset($_GET["username"])&&is_string(get_password())){list($Bd,$fg)=explode(":",SERVER,2);if(is_numeric($fg)&&$fg<1024)auth_error(lang(93));check_invalid_login();$h=connect();$n=new
     6742Min_Driver($h);}$_e=null;if(!is_object($h)||($_e=$b->login($_GET["username"],get_password()))!==true){$o=(is_string($h)?h($h):(is_string($_e)?$_e:lang(94)));auth_error($o.(preg_match('~^ | $~',get_password())?'<br>'.lang(95):''));}if($La&&$_POST["token"])$_POST["token"]=$ri;$o='';if($_POST){if(!verify_token()){$Rd="max_input_vars";$Le=ini_get($Rd);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$z){$X=ini_get($z);if($X&&(!$Le||$X<$Le)){$Rd=$z;$Le=$X;}}}$o=(!$_POST["token"]&&$Le?lang(96,"'$Rd'"):lang(84).' '.lang(97));}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$o=lang(98,"'post_max_size'");if(isset($_GET["sql"]))$o.=' '.lang(99);}function
     6743select($H,$i=null,$Ef=array(),$_=0){global$y;$ye=array();$x=array();$f=array();$Va=array();$U=array();$I=array();odd('');for($t=0;(!$_||$t<$_)&&($J=$H->fetch_row());$t++){if(!$t){echo"<div class='scrollable'>\n","<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($de=0;$de<count($J);$de++){$p=$H->fetch_field();$C=$p->name;$Df=$p->orgtable;$Cf=$p->orgname;$I[$p->table]=$Df;if($Ef&&$y=="sql")$ye[$de]=($C=="table"?"table=":($C=="possible_keys"?"indexes=":null));elseif($Df!=""){if(!isset($x[$Df])){$x[$Df]=array();foreach(indexes($Df,$i)as$w){if($w["type"]=="PRIMARY"){$x[$Df]=array_flip($w["columns"]);break;}}$f[$Df]=$x[$Df];}if(isset($f[$Df][$Cf])){unset($f[$Df][$Cf]);$x[$Df][$Cf]=$de;$ye[$de]=$Df;}}if($p->charsetnr==63)$Va[$de]=true;$U[$de]=$p->type;echo"<th".($Df!=""||$p->name!=$Cf?" title='".h(($Df!=""?"$Df.":"").$Cf)."'":"").">".h($C).($Ef?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($C),'mariadb'=>"explain/#the-columns-in-explain-select",)):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($J
     6744as$z=>$X){if($X===null)$X="<i>NULL</i>";elseif($Va[$z]&&!isutf8($X))$X="<i>".lang(48,strlen($X))."</i>";else{$X=h($X);if($U[$z]==254)$X="<code>$X</code>";}if(isset($ye[$z])&&!$f[$ye[$z]]){if($Ef&&$y=="sql"){$Q=$J[array_search("table=",$ye)];$A=$ye[$z].urlencode($Ef[$Q]!=""?$Ef[$Q]:$Q);}else{$A="edit=".urlencode($ye[$z]);foreach($x[$ye[$z]]as$ob=>$de)$A.="&where".urlencode("[".bracket_escape($ob)."]")."=".urlencode($J[$de]);}$X="<a href='".h(ME.$A)."'>$X</a>";}echo"<td>$X";}}echo($t?"</table>\n</div>":"<p class='message'>".lang(12))."\n";return$I;}function
     6745referencable_primary($jh){$I=array();foreach(table_status('',true)as$Sh=>$Q){if($Sh!=$jh&&fk_support($Q)){foreach(fields($Sh)as$p){if($p["primary"]){if($I[$Sh]){unset($I[$Sh]);break;}$I[$Sh]=$p;}}}}return$I;}function
     6746adminer_settings(){parse_str($_COOKIE["adminer_settings"],$rh);return$rh;}function
     6747adminer_setting($z){$rh=adminer_settings();return$rh[$z];}function
     6748set_adminer_settings($rh){return
     6749cookie("adminer_settings",http_build_query($rh+adminer_settings()));}function
     6750textarea($C,$Y,$K=10,$sb=80){global$y;echo"<textarea name='$C' rows='$K' cols='$sb' class='sqlarea jush-$y' spellcheck='false' wrap='off'>";if(is_array($Y)){foreach($Y
    67516751as$X)echo
    67526752h($X[0])."\n\n\n";}else
    67536753echo
    67546754h($Y);echo"</textarea>";}function
    6755 edit_type($z,$p,$pb,$ed=array(),$Lc=array()){global$Ih,$U,$Ji,$qf;$T=$p["type"];echo'<td><select name="',h($z),'[type]" class="type" aria-labelledby="label-type">';if($T&&!isset($U[$T])&&!isset($ed[$T])&&!in_array($T,$Lc))$Lc[]=$T;if($ed)$Ih[lang(100)]=$ed;echo
    6756 optionlist(array_merge($Lc,$Ih),$T),'</select>
    6757 ',on_help("getTarget(event).value",1),script("mixin(qsl('select'), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});",""),'<td><input name="',h($z),'[length]" value="',h($p["length"]),'" size="3"',(!$p["length"]&&preg_match('~var(char|binary)$~',$T)?" class='required'":"");echo' aria-labelledby="label-length">',script("mixin(qsl('input'), {onfocus: editingLengthFocus, oninput: editingLengthChange});",""),'<td class="options">',"<select name='".h($z)."[collation]'".(preg_match('~(char|text|enum|set)$~',$T)?"":" class='hidden'").'><option value="">('.lang(101).')'.optionlist($pb,$p["collation"]).'</select>',($Ji?"<select name='".h($z)."[unsigned]'".(!$T||preg_match(number_type(),$T)?"":" class='hidden'").'><option>'.optionlist($Ji,$p["unsigned"]).'</select>':''),(isset($p['on_update'])?"<select name='".h($z)."[on_update]'".(preg_match('~timestamp|datetime~',$T)?"":" class='hidden'").'>'.optionlist(array(""=>"(".lang(102).")","CURRENT_TIMESTAMP"),(preg_match('~^CURRENT_TIMESTAMP~i',$p["on_update"])?"CURRENT_TIMESTAMP":$p["on_update"])).'</select>':''),($ed?"<select name='".h($z)."[on_delete]'".(preg_match("~`~",$T)?"":" class='hidden'")."><option value=''>(".lang(103).")".optionlist(explode("|",$qf),$p["on_delete"])."</select> ":" ");}function
    6758 process_length($ue){global$wc;return(preg_match("~^\\s*\\(?\\s*$wc(?:\\s*,\\s*$wc)*+\\s*\\)?\\s*\$~",$ue)&&preg_match_all("~$wc~",$ue,$Ee)?"(".implode(",",$Ee[0]).")":preg_replace('~^[0-9].*~','(\0)',preg_replace('~[^-0-9,+()[\]]~','',$ue)));}function
    6759 process_type($p,$ob="COLLATE"){global$Ji;return" $p[type]".process_length($p["length"]).(preg_match(number_type(),$p["type"])&&in_array($p["unsigned"],$Ji)?" $p[unsigned]":"").(preg_match('~char|text|enum|set~',$p["type"])&&$p["collation"]?" $ob ".q($p["collation"]):"");}function
    6760 process_field($p,$Bi){return
    6761 array(idf_escape(trim($p["field"])),process_type($Bi),($p["null"]?" NULL":" NOT NULL"),default_value($p),(preg_match('~timestamp|datetime~',$p["type"])&&$p["on_update"]?" ON UPDATE $p[on_update]":""),(support("comment")&&$p["comment"]!=""?" COMMENT ".q($p["comment"]):""),($p["auto_increment"]?auto_increment():null),);}function
    6762 default_value($p){$Sb=$p["default"];return($Sb===null?"":" DEFAULT ".(preg_match('~char|binary|text|enum|set~',$p["type"])||preg_match('~^(?![a-z])~i',$Sb)?q($Sb):$Sb));}function
     6755edit_type($z,$p,$qb,$fd=array(),$Mc=array()){global$Kh,$U,$Li,$sf;$T=$p["type"];echo'<td><select name="',h($z),'[type]" class="type" aria-labelledby="label-type">';if($T&&!isset($U[$T])&&!isset($fd[$T])&&!in_array($T,$Mc))$Mc[]=$T;if($fd)$Kh[lang(100)]=$fd;echo
     6756optionlist(array_merge($Mc,$Kh),$T),'</select>
     6757',on_help("getTarget(event).value",1),script("mixin(qsl('select'), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});",""),'<td><input name="',h($z),'[length]" value="',h($p["length"]),'" size="3"',(!$p["length"]&&preg_match('~var(char|binary)$~',$T)?" class='required'":"");echo' aria-labelledby="label-length">',script("mixin(qsl('input'), {onfocus: editingLengthFocus, oninput: editingLengthChange});",""),'<td class="options">',"<select name='".h($z)."[collation]'".(preg_match('~(char|text|enum|set)$~',$T)?"":" class='hidden'").'><option value="">('.lang(101).')'.optionlist($qb,$p["collation"]).'</select>',($Li?"<select name='".h($z)."[unsigned]'".(!$T||preg_match(number_type(),$T)?"":" class='hidden'").'><option>'.optionlist($Li,$p["unsigned"]).'</select>':''),(isset($p['on_update'])?"<select name='".h($z)."[on_update]'".(preg_match('~timestamp|datetime~',$T)?"":" class='hidden'").'>'.optionlist(array(""=>"(".lang(102).")","CURRENT_TIMESTAMP"),(preg_match('~^CURRENT_TIMESTAMP~i',$p["on_update"])?"CURRENT_TIMESTAMP":$p["on_update"])).'</select>':''),($fd?"<select name='".h($z)."[on_delete]'".(preg_match("~`~",$T)?"":" class='hidden'")."><option value=''>(".lang(103).")".optionlist(explode("|",$sf),$p["on_delete"])."</select> ":" ");}function
     6758process_length($ve){global$xc;return(preg_match("~^\\s*\\(?\\s*$xc(?:\\s*,\\s*$xc)*+\\s*\\)?\\s*\$~",$ve)&&preg_match_all("~$xc~",$ve,$Fe)?"(".implode(",",$Fe[0]).")":preg_replace('~^[0-9].*~','(\0)',preg_replace('~[^-0-9,+()[\]]~','',$ve)));}function
     6759process_type($p,$pb="COLLATE"){global$Li;return" $p[type]".process_length($p["length"]).(preg_match(number_type(),$p["type"])&&in_array($p["unsigned"],$Li)?" $p[unsigned]":"").(preg_match('~char|text|enum|set~',$p["type"])&&$p["collation"]?" $pb ".q($p["collation"]):"");}function
     6760process_field($p,$Di){return
     6761array(idf_escape(trim($p["field"])),process_type($Di),($p["null"]?" NULL":" NOT NULL"),default_value($p),(preg_match('~timestamp|datetime~',$p["type"])&&$p["on_update"]?" ON UPDATE $p[on_update]":""),(support("comment")&&$p["comment"]!=""?" COMMENT ".q($p["comment"]):""),($p["auto_increment"]?auto_increment():null),);}function
     6762default_value($p){$Ub=$p["default"];return($Ub===null?"":" DEFAULT ".(preg_match('~char|binary|text|enum|set~',$p["type"])||preg_match('~^(?![a-z])~i',$Ub)?q($Ub):$Ub));}function
    67636763type_class($T){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$z=>$X){if(preg_match("~$z|$X~",$T))return" class='$z'";}}function
    6764 edit_fields($q,$pb,$T="TABLE",$ed=array()){global$Rd;$q=array_values($q);echo'<thead><tr>
     6764edit_fields($q,$qb,$T="TABLE",$fd=array()){global$Sd;$q=array_values($q);echo'<thead><tr>
    67656765';if($T=="PROCEDURE"){echo'<td>';}echo'<th id="label-name">',($T=="TABLE"?lang(104):lang(105)),'<td id="label-type">',lang(50),'<textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;"></textarea>',script("qs('#enum-edit').onblur = editingLengthBlur;"),'<td id="label-length">',lang(106),'<td>',lang(107);if($T=="TABLE"){echo'<td id="label-null">NULL
    6766 <td><input type="radio" name="auto_increment_col" value=""><acronym id="label-ai" title="',lang(52),'">AI</acronym>',doc_link(array('sql'=>"example-auto-increment.html",'mariadb'=>"auto_increment/",'sqlite'=>"autoinc.html",'pgsql'=>"datatype.html#DATATYPE-SERIAL",'mssql'=>"ms186775.aspx",)),'<td id="label-default">',lang(53),(support("comment")?"<td id='label-comment'>".lang(51):"");}echo'<td>',"<input type='image' class='icon' name='add[".(support("move_col")?0:count($q))."]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.2")."' alt='+' title='".lang(108)."'>".script("row_count = ".count($q).";"),'</thead>
     6766<td><input type="radio" name="auto_increment_col" value=""><acronym id="label-ai" title="',lang(52),'">AI</acronym>',doc_link(array('sql'=>"example-auto-increment.html",'mariadb'=>"auto_increment/",'sqlite'=>"autoinc.html",'pgsql'=>"datatype.html#DATATYPE-SERIAL",'mssql'=>"ms186775.aspx",)),'<td id="label-default">',lang(53),(support("comment")?"<td id='label-comment'>".lang(51):"");}echo'<td>',"<input type='image' class='icon' name='add[".(support("move_col")?0:count($q))."]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.4")."' alt='+' title='".lang(108)."'>".script("row_count = ".count($q).";"),'</thead>
    67676767<tbody>
    67686768',script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown, oninput: editingInput});");foreach($q
    6769 as$t=>$p){$t++;$Df=$p[($_POST?"orig":"field")];$ac=(isset($_POST["add"][$t-1])||(isset($p["field"])&&!$_POST["drop_col"][$t]))&&(support("drop_col")||$Df=="");echo'<tr',($ac?"":" style='display: none;'"),'>
    6770 ',($T=="PROCEDURE"?"<td>".html_select("fields[$t][inout]",explode("|",$Rd),$p["inout"]):""),'<th>';if($ac){echo'<input name="fields[',$t,'][field]" value="',h($p["field"]),'" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name">',script("qsl('input').oninput = function () { editingNameChange.call(this);".($p["field"]!=""||count($q)>1?"":" editingAddRow.call(this);")." };","");}echo'<input type="hidden" name="fields[',$t,'][orig]" value="',h($Df),'">
    6771 ';edit_type("fields[$t]",$p,$pb,$ed);if($T=="TABLE"){echo'<td>',checkbox("fields[$t][null]",1,$p["null"],"","","block","label-null"),'<td><label class="block"><input type="radio" name="auto_increment_col" value="',$t,'"';if($p["auto_increment"]){echo' checked';}echo' aria-labelledby="label-ai"></label><td>',checkbox("fields[$t][has_default]",1,$p["has_default"],"","","","label-default"),'<input name="fields[',$t,'][default]" value="',h($p["default"]),'" aria-labelledby="label-default">',(support("comment")?"<td><input name='fields[$t][comment]' value='".h($p["comment"])."' data-maxlength='".(min_version(5.5)?1024:255)."' aria-labelledby='label-comment'>":"");}echo"<td>",(support("move_col")?"<input type='image' class='icon' name='add[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.2")."' alt='+' title='".lang(108)."'> "."<input type='image' class='icon' name='up[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=up.gif&version=4.7.2")."' alt='↑' title='".lang(109)."'> "."<input type='image' class='icon' name='down[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=down.gif&version=4.7.2")."' alt='↓' title='".lang(110)."'> ":""),($Df==""||support("drop_col")?"<input type='image' class='icon' name='drop_col[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.7.2")."' alt='x' title='".lang(111)."'>":"");}}function
    6772 process_fields(&$q){$D=0;if($_POST["up"]){$oe=0;foreach($q
    6773 as$z=>$p){if(key($_POST["up"])==$z){unset($q[$z]);array_splice($q,$oe,0,array($p));break;}if(isset($p["field"]))$oe=$D;$D++;}}elseif($_POST["down"]){$gd=false;foreach($q
    6774 as$z=>$p){if(isset($p["field"])&&$gd){unset($q[key($_POST["down"])]);array_splice($q,$D,0,array($gd));break;}if(key($_POST["down"])==$z)$gd=$p;$D++;}}elseif($_POST["add"]){$q=array_values($q);array_splice($q,key($_POST["add"]),0,array(array()));}elseif(!$_POST["drop_col"])return
     6769as$t=>$p){$t++;$Ff=$p[($_POST?"orig":"field")];$cc=(isset($_POST["add"][$t-1])||(isset($p["field"])&&!$_POST["drop_col"][$t]))&&(support("drop_col")||$Ff=="");echo'<tr',($cc?"":" style='display: none;'"),'>
     6770',($T=="PROCEDURE"?"<td>".html_select("fields[$t][inout]",explode("|",$Sd),$p["inout"]):""),'<th>';if($cc){echo'<input name="fields[',$t,'][field]" value="',h($p["field"]),'" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name">',script("qsl('input').oninput = function () { editingNameChange.call(this);".($p["field"]!=""||count($q)>1?"":" editingAddRow.call(this);")." };","");}echo'<input type="hidden" name="fields[',$t,'][orig]" value="',h($Ff),'">
     6771';edit_type("fields[$t]",$p,$qb,$fd);if($T=="TABLE"){echo'<td>',checkbox("fields[$t][null]",1,$p["null"],"","","block","label-null"),'<td><label class="block"><input type="radio" name="auto_increment_col" value="',$t,'"';if($p["auto_increment"]){echo' checked';}echo' aria-labelledby="label-ai"></label><td>',checkbox("fields[$t][has_default]",1,$p["has_default"],"","","","label-default"),'<input name="fields[',$t,'][default]" value="',h($p["default"]),'" aria-labelledby="label-default">',(support("comment")?"<td><input name='fields[$t][comment]' value='".h($p["comment"])."' data-maxlength='".(min_version(5.5)?1024:255)."' aria-labelledby='label-comment'>":"");}echo"<td>",(support("move_col")?"<input type='image' class='icon' name='add[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.4")."' alt='+' title='".lang(108)."'> "."<input type='image' class='icon' name='up[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=up.gif&version=4.7.4")."' alt='↑' title='".lang(109)."'> "."<input type='image' class='icon' name='down[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=down.gif&version=4.7.4")."' alt='↓' title='".lang(110)."'> ":""),($Ff==""||support("drop_col")?"<input type='image' class='icon' name='drop_col[$t]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.7.4")."' alt='x' title='".lang(111)."'>":"");}}function
     6772process_fields(&$q){$D=0;if($_POST["up"]){$pe=0;foreach($q
     6773as$z=>$p){if(key($_POST["up"])==$z){unset($q[$z]);array_splice($q,$pe,0,array($p));break;}if(isset($p["field"]))$pe=$D;$D++;}}elseif($_POST["down"]){$hd=false;foreach($q
     6774as$z=>$p){if(isset($p["field"])&&$hd){unset($q[key($_POST["down"])]);array_splice($q,$D,0,array($hd));break;}if(key($_POST["down"])==$z)$hd=$p;$D++;}}elseif($_POST["add"]){$q=array_values($q);array_splice($q,key($_POST["add"]),0,array(array()));}elseif(!$_POST["drop_col"])return
    67756775false;return
    67766776true;}function
    67776777normalize_enum($B){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($B[0][0].$B[0][0],$B[0][0],substr($B[0],1,-1))),'\\'))."'";}function
    6778 grant($ld,$pg,$f,$pf){if(!$pg)return
    6779 true;if($pg==array("ALL PRIVILEGES","GRANT OPTION"))return($ld=="GRANT"?queries("$ld ALL PRIVILEGES$pf WITH GRANT OPTION"):queries("$ld ALL PRIVILEGES$pf")&&queries("$ld GRANT OPTION$pf"));return
    6780 queries("$ld ".preg_replace('~(GRANT OPTION)\([^)]*\)~','\1',implode("$f, ",$pg).$f).$pf);}function
    6781 drop_create($fc,$j,$gc,$ci,$ic,$ye,$Pe,$Ne,$Oe,$mf,$af){if($_POST["drop"])query_redirect($fc,$ye,$Pe);elseif($mf=="")query_redirect($j,$ye,$Oe);elseif($mf!=$af){$Fb=queries($j);queries_redirect($ye,$Ne,$Fb&&queries($fc));if($Fb)queries($gc);}else
    6782 queries_redirect($ye,$Ne,queries($ci)&&queries($ic)&&queries($fc)&&queries($j));}function
    6783 create_trigger($pf,$J){global$y;$hi=" $J[Timing] $J[Event]".($J["Event"]=="UPDATE OF"?" ".idf_escape($J["Of"]):"");return"CREATE TRIGGER ".idf_escape($J["Trigger"]).($y=="mssql"?$pf.$hi:$hi.$pf).rtrim(" $J[Type]\n$J[Statement]",";").";";}function
    6784 create_routine($Ug,$J){global$Rd,$y;$O=array();$q=(array)$J["fields"];ksort($q);foreach($q
    6785 as$p){if($p["field"]!="")$O[]=(preg_match("~^($Rd)\$~",$p["inout"])?"$p[inout] ":"").idf_escape($p["field"]).process_type($p,"CHARACTER SET");}$Tb=rtrim("\n$J[definition]",";");return"CREATE $Ug ".idf_escape(trim($J["name"]))." (".implode(", ",$O).")".(isset($_GET["function"])?" RETURNS".process_type($J["returns"],"CHARACTER SET"):"").($J["language"]?" LANGUAGE $J[language]":"").($y=="pgsql"?" AS ".q($Tb):"$Tb;");}function
     6778grant($md,$rg,$f,$rf){if(!$rg)return
     6779true;if($rg==array("ALL PRIVILEGES","GRANT OPTION"))return($md=="GRANT"?queries("$md ALL PRIVILEGES$rf WITH GRANT OPTION"):queries("$md ALL PRIVILEGES$rf")&&queries("$md GRANT OPTION$rf"));return
     6780queries("$md ".preg_replace('~(GRANT OPTION)\([^)]*\)~','\1',implode("$f, ",$rg).$f).$rf);}function
     6781drop_create($gc,$j,$hc,$ei,$jc,$ze,$Qe,$Oe,$Pe,$of,$bf){if($_POST["drop"])query_redirect($gc,$ze,$Qe);elseif($of=="")query_redirect($j,$ze,$Pe);elseif($of!=$bf){$Hb=queries($j);queries_redirect($ze,$Oe,$Hb&&queries($gc));if($Hb)queries($hc);}else
     6782queries_redirect($ze,$Oe,queries($ei)&&queries($jc)&&queries($gc)&&queries($j));}function
     6783create_trigger($rf,$J){global$y;$ji=" $J[Timing] $J[Event]".($J["Event"]=="UPDATE OF"?" ".idf_escape($J["Of"]):"");return"CREATE TRIGGER ".idf_escape($J["Trigger"]).($y=="mssql"?$rf.$ji:$ji.$rf).rtrim(" $J[Type]\n$J[Statement]",";").";";}function
     6784create_routine($Wg,$J){global$Sd,$y;$O=array();$q=(array)$J["fields"];ksort($q);foreach($q
     6785as$p){if($p["field"]!="")$O[]=(preg_match("~^($Sd)\$~",$p["inout"])?"$p[inout] ":"").idf_escape($p["field"]).process_type($p,"CHARACTER SET");}$Vb=rtrim("\n$J[definition]",";");return"CREATE $Wg ".idf_escape(trim($J["name"]))." (".implode(", ",$O).")".(isset($_GET["function"])?" RETURNS".process_type($J["returns"],"CHARACTER SET"):"").($J["language"]?" LANGUAGE $J[language]":"").($y=="pgsql"?" AS ".q($Vb):"$Vb;");}function
    67866786remove_definer($G){return
    67876787preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\1)',logged_user()).'`~','\1',$G);}function
    6788 format_foreign_key($r){global$qf;return" FOREIGN KEY (".implode(", ",array_map('idf_escape',$r["source"])).") REFERENCES ".table($r["table"])." (".implode(", ",array_map('idf_escape',$r["target"])).")".(preg_match("~^($qf)\$~",$r["on_delete"])?" ON DELETE $r[on_delete]":"").(preg_match("~^($qf)\$~",$r["on_update"])?" ON UPDATE $r[on_update]":"");}function
    6789 tar_file($Uc,$mi){$I=pack("a100a8a8a8a12a12",$Uc,644,0,0,decoct($mi->size),decoct(time()));$hb=8*32;for($t=0;$t<strlen($I);$t++)$hb+=ord($I[$t]);$I.=sprintf("%06o",$hb)."\0 ";echo$I,str_repeat("\0",512-strlen($I));$mi->send();echo
    6790 str_repeat("\0",511-($mi->size+511)%512);}function
    6791 ini_bytes($Qd){$X=ini_get($Qd);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}function
    6792 doc_link($Zf,$di="<sup>?</sup>"){global$y,$h;$lh=$h->server_info;$Yi=preg_replace('~^(\d\.?\d).*~s','\1',$lh);$Oi=array('sql'=>"https://dev.mysql.com/doc/refman/$Yi/en/",'sqlite'=>"https://www.sqlite.org/",'pgsql'=>"https://www.postgresql.org/docs/$Yi/static/",'mssql'=>"https://msdn.microsoft.com/library/",'oracle'=>"https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",);if(preg_match('~MariaDB~',$lh)){$Oi['sql']="https://mariadb.com/kb/en/library/";$Zf['sql']=(isset($Zf['mariadb'])?$Zf['mariadb']:str_replace(".html","/",$Zf['sql']));}return($Zf[$y]?"<a href='$Oi[$y]$Zf[$y]'".target_blank().">$di</a>":"");}function
     6788format_foreign_key($r){global$sf;$m=$r["db"];$gf=$r["ns"];return" FOREIGN KEY (".implode(", ",array_map('idf_escape',$r["source"])).") REFERENCES ".($m!=""&&$m!=$_GET["db"]?idf_escape($m).".":"").($gf!=""&&$gf!=$_GET["ns"]?idf_escape($gf).".":"").table($r["table"])." (".implode(", ",array_map('idf_escape',$r["target"])).")".(preg_match("~^($sf)\$~",$r["on_delete"])?" ON DELETE $r[on_delete]":"").(preg_match("~^($sf)\$~",$r["on_update"])?" ON UPDATE $r[on_update]":"");}function
     6789tar_file($Vc,$oi){$I=pack("a100a8a8a8a12a12",$Vc,644,0,0,decoct($oi->size),decoct(time()));$ib=8*32;for($t=0;$t<strlen($I);$t++)$ib+=ord($I[$t]);$I.=sprintf("%06o",$ib)."\0 ";echo$I,str_repeat("\0",512-strlen($I));$oi->send();echo
     6790str_repeat("\0",511-($oi->size+511)%512);}function
     6791ini_bytes($Rd){$X=ini_get($Rd);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}function
     6792doc_link($bg,$fi="<sup>?</sup>"){global$y,$h;$nh=$h->server_info;$bj=preg_replace('~^(\d\.?\d).*~s','\1',$nh);$Qi=array('sql'=>"https://dev.mysql.com/doc/refman/$bj/en/",'sqlite'=>"https://www.sqlite.org/",'pgsql'=>"https://www.postgresql.org/docs/$bj/",'mssql'=>"https://msdn.microsoft.com/library/",'oracle'=>"https://www.oracle.com/pls/topic/lookup?ctx=db".preg_replace('~^.* (\d+)\.(\d+)\.\d+\.\d+\.\d+.*~s','\1\2',$nh)."&id=",);if(preg_match('~MariaDB~',$nh)){$Qi['sql']="https://mariadb.com/kb/en/library/";$bg['sql']=(isset($bg['mariadb'])?$bg['mariadb']:str_replace(".html","/",$bg['sql']));}return($bg[$y]?"<a href='$Qi[$y]$bg[$y]'".target_blank().">$fi</a>":"");}function
    67936793ob_gzencode($P){return
    67946794gzencode($P);}function
     
    67966796format_number($I);}function
    67976797set_utf8mb4($j){global$h;static$O=false;if(!$O&&preg_match('~\butf8mb4~i',$j)){$O=true;echo"SET NAMES ".charset($h).";\n\n";}}function
    6798 connect_error(){global$b,$h,$pi,$o,$ec;if(DB!=""){header("HTTP/1.1 404 Not Found");page_header(lang(38).": ".h(DB),lang(112),true);}else{if($_POST["db"]&&!$o)queries_redirect(substr(ME,0,-1),lang(113),drop_databases($_POST["db"]));page_header(lang(114),$o,false);echo"<p class='links'>\n";foreach(array('database'=>lang(115),'privileges'=>lang(72),'processlist'=>lang(116),'variables'=>lang(117),'status'=>lang(118),)as$z=>$X){if(support($z))echo"<a href='".h(ME)."$z='>$X</a>\n";}echo"<p>".lang(119,$ec[DRIVER],"<b>".h($h->server_info)."</b>","<b>$h->extension</b>")."\n","<p>".lang(120,"<b>".h(logged_user())."</b>")."\n";$l=$b->databases();if($l){$bh=support("scheme");$pb=collations();echo"<form action='' method='post'>\n","<table cellspacing='0' class='checkable'>\n",script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"),"<thead><tr>".(support("database")?"<td>":"")."<th>".lang(38)." - <a href='".h(ME)."refresh=1'>".lang(121)."</a>"."<td>".lang(122)."<td>".lang(123)."<td>".lang(124)." - <a href='".h(ME)."dbsize=1'>".lang(125)."</a>".script("qsl('a').onclick = partial(ajaxSetHtml, '".js_escape(ME)."script=connect');","")."</thead>\n";$l=($_GET["dbsize"]?count_tables($l):array_flip($l));foreach($l
    6799 as$m=>$S){$Tg=h(ME)."db=".urlencode($m);$u=h("Db-".$m);echo"<tr".odd().">".(support("database")?"<td>".checkbox("db[]",$m,in_array($m,(array)$_POST["db"]),"","","",$u):""),"<th><a href='$Tg' id='$u'>".h($m)."</a>";$d=h(db_collation($m,$pb));echo"<td>".(support("database")?"<a href='$Tg".($bh?"&amp;ns=":"")."&amp;database=' title='".lang(68)."'>$d</a>":$d),"<td align='right'><a href='$Tg&amp;schema=' id='tables-".h($m)."' title='".lang(71)."'>".($_GET["dbsize"]?$S:"?")."</a>","<td align='right' id='size-".h($m)."'>".($_GET["dbsize"]?db_size($m):"?"),"\n";}echo"</table>\n",(support("database")?"<div class='footer'><div>\n"."<fieldset><legend>".lang(126)." <span id='selected'></span></legend><div>\n"."<input type='hidden' name='all' value=''>".script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^db/)); };")."<input type='submit' name='drop' value='".lang(127)."'>".confirm()."\n"."</div></fieldset>\n"."</div></div>\n":""),"<input type='hidden' name='token' value='$pi'>\n","</form>\n",script("tableCheck();");}}page_footer("db");}if(isset($_GET["status"]))$_GET["variables"]=$_GET["status"];if(isset($_GET["import"]))$_GET["sql"]=$_GET["import"];if(!(DB!=""?$h->select_db(DB):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"])||isset($_GET["variables"])||$_GET["script"]=="connect"||$_GET["script"]=="kill")){if(DB!=""||$_GET["refresh"]){restart_session();set_session("dbs",null);}connect_error();exit;}if(support("scheme")&&DB!=""&&$_GET["ns"]!==""){if(!isset($_GET["ns"]))redirect(preg_replace('~ns=[^&]*&~','',ME)."ns=".get_schema());if(!set_schema($_GET["ns"])){header("HTTP/1.1 404 Not Found");page_header(lang(78).": ".h($_GET["ns"]),lang(128),true);page_footer("ns");exit;}}$qf="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";class
     6798connect_error(){global$b,$h,$ri,$o,$fc;if(DB!=""){header("HTTP/1.1 404 Not Found");page_header(lang(38).": ".h(DB),lang(112),true);}else{if($_POST["db"]&&!$o)queries_redirect(substr(ME,0,-1),lang(113),drop_databases($_POST["db"]));page_header(lang(114),$o,false);echo"<p class='links'>\n";foreach(array('database'=>lang(115),'privileges'=>lang(72),'processlist'=>lang(116),'variables'=>lang(117),'status'=>lang(118),)as$z=>$X){if(support($z))echo"<a href='".h(ME)."$z='>$X</a>\n";}echo"<p>".lang(119,$fc[DRIVER],"<b>".h($h->server_info)."</b>","<b>$h->extension</b>")."\n","<p>".lang(120,"<b>".h(logged_user())."</b>")."\n";$l=$b->databases();if($l){$dh=support("scheme");$qb=collations();echo"<form action='' method='post'>\n","<table cellspacing='0' class='checkable'>\n",script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"),"<thead><tr>".(support("database")?"<td>":"")."<th>".lang(38)." - <a href='".h(ME)."refresh=1'>".lang(121)."</a>"."<td>".lang(122)."<td>".lang(123)."<td>".lang(124)." - <a href='".h(ME)."dbsize=1'>".lang(125)."</a>".script("qsl('a').onclick = partial(ajaxSetHtml, '".js_escape(ME)."script=connect');","")."</thead>\n";$l=($_GET["dbsize"]?count_tables($l):array_flip($l));foreach($l
     6799as$m=>$S){$Vg=h(ME)."db=".urlencode($m);$u=h("Db-".$m);echo"<tr".odd().">".(support("database")?"<td>".checkbox("db[]",$m,in_array($m,(array)$_POST["db"]),"","","",$u):""),"<th><a href='$Vg' id='$u'>".h($m)."</a>";$d=h(db_collation($m,$qb));echo"<td>".(support("database")?"<a href='$Vg".($dh?"&amp;ns=":"")."&amp;database=' title='".lang(68)."'>$d</a>":$d),"<td align='right'><a href='$Vg&amp;schema=' id='tables-".h($m)."' title='".lang(71)."'>".($_GET["dbsize"]?$S:"?")."</a>","<td align='right' id='size-".h($m)."'>".($_GET["dbsize"]?db_size($m):"?"),"\n";}echo"</table>\n",(support("database")?"<div class='footer'><div>\n"."<fieldset><legend>".lang(126)." <span id='selected'></span></legend><div>\n"."<input type='hidden' name='all' value=''>".script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^db/)); };")."<input type='submit' name='drop' value='".lang(127)."'>".confirm()."\n"."</div></fieldset>\n"."</div></div>\n":""),"<input type='hidden' name='token' value='$ri'>\n","</form>\n",script("tableCheck();");}}page_footer("db");}if(isset($_GET["status"]))$_GET["variables"]=$_GET["status"];if(isset($_GET["import"]))$_GET["sql"]=$_GET["import"];if(!(DB!=""?$h->select_db(DB):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"])||isset($_GET["variables"])||$_GET["script"]=="connect"||$_GET["script"]=="kill")){if(DB!=""||$_GET["refresh"]){restart_session();set_session("dbs",null);}connect_error();exit;}if(support("scheme")&&DB!=""&&$_GET["ns"]!==""){if(!isset($_GET["ns"]))redirect(preg_replace('~ns=[^&]*&~','',ME)."ns=".get_schema());if(!set_schema($_GET["ns"])){header("HTTP/1.1 404 Not Found");page_header(lang(78).": ".h($_GET["ns"]),lang(128),true);page_footer("ns");exit;}}$sf="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";class
    68006800TmpFile{var$handler;var$size;function
    68016801__construct(){$this->handler=tmpfile();}function
    6802 write($Ab){$this->size+=strlen($Ab);fwrite($this->handler,$Ab);}function
    6803 send(){fseek($this->handler,0);fpassthru($this->handler);fclose($this->handler);}}$wc="'(?:''|[^'\\\\]|\\\\.)*'";$Rd="IN|OUT|INOUT";if(isset($_GET["select"])&&($_POST["edit"]||$_POST["clone"])&&!$_POST["save"])$_GET["edit"]=$_GET["select"];if(isset($_GET["callf"]))$_GET["call"]=$_GET["callf"];if(isset($_GET["function"]))$_GET["procedure"]=$_GET["function"];if(isset($_GET["download"])){$a=$_GET["download"];$q=fields($a);header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));$L=array(idf_escape($_GET["field"]));$H=$n->select($a,$L,array(where($_GET,$q)),$L);$J=($H?$H->fetch_row():array());echo$n->value($J[0],$q[$_GET["field"]]);exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$q=fields($a);if(!$q)$o=error();$R=table_status1($a,true);$C=$b->tableName($R);page_header(($q&&is_view($R)?$R['Engine']=='materialized view'?lang(129):lang(130):lang(131)).": ".($C!=""?$C:h($a)),$o);$b->selectLinks($R);$ub=$R["Comment"];if($ub!="")echo"<p class='nowrap'>".lang(51).": ".h($ub)."\n";if($q)$b->tableStructurePrint($q);if(!is_view($R)){if(support("indexes")){echo"<h3 id='indexes'>".lang(132)."</h3>\n";$x=indexes($a);if($x)$b->tableIndexesPrint($x);echo'<p class="links"><a href="'.h(ME).'indexes='.urlencode($a).'">'.lang(133)."</a>\n";}if(fk_support($R)){echo"<h3 id='foreign-keys'>".lang(100)."</h3>\n";$ed=foreign_keys($a);if($ed){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(134)."<td>".lang(135)."<td>".lang(103)."<td>".lang(102)."<td></thead>\n";foreach($ed
    6804 as$C=>$r){echo"<tr title='".h($C)."'>","<th><i>".implode("</i>, <i>",array_map('h',$r["source"]))."</i>","<td><a href='".h($r["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($r["db"]),ME):($r["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($r["ns"]),ME):ME))."table=".urlencode($r["table"])."'>".($r["db"]!=""?"<b>".h($r["db"])."</b>.":"").($r["ns"]!=""?"<b>".h($r["ns"])."</b>.":"").h($r["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$r["target"]))."</i>)","<td>".h($r["on_delete"])."\n","<td>".h($r["on_update"])."\n",'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($C)).'">'.lang(136).'</a>';}echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'foreign='.urlencode($a).'">'.lang(137)."</a>\n";}}if(support(is_view($R)?"view_trigger":"trigger")){echo"<h3 id='triggers'>".lang(138)."</h3>\n";$Ai=triggers($a);if($Ai){echo"<table cellspacing='0'>\n";foreach($Ai
    6805 as$z=>$X)echo"<tr valign='top'><td>".h($X[0])."<td>".h($X[1])."<th>".h($z)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($z))."'>".lang(136)."</a>\n";echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'trigger='.urlencode($a).'">'.lang(139)."</a>\n";}}elseif(isset($_GET["schema"])){page_header(lang(71),"",array(),h(DB.($_GET["ns"]?".$_GET[ns]":"")));$Sh=array();$Th=array();$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE["adminer_schema-".str_replace(".","_",DB)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$Ee,PREG_SET_ORDER);foreach($Ee
    6806 as$t=>$B){$Sh[$B[1]]=array($B[2],$B[3]);$Th[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$qi=0;$Ra=-1;$ah=array();$Fg=array();$se=array();foreach(table_status('',true)as$Q=>$R){if(is_view($R))continue;$eg=0;$ah[$Q]["fields"]=array();foreach(fields($Q)as$C=>$p){$eg+=1.25;$p["pos"]=$eg;$ah[$Q]["fields"][$C]=$p;}$ah[$Q]["pos"]=($Sh[$Q]?$Sh[$Q]:array($qi,0));foreach($b->foreignKeys($Q)as$X){if(!$X["db"]){$qe=$Ra;if($Sh[$Q][1]||$Sh[$X["table"]][1])$qe=min(floatval($Sh[$Q][1]),floatval($Sh[$X["table"]][1]))-1;else$Ra-=.1;while($se[(string)$qe])$qe-=.0001;$ah[$Q]["references"][$X["table"]][(string)$qe]=array($X["source"],$X["target"]);$Fg[$X["table"]][$Q][(string)$qe]=$X["target"];$se[(string)$qe]=true;}}$qi=max($qi,$ah[$Q]["pos"][0]+2.5+$eg);}echo'<div id="schema" style="height: ',$qi,'em;">
     6802write($Bb){$this->size+=strlen($Bb);fwrite($this->handler,$Bb);}function
     6803send(){fseek($this->handler,0);fpassthru($this->handler);fclose($this->handler);}}$xc="'(?:''|[^'\\\\]|\\\\.)*'";$Sd="IN|OUT|INOUT";if(isset($_GET["select"])&&($_POST["edit"]||$_POST["clone"])&&!$_POST["save"])$_GET["edit"]=$_GET["select"];if(isset($_GET["callf"]))$_GET["call"]=$_GET["callf"];if(isset($_GET["function"]))$_GET["procedure"]=$_GET["function"];if(isset($_GET["download"])){$a=$_GET["download"];$q=fields($a);header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));$L=array(idf_escape($_GET["field"]));$H=$n->select($a,$L,array(where($_GET,$q)),$L);$J=($H?$H->fetch_row():array());echo$n->value($J[0],$q[$_GET["field"]]);exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$q=fields($a);if(!$q)$o=error();$R=table_status1($a,true);$C=$b->tableName($R);page_header(($q&&is_view($R)?$R['Engine']=='materialized view'?lang(129):lang(130):lang(131)).": ".($C!=""?$C:h($a)),$o);$b->selectLinks($R);$vb=$R["Comment"];if($vb!="")echo"<p class='nowrap'>".lang(51).": ".h($vb)."\n";if($q)$b->tableStructurePrint($q);if(!is_view($R)){if(support("indexes")){echo"<h3 id='indexes'>".lang(132)."</h3>\n";$x=indexes($a);if($x)$b->tableIndexesPrint($x);echo'<p class="links"><a href="'.h(ME).'indexes='.urlencode($a).'">'.lang(133)."</a>\n";}if(fk_support($R)){echo"<h3 id='foreign-keys'>".lang(100)."</h3>\n";$fd=foreign_keys($a);if($fd){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(134)."<td>".lang(135)."<td>".lang(103)."<td>".lang(102)."<td></thead>\n";foreach($fd
     6804as$C=>$r){echo"<tr title='".h($C)."'>","<th><i>".implode("</i>, <i>",array_map('h',$r["source"]))."</i>","<td><a href='".h($r["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($r["db"]),ME):($r["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($r["ns"]),ME):ME))."table=".urlencode($r["table"])."'>".($r["db"]!=""?"<b>".h($r["db"])."</b>.":"").($r["ns"]!=""?"<b>".h($r["ns"])."</b>.":"").h($r["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$r["target"]))."</i>)","<td>".h($r["on_delete"])."\n","<td>".h($r["on_update"])."\n",'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($C)).'">'.lang(136).'</a>';}echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'foreign='.urlencode($a).'">'.lang(137)."</a>\n";}}if(support(is_view($R)?"view_trigger":"trigger")){echo"<h3 id='triggers'>".lang(138)."</h3>\n";$Ci=triggers($a);if($Ci){echo"<table cellspacing='0'>\n";foreach($Ci
     6805as$z=>$X)echo"<tr valign='top'><td>".h($X[0])."<td>".h($X[1])."<th>".h($z)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($z))."'>".lang(136)."</a>\n";echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'trigger='.urlencode($a).'">'.lang(139)."</a>\n";}}elseif(isset($_GET["schema"])){page_header(lang(71),"",array(),h(DB.($_GET["ns"]?".$_GET[ns]":"")));$Uh=array();$Vh=array();$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE["adminer_schema-".str_replace(".","_",DB)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$Fe,PREG_SET_ORDER);foreach($Fe
     6806as$t=>$B){$Uh[$B[1]]=array($B[2],$B[3]);$Vh[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$si=0;$Sa=-1;$ch=array();$Hg=array();$te=array();foreach(table_status('',true)as$Q=>$R){if(is_view($R))continue;$gg=0;$ch[$Q]["fields"]=array();foreach(fields($Q)as$C=>$p){$gg+=1.25;$p["pos"]=$gg;$ch[$Q]["fields"][$C]=$p;}$ch[$Q]["pos"]=($Uh[$Q]?$Uh[$Q]:array($si,0));foreach($b->foreignKeys($Q)as$X){if(!$X["db"]){$re=$Sa;if($Uh[$Q][1]||$Uh[$X["table"]][1])$re=min(floatval($Uh[$Q][1]),floatval($Uh[$X["table"]][1]))-1;else$Sa-=.1;while($te[(string)$re])$re-=.0001;$ch[$Q]["references"][$X["table"]][(string)$re]=array($X["source"],$X["target"]);$Hg[$X["table"]][$Q][(string)$re]=$X["target"];$te[(string)$re]=true;}}$si=max($si,$ch[$Q]["pos"][0]+2.5+$gg);}echo'<div id="schema" style="height: ',$si,'em;">
    68076807<script',nonce(),'>
    68086808qs(\'#schema\').onselectstart = function () { return false; };
    6809 var tablePos = {',implode(",",$Th)."\n",'};
    6810 var em = qs(\'#schema\').offsetHeight / ',$qi,';
     6809var tablePos = {',implode(",",$Vh)."\n",'};
     6810var em = qs(\'#schema\').offsetHeight / ',$si,';
    68116811document.onmousemove = schemaMousemove;
    68126812document.onmouseup = partialArg(schemaMouseup, \'',js_escape(DB),'\');
    68136813</script>
    6814 ';foreach($ah
    6815 as$C=>$Q){echo"<div class='table' style='top: ".$Q["pos"][0]."em; left: ".$Q["pos"][1]."em;'>",'<a href="'.h(ME).'table='.urlencode($C).'"><b>'.h($C)."</b></a>",script("qsl('div').onmousedown = schemaMousedown;");foreach($Q["fields"]as$p){$X='<span'.type_class($p["type"]).' title="'.h($p["full_type"].($p["null"]?" NULL":'')).'">'.h($p["field"]).'</span>';echo"<br>".($p["primary"]?"<i>$X</i>":$X);}foreach((array)$Q["references"]as$Zh=>$Gg){foreach($Gg
    6816 as$qe=>$Cg){$re=$qe-$Sh[$C][1];$t=0;foreach($Cg[0]as$wh)echo"\n<div class='references' title='".h($Zh)."' id='refs$qe-".($t++)."' style='left: $re"."em; top: ".$Q["fields"][$wh]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$re)."em;'></div></div>";}}foreach((array)$Fg[$C]as$Zh=>$Gg){foreach($Gg
    6817 as$qe=>$f){$re=$qe-$Sh[$C][1];$t=0;foreach($f
    6818 as$Yh)echo"\n<div class='references' title='".h($Zh)."' id='refd$qe-".($t++)."' style='left: $re"."em; top: ".$Q["fields"][$Yh]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME)."?file=arrow.gif) no-repeat right center;&version=4.7.2")."'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$re)."em;'></div></div>";}}echo"\n</div>\n";}foreach($ah
    6819 as$C=>$Q){foreach((array)$Q["references"]as$Zh=>$Gg){foreach($Gg
    6820 as$qe=>$Cg){$Te=$qi;$Ie=-10;foreach($Cg[0]as$z=>$wh){$fg=$Q["pos"][0]+$Q["fields"][$wh]["pos"];$gg=$ah[$Zh]["pos"][0]+$ah[$Zh]["fields"][$Cg[1][$z]]["pos"];$Te=min($Te,$fg,$gg);$Ie=max($Ie,$fg,$gg);}echo"<div class='references' id='refl$qe' style='left: $qe"."em; top: $Te"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Ie-$Te)."em;'></div></div>\n";}}}echo'</div>
     6814';foreach($ch
     6815as$C=>$Q){echo"<div class='table' style='top: ".$Q["pos"][0]."em; left: ".$Q["pos"][1]."em;'>",'<a href="'.h(ME).'table='.urlencode($C).'"><b>'.h($C)."</b></a>",script("qsl('div').onmousedown = schemaMousedown;");foreach($Q["fields"]as$p){$X='<span'.type_class($p["type"]).' title="'.h($p["full_type"].($p["null"]?" NULL":'')).'">'.h($p["field"]).'</span>';echo"<br>".($p["primary"]?"<i>$X</i>":$X);}foreach((array)$Q["references"]as$bi=>$Ig){foreach($Ig
     6816as$re=>$Eg){$se=$re-$Uh[$C][1];$t=0;foreach($Eg[0]as$yh)echo"\n<div class='references' title='".h($bi)."' id='refs$re-".($t++)."' style='left: $se"."em; top: ".$Q["fields"][$yh]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$se)."em;'></div></div>";}}foreach((array)$Hg[$C]as$bi=>$Ig){foreach($Ig
     6817as$re=>$f){$se=$re-$Uh[$C][1];$t=0;foreach($f
     6818as$ai)echo"\n<div class='references' title='".h($bi)."' id='refd$re-".($t++)."' style='left: $se"."em; top: ".$Q["fields"][$ai]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME)."?file=arrow.gif) no-repeat right center;&version=4.7.4")."'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$se)."em;'></div></div>";}}echo"\n</div>\n";}foreach($ch
     6819as$C=>$Q){foreach((array)$Q["references"]as$bi=>$Ig){foreach($Ig
     6820as$re=>$Eg){$Ue=$si;$Je=-10;foreach($Eg[0]as$z=>$yh){$hg=$Q["pos"][0]+$Q["fields"][$yh]["pos"];$ig=$ch[$bi]["pos"][0]+$ch[$bi]["fields"][$Eg[1][$z]]["pos"];$Ue=min($Ue,$hg,$ig);$Je=max($Je,$hg,$ig);}echo"<div class='references' id='refl$re' style='left: $re"."em; top: $Ue"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Je-$Ue)."em;'></div></div>\n";}}}echo'</div>
    68216821<p class="links"><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">',lang(140),'</a>
    6822 ';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$o){$Db="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$z)$Db.="&$z=".urlencode($_POST[$z]);cookie("adminer_export",substr($Db,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Ic=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$Zd=preg_match('~sql~',$_POST["format"]);if($Zd){echo"-- Adminer $ia ".$ec[DRIVER]." dump\n\n";if($y=="sql"){echo"SET NAMES utf8;
     6822';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$o){$Eb="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$z)$Eb.="&$z=".urlencode($_POST[$z]);cookie("adminer_export",substr($Eb,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Jc=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$ae=preg_match('~sql~',$_POST["format"]);if($ae){echo"-- Adminer $ia ".$fc[DRIVER]." dump\n\n";if($y=="sql"){echo"SET NAMES utf8;
    68236823SET time_zone = '+00:00';
    68246824".($_POST["data_style"]?"SET foreign_key_checks = 0;
    68256825SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
    68266826":"")."
    6827 ";$h->query("SET time_zone = '+00:00';");}}$Jh=$_POST["db_style"];$l=array(DB);if(DB==""){$l=$_POST["databases"];if(is_string($l))$l=explode("\n",rtrim(str_replace("\r","",$l),"\n"));}foreach((array)$l
    6828 as$m){$b->dumpDatabase($m);if($h->select_db($m)){if($Zd&&preg_match('~CREATE~',$Jh)&&($j=$h->result("SHOW CREATE DATABASE ".idf_escape($m),1))){set_utf8mb4($j);if($Jh=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($m).";\n";echo"$j;\n";}if($Zd){if($Jh)echo
    6829 use_sql($m).";\n\n";$Jf="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$Ug){foreach(get_rows("SHOW $Ug STATUS WHERE Db = ".q($m),null,"-- ")as$J){$j=remove_definer($h->result("SHOW CREATE $Ug ".idf_escape($J["Name"]),2));set_utf8mb4($j);$Jf.=($Jh!='DROP+CREATE'?"DROP $Ug IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$j;;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$J){$j=remove_definer($h->result("SHOW CREATE EVENT ".idf_escape($J["Name"]),3));set_utf8mb4($j);$Jf.=($Jh!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$j;;\n\n";}}if($Jf)echo"DELIMITER ;;\n\n$Jf"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$aj=array();foreach(table_status('',true)as$C=>$R){$Q=(DB==""||in_array($C,(array)$_POST["tables"]));$Lb=(DB==""||in_array($C,(array)$_POST["data"]));if($Q||$Lb){if($Ic=="tar"){$mi=new
    6830 TmpFile;ob_start(array($mi,'write'),1e5);}$b->dumpTable($C,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$aj[]=$C;elseif($Lb){$q=fields($C);$b->dumpData($C,$_POST["data_style"],"SELECT *".convert_fields($q,$q)." FROM ".table($C));}if($Zd&&$_POST["triggers"]&&$Q&&($Ai=trigger_sql($C)))echo"\nDELIMITER ;;\n$Ai\nDELIMITER ;\n";if($Ic=="tar"){ob_end_flush();tar_file((DB!=""?"":"$m/")."$C.csv",$mi);}elseif($Zd)echo"\n";}}foreach($aj
    6831 as$Zi)$b->dumpTable($Zi,$_POST["table_style"],1);if($Ic=="tar")echo
    6832 pack("x512");}}}if($Zd)echo"-- ".$h->result("SELECT NOW()")."\n";exit;}page_header(lang(74),$o,($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),h(DB));echo'
     6827";$h->query("SET time_zone = '+00:00';");}}$Lh=$_POST["db_style"];$l=array(DB);if(DB==""){$l=$_POST["databases"];if(is_string($l))$l=explode("\n",rtrim(str_replace("\r","",$l),"\n"));}foreach((array)$l
     6828as$m){$b->dumpDatabase($m);if($h->select_db($m)){if($ae&&preg_match('~CREATE~',$Lh)&&($j=$h->result("SHOW CREATE DATABASE ".idf_escape($m),1))){set_utf8mb4($j);if($Lh=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($m).";\n";echo"$j;\n";}if($ae){if($Lh)echo
     6829use_sql($m).";\n\n";$Lf="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$Wg){foreach(get_rows("SHOW $Wg STATUS WHERE Db = ".q($m),null,"-- ")as$J){$j=remove_definer($h->result("SHOW CREATE $Wg ".idf_escape($J["Name"]),2));set_utf8mb4($j);$Lf.=($Lh!='DROP+CREATE'?"DROP $Wg IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$j;;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$J){$j=remove_definer($h->result("SHOW CREATE EVENT ".idf_escape($J["Name"]),3));set_utf8mb4($j);$Lf.=($Lh!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$j;;\n\n";}}if($Lf)echo"DELIMITER ;;\n\n$Lf"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$dj=array();foreach(table_status('',true)as$C=>$R){$Q=(DB==""||in_array($C,(array)$_POST["tables"]));$Nb=(DB==""||in_array($C,(array)$_POST["data"]));if($Q||$Nb){if($Jc=="tar"){$oi=new
     6830TmpFile;ob_start(array($oi,'write'),1e5);}$b->dumpTable($C,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$dj[]=$C;elseif($Nb){$q=fields($C);$b->dumpData($C,$_POST["data_style"],"SELECT *".convert_fields($q,$q)." FROM ".table($C));}if($ae&&$_POST["triggers"]&&$Q&&($Ci=trigger_sql($C)))echo"\nDELIMITER ;;\n$Ci\nDELIMITER ;\n";if($Jc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$m/")."$C.csv",$oi);}elseif($ae)echo"\n";}}foreach($dj
     6831as$cj)$b->dumpTable($cj,$_POST["table_style"],1);if($Jc=="tar")echo
     6832pack("x512");}}}if($ae)echo"-- ".$h->result("SELECT NOW()")."\n";exit;}page_header(lang(74),$o,($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),h(DB));echo'
    68336833<form action="" method="post">
    68346834<table cellspacing="0" class="layout">
    6835 ';$Pb=array('','USE','DROP+CREATE','CREATE');$Uh=array('','DROP+CREATE','CREATE');$Mb=array('','TRUNCATE+INSERT','INSERT');if($y=="sql")$Mb[]='INSERT+UPDATE';parse_str($_COOKIE["adminer_export"],$J);if(!$J)$J=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($J["events"])){$J["routines"]=$J["events"]=($_GET["dump"]=="");$J["triggers"]=$J["table_style"];}echo"<tr><th>".lang(141)."<td>".html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"<tr><th>".lang(142)."<td>".html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($y=="sqlite"?"":"<tr><th>".lang(38)."<td>".html_select('db_style',$Pb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(143)):"").(support("event")?checkbox("events",1,$J["events"],lang(144)):"")),"<tr><th>".lang(123)."<td>".html_select('table_style',$Uh,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(52)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(138)):""),"<tr><th>".lang(145)."<td>".html_select('data_style',$Mb,$J["data_style"]),'</table>
     6835';$Rb=array('','USE','DROP+CREATE','CREATE');$Wh=array('','DROP+CREATE','CREATE');$Ob=array('','TRUNCATE+INSERT','INSERT');if($y=="sql")$Ob[]='INSERT+UPDATE';parse_str($_COOKIE["adminer_export"],$J);if(!$J)$J=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($J["events"])){$J["routines"]=$J["events"]=($_GET["dump"]=="");$J["triggers"]=$J["table_style"];}echo"<tr><th>".lang(141)."<td>".html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"<tr><th>".lang(142)."<td>".html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($y=="sqlite"?"":"<tr><th>".lang(38)."<td>".html_select('db_style',$Rb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(143)):"").(support("event")?checkbox("events",1,$J["events"],lang(144)):"")),"<tr><th>".lang(123)."<td>".html_select('table_style',$Wh,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(52)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(138)):""),"<tr><th>".lang(145)."<td>".html_select('data_style',$Ob,$J["data_style"]),'</table>
    68366836<p><input type="submit" value="',lang(74),'">
    6837 <input type="hidden" name="token" value="',$pi,'">
     6837<input type="hidden" name="token" value="',$ri,'">
    68386838
    68396839<table cellspacing="0">
    6840 ',script("qsl('table').onclick = dumpClick;");$jg=array();if(DB!=""){$fb=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$fb>".lang(123)."</label>".script("qs('#check-tables').onclick = partial(formCheck, /^tables\\[/);",""),"<th style='text-align: right;'><label class='block'>".lang(145)."<input type='checkbox' id='check-data'$fb></label>".script("qs('#check-data').onclick = partial(formCheck, /^data\\[/);",""),"</thead>\n";$aj="";$Vh=tables_list();foreach($Vh
    6841 as$C=>$T){$ig=preg_replace('~_.*~','',$C);$fb=($a==""||$a==(substr($a,-1)=="%"?"$ig%":$C));$mg="<tr><td>".checkbox("tables[]",$C,$fb,$C,"","block");if($T!==null&&!preg_match('~table~i',$T))$aj.="$mg\n";else
    6842 echo"$mg<td align='right'><label class='block'><span id='Rows-".h($C)."'></span>".checkbox("data[]",$C,$fb)."</label>\n";$jg[$ig]++;}echo$aj;if($Vh)echo
     6840',script("qsl('table').onclick = dumpClick;");$lg=array();if(DB!=""){$gb=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$gb>".lang(123)."</label>".script("qs('#check-tables').onclick = partial(formCheck, /^tables\\[/);",""),"<th style='text-align: right;'><label class='block'>".lang(145)."<input type='checkbox' id='check-data'$gb></label>".script("qs('#check-data').onclick = partial(formCheck, /^data\\[/);",""),"</thead>\n";$dj="";$Xh=tables_list();foreach($Xh
     6841as$C=>$T){$kg=preg_replace('~_.*~','',$C);$gb=($a==""||$a==(substr($a,-1)=="%"?"$kg%":$C));$og="<tr><td>".checkbox("tables[]",$C,$gb,$C,"","block");if($T!==null&&!preg_match('~table~i',$T))$dj.="$og\n";else
     6842echo"$og<td align='right'><label class='block'><span id='Rows-".h($C)."'></span>".checkbox("data[]",$C,$gb)."</label>\n";$lg[$kg]++;}echo$dj;if($Xh)echo
    68436843script("ajaxSetHtml('".js_escape(ME)."script=db');");}else{echo"<thead><tr><th style='text-align: left;'>","<label class='block'><input type='checkbox' id='check-databases'".($a==""?" checked":"").">".lang(38)."</label>",script("qs('#check-databases').onclick = partial(formCheck, /^databases\\[/);",""),"</thead>\n";$l=$b->databases();if($l){foreach($l
    6844 as$m){if(!information_schema($m)){$ig=preg_replace('~_.*~','',$m);echo"<tr><td>".checkbox("databases[]",$m,$a==""||$a=="$ig%",$m,"","block")."\n";$jg[$ig]++;}}}else
     6844as$m){if(!information_schema($m)){$kg=preg_replace('~_.*~','',$m);echo"<tr><td>".checkbox("databases[]",$m,$a==""||$a=="$kg%",$m,"","block")."\n";$lg[$kg]++;}}}else
    68456845echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}echo'</table>
    68466846</form>
    6847 ';$Wc=true;foreach($jg
    6848 as$z=>$X){if($z!=""&&$X>1){echo($Wc?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$z%")."'>".h($z)."</a>";$Wc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(72));echo'<p class="links"><a href="'.h(ME).'user=">'.lang(146)."</a>";$H=$h->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$ld=$H;if(!$H)$H=$h->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($ld?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".lang(36)."<th>".lang(35)."<th></thead>\n";while($J=$H->fetch_assoc())echo'<tr'.odd().'><td>'.h($J["User"])."<td>".h($J["Host"]).'<td><a href="'.h(ME.'user='.urlencode($J["User"]).'&host='.urlencode($J["Host"])).'">'.lang(10)."</a>\n";if(!$ld||DB!="")echo"<tr".odd()."><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='".lang(10)."'>\n";echo"</table>\n","</form>\n";}elseif(isset($_GET["sql"])){if(!$o&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$zd=&get_session("queries");$yd=&$zd[DB];if(!$o&&$_POST["clear"]){$yd=array();redirect(remove_from_uri("history"));}page_header((isset($_GET["import"])?lang(73):lang(65)),$o);if(!$o&&$_POST){$id=false;if(!isset($_GET["import"]))$G=$_POST["query"];elseif($_POST["webfile"]){$_h=$b->importServerPath();$id=@fopen((file_exists($_h)?$_h:"compress.zlib://$_h.gz"),"rb");$G=($id?fread($id,1e6):false);}else$G=get_file("sql_file",true);if(is_string($G)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($G)+memory_get_usage()+8e6));if($G!=""&&strlen($G)<1e6){$ug=$G.(preg_match("~;[ \t\r\n]*\$~",$G)?"":";");if(!$yd||reset(end($yd))!=$ug){restart_session();$yd[]=array($ug,time());set_session("queries",$zd);stop_session();}}$xh="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Vb=";";$D=0;$tc=true;$i=connect();if(is_object($i)&&DB!="")$i->select_db(DB);$tb=0;$yc=array();$Qf='[\'"'.($y=="sql"?'`#':($y=="sqlite"?'`[':($y=="mssql"?'[':''))).']|/\*|-- |$'.($y=="pgsql"?'|\$[^$]*\$':'');$ri=microtime(true);parse_str($_COOKIE["adminer_export"],$ya);$kc=$b->dumpFormat();unset($kc["sql"]);while($G!=""){if(!$D&&preg_match("~^$xh*+DELIMITER\\s+(\\S+)~i",$G,$B)){$Vb=$B[1];$G=substr($G,strlen($B[0]));}else{preg_match('('.preg_quote($Vb)."\\s*|$Qf)",$G,$B,PREG_OFFSET_CAPTURE,$D);list($gd,$eg)=$B[0];if(!$gd&&$id&&!feof($id))$G.=fread($id,1e5);else{if(!$gd&&rtrim($G)=="")break;$D=$eg+strlen($gd);if($gd&&rtrim($gd)!=$Vb){while(preg_match('('.($gd=='/*'?'\*/':($gd=='['?']':(preg_match('~^-- |^#~',$gd)?"\n":preg_quote($gd)."|\\\\."))).'|$)s',$G,$B,PREG_OFFSET_CAPTURE,$D)){$Yg=$B[0][0];if(!$Yg&&$id&&!feof($id))$G.=fread($id,1e5);else{$D=$B[0][1]+strlen($Yg);if($Yg[0]!="\\")break;}}}else{$tc=false;$ug=substr($G,0,$eg);$tb++;$mg="<pre id='sql-$tb'><code class='jush-$y'>".$b->sqlCommandQuery($ug)."</code></pre>\n";if($y=="sqlite"&&preg_match("~^$xh*+ATTACH\\b~i",$ug,$B)){echo$mg,"<p class='error'>".lang(147)."\n";$yc[]=" <a href='#sql-$tb'>$tb</a>";if($_POST["error_stops"])break;}else{if(!$_POST["only_errors"]){echo$mg;ob_flush();flush();}$Dh=microtime(true);if($h->multi_query($ug)&&is_object($i)&&preg_match("~^$xh*+USE\\b~i",$ug))$i->query($ug);do{$H=$h->store_result();if($h->error){echo($_POST["only_errors"]?$mg:""),"<p class='error'>".lang(148).($h->errno?" ($h->errno)":"").": ".error()."\n";$yc[]=" <a href='#sql-$tb'>$tb</a>";if($_POST["error_stops"])break
    6849 2;}else{$fi=" <span class='time'>(".format_time($Dh).")</span>".(strlen($ug)<1000?" <a href='".h(ME)."sql=".urlencode(trim($ug))."'>".lang(10)."</a>":"");$_a=$h->affected_rows;$dj=($_POST["only_errors"]?"":$n->warnings());$ej="warnings-$tb";if($dj)$fi.=", <a href='#$ej'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$ej');","");$Fc=null;$Gc="explain-$tb";if(is_object($H)){$_=$_POST["limit"];$Cf=select($H,$i,array(),$_);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n";$gf=$H->num_rows;echo"<p>".($gf?($_&&$gf>$_?lang(149,$_):"").lang(150,$gf):""),$fi;if($i&&preg_match("~^($xh|\\()*+SELECT\\b~i",$ug)&&($Fc=explain($i,$ug)))echo", <a href='#$Gc'>Explain</a>".script("qsl('a').onclick = partial(toggle, '$Gc');","");$u="export-$tb";echo", <a href='#$u'>".lang(74)."</a>".script("qsl('a').onclick = partial(toggle, '$u');","")."<span id='$u' class='hidden'>: ".html_select("output",$b->dumpOutput(),$ya["output"])." ".html_select("format",$kc,$ya["format"])."<input type='hidden' name='query' value='".h($ug)."'>"." <input type='submit' name='export' value='".lang(74)."'><input type='hidden' name='token' value='$pi'></span>\n"."</form>\n";}}else{if(preg_match("~^$xh*+(CREATE|DROP|ALTER)$xh++(DATABASE|SCHEMA)\\b~i",$ug)){restart_session();set_session("dbs",null);stop_session();}if(!$_POST["only_errors"])echo"<p class='message' title='".h($h->info)."'>".lang(151,$_a)."$fi\n";}echo($dj?"<div id='$ej' class='hidden'>\n$dj</div>\n":"");if($Fc){echo"<div id='$Gc' class='hidden'>\n";select($Fc,$i,$Cf);echo"</div>\n";}}$Dh=microtime(true);}while($h->next_result());}$G=substr($G,$D);$D=0;}}}}if($tc)echo"<p class='message'>".lang(152)."\n";elseif($_POST["only_errors"]){echo"<p class='message'>".lang(153,$tb-count($yc))," <span class='time'>(".format_time($ri).")</span>\n";}elseif($yc&&$tb>1)echo"<p class='error'>".lang(148).": ".implode("",$yc)."\n";}else
     6847';$Xc=true;foreach($lg
     6848as$z=>$X){if($z!=""&&$X>1){echo($Xc?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$z%")."'>".h($z)."</a>";$Xc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(72));echo'<p class="links"><a href="'.h(ME).'user=">'.lang(146)."</a>";$H=$h->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$md=$H;if(!$H)$H=$h->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($md?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".lang(36)."<th>".lang(35)."<th></thead>\n";while($J=$H->fetch_assoc())echo'<tr'.odd().'><td>'.h($J["User"])."<td>".h($J["Host"]).'<td><a href="'.h(ME.'user='.urlencode($J["User"]).'&host='.urlencode($J["Host"])).'">'.lang(10)."</a>\n";if(!$md||DB!="")echo"<tr".odd()."><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='".lang(10)."'>\n";echo"</table>\n","</form>\n";}elseif(isset($_GET["sql"])){if(!$o&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$_d=&get_session("queries");$zd=&$_d[DB];if(!$o&&$_POST["clear"]){$zd=array();redirect(remove_from_uri("history"));}page_header((isset($_GET["import"])?lang(73):lang(65)),$o);if(!$o&&$_POST){$jd=false;if(!isset($_GET["import"]))$G=$_POST["query"];elseif($_POST["webfile"]){$Bh=$b->importServerPath();$jd=@fopen((file_exists($Bh)?$Bh:"compress.zlib://$Bh.gz"),"rb");$G=($jd?fread($jd,1e6):false);}else$G=get_file("sql_file",true);if(is_string($G)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($G)+memory_get_usage()+8e6));if($G!=""&&strlen($G)<1e6){$wg=$G.(preg_match("~;[ \t\r\n]*\$~",$G)?"":";");if(!$zd||reset(end($zd))!=$wg){restart_session();$zd[]=array($wg,time());set_session("queries",$_d);stop_session();}}$zh="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Xb=";";$D=0;$uc=true;$i=connect();if(is_object($i)&&DB!="")$i->select_db(DB);$ub=0;$zc=array();$Sf='[\'"'.($y=="sql"?'`#':($y=="sqlite"?'`[':($y=="mssql"?'[':''))).']|/\*|-- |$'.($y=="pgsql"?'|\$[^$]*\$':'');$ti=microtime(true);parse_str($_COOKIE["adminer_export"],$ya);$lc=$b->dumpFormat();unset($lc["sql"]);while($G!=""){if(!$D&&preg_match("~^$zh*+DELIMITER\\s+(\\S+)~i",$G,$B)){$Xb=$B[1];$G=substr($G,strlen($B[0]));}else{preg_match('('.preg_quote($Xb)."\\s*|$Sf)",$G,$B,PREG_OFFSET_CAPTURE,$D);list($hd,$gg)=$B[0];if(!$hd&&$jd&&!feof($jd))$G.=fread($jd,1e5);else{if(!$hd&&rtrim($G)=="")break;$D=$gg+strlen($hd);if($hd&&rtrim($hd)!=$Xb){while(preg_match('('.($hd=='/*'?'\*/':($hd=='['?']':(preg_match('~^-- |^#~',$hd)?"\n":preg_quote($hd)."|\\\\."))).'|$)s',$G,$B,PREG_OFFSET_CAPTURE,$D)){$ah=$B[0][0];if(!$ah&&$jd&&!feof($jd))$G.=fread($jd,1e5);else{$D=$B[0][1]+strlen($ah);if($ah[0]!="\\")break;}}}else{$uc=false;$wg=substr($G,0,$gg);$ub++;$og="<pre id='sql-$ub'><code class='jush-$y'>".$b->sqlCommandQuery($wg)."</code></pre>\n";if($y=="sqlite"&&preg_match("~^$zh*+ATTACH\\b~i",$wg,$B)){echo$og,"<p class='error'>".lang(147)."\n";$zc[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break;}else{if(!$_POST["only_errors"]){echo$og;ob_flush();flush();}$Fh=microtime(true);if($h->multi_query($wg)&&is_object($i)&&preg_match("~^$zh*+USE\\b~i",$wg))$i->query($wg);do{$H=$h->store_result();if($h->error){echo($_POST["only_errors"]?$og:""),"<p class='error'>".lang(148).($h->errno?" ($h->errno)":"").": ".error()."\n";$zc[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break
     68492;}else{$hi=" <span class='time'>(".format_time($Fh).")</span>".(strlen($wg)<1000?" <a href='".h(ME)."sql=".urlencode(trim($wg))."'>".lang(10)."</a>":"");$_a=$h->affected_rows;$gj=($_POST["only_errors"]?"":$n->warnings());$hj="warnings-$ub";if($gj)$hi.=", <a href='#$hj'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$hj');","");$Gc=null;$Hc="explain-$ub";if(is_object($H)){$_=$_POST["limit"];$Ef=select($H,$i,array(),$_);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n";$if=$H->num_rows;echo"<p>".($if?($_&&$if>$_?lang(149,$_):"").lang(150,$if):""),$hi;if($i&&preg_match("~^($zh|\\()*+SELECT\\b~i",$wg)&&($Gc=explain($i,$wg)))echo", <a href='#$Hc'>Explain</a>".script("qsl('a').onclick = partial(toggle, '$Hc');","");$u="export-$ub";echo", <a href='#$u'>".lang(74)."</a>".script("qsl('a').onclick = partial(toggle, '$u');","")."<span id='$u' class='hidden'>: ".html_select("output",$b->dumpOutput(),$ya["output"])." ".html_select("format",$lc,$ya["format"])."<input type='hidden' name='query' value='".h($wg)."'>"." <input type='submit' name='export' value='".lang(74)."'><input type='hidden' name='token' value='$ri'></span>\n"."</form>\n";}}else{if(preg_match("~^$zh*+(CREATE|DROP|ALTER)$zh++(DATABASE|SCHEMA)\\b~i",$wg)){restart_session();set_session("dbs",null);stop_session();}if(!$_POST["only_errors"])echo"<p class='message' title='".h($h->info)."'>".lang(151,$_a)."$hi\n";}echo($gj?"<div id='$hj' class='hidden'>\n$gj</div>\n":"");if($Gc){echo"<div id='$Hc' class='hidden'>\n";select($Gc,$i,$Ef);echo"</div>\n";}}$Fh=microtime(true);}while($h->next_result());}$G=substr($G,$D);$D=0;}}}}if($uc)echo"<p class='message'>".lang(152)."\n";elseif($_POST["only_errors"]){echo"<p class='message'>".lang(153,$ub-count($zc))," <span class='time'>(".format_time($ti).")</span>\n";}elseif($zc&&$ub>1)echo"<p class='error'>".lang(148).": ".implode("",$zc)."\n";}else
    68506850echo"<p class='error'>".upload_error($G)."\n";}echo'
    68516851<form action="" method="post" enctype="multipart/form-data" id="form">
    6852 ';$Cc="<input type='submit' value='".lang(154)."' title='Ctrl+Enter'>";if(!isset($_GET["import"])){$ug=$_GET["sql"];if($_POST)$ug=$_POST["query"];elseif($_GET["history"]=="all")$ug=$yd;elseif($_GET["history"]!="")$ug=$yd[$_GET["history"]][0];echo"<p>";textarea("query",$ug,20);echo
    6853 script(($_POST?"":"qs('textarea').focus();\n")."qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '".remove_from_uri("sql|limit|error_stops|only_errors")."');"),"<p>$Cc\n",lang(155).": <input type='number' name='limit' class='size' value='".h($_POST?$_POST["limit"]:$_GET["limit"])."'>\n";}else{echo"<fieldset><legend>".lang(156)."</legend><div>";$rd=(extension_loaded("zlib")?"[.gz]":"");echo(ini_bool("file_uploads")?"SQL$rd (&lt; ".ini_get("upload_max_filesize")."B): <input type='file' name='sql_file[]' multiple>\n$Cc":lang(157)),"</div></fieldset>\n";$Gd=$b->importServerPath();if($Gd){echo"<fieldset><legend>".lang(158)."</legend><div>",lang(159,"<code>".h($Gd)."$rd</code>"),' <input type="submit" name="webfile" value="'.lang(160).'">',"</div></fieldset>\n";}echo"<p>";}echo
    6854 checkbox("error_stops",1,($_POST?$_POST["error_stops"]:isset($_GET["import"])),lang(161))."\n",checkbox("only_errors",1,($_POST?$_POST["only_errors"]:isset($_GET["import"])),lang(162))."\n","<input type='hidden' name='token' value='$pi'>\n";if(!isset($_GET["import"])&&$yd){print_fieldset("history",lang(163),$_GET["history"]!="");for($X=end($yd);$X;$X=prev($yd)){$z=key($yd);list($ug,$fi,$oc)=$X;echo'<a href="'.h(ME."sql=&history=$z").'">'.lang(10)."</a>"." <span class='time' title='".@date('Y-m-d',$fi)."'>".@date("H:i:s",$fi)."</span>"." <code class='jush-$y'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$ug)))),80,"</code>").($oc?" <span class='time'>($oc)</span>":"")."<br>\n";}echo"<input type='submit' name='clear' value='".lang(164)."'>\n","<a href='".h(ME."sql=&history=all")."'>".lang(165)."</a>\n","</div></fieldset>\n";}echo'</form>
    6855 ';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$q=fields($a);$Z=(isset($_GET["select"])?($_POST["check"]&&count($_POST["check"])==1?where_check($_POST["check"][0],$q):""):where($_GET,$q));$Ki=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($q
    6856 as$C=>$p){if(!isset($p["privileges"][$Ki?"update":"insert"])||$b->fieldName($p)=="")unset($q[$C]);}if($_POST&&!$o&&!isset($_GET["select"])){$ye=$_POST["referer"];if($_POST["insert"])$ye=($Ki?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$ye))$ye=ME."select=".urlencode($a);$x=indexes($a);$Fi=unique_array($_GET["where"],$x);$xg="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($ye,lang(166),$n->delete($a,$xg,!$Fi));else{$O=array();foreach($q
    6857 as$C=>$p){$X=process_input($p);if($X!==false&&$X!==null)$O[idf_escape($C)]=$X;}if($Ki){if(!$O)redirect($ye);queries_redirect($ye,lang(167),$n->update($a,$O,$xg,!$Fi));if(is_ajax()){page_headers();page_messages($o);exit;}}else{$H=$n->insert($a,$O);$pe=($H?last_id():0);queries_redirect($ye,lang(168,($pe?" $pe":"")),$H);}}}$J=null;if($_POST["save"])$J=(array)$_POST["fields"];elseif($Z){$L=array();foreach($q
     6852';$Dc="<input type='submit' value='".lang(154)."' title='Ctrl+Enter'>";if(!isset($_GET["import"])){$wg=$_GET["sql"];if($_POST)$wg=$_POST["query"];elseif($_GET["history"]=="all")$wg=$zd;elseif($_GET["history"]!="")$wg=$zd[$_GET["history"]][0];echo"<p>";textarea("query",$wg,20);echo
     6853script(($_POST?"":"qs('textarea').focus();\n")."qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '".remove_from_uri("sql|limit|error_stops|only_errors")."');"),"<p>$Dc\n",lang(155).": <input type='number' name='limit' class='size' value='".h($_POST?$_POST["limit"]:$_GET["limit"])."'>\n";}else{echo"<fieldset><legend>".lang(156)."</legend><div>";$sd=(extension_loaded("zlib")?"[.gz]":"");echo(ini_bool("file_uploads")?"SQL$sd (&lt; ".ini_get("upload_max_filesize")."B): <input type='file' name='sql_file[]' multiple>\n$Dc":lang(157)),"</div></fieldset>\n";$Hd=$b->importServerPath();if($Hd){echo"<fieldset><legend>".lang(158)."</legend><div>",lang(159,"<code>".h($Hd)."$sd</code>"),' <input type="submit" name="webfile" value="'.lang(160).'">',"</div></fieldset>\n";}echo"<p>";}echo
     6854checkbox("error_stops",1,($_POST?$_POST["error_stops"]:isset($_GET["import"])),lang(161))."\n",checkbox("only_errors",1,($_POST?$_POST["only_errors"]:isset($_GET["import"])),lang(162))."\n","<input type='hidden' name='token' value='$ri'>\n";if(!isset($_GET["import"])&&$zd){print_fieldset("history",lang(163),$_GET["history"]!="");for($X=end($zd);$X;$X=prev($zd)){$z=key($zd);list($wg,$hi,$pc)=$X;echo'<a href="'.h(ME."sql=&history=$z").'">'.lang(10)."</a>"." <span class='time' title='".@date('Y-m-d',$hi)."'>".@date("H:i:s",$hi)."</span>"." <code class='jush-$y'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$wg)))),80,"</code>").($pc?" <span class='time'>($pc)</span>":"")."<br>\n";}echo"<input type='submit' name='clear' value='".lang(164)."'>\n","<a href='".h(ME."sql=&history=all")."'>".lang(165)."</a>\n","</div></fieldset>\n";}echo'</form>
     6855';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$q=fields($a);$Z=(isset($_GET["select"])?($_POST["check"]&&count($_POST["check"])==1?where_check($_POST["check"][0],$q):""):where($_GET,$q));$Mi=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($q
     6856as$C=>$p){if(!isset($p["privileges"][$Mi?"update":"insert"])||$b->fieldName($p)==""||$p["generated"])unset($q[$C]);}if($_POST&&!$o&&!isset($_GET["select"])){$ze=$_POST["referer"];if($_POST["insert"])$ze=($Mi?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$ze))$ze=ME."select=".urlencode($a);$x=indexes($a);$Hi=unique_array($_GET["where"],$x);$zg="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($ze,lang(166),$n->delete($a,$zg,!$Hi));else{$O=array();foreach($q
     6857as$C=>$p){$X=process_input($p);if($X!==false&&$X!==null)$O[idf_escape($C)]=$X;}if($Mi){if(!$O)redirect($ze);queries_redirect($ze,lang(167),$n->update($a,$O,$zg,!$Hi));if(is_ajax()){page_headers();page_messages($o);exit;}}else{$H=$n->insert($a,$O);$qe=($H?last_id():0);queries_redirect($ze,lang(168,($qe?" $qe":"")),$H);}}}$J=null;if($_POST["save"])$J=(array)$_POST["fields"];elseif($Z){$L=array();foreach($q
    68586858as$C=>$p){if(isset($p["privileges"]["select"])){$Ha=convert_field($p);if($_POST["clone"]&&$p["auto_increment"])$Ha="''";if($y=="sql"&&preg_match("~enum|set~",$p["type"]))$Ha="1*".idf_escape($C);$L[]=($Ha?"$Ha AS ":"").idf_escape($C);}}$J=array();if(!support("table"))$L=array("*");if($L){$H=$n->select($a,$L,array($Z),$L,array(),(isset($_GET["select"])?2:1));if(!$H)$o=error();else{$J=$H->fetch_assoc();if(!$J)$J=false;}if(isset($_GET["select"])&&(!$J||$H->fetch_assoc()))$J=null;}}if(!support("table")&&!$q){if(!$Z){$H=$n->select($a,array("*"),$Z,array("*"));$J=($H?$H->fetch_assoc():false);if(!$J)$J=array($n->primary=>"");}if($J){foreach($J
    6859 as$z=>$X){if(!$Z)$J[$z]=null;$q[$z]=array("field"=>$z,"null"=>($z!=$n->primary),"auto_increment"=>($z==$n->primary));}}}edit_form($a,$q,$J,$Ki);}elseif(isset($_GET["create"])){$a=$_GET["create"];$Sf=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$z)$Sf[$z]=$z;$Eg=referencable_primary($a);$ed=array();foreach($Eg
    6860 as$Qh=>$p)$ed[str_replace("`","``",$Qh)."`".str_replace("`","``",$p["field"])]=$Qh;$Ff=array();$R=array();if($a!=""){$Ff=fields($a);$R=table_status($a);if(!$R)$o=lang(9);}$J=$_POST;$J["fields"]=(array)$J["fields"];if($J["auto_increment_col"])$J["fields"][$J["auto_increment_col"]]["auto_increment"]=true;if($_POST)set_adminer_settings(array("comments"=>$_POST["comments"],"defaults"=>$_POST["defaults"]));if($_POST&&!process_fields($J["fields"])&&!$o){if($_POST["drop"])queries_redirect(substr(ME,0,-1),lang(169),drop_tables(array($a)));else{$q=array();$Ea=array();$Pi=false;$cd=array();$Ef=reset($Ff);$Ba=" FIRST";foreach($J["fields"]as$z=>$p){$r=$ed[$p["type"]];$Bi=($r!==null?$Eg[$r]:$p);if($p["field"]!=""){if(!$p["has_default"])$p["default"]=null;if($z==$J["auto_increment_col"])$p["auto_increment"]=true;$rg=process_field($p,$Bi);$Ea[]=array($p["orig"],$rg,$Ba);if($rg!=process_field($Ef,$Ef)){$q[]=array($p["orig"],$rg,$Ba);if($p["orig"]!=""||$Ba)$Pi=true;}if($r!==null)$cd[idf_escape($p["field"])]=($a!=""&&$y!="sqlite"?"ADD":" ").format_foreign_key(array('table'=>$ed[$p["type"]],'source'=>array($p["field"]),'target'=>array($Bi["field"]),'on_delete'=>$p["on_delete"],));$Ba=" AFTER ".idf_escape($p["field"]);}elseif($p["orig"]!=""){$Pi=true;$q[]=array($p["orig"]);}if($p["orig"]!=""){$Ef=next($Ff);if(!$Ef)$Ba="";}}$Uf="";if($Sf[$J["partition_by"]]){$Vf=array();if($J["partition_by"]=='RANGE'||$J["partition_by"]=='LIST'){foreach(array_filter($J["partition_names"])as$z=>$X){$Y=$J["partition_values"][$z];$Vf[]="\n  PARTITION ".idf_escape($X)." VALUES ".($J["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Uf.="\nPARTITION BY $J[partition_by]($J[partition])".($Vf?" (".implode(",",$Vf)."\n)":($J["partitions"]?" PARTITIONS ".(+$J["partitions"]):""));}elseif(support("partitioning")&&preg_match("~partitioned~",$R["Create_options"]))$Uf.="\nREMOVE PARTITIONING";$Me=lang(170);if($a==""){cookie("adminer_engine",$J["Engine"]);$Me=lang(171);}$C=trim($J["name"]);queries_redirect(ME.(support("table")?"table=":"select=").urlencode($C),$Me,alter_table($a,$C,($y=="sqlite"&&($Pi||$cd)?$Ea:$q),$cd,($J["Comment"]!=$R["Comment"]?$J["Comment"]:null),($J["Engine"]&&$J["Engine"]!=$R["Engine"]?$J["Engine"]:""),($J["Collation"]&&$J["Collation"]!=$R["Collation"]?$J["Collation"]:""),($J["Auto_increment"]!=""?number($J["Auto_increment"]):""),$Uf));}}page_header(($a!=""?lang(45):lang(75)),$o,array("table"=>$a),h($a));if(!$_POST){$J=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($U["int"])?"int":(isset($U["integer"])?"integer":"")),"on_update"=>"")),"partition_names"=>array(""),);if($a!=""){$J=$R;$J["name"]=$a;$J["fields"]=array();if(!$_GET["auto_increment"])$J["Auto_increment"]="";foreach($Ff
    6861 as$p){$p["has_default"]=isset($p["default"]);$J["fields"][]=$p;}if(support("partitioning")){$jd="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$H=$h->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $jd ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($J["partition_by"],$J["partitions"],$J["partition"])=$H->fetch_row();$Vf=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $jd AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$Vf[""]="";$J["partition_names"]=array_keys($Vf);$J["partition_values"]=array_values($Vf);}}}$pb=collations();$vc=engines();foreach($vc
    6862 as$uc){if(!strcasecmp($uc,$J["Engine"])){$J["Engine"]=$uc;break;}}echo'
     6859as$z=>$X){if(!$Z)$J[$z]=null;$q[$z]=array("field"=>$z,"null"=>($z!=$n->primary),"auto_increment"=>($z==$n->primary));}}}edit_form($a,$q,$J,$Mi);}elseif(isset($_GET["create"])){$a=$_GET["create"];$Uf=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$z)$Uf[$z]=$z;$Gg=referencable_primary($a);$fd=array();foreach($Gg
     6860as$Sh=>$p)$fd[str_replace("`","``",$Sh)."`".str_replace("`","``",$p["field"])]=$Sh;$Hf=array();$R=array();if($a!=""){$Hf=fields($a);$R=table_status($a);if(!$R)$o=lang(9);}$J=$_POST;$J["fields"]=(array)$J["fields"];if($J["auto_increment_col"])$J["fields"][$J["auto_increment_col"]]["auto_increment"]=true;if($_POST)set_adminer_settings(array("comments"=>$_POST["comments"],"defaults"=>$_POST["defaults"]));if($_POST&&!process_fields($J["fields"])&&!$o){if($_POST["drop"])queries_redirect(substr(ME,0,-1),lang(169),drop_tables(array($a)));else{$q=array();$Ea=array();$Ri=false;$dd=array();$Gf=reset($Hf);$Ba=" FIRST";foreach($J["fields"]as$z=>$p){$r=$fd[$p["type"]];$Di=($r!==null?$Gg[$r]:$p);if($p["field"]!=""){if(!$p["has_default"])$p["default"]=null;if($z==$J["auto_increment_col"])$p["auto_increment"]=true;$tg=process_field($p,$Di);$Ea[]=array($p["orig"],$tg,$Ba);if($tg!=process_field($Gf,$Gf)){$q[]=array($p["orig"],$tg,$Ba);if($p["orig"]!=""||$Ba)$Ri=true;}if($r!==null)$dd[idf_escape($p["field"])]=($a!=""&&$y!="sqlite"?"ADD":" ").format_foreign_key(array('table'=>$fd[$p["type"]],'source'=>array($p["field"]),'target'=>array($Di["field"]),'on_delete'=>$p["on_delete"],));$Ba=" AFTER ".idf_escape($p["field"]);}elseif($p["orig"]!=""){$Ri=true;$q[]=array($p["orig"]);}if($p["orig"]!=""){$Gf=next($Hf);if(!$Gf)$Ba="";}}$Wf="";if($Uf[$J["partition_by"]]){$Xf=array();if($J["partition_by"]=='RANGE'||$J["partition_by"]=='LIST'){foreach(array_filter($J["partition_names"])as$z=>$X){$Y=$J["partition_values"][$z];$Xf[]="\n  PARTITION ".idf_escape($X)." VALUES ".($J["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Wf.="\nPARTITION BY $J[partition_by]($J[partition])".($Xf?" (".implode(",",$Xf)."\n)":($J["partitions"]?" PARTITIONS ".(+$J["partitions"]):""));}elseif(support("partitioning")&&preg_match("~partitioned~",$R["Create_options"]))$Wf.="\nREMOVE PARTITIONING";$Ne=lang(170);if($a==""){cookie("adminer_engine",$J["Engine"]);$Ne=lang(171);}$C=trim($J["name"]);queries_redirect(ME.(support("table")?"table=":"select=").urlencode($C),$Ne,alter_table($a,$C,($y=="sqlite"&&($Ri||$dd)?$Ea:$q),$dd,($J["Comment"]!=$R["Comment"]?$J["Comment"]:null),($J["Engine"]&&$J["Engine"]!=$R["Engine"]?$J["Engine"]:""),($J["Collation"]&&$J["Collation"]!=$R["Collation"]?$J["Collation"]:""),($J["Auto_increment"]!=""?number($J["Auto_increment"]):""),$Wf));}}page_header(($a!=""?lang(45):lang(75)),$o,array("table"=>$a),h($a));if(!$_POST){$J=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($U["int"])?"int":(isset($U["integer"])?"integer":"")),"on_update"=>"")),"partition_names"=>array(""),);if($a!=""){$J=$R;$J["name"]=$a;$J["fields"]=array();if(!$_GET["auto_increment"])$J["Auto_increment"]="";foreach($Hf
     6861as$p){$p["has_default"]=isset($p["default"]);$J["fields"][]=$p;}if(support("partitioning")){$kd="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$H=$h->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $kd ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($J["partition_by"],$J["partitions"],$J["partition"])=$H->fetch_row();$Xf=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $kd AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$Xf[""]="";$J["partition_names"]=array_keys($Xf);$J["partition_values"]=array_values($Xf);}}}$qb=collations();$wc=engines();foreach($wc
     6862as$vc){if(!strcasecmp($vc,$J["Engine"])){$J["Engine"]=$vc;break;}}echo'
    68636863<form action="" method="post" id="form">
    68646864<p>
     
    68666866lang(172),': <input name="name" data-maxlength="64" value="',h($J["name"]),'" autocapitalize="off">
    68676867';if($a==""&&!$_POST)echo
    6868 script("focus(qs('#form')['name']);");echo($vc?"<select name='Engine'>".optionlist(array(""=>"(".lang(173).")")+$vc,$J["Engine"])."</select>".on_help("getTarget(event).value",1).script("qsl('select').onchange = helpClose;"):""),' ',($pb&&!preg_match("~sqlite|mssql~",$y)?html_select("Collation",array(""=>"(".lang(101).")")+$pb,$J["Collation"]):""),' <input type="submit" value="',lang(14),'">
     6868script("focus(qs('#form')['name']);");echo($wc?"<select name='Engine'>".optionlist(array(""=>"(".lang(173).")")+$wc,$J["Engine"])."</select>".on_help("getTarget(event).value",1).script("qsl('select').onchange = helpClose;"):""),' ',($qb&&!preg_match("~sqlite|mssql~",$y)?html_select("Collation",array(""=>"(".lang(101).")")+$qb,$J["Collation"]):""),' <input type="submit" value="',lang(14),'">
    68696869';}echo'
    68706870';if(support("columns")){echo'<div class="scrollable">
    68716871<table cellspacing="0" id="edit-fields" class="nowrap">
    6872 ';edit_fields($J["fields"],$pb,"TABLE",$ed);echo'</table>
     6872';edit_fields($J["fields"],$qb,"TABLE",$fd);echo'</table>
    68736873</div>
    68746874<p>
     
    68776877<input type="submit" value="',lang(14),'">
    68786878';}echo'
    6879 ';if($a!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$a));}if(support("partitioning")){$Tf=preg_match('~RANGE|LIST~',$J["partition_by"]);print_fieldset("partition",lang(176),$J["partition_by"]);echo'<p>
    6880 ',"<select name='partition_by'>".optionlist(array(""=>"")+$Sf,$J["partition_by"])."</select>".on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')",1).script("qsl('select').onchange = partitionByChange;"),'(<input name="partition" value="',h($J["partition"]),'">)
    6881 ',lang(177),': <input type="number" name="partitions" class="size',($Tf||!$J["partition_by"]?" hidden":""),'" value="',h($J["partitions"]),'">
    6882 <table cellspacing="0" id="partition-table"',($Tf?"":" class='hidden'"),'>
     6879';if($a!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$a));}if(support("partitioning")){$Vf=preg_match('~RANGE|LIST~',$J["partition_by"]);print_fieldset("partition",lang(176),$J["partition_by"]);echo'<p>
     6880',"<select name='partition_by'>".optionlist(array(""=>"")+$Uf,$J["partition_by"])."</select>".on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')",1).script("qsl('select').onchange = partitionByChange;"),'(<input name="partition" value="',h($J["partition"]),'">)
     6881',lang(177),': <input type="number" name="partitions" class="size',($Vf||!$J["partition_by"]?" hidden":""),'" value="',h($J["partitions"]),'">
     6882<table cellspacing="0" id="partition-table"',($Vf?"":" class='hidden'"),'>
    68836883<thead><tr><th>',lang(178),'<th>',lang(179),'</thead>
    68846884';foreach($J["partition_names"]as$z=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'" autocapitalize="off">',($z==count($J["partition_names"])-1?script("qsl('input').oninput = partitionNameChange;"):''),'<td><input name="partition_values[]" value="'.h($J["partition_values"][$z]).'">';}echo'</table>
    68856885</div></fieldset>
    6886 ';}echo'<input type="hidden" name="token" value="',$pi,'">
     6886';}echo'<input type="hidden" name="token" value="',$ri,'">
    68876887</form>
    6888 ',script("qs('#form')['defaults'].onclick();".(support("comment")?" editingCommentsClick(qs('#form')['comments']);":""));}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Jd=array("PRIMARY","UNIQUE","INDEX");$R=table_status($a,true);if(preg_match('~MyISAM|M?aria'.(min_version(5.6,'10.0.5')?'|InnoDB':'').'~i',$R["Engine"]))$Jd[]="FULLTEXT";if(preg_match('~MyISAM|M?aria'.(min_version(5.7,'10.2.2')?'|InnoDB':'').'~i',$R["Engine"]))$Jd[]="SPATIAL";$x=indexes($a);$kg=array();if($y=="mongo"){$kg=$x["_id_"];unset($Jd[0]);unset($x["_id_"]);}$J=$_POST;if($_POST&&!$o&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($J["indexes"]as$w){$C=$w["name"];if(in_array($w["type"],$Jd)){$f=array();$ve=array();$Xb=array();$O=array();ksort($w["columns"]);foreach($w["columns"]as$z=>$e){if($e!=""){$ue=$w["lengths"][$z];$Wb=$w["descs"][$z];$O[]=idf_escape($e).($ue?"(".(+$ue).")":"").($Wb?" DESC":"");$f[]=$e;$ve[]=($ue?$ue:null);$Xb[]=$Wb;}}if($f){$Dc=$x[$C];if($Dc){ksort($Dc["columns"]);ksort($Dc["lengths"]);ksort($Dc["descs"]);if($w["type"]==$Dc["type"]&&array_values($Dc["columns"])===$f&&(!$Dc["lengths"]||array_values($Dc["lengths"])===$ve)&&array_values($Dc["descs"])===$Xb){unset($x[$C]);continue;}}$c[]=array($w["type"],$C,$O);}}}foreach($x
    6889 as$C=>$Dc)$c[]=array($Dc["type"],$C,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(180),alter_indexes($a,$c));}page_header(lang(132),$o,array("table"=>$a),h($a));$q=array_keys(fields($a));if($_POST["add"]){foreach($J["indexes"]as$z=>$w){if($w["columns"][count($w["columns"])]!="")$J["indexes"][$z]["columns"][]="";}$w=end($J["indexes"]);if($w["type"]||array_filter($w["columns"],'strlen'))$J["indexes"][]=array("columns"=>array(1=>""));}if(!$J){foreach($x
     6888',script("qs('#form')['defaults'].onclick();".(support("comment")?" editingCommentsClick(qs('#form')['comments']);":""));}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Kd=array("PRIMARY","UNIQUE","INDEX");$R=table_status($a,true);if(preg_match('~MyISAM|M?aria'.(min_version(5.6,'10.0.5')?'|InnoDB':'').'~i',$R["Engine"]))$Kd[]="FULLTEXT";if(preg_match('~MyISAM|M?aria'.(min_version(5.7,'10.2.2')?'|InnoDB':'').'~i',$R["Engine"]))$Kd[]="SPATIAL";$x=indexes($a);$mg=array();if($y=="mongo"){$mg=$x["_id_"];unset($Kd[0]);unset($x["_id_"]);}$J=$_POST;if($_POST&&!$o&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($J["indexes"]as$w){$C=$w["name"];if(in_array($w["type"],$Kd)){$f=array();$we=array();$Zb=array();$O=array();ksort($w["columns"]);foreach($w["columns"]as$z=>$e){if($e!=""){$ve=$w["lengths"][$z];$Yb=$w["descs"][$z];$O[]=idf_escape($e).($ve?"(".(+$ve).")":"").($Yb?" DESC":"");$f[]=$e;$we[]=($ve?$ve:null);$Zb[]=$Yb;}}if($f){$Ec=$x[$C];if($Ec){ksort($Ec["columns"]);ksort($Ec["lengths"]);ksort($Ec["descs"]);if($w["type"]==$Ec["type"]&&array_values($Ec["columns"])===$f&&(!$Ec["lengths"]||array_values($Ec["lengths"])===$we)&&array_values($Ec["descs"])===$Zb){unset($x[$C]);continue;}}$c[]=array($w["type"],$C,$O);}}}foreach($x
     6889as$C=>$Ec)$c[]=array($Ec["type"],$C,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(180),alter_indexes($a,$c));}page_header(lang(132),$o,array("table"=>$a),h($a));$q=array_keys(fields($a));if($_POST["add"]){foreach($J["indexes"]as$z=>$w){if($w["columns"][count($w["columns"])]!="")$J["indexes"][$z]["columns"][]="";}$w=end($J["indexes"]);if($w["type"]||array_filter($w["columns"],'strlen'))$J["indexes"][]=array("columns"=>array(1=>""));}if(!$J){foreach($x
    68906890as$z=>$w){$x[$z]["name"]=$z;$x[$z]["columns"][]="";}$x[]=array("columns"=>array(1=>""));$J["indexes"]=$x;}echo'
    68916891<form action="" method="post">
     
    68936893<table cellspacing="0" class="nowrap">
    68946894<thead><tr>
    6895 <th id="label-type">',lang(181),'<th><input type="submit" class="wayoff">',lang(182),'<th id="label-name">',lang(183),'<th><noscript>',"<input type='image' class='icon' name='add[0]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.2")."' alt='+' title='".lang(108)."'>",'</noscript>
     6895<th id="label-type">',lang(181),'<th><input type="submit" class="wayoff">',lang(182),'<th id="label-name">',lang(183),'<th><noscript>',"<input type='image' class='icon' name='add[0]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.4")."' alt='+' title='".lang(108)."'>",'</noscript>
    68966896</thead>
    6897 ';if($kg){echo"<tr><td>PRIMARY<td>";foreach($kg["columns"]as$z=>$e){echo
    6898 select_input(" disabled",$q,$e),"<label><input disabled type='checkbox'>".lang(60)."</label> ";}echo"<td><td>\n";}$ce=1;foreach($J["indexes"]as$w){if(!$_POST["drop_col"]||$ce!=key($_POST["drop_col"])){echo"<tr><td>".html_select("indexes[$ce][type]",array(-1=>"")+$Jd,$w["type"],($ce==count($J["indexes"])?"indexesAddRow.call(this);":1),"label-type"),"<td>";ksort($w["columns"]);$t=1;foreach($w["columns"]as$z=>$e){echo"<span>".select_input(" name='indexes[$ce][columns][$t]' title='".lang(49)."'",($q?array_combine($q,$q):$q),$e,"partial(".($t==count($w["columns"])?"indexesAddColumn":"indexesChangeColumn").", '".js_escape($y=="sql"?"":$_GET["indexes"]."_")."')"),($y=="sql"||$y=="mssql"?"<input type='number' name='indexes[$ce][lengths][$t]' class='size' value='".h($w["lengths"][$z])."' title='".lang(106)."'>":""),(support("descidx")?checkbox("indexes[$ce][descs][$t]",1,$w["descs"][$z],lang(60)):"")," </span>";$t++;}echo"<td><input name='indexes[$ce][name]' value='".h($w["name"])."' autocapitalize='off' aria-labelledby='label-name'>\n","<td><input type='image' class='icon' name='drop_col[$ce]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.7.2")."' alt='x' title='".lang(111)."'>".script("qsl('input').onclick = partial(editingRemoveRow, 'indexes\$1[type]');");}$ce++;}echo'</table>
     6897';if($mg){echo"<tr><td>PRIMARY<td>";foreach($mg["columns"]as$z=>$e){echo
     6898select_input(" disabled",$q,$e),"<label><input disabled type='checkbox'>".lang(60)."</label> ";}echo"<td><td>\n";}$de=1;foreach($J["indexes"]as$w){if(!$_POST["drop_col"]||$de!=key($_POST["drop_col"])){echo"<tr><td>".html_select("indexes[$de][type]",array(-1=>"")+$Kd,$w["type"],($de==count($J["indexes"])?"indexesAddRow.call(this);":1),"label-type"),"<td>";ksort($w["columns"]);$t=1;foreach($w["columns"]as$z=>$e){echo"<span>".select_input(" name='indexes[$de][columns][$t]' title='".lang(49)."'",($q?array_combine($q,$q):$q),$e,"partial(".($t==count($w["columns"])?"indexesAddColumn":"indexesChangeColumn").", '".js_escape($y=="sql"?"":$_GET["indexes"]."_")."')"),($y=="sql"||$y=="mssql"?"<input type='number' name='indexes[$de][lengths][$t]' class='size' value='".h($w["lengths"][$z])."' title='".lang(106)."'>":""),(support("descidx")?checkbox("indexes[$de][descs][$t]",1,$w["descs"][$z],lang(60)):"")," </span>";$t++;}echo"<td><input name='indexes[$de][name]' value='".h($w["name"])."' autocapitalize='off' aria-labelledby='label-name'>\n","<td><input type='image' class='icon' name='drop_col[$de]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.7.4")."' alt='x' title='".lang(111)."'>".script("qsl('input').onclick = partial(editingRemoveRow, 'indexes\$1[type]');");}$de++;}echo'</table>
    68996899</div>
    69006900<p>
    69016901<input type="submit" value="',lang(14),'">
    6902 <input type="hidden" name="token" value="',$pi,'">
     6902<input type="hidden" name="token" value="',$ri,'">
    69036903</form>
    6904 ';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$o&&!isset($_POST["add_x"])){$C=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(184),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace('~\bdb=[^&]*&~','',ME)."db=".urlencode($C),lang(185),rename_database($C,$J["collation"]));}else{$l=explode("\n",str_replace("\r","",$C));$Kh=true;$oe="";foreach($l
    6905 as$m){if(count($l)==1||$m!=""){if(!create_database($m,$J["collation"]))$Kh=false;$oe=$m;}}restart_session();set_session("dbs",null);queries_redirect(ME."db=".urlencode($oe),lang(186),$Kh);}}else{if(!$J["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($C).(preg_match('~^[a-z0-9_]+$~i',$J["collation"])?" COLLATE $J[collation]":""),substr(ME,0,-1),lang(187));}}page_header(DB!=""?lang(68):lang(115),$o,array(),h(DB));$pb=collations();$C=DB;if($_POST)$C=$J["name"];elseif(DB!="")$J["collation"]=db_collation(DB,$pb);elseif($y=="sql"){foreach(get_vals("SHOW GRANTS")as$ld){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~',$ld,$B)&&$B[1]){$C=stripcslashes(idf_unescape("`$B[2]`"));break;}}}echo'
     6904';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$o&&!isset($_POST["add_x"])){$C=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(184),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace('~\bdb=[^&]*&~','',ME)."db=".urlencode($C),lang(185),rename_database($C,$J["collation"]));}else{$l=explode("\n",str_replace("\r","",$C));$Mh=true;$pe="";foreach($l
     6905as$m){if(count($l)==1||$m!=""){if(!create_database($m,$J["collation"]))$Mh=false;$pe=$m;}}restart_session();set_session("dbs",null);queries_redirect(ME."db=".urlencode($pe),lang(186),$Mh);}}else{if(!$J["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($C).(preg_match('~^[a-z0-9_]+$~i',$J["collation"])?" COLLATE $J[collation]":""),substr(ME,0,-1),lang(187));}}page_header(DB!=""?lang(68):lang(115),$o,array(),h(DB));$qb=collations();$C=DB;if($_POST)$C=$J["name"];elseif(DB!="")$J["collation"]=db_collation(DB,$qb);elseif($y=="sql"){foreach(get_vals("SHOW GRANTS")as$md){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~',$md,$B)&&$B[1]){$C=stripcslashes(idf_unescape("`$B[2]`"));break;}}}echo'
    69066906<form action="" method="post">
    69076907<p>
    6908 ',($_POST["add_x"]||strpos($C,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($C).'</textarea><br>':'<input name="name" id="name" value="'.h($C).'" data-maxlength="64" autocapitalize="off">')."\n".($pb?html_select("collation",array(""=>"(".lang(101).")")+$pb,$J["collation"]).doc_link(array('sql'=>"charset-charsets.html",'mariadb'=>"supported-character-sets-and-collations/",'mssql'=>"ms187963.aspx",)):""),script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
    6909 ';if(DB!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,DB))."\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type='image' class='icon' name='add' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.2")."' alt='+' title='".lang(108)."'>\n";echo'<input type="hidden" name="token" value="',$pi,'">
     6908',($_POST["add_x"]||strpos($C,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($C).'</textarea><br>':'<input name="name" id="name" value="'.h($C).'" data-maxlength="64" autocapitalize="off">')."\n".($qb?html_select("collation",array(""=>"(".lang(101).")")+$qb,$J["collation"]).doc_link(array('sql'=>"charset-charsets.html",'mariadb'=>"supported-character-sets-and-collations/",'mssql'=>"ms187963.aspx",)):""),script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
     6909';if(DB!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,DB))."\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type='image' class='icon' name='add' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.4")."' alt='+' title='".lang(108)."'>\n";echo'<input type="hidden" name="token" value="',$ri,'">
    69106910</form>
    69116911';}elseif(isset($_GET["scheme"])){$J=$_POST;if($_POST&&!$o){$A=preg_replace('~ns=[^&]*&~','',ME)."ns=";if($_POST["drop"])query_redirect("DROP SCHEMA ".idf_escape($_GET["ns"]),$A,lang(188));else{$C=trim($J["name"]);$A.=urlencode($C);if($_GET["ns"]=="")query_redirect("CREATE SCHEMA ".idf_escape($C),$A,lang(189));elseif($_GET["ns"]!=$C)query_redirect("ALTER SCHEMA ".idf_escape($_GET["ns"])." RENAME TO ".idf_escape($C),$A,lang(190));else
     
    69146914<p><input name="name" id="name" value="',h($J["name"]),'" autocapitalize="off">
    69156915',script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
    6916 ';if($_GET["ns"]!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$_GET["ns"]))."\n";echo'<input type="hidden" name="token" value="',$pi,'">
     6916';if($_GET["ns"]!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$_GET["ns"]))."\n";echo'<input type="hidden" name="token" value="',$ri,'">
    69176917</form>
    6918 ';}elseif(isset($_GET["call"])){$da=($_GET["name"]?$_GET["name"]:$_GET["call"]);page_header(lang(191).": ".h($da),$o);$Ug=routine($_GET["call"],(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Hd=array();$Jf=array();foreach($Ug["fields"]as$t=>$p){if(substr($p["inout"],-3)=="OUT")$Jf[$t]="@".idf_escape($p["field"])." AS ".idf_escape($p["field"]);if(!$p["inout"]||substr($p["inout"],0,2)=="IN")$Hd[]=$t;}if(!$o&&$_POST){$ab=array();foreach($Ug["fields"]as$z=>$p){if(in_array($z,$Hd)){$X=process_input($p);if($X===false)$X="''";if(isset($Jf[$z]))$h->query("SET @".idf_escape($p["field"])." = $X");}$ab[]=(isset($Jf[$z])?"@".idf_escape($p["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$ab).")";$Dh=microtime(true);$H=$h->multi_query($G);$_a=$h->affected_rows;echo$b->selectQuery($G,$Dh,!$H);if(!$H)echo"<p class='error'>".error()."\n";else{$i=connect();if(is_object($i))$i->select_db(DB);do{$H=$h->store_result();if(is_object($H))select($H,$i);else
    6919 echo"<p class='message'>".lang(192,$_a)."\n";}while($h->next_result());if($Jf)select($h->query("SELECT ".implode(", ",$Jf)));}}echo'
     6918';}elseif(isset($_GET["call"])){$da=($_GET["name"]?$_GET["name"]:$_GET["call"]);page_header(lang(191).": ".h($da),$o);$Wg=routine($_GET["call"],(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Id=array();$Lf=array();foreach($Wg["fields"]as$t=>$p){if(substr($p["inout"],-3)=="OUT")$Lf[$t]="@".idf_escape($p["field"])." AS ".idf_escape($p["field"]);if(!$p["inout"]||substr($p["inout"],0,2)=="IN")$Id[]=$t;}if(!$o&&$_POST){$bb=array();foreach($Wg["fields"]as$z=>$p){if(in_array($z,$Id)){$X=process_input($p);if($X===false)$X="''";if(isset($Lf[$z]))$h->query("SET @".idf_escape($p["field"])." = $X");}$bb[]=(isset($Lf[$z])?"@".idf_escape($p["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$bb).")";$Fh=microtime(true);$H=$h->multi_query($G);$_a=$h->affected_rows;echo$b->selectQuery($G,$Fh,!$H);if(!$H)echo"<p class='error'>".error()."\n";else{$i=connect();if(is_object($i))$i->select_db(DB);do{$H=$h->store_result();if(is_object($H))select($H,$i);else
     6919echo"<p class='message'>".lang(192,$_a)."\n";}while($h->next_result());if($Lf)select($h->query("SELECT ".implode(", ",$Lf)));}}echo'
    69206920<form action="" method="post">
    6921 ';if($Hd){echo"<table cellspacing='0' class='layout'>\n";foreach($Hd
    6922 as$z){$p=$Ug["fields"][$z];$C=$p["field"];echo"<tr><th>".$b->fieldName($p);$Y=$_POST["fields"][$C];if($Y!=""){if($p["type"]=="enum")$Y=+$Y;if($p["type"]=="set")$Y=array_sum($Y);}input($p,$Y,(string)$_POST["function"][$C]);echo"\n";}echo"</table>\n";}echo'<p>
     6921';if($Id){echo"<table cellspacing='0' class='layout'>\n";foreach($Id
     6922as$z){$p=$Wg["fields"][$z];$C=$p["field"];echo"<tr><th>".$b->fieldName($p);$Y=$_POST["fields"][$C];if($Y!=""){if($p["type"]=="enum")$Y=+$Y;if($p["type"]=="set")$Y=array_sum($Y);}input($p,$Y,(string)$_POST["function"][$C]);echo"\n";}echo"</table>\n";}echo'<p>
    69236923<input type="submit" value="',lang(191),'">
    6924 <input type="hidden" name="token" value="',$pi,'">
     6924<input type="hidden" name="token" value="',$ri,'">
    69256925</form>
    6926 ';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$J=$_POST;if($_POST&&!$o&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$Me=($_POST["drop"]?lang(193):($C!=""?lang(194):lang(195)));$ye=ME."table=".urlencode($a);if(!$_POST["drop"]){$J["source"]=array_filter($J["source"],'strlen');ksort($J["source"]);$Yh=array();foreach($J["source"]as$z=>$X)$Yh[$z]=$J["target"][$z];$J["target"]=$Yh;}if($y=="sqlite")queries_redirect($ye,$Me,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($J)))));else{$c="ALTER TABLE ".table($a);$fc="\nDROP ".($y=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$fc,$ye,$Me);else{query_redirect($c.($C!=""?"$fc,":"")."\nADD".format_foreign_key($J),$ye,$Me);$o=lang(196)."<br>$o";}}}page_header(lang(197),$o,array("table"=>$a),h($a));if($_POST){ksort($J["source"]);if($_POST["add"])$J["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$J["target"]=array();}elseif($C!=""){$ed=foreign_keys($a);$J=$ed[$C];$J["source"][]="";}else{$J["table"]=$a;$J["source"]=array("");}$wh=array_keys(fields($a));$Yh=($a===$J["table"]?$wh:array_keys(fields($J["table"])));$Dg=array_keys(array_filter(table_status('',true),'fk_support'));echo'
     6926';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$J=$_POST;if($_POST&&!$o&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$Ne=($_POST["drop"]?lang(193):($C!=""?lang(194):lang(195)));$ze=ME."table=".urlencode($a);if(!$_POST["drop"]){$J["source"]=array_filter($J["source"],'strlen');ksort($J["source"]);$ai=array();foreach($J["source"]as$z=>$X)$ai[$z]=$J["target"][$z];$J["target"]=$ai;}if($y=="sqlite")queries_redirect($ze,$Ne,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($J)))));else{$c="ALTER TABLE ".table($a);$gc="\nDROP ".($y=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$gc,$ze,$Ne);else{query_redirect($c.($C!=""?"$gc,":"")."\nADD".format_foreign_key($J),$ze,$Ne);$o=lang(196)."<br>$o";}}}page_header(lang(197),$o,array("table"=>$a),h($a));if($_POST){ksort($J["source"]);if($_POST["add"])$J["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$J["target"]=array();}elseif($C!=""){$fd=foreign_keys($a);$J=$fd[$C];$J["source"][]="";}else{$J["table"]=$a;$J["source"]=array("");}echo'
    69276927<form action="" method="post">
    6928 <p>
    6929 ';if($J["db"]==""&&$J["ns"]==""){echo
    6930 lang(198),':
    6931 ',html_select("table",$Dg,$J["table"],"this.form['change-js'].value = '1'; this.form.submit();"),'<input type="hidden" name="change-js" value="">
     6928';$yh=array_keys(fields($a));if($J["db"]!="")$h->select_db($J["db"]);if($J["ns"]!="")set_schema($J["ns"]);$Fg=array_keys(array_filter(table_status('',true),'fk_support'));$ai=($a===$J["table"]?$yh:array_keys(fields(in_array($J["table"],$Fg)?$J["table"]:reset($Fg))));$tf="this.form['change-js'].value = '1'; this.form.submit();";echo"<p>".lang(198).": ".html_select("table",$Fg,$J["table"],$tf)."\n";if($y=="pgsql")echo
     6929lang(78).": ".html_select("ns",$b->schemas(),$J["ns"]!=""?$J["ns"]:$_GET["ns"],$tf);elseif($y!="sqlite"){$Sb=array();foreach($b->databases()as$m){if(!information_schema($m))$Sb[]=$m;}echo
     6930lang(77).": ".html_select("db",$Sb,$J["db"]!=""?$J["db"]:$_GET["db"],$tf);}echo'<input type="hidden" name="change-js" value="">
    69326931<noscript><p><input type="submit" name="change" value="',lang(199),'"></noscript>
    69336932<table cellspacing="0">
    69346933<thead><tr><th id="label-source">',lang(134),'<th id="label-target">',lang(135),'</thead>
    6935 ';$ce=0;foreach($J["source"]as$z=>$X){echo"<tr>","<td>".html_select("source[".(+$z)."]",array(-1=>"")+$wh,$X,($ce==count($J["source"])-1?"foreignAddRow.call(this);":1),"label-source"),"<td>".html_select("target[".(+$z)."]",$Yh,$J["target"][$z],1,"label-target");$ce++;}echo'</table>
     6934';$de=0;foreach($J["source"]as$z=>$X){echo"<tr>","<td>".html_select("source[".(+$z)."]",array(-1=>"")+$yh,$X,($de==count($J["source"])-1?"foreignAddRow.call(this);":1),"label-source"),"<td>".html_select("target[".(+$z)."]",$ai,$J["target"][$z],1,"label-target");$de++;}echo'</table>
    69366935<p>
    6937 ',lang(103),': ',html_select("on_delete",array(-1=>"")+explode("|",$qf),$J["on_delete"]),' ',lang(102),': ',html_select("on_update",array(-1=>"")+explode("|",$qf),$J["on_update"]),doc_link(array('sql'=>"innodb-foreign-key-constraints.html",'mariadb'=>"foreign-keys/",'pgsql'=>"sql-createtable.html#SQL-CREATETABLE-REFERENCES",'mssql'=>"ms174979.aspx",'oracle'=>"clauses002.htm#sthref2903",)),'<p>
     6936',lang(103),': ',html_select("on_delete",array(-1=>"")+explode("|",$sf),$J["on_delete"]),' ',lang(102),': ',html_select("on_update",array(-1=>"")+explode("|",$sf),$J["on_update"]),doc_link(array('sql'=>"innodb-foreign-key-constraints.html",'mariadb'=>"foreign-keys/",'pgsql'=>"sql-createtable.html#SQL-CREATETABLE-REFERENCES",'mssql'=>"ms174979.aspx",'oracle'=>"https://docs.oracle.com/cd/B19306_01/server.102/b14200/clauses002.htm#sthref2903",)),'<p>
    69386937<input type="submit" value="',lang(14),'">
    69396938<noscript><p><input type="submit" name="add" value="',lang(200),'"></noscript>
    6940 ';}if($C!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$C));}echo'<input type="hidden" name="token" value="',$pi,'">
     6939';if($C!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$C));}echo'<input type="hidden" name="token" value="',$ri,'">
    69416940</form>
    6942 ';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;$Gf="VIEW";if($y=="pgsql"&&$a!=""){$Fh=table_status($a);$Gf=strtoupper($Fh["Engine"]);}if($_POST&&!$o){$C=trim($J["name"]);$Ha=" AS\n$J[select]";$ye=ME."table=".urlencode($C);$Me=lang(201);$T=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$C&&$y!="sqlite"&&$T=="VIEW"&&$Gf=="VIEW")query_redirect(($y=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ha,$ye,$Me);else{$ai=$C."_adminer_".uniqid();drop_create("DROP $Gf ".table($a),"CREATE $T ".table($C).$Ha,"DROP $T ".table($C),"CREATE $T ".table($ai).$Ha,"DROP $T ".table($ai),($_POST["drop"]?substr(ME,0,-1):$ye),lang(202),$Me,lang(203),$a,$C);}}if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;$J["materialized"]=($Gf!="VIEW");if(!$o)$o=error();}page_header(($a!=""?lang(44):lang(204)),$o,array("table"=>$a),h($a));echo'
     6941';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;$If="VIEW";if($y=="pgsql"&&$a!=""){$Hh=table_status($a);$If=strtoupper($Hh["Engine"]);}if($_POST&&!$o){$C=trim($J["name"]);$Ha=" AS\n$J[select]";$ze=ME."table=".urlencode($C);$Ne=lang(201);$T=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$C&&$y!="sqlite"&&$T=="VIEW"&&$If=="VIEW")query_redirect(($y=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ha,$ze,$Ne);else{$ci=$C."_adminer_".uniqid();drop_create("DROP $If ".table($a),"CREATE $T ".table($C).$Ha,"DROP $T ".table($C),"CREATE $T ".table($ci).$Ha,"DROP $T ".table($ci),($_POST["drop"]?substr(ME,0,-1):$ze),lang(202),$Ne,lang(203),$a,$C);}}if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;$J["materialized"]=($If!="VIEW");if(!$o)$o=error();}page_header(($a!=""?lang(44):lang(204)),$o,array("table"=>$a),h($a));echo'
    69436942<form action="" method="post">
    69446943<p>',lang(183),': <input name="name" value="',h($J["name"]),'" data-maxlength="64" autocapitalize="off">
    69456944',(support("materializedview")?" ".checkbox("materialized",1,$J["materialized"],lang(129)):""),'<p>';textarea("select",$J["select"]);echo'<p>
    69466945<input type="submit" value="',lang(14),'">
    6947 ';if($a!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$a));}echo'<input type="hidden" name="token" value="',$pi,'">
     6946';if($a!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$a));}echo'<input type="hidden" name="token" value="',$ri,'">
    69486947</form>
    6949 ';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Ud=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Gh=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$o){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(205));elseif(in_array($J["INTERVAL_FIELD"],$Ud)&&isset($Gh[$J["STATUS"]])){$Zg="\nON SCHEDULE ".($J["INTERVAL_VALUE"]?"EVERY ".q($J["INTERVAL_VALUE"])." $J[INTERVAL_FIELD]".($J["STARTS"]?" STARTS ".q($J["STARTS"]):"").($J["ENDS"]?" ENDS ".q($J["ENDS"]):""):"AT ".q($J["STARTS"]))." ON COMPLETION".($J["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(206):lang(207)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$Zg.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$Zg)."\n".$Gh[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(208).": ".h($aa):lang(209)),$o);if(!$J&&$aa!=""){$K=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$J=reset($K);}echo'
     6948';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Vd=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Ih=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$o){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(205));elseif(in_array($J["INTERVAL_FIELD"],$Vd)&&isset($Ih[$J["STATUS"]])){$bh="\nON SCHEDULE ".($J["INTERVAL_VALUE"]?"EVERY ".q($J["INTERVAL_VALUE"])." $J[INTERVAL_FIELD]".($J["STARTS"]?" STARTS ".q($J["STARTS"]):"").($J["ENDS"]?" ENDS ".q($J["ENDS"]):""):"AT ".q($J["STARTS"]))." ON COMPLETION".($J["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(206):lang(207)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$bh.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$bh)."\n".$Ih[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(208).": ".h($aa):lang(209)),$o);if(!$J&&$aa!=""){$K=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$J=reset($K);}echo'
    69506949<form action="" method="post">
    69516950<table cellspacing="0" class="layout">
     
    69536952<tr><th title="datetime">',lang(210),'<td><input name="STARTS" value="',h("$J[EXECUTE_AT]$J[STARTS]"),'">
    69546953<tr><th title="datetime">',lang(211),'<td><input name="ENDS" value="',h($J["ENDS"]),'">
    6955 <tr><th>',lang(212),'<td><input type="number" name="INTERVAL_VALUE" value="',h($J["INTERVAL_VALUE"]),'" class="size"> ',html_select("INTERVAL_FIELD",$Ud,$J["INTERVAL_FIELD"]),'<tr><th>',lang(118),'<td>',html_select("STATUS",$Gh,$J["STATUS"]),'<tr><th>',lang(51),'<td><input name="EVENT_COMMENT" value="',h($J["EVENT_COMMENT"]),'" data-maxlength="64">
     6954<tr><th>',lang(212),'<td><input type="number" name="INTERVAL_VALUE" value="',h($J["INTERVAL_VALUE"]),'" class="size"> ',html_select("INTERVAL_FIELD",$Vd,$J["INTERVAL_FIELD"]),'<tr><th>',lang(118),'<td>',html_select("STATUS",$Ih,$J["STATUS"]),'<tr><th>',lang(51),'<td><input name="EVENT_COMMENT" value="',h($J["EVENT_COMMENT"]),'" data-maxlength="64">
    69566955<tr><th><td>',checkbox("ON_COMPLETION","PRESERVE",$J["ON_COMPLETION"]=="PRESERVE",lang(213)),'</table>
    69576956<p>';textarea("EVENT_DEFINITION",$J["EVENT_DEFINITION"]);echo'<p>
    69586957<input type="submit" value="',lang(14),'">
    6959 ';if($aa!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$aa));}echo'<input type="hidden" name="token" value="',$pi,'">
     6958';if($aa!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$aa));}echo'<input type="hidden" name="token" value="',$ri,'">
    69606959</form>
    6961 ';}elseif(isset($_GET["procedure"])){$da=($_GET["name"]?$_GET["name"]:$_GET["procedure"]);$Ug=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$o){$Df=routine($_GET["procedure"],$Ug);$ai="$J[name]_adminer_".uniqid();drop_create("DROP $Ug ".routine_id($da,$Df),create_routine($Ug,$J),"DROP $Ug ".routine_id($J["name"],$J),create_routine($Ug,array("name"=>$ai)+$J),"DROP $Ug ".routine_id($ai,$J),substr(ME,0,-1),lang(214),lang(215),lang(216),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(217):lang(218)).": ".h($da):(isset($_GET["function"])?lang(219):lang(220))),$o);if(!$_POST&&$da!=""){$J=routine($_GET["procedure"],$Ug);$J["name"]=$da;}$pb=get_vals("SHOW CHARACTER SET");sort($pb);$Vg=routine_languages();echo'
     6960';}elseif(isset($_GET["procedure"])){$da=($_GET["name"]?$_GET["name"]:$_GET["procedure"]);$Wg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$o){$Ff=routine($_GET["procedure"],$Wg);$ci="$J[name]_adminer_".uniqid();drop_create("DROP $Wg ".routine_id($da,$Ff),create_routine($Wg,$J),"DROP $Wg ".routine_id($J["name"],$J),create_routine($Wg,array("name"=>$ci)+$J),"DROP $Wg ".routine_id($ci,$J),substr(ME,0,-1),lang(214),lang(215),lang(216),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(217):lang(218)).": ".h($da):(isset($_GET["function"])?lang(219):lang(220))),$o);if(!$_POST&&$da!=""){$J=routine($_GET["procedure"],$Wg);$J["name"]=$da;}$qb=get_vals("SHOW CHARACTER SET");sort($qb);$Xg=routine_languages();echo'
    69626961<form action="" method="post" id="form">
    69636962<p>',lang(183),': <input name="name" value="',h($J["name"]),'" data-maxlength="64" autocapitalize="off">
    6964 ',($Vg?lang(19).": ".html_select("language",$Vg,$J["language"])."\n":""),'<input type="submit" value="',lang(14),'">
     6963',($Xg?lang(19).": ".html_select("language",$Xg,$J["language"])."\n":""),'<input type="submit" value="',lang(14),'">
    69656964<div class="scrollable">
    69666965<table cellspacing="0" class="nowrap">
    6967 ';edit_fields($J["fields"],$pb,$Ug);if(isset($_GET["function"])){echo"<tr><td>".lang(221);edit_type("returns",$J["returns"],$pb,array(),($y=="pgsql"?array("void","trigger"):array()));}echo'</table>
     6966';edit_fields($J["fields"],$qb,$Wg);if(isset($_GET["function"])){echo"<tr><td>".lang(221);edit_type("returns",$J["returns"],$qb,array(),($y=="pgsql"?array("void","trigger"):array()));}echo'</table>
    69686967</div>
    69696968<p>';textarea("definition",$J["definition"]);echo'<p>
    69706969<input type="submit" value="',lang(14),'">
    6971 ';if($da!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$da));}echo'<input type="hidden" name="token" value="',$pi,'">
     6970';if($da!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$da));}echo'<input type="hidden" name="token" value="',$ri,'">
    69726971</form>
    69736972';}elseif(isset($_GET["sequence"])){$fa=$_GET["sequence"];$J=$_POST;if($_POST&&!$o){$A=substr(ME,0,-1);$C=trim($J["name"]);if($_POST["drop"])query_redirect("DROP SEQUENCE ".idf_escape($fa),$A,lang(222));elseif($fa=="")query_redirect("CREATE SEQUENCE ".idf_escape($C),$A,lang(223));elseif($fa!=$C)query_redirect("ALTER SEQUENCE ".idf_escape($fa)." RENAME TO ".idf_escape($C),$A,lang(224));else
     
    69766975<p><input name="name" value="',h($J["name"]),'" autocapitalize="off">
    69776976<input type="submit" value="',lang(14),'">
    6978 ';if($fa!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$fa))."\n";echo'<input type="hidden" name="token" value="',$pi,'">
     6977';if($fa!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$fa))."\n";echo'<input type="hidden" name="token" value="',$ri,'">
    69796978</form>
    69806979';}elseif(isset($_GET["type"])){$ga=$_GET["type"];$J=$_POST;if($_POST&&!$o){$A=substr(ME,0,-1);if($_POST["drop"])query_redirect("DROP TYPE ".idf_escape($ga),$A,lang(227));else
     
    69826981<form action="" method="post">
    69836982<p>
    6984 ';if($ga!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$ga))."\n";else{echo"<input name='name' value='".h($J['name'])."' autocapitalize='off'>\n";textarea("as",$J["as"]);echo"<p><input type='submit' value='".lang(14)."'>\n";}echo'<input type="hidden" name="token" value="',$pi,'">
     6983';if($ga!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$ga))."\n";else{echo"<input name='name' value='".h($J['name'])."' autocapitalize='off'>\n";textarea("as",$J["as"]);echo"<p><input type='submit' value='".lang(14)."'>\n";}echo'<input type="hidden" name="token" value="',$ri,'">
    69856984</form>
    6986 ';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$_i=trigger_options();$J=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$o&&in_array($_POST["Timing"],$_i["Timing"])&&in_array($_POST["Event"],$_i["Event"])&&in_array($_POST["Type"],$_i["Type"])){$pf=" ON ".table($a);$fc="DROP TRIGGER ".idf_escape($C).($y=="pgsql"?$pf:"");$ye=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($fc,$ye,lang(231));else{if($C!="")queries($fc);queries_redirect($ye,($C!=""?lang(232):lang(233)),queries(create_trigger($pf,$_POST)));if($C!="")queries(create_trigger($pf,$J+array("Type"=>reset($_i["Type"]))));}}$J=$_POST;}page_header(($C!=""?lang(234).": ".h($C):lang(235)),$o,array("table"=>$a));echo'
     6985';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$Bi=trigger_options();$J=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$o&&in_array($_POST["Timing"],$Bi["Timing"])&&in_array($_POST["Event"],$Bi["Event"])&&in_array($_POST["Type"],$Bi["Type"])){$rf=" ON ".table($a);$gc="DROP TRIGGER ".idf_escape($C).($y=="pgsql"?$rf:"");$ze=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($gc,$ze,lang(231));else{if($C!="")queries($gc);queries_redirect($ze,($C!=""?lang(232):lang(233)),queries(create_trigger($rf,$_POST)));if($C!="")queries(create_trigger($rf,$J+array("Type"=>reset($Bi["Type"]))));}}$J=$_POST;}page_header(($C!=""?lang(234).": ".h($C):lang(235)),$o,array("table"=>$a));echo'
    69876986<form action="" method="post" id="form">
    69886987<table cellspacing="0" class="layout">
    6989 <tr><th>',lang(236),'<td>',html_select("Timing",$_i["Timing"],$J["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, '".js_escape($a)."', this.form);"),'<tr><th>',lang(237),'<td>',html_select("Event",$_i["Event"],$J["Event"],"this.form['Timing'].onchange();"),(in_array("UPDATE OF",$_i["Event"])?" <input name='Of' value='".h($J["Of"])."' class='hidden'>":""),'<tr><th>',lang(50),'<td>',html_select("Type",$_i["Type"],$J["Type"]),'</table>
     6988<tr><th>',lang(236),'<td>',html_select("Timing",$Bi["Timing"],$J["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, '".js_escape($a)."', this.form);"),'<tr><th>',lang(237),'<td>',html_select("Event",$Bi["Event"],$J["Event"],"this.form['Timing'].onchange();"),(in_array("UPDATE OF",$Bi["Event"])?" <input name='Of' value='".h($J["Of"])."' class='hidden'>":""),'<tr><th>',lang(50),'<td>',html_select("Type",$Bi["Type"],$J["Type"]),'</table>
    69906989<p>',lang(183),': <input name="Trigger" value="',h($J["Trigger"]),'" data-maxlength="64" autocapitalize="off">
    69916990',script("qs('#form')['Timing'].onchange();"),'<p>';textarea("Statement",$J["Statement"]);echo'<p>
    69926991<input type="submit" value="',lang(14),'">
    6993 ';if($C!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$C));}echo'<input type="hidden" name="token" value="',$pi,'">
     6992';if($C!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$C));}echo'<input type="hidden" name="token" value="',$ri,'">
    69946993</form>
    6995 ';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$pg=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$Bb)$pg[$Bb][$J["Privilege"]]=$J["Comment"];}$pg["Server Admin"]+=$pg["File access on server"];$pg["Databases"]["Create routine"]=$pg["Procedures"]["Create routine"];unset($pg["Procedures"]["Create routine"]);$pg["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$pg["Columns"][$X]=$pg["Tables"][$X];unset($pg["Server Admin"]["Usage"]);foreach($pg["Tables"]as$z=>$X)unset($pg["Databases"][$z]);$Ze=array();if($_POST){foreach($_POST["objects"]as$z=>$X)$Ze[$X]=(array)$Ze[$X]+(array)$_POST["grants"][$z];}$md=array();$nf="";if(isset($_GET["host"])&&($H=$h->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$J[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\([^)]+\))?~',$B[1],$Ee,PREG_SET_ORDER)){foreach($Ee
    6996 as$X){if($X[1]!="USAGE")$md["$B[2]$X[2]"][$X[1]]=true;if(preg_match('~ WITH GRANT OPTION~',$J[0]))$md["$B[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$J[0],$B))$nf=$B[1];}}if($_POST&&!$o){$of=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $of",ME."privileges=",lang(238));else{$bf=q($_POST["user"])."@".q($_POST["host"]);$Xf=$_POST["pass"];if($Xf!=''&&!$_POST["hashed"]&&!min_version(8)){$Xf=$h->result("SELECT PASSWORD(".q($Xf).")");$o=!$Xf;}$Fb=false;if(!$o){if($of!=$bf){$Fb=queries((min_version(5)?"CREATE USER":"GRANT USAGE ON *.* TO")." $bf IDENTIFIED BY ".(min_version(8)?"":"PASSWORD ").q($Xf));$o=!$Fb;}elseif($Xf!=$nf)queries("SET PASSWORD FOR $bf = ".q($Xf));}if(!$o){$Rg=array();foreach($Ze
    6997 as$if=>$ld){if(isset($_GET["grant"]))$ld=array_filter($ld);$ld=array_keys($ld);if(isset($_GET["grant"]))$Rg=array_diff(array_keys(array_filter($Ze[$if],'strlen')),$ld);elseif($of==$bf){$lf=array_keys((array)$md[$if]);$Rg=array_diff($lf,$ld);$ld=array_diff($ld,$lf);unset($md[$if]);}if(preg_match('~^(.+)\s*(\(.*\))?$~U',$if,$B)&&(!grant("REVOKE",$Rg,$B[2]," ON $B[1] FROM $bf")||!grant("GRANT",$ld,$B[2]," ON $B[1] TO $bf"))){$o=true;break;}}}if(!$o&&isset($_GET["host"])){if($of!=$bf)queries("DROP USER $of");elseif(!isset($_GET["grant"])){foreach($md
    6998 as$if=>$Rg){if(preg_match('~^(.+)(\(.*\))?$~U',$if,$B))grant("REVOKE",array_keys($Rg),$B[2]," ON $B[1] FROM $bf");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(239):lang(240)),!$o);if($Fb)$h->query("DROP USER $bf");}}page_header((isset($_GET["host"])?lang(36).": ".h("$ha@$_GET[host]"):lang(146)),$o,array("privileges"=>array('',lang(72))));if($_POST){$J=$_POST;$md=$Ze;}else{$J=$_GET+array("host"=>$h->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$J["pass"]=$nf;if($nf!="")$J["hashed"]=true;$md[(DB==""||$md?"":idf_escape(addcslashes(DB,"%_\\"))).".*"]=array();}echo'<form action="" method="post">
     6994';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$rg=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$Cb)$rg[$Cb][$J["Privilege"]]=$J["Comment"];}$rg["Server Admin"]+=$rg["File access on server"];$rg["Databases"]["Create routine"]=$rg["Procedures"]["Create routine"];unset($rg["Procedures"]["Create routine"]);$rg["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$rg["Columns"][$X]=$rg["Tables"][$X];unset($rg["Server Admin"]["Usage"]);foreach($rg["Tables"]as$z=>$X)unset($rg["Databases"][$z]);$af=array();if($_POST){foreach($_POST["objects"]as$z=>$X)$af[$X]=(array)$af[$X]+(array)$_POST["grants"][$z];}$nd=array();$pf="";if(isset($_GET["host"])&&($H=$h->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$J[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\([^)]+\))?~',$B[1],$Fe,PREG_SET_ORDER)){foreach($Fe
     6995as$X){if($X[1]!="USAGE")$nd["$B[2]$X[2]"][$X[1]]=true;if(preg_match('~ WITH GRANT OPTION~',$J[0]))$nd["$B[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$J[0],$B))$pf=$B[1];}}if($_POST&&!$o){$qf=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $qf",ME."privileges=",lang(238));else{$cf=q($_POST["user"])."@".q($_POST["host"]);$Zf=$_POST["pass"];if($Zf!=''&&!$_POST["hashed"]&&!min_version(8)){$Zf=$h->result("SELECT PASSWORD(".q($Zf).")");$o=!$Zf;}$Hb=false;if(!$o){if($qf!=$cf){$Hb=queries((min_version(5)?"CREATE USER":"GRANT USAGE ON *.* TO")." $cf IDENTIFIED BY ".(min_version(8)?"":"PASSWORD ").q($Zf));$o=!$Hb;}elseif($Zf!=$pf)queries("SET PASSWORD FOR $cf = ".q($Zf));}if(!$o){$Tg=array();foreach($af
     6996as$kf=>$md){if(isset($_GET["grant"]))$md=array_filter($md);$md=array_keys($md);if(isset($_GET["grant"]))$Tg=array_diff(array_keys(array_filter($af[$kf],'strlen')),$md);elseif($qf==$cf){$nf=array_keys((array)$nd[$kf]);$Tg=array_diff($nf,$md);$md=array_diff($md,$nf);unset($nd[$kf]);}if(preg_match('~^(.+)\s*(\(.*\))?$~U',$kf,$B)&&(!grant("REVOKE",$Tg,$B[2]," ON $B[1] FROM $cf")||!grant("GRANT",$md,$B[2]," ON $B[1] TO $cf"))){$o=true;break;}}}if(!$o&&isset($_GET["host"])){if($qf!=$cf)queries("DROP USER $qf");elseif(!isset($_GET["grant"])){foreach($nd
     6997as$kf=>$Tg){if(preg_match('~^(.+)(\(.*\))?$~U',$kf,$B))grant("REVOKE",array_keys($Tg),$B[2]," ON $B[1] FROM $cf");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(239):lang(240)),!$o);if($Hb)$h->query("DROP USER $cf");}}page_header((isset($_GET["host"])?lang(36).": ".h("$ha@$_GET[host]"):lang(146)),$o,array("privileges"=>array('',lang(72))));if($_POST){$J=$_POST;$nd=$af;}else{$J=$_GET+array("host"=>$h->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$J["pass"]=$pf;if($pf!="")$J["hashed"]=true;$nd[(DB==""||$nd?"":idf_escape(addcslashes(DB,"%_\\"))).".*"]=array();}echo'<form action="" method="post">
    69996998<table cellspacing="0" class="layout">
    70006999<tr><th>',lang(35),'<td><input name="host" data-maxlength="60" value="',h($J["host"]),'" autocapitalize="off">
     
    70047003script("typePassword(qs('#pass'));");echo(min_version(8)?"":checkbox("hashed",1,$J["hashed"],lang(241),"typePassword(this.form['pass'], this.checked);")),'</table>
    70057004
    7006 ';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'>".lang(72).doc_link(array('sql'=>"grant.html#priv_level"));$t=0;foreach($md
    7007 as$if=>$ld){echo'<th>'.($if!="*.*"?"<input name='objects[$t]' value='".h($if)."' size='10' autocapitalize='off'>":"<input type='hidden' name='objects[$t]' value='*.*' size='10'>*.*");$t++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>lang(35),"Databases"=>lang(38),"Tables"=>lang(131),"Columns"=>lang(49),"Procedures"=>lang(242),)as$Bb=>$Wb){foreach((array)$pg[$Bb]as$og=>$ub){echo"<tr".odd()."><td".($Wb?">$Wb<td":" colspan='2'").' lang="en" title="'.h($ub).'">'.h($og);$t=0;foreach($md
    7008 as$if=>$ld){$C="'grants[$t][".h(strtoupper($og))."]'";$Y=$ld[strtoupper($og)];if($Bb=="Server Admin"&&$if!=(isset($md["*.*"])?"*.*":".*"))echo"<td>";elseif(isset($_GET["grant"]))echo"<td><select name=$C><option><option value='1'".($Y?" selected":"").">".lang(243)."<option value='0'".($Y=="0"?" selected":"").">".lang(244)."</select>";else{echo"<td align='center'><label class='block'>","<input type='checkbox' name=$C value='1'".($Y?" checked":"").($og=="All privileges"?" id='grants-$t-all'>":">".($og=="Grant option"?"":script("qsl('input').onclick = function () { if (this.checked) formUncheck('grants-$t-all'); };"))),"</label>";}$t++;}}}echo"</table>\n",'<p>
     7005';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'>".lang(72).doc_link(array('sql'=>"grant.html#priv_level"));$t=0;foreach($nd
     7006as$kf=>$md){echo'<th>'.($kf!="*.*"?"<input name='objects[$t]' value='".h($kf)."' size='10' autocapitalize='off'>":"<input type='hidden' name='objects[$t]' value='*.*' size='10'>*.*");$t++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>lang(35),"Databases"=>lang(38),"Tables"=>lang(131),"Columns"=>lang(49),"Procedures"=>lang(242),)as$Cb=>$Yb){foreach((array)$rg[$Cb]as$qg=>$vb){echo"<tr".odd()."><td".($Yb?">$Yb<td":" colspan='2'").' lang="en" title="'.h($vb).'">'.h($qg);$t=0;foreach($nd
     7007as$kf=>$md){$C="'grants[$t][".h(strtoupper($qg))."]'";$Y=$md[strtoupper($qg)];if($Cb=="Server Admin"&&$kf!=(isset($nd["*.*"])?"*.*":".*"))echo"<td>";elseif(isset($_GET["grant"]))echo"<td><select name=$C><option><option value='1'".($Y?" selected":"").">".lang(243)."<option value='0'".($Y=="0"?" selected":"").">".lang(244)."</select>";else{echo"<td align='center'><label class='block'>","<input type='checkbox' name=$C value='1'".($Y?" checked":"").($qg=="All privileges"?" id='grants-$t-all'>":">".($qg=="Grant option"?"":script("qsl('input').onclick = function () { if (this.checked) formUncheck('grants-$t-all'); };"))),"</label>";}$t++;}}}echo"</table>\n",'<p>
    70097008<input type="submit" value="',lang(14),'">
    7010 ';if(isset($_GET["host"])){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,"$ha@$_GET[host]"));}echo'<input type="hidden" name="token" value="',$pi,'">
     7009';if(isset($_GET["host"])){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,"$ha@$_GET[host]"));}echo'<input type="hidden" name="token" value="',$ri,'">
    70117010</form>
    7012 ';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$o){$je=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$je++;}queries_redirect(ME."processlist=",lang(245,$je),$je||!$_POST["kill"]);}page_header(lang(116),$o);echo'
     7011';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$o){$ke=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$ke++;}queries_redirect(ME."processlist=",lang(245,$ke),$ke||!$_POST["kill"]);}page_header(lang(116),$o);echo'
    70137012<form action="" method="post">
    70147013<div class="scrollable">
    70157014<table cellspacing="0" class="nowrap checkable">
    70167015',script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");$t=-1;foreach(process_list()as$t=>$J){if(!$t){echo"<thead><tr lang='en'>".(support("kill")?"<th>":"");foreach($J
    7017 as$z=>$X)echo"<th>$z".doc_link(array('sql'=>"show-processlist.html#processlist_".strtolower($z),'pgsql'=>"monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",'oracle'=>"../b14237/dynviews_2088.htm",));echo"</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$J[$y=="sql"?"Id":"pid"],0):"");foreach($J
     7016as$z=>$X)echo"<th>$z".doc_link(array('sql'=>"show-processlist.html#processlist_".strtolower($z),'pgsql'=>"monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",'oracle'=>"REFRN30223",));echo"</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$J[$y=="sql"?"Id":"pid"],0):"");foreach($J
    70187017as$z=>$X)echo"<td>".(($y=="sql"&&$z=="Info"&&preg_match("~Query|Killed~",$J["Command"])&&$X!="")||($y=="pgsql"&&$z=="current_query"&&$X!="<IDLE>")||($y=="oracle"&&$z=="sql_text"&&$X!="")?"<code class='jush-$y'>".shorten_utf8($X,100,"</code>").' <a href="'.h(ME.($J["db"]!=""?"db=".urlencode($J["db"])."&":"")."sql=".urlencode($X)).'">'.lang(246).'</a>':h($X));echo"\n";}echo'</table>
    70197018</div>
    70207019<p>
    7021 ';if(support("kill")){echo($t+1)."/".lang(247,max_connections()),"<p><input type='submit' value='".lang(248)."'>\n";}echo'<input type="hidden" name="token" value="',$pi,'">
     7020';if(support("kill")){echo($t+1)."/".lang(247,max_connections()),"<p><input type='submit' value='".lang(248)."'>\n";}echo'<input type="hidden" name="token" value="',$ri,'">
    70227021</form>
    7023 ',script("tableCheck();");}elseif(isset($_GET["select"])){$a=$_GET["select"];$R=table_status1($a);$x=indexes($a);$q=fields($a);$ed=column_foreign_keys($a);$kf=$R["Oid"];parse_str($_COOKIE["adminer_import"],$za);$Sg=array();$f=array();$ei=null;foreach($q
    7024 as$z=>$p){$C=$b->fieldName($p);if(isset($p["privileges"]["select"])&&$C!=""){$f[$z]=html_entity_decode(strip_tags($C),ENT_QUOTES);if(is_shortable($p))$ei=$b->selectLengthProcess();}$Sg+=$p["privileges"];}list($L,$nd)=$b->selectColumnsProcess($f,$x);$Yd=count($nd)<count($L);$Z=$b->selectSearchProcess($q,$x);$_f=$b->selectOrderProcess($q,$x);$_=$b->selectLimitProcess();if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Gi=>$J){$Ha=convert_field($q[key($J)]);$L=array($Ha?$Ha:idf_escape(key($J)));$Z[]=where_check($Gi,$q);$I=$n->select($a,$L,$Z,$L);if($I)echo
    7025 reset($I->fetch_row());}exit;}$kg=$Ii=null;foreach($x
    7026 as$w){if($w["type"]=="PRIMARY"){$kg=array_flip($w["columns"]);$Ii=($L?$kg:array());foreach($Ii
    7027 as$z=>$X){if(in_array(idf_escape($z),$L))unset($Ii[$z]);}break;}}if($kf&&!$kg){$kg=$Ii=array($kf=>0);$x[]=array("type"=>"PRIMARY","columns"=>array($kf));}if($_POST&&!$o){$jj=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$gb=array();foreach($_POST["check"]as$db)$gb[]=where_check($db,$q);$jj[]="((".implode(") OR (",$gb)."))";}$jj=($jj?"\nWHERE ".implode(" AND ",$jj):"");if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");$jd=($L?implode(", ",$L):"*").convert_fields($f,$q,$L)."\nFROM ".table($a);$pd=($nd&&$Yd?"\nGROUP BY ".implode(", ",$nd):"").($_f?"\nORDER BY ".implode(", ",$_f):"");if(!is_array($_POST["check"])||$kg)$G="SELECT $jd$jj$pd";else{$Ei=array();foreach($_POST["check"]as$X)$Ei[]="(SELECT".limit($jd,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$q).$pd,1).")";$G=implode(" UNION ALL ",$Ei);}$b->dumpData($a,"table",$G);exit;}if(!$b->selectEmailProcess($Z,$ed)){if($_POST["save"]||$_POST["delete"]){$H=true;$_a=0;$O=array();if(!$_POST["delete"]){foreach($f
    7028 as$C=>$X){$X=process_input($q[$C]);if($X!==null&&($_POST["clone"]||$X!==false))$O[idf_escape($C)]=($X!==false?$X:idf_escape($C));}}if($_POST["delete"]||$O){if($_POST["clone"])$G="INTO ".table($a)." (".implode(", ",array_keys($O)).")\nSELECT ".implode(", ",$O)."\nFROM ".table($a);if($_POST["all"]||($kg&&is_array($_POST["check"]))||$Yd){$H=($_POST["delete"]?$n->delete($a,$jj):($_POST["clone"]?queries("INSERT $G$jj"):$n->update($a,$O,$jj)));$_a=$h->affected_rows;}else{foreach((array)$_POST["check"]as$X){$fj="\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$q);$H=($_POST["delete"]?$n->delete($a,$fj,1):($_POST["clone"]?queries("INSERT".limit1($a,$G,$fj)):$n->update($a,$O,$fj,1)));if(!$H)break;$_a+=$h->affected_rows;}}}$Me=lang(249,$_a);if($_POST["clone"]&&$H&&$_a==1){$pe=last_id();if($pe)$Me=lang(168," $pe");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$Me,$H);if(!$_POST["delete"]){edit_form($a,$q,(array)$_POST["fields"],!$_POST["clone"]);page_footer();exit;}}elseif(!$_POST["import"]){if(!$_POST["val"])$o=lang(250);else{$H=true;$_a=0;foreach($_POST["val"]as$Gi=>$J){$O=array();foreach($J
    7029 as$z=>$X){$z=bracket_escape($z,1);$O[idf_escape($z)]=(preg_match('~char|text~',$q[$z]["type"])||$X!=""?$b->processInput($q[$z],$X):"NULL");}$H=$n->update($a,$O," WHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($Gi,$q),!$Yd&&!$kg," ");if(!$H)break;$_a+=$h->affected_rows;}queries_redirect(remove_from_uri(),lang(249,$_a),$H);}}elseif(!is_string($Tc=get_file("csv_file",true)))$o=upload_error($Tc);elseif(!preg_match('~~u',$Tc))$o=lang(251);else{cookie("adminer_import","output=".urlencode($za["output"])."&format=".urlencode($_POST["separator"]));$H=true;$rb=array_keys($q);preg_match_all('~(?>"[^"]*"|[^"\r\n]+)+~',$Tc,$Ee);$_a=count($Ee[0]);$n->begin();$M=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));$K=array();foreach($Ee[0]as$z=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$M]*)$M~",$X.$M,$Fe);if(!$z&&!array_diff($Fe[1],$rb)){$rb=$Fe[1];$_a--;}else{$O=array();foreach($Fe[1]as$t=>$nb)$O[idf_escape($rb[$t])]=($nb==""&&$q[$rb[$t]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$nb))));$K[]=$O;}}$H=(!$K||$n->insertUpdate($a,$K,$kg));if($H)$H=$n->commit();queries_redirect(remove_from_uri("page"),lang(252,$_a),$H);$n->rollback();}}}$Qh=$b->tableName($R);if(is_ajax()){page_headers();ob_start();}else
    7030 page_header(lang(54).": $Qh",$o);$O=null;if(isset($Sg["insert"])||!support("table")){$O="";foreach((array)$_GET["where"]as$X){if($ed[$X["col"]]&&count($ed[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!preg_match('~[_%]~',$X["val"]))))$O.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($R,$O);if(!$f&&support("table"))echo"<p class='error'>".lang(253).($q?".":": ".error())."\n";else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($a).'">',"</div>\n";$b->selectColumnsPrint($L,$f);$b->selectSearchPrint($Z,$f,$x);$b->selectOrderPrint($_f,$f,$x);$b->selectLimitPrint($_);$b->selectLengthPrint($ei);$b->selectActionPrint($x);echo"</form>\n";$E=$_GET["page"];if($E=="last"){$hd=$h->result(count_rows($a,$Z,$Yd,$nd));$E=floor(max(0,$hd-1)/$_);}$eh=$L;$od=$nd;if(!$eh){$eh[]="*";$Cb=convert_fields($f,$q,$L);if($Cb)$eh[]=substr($Cb,2);}foreach($L
    7031 as$z=>$X){$p=$q[idf_unescape($X)];if($p&&($Ha=convert_field($p)))$eh[$z]="$Ha AS $X";}if(!$Yd&&$Ii){foreach($Ii
    7032 as$z=>$X){$eh[]=idf_escape($z);if($od)$od[]=idf_escape($z);}}$H=$n->select($a,$eh,$Z,$od,$_f,$_,$E,true);if(!$H)echo"<p class='error'>".error()."\n";else{if($y=="mssql"&&$E)$H->seek($_*$E);$sc=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$K=array();while($J=$H->fetch_assoc()){if($E&&$y=="oracle")unset($J["RNUM"]);$K[]=$J;}if($_GET["page"]!="last"&&$_!=""&&$nd&&$Yd&&$y=="sql")$hd=$h->result(" SELECT FOUND_ROWS()");if(!$K)echo"<p class='message'>".lang(12)."\n";else{$Qa=$b->backwardKeys($a,$Qh);echo"<div class='scrollable'>","<table id='table' cellspacing='0' class='nowrap checkable'>",script("mixin(qs('#table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown});"),"<thead><tr>".(!$nd&&$L?"":"<td><input type='checkbox' id='all-page' class='jsonly'>".script("qs('#all-page').onclick = partial(formCheck, /check/);","")." <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".lang(254)."</a>");$Ye=array();$kd=array();reset($L);$zg=1;foreach($K[0]as$z=>$X){if(!isset($Ii[$z])){$X=$_GET["columns"][key($L)];$p=$q[$L?($X?$X["col"]:current($L)):$z];$C=($p?$b->fieldName($p,$zg):($X["fun"]?"*":$z));if($C!=""){$zg++;$Ye[$z]=$C;$e=idf_escape($z);$Bd=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($z);$Wb="&desc%5B0%5D=1";echo"<th>".script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});",""),'<a href="'.h($Bd.($_f[0]==$e||$_f[0]==$z||(!$_f&&$Yd&&$nd[0]==$e)?$Wb:'')).'">';echo
    7033 apply_sql_function($X["fun"],$C)."</a>";echo"<span class='column hidden'>","<a href='".h($Bd.$Wb)."' title='".lang(60)."' class='text'> ↓</a>";if(!$X["fun"]){echo'<a href="#fieldset-search" title="'.lang(57).'" class="text jsonly"> =</a>',script("qsl('a').onclick = partial(selectSearch, '".js_escape($z)."');");}echo"</span>";}$kd[$z]=$X["fun"];next($L);}}$ve=array();if($_GET["modify"]){foreach($K
     7022',script("tableCheck();");}elseif(isset($_GET["select"])){$a=$_GET["select"];$R=table_status1($a);$x=indexes($a);$q=fields($a);$fd=column_foreign_keys($a);$mf=$R["Oid"];parse_str($_COOKIE["adminer_import"],$za);$Ug=array();$f=array();$gi=null;foreach($q
     7023as$z=>$p){$C=$b->fieldName($p);if(isset($p["privileges"]["select"])&&$C!=""){$f[$z]=html_entity_decode(strip_tags($C),ENT_QUOTES);if(is_shortable($p))$gi=$b->selectLengthProcess();}$Ug+=$p["privileges"];}list($L,$od)=$b->selectColumnsProcess($f,$x);$Zd=count($od)<count($L);$Z=$b->selectSearchProcess($q,$x);$Bf=$b->selectOrderProcess($q,$x);$_=$b->selectLimitProcess();if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Ii=>$J){$Ha=convert_field($q[key($J)]);$L=array($Ha?$Ha:idf_escape(key($J)));$Z[]=where_check($Ii,$q);$I=$n->select($a,$L,$Z,$L);if($I)echo
     7024reset($I->fetch_row());}exit;}$mg=$Ki=null;foreach($x
     7025as$w){if($w["type"]=="PRIMARY"){$mg=array_flip($w["columns"]);$Ki=($L?$mg:array());foreach($Ki
     7026as$z=>$X){if(in_array(idf_escape($z),$L))unset($Ki[$z]);}break;}}if($mf&&!$mg){$mg=$Ki=array($mf=>0);$x[]=array("type"=>"PRIMARY","columns"=>array($mf));}if($_POST&&!$o){$mj=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$hb=array();foreach($_POST["check"]as$eb)$hb[]=where_check($eb,$q);$mj[]="((".implode(") OR (",$hb)."))";}$mj=($mj?"\nWHERE ".implode(" AND ",$mj):"");if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");$kd=($L?implode(", ",$L):"*").convert_fields($f,$q,$L)."\nFROM ".table($a);$qd=($od&&$Zd?"\nGROUP BY ".implode(", ",$od):"").($Bf?"\nORDER BY ".implode(", ",$Bf):"");if(!is_array($_POST["check"])||$mg)$G="SELECT $kd$mj$qd";else{$Gi=array();foreach($_POST["check"]as$X)$Gi[]="(SELECT".limit($kd,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$q).$qd,1).")";$G=implode(" UNION ALL ",$Gi);}$b->dumpData($a,"table",$G);exit;}if(!$b->selectEmailProcess($Z,$fd)){if($_POST["save"]||$_POST["delete"]){$H=true;$_a=0;$O=array();if(!$_POST["delete"]){foreach($f
     7027as$C=>$X){$X=process_input($q[$C]);if($X!==null&&($_POST["clone"]||$X!==false))$O[idf_escape($C)]=($X!==false?$X:idf_escape($C));}}if($_POST["delete"]||$O){if($_POST["clone"])$G="INTO ".table($a)." (".implode(", ",array_keys($O)).")\nSELECT ".implode(", ",$O)."\nFROM ".table($a);if($_POST["all"]||($mg&&is_array($_POST["check"]))||$Zd){$H=($_POST["delete"]?$n->delete($a,$mj):($_POST["clone"]?queries("INSERT $G$mj"):$n->update($a,$O,$mj)));$_a=$h->affected_rows;}else{foreach((array)$_POST["check"]as$X){$ij="\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$q);$H=($_POST["delete"]?$n->delete($a,$ij,1):($_POST["clone"]?queries("INSERT".limit1($a,$G,$ij)):$n->update($a,$O,$ij,1)));if(!$H)break;$_a+=$h->affected_rows;}}}$Ne=lang(249,$_a);if($_POST["clone"]&&$H&&$_a==1){$qe=last_id();if($qe)$Ne=lang(168," $qe");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$Ne,$H);if(!$_POST["delete"]){edit_form($a,$q,(array)$_POST["fields"],!$_POST["clone"]);page_footer();exit;}}elseif(!$_POST["import"]){if(!$_POST["val"])$o=lang(250);else{$H=true;$_a=0;foreach($_POST["val"]as$Ii=>$J){$O=array();foreach($J
     7028as$z=>$X){$z=bracket_escape($z,1);$O[idf_escape($z)]=(preg_match('~char|text~',$q[$z]["type"])||$X!=""?$b->processInput($q[$z],$X):"NULL");}$H=$n->update($a,$O," WHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($Ii,$q),!$Zd&&!$mg," ");if(!$H)break;$_a+=$h->affected_rows;}queries_redirect(remove_from_uri(),lang(249,$_a),$H);}}elseif(!is_string($Uc=get_file("csv_file",true)))$o=upload_error($Uc);elseif(!preg_match('~~u',$Uc))$o=lang(251);else{cookie("adminer_import","output=".urlencode($za["output"])."&format=".urlencode($_POST["separator"]));$H=true;$sb=array_keys($q);preg_match_all('~(?>"[^"]*"|[^"\r\n]+)+~',$Uc,$Fe);$_a=count($Fe[0]);$n->begin();$M=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));$K=array();foreach($Fe[0]as$z=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$M]*)$M~",$X.$M,$Ge);if(!$z&&!array_diff($Ge[1],$sb)){$sb=$Ge[1];$_a--;}else{$O=array();foreach($Ge[1]as$t=>$ob)$O[idf_escape($sb[$t])]=($ob==""&&$q[$sb[$t]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$ob))));$K[]=$O;}}$H=(!$K||$n->insertUpdate($a,$K,$mg));if($H)$H=$n->commit();queries_redirect(remove_from_uri("page"),lang(252,$_a),$H);$n->rollback();}}}$Sh=$b->tableName($R);if(is_ajax()){page_headers();ob_start();}else
     7029page_header(lang(54).": $Sh",$o);$O=null;if(isset($Ug["insert"])||!support("table")){$O="";foreach((array)$_GET["where"]as$X){if($fd[$X["col"]]&&count($fd[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!preg_match('~[_%]~',$X["val"]))))$O.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($R,$O);if(!$f&&support("table"))echo"<p class='error'>".lang(253).($q?".":": ".error())."\n";else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($a).'">',"</div>\n";$b->selectColumnsPrint($L,$f);$b->selectSearchPrint($Z,$f,$x);$b->selectOrderPrint($Bf,$f,$x);$b->selectLimitPrint($_);$b->selectLengthPrint($gi);$b->selectActionPrint($x);echo"</form>\n";$E=$_GET["page"];if($E=="last"){$id=$h->result(count_rows($a,$Z,$Zd,$od));$E=floor(max(0,$id-1)/$_);}$gh=$L;$pd=$od;if(!$gh){$gh[]="*";$Db=convert_fields($f,$q,$L);if($Db)$gh[]=substr($Db,2);}foreach($L
     7030as$z=>$X){$p=$q[idf_unescape($X)];if($p&&($Ha=convert_field($p)))$gh[$z]="$Ha AS $X";}if(!$Zd&&$Ki){foreach($Ki
     7031as$z=>$X){$gh[]=idf_escape($z);if($pd)$pd[]=idf_escape($z);}}$H=$n->select($a,$gh,$Z,$pd,$Bf,$_,$E,true);if(!$H)echo"<p class='error'>".error()."\n";else{if($y=="mssql"&&$E)$H->seek($_*$E);$tc=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$K=array();while($J=$H->fetch_assoc()){if($E&&$y=="oracle")unset($J["RNUM"]);$K[]=$J;}if($_GET["page"]!="last"&&$_!=""&&$od&&$Zd&&$y=="sql")$id=$h->result(" SELECT FOUND_ROWS()");if(!$K)echo"<p class='message'>".lang(12)."\n";else{$Ra=$b->backwardKeys($a,$Sh);echo"<div class='scrollable'>","<table id='table' cellspacing='0' class='nowrap checkable'>",script("mixin(qs('#table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown});"),"<thead><tr>".(!$od&&$L?"":"<td><input type='checkbox' id='all-page' class='jsonly'>".script("qs('#all-page').onclick = partial(formCheck, /check/);","")." <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".lang(254)."</a>");$Ze=array();$ld=array();reset($L);$Ag=1;foreach($K[0]as$z=>$X){if(!isset($Ki[$z])){$X=$_GET["columns"][key($L)];$p=$q[$L?($X?$X["col"]:current($L)):$z];$C=($p?$b->fieldName($p,$Ag):($X["fun"]?"*":$z));if($C!=""){$Ag++;$Ze[$z]=$C;$e=idf_escape($z);$Cd=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($z);$Yb="&desc%5B0%5D=1";echo"<th>".script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});",""),'<a href="'.h($Cd.($Bf[0]==$e||$Bf[0]==$z||(!$Bf&&$Zd&&$od[0]==$e)?$Yb:'')).'">';echo
     7032apply_sql_function($X["fun"],$C)."</a>";echo"<span class='column hidden'>","<a href='".h($Cd.$Yb)."' title='".lang(60)."' class='text'> ↓</a>";if(!$X["fun"]){echo'<a href="#fieldset-search" title="'.lang(57).'" class="text jsonly"> =</a>',script("qsl('a').onclick = partial(selectSearch, '".js_escape($z)."');");}echo"</span>";}$ld[$z]=$X["fun"];next($L);}}$we=array();if($_GET["modify"]){foreach($K
    70347033as$J){foreach($J
    7035 as$z=>$X)$ve[$z]=max($ve[$z],min(40,strlen(utf8_decode($X))));}}echo($Qa?"<th>".lang(255):"")."</thead>\n";if(is_ajax()){if($_%2==1&&$E%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($K,$ed)as$Xe=>$J){$Fi=unique_array($K[$Xe],$x);if(!$Fi){$Fi=array();foreach($K[$Xe]as$z=>$X){if(!preg_match('~^(COUNT\((\*|(DISTINCT )?`(?:[^`]|``)+`)\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\(`(?:[^`]|``)+`\))$~',$z))$Fi[$z]=$X;}}$Gi="";foreach($Fi
    7036 as$z=>$X){if(($y=="sql"||$y=="pgsql")&&preg_match('~char|text|enum|set~',$q[$z]["type"])&&strlen($X)>64){$z=(strpos($z,'(')?$z:idf_escape($z));$z="MD5(".($y!='sql'||preg_match("~^utf8~",$q[$z]["collation"])?$z:"CONVERT($z USING ".charset($h).")").")";$X=md5($X);}$Gi.="&".($X!==null?urlencode("where[".bracket_escape($z)."]")."=".urlencode($X):"null%5B%5D=".urlencode($z));}echo"<tr".odd().">".(!$nd&&$L?"":"<td>".checkbox("check[]",substr($Gi,1),in_array(substr($Gi,1),(array)$_POST["check"])).($Yd||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$Gi)."' class='edit'>".lang(256)."</a>"));foreach($J
    7037 as$z=>$X){if(isset($Ye[$z])){$p=$q[$z];$X=$n->value($X,$p);if($X!=""&&(!isset($sc[$z])||$sc[$z]!=""))$sc[$z]=(is_mail($X)?$Ye[$z]:"");$A="";if(preg_match('~blob|bytea|raw|file~',$p["type"])&&$X!="")$A=ME.'download='.urlencode($a).'&field='.urlencode($z).$Gi;if(!$A&&$X!==null){foreach((array)$ed[$z]as$r){if(count($ed[$z])==1||end($r["source"])==$z){$A="";foreach($r["source"]as$t=>$wh)$A.=where_link($t,$r["target"][$t],$K[$Xe][$wh]);$A=($r["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\1'.urlencode($r["db"]),ME):ME).'select='.urlencode($r["table"]).$A;if($r["ns"])$A=preg_replace('~([?&]ns=)[^&]+~','\1'.urlencode($r["ns"]),$A);if(count($r["source"])==1)break;}}}if($z=="COUNT(*)"){$A=ME."select=".urlencode($a);$t=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$Fi))$A.=where_link($t++,$W["col"],$W["val"],$W["op"]);}foreach($Fi
    7038 as$de=>$W)$A.=where_link($t++,$de,$W);}$X=select_value($X,$A,$p,$ei);$u=h("val[$Gi][".bracket_escape($z)."]");$Y=$_POST["val"][$Gi][bracket_escape($z)];$nc=!is_array($J[$z])&&isutf8($X)&&$K[$Xe][$z]==$J[$z]&&!$kd[$z];$di=preg_match('~text|lob~',$p["type"]);if(($_GET["modify"]&&$nc)||$Y!==null){$sd=h($Y!==null?$Y:$J[$z]);echo"<td>".($di?"<textarea name='$u' cols='30' rows='".(substr_count($J[$z],"\n")+1)."'>$sd</textarea>":"<input name='$u' value='$sd' size='$ve[$z]'>");}else{$_e=strpos($X,"<i>…</i>");echo"<td id='$u' data-text='".($_e?2:($di?1:0))."'".($nc?"":" data-warning='".h(lang(257))."'").">$X</td>";}}}if($Qa)echo"<td>";$b->backwardKeysPrint($Qa,$K[$Xe]);echo"</tr>\n";}if(is_ajax())exit;echo"</table>\n","</div>\n";}if(!is_ajax()){if($K||$E){$Bc=true;if($_GET["page"]!="last"){if($_==""||(count($K)<$_&&($K||!$E)))$hd=($E?$E*$_:0)+count($K);elseif($y!="sql"||!$Yd){$hd=($Yd?false:found_rows($R,$Z));if($hd<max(1e4,2*($E+1)*$_))$hd=reset(slow_query(count_rows($a,$Z,$Yd,$nd)));else$Bc=false;}}$Mf=($_!=""&&($hd===false||$hd>$_||$E));if($Mf){echo(($hd===false?count($K)+1:$hd-$E*$_)>$_?'<p><a href="'.h(remove_from_uri("page")."&page=".($E+1)).'" class="loadmore">'.lang(258).'</a>'.script("qsl('a').onclick = partial(selectLoadMore, ".(+$_).", '".lang(259)."…');",""):''),"\n";}}echo"<div class='footer'><div>\n";if($K||$E){if($Mf){$He=($hd===false?$E+(count($K)>=$_?2:1):floor(($hd-1)/$_));echo"<fieldset>";if($y!="simpledb"){echo"<legend><a href='".h(remove_from_uri("page"))."'>".lang(260)."</a></legend>",script("qsl('a').onclick = function () { pageClick(this.href, +prompt('".lang(260)."', '".($E+1)."')); return false; };"),pagination(0,$E).($E>5?" …":"");for($t=max(1,$E-4);$t<min($He,$E+5);$t++)echo
    7039 pagination($t,$E);if($He>0){echo($E+5<$He?" …":""),($Bc&&$hd!==false?pagination($He,$E):" <a href='".h(remove_from_uri("page")."&page=last")."' title='~$He'>".lang(261)."</a>");}}else{echo"<legend>".lang(260)."</legend>",pagination(0,$E).($E>1?" …":""),($E?pagination($E,$E):""),($He>$E?pagination($E+1,$E).($He>$E+1?" …":""):"");}echo"</fieldset>\n";}echo"<fieldset>","<legend>".lang(262)."</legend>";$bc=($Bc?"":"~ ").$hd;echo
    7040 checkbox("all",1,0,($hd!==false?($Bc?"":"~ ").lang(150,$hd):""),"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$bc' : checked); selectCount('selected2', this.checked || !checked ? '$bc' : checked);")."\n","</fieldset>\n";if($b->selectCommandPrint()){echo'<fieldset',($_GET["modify"]?'':' class="jsonly"'),'><legend>',lang(254),'</legend><div>
     7034as$z=>$X)$we[$z]=max($we[$z],min(40,strlen(utf8_decode($X))));}}echo($Ra?"<th>".lang(255):"")."</thead>\n";if(is_ajax()){if($_%2==1&&$E%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($K,$fd)as$Ye=>$J){$Hi=unique_array($K[$Ye],$x);if(!$Hi){$Hi=array();foreach($K[$Ye]as$z=>$X){if(!preg_match('~^(COUNT\((\*|(DISTINCT )?`(?:[^`]|``)+`)\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\(`(?:[^`]|``)+`\))$~',$z))$Hi[$z]=$X;}}$Ii="";foreach($Hi
     7035as$z=>$X){if(($y=="sql"||$y=="pgsql")&&preg_match('~char|text|enum|set~',$q[$z]["type"])&&strlen($X)>64){$z=(strpos($z,'(')?$z:idf_escape($z));$z="MD5(".($y!='sql'||preg_match("~^utf8~",$q[$z]["collation"])?$z:"CONVERT($z USING ".charset($h).")").")";$X=md5($X);}$Ii.="&".($X!==null?urlencode("where[".bracket_escape($z)."]")."=".urlencode($X):"null%5B%5D=".urlencode($z));}echo"<tr".odd().">".(!$od&&$L?"":"<td>".checkbox("check[]",substr($Ii,1),in_array(substr($Ii,1),(array)$_POST["check"])).($Zd||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$Ii)."' class='edit'>".lang(256)."</a>"));foreach($J
     7036as$z=>$X){if(isset($Ze[$z])){$p=$q[$z];$X=$n->value($X,$p);if($X!=""&&(!isset($tc[$z])||$tc[$z]!=""))$tc[$z]=(is_mail($X)?$Ze[$z]:"");$A="";if(preg_match('~blob|bytea|raw|file~',$p["type"])&&$X!="")$A=ME.'download='.urlencode($a).'&field='.urlencode($z).$Ii;if(!$A&&$X!==null){foreach((array)$fd[$z]as$r){if(count($fd[$z])==1||end($r["source"])==$z){$A="";foreach($r["source"]as$t=>$yh)$A.=where_link($t,$r["target"][$t],$K[$Ye][$yh]);$A=($r["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\1'.urlencode($r["db"]),ME):ME).'select='.urlencode($r["table"]).$A;if($r["ns"])$A=preg_replace('~([?&]ns=)[^&]+~','\1'.urlencode($r["ns"]),$A);if(count($r["source"])==1)break;}}}if($z=="COUNT(*)"){$A=ME."select=".urlencode($a);$t=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$Hi))$A.=where_link($t++,$W["col"],$W["val"],$W["op"]);}foreach($Hi
     7037as$ee=>$W)$A.=where_link($t++,$ee,$W);}$X=select_value($X,$A,$p,$gi);$u=h("val[$Ii][".bracket_escape($z)."]");$Y=$_POST["val"][$Ii][bracket_escape($z)];$oc=!is_array($J[$z])&&isutf8($X)&&$K[$Ye][$z]==$J[$z]&&!$ld[$z];$fi=preg_match('~text|lob~',$p["type"]);if(($_GET["modify"]&&$oc)||$Y!==null){$td=h($Y!==null?$Y:$J[$z]);echo"<td>".($fi?"<textarea name='$u' cols='30' rows='".(substr_count($J[$z],"\n")+1)."'>$td</textarea>":"<input name='$u' value='$td' size='$we[$z]'>");}else{$Ae=strpos($X,"<i>…</i>");echo"<td id='$u' data-text='".($Ae?2:($fi?1:0))."'".($oc?"":" data-warning='".h(lang(257))."'").">$X</td>";}}}if($Ra)echo"<td>";$b->backwardKeysPrint($Ra,$K[$Ye]);echo"</tr>\n";}if(is_ajax())exit;echo"</table>\n","</div>\n";}if(!is_ajax()){if($K||$E){$Cc=true;if($_GET["page"]!="last"){if($_==""||(count($K)<$_&&($K||!$E)))$id=($E?$E*$_:0)+count($K);elseif($y!="sql"||!$Zd){$id=($Zd?false:found_rows($R,$Z));if($id<max(1e4,2*($E+1)*$_))$id=reset(slow_query(count_rows($a,$Z,$Zd,$od)));else$Cc=false;}}$Of=($_!=""&&($id===false||$id>$_||$E));if($Of){echo(($id===false?count($K)+1:$id-$E*$_)>$_?'<p><a href="'.h(remove_from_uri("page")."&page=".($E+1)).'" class="loadmore">'.lang(258).'</a>'.script("qsl('a').onclick = partial(selectLoadMore, ".(+$_).", '".lang(259)."…');",""):''),"\n";}}echo"<div class='footer'><div>\n";if($K||$E){if($Of){$Ie=($id===false?$E+(count($K)>=$_?2:1):floor(($id-1)/$_));echo"<fieldset>";if($y!="simpledb"){echo"<legend><a href='".h(remove_from_uri("page"))."'>".lang(260)."</a></legend>",script("qsl('a').onclick = function () { pageClick(this.href, +prompt('".lang(260)."', '".($E+1)."')); return false; };"),pagination(0,$E).($E>5?" …":"");for($t=max(1,$E-4);$t<min($Ie,$E+5);$t++)echo
     7038pagination($t,$E);if($Ie>0){echo($E+5<$Ie?" …":""),($Cc&&$id!==false?pagination($Ie,$E):" <a href='".h(remove_from_uri("page")."&page=last")."' title='~$Ie'>".lang(261)."</a>");}}else{echo"<legend>".lang(260)."</legend>",pagination(0,$E).($E>1?" …":""),($E?pagination($E,$E):""),($Ie>$E?pagination($E+1,$E).($Ie>$E+1?" …":""):"");}echo"</fieldset>\n";}echo"<fieldset>","<legend>".lang(262)."</legend>";$dc=($Cc?"":"~ ").$id;echo
     7039checkbox("all",1,0,($id!==false?($Cc?"":"~ ").lang(150,$id):""),"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$dc' : checked); selectCount('selected2', this.checked || !checked ? '$dc' : checked);")."\n","</fieldset>\n";if($b->selectCommandPrint()){echo'<fieldset',($_GET["modify"]?'':' class="jsonly"'),'><legend>',lang(254),'</legend><div>
    70417040<input type="submit" value="',lang(14),'"',($_GET["modify"]?'':' title="'.lang(250).'"'),'>
    70427041</div></fieldset>
     
    70457044<input type="submit" name="clone" value="',lang(246),'">
    70467045<input type="submit" name="delete" value="',lang(18),'">',confirm(),'</div></fieldset>
    7047 ';}$fd=$b->dumpFormat();foreach((array)$_GET["columns"]as$e){if($e["fun"]){unset($fd['sql']);break;}}if($fd){print_fieldset("export",lang(74)." <span id='selected2'></span>");$Kf=$b->dumpOutput();echo($Kf?html_select("output",$Kf,$za["output"])." ":""),html_select("format",$fd,$za["format"])," <input type='submit' name='export' value='".lang(74)."'>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($sc,'strlen'),$f);}echo"</div></div>\n";if($b->selectImportPrint()){echo"<div>","<a href='#import'>".lang(73)."</a>",script("qsl('a').onclick = partial(toggle, 'import');",""),"<span id='import' class='hidden'>: ","<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$za["format"],1);echo" <input type='submit' name='import' value='".lang(73)."'>","</span>","</div>";}echo"<input type='hidden' name='token' value='$pi'>\n","</form>\n",(!$nd&&$L?"":script("tableCheck();"));}}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$Fh=isset($_GET["status"]);page_header($Fh?lang(118):lang(117));$Wi=($Fh?show_status():show_variables());if(!$Wi)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Wi
    7048 as$z=>$X){echo"<tr>","<th><code class='jush-".$y.($Fh?"status":"set")."'>".h($z)."</code>","<td>".h($X);}echo"</table>\n";}}elseif(isset($_GET["script"])){header("Content-Type: text/javascript; charset=utf-8");if($_GET["script"]=="db"){$Nh=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$C=>$R){json_row("Comment-$C",h($R["Comment"]));if(!is_view($R)){foreach(array("Engine","Collation")as$z)json_row("$z-$C",h($R[$z]));foreach($Nh+array("Auto_increment"=>0,"Rows"=>0)as$z=>$X){if($R[$z]!=""){$X=format_number($R[$z]);json_row("$z-$C",($z=="Rows"&&$X&&$R["Engine"]==($zh=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Nh[$z]))$Nh[$z]+=($R["Engine"]!="InnoDB"||$z!="Data_free"?$R[$z]:0);}elseif(array_key_exists($z,$R))json_row("$z-$C");}}}foreach($Nh
    7049 as$z=>$X)json_row("sum-$z",format_number($X));json_row("");}elseif($_GET["script"]=="kill")$h->query("KILL ".number($_POST["kill"]));else{foreach(count_tables($b->databases())as$m=>$X){json_row("tables-$m",$X);json_row("size-$m",db_size($m));}json_row("");}exit;}else{$Wh=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Wh&&!$o&&!$_POST["search"]){$H=true;$Me="";if($y=="sql"&&$_POST["tables"]&&count($_POST["tables"])>1&&($_POST["drop"]||$_POST["truncate"]||$_POST["copy"]))queries("SET foreign_key_checks = 0");if($_POST["truncate"]){if($_POST["tables"])$H=truncate_tables($_POST["tables"]);$Me=lang(263);}elseif($_POST["move"]){$H=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Me=lang(264);}elseif($_POST["copy"]){$H=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Me=lang(265);}elseif($_POST["drop"]){if($_POST["views"])$H=drop_views($_POST["views"]);if($H&&$_POST["tables"])$H=drop_tables($_POST["tables"]);$Me=lang(266);}elseif($y!="sql"){$H=($y=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Me=lang(267);}elseif(!$_POST["tables"])$Me=lang(9);elseif($H=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"])))){while($J=$H->fetch_assoc())$Me.="<b>".h($J["Table"])."</b>: ".h($J["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$Me,$H);}page_header(($_GET["ns"]==""?lang(38).": ".h(DB):lang(78).": ".h($_GET["ns"])),$o,true);if($b->homepage()){if($_GET["ns"]!==""){echo"<h3 id='tables-views'>".lang(268)."</h3>\n";$Vh=tables_list();if(!$Vh)echo"<p class='message'>".lang(9)."\n";else{echo"<form action='' method='post'>\n";if(support("table")){echo"<fieldset><legend>".lang(269)." <span id='selected2'></span></legend><div>","<input type='search' name='query' value='".h($_POST["query"])."'>",script("qsl('input').onkeydown = partialArg(bodyKeydown, 'search');","")," <input type='submit' name='search' value='".lang(57)."'>\n","</div></fieldset>\n";if($_POST["search"]&&$_POST["query"]!=""){$_GET["where"][0]["op"]="LIKE %%";search_tables();}}$cc=doc_link(array('sql'=>'show-table-status.html'));echo"<div class='scrollable'>\n","<table cellspacing='0' class='nowrap checkable'>\n",script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"),'<thead><tr class="wrap">','<td><input id="check-all" type="checkbox" class="jsonly">'.script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);",""),'<th>'.lang(131),'<td>'.lang(270).doc_link(array('sql'=>'storage-engines.html')),'<td>'.lang(122).doc_link(array('sql'=>'charset-charsets.html','mariadb'=>'supported-character-sets-and-collations/')),'<td>'.lang(271).$cc,'<td>'.lang(272).$cc,'<td>'.lang(273).$cc,'<td>'.lang(52).doc_link(array('sql'=>'example-auto-increment.html','mariadb'=>'auto_increment/')),'<td>'.lang(274).$cc,(support("comment")?'<td>'.lang(51).$cc:''),"</thead>\n";$S=0;foreach($Vh
    7050 as$C=>$T){$Zi=($T!==null&&!preg_match('~table~i',$T));$u=h("Table-".$C);echo'<tr'.odd().'><td>'.checkbox(($Zi?"views[]":"tables[]"),$C,in_array($C,$Wh,true),"","","",$u),'<th>'.(support("table")||support("indexes")?"<a href='".h(ME)."table=".urlencode($C)."' title='".lang(43)."' id='$u'>".h($C).'</a>':h($C));if($Zi){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($C).'" title="'.lang(44).'">'.(preg_match('~materialized~i',$T)?lang(129):lang(130)).'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($C).'" title="'.lang(42).'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",lang(45)),"Index_length"=>array("indexes",lang(133)),"Data_free"=>array("edit",lang(46)),"Auto_increment"=>array("auto_increment=1&create",lang(45)),"Rows"=>array("select",lang(42)),)as$z=>$A){$u=" id='$z-".h($C)."'";echo($A?"<td align='right'>".(support("table")||$z=="Rows"||(support("indexes")&&$z!="Data_length")?"<a href='".h(ME."$A[0]=").urlencode($C)."'$u title='$A[1]'>?</a>":"<span$u>?</span>"):"<td id='$z-".h($C)."'>");}$S++;}echo(support("comment")?"<td id='Comment-".h($C)."'>":"");}echo"<tr><td><th>".lang(247,count($Vh)),"<td>".h($y=="sql"?$h->result("SELECT @@storage_engine"):""),"<td>".h(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$z)echo"<td align='right' id='sum-$z'>";echo"</table>\n","</div>\n";if(!information_schema(DB)){echo"<div class='footer'><div>\n";$Ti="<input type='submit' value='".lang(275)."'> ".on_help("'VACUUM'");$wf="<input type='submit' name='optimize' value='".lang(276)."'> ".on_help($y=="sql"?"'OPTIMIZE TABLE'":"'VACUUM OPTIMIZE'");echo"<fieldset><legend>".lang(126)." <span id='selected'></span></legend><div>".($y=="sqlite"?$Ti:($y=="pgsql"?$Ti.$wf:($y=="sql"?"<input type='submit' value='".lang(277)."'> ".on_help("'ANALYZE TABLE'").$wf."<input type='submit' name='check' value='".lang(278)."'> ".on_help("'CHECK TABLE'")."<input type='submit' name='repair' value='".lang(279)."'> ".on_help("'REPAIR TABLE'"):"")))."<input type='submit' name='truncate' value='".lang(280)."'> ".on_help($y=="sqlite"?"'DELETE'":"'TRUNCATE".($y=="pgsql"?"'":" TABLE'")).confirm()."<input type='submit' name='drop' value='".lang(127)."'>".on_help("'DROP TABLE'").confirm()."\n";$l=(support("scheme")?$b->schemas():$b->databases());if(count($l)!=1&&$y!="sqlite"){$m=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".lang(281).": ",($l?html_select("target",$l,$m):'<input name="target" value="'.h($m).'" autocapitalize="off">')," <input type='submit' name='move' value='".lang(282)."'>",(support("copy")?" <input type='submit' name='copy' value='".lang(283)."'> ".checkbox("overwrite",1,$_POST["overwrite"],lang(284)):""),"\n";}echo"<input type='hidden' name='all' value=''>";echo
    7051 script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^(tables|views)\[/));".(support("table")?" selectCount('selected2', formChecked(this, /^tables\[/) || $S);":"")." }"),"<input type='hidden' name='token' value='$pi'>\n","</div></fieldset>\n","</div></div>\n";}echo"</form>\n",script("tableCheck();");}echo'<p class="links"><a href="'.h(ME).'create=">'.lang(75)."</a>\n",(support("view")?'<a href="'.h(ME).'view=">'.lang(204)."</a>\n":"");if(support("routine")){echo"<h3 id='routines'>".lang(143)."</h3>\n";$Wg=routines();if($Wg){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.lang(183).'<td>'.lang(50).'<td>'.lang(221)."<td></thead>\n";odd('');foreach($Wg
    7052 as$J){$C=($J["SPECIFIC_NAME"]==$J["ROUTINE_NAME"]?"":"&name=".urlencode($J["ROUTINE_NAME"]));echo'<tr'.odd().'>','<th><a href="'.h(ME.($J["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($J["SPECIFIC_NAME"]).$C).'">'.h($J["ROUTINE_NAME"]).'</a>','<td>'.h($J["ROUTINE_TYPE"]),'<td>'.h($J["DTD_IDENTIFIER"]),'<td><a href="'.h(ME.($J["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($J["SPECIFIC_NAME"]).$C).'">'.lang(136)."</a>";}echo"</table>\n";}echo'<p class="links">'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.lang(220).'</a>':'').'<a href="'.h(ME).'function=">'.lang(219)."</a>\n";}if(support("sequence")){echo"<h3 id='sequences'>".lang(285)."</h3>\n";$kh=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name");if($kh){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."</thead>\n";odd('');foreach($kh
    7053 as$X)echo"<tr".odd()."><th><a href='".h(ME)."sequence=".urlencode($X)."'>".h($X)."</a>\n";echo"</table>\n";}echo"<p class='links'><a href='".h(ME)."sequence='>".lang(226)."</a>\n";}if(support("type")){echo"<h3 id='user-types'>".lang(26)."</h3>\n";$Ri=types();if($Ri){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."</thead>\n";odd('');foreach($Ri
     7046';}$gd=$b->dumpFormat();foreach((array)$_GET["columns"]as$e){if($e["fun"]){unset($gd['sql']);break;}}if($gd){print_fieldset("export",lang(74)." <span id='selected2'></span>");$Mf=$b->dumpOutput();echo($Mf?html_select("output",$Mf,$za["output"])." ":""),html_select("format",$gd,$za["format"])," <input type='submit' name='export' value='".lang(74)."'>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($tc,'strlen'),$f);}echo"</div></div>\n";if($b->selectImportPrint()){echo"<div>","<a href='#import'>".lang(73)."</a>",script("qsl('a').onclick = partial(toggle, 'import');",""),"<span id='import' class='hidden'>: ","<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$za["format"],1);echo" <input type='submit' name='import' value='".lang(73)."'>","</span>","</div>";}echo"<input type='hidden' name='token' value='$ri'>\n","</form>\n",(!$od&&$L?"":script("tableCheck();"));}}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$Hh=isset($_GET["status"]);page_header($Hh?lang(118):lang(117));$Zi=($Hh?show_status():show_variables());if(!$Zi)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Zi
     7047as$z=>$X){echo"<tr>","<th><code class='jush-".$y.($Hh?"status":"set")."'>".h($z)."</code>","<td>".h($X);}echo"</table>\n";}}elseif(isset($_GET["script"])){header("Content-Type: text/javascript; charset=utf-8");if($_GET["script"]=="db"){$Ph=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$C=>$R){json_row("Comment-$C",h($R["Comment"]));if(!is_view($R)){foreach(array("Engine","Collation")as$z)json_row("$z-$C",h($R[$z]));foreach($Ph+array("Auto_increment"=>0,"Rows"=>0)as$z=>$X){if($R[$z]!=""){$X=format_number($R[$z]);json_row("$z-$C",($z=="Rows"&&$X&&$R["Engine"]==($Ah=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Ph[$z]))$Ph[$z]+=($R["Engine"]!="InnoDB"||$z!="Data_free"?$R[$z]:0);}elseif(array_key_exists($z,$R))json_row("$z-$C");}}}foreach($Ph
     7048as$z=>$X)json_row("sum-$z",format_number($X));json_row("");}elseif($_GET["script"]=="kill")$h->query("KILL ".number($_POST["kill"]));else{foreach(count_tables($b->databases())as$m=>$X){json_row("tables-$m",$X);json_row("size-$m",db_size($m));}json_row("");}exit;}else{$Yh=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Yh&&!$o&&!$_POST["search"]){$H=true;$Ne="";if($y=="sql"&&$_POST["tables"]&&count($_POST["tables"])>1&&($_POST["drop"]||$_POST["truncate"]||$_POST["copy"]))queries("SET foreign_key_checks = 0");if($_POST["truncate"]){if($_POST["tables"])$H=truncate_tables($_POST["tables"]);$Ne=lang(263);}elseif($_POST["move"]){$H=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Ne=lang(264);}elseif($_POST["copy"]){$H=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Ne=lang(265);}elseif($_POST["drop"]){if($_POST["views"])$H=drop_views($_POST["views"]);if($H&&$_POST["tables"])$H=drop_tables($_POST["tables"]);$Ne=lang(266);}elseif($y!="sql"){$H=($y=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Ne=lang(267);}elseif(!$_POST["tables"])$Ne=lang(9);elseif($H=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"])))){while($J=$H->fetch_assoc())$Ne.="<b>".h($J["Table"])."</b>: ".h($J["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$Ne,$H);}page_header(($_GET["ns"]==""?lang(38).": ".h(DB):lang(78).": ".h($_GET["ns"])),$o,true);if($b->homepage()){if($_GET["ns"]!==""){echo"<h3 id='tables-views'>".lang(268)."</h3>\n";$Xh=tables_list();if(!$Xh)echo"<p class='message'>".lang(9)."\n";else{echo"<form action='' method='post'>\n";if(support("table")){echo"<fieldset><legend>".lang(269)." <span id='selected2'></span></legend><div>","<input type='search' name='query' value='".h($_POST["query"])."'>",script("qsl('input').onkeydown = partialArg(bodyKeydown, 'search');","")," <input type='submit' name='search' value='".lang(57)."'>\n","</div></fieldset>\n";if($_POST["search"]&&$_POST["query"]!=""){$_GET["where"][0]["op"]="LIKE %%";search_tables();}}echo"<div class='scrollable'>\n","<table cellspacing='0' class='nowrap checkable'>\n",script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"),'<thead><tr class="wrap">','<td><input id="check-all" type="checkbox" class="jsonly">'.script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);",""),'<th>'.lang(131),'<td>'.lang(270).doc_link(array('sql'=>'storage-engines.html')),'<td>'.lang(122).doc_link(array('sql'=>'charset-charsets.html','mariadb'=>'supported-character-sets-and-collations/')),'<td>'.lang(271).doc_link(array('sql'=>'show-table-status.html','pgsql'=>'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT','oracle'=>'REFRN20286')),'<td>'.lang(272).doc_link(array('sql'=>'show-table-status.html','pgsql'=>'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT')),'<td>'.lang(273).doc_link(array('sql'=>'show-table-status.html')),'<td>'.lang(52).doc_link(array('sql'=>'example-auto-increment.html','mariadb'=>'auto_increment/')),'<td>'.lang(274).doc_link(array('sql'=>'show-table-status.html','pgsql'=>'catalog-pg-class.html#CATALOG-PG-CLASS','oracle'=>'REFRN20286')),(support("comment")?'<td>'.lang(51).doc_link(array('sql'=>'show-table-status.html','pgsql'=>'functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE')):''),"</thead>\n";$S=0;foreach($Xh
     7049as$C=>$T){$cj=($T!==null&&!preg_match('~table~i',$T));$u=h("Table-".$C);echo'<tr'.odd().'><td>'.checkbox(($cj?"views[]":"tables[]"),$C,in_array($C,$Yh,true),"","","",$u),'<th>'.(support("table")||support("indexes")?"<a href='".h(ME)."table=".urlencode($C)."' title='".lang(43)."' id='$u'>".h($C).'</a>':h($C));if($cj){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($C).'" title="'.lang(44).'">'.(preg_match('~materialized~i',$T)?lang(129):lang(130)).'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($C).'" title="'.lang(42).'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",lang(45)),"Index_length"=>array("indexes",lang(133)),"Data_free"=>array("edit",lang(46)),"Auto_increment"=>array("auto_increment=1&create",lang(45)),"Rows"=>array("select",lang(42)),)as$z=>$A){$u=" id='$z-".h($C)."'";echo($A?"<td align='right'>".(support("table")||$z=="Rows"||(support("indexes")&&$z!="Data_length")?"<a href='".h(ME."$A[0]=").urlencode($C)."'$u title='$A[1]'>?</a>":"<span$u>?</span>"):"<td id='$z-".h($C)."'>");}$S++;}echo(support("comment")?"<td id='Comment-".h($C)."'>":"");}echo"<tr><td><th>".lang(247,count($Xh)),"<td>".h($y=="sql"?$h->result("SELECT @@storage_engine"):""),"<td>".h(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$z)echo"<td align='right' id='sum-$z'>";echo"</table>\n","</div>\n";if(!information_schema(DB)){echo"<div class='footer'><div>\n";$Wi="<input type='submit' value='".lang(275)."'> ".on_help("'VACUUM'");$yf="<input type='submit' name='optimize' value='".lang(276)."'> ".on_help($y=="sql"?"'OPTIMIZE TABLE'":"'VACUUM OPTIMIZE'");echo"<fieldset><legend>".lang(126)." <span id='selected'></span></legend><div>".($y=="sqlite"?$Wi:($y=="pgsql"?$Wi.$yf:($y=="sql"?"<input type='submit' value='".lang(277)."'> ".on_help("'ANALYZE TABLE'").$yf."<input type='submit' name='check' value='".lang(278)."'> ".on_help("'CHECK TABLE'")."<input type='submit' name='repair' value='".lang(279)."'> ".on_help("'REPAIR TABLE'"):"")))."<input type='submit' name='truncate' value='".lang(280)."'> ".on_help($y=="sqlite"?"'DELETE'":"'TRUNCATE".($y=="pgsql"?"'":" TABLE'")).confirm()."<input type='submit' name='drop' value='".lang(127)."'>".on_help("'DROP TABLE'").confirm()."\n";$l=(support("scheme")?$b->schemas():$b->databases());if(count($l)!=1&&$y!="sqlite"){$m=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".lang(281).": ",($l?html_select("target",$l,$m):'<input name="target" value="'.h($m).'" autocapitalize="off">')," <input type='submit' name='move' value='".lang(282)."'>",(support("copy")?" <input type='submit' name='copy' value='".lang(283)."'> ".checkbox("overwrite",1,$_POST["overwrite"],lang(284)):""),"\n";}echo"<input type='hidden' name='all' value=''>";echo
     7050script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^(tables|views)\[/));".(support("table")?" selectCount('selected2', formChecked(this, /^tables\[/) || $S);":"")." }"),"<input type='hidden' name='token' value='$ri'>\n","</div></fieldset>\n","</div></div>\n";}echo"</form>\n",script("tableCheck();");}echo'<p class="links"><a href="'.h(ME).'create=">'.lang(75)."</a>\n",(support("view")?'<a href="'.h(ME).'view=">'.lang(204)."</a>\n":"");if(support("routine")){echo"<h3 id='routines'>".lang(143)."</h3>\n";$Yg=routines();if($Yg){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.lang(183).'<td>'.lang(50).'<td>'.lang(221)."<td></thead>\n";odd('');foreach($Yg
     7051as$J){$C=($J["SPECIFIC_NAME"]==$J["ROUTINE_NAME"]?"":"&name=".urlencode($J["ROUTINE_NAME"]));echo'<tr'.odd().'>','<th><a href="'.h(ME.($J["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($J["SPECIFIC_NAME"]).$C).'">'.h($J["ROUTINE_NAME"]).'</a>','<td>'.h($J["ROUTINE_TYPE"]),'<td>'.h($J["DTD_IDENTIFIER"]),'<td><a href="'.h(ME.($J["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($J["SPECIFIC_NAME"]).$C).'">'.lang(136)."</a>";}echo"</table>\n";}echo'<p class="links">'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.lang(220).'</a>':'').'<a href="'.h(ME).'function=">'.lang(219)."</a>\n";}if(support("sequence")){echo"<h3 id='sequences'>".lang(285)."</h3>\n";$mh=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name");if($mh){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."</thead>\n";odd('');foreach($mh
     7052as$X)echo"<tr".odd()."><th><a href='".h(ME)."sequence=".urlencode($X)."'>".h($X)."</a>\n";echo"</table>\n";}echo"<p class='links'><a href='".h(ME)."sequence='>".lang(226)."</a>\n";}if(support("type")){echo"<h3 id='user-types'>".lang(26)."</h3>\n";$Ui=types();if($Ui){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."</thead>\n";odd('');foreach($Ui
    70547053as$X)echo"<tr".odd()."><th><a href='".h(ME)."type=".urlencode($X)."'>".h($X)."</a>\n";echo"</table>\n";}echo"<p class='links'><a href='".h(ME)."type='>".lang(230)."</a>\n";}if(support("event")){echo"<h3 id='events'>".lang(144)."</h3>\n";$K=get_rows("SHOW EVENTS");if($K){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."<td>".lang(286)."<td>".lang(210)."<td>".lang(211)."<td></thead>\n";foreach($K
    7055 as$J){echo"<tr>","<th>".h($J["Name"]),"<td>".($J["Execute at"]?lang(287)."<td>".$J["Execute at"]:lang(212)." ".$J["Interval value"]." ".$J["Interval field"]."<td>$J[Starts]"),"<td>$J[Ends]",'<td><a href="'.h(ME).'event='.urlencode($J["Name"]).'">'.lang(136).'</a>';}echo"</table>\n";$_c=$h->result("SELECT @@event_scheduler");if($_c&&$_c!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($_c)."\n";}echo'<p class="links"><a href="'.h(ME).'event=">'.lang(209)."</a>\n";}if($Vh)echo
     7054as$J){echo"<tr>","<th>".h($J["Name"]),"<td>".($J["Execute at"]?lang(287)."<td>".$J["Execute at"]:lang(212)." ".$J["Interval value"]." ".$J["Interval field"]."<td>$J[Starts]"),"<td>$J[Ends]",'<td><a href="'.h(ME).'event='.urlencode($J["Name"]).'">'.lang(136).'</a>';}echo"</table>\n";$Ac=$h->result("SELECT @@event_scheduler");if($Ac&&$Ac!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($Ac)."\n";}echo'<p class="links"><a href="'.h(ME).'event=">'.lang(209)."</a>\n";}if($Xh)echo
    70567055script("ajaxSetHtml('".js_escape(ME)."script=db');");}}}page_footer();
  • _plugins_/adminer/paquet.xml

    r116239 r118333  
    22        prefix="adminer"
    33        categorie="outil"
    4         version="4.7.2.0"
     4        version="4.7.4.0"
    55        etat="stable"
    66        compatibilite="[2.0.0;3.2.*]"
  • _plugins_/adminer/plugin.xml

    r116238 r118333  
    33        <slogan>Utiliser Adminer pour explorer la base SPIP</slogan>
    44        <auteur>Jakub Vrana ( https://www.vrana.cz ), mis en plugin par Fil</auteur>
    5         <version>4.7.2.0</version>
     5        <version>4.7.4.0</version>
    66        <etat>stable</etat>
    77        <prefix>adminer</prefix>
Note: See TracChangeset for help on using the changeset viewer.