9 `'Cۗ889 xQ\0e4QʘlPVbT4 \\W/\n`  7\"hq4ZM6T\rr\\C{h7\rx67J2.39KH,!mƆo\$.[\r&#\$ X:\rܺ3b-8SLK.-ҥ\rH@ml:;J0LR2! A 2 m0eI-:U\r9MWL0GcJv2(F9`C1HRSd9%U1Sna|.ԁ`8:#C2*[o4X~7j\\ 6/F[NY\\no56 kvqs:p8\r#Ȑ^nZ,B2)OR[I7tҔ7(W02x~];K2Va~r=(,\rj*B(R2CN\\9}a\0ŕVR4GBC(s(mm(wsnmB\\lMi#;#U=M-~h)5 pC/,в]s#CvM >6@hu`ksryS\"Ⓟ& 5u\"cu/L #DBOMctW6\"[!1`#EdnLwm٪5gAUF8ۍ\\M-7N\n:`R>KI\$䬗j!M9\"O&B̐w݃qZܫJ\"AÅ(\r_s}>̜&Hnʜ6/Cf89@Ût4Cx6fە5HP?DA\0G!tӕ'TYI+Ln]ސf(1*Z@\rRծĐgh!Cp1*2P`f!ܸ8#?A`48_ Z wN)R`75Z`*;DA* TT+#~Jp0GPHq 9]JD+eu5-ܩɨtT:*a 5Gl6&\r@*=qgiA iG#9<\"/ d a?[yO7OT5w&kgh o!] Ҟm>hu!6\$W\0ڢ`[)\r:f(\$p gse2ѻ.\rնqܝؒzhm\rRle C.j Yq.'(9paRu0'dBj7a4YkR{d,?l%%rO\$b.Իg8r׶P` <8T3k\nv88檫8e١IpH.P-#_WkE|-(2}FcBno9>;n]t^w\r=9k}]Gw8h7\$߂.`C)bVlfHp)`onɵzցe,NϜUh_]_]n[ػ삽]ǹ:>mrC36ѻ\nOjf~?,ڐ[E=DێYk-mlO.fhtcBy>tE@>");}elseif($_GET["file"]=="functions.js"){header("Content-Type: text/javascript; charset=utf-8");echo lzw_decompress("f:gCI\n:saPi2\nOgc e6Le7s)Ћ\rHGI3as'cDi6N2H8uFR#r7#v}@`Qo5aI,2O'8R-q:PS(a*w(%p-C \" XS`\\F֬h83`X:O,) 898c<#0L9 ?(R#e=\n:*0D9C@{ZO8ioVvkAr8&..cHE>H_hWU51r* ^ (bxܡY1&XH6ؓ.9xP\r.`v484daXV6FEHHfc-^=txY\r%xeQ,X=1!svjkQ2 %W? Ů=dY&ٓVX4ـ\\5Xì!}NgvڃWY*Qi&lѵZ#Ց\rA\$ev5o#ޛ5gc3MTCL>vH<`*]_;%;Vi4X'`ij0gOۥi9ƙےdFk/lŞnc\n/ l[ ŠPa8%!1v/SUcoJ:4J+BvJ\rb{,|\0zcYl\ni.!)dmJ!' B\nC\\ i\$J\"2+IkJ \$Gy\$#ܲi/CAbbC(:UX2& , Q;~/Ky9?\r6tV!6CP hYEl䏞(ؖTp'3C<dc?yCe0@&A?= %A:JD&SQ6R)Ab`0@u9(!0R\nF Š wC\\υrܙ #~2'\$ :K`h@Eb[~ Tlf5BR]{\"-\0L>\r\$@\n(&\r9\0vh*ɇ*X!_djpy`jYwJ\$R(uaM+nxspU^Ap`ͤIH\nf02)!4a9 EwC ˩ LPAi)p3Au AIAHu !g͕UZUc *Mxf :^Xp+V KC#+ WhCP! ;[pn\\%k \0,ڨ87xQC\nY\rbXvC d\nA;lF,_wr4RPHA!;&^Ͳ\"6;=#CI 9f':DY!B+sxV8lÓ\"鑃HU%\"Z6u\re0[pa. +^``b5#CM\$ I˚AP5C\r SdWN6H[ SR\\+X=kλ׺Sr^(oo7\\huklHaC(mnRBUup2C1[|ٽbeG0\"CG?\$x7n\$Z=ZӦsi5f&,fhiIyn20DvETxM{`ܤGN#遂Z,ƒ/ R\$#\\I- |0-0NP ;s-v҆nwGtndiH|4(+v&Ņ+KL\nJ\$ԩ:\\Q/F\n?mFj 3 p DHKv Ⱥɜ\0X*\rʚ\n0 e\n%\riOflNM%]UQ QL-S±T4!U5T\nndi0#EMi./U\rZF j;H☎d`mݩ\ntQS e|iQt d12,DY 1UQSUcdE)\\L F\$@V{W6\"LlTA\$6abOdrLp c,esΞ<2`@bXP\$3@˃P,KVխ^MLu1 @ct-(`\09n2sb/ Fm)Hl5@nl\$q+:/ d,\n޵. 4\$ w0\$dV0\"rW4678VtqBaupÀI<\$#x`wd9^*kuofBEp g2f4 L!r=\0 \" \r< hU%ThBk#>'Cp\n (\r2\"3lMԋ7Gx.,Uu%Dt wy^Mf\" (vU3uJ^HC_IUYkSc_ylcc]rF_q%W#]@rkv3-cyVHJG<ZT@V8\$6o2H@\rª\0=ݍ\"39z:K uK >B\$r.J*l'kophxvL`w1 !M4\"I\$\"o\$>˙Bea\"DBoʶ+ B0Pxp&7|p{|}7ְ\$-P@beVYmoMo\0Nzn*>΄)-Hl!hpg &tZ㜤\0!8 ɩZK@DZG F秩. lz%(x}'<Ū(<XZǬњ ɮgwzz{e'{;@噱(&R^Eݛx宛Y\"MܒV\n5zlzr[x˪ G\$OW@Zx, be fdƻ2EËIDYT%k{J\\\rU N '_ɽf|w޵,l7kt1RD>ЋXZЊ|y|Z{|բ\r%;#\0eZ,\rKt\r >>\$>??c?+@  @ʰcqfc+3Ș؀&x]N*|b2R_\$< \rl [*`\n~b]jB\rqˣQ꾼+(W| +ep9j}R#O:|?50Dm#\nhj !6<\r. Dr@ g9:ؗ;%7c@Q5 Rš\0o\0 D9GO8cHĆ1q@n{f1hGhG2dbc!C?RSYNZiXSשu6)X( &bp Xb*BTm1\rꬌEDRXhvOLyՐatҼpS\0aA%\\Ld@5h+VNEjKT YPo\rK)!'8gNB4>6}2S] ˶]!\0rp/0˄A`\"@EMĺ6~[Q\0/L QVg\0W-0>EZb8R!9\n M-xJpY `\"PPYq``^̪I f ˍLvUBAW\0-#|gGό3[jL]іUA=\n\$0=C\nF, -hœr\0e`D΅131\nY|{ C3<B40u/hTO;qā2BDPqBlؿEdV}\"!%8p-fӭ|l\$ 8qpHH:f[LȀ \n9٥&[GVFg.8A0%– e\"41襂)Ν21KR15K\rĉ@a\nUi` rFl8\r[RLc8eS\0( e -ݢ.\\ .f\n@xh˞T_/MZ3?7s`X ޢ#?xY<...&L1!?4ioĄQ\nTk3\"fx\n33q=AV 25)(5BњMto(6 @r6xM \rq#O&r LKttIdAP&t (~q&4\n\"/z!2㲖xD2PdMĒ&fȹ(kCz·g5gҾ#9D\rj3цSFZB`_pCG;RCC\\O\$>5:wpR-ҥR@}\nўXë,E(C:G;/R\$d\$QJXO@!ҝK|69BA8ؤztHe.hY'oB]>K(*IP}Q>J,ـH-c37>Ȱز4A@\n9҃v?5hBZ`3m&*ȸIӐ f}4Πddd&Rn<V|D\\Ԛ?-6t8\r#BLCI;O&W<> \\]0\$r1PbV#tԡ\rGY3(UT0tV @򄖪ܪȆ&7UÕkU^epom043;R7IN6uNu_8*O3IO\0 t4zRUH}efc xo TjU\riX;Wi#>\0!I:P!T7!n-jCP\\|ޏϵ >HEtUn\$Vp'Ui ;N'T2:\"x+xVnK@^қow[>̹T:ZVַ -TN)VyJUʭUFMbHEZyڻ` t0f=@\0E2IԖ0t>- \$1iZMHL2rp+|VK›dfYNA`YrL yQZ4\0001&YPY#mIMy3CYMf#S͔xRK6L fҸdK,lEk7\rvk*X\nm(-قв\nerL\"̶gQCgK5ul\$\n`hWpkˠ]C0 ͘LSrT_mBh5 ^`Q)\rDġe\"/\0A%# B&v='R&JRXֻD@XcG\"\rxJ%R\\- C\0^ 9>`||\$\$Cd<B ipE5ɹ=qZtF\r\0ux>@y9.Z'_s\0002ۊnт\rM\\@TY%g 4}VXJS4X֮IMX䵦Q)KF X mt1v!AuG]X)%~@i\$\$FD(GEt6\r(b3Tɑ MzlTQP@vI.։ 3M\rwWҀ\\]M zmґ04}OB(AK/+'j#|lͳuL;D+Q^<<MKhEնW~-x\\wվE}A_Td\\Jjy*xlF(vrP7m~F;{7%̼ª˘3aE\0q0>G%3 n魀g`*5@3ُMlX\rH\0W58▌B}Y`(W&{\n_W21atpgk\r&/Gدgq\$\\qf]1N9%\\G@ل#=|J:|[lxx!}z{~l} }W\\q\rl'_E/6Y Iĝ0?WhKf31%rmX`\0XW2#@X|. d.hiԀ\nSANEŦ07\0wQlou3%ܣp\\ |m\0Z@\0`)! Ep\0`/MWxh```y\"k<.l G< X~y' r®edhew\natT@D a.DPP\"=7!]261ڿ:xqK|qD\\^Di0:\0\0r30 tF^ٝY';QH (IZ2Դ04% p._[-m1Za|<ʆF!E ̲K&c16,]nb3}(LdV2[-\0002Fg2\rf٣16isw”]+ar:XX S-3'xˬϲiahD\rMSіG3aX5.=9f{-T9^\\ƛn)ݝ39̢{0s\\83\$:3f0\n  @\\̠ar<ώ3700\"*25e9r2\0ʻ\"GYH>  9V-L25u]wzXO;H\\ -Ƞx\$ld'!a^1h'iiG6d{ZC>>`Cro+u@ PϒP!NԯA j\".zfuza ,`+׌K]rtGMNd/vk2= 1ޅ");}else{header("Content-Type: image/gif");switch($_GET["file"]){case"plus.gif":echo"GIF87a\0\0\0\0\0\0\0\0\0\0,\0\0\0\0\0\0\0!M*)o) qe#L\0;";break;case"cross.gif":echo"GIF87a\0\0\0\0\0\0\0\0\0\0,\0\0\0\0\0\0\0##\naFo~y._wa1J GL6]\0\0;";break;case"up.gif":echo"GIF87a\0\0\0\0\0\0\0\0\0\0,\0\0\0\0\0\0\0 MQN\n}a8yaŶ\0\0;";break;case"down.gif":echo"GIF87a\0\0\0\0\0\0\0\0\0\0,\0\0\0\0\0\0\0 M*)[W\\L&ٜƶ\0\0;";break;case"arrow.gif":echo"GIF89a\0\n\0\0\0!\0\0\0,\0\0\0\0\0\n\0\0iӲ޻\0\0;";break;}}exit;}function connection(){global$i;return$i;}function adminer(){global$b;return$b;}function idf_unescape($t){$ld=substr($t,-1);return str_replace($ld.$ld,$ld,substr($t,1,-1));}function escape_string($X){return substr(q($X),1,-1);}function remove_slashes($Te,$oc=false){if(get_magic_quotes_gpc()){while(list($x,$X)=each($Te)){foreach($X as$dd=>$W){unset($Te[$x][$dd]);if(is_array($W)){$Te[$x][stripslashes($dd)]=$W;$Te[]=&$Te[$x][stripslashes($dd)];}else$Te[$x][stripslashes($dd)]=($oc?$W:stripslashes($W));}}}}function bracket_escape($t,$Ca=false){static$qg=array(':'=>':1',']'=>':2','['=>':3');return strtr($t,($Ca?array_flip($qg):$qg));}function h($O){return htmlspecialchars(str_replace("\0","",$O),ENT_QUOTES);}function nbsp($O){return(trim($O)!=""?h($O):" ");}function nl_br($O){return str_replace("\n","
",$O);}function checkbox($B,$Y,$Pa,$id="",$fe="",$cd=false){static$s=0;$s++;$I="";return($id!=""?"":$I);}function optionlist($je,$xf=null,$Jg=false){$I="";foreach($je as$dd=>$W){$ke=array($dd=>$W);if(is_array($W)){$I.='';$ke=$W;}foreach($ke as$x=>$X)$I.=''.h($X);if(is_array($W))$I.='';}return$I;}function html_select($B,$je,$Y="",$ee=true){if($ee)return"";$I="";foreach($je as$x=>$X)$I.="";return$I;}function confirm($ib=""){return" onclick=\"return confirm('".lang(0).($ib?" (' + $ib + ')":"")."');\"";}function print_fieldset($s,$qd,$Sg=false,$fe=""){echo"
$qd
\n";}function selectSearchPrint($Z,$g,$v){print_fieldset("search",lang(39),$Z);foreach($v as$r=>$u){if($u["type"]=="FULLTEXT"){echo"(".implode(", ",array_map('h',$u["columns"])).") AGAINST"," ",checkbox("boolean[$r]",1,isset($_GET["boolean"][$r]),"BOOL"),"
\n";}}$_GET["where"]=(array)$_GET["where"];reset($_GET["where"]);$Na="this.nextSibling.onchange();";for($r=0;$r<=count($_GET["where"]);$r++){list(,$X)=each($_GET["where"]);if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"
",html_select("where[$r][op]",$this->operators,$X["op"],$Na),"
\n";}}echo"\n";}function selectOrderPrint($le,$g,$v){print_fieldset("sort",lang(41),$le);$r=0;foreach((array)$_GET["order"]as$x=>$X){if(isset($g[$X])){echo"
",checkbox("desc[$r]",1,isset($_GET["desc"][$x]),lang(42))."
\n";$r++;}}echo"
","
\n";echo"\n";}function selectLimitPrint($y){echo"
".lang(43)."
";echo"","
\n";}function selectLengthPrint($fg){if($fg!==null){echo"
".lang(44)."
","","
\n";}}function selectActionPrint($v){echo"
".lang(45)."
",""," ","\n","
\n";}function selectCommandPrint(){return!information_schema(DB);}function selectImportPrint(){return!information_schema(DB);}function selectEmailPrint($Nb,$g){}function selectColumnsProcess($g,$v){global$Ac,$Fc;$L=array();$Dc=array();foreach((array)$_GET["columns"]as$x=>$X){if($X["fun"]=="count"||(isset($g[$X["col"]])&&(!$X["fun"]||in_array($X["fun"],$Ac)||in_array($X["fun"],$Fc)))){$L[$x]=apply_sql_function($X["fun"],(isset($g[$X["col"]])?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$Fc))$Dc[]=$L[$x];}}return array($L,$Dc);}function selectSearchProcess($o,$v){global$w;$I=array();foreach($v as$r=>$u){if($u["type"]=="FULLTEXT"&&$_GET["fulltext"][$r]!="")$I[]="MATCH (".implode(", ",array_map('idf_escape',$u["columns"])).") AGAINST (".q($_GET["fulltext"][$r]).(isset($_GET["boolean"][$r])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$cb=" $X[op]";if(ereg('IN$',$X["op"])){$Oc=process_length($X["val"]);$cb.=" (".($Oc!=""?$Oc:"NULL").")";}elseif($X["op"]=="SQL")$cb=" $X[val]";elseif($X["op"]=="LIKE %%")$cb=" LIKE ".$this->processInput($o[$X["col"]],"%$X[val]%");elseif(!ereg('NULL$',$X["op"]))$cb.=" ".$this->processInput($o[$X["col"]],$X["val"]);if($X["col"]!="")$I[]=idf_escape($X["col"]).$cb;else{$Xa=array();foreach($o as$B=>$n){$Zc=ereg('char|text|enum|set',$n["type"]);if((is_numeric($X["val"])||!ereg('(^|[^o])int|float|double|decimal|bit',$n["type"]))&&(!ereg("[\x80-\xFF]",$X["val"])||$Zc)){$B=idf_escape($B);$Xa[]=($w=="sql"&&$Zc&&!ereg('^utf8',$n["collation"])?"CONVERT($B USING utf8)":$B);}}$I[]=($Xa?"(".implode("$cb OR ",$Xa)."$cb)":"0");}}}return$I;}function selectOrderProcess($o,$v){$I=array();foreach((array)$_GET["order"]as$x=>$X){if(isset($o[$X])||preg_match('~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~',$X))$I[]=(isset($o[$X])?idf_escape($X):$X).(isset($_GET["desc"][$x])?" DESC":"");}return$I;}function selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"50");}function selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function selectEmailProcess($Z,$sc){return false;}function selectQueryBuild($L,$Z,$Dc,$le,$y,$D){return"";}function messageQuery($G){global$w;restart_session();$Ic=&get_session("queries");$s="sql-".count($Ic[$_GET["db"]]);if(strlen($G)>1e6)$G=ereg_replace('[\x80-\xFF]+$','',substr($G,0,1e6))."\n...";$Ic[$_GET["db"]][]=array($G,time());return" ".@date("H:i:s")." ".lang(47)."';}function editFunctions($n){global$Jb;$I=($n["null"]?"NULL/":"");foreach($Jb as$x=>$Ac){if(!$x||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($Ac as$Ee=>$X){if(!$Ee||ereg($Ee,$n["type"]))$I.="/$X";}if($x&&!ereg('set|blob|bytea|raw|file',$n["type"]))$I.="/SQL";}}return explode("/",$I);}function editInput($P,$n,$_a,$Y){if($n["type"]=="enum")return(isset($_GET["select"])?" ":"").($n["null"]?" ":"").enum_input("radio",$_a,$n,$Y,0);return"";}function processInput($n,$Y,$q=""){if($q=="SQL")return$Y;$B=$n["field"];$I=q($Y);if(ereg('^(now|getdate|uuid)$',$q))$I="$q()";elseif(ereg('^current_(date|timestamp)$',$q))$I=$q;elseif(ereg('^([+-]|\\|\\|)$',$q))$I=idf_escape($B)." $q $I";elseif(ereg('^[+-] interval$',$q))$I=idf_escape($B)." $q ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+$~i",$Y)?$Y:$I);elseif(ereg('^(addtime|subtime|concat)$',$q))$I="$q(".idf_escape($B).", $I)";elseif(ereg('^(md5|sha1|password|encrypt)$',$q))$I="$q($I)";return unconvert_field($n,$I);}function dumpOutput(){$I=array('text'=>lang(48),'file'=>lang(49));if(function_exists('gzencode'))$I['gz']='gzip';return$I;}function dumpFormat(){return array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function dumpDatabase($l){}function dumpTable($P,$Mf,$ad=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($Mf)dump_csv(array_keys(fields($P)));}elseif($Mf){if($ad==2){$o=array();foreach(fields($P)as$B=>$n)$o[]=idf_escape($B)." $n[full_type]";$jb="CREATE TABLE ".table($P)." (".implode(", ",$o).")";}else$jb=create_sql($P,$_POST["auto_increment"]);if($jb){if($Mf=="DROP+CREATE"||$ad==1)echo"DROP ".($ad==2?"VIEW":"TABLE")." IF EXISTS ".table($P).";\n";if($ad==1)$jb=remove_definer($jb);echo"$jb;\n\n";}}}function dumpData($P,$Mf,$G){global$i,$w;$_d=($w=="sqlite"?0:1048576);if($Mf){if($_POST["format"]=="sql"){if($Mf=="TRUNCATE+INSERT")echo truncate_sql($P).";\n";$o=fields($P);}$H=$i->query($G,1);if($H){$Vc="";$La="";$fd=array();$Of="";$lc=($P!=''?'fetch_assoc':'fetch_row');while($J=$H->$lc()){if(!$fd){$Ng=array();foreach($J as$X){$n=$H->fetch_field();$fd[]=$n->name;$x=idf_escape($n->name);$Ng[]="$x = VALUES($x)";}$Of=($Mf=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Ng):"").";\n";}if($_POST["format"]!="sql"){if($Mf=="table"){dump_csv($fd);$Mf="INSERT";}dump_csv($J);}else{if(!$Vc)$Vc="INSERT INTO ".table($P)." (".implode(", ",array_map('idf_escape',$fd)).") VALUES";foreach($J as$x=>$X){$n=$o[$x];$J[$x]=($X!==null?unconvert_field($n,ereg('(^|[^o])int|float|double|decimal',$n["type"])&&$X!=''?$X:q($X)):"NULL");}$sf=($_d?"\n":" ")."(".implode(",\t",$J).")";if(!$La)$La=$Vc.$sf;elseif(strlen($La)+4+strlen($sf)+strlen($Of)<$_d)$La.=",$sf";else{echo$La.$Of;$La=$Vc.$sf;}}}if($La)echo$La.$Of;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$i->error)."\n";}}function dumpFilename($Mc){return friendly_url($Mc!=""?$Mc:(SERVER!=""?SERVER:"localhost"));}function dumpHeaders($Mc,$Nd=false){$ve=$_POST["output"];$fc=(ereg('sql',$_POST["format"])?"sql":($Nd?"tar":"csv"));header("Content-Type: ".($ve=="gz"?"application/x-gzip":($fc=="tar"?"application/x-tar":($fc=="sql"||$ve!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($ve=="gz")ob_start('gzencode',1e6);return$fc;}function homepage(){echo'

'.($_GET["ns"]==""?''.lang(50)."\n":""),(support("scheme")?"".($_GET["ns"]!=""?lang(51):lang(52))."\n":""),($_GET["ns"]!==""?''.lang(53)."\n":""),(support("privileges")?"".lang(54)."\n":"");return true;}function navigation($Md){global$ia,$S,$w,$Cb;echo'

',$this->name(),' ',$ia,' ',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'

';if($Md=="auth"){$pc=true;foreach((array)$_SESSION["pwds"]as$Bb=>$Bf){foreach($Bf as$M=>$Lg){foreach($Lg as$V=>$E){if($E!==null){if($pc){echo"

\n";$pc=false;}$sb=$_SESSION["db"][$Bb][$M][$V];foreach(($sb?array_keys($sb):array(""))as$l)echo"($Cb[$Bb]) ".h($V.($M!=""?"@$M":"").($l!=""?" - $l":""))."
\n";}}}}}else{echo'

';if(DB==""||!$Md){echo"".lang(47)."\n";if(support("dump"))echo"".lang(55)."\n";}echo'

';$this->databasesPrint($Md);if($_GET["ns"]!==""&&!$Md&&DB!=""){echo'

".lang(57)."\n";$R=table_status('',true);if(!$R)echo"

".lang(7)."\n";else{$this->tablesPrint($R);$ud=array();foreach($R as$P=>$T)$ud[]=preg_quote($P,'/');echo"\n";}}}}function databasesPrint($Md){global$i;$k=$this->databases();echo'

';hidden_fields_get();echo($k?'':''),' ';if($Md!="db"&&DB!=""&&$i->select_db(DB)){if(support("scheme")){echo"
".html_select("ns",array(""=>"(".lang(59).")")+schemas(),$_GET["ns"],"this.form.submit();");if($_GET["ns"]!="")set_schema($_GET["ns"]);}}echo(isset($_GET["sql"])?'':(isset($_GET["schema"])?'':(isset($_GET["dump"])?'':""))),"

\n";}function tablesPrint($R){echo"

\n";foreach($R as$P=>$If){echo'".lang(60)." ",'".$this->tableName($If)."
\n";}}}$b=(function_exists('adminer_object')?adminer_object():new Adminer);if($b->operators===null)$b->operators=$he;function page_header($ig,$m="",$Ka=array(),$jg=""){global$ca,$b,$i,$Cb;header("Content-Type: text/html; charset=utf-8");if($b->headers()){header("X-Frame-Options: deny");header("X-XSS-Protection: 0");}$kg=$ig.($jg!=""?": ".h($jg):"");$lg=strip_tags($kg.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo' ',$lg,' ';if($b->head()){echo' ';if(file_exists("adminer.css")){echo' ';}}echo'

';if($Ka!==null){$z=substr(preg_replace('~(username|db|ns)=[^&]*&~','',ME),0,-1);echo'

$kg

\n";restart_session();$Hg=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Jd=$_SESSION["messages"][$Hg];if($Jd){echo"
".implode("
\n
",$Jd)."
\n";unset($_SESSION["messages"][$Hg]);}$k=&get_session("dbs");if(DB!=""&&$k&&!in_array(DB,$k,true))$k=null;stop_session();if($m)echo"
$m
\n";define("PAGE_HEADER",1);}function page_footer($Md=""){global$b;echo'
';switch_lang();echo' ';}function int32($Pd){while($Pd>=2147483648)$Pd-=4294967296;while($Pd<=-2147483649)$Pd+=4294967296;return(int)$Pd;}function long2str($W,$Tg){$sf='';foreach($W as$X)$sf.=pack('V',$X);if($Tg)return substr($sf,0,end($W));return$sf;}function str2long($sf,$Tg){$W=array_values(unpack('V*',str_pad($sf,4*ceil(strlen($sf)/4),"\0")));if($Tg)$W[]=strlen($sf);return$W;}function xxtea_mx($Yg,$Xg,$Pf,$dd){return int32((($Yg>>5&0x7FFFFFF)^$Xg<<2)+(($Xg>>3&0x1FFFFFFF)^$Yg<<4))^int32(($Pf^$Xg)+($dd^$Yg));}function encrypt_string($Kf,$x){if($Kf=="")return"";$x=array_values(unpack("V*",pack("H*",md5($x))));$W=str2long($Kf,true);$Pd=count($W)-1;$Yg=$W[$Pd];$Xg=$W[0];$F=floor(6+52/($Pd+1));$Pf=0;while($F-->0){$Pf=int32($Pf+0x9E3779B9);$Ib=$Pf>>2&3;for($we=0;$we<$Pd;$we++){$Xg=$W[$we+1];$Od=xxtea_mx($Yg,$Xg,$Pf,$x[$we&3^$Ib]);$Yg=int32($W[$we]+$Od);$W[$we]=$Yg;}$Xg=$W[0];$Od=xxtea_mx($Yg,$Xg,$Pf,$x[$we&3^$Ib]);$Yg=int32($W[$Pd]+$Od);$W[$Pd]=$Yg;}return long2str($W,false);}function decrypt_string($Kf,$x){if($Kf=="")return"";$x=array_values(unpack("V*",pack("H*",md5($x))));$W=str2long($Kf,false);$Pd=count($W)-1;$Yg=$W[$Pd];$Xg=$W[0];$F=floor(6+52/($Pd+1));$Pf=int32($F*0x9E3779B9);while($Pf){$Ib=$Pf>>2&3;for($we=$Pd;$we>0;$we--){$Yg=$W[$we-1];$Od=xxtea_mx($Yg,$Xg,$Pf,$x[$we&3^$Ib]);$Xg=int32($W[$we]-$Od);$W[$we]=$Xg;}$Yg=$W[$Pd];$Od=xxtea_mx($Yg,$Xg,$Pf,$x[$we&3^$Ib]);$Xg=int32($W[0]-$Od);$W[0]=$Xg;$Pf=int32($Pf-0x9E3779B9);}return long2str($W,true);}$i='';$S=$_SESSION["token"];if(!$_SESSION["token"])$_SESSION["token"]=rand(1,1e6);$Fe=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($x)=explode(":",$X);$Fe[$x]=$X;}}$d=$_POST["auth"];if($d){session_regenerate_id();$_SESSION["pwds"][$d["driver"]][$d["server"]][$d["username"]]=$d["password"];$_SESSION["db"][$d["driver"]][$d["server"]][$d["username"]][$d["db"]]=true;if($d["permanent"]){$x=base64_encode($d["driver"])."-".base64_encode($d["server"])."-".base64_encode($d["username"])."-".base64_encode($d["db"]);$Qe=$b->permanentLogin();$Fe[$x]="$x:".base64_encode($Qe?encrypt_string($d["password"],$Qe):"");cookie("adminer_permanent",implode(" ",$Fe));}if(count($_POST)==1||DRIVER!=$d["driver"]||SERVER!=$d["server"]||$_GET["username"]!==$d["username"]||DB!=$d["db"])redirect(auth_url($d["driver"],$d["server"],$d["username"],$d["db"]));}elseif($_POST["logout"]){if($S&&$_POST["token"]!=$S){page_header(lang(56),lang(62));page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$x)set_session($x,null);unset_permanent();redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~','',ME),0,-1),lang(63));}}elseif($Fe&&!$_SESSION["pwds"]){session_regenerate_id();$Qe=$b->permanentLogin();foreach($Fe as$x=>$X){list(,$Ra)=explode(":",$X);list($Bb,$M,$V,$l)=array_map('base64_decode',explode("-",$x));$_SESSION["pwds"][$Bb][$M][$V]=decrypt_string(base64_decode($Ra),$Qe);$_SESSION["db"][$Bb][$M][$V][$l]=true;}}function unset_permanent(){global$Fe;foreach($Fe as$x=>$X){list($Bb,$M,$V,$l)=array_map('base64_decode',explode("-",$x));if($Bb==DRIVER&&$M==SERVER&&$V==$_GET["username"]&&$l==DB)unset($Fe[$x]);}cookie("adminer_permanent",implode(" ",$Fe));}function auth_error($Zb=null){global$i,$b,$S;$Cf=session_name();$m="";if(!$_COOKIE[$Cf]&&$_GET[$Cf]&&ini_bool("session.use_only_cookies"))$m=lang(64);elseif(isset($_GET["username"])){if(($_COOKIE[$Cf]||$_GET[$Cf])&&!$S)$m=lang(65);else{$E=&get_session("pwds");if($E!==null){$m=h($Zb?$Zb->getMessage():(is_string($i)?$i:lang(66)));$E=null;}unset_permanent();}}page_header(lang(26),$m,null);echo"
\n";$b->loginForm();echo"
";hidden_fields($_POST,array("auth"));echo"
\n","
\n";page_footer("auth");}if(isset($_GET["username"])){if(!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);unset_permanent();page_header(lang(67),lang(68,implode(", ",$Ke)),false);page_footer("auth");exit;}$i=connect();}if(is_string($i)||!$b->login($_GET["username"],get_session("pwds"))){auth_error();exit;}$S=$_SESSION["token"];if($d&&$_POST["token"])$_POST["token"]=$S;$m='';if($_POST){if($_POST["token"]!=$S){$Sc="max_input_vars";$Dd=ini_get($Sc);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$x){$X=ini_get($x);if($X&&(!$Dd||$X<$Dd)){$Sc=$x;$Dd=$X;}}}$m=(!$_POST["token"]&&$Dd?lang(69,"'$Sc'"):lang(62));}}elseif($_SERVER["REQUEST_METHOD"]=="POST")$m=lang(70,"'post_max_size'");if(!ini_bool("session.use_cookies")||@ini_set("session.use_cookies",false)!==false){session_cache_limiter("");session_write_close();}function connect_error(){global$b,$i,$S,$m,$Cb;$k=array();if(DB!="")page_header(lang(25).": ".h(DB),lang(71),true);else{if($_POST["db"]&&!$m)queries_redirect(substr(ME,0,-1),lang(72),drop_databases($_POST["db"]));page_header(lang(73),$m,false);echo"

".lang(74)."\n";foreach(array('privileges'=>lang(54),'processlist'=>lang(75),'variables'=>lang(76),'status'=>lang(77),)as$x=>$X){if(support($x))echo"$X\n";}echo"

".lang(78,$Cb[DRIVER],"$i->server_info","$i->extension")."\n","

".lang(79,"".h(logged_user())."")."\n";$ef="".lang(80)."\n";$k=$b->databases();if($k){$vf=support("scheme");$Wa=collations();echo"

\n","\n","\n";foreach($k as$l){$nf=h(ME)."db=".urlencode($l);echo"
 ".lang(25)."".lang(81)."".lang(82)."
".checkbox("db[]",$l,in_array($l,(array)$_POST["db"])),"".h($l)."","".nbsp(db_collation($l,$Wa))."","?","\n";}echo"
\n","\n","

\n","\n",$ef,"

\n";}else echo"

$ef";}page_footer("db");if($k)echo"\n";}if(isset($_GET["status"]))$_GET["variables"]=$_GET["status"];if(!(DB!=""?$i->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"])){page_header(lang(84).": ".h($_GET["ns"]),lang(85),true);page_footer("ns");exit;}}function select($H,$j=null,$Lc="",$oe=array()){$ud=array();$v=array();$g=array();$Ia=array();$U=array();$I=array();odd('');for($r=0;$J=$H->fetch_row();$r++){if(!$r){echo"\n","";for($bd=0;$bdfetch_field();$B=$n->name;$ne=$n->orgtable;$me=$n->orgname;$I[$n->table]=$ne;if($Lc)$ud[$bd]=($B=="table"?"table=":($B=="possible_keys"?"indexes=":null));elseif($ne!=""){if(!isset($v[$ne])){$v[$ne]=array();foreach(indexes($ne,$j)as$u){if($u["type"]=="PRIMARY"){$v[$ne]=array_flip($u["columns"]);break;}}$g[$ne]=$v[$ne];}if(isset($g[$ne][$me])){unset($g[$ne][$me]);$v[$ne][$me]=$bd;$ud[$bd]=$ne;}}if($n->charsetnr==63)$Ia[$bd]=true;$U[$bd]=$n->type;$B=h($B);echo"name!=$me?" title='".h(($ne!=""?"$ne.":"").$me)."'":"").">".($Lc?"$B":$B);}echo"\n";}echo"";foreach($J as$x=>$X){if($X===null)$X="NULL";elseif($Ia[$x]&&!is_utf8($X))$X="".lang(35,strlen($X))."";elseif(!strlen($X))$X=" ";else{$X=h($X);if($U[$x]==254)$X="$X";}if(isset($ud[$x])&&!$g[$ud[$x]]){if($Lc){$P=$J[array_search("table=",$ud)];$z=$ud[$x].urlencode($oe[$P]!=""?$oe[$P]:$P);}else{$z="edit=".urlencode($ud[$x]);foreach($v[$ud[$x]]as$Ua=>$bd)$z.="&where".urlencode("[".bracket_escape($Ua)."]")."=".urlencode($J[$bd]);}$X="$X";}echo"
$X";}}echo($r?"
":"

".lang(86))."\n";return$I;}function referencable_primary($yf){$I=array();foreach(table_status('',true)as$Tf=>$P){if($Tf!=$yf&&fk_support($P)){foreach(fields($Tf)as$n){if($n["primary"]){if($I[$Tf]){unset($I[$Tf]);break;}$I[$Tf]=$n;}}}}return$I;}function textarea($B,$Y,$K=10,$Xa=80){echo"";}function edit_type($x,$n,$Wa,$tc=array()){global$Lf,$U,$Fg,$de;echo' ';echo"',($Fg?"':''),(isset($n['on_update'])?"':''),($tc?" ":" ");}function process_length($rd){global$Tb;return(preg_match("~^\\s*(?:$Tb)(?:\\s*,\\s*(?:$Tb))*\\s*\$~",$rd)&&preg_match_all("~$Tb~",$rd,$yd)?implode(",",$yd[0]):preg_replace('~[^0-9,+-]~','',$rd));}function process_type($n,$Va="COLLATE"){global$Fg;return" $n[type]".($n["length"]!=""?"(".process_length($n["length"]).")":"").(ereg('(^|[^o])int|float|double|decimal',$n["type"])&&in_array($n["unsigned"],$Fg)?" $n[unsigned]":"").(ereg('char|text|enum|set',$n["type"])&&$n["collation"]?" $Va ".q($n["collation"]):"");}function process_field($n,$yg){return array(idf_escape(trim($n["field"])),process_type($yg),($n["null"]?" NULL":" NOT NULL"),(isset($n["default"])?" DEFAULT ".((ereg("time",$n["type"])&&eregi('^CURRENT_TIMESTAMP$',$n["default"]))||($n["type"]=="bit"&&ereg("^([0-9]+|b'[0-1]+')\$",$n["default"]))?$n["default"]:q($n["default"])):""),($n["type"]=="timestamp"&&$n["on_update"]?" ON UPDATE $n[on_update]":""),(support("comment")&&$n["comment"]!=""?" COMMENT ".q($n["comment"]):""),($n["auto_increment"]?auto_increment():null),);}function type_class($T){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$x=>$X){if(ereg("$x|$X",$T))return" class='$x'";}}function edit_fields($o,$Wa,$T="TABLE",$tc=array(),$bb=false){global$i,$Tc;echo' ';if($T=="PROCEDURE"){echo' ';}echo'',($T=="TABLE"?lang(91):lang(92)),'',lang(93),' ',lang(94),'',lang(95);if($T=="TABLE"){echo'NULL AI ',lang(97),(support("comment")?"

".lang(98).": ".h($ab)."\n";if($o){echo"\n","\n";foreach($o as$n){echo"
".lang(105)."".lang(93).(support("comment")?"".lang(98):"")."
".h($n["field"]),"".h($n["full_type"]).($n["null"]?" NULL":"").($n["auto_increment"]?" ".lang(96)."":""),(isset($n["default"])?" [".h($n["default"])."]":""),(support("comment")?"".nbsp($n["comment"]):""),"\n";}echo"
\n";if(!is_view($Q)){echo"

".lang(106)."

\n";$v=indexes($a);if($v){echo"\n";foreach($v as$B=>$u){ksort($u["columns"]);$Pe=array();foreach($u["columns"]as$x=>$X)$Pe[]="".h($X)."".($u["lengths"][$x]?"(".$u["lengths"][$x].")":"");echo"
$u[type]".implode(", ",$Pe)."\n";}echo"
\n";}echo'

'.lang(107)."\n";if(fk_support($Q)){echo"

".lang(87)."

\n";$tc=foreign_keys($a);if($tc){echo"\n","\n";foreach($tc as$B=>$p){echo"","
".lang(108)."".lang(109)."".lang(90)."".lang(89).($w!="sqlite"?" ":"")."
".implode(", ",array_map('h',$p["source"]))."","".($p["db"]!=""?"".h($p["db"]).".":"").($p["ns"]!=""?"".h($p["ns"]).".":"").h($p["table"])."","(".implode(", ",array_map('h',$p["target"])).")","".nbsp($p["on_delete"])."\n","".nbsp($p["on_update"])."\n",($w=="sqlite"?"":''.lang(110).'');}echo"
\n";}if($w!="sqlite")echo'

'.lang(111)."\n";}if(support("trigger")){echo"

".lang(112)."

\n";$xg=triggers($a);if($xg){echo"\n";foreach($xg as$x=>$X)echo"
$X[0]$X[1]".h($x)."".lang(110)."\n";echo"
\n";}echo'

'.lang(113)."\n";}}}}elseif(isset($_GET["schema"])){page_header(lang(53),"",array(),DB.($_GET["ns"]?".$_GET[ns]":""));$Vf=array();$Wf=array();$B="adminer_schema";$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE[($_COOKIE["$B-".DB]?"$B-".DB:$B)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$yd,PREG_SET_ORDER);foreach($yd as$r=>$A){$Vf[$A[1]]=array($A[2],$A[3]);$Wf[]="\n\t'".js_escape($A[1])."': [ $A[2], $A[3] ]";}$og=0;$Fa=-1;$uf=array();$df=array();$pd=array();foreach(table_status('',true)as$P=>$Q){if(is_view($Q))continue;$He=0;$uf[$P]["fields"]=array();foreach(fields($P)as$B=>$n){$He+=1.25;$n["pos"]=$He;$uf[$P]["fields"][$B]=$n;}$uf[$P]["pos"]=($Vf[$P]?$Vf[$P]:array($og,0));foreach($b->foreignKeys($P)as$X){if(!$X["db"]){$nd=$Fa;if($Vf[$P][1]||$Vf[$X["table"]][1])$nd=min(floatval($Vf[$P][1]),floatval($Vf[$X["table"]][1]))-1;else$Fa-=.1;while($pd[(string)$nd])$nd-=.0001;$uf[$P]["references"][$X["table"]][(string)$nd]=array($X["source"],$X["target"]);$df[$X["table"]][$P][(string)$nd]=$X["target"];$pd[(string)$nd]=true;}}$og=max($og,$uf[$P]["pos"][0]+2.5+$He);}echo'

';foreach($uf as$B=>$P){echo"
",''.h($B)."";foreach($P["fields"]as$n){$X=''.h($n["field"]).'';echo"
".($n["primary"]?"$X":$X);}foreach((array)$P["references"]as$bg=>$ff){foreach($ff as$nd=>$af){$od=$nd-$Vf[$B][1];$r=0;foreach($af[0]as$Ef)echo"\n
";}}foreach((array)$df[$B]as$bg=>$ff){foreach($ff as$nd=>$g){$od=$nd-$Vf[$B][1];$r=0;foreach($g as$ag)echo"\n
";}}echo"\n
\n";}foreach($uf as$B=>$P){foreach((array)$P["references"]as$bg=>$ff){foreach($ff as$nd=>$af){$Ld=$og;$Bd=-10;foreach($af[0]as$x=>$Ef){$Ie=$P["pos"][0]+$P["fields"][$Ef]["pos"];$Je=$uf[$bg]["pos"][0]+$uf[$bg]["fields"][$af[1][$x]]["pos"];$Ld=min($Ld,$Ie,$Je);$Bd=max($Bd,$Ie,$Je);}echo"
\n";}}}echo'

',lang(114),' ';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$m){$hb="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$x)$hb.="&$x=".urlencode($_POST[$x]);cookie("adminer_export",substr($hb,1));$R=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$fc=dump_headers((count($R)==1?key($R):DB),(DB==""||count($R)>1));$Yc=ereg('sql',$_POST["format"]);if($Yc)echo"-- Adminer $ia ".$Cb[DRIVER]." dump ".($w!="sql"?"":"SET NAMES utf8; ".($_POST["data_style"]?"SET foreign_key_checks = 0; SET time_zone = ".q(substr(preg_replace('~^[^-]~','+\0',$i->result("SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP)")),0,6))."; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; ":"")." ");$Mf=$_POST["db_style"];$k=array(DB);if(DB==""){$k=$_POST["databases"];if(is_string($k))$k=explode("\n",rtrim(str_replace("\r","",$k),"\n"));}foreach((array)$k as$l){$b->dumpDatabase($l);if($i->select_db($l)){if($Yc&&ereg('CREATE',$Mf)&&($jb=$i->result("SHOW CREATE DATABASE ".idf_escape($l),1))){if($Mf=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($l).";\n";echo"$jb;\n";}if($Yc){if($Mf)echo use_sql($l).";\n\n";$ue="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$of){foreach(get_rows("SHOW $of STATUS WHERE Db = ".q($l),null,"-- ")as$J)$ue.=($Mf!='DROP+CREATE'?"DROP $of IF EXISTS ".idf_escape($J["Name"]).";;\n":"").remove_definer($i->result("SHOW CREATE $of ".idf_escape($J["Name"]),2)).";;\n\n";}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$J)$ue.=($Mf!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($J["Name"]).";;\n":"").remove_definer($i->result("SHOW CREATE EVENT ".idf_escape($J["Name"]),3)).";;\n\n";}if($ue)echo"DELIMITER ;;\n\n$ue"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$Rg=array();foreach(table_status('',true)as$B=>$Q){$P=(DB==""||in_array($B,(array)$_POST["tables"]));$ob=(DB==""||in_array($B,(array)$_POST["data"]));if($P||$ob){if($fc=="tar"){$mg=new TmpFile;ob_start(array($mg,'write'),1e5);}$b->dumpTable($B,($P?$_POST["table_style"]:""),(is_view($Q)?2:0));if(is_view($Q))$Rg[]=$B;elseif($ob){$o=fields($B);$b->dumpData($B,$_POST["data_style"],"SELECT *".convert_fields($o,$o)." FROM ".table($B));}if($Yc&&$_POST["triggers"]&&$P&&($xg=trigger_sql($B,$_POST["table_style"])))echo"\nDELIMITER ;;\n$xg\nDELIMITER ;\n";if($fc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$l/")."$B.csv",$mg);}elseif($Yc)echo"\n";}}foreach($Rg as$Qg)$b->dumpTable($Qg,$_POST["table_style"],1);if($fc=="tar")echo pack("x512");}}}if($Yc)echo"-- ".$i->result("SELECT NOW()")."\n";exit;}page_header(lang(115),$m,($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),DB);echo'

';$rb=array('','USE','DROP+CREATE','CREATE');$Xf=array('','DROP+CREATE','CREATE');$pb=array('','TRUNCATE+INSERT','INSERT');if($w=="sql")$pb[]='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"
".lang(116)."".html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"
".lang(117)."".html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($w=="sqlite"?"":"
".lang(25)."".html_select('db_style',$rb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(118)):"").(support("event")?checkbox("events",1,$J["events"],lang(119)):"")),"
".lang(82)."".html_select('table_style',$Xf,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(96)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(112)):""),"
".lang(120)."".html_select('data_style',$pb,$J["data_style"]),'

';$Me=array();if(DB!=""){$Pa=($a!=""?"":" checked");echo"","\n";$Rg="";$Yf=tables_list();foreach($Yf as$B=>$T){$Le=ereg_replace("_.*","",$B);$Pa=($a==""||$a==(substr($a,-1)=="%"?"$Le%":$B));$Pe="\n";$k=$b->databases();if($k){foreach($k as$l){if(!information_schema($l)){$Le=ereg_replace("_.*","",$l);echo"
","","
".checkbox("tables[]",$B,$Pa,$B,"checkboxClick(event, this); formUncheck('check-tables');");if($T!==null&&!eregi("table",$T))$Rg.="$Pe\n";else echo"$Pe\n";$Me[$Le]++;}echo$Rg;if($Yf)echo"\n";}else{echo"
".checkbox("databases[]",$l,$a==""||$a=="$Le%",$l,"formUncheck('check-databases');")."\n";$Me[$Le]++;}}}else echo"
";}echo'

';$pc=true;foreach($Me as$x=>$X){if($x!=""&&$X>1){echo($pc?"

":" ")."".h($x)."";$pc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(54));$H=$i->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$Bc=$H;if(!$H)$H=$i->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"

\n";hidden_fields_get();echo"\n",($Bc?"":"\n"),"\n","\n";while($J=$H->fetch_assoc())echo'
".lang(23)."".lang(22)." 
'.h($J["User"])."".h($J["Host"]).''.lang(34)."\n";if(!$Bc||DB!="")echo"\n";echo"
\n","

\n",'

'.lang(121)."";}elseif(isset($_GET["sql"])){if(!$m&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$Jc=&get_session("queries");$Ic=&$Jc[DB];if(!$m&&$_POST["clear"]){$Ic=array();redirect(remove_from_uri("history"));}page_header(lang(47),$m);if(!$m&&$_POST){$xc=false;$G=$_POST["query"];if($_POST["webfile"]){$xc=@fopen((file_exists("adminer.sql")?"adminer.sql":"compress.zlib://adminer.sql.gz"),"rb");$G=($xc?fread($xc,1e6):false);}elseif($_FILES&&$_FILES["sql_file"]["error"][0]!=4)$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){$F=$G.(ereg(";[ \t\r\n]*\$",$G)?"":";");if(!$Ic||reset(end($Ic))!=$F){restart_session();$Ic[]=array($F,time());set_session("queries",$Jc);stop_session();}}$Ff="(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";$vb=";";$C=0;$Pb=true;$j=connect();if(is_object($j)&&DB!="")$j->select_db(DB);$Za=0;$Vb=array();$td=0;$ze='[\'"'.($w=="sql"?'`#':($w=="sqlite"?'`[':($w=="mssql"?'[':''))).']|/\\*|-- |$'.($w=="pgsql"?'|\\$[^$]*\\$':'');$pg=microtime();parse_str($_COOKIE["adminer_export"],$qa);$Hb=$b->dumpFormat();unset($Hb["sql"]);while($G!=""){if(!$C&&preg_match("~^$Ff*DELIMITER\\s+(\\S+)~i",$G,$A)){$vb=$A[1];$G=substr($G,strlen($A[0]));}else{preg_match('('.preg_quote($vb)."\\s*|$ze)",$G,$A,PREG_OFFSET_CAPTURE,$C);list($vc,$He)=$A[0];if(!$vc&&$xc&&!feof($xc))$G.=fread($xc,1e5);else{if(!$vc&&rtrim($G)=="")break;$C=$He+strlen($vc);if($vc&&rtrim($vc)!=$vb){while(preg_match('('.($vc=='/*'?'\\*/':($vc=='['?']':(ereg('^-- |^#',$vc)?"\n":preg_quote($vc)."|\\\\."))).'|$)s',$G,$A,PREG_OFFSET_CAPTURE,$C)){$sf=$A[0][0];if(!$sf&&$xc&&!feof($xc))$G.=fread($xc,1e5);else{$C=$A[0][1]+strlen($sf);if($sf[0]!="\\")break;}}}else{$Pb=false;$F=substr($G,0,$He);$Za++;$Pe="

".shorten_utf8(trim($F),1000)."
\n";if(!$_POST["only_errors"]){echo$Pe;ob_flush();flush();}$Hf=microtime();if($i->multi_query($F)&&is_object($j)&&preg_match("~^$Ff*USE\\b~isU",$F))$j->query($F);do{$H=$i->store_result();$Qb=microtime();$gg=" (".format_time($Hf,$Qb).")".(strlen($F)<1000?" ".lang(34)."":"");if($i->error){echo($_POST["only_errors"]?$Pe:""),"

".lang(122).($i->errno?" ($i->errno)":"").": ".error()."\n";$Vb[]=" $Za";if($_POST["error_stops"])break 2;}elseif(is_object($H)){$oe=select($H,$j);if(!$_POST["only_errors"]){echo"

\n","

".($H->num_rows?lang(123,$H->num_rows):"").$gg;$s="export-$Za";$ec=", ".lang(115)."\n";if($j&&preg_match("~^($Ff|\\()*SELECT\\b~isU",$F)&&($dc=explain($j,$F))){$s="explain-$Za";echo", EXPLAIN$ec","

\n";}else echo$ec;echo"
\n";}}else{if(preg_match("~^$Ff*(CREATE|DROP|ALTER)$Ff+(DATABASE|SCHEMA)\\b~isU",$F)){restart_session();set_session("dbs",null);stop_session();}if(!$_POST["only_errors"])echo"

".lang(124,$i->affected_rows)."$gg\n";}$Hf=$Qb;}while($i->next_result());$td+=substr_count($F.$vc,"\n");$G=substr($G,$C);$C=0;}}}}if($Pb)echo"

".lang(125)."\n";elseif($_POST["only_errors"]){echo"

".lang(126,$Za-count($Vb))," (".format_time($pg,microtime()).")\n";}elseif($Vb&&$Za>1)echo"

".lang(122).": ".implode("",$Vb)."\n";}else echo"

".upload_error($G)."\n";}echo'

';$F=$_GET["sql"];if($_POST)$F=$_POST["query"];elseif($_GET["history"]=="all")$F=$Ic;elseif($_GET["history"]!="")$F=$Ic[$_GET["history"]][0];textarea("query",$F,20);echo($_POST?"":"\n"),"

".(ini_bool("file_uploads")?lang(127).': (< '.ini_get("upload_max_filesize").'B)':lang(128)),'

',checkbox("error_stops",1,$_POST["error_stops"],lang(129))."\n",checkbox("only_errors",1,$_POST["only_errors"],lang(130))."\n";print_fieldset("webfile",lang(131),$_POST["webfile"],"document.getElementById('form')['only_errors'].checked = true; ");echo lang(132,"adminer.sql".(extension_loaded("zlib")?"[.gz]":"").""),' ',"\n";if($Ic){print_fieldset("history",lang(134),$_GET["history"]!="");for($X=end($Ic);$X;$X=prev($Ic)){$x=key($Ic);list($F,$gg)=$X;echo''.lang(34)." ".@date("H:i:s",$gg)." ".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$F)))),80,"")."
\n";}echo"\n","".lang(136)."\n","\n";}echo'

';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$o=fields($a);$Z=(isset($_GET["select"])?(count($_POST["check"])==1?where_check($_POST["check"][0],$o):""):where($_GET,$o));$Gg=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($o as$B=>$n){if(!isset($n["privileges"][$Gg?"update":"insert"])||$b->fieldName($n)=="")unset($o[$B]);}if($_POST&&!$m&&!isset($_GET["select"])){$_=$_POST["referer"];if($_POST["insert"])$_=($Gg?null:$_SERVER["REQUEST_URI"]);elseif(!ereg('^.+&select=.+$',$_))$_=ME."select=".urlencode($a);$v=indexes($a);$Bg=unique_array($_GET["where"],$v);$Xe="\nWHERE $Z";if(isset($_POST["delete"])){$G="FROM ".table($a);query_redirect("DELETE".($Bg?" $G$Xe":limit1($G,$Xe)),$_,lang(137));}else{$N=array();foreach($o as$B=>$n){$X=process_input($n);if($X!==false&&$X!==null)$N[idf_escape($B)]=($Gg?"\n".idf_escape($B)." = $X":$X);}if($Gg){if(!$N)redirect($_);$G=table($a)." SET".implode(",",$N);query_redirect("UPDATE".($Bg?" $G$Xe":limit1($G,$Xe)),$_,lang(138));}else{$H=insert_into($a,$N);$md=($H?last_id():0);queries_redirect($_,lang(139,($md?" $md":"")),$H);}}}$Tf=$b->tableName(table_status($a,true));page_header(($Gg?lang(34):lang(140)),$m,array("select"=>array($a,$Tf)),$Tf);$J=null;if($_POST["save"])$J=(array)$_POST["fields"];elseif($Z){$L=array();foreach($o as$B=>$n){if(isset($n["privileges"]["select"])){$ya=convert_field($n);if($_POST["clone"]&&$n["auto_increment"])$ya="''";if($w=="sql"&&ereg("enum|set",$n["type"]))$ya="1*".idf_escape($B);$L[]=($ya?"$ya AS ":"").idf_escape($B);}}$J=array();if($L){$K=get_rows("SELECT".limit(implode(", ",$L)." FROM ".table($a)," WHERE $Z",(isset($_GET["select"])?2:1)));$J=(isset($_GET["select"])&&count($K)!=1?null:reset($K));}}if($J===false)echo"

".lang(86)."\n";echo'

';if(!$o)echo"

".lang(141)."\n";else{echo"\n";foreach($o as$B=>$n){echo"
".$b->fieldName($n);$ub=$_GET["set"][bracket_escape($B)];if($ub===null){$ub=$n["default"];if($n["type"]=="bit"&&ereg("^b'([01]*)'\$",$ub,$gf))$ub=$gf[1];}$Y=($J!==null?($J[$B]!=""&&$w=="sql"&&ereg("enum|set",$n["type"])?(is_array($J[$B])?array_sum($J[$B]):+$J[$B]):$J[$B]):(!$Gg&&$n["auto_increment"]?"":(isset($_GET["select"])?false:$ub)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$n);$q=($_POST["save"]?(string)$_POST["function"][$B]:($Gg&&$n["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(ereg("time",$n["type"])&&$Y=="CURRENT_TIMESTAMP"){$Y="";$q="now";}input($n,$Y,$q);echo"\n";}echo"
\n";}echo'

';if($o){echo"\n";if(!isset($_GET["select"]))echo"\n";}echo($Gg?"\n":($_POST||!$o?"":"\n"));if(isset($_GET["select"]))hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo'

';}elseif(isset($_GET["create"])){$a=$_GET["create"];$_e=array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST');$cf=referencable_primary($a);$tc=array();foreach($cf as$Tf=>$n)$tc[str_replace("`","``",$Tf)."`".str_replace("`","``",$n["field"])]=$Tf;$re=array();$se=array();if($a!=""){$re=fields($a);$se=table_status($a);}$J=$_POST;$J["fields"]=(array)$J["fields"];if($J["auto_increment_col"])$J["fields"][$J["auto_increment_col"]]["auto_increment"]=true;if($_POST&&!process_fields($J["fields"])&&!$m){if($_POST["drop"])query_redirect("DROP TABLE ".table($a),substr(ME,0,-1),lang(146));else{$o=array();$wa=array();$Ig=false;$rc=array();ksort($J["fields"]);$qe=reset($re);$ua=" FIRST";foreach($J["fields"]as$x=>$n){$p=$tc[$n["type"]];$yg=($p!==null?$cf[$p]:$n);if($n["field"]!=""){if(!$n["has_default"])$n["default"]=null;if($x==$J["auto_increment_col"])$n["auto_increment"]=true;$Ue=process_field($n,$yg);$wa[]=array($n["orig"],$Ue,$ua);if($Ue!=process_field($qe,$qe)){$o[]=array($n["orig"],$Ue,$ua);if($n["orig"]!=""||$ua)$Ig=true;}if($p!==null)$rc[idf_escape($n["field"])]=($a!=""&&$w!="sqlite"?"ADD":" ")." FOREIGN KEY (".idf_escape($n["field"]).") REFERENCES ".table($tc[$n["type"]])." (".idf_escape($yg["field"]).")".(ereg("^($de)\$",$n["on_delete"])?" ON DELETE $n[on_delete]":"");$ua=" AFTER ".idf_escape($n["field"]);}elseif($n["orig"]!=""){$Ig=true;$o[]=array($n["orig"]);}if($n["orig"]!=""){$qe=next($re);if(!$qe)$ua="";}}$Be="";if(in_array($J["partition_by"],$_e)){$Ce=array();if($J["partition_by"]=='RANGE'||$J["partition_by"]=='LIST'){foreach(array_filter($J["partition_names"])as$x=>$X){$Y=$J["partition_values"][$x];$Ce[]="\n PARTITION ".idf_escape($X)." VALUES ".($J["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Be.="\nPARTITION BY $J[partition_by]($J[partition])".($Ce?" (".implode(",",$Ce)."\n)":($J["partitions"]?" PARTITIONS ".(+$J["partitions"]):""));}elseif(support("partitioning")&&ereg("partitioned",$se["Create_options"]))$Be.="\nREMOVE PARTITIONING";$Fd=lang(147);if($a==""){cookie("adminer_engine",$J["Engine"]);$Fd=lang(148);}$B=trim($J["name"]);queries_redirect(ME."table=".urlencode($B),$Fd,alter_table($a,$B,($w=="sqlite"&&($Ig||$rc)?$wa:$o),$rc,$J["Comment"],($J["Engine"]&&$J["Engine"]!=$se["Engine"]?$J["Engine"]:""),($J["Collation"]&&$J["Collation"]!=$se["Collation"]?$J["Collation"]:""),($J["Auto_increment"]!=""?+$J["Auto_increment"]:""),$Be));}}page_header(($a!=""?lang(31):lang(149)),$m,array("table"=>$a),$a);if(!$_POST){$J=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($U["int"])?"int":(isset($U["integer"])?"integer":"")))),"partition_names"=>array(""),);if($a!=""){$J=$se;$J["name"]=$a;$J["fields"]=array();if(!$_GET["auto_increment"])$J["Auto_increment"]="";foreach($re as$n){$n["has_default"]=isset($n["default"]);$J["fields"][]=$n;}if(support("partitioning")){$yc="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$H=$i->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $yc ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($J["partition_by"],$J["partitions"],$J["partition"])=$H->fetch_row();$Ce=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $yc AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$Ce[""]="";$J["partition_names"]=array_keys($Ce);$J["partition_values"]=array_values($Ce);}}}$Wa=collations();$Sb=engines();foreach($Sb as$Rb){if(!strcasecmp($Rb,$J["Engine"])){$J["Engine"]=$Rb;break;}}echo'

',lang(150),': ';if($a==""&&!$_POST){?>"(".lang(151).")")+$Sb,$J["Engine"]):""),' ',($Wa&&!ereg("sqlite|mssql",$w)?html_select("Collation",array(""=>"(".lang(88).")")+$Wa,$J["Collation"]):""),' ';$bb=($_POST?$_POST["comments"]:$J["Comment"]!="");if(!$_POST&&!$bb){foreach($J["fields"]as$n){if($n["comment"]!=""){$bb=true;break;}}}edit_fields($J["fields"],$Wa,"TABLE",$tc,$bb);echo'

',lang(96),': ';if(!$_POST["defaults"]){echo'';}echo(support("comment")?checkbox("comments",1,$bb,lang(98),"columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();",true).' ':''),'

';if($_GET["create"]!=""){echo'';}if(support("partitioning")){$Ae=ereg('RANGE|LIST',$J["partition_by"]);print_fieldset("partition",lang(152),$J["partition_by"]);echo'

',html_select("partition_by",array(-1=>"")+$_e,$J["partition_by"],"partitionByChange(this);"),'() ',lang(153),': ';foreach($J["partition_names"]as$x=>$X){echo'',' ';}echo'

';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Pc=array("PRIMARY","UNIQUE","INDEX");$Q=table_status($a,true);if(eregi("MyISAM|M?aria".($i->server_info>=5.6?"|InnoDB":""),$Q["Engine"]))$Pc[]="FULLTEXT";$v=indexes($a);if($w=="sqlite"){unset($Pc[0]);unset($v[""]);}$J=$_POST;if($_POST&&!$m&&!$_POST["add"]){$c=array();foreach($J["indexes"]as$u){$B=$u["name"];if(in_array($u["type"],$Pc)){$g=array();$sd=array();$N=array();ksort($u["columns"]);foreach($u["columns"]as$x=>$f){if($f!=""){$rd=$u["lengths"][$x];$N[]=idf_escape($f).($rd?"(".(+$rd).")":"");$g[]=$f;$sd[]=($rd?$rd:null);}}if($g){$cc=$v[$B];if($cc){ksort($cc["columns"]);ksort($cc["lengths"]);if($u["type"]==$cc["type"]&&array_values($cc["columns"])===$g&&(!$cc["lengths"]||array_values($cc["lengths"])===$sd)){unset($v[$B]);continue;}}$c[]=array($u["type"],$B,"(".implode(", ",$N).")");}}}foreach($v as$B=>$cc)$c[]=array($cc["type"],$B,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(156),alter_indexes($a,$c));}page_header(lang(106),$m,array("table"=>$a),$a);$o=array_keys(fields($a));if($_POST["add"]){foreach($J["indexes"]as$x=>$u){if($u["columns"][count($u["columns"])]!="")$J["indexes"][$x]["columns"][]="";}$u=end($J["indexes"]);if($u["type"]||array_filter($u["columns"],'strlen')||array_filter($u["lengths"],'strlen'))$J["indexes"][]=array("columns"=>array(1=>""));}if(!$J){foreach($v as$x=>$u){$v[$x]["name"]=$x;$v[$x]["columns"][]="";}$v[]=array("columns"=>array(1=>""));$J["indexes"]=$v;}echo'
';$bd=1;foreach($J["indexes"]as$u){echo"
',lang(157),'',lang(158),'',lang(159),'
".html_select("indexes[$bd][type]",array(-1=>"")+$Pc,$u["type"],($bd==count($J["indexes"])?"indexesAddRow(this);":1))."";ksort($u["columns"]);$r=1;foreach($u["columns"]as$x=>$f){echo"".html_select("indexes[$bd][columns][$r]",array(-1=>"")+$o,$f,($r==count($u["columns"])?"indexesAddColumn":"indexesChangeColumn")."(this, '".js_escape($w=="sql"?"":$_GET["indexes"]."_")."');")," ";$r++;}echo"\n";$bd++;}echo'

';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$m&&!isset($_POST["add_x"])){restart_session();$B=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(160),drop_databases(array(DB)));}elseif(DB!==$B){if(DB!=""){$_GET["db"]=$B;queries_redirect(preg_replace('~db=[^&]*&~','',ME)."db=".urlencode($B),lang(161),rename_database($B,$J["collation"]));}else{$k=explode("\n",str_replace("\r","",$B));$Nf=true;$ld="";foreach($k as$l){if(count($k)==1||$l!=""){if(!create_database($l,$J["collation"]))$Nf=false;$ld=$l;}}queries_redirect(ME."db=".urlencode($ld),lang(162),$Nf);}}else{if(!$J["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($B).(eregi('^[a-z0-9_]+$',$J["collation"])?" COLLATE $J[collation]":""),substr(ME,0,-1),lang(163));}}page_header(DB!=""?lang(50):lang(164),$m,array(),DB);$Wa=collations();$B=DB;if($_POST)$B=$J["name"];elseif(DB!="")$J["collation"]=db_collation(DB,$Wa);elseif($w=="sql"){foreach(get_vals("SHOW GRANTS")as$Bc){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~',$Bc,$A)&&$A[1]){$B=stripcslashes(idf_unescape("`$A[2]`"));break;}}}echo'

',($_POST["add_x"]||strpos($B,"\n")?'
':'')."\n".($Wa?html_select("collation",array(""=>"(".lang(88).")")+$Wa,$J["collation"]):"");?> ';if(DB!="")echo"\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"\n";echo'

';}elseif(isset($_GET["scheme"])){$J=$_POST;if($_POST&&!$m){$z=preg_replace('~ns=[^&]*&~','',ME)."ns=";if($_POST["drop"])query_redirect("DROP SCHEMA ".idf_escape($_GET["ns"]),$z,lang(165));else{$B=trim($J["name"]);$z.=urlencode($B);if($_GET["ns"]=="")query_redirect("CREATE SCHEMA ".idf_escape($B),$z,lang(166));elseif($_GET["ns"]!=$B)query_redirect("ALTER SCHEMA ".idf_escape($_GET["ns"])." RENAME TO ".idf_escape($B),$z,lang(167));else redirect($z);}}page_header($_GET["ns"]!=""?lang(51):lang(52),$m);if(!$J)$J["name"]=$_GET["ns"];echo'

" autocapitalize="off"> ';if($_GET["ns"]!="")echo"\n";echo'

';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header(lang(168).": ".h($da),$m);$of=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Oc=array();$ue=array();foreach($of["fields"]as$r=>$n){if(substr($n["inout"],-3)=="OUT")$ue[$r]="@".idf_escape($n["field"])." AS ".idf_escape($n["field"]);if(!$n["inout"]||substr($n["inout"],0,2)=="IN")$Oc[]=$r;}if(!$m&&$_POST){$Ma=array();foreach($of["fields"]as$x=>$n){if(in_array($x,$Oc)){$X=process_input($n);if($X===false)$X="''";if(isset($ue[$x]))$i->query("SET @".idf_escape($n["field"])." = $X");}$Ma[]=(isset($ue[$x])?"@".idf_escape($n["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".idf_escape($da)."(".implode(", ",$Ma).")";echo"

".h($G)." ".lang(34)."\n";if(!$i->multi_query($G))echo"

".error()."\n";else{$j=connect();if(is_object($j))$j->select_db(DB);do{$H=$i->store_result();if(is_object($H))select($H,$j);else echo"

".lang(169,$i->affected_rows)."\n";}while($i->next_result());if($ue)select($i->query("SELECT ".implode(", ",$ue)));}}echo'

';if($Oc){echo"\n";foreach($Oc as$x){$n=$of["fields"][$x];$B=$n["field"];echo"
".$b->fieldName($n);$Y=$_POST["fields"][$B];if($Y!=""){if($n["type"]=="enum")$Y=+$Y;if($n["type"]=="set")$Y=array_sum($Y);}input($n,$Y,(string)$_POST["function"][$B]);echo"\n";}echo"
\n";}echo'

';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$B=$_GET["name"];$J=$_POST;if($_POST&&!$m&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){if($_POST["drop"])query_redirect("ALTER TABLE ".table($a)."\nDROP ".($w=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($B),ME."table=".urlencode($a),lang(170));else{$Ef=array_filter($J["source"],'strlen');ksort($Ef);$ag=array();foreach($Ef as$x=>$X)$ag[$x]=$J["target"][$x];query_redirect("ALTER TABLE ".table($a).($B!=""?"\nDROP ".($w=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($B).",":"")."\nADD FOREIGN KEY (".implode(", ",array_map('idf_escape',$Ef)).") REFERENCES ".table($J["table"])." (".implode(", ",array_map('idf_escape',$ag)).")".(ereg("^($de)\$",$J["on_delete"])?" ON DELETE $J[on_delete]":"").(ereg("^($de)\$",$J["on_update"])?" ON UPDATE $J[on_update]":""),ME."table=".urlencode($a),($B!=""?lang(171):lang(172)));$m=lang(173)."
$m";}}page_header(lang(174),$m,array("table"=>$a),$a);if($_POST){ksort($J["source"]);if($_POST["add"])$J["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$J["target"]=array();}elseif($B!=""){$tc=foreign_keys($a);$J=$tc[$B];$J["source"][]="";}else{$J["table"]=$a;$J["source"]=array("");}$Ef=array_keys(fields($a));$ag=($a===$J["table"]?$Ef:array_keys(fields($J["table"])));$bf=array_keys(array_filter(table_status('',true),'fk_support'));echo'

';if($J["db"]==""&&$J["ns"]==""){echo lang(175),': ',html_select("table",$bf,$J["table"],"this.form['change-js'].value = '1'; this.form.submit();"),'

';$bd=0;foreach($J["source"]as$x=>$X){echo"","
',lang(108),'',lang(109),'
".html_select("source[".(+$x)."]",array(-1=>"")+$Ef,$X,($bd==count($J["source"])-1?"foreignAddRow(this);":1)),"".html_select("target[".(+$x)."]",$ag,$J["target"][$x]);$bd++;}echo'

',lang(90),': ',html_select("on_delete",array(-1=>"")+explode("|",$de),$J["on_delete"]),' ',lang(89),': ',html_select("on_update",array(-1=>"")+explode("|",$de),$J["on_update"]),'

';}if($B!=""){echo'';}echo'

';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;if($_POST&&!$m){$B=trim($J["name"]);$ya=" AS\n$J[select]";$_=ME."table=".urlencode($B);$Fd=lang(178);if(!$_POST["drop"]&&$a==$B&&$w!="sqlite")query_redirect(($w=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($B).$ya,$_,$Fd);else{$cg=$B."_adminer_".uniqid();drop_create("DROP VIEW ".table($a),"CREATE VIEW ".table($B).$ya,"DROP VIEW ".table($B),"CREATE VIEW ".table($cg).$ya,"DROP VIEW ".table($cg),($_POST["drop"]?substr(ME,0,-1):$_),lang(179),$Fd,lang(180),$a,$B);}}page_header(($a!=""?lang(30):lang(181)),$m,array("table"=>$a),$a);if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;}echo'

',lang(159),':

';textarea("select",$J["select"]);echo'

';if($_GET["view"]!=""){echo'';}echo'

';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Wc=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Jf=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$m){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(182));elseif(in_array($J["INTERVAL_FIELD"],$Wc)&&isset($Jf[$J["STATUS"]])){$tf="\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(183):lang(184)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$tf.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$tf)."\n".$Jf[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(185).": ".h($aa):lang(186)),$m);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'
',lang(159),'
',lang(187),'
',lang(188),'
',lang(189),' ',html_select("INTERVAL_FIELD",$Wc,$J["INTERVAL_FIELD"]),'
',lang(77),'',html_select("STATUS",$Jf,$J["STATUS"]),'
',lang(98),'
 ',checkbox("ON_COMPLETION","PRESERVE",$J["ON_COMPLETION"]=="PRESERVE",lang(190)),'

';textarea("EVENT_DEFINITION",$J["EVENT_DEFINITION"]);echo'

';if($aa!=""){echo'';}echo'

';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$of=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$m){$cg="$J[name]_adminer_".uniqid();drop_create("DROP $of ".idf_escape($da),create_routine($of,$J),"DROP $of ".idf_escape($J["name"]),create_routine($of,array("name"=>$cg)+$J),"DROP $of ".idf_escape($cg),substr(ME,0,-1),lang(191),lang(192),lang(193),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(194):lang(195)).": ".h($da):(isset($_GET["function"])?lang(196):lang(197))),$m);if(!$_POST&&$da!=""){$J=routine($da,$of);$J["name"]=$da;}$Wa=get_vals("SHOW CHARACTER SET");sort($Wa);$pf=routine_languages();echo'

',lang(159),': ',($pf?lang(9).": ".html_select("language",$pf,$J["language"]):""),' ';edit_fields($J["fields"],$Wa,$of);if(isset($_GET["function"])){echo"
".lang(198);edit_type("returns",$J["returns"],$Wa);}echo'

';textarea("definition",$J["definition"]);echo'

';if($da!=""){echo'';}echo'

';}elseif(isset($_GET["sequence"])){$fa=$_GET["sequence"];$J=$_POST;if($_POST&&!$m){$z=substr(ME,0,-1);$B=trim($J["name"]);if($_POST["drop"])query_redirect("DROP SEQUENCE ".idf_escape($fa),$z,lang(199));elseif($fa=="")query_redirect("CREATE SEQUENCE ".idf_escape($B),$z,lang(200));elseif($fa!=$B)query_redirect("ALTER SEQUENCE ".idf_escape($fa)." RENAME TO ".idf_escape($B),$z,lang(201));else redirect($z);}page_header($fa!=""?lang(202).": ".h($fa):lang(203),$m);if(!$J)$J["name"]=$fa;echo'

';if($fa!="")echo"\n";echo'

';}elseif(isset($_GET["type"])){$ga=$_GET["type"];$J=$_POST;if($_POST&&!$m){$z=substr(ME,0,-1);if($_POST["drop"])query_redirect("DROP TYPE ".idf_escape($ga),$z,lang(204));else query_redirect("CREATE TYPE ".idf_escape(trim($J["name"]))." $J[as]",$z,lang(205));}page_header($ga!=""?lang(206).": ".h($ga):lang(207),$m);if(!$J)$J["as"]="AS ";echo'

';if($ga!="")echo"\n";else{echo"\n";textarea("as",$J["as"]);echo"

\n";}echo'

';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$B=$_GET["name"];$wg=trigger_options();$ug=array("INSERT","UPDATE","DELETE");$J=(array)trigger($B)+array("Trigger"=>$a."_bi");if($_POST){if(!$m&&in_array($_POST["Timing"],$wg["Timing"])&&in_array($_POST["Event"],$ug)&&in_array($_POST["Type"],$wg["Type"])){$ce=" ON ".table($a);$Db="DROP TRIGGER ".idf_escape($B).($w=="pgsql"?$ce:"");$_=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($Db,$_,lang(208));else{if($B!="")queries($Db);queries_redirect($_,($B!=""?lang(209):lang(210)),queries(create_trigger($ce,$_POST)));if($B!="")queries(create_trigger($ce,$J+array("Type"=>reset($wg["Type"]))));}}$J=$_POST;}page_header(($B!=""?lang(211).": ".h($B):lang(212)),$m,array("table"=>$a));echo'
',lang(213),'',html_select("Timing",$wg["Timing"],$J["Timing"],"if (/^".preg_quote($a,"/")."_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '".js_escape($a)."_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"),'
',lang(214),'',html_select("Event",$ug,$J["Event"],"this.form['Timing'].onchange();"),'
',lang(93),'',html_select("Type",$wg["Type"],$J["Type"]),'

',lang(159),':

';textarea("Statement",$J["Statement"]);echo'

';if($B!=""){echo'';}echo'

';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$Se=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$gb)$Se[$gb][$J["Privilege"]]=$J["Comment"];}$Se["Server Admin"]+=$Se["File access on server"];$Se["Databases"]["Create routine"]=$Se["Procedures"]["Create routine"];unset($Se["Procedures"]["Create routine"]);$Se["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$Se["Columns"][$X]=$Se["Tables"][$X];unset($Se["Server Admin"]["Usage"]);foreach($Se["Tables"]as$x=>$X)unset($Se["Databases"][$x]);$Rd=array();if($_POST){foreach($_POST["objects"]as$x=>$X)$Rd[$X]=(array)$Rd[$X]+(array)$_POST["grants"][$x];}$Cc=array();$ae="";if(isset($_GET["host"])&&($H=$i->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$J[0],$A)&&preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$A[1],$yd,PREG_SET_ORDER)){foreach($yd as$X){if($X[1]!="USAGE")$Cc["$A[2]$X[2]"][$X[1]]=true;if(ereg(' WITH GRANT OPTION',$J[0]))$Cc["$A[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$J[0],$A))$ae=$A[1];}}if($_POST&&!$m){$be=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $be",ME."privileges=",lang(215));else{$Td=q($_POST["user"])."@".q($_POST["host"]);$De=$_POST["pass"];if($De!=''&&!$_POST["hashed"]){$De=$i->result("SELECT PASSWORD(".q($De).")");$m=!$De;}$lb=false;if(!$m){if($be!=$Td){$lb=queries(($i->server_info<5?"GRANT USAGE ON *.* TO":"CREATE USER")." $Td IDENTIFIED BY PASSWORD ".q($De));$m=!$lb;}elseif($De!=$ae)queries("SET PASSWORD FOR $Td = ".q($De));}if(!$m){$lf=array();foreach($Rd as$Wd=>$Bc){if(isset($_GET["grant"]))$Bc=array_filter($Bc);$Bc=array_keys($Bc);if(isset($_GET["grant"]))$lf=array_diff(array_keys(array_filter($Rd[$Wd],'strlen')),$Bc);elseif($be==$Td){$Yd=array_keys((array)$Cc[$Wd]);$lf=array_diff($Yd,$Bc);$Bc=array_diff($Bc,$Yd);unset($Cc[$Wd]);}if(preg_match('~^(.+)\\s*(\\(.*\\))?$~U',$Wd,$A)&&(!grant("REVOKE",$lf,$A[2]," ON $A[1] FROM $Td")||!grant("GRANT",$Bc,$A[2]," ON $A[1] TO $Td"))){$m=true;break;}}}if(!$m&&isset($_GET["host"])){if($be!=$Td)queries("DROP USER $be");elseif(!isset($_GET["grant"])){foreach($Cc as$Wd=>$lf){if(preg_match('~^(.+)(\\(.*\\))?$~U',$Wd,$A))grant("REVOKE",array_keys($lf),$A[2]," ON $A[1] FROM $Td");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(216):lang(217)),!$m);if($lb)$i->query("DROP USER $Td");}}page_header((isset($_GET["host"])?lang(23).": ".h("$ha@$_GET[host]"):lang(121)),$m,array("privileges"=>array('',lang(54))));if($_POST){$J=$_POST;$Cc=$Rd;}else{$J=$_GET+array("host"=>$i->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$J["pass"]=$ae;if($ae!="")$J["hashed"]=true;$Cc[(DB==""||$Cc?"":idf_escape(addcslashes(DB,"%_\\"))).".*"]=array();}echo'
',lang(22),'
',lang(23),'
',lang(24),' ';if(!$J["hashed"]){echo'';}echo checkbox("hashed",1,$J["hashed"],lang(218),"typePassword(this.form['pass'], this.checked);"),'
';echo"\n","\n";foreach(array(""=>"","Server Admin"=>lang(22),"Databases"=>lang(25),"Tables"=>lang(104),"Columns"=>lang(105),"Procedures"=>lang(219),)as$gb=>$wb){foreach((array)$Se[$gb]as$Re=>$ab){echo"$wb'.h($Re);$r=0;foreach($Cc as$Wd=>$Bc){$B="'grants[$r][".h(strtoupper($Re))."]'";$Y=$Bc[strtoupper($Re)];if($gb=="Server Admin"&&$Wd!=(isset($Cc["*.*"])?"*.*":".*"))echo"
".lang(54)."";$r=0;foreach($Cc as$Wd=>$Bc){echo''.($Wd!="*.*"?"":"*.*");$r++;}echo"
 ";elseif(isset($_GET["grant"]))echo"";else echo"";$r++;}}}echo"
\n",'

';if(isset($_GET["host"])){echo'';}echo'

';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$m){$hd=0;foreach((array)$_POST["kill"]as$X){if(queries("KILL ".(+$X)))$hd++;}queries_redirect(ME."processlist=",lang(222,$hd),$hd||!$_POST["kill"]);}page_header(lang(75),$m);echo'
';$r=-1;foreach(process_list()as$r=>$J){if(!$r){echo"".(support("kill")?"\n";}echo"".(support("kill")?"
 ":"");foreach($J as$x=>$X)echo"".($w=="sql"?"$x":$x);echo"
".checkbox("kill[]",$J["Id"],0):"");foreach($J as$x=>$X)echo"".(($w=="sql"&&$x=="Info"&&ereg("Query|Killed",$J["Command"])&&$X!="")||($w=="pgsql"&&$x=="current_query"&&$X!="")||($w=="oracle"&&$x=="sql_text"&&$X!="")?"".shorten_utf8($X,100,"").' '.lang(223).'':nbsp($X));echo"\n";}echo'

';if(support("kill")){echo($r+1)."/".lang(224,$i->result("SELECT @@max_connections")),"

\n";}echo'

';}elseif(isset($_GET["select"])){$a=$_GET["select"];$Q=table_status($a);$v=indexes($a);$o=fields($a);$tc=column_foreign_keys($a);$Xd="";if($Q["Oid"]=="t"){$Xd=($w=="sqlite"?"rowid":"oid");$v[]=array("type"=>"PRIMARY","columns"=>array($Xd));}parse_str($_COOKIE["adminer_import"],$ra);$mf=array();$g=array();$fg=null;foreach($o as$x=>$n){$B=$b->fieldName($n);if(isset($n["privileges"]["select"])&&$B!=""){$g[$x]=html_entity_decode(strip_tags($B),ENT_QUOTES);if(is_shortable($n))$fg=$b->selectLengthProcess();}$mf+=$n["privileges"];}list($L,$Dc)=$b->selectColumnsProcess($g,$v);$Xc=count($Dc)selectSearchProcess($o,$v);$le=$b->selectOrderProcess($o,$v);$y=$b->selectLimitProcess();$yc=($L?implode(", ",$L):"*".($Xd?", $Xd":"")).convert_fields($g,$o,$L)."\nFROM ".table($a);$Ec=($Dc&&$Xc?"\nGROUP BY ".implode(", ",$Dc):"").($le?"\nORDER BY ".implode(", ",$le):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Cg=>$J){$ya=convert_field($o[key($J)]);echo$i->result("SELECT".limit($ya?$ya:idf_escape(key($J))." FROM ".table($a)," WHERE ".where_check($Cg,$o).($Z?" AND ".implode(" AND ",$Z):"").($le?" ORDER BY ".implode(", ",$le):""),1));}exit;}if($_POST&&!$m){$Vg=$Z;if(is_array($_POST["check"]))$Vg[]="((".implode(") OR (",array_map('where_check',$_POST["check"]))."))";$Vg=($Vg?"\nWHERE ".implode(" AND ",$Vg):"");$Ne=$Eg=null;foreach($v as$u){if($u["type"]=="PRIMARY"){$Ne=array_flip($u["columns"]);$Eg=($L?$Ne:array());break;}}foreach((array)$Eg as$x=>$X){if(in_array(idf_escape($x),$L))unset($Eg[$x]);}if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");if(!is_array($_POST["check"])||$Eg===array())$G="SELECT $yc$Vg$Ec";else{$Ag=array();foreach($_POST["check"]as$X)$Ag[]="(SELECT".limit($yc,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$o).$Ec,1).")";$G=implode(" UNION ALL ",$Ag);}$b->dumpData($a,"table",$G);exit;}if(!$b->selectEmailProcess($Z,$tc)){if($_POST["save"]||$_POST["delete"]){$H=true;$sa=0;$G=table($a);$N=array();if(!$_POST["delete"]){foreach($g as$B=>$X){$X=process_input($o[$B]);if($X!==null){if($_POST["clone"])$N[idf_escape($B)]=($X!==false?$X:idf_escape($B));elseif($X!==false)$N[]=idf_escape($B)." = $X";}}$G.=($_POST["clone"]?" (".implode(", ",array_keys($N)).")\nSELECT ".implode(", ",$N)."\nFROM ".table($a):" SET\n".implode(",\n",$N));}if($_POST["delete"]||$N){$Ya="UPDATE";if($_POST["delete"]){$Ya="DELETE";$G="FROM $G";}if($_POST["clone"]){$Ya="INSERT";$G="INTO $G";}if($_POST["all"]||($Eg===array()&&$_POST["check"])||$Xc){$H=queries("$Ya $G$Vg");$sa=$i->affected_rows;}else{foreach((array)$_POST["check"]as$X){$H=queries($Ya.limit1($G,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$o)));if(!$H)break;$sa+=$i->affected_rows;}}}$Fd=lang(226,$sa);if($_POST["clone"]&&$H&&$sa==1){$md=last_id();if($md)$Fd=lang(139," $md");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$Fd,$H);}elseif(!$_POST["import"]){if(!$_POST["val"])$m=lang(227);else{$H=true;$sa=0;foreach($_POST["val"]as$Cg=>$J){$N=array();foreach($J as$x=>$X){$x=bracket_escape($x,1);$N[]=idf_escape($x)." = ".(ereg('char|text',$o[$x]["type"])||$X!=""?$b->processInput($o[$x],$X):"NULL");}$G=table($a)." SET ".implode(", ",$N);$Ug=" WHERE ".where_check($Cg,$o).($Z?" AND ".implode(" AND ",$Z):"");$H=queries("UPDATE".($Xc?" $G$Ug":limit1($G,$Ug)));if(!$H)break;$sa+=$i->affected_rows;}queries_redirect(remove_from_uri(),lang(226,$sa),$H);}}elseif(is_string($mc=get_file("csv_file",true))){cookie("adminer_import","output=".urlencode($ra["output"])."&format=".urlencode($_POST["separator"]));$H=true;$Xa=array_keys($o);preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~',$mc,$yd);$sa=count($yd[0]);begin();$zf=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));foreach($yd[0]as$x=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$zf]*)$zf~",$X.$zf,$zd);if(!$x&&!array_diff($zd[1],$Xa)){$Xa=$zd[1];$sa--;}else{$N=array();foreach($zd[1]as$r=>$Ua)$N[idf_escape($Xa[$r])]=($Ua==""&&$o[$Xa[$r]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$Ua))));$H=insert_update($a,$N,$Ne);if(!$H)break;}}if($H)queries("COMMIT");queries_redirect(remove_from_uri("page"),lang(228,$sa),$H);queries("ROLLBACK");}else$m=upload_error($mc);}}$Tf=$b->tableName($Q);if(is_ajax())ob_start();page_header(lang(36).": $Tf",$m);$N=null;if(isset($mf["insert"])){$N="";foreach((array)$_GET["where"]as$X){if(count($tc[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!ereg('[_%]',$X["val"]))))$N.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($Q,$N);if(!$g)echo"

".lang(229).($o?".":": ".error())."\n";else{echo"

\n","
";hidden_fields_get();echo(DB!=""?''.(isset($_GET["ns"])?'':""):"");echo'',"
\n";$b->selectColumnsPrint($L,$g);$b->selectSearchPrint($Z,$g,$v);$b->selectOrderPrint($le,$g,$v);$b->selectLimitPrint($y);$b->selectLengthPrint($fg);$b->selectActionPrint($v);echo"
\n";$D=$_GET["page"];if($D=="last"){$wc=$i->result("SELECT COUNT(*) FROM ".table($a).($Z?" WHERE ".implode(" AND ",$Z):""));$D=floor(max(0,$wc-1)/$y);}$G=$b->selectQueryBuild($L,$Z,$Dc,$le,$y,$D);if(!$G)$G="SELECT".limit((+$y&&$Dc&&$Xc&&$w=="sql"?"SQL_CALC_FOUND_ROWS ":"").$yc,($Z?"\nWHERE ".implode(" AND ",$Z):"").$Ec,($y!=""?+$y:null),($D?$y*$D:0),"\n");echo$b->selectQuery($G);$H=$i->query($G);if(!$H)echo"

".error()."\n";else{if($w=="mssql"&&$D)$H->seek($y*$D);$Ob=array();echo"

\n";$K=array();while($J=$H->fetch_assoc()){if($D&&$w=="oracle")unset($J["RNUM"]);$K[]=$J;}if($_GET["page"]!="last")$wc=(+$y&&$Dc&&$Xc?($w=="sql"?$i->result(" SELECT FOUND_ROWS()"):$i->result("SELECT COUNT(*) FROM ($G) x")):count($K));if(!$K)echo"

".lang(86)."\n";else{$Ea=$b->backwardKeys($a,$Tf);echo"\n","".(!$Dc&&$L?"":"\n";if(is_ajax()){if($y%2==1&&$D%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($K,$tc)as$Pd=>$J){$Bg=unique_array($K[$Pd],$v);if(!$Bg){$Bg=array();foreach($K[$Pd]as$x=>$X){if(!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~',$x))$Bg[$x]=$X;}}$Cg="";foreach($Bg as$x=>$X){if(strlen($X)>64){$x="MD5(".(strpos($x,'(')?$x:idf_escape($x)).")";$X=md5($X);}$Cg.="&".($X!==null?urlencode("where[".bracket_escape($x)."]")."=".urlencode($X):"null%5B%5D=".urlencode($x));}echo"".(!$Dc&&$L?"":"\n";}if(is_ajax())exit;echo"
".lang(230)."");$Qd=array();$Ac=array();reset($L);$Ye=1;foreach($K[0]as$x=>$X){if($x!=$Xd){$X=$_GET["columns"][key($L)];$n=$o[$L?($X?$X["col"]:current($L)):$x];$B=($n?$b->fieldName($n,$Ye):"*");if($B!=""){$Ye++;$Qd[$x]=$B;$f=idf_escape($x);$Lc=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($x);$wb="&desc%5B0%5D=1";echo'','';echo(!$L||$X?apply_sql_function($X["fun"],$B):h(current($L)))."";echo"";}$Ac[$x]=$X["fun"];next($L);}}$sd=array();if($_GET["modify"]){foreach($K as$J){foreach($J as$x=>$X)$sd[$x]=max($sd[$x],min(40,strlen(utf8_decode($X))));}}echo($Ea?"".lang(231):"")."
".checkbox("check[]",substr($Cg,1),in_array(substr($Cg,1),(array)$_POST["check"]),"","this.form['all'].checked = false; formUncheck('all-page');").($Xc||information_schema(DB)?"":" ".lang(230).""));foreach($J as$x=>$X){if(isset($Qd[$x])){$n=$o[$x];if($X!=""&&(!isset($Ob[$x])||$Ob[$x]!=""))$Ob[$x]=(is_mail($X)?$Qd[$x]:"");$z="";$X=$b->editVal($X,$n);if($X!==null){if(ereg('blob|bytea|raw|file',$n["type"])&&$X!="")$z=ME.'download='.urlencode($a).'&field='.urlencode($x).$Cg;if($X==="")$X=" ";elseif($fg!=""&&is_shortable($n))$X=shorten_utf8($X,max(0,+$fg));else$X=h($X);if(!$z){foreach((array)$tc[$x]as$p){if(count($tc[$x])==1||end($p["source"])==$x){$z="";foreach($p["source"]as$r=>$Ef)$z.=where_link($r,$p["target"][$r],$K[$Pd][$Ef]);$z=($p["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\\1'.urlencode($p["db"]),ME):ME).'select='.urlencode($p["table"]).$z;if(count($p["source"])==1)break;}}}if($x=="COUNT(*)"){$z=ME."select=".urlencode($a);$r=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$Bg))$z.=where_link($r++,$W["col"],$W["val"],$W["op"]);}foreach($Bg as$dd=>$W)$z.=where_link($r++,$dd,$W);}}if(!$z&&($z=$b->selectLink($J[$x],$n))===null){if(is_mail($J[$x]))$z="mailto:$J[$x]";if($Ve=is_url($J[$x]))$z=($Ve=="http"&&$ba?$J[$x]:"$Ve://www.adminer.org/redirect/?url=".urlencode($J[$x]));}$s=h("val[$Cg][".bracket_escape($x)."]");$Y=$_POST["val"][$Cg][bracket_escape($x)];$Gc=h($Y!==null?$Y:$J[$x]);$wd=strpos($X,"...");$Kb=is_utf8($X)&&$K[$Pd][$x]==$J[$x]&&!$Ac[$x];$eg=ereg('text|lob',$n["type"]);echo(($_GET["modify"]&&$Kb)||$Y!==null?"".($eg?"":""):"".$b->selectVal($X,$z,$n));}}if($Ea)echo"";$b->backwardKeysPrint($Ea,$K[$Pd]);echo"
\n",(!$Dc&&$L?"":"\n");}if(($K||$D)&&!is_ajax()){$Yb=true;if($_GET["page"]!="last"&&+$y&&!$Xc&&($wc>=$y||$D)){$wc=found_rows($Q,$Z);if($wc$y||$D)){echo"

";$Ad=($wc===false?$D+(count($K)>=$y?2:1):floor(($wc-1)/$y));echo'".lang(233).":",pagination(0,$D).($D>5?" ...":"");for($r=max(1,$D-4);$r0){echo($D+5<$Ad?" ...":""),($Yb&&$wc!==false?pagination($Ad,$D):" ".lang(234)."");}echo(($wc===false?count($K)+1:$wc-$D*$y)>$y?' '.lang(236).'':'');}echo"

\n",($wc!==false?"(".($Yb?"":"~ ").lang(123,$wc).") ":""),checkbox("all",1,0,lang(237))."\n";if($b->selectCommandPrint()){echo'

',lang(34),'
';}$uc=$b->dumpFormat();foreach((array)$_GET["columns"]as$f){if($f["fun"]){unset($uc['sql']);break;}}if($uc){print_fieldset("export",lang(115));$ve=$b->dumpOutput();echo($ve?html_select("output",$ve,$ra["output"])." ":""),html_select("format",$uc,$ra["format"])," \n","\n";}}if($b->selectImportPrint()){print_fieldset("import",lang(238),!$K);echo" ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$ra["format"],1);echo" ","\n";}$b->selectEmailPrint(array_filter($Ob,'strlen'),$g);echo"

\n","
\n";}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$If=isset($_GET["status"]);page_header($If?lang(77):lang(76));$Og=($If?show_status():show_variables());if(!$Og)echo"

".lang(86)."\n";else{echo"\n";foreach($Og as$x=>$X){echo"","
".h($x)."","".nbsp($X);}echo"
\n";}}elseif(isset($_GET["script"])){header("Content-Type: text/javascript; charset=utf-8");if($_GET["script"]=="db"){$Qf=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$B=>$Q){$s=js_escape($B);json_row("Comment-$s",nbsp($Q["Comment"]));if(!is_view($Q)){foreach(array("Engine","Collation")as$x)json_row("$x-$s",nbsp($Q[$x]));foreach($Qf+array("Auto_increment"=>0,"Rows"=>0)as$x=>$X){if($Q[$x]!=""){$X=number_format($Q[$x],0,'.',lang(8));json_row("$x-$s",($x=="Rows"&&$X&&$Q["Engine"]==($Gf=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Qf[$x]))$Qf[$x]+=($Q["Engine"]!="InnoDB"||$x!="Data_free"?$Q[$x]:0);}elseif(array_key_exists($x,$Q))json_row("$x-$s");}}}foreach($Qf as$x=>$X)json_row("sum-$x",number_format($X,0,'.',lang(8)));json_row("");}elseif($_GET["script"]=="kill")$i->query("KILL ".(+$_POST["kill"]));else{foreach(count_tables($b->databases())as$l=>$X)json_row("tables-".js_escape($l),$X);json_row("");}exit;}else{$Zf=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Zf&&!$m&&!$_POST["search"]){$H=true;$Fd="";if($w=="sql"&&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"]);$Fd=lang(239);}elseif($_POST["move"]){$H=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Fd=lang(240);}elseif($_POST["copy"]){$H=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Fd=lang(241);}elseif($_POST["drop"]){if($_POST["views"])$H=drop_views($_POST["views"]);if($H&&$_POST["tables"])$H=drop_tables($_POST["tables"]);$Fd=lang(242);}elseif($w!="sql"){$H=($w=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Fd=lang(243);}elseif(!$_POST["tables"])$Fd=lang(7);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())$Fd.="".h($J["Table"]).": ".h($J["Msg_text"])."
";}queries_redirect(substr(ME,0,-1),$Fd,$H);}page_header(($_GET["ns"]==""?lang(25).": ".h(DB):lang(84).": ".h($_GET["ns"])),$m,true);if($b->homepage()){if($_GET["ns"]!==""){echo"

".lang(244)."

\n";$Yf=tables_list();if(!$Yf)echo"

".lang(7)."\n";else{echo"

\n","

".lang(245).": \n";if($_POST["search"]&&$_POST["query"]!="")search_tables();echo"\n",'\n";foreach($Yf as$B=>$T){$Qg=($T!==null&&!eregi("table",$T));echo'
',''.lang(104),''.lang(246),''.lang(81),''.lang(247),''.lang(248),''.lang(249),''.lang(96),''.lang(250),(support("comment")?''.lang(98):''),"
'.checkbox(($Qg?"views[]":"tables[]"),$B,in_array($B,$Zf,true),"","formUncheck('check-all');"),''.h($B).'';if($Qg){echo''.lang(103).'','?';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",lang(31)),"Index_length"=>array("indexes",lang(107)),"Data_free"=>array("edit",lang(32)),"Auto_increment"=>array("auto_increment=1&create",lang(31)),"Rows"=>array("select",lang(28)),)as$x=>$z)echo($z?"?":" ");}echo(support("comment")?" ":"");}echo"
 ".lang(224,count($Yf)),"".nbsp($w=="sql"?$i->result("SELECT @@storage_engine"):""),"".nbsp(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$x)echo" ";echo"
\n","\n";if(!information_schema(DB)){echo"

".(ereg('^(sql|sqlite|pgsql)$',$w)?($w!="sqlite"?" ":"")." ":"").($w=="sql"?" ":"")." \n";$k=(support("scheme")?schemas():$b->databases());if(count($k)!=1&&$w!="sqlite"){$l=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"

".lang(256).": ",($k?html_select("target",$k,$l):'')," ",(support("copy")?" ":""),"\n";}echo"\n";}echo"

\n";}echo'

'.lang(149)."\n";if(support("view"))echo''.lang(181)."\n";if(support("routine")){echo"

".lang(118)."

\n";$qf=routines();if($qf){echo"\n",'\n";odd('');foreach($qf as$J){echo'','
'.lang(159).''.lang(93).''.lang(198)." 
'.h($J["ROUTINE_NAME"]).'',''.h($J["ROUTINE_TYPE"]),''.h($J["DTD_IDENTIFIER"]),''.lang(110)."";}echo"
\n";}echo'

'.(support("procedure")?''.lang(197).' ':'').''.lang(196)."\n";}if(support("sequence")){echo"

".lang(259)."

\n";$_f=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema()");if($_f){echo"\n","\n";odd('');foreach($_f as$X)echo"
".lang(159)."
".h($X)."\n";echo"
\n";}echo"

".lang(203)."\n";}if(support("type")){echo"

".lang(13)."

\n";$Kg=types();if($Kg){echo"\n","\n";odd('');foreach($Kg as$X)echo"
".lang(159)."
".h($X)."\n";echo"
\n";}echo"

".lang(207)."\n";}if(support("event")){echo"

".lang(119)."

\n";$K=get_rows("SHOW EVENTS");if($K){echo"\n","\n";foreach($K as$J){echo"","
".lang(159)."".lang(260)."".lang(187)."".lang(188)."
".h($J["Name"]),"".($J["Execute at"]?lang(261)."".$J["Execute at"]:lang(189)." ".$J["Interval value"]." ".$J["Interval field"]."$J[Starts]"),"$J[Ends]",''.lang(110).'';}echo"
\n";$Xb=$i->result("SELECT @@event_scheduler");if($Xb&&$Xb!="ON")echo"

event_scheduler: ".h($Xb)."\n";}echo'

'.lang(186)."\n";}if($Yf)echo"\n";}}}page_footer();