2041 lines
478 KiB
PHP
2041 lines
478 KiB
PHP
|
<?php
|
|||
|
/** Adminer - Compact database management
|
|||
|
* @link https://www.adminer.org/
|
|||
|
* @author Jakub Vrana, https://www.vrana.cz/
|
|||
|
* @copyright 2007 Jakub Vrana
|
|||
|
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
|||
|
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
|||
|
* @version 4.7.5
|
|||
|
*/error_reporting(6135);$Xc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Xc||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
|
|||
|
connection(){global$h;return$h;}function
|
|||
|
adminer(){global$b;return$b;}function
|
|||
|
version(){global$ia;return$ia;}function
|
|||
|
idf_unescape($u){$qe=substr($u,-1);return
|
|||
|
str_replace($qe.$qe,$qe,substr($u,1,-1));}function
|
|||
|
escape_string($X){return
|
|||
|
substr(q($X),1,-1);}function
|
|||
|
number($X){return
|
|||
|
preg_replace('~[^0-9]+~','',$X);}function
|
|||
|
number_type(){return'((?<!o)int(?!er)|numeric|real|float|double|decimal|money)';}function
|
|||
|
remove_slashes($tg,$Xc=false){if(get_magic_quotes_gpc()){while(list($y,$X)=each($tg)){foreach($X
|
|||
|
as$fe=>$W){unset($tg[$y][$fe]);if(is_array($W)){$tg[$y][stripslashes($fe)]=$W;$tg[]=&$tg[$y][stripslashes($fe)];}else$tg[$y][stripslashes($fe)]=($Xc?$W:stripslashes($W));}}}}function
|
|||
|
bracket_escape($u,$Pa=false){static$vi=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return
|
|||
|
strtr($u,($Pa?array_flip($vi):$vi));}function
|
|||
|
min_version($bj,$Ee="",$i=null){global$h;if(!$i)$i=$h;$oh=$i->server_info;if($Ee&&preg_match('~([\d.]+)-MariaDB~',$oh,$A)){$oh=$A[1];$bj=$Ee;}return(version_compare($oh,$bj)>=0);}function
|
|||
|
charset($h){return(min_version("5.5.3",0,$h)?"utf8mb4":"utf8");}function
|
|||
|
script($zh,$ui="\n"){return"<script".nonce().">$zh</script>$ui";}function
|
|||
|
script_src($Oi){return"<script src='".h($Oi)."'".nonce()."></script>\n";}function
|
|||
|
nonce(){return' nonce="'.get_nonce().'"';}function
|
|||
|
target_blank(){return' target="_blank" rel="noreferrer noopener"';}function
|
|||
|
h($P){return
|
|||
|
str_replace("\0","�",htmlspecialchars($P,ENT_QUOTES,'utf-8'));}function
|
|||
|
nl_br($P){return
|
|||
|
str_replace("\n","<br>",$P);}function
|
|||
|
checkbox($B,$Y,$gb,$me="",$vf="",$lb="",$ne=""){$H="<input type='checkbox' name='$B' value='".h($Y)."'".($gb?" checked":"").($ne?" aria-labelledby='$ne'":"").">".($vf?script("qsl('input').onclick = function () { $vf };",""):"");return($me!=""||$lb?"<label".($lb?" class='$lb'":"").">$H".h($me)."</label>":$H);}function
|
|||
|
optionlist($Af,$ih=null,$Ti=false){$H="";foreach($Af
|
|||
|
as$fe=>$W){$Bf=array($fe=>$W);if(is_array($W)){$H.='<optgroup label="'.h($fe).'">';$Bf=$W;}foreach($Bf
|
|||
|
as$y=>$X)$H.='<option'.($Ti||is_string($y)?' value="'.h($y).'"':'').(($Ti||is_string($y)?(string)$y:$X)===$ih?' selected':'').'>'.h($X);if(is_array($W))$H.='</optgroup>';}return$H;}function
|
|||
|
html_select($B,$Af,$Y="",$uf=true,$ne=""){if($uf)return"<select name='".h($B)."'".($ne?" aria-labelledby='$ne'":"").">".optionlist($Af,$Y)."</select>".(is_string($uf)?script("qsl('select').onchange = function () { $uf };",""):"");$H="";foreach($Af
|
|||
|
as$y=>$X)$H.="<label><input type='radio' name='".h($B)."' value='".h($y)."'".($y==$Y?" checked":"").">".h($X)."</label>";return$H;}function
|
|||
|
select_input($Ka,$Af,$Y="",$uf="",$fg=""){$Zh=($Af?"select":"input");return"<$Zh$Ka".($Af?"><option value=''>$fg".optionlist($Af,$Y,true)."</select>":" size='10' value='".h($Y)."' placeholder='$fg'>").($uf?script("qsl('$Zh').onchange = $uf;",""):"");}function
|
|||
|
confirm($Oe="",$jh="qsl('input')"){return
|
|||
|
script("$jh.onclick = function () { return confirm('".($Oe?js_escape($Oe):lang(0))."'); };","");}function
|
|||
|
print_fieldset($t,$ve,$ej=false){echo"<fieldset><legend>","<a href='#fieldset-$t'>$ve</a>",script("qsl('a').onclick = partial(toggle, 'fieldset-$t');",""),"</legend>","<div id='fieldset-$t'".($ej?"":" class='hidden'").">\n";}function
|
|||
|
bold($Xa,$lb=""){return($Xa?" class='active $lb'":($lb?" class='$lb'":""));}function
|
|||
|
odd($H=' class="odd"'){static$s=0;if(!$H)$s=-1;return($s++%2?$H:'');}function
|
|||
|
js_escape($P){return
|
|||
|
addcslashes($P,"\r\n'\\/");}function
|
|||
|
json_row($y,$X=null){static$Yc=true;if($Yc)echo"{";if($y!=""){echo($Yc?"":",")."\n\t\"".addcslashes($y,"\r\n\t\"\\/").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\/").'"':'null');$Yc=false;}else{echo"\n}\n";$Yc=true;}}function
|
|||
|
ini_bool($Sd){$X=ini_get($Sd);return(preg_match('~^(on|true|yes)$~i',$X)||(int)$X);}function
|
|||
|
sid(){static$H;if($H===null)$H=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));return$H;}function
|
|||
|
set_password($aj,$M,$V,$E){$_SESSION["pwds"][$aj][$M][$V]=($_COOKIE["adminer_key"]&&is_string($E)?array(encrypt_string($E,$_COOKIE["adminer_key"])):$E);}function
|
|||
|
get_password(){$H=get_session("pwds");if(is_array($H))$H=($_COOKIE["adminer_key"]?decrypt_string($H[0],$_COOKIE["adminer_key"]):false);return$H;}function
|
|||
|
q($P){global$h;return$h->quote($P);}function
|
|||
|
get_vals($F,$e=0){global$h;$H=array();$G=$h->query($F);if(is_object($G)){while($I=$G->fetch_row())$H[]=$I[$e];}return$H;}function
|
|||
|
get_key_vals($F,$i=null,$rh=true){global$h;if(!is_object($i))$i=$h;$H=array();$G=$i->query($F);if(is_object($G)){while($I=$G->fetch_row()){if($rh)$H[$I[0]]=$I[1];else$H[]=$I[0];}}return$H;}function
|
|||
|
get_rows($F,$i=null,$n="<p class='error'>"){global$h;$yb=(is_object($i)?$i:$h);$H=array();$G=$yb->query($F);if(is_object($G)){while($I=$G->fetch_assoc())$H[]=$I;}elseif(!$G&&!is_object($i)&&$n&&defined("PAGE_HEADER"))echo$n.error()."\n";return$H;}function
|
|||
|
unique_array($I,$w){foreach($w
|
|||
|
as$v){if(preg_match("~PRIMARY|UNIQUE~",$v["type"])){$H=array();foreach($v["columns"]as$y){if(!isset($I[$y]))continue
|
|||
|
2;$H[$y]=$I[$y];}return$H;}}}function
|
|||
|
escape_key($y){if(preg_match('(^([\w(]+)('.str_replace("_",".*",preg_quote(idf_escape("_"))).')([ \w)]+)$)',$y,$A))return$A[1].idf_escape(idf_unescape($A[2])).$A[3];return
|
|||
|
idf_escape($y);}function
|
|||
|
where($Z,$p=array()){global$h,$x;$H=array();foreach((array)$Z["where"]as$y=>$X){$y=bracket_escape($y,1);$e=escape_key($y);$H[]=$e.($x=="sql"&&is_numeric($X)&&preg_match('~\.~',$X)?" LIKE ".q($X):($x=="mssql"?" LIKE ".q(preg_replace('~[_%[]~','[\0]',$X)):" = ".unconvert_field($p[$y],q($X))));if($x=="sql"&&preg_match('~char|text~',$p[$y]["type"])&&preg_match("~[^ -@]~",$X))$H[]="$e = ".q($X)." COLLATE ".charset($h)."_bin";}foreach((array)$Z["null"]as$y)$H[]=escape_key($y)." IS NULL";return
|
|||
|
implode(" AND ",$H);}function
|
|||
|
where_check($X,$p=array()){parse_str($X,$eb);remove_slashes(array(&$eb));return
|
|||
|
where($eb,$p);}function
|
|||
|
where_link($s,$e,$Y,$xf="="){return"&where%5B$s%5D%5Bcol%5D=".urlencode($e)."&where%5B$s%5D%5Bop%5D=".urlencode(($Y!==null?$xf:"IS NULL"))."&where%5B$s%5D%5Bval%5D=".urlencode($Y);}function
|
|||
|
convert_fields($f,$p,$K=array()){$H="";foreach($f
|
|||
|
as$y=>$X){if($K&&!in_array(idf_escape($y),$K))continue;$Ha=convert_field($p[$y]);if($Ha)$H.=", $Ha AS ".idf_escape($y);}return$H;}function
|
|||
|
cookie($B,$Y,$ye=2592000){global$ba;return
|
|||
|
header("Set-Cookie: $B=".urlencode($Y).($ye?"; expires=".gmdate("D, d M Y H:i:s",time()+$ye)." GMT":"")."; path=".preg_replace('~\?.*~','',$_SERVER["REQUEST_URI"]).($ba?"; secure":"")."; HttpOnly; SameSite=lax",false);}function
|
|||
|
restart_session(){if(!ini_bool("session.use_cookies"))session_start();}function
|
|||
|
stop_session($dd=false){$Si=ini_bool("session.use_cookies");if(!$Si||$dd){session_write_close();if($Si&&@ini_set("session.use_cookies",false)===false)session_start();}}function&get_session($y){return$_SESSION[$y][DRIVER][SERVER][$_GET["username"]];}function
|
|||
|
set_session($y,$X){$_SESSION[$y][DRIVER][SERVER][$_GET["username"]]=$X;}function
|
|||
|
auth_url($aj,$M,$V,$l=null){global$gc;preg_match('~([^?]*)\??(.*)~',remove_from_uri(implode("|",array_keys($gc))."|username|".($l!==null?"db|":"").session_name()),$A);return"$A[1]?".(sid()?SID."&":"").($aj!="server"||$M!=""?urlencode($aj)."=".urlencode($M)."&":"")."username=".urlencode($V).($l!=""?"&db=".urlencode($l):"").($A[2]?"&$A[2]":"");}function
|
|||
|
is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
|
|||
|
redirect($_e,$Oe=null){if($Oe!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($_e!==null?$_e:$_SERVER["REQUEST_URI"]))][]=$Oe;}if($_e!==null){if($_e=="")$_e=".";header("Location: $_e");exit;}}function
|
|||
|
query_redirect($F,$_e,$Oe,$Eg=true,$Ec=true,$Pc=false,$hi=""){global$h,$n,$b;if($Ec){$Gh=microtime(true);$Pc=!$h->query($F);$hi=format_time($Gh);}$Bh="";if($F)$Bh=$b->messageQuery($F,$hi,$Pc);if($Pc){$n=error().$Bh.script("messagesPrint();");return
|
|||
|
false;}if($Eg)redirect($_e,$Oe.$Bh);return
|
|||
|
true;}function
|
|||
|
queries($F){global$h;static$yg=array();static$Gh;if(!$Gh)$Gh=microtime(true);if($F===null)return
|
|||
|
array(implode("\n",$yg),format_time($Gh));$yg[]=(preg_match('~;$~',$F)?"DELIMITER ;;\n$F;\nDELIMITER ":$F).";";return$h->query($F);}function
|
|||
|
apply_queries($F,$S,$Ac='table'){foreach($S
|
|||
|
as$Q){if(!queries("$F ".$Ac($Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
queries_redirect($_e,$Oe,$Eg){list($yg,$hi)=queries(null);return
|
|||
|
query_redirect($yg,$_e,$Oe,$Eg,false,!$Eg,$hi);}function
|
|||
|
format_time($Gh){return
|
|||
|
lang(1,max(0,microtime(true)-$Gh));}function
|
|||
|
remove_from_uri($Qf=""){return
|
|||
|
substr(preg_replace("~(?<=[?&])($Qf".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
|
|||
|
pagination($D,$Mb){return" ".($D==$Mb?$D+1:'<a href="'.h(remove_from_uri("page").($D?"&page=$D".($_GET["next"]?"&next=".urlencode($_GET["next"]):""):"")).'">'.($D+1)."</a>");}function
|
|||
|
get_file($y,$Ub=false){$Vc=$_FILES[$y];if(!$Vc)return
|
|||
|
null;foreach($Vc
|
|||
|
as$y=>$X)$Vc[$y]=(array)$X;$H='';foreach($Vc["error"]as$y=>$n){if($n)return$n;$B=$Vc["name"][$y];$pi=$Vc["tmp_name"][$y];$Ab=file_get_contents($Ub&&preg_match('~\.gz$~',$B)?"compress.zlib://$pi":$pi);if($Ub){$Gh=substr($Ab,0,3);if(function_exists("iconv")&&preg_match("~^\xFE\xFF|^\xFF\xFE~",$Gh,$Kg))$Ab=iconv("utf-16","utf-8",$Ab);elseif($Gh=="\xEF\xBB\xBF")$Ab=substr($Ab,3);$H.=$Ab."\n\n";}else$H.=$Ab;}return$H;}function
|
|||
|
upload_error($n){$Le=($n==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($n?lang(2).($Le?" ".lang(3,$Le):""):lang(4));}function
|
|||
|
repeat_pattern($dg,$we){return
|
|||
|
str_repeat("$dg{0,65535}",$we/65535)."$dg{0,".($we%65535)."}";}function
|
|||
|
is_utf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\0-\x8\xB\xC\xE-\x1F]~',$X));}function
|
|||
|
shorten_utf8($P,$we=80,$Nh=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{10FFFF}]",$we).")($)?)u",$P,$A))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$we).")($)?)",$P,$A);return
|
|||
|
h($A[1]).$Nh.(isset($A[2])?"":"<i>…</i>");}function
|
|||
|
format_number($X){return
|
|||
|
strtr(number_format($X,0,".",lang(5)),preg_split('~~u',lang(6),-1,PREG_SPLIT_NO_EMPTY));}function
|
|||
|
friendly_url($X){return
|
|||
|
preg_replace('~[^a-z0-9_]~i','-',$X);}function
|
|||
|
hidden_fields($tg,$Hd=array()){$H=false;while(list($y,$X)=each($tg)){if(!in_array($y,$Hd)){if(is_array($X)){foreach($X
|
|||
|
as$fe=>$W)$tg[$y."[$fe]"]=$W;}else{$H=true;echo'<input type="hidden" name="'.h($y).'" value="'.h($X).'">';}}}return$H;}function
|
|||
|
hidden_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
|
|||
|
table_status1($Q,$Qc=false){$H=table_status($Q,$Qc);return($H?$H:array("Name"=>$Q));}function
|
|||
|
column_foreign_keys($Q){global$b;$H=array();foreach($b->foreignKeys($Q)as$q){foreach($q["source"]as$X)$H[$X][]=$q;}return$H;}function
|
|||
|
enum_input($T,$Ka,$o,$Y,$vc=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$o["length"],$Ge);$H=($vc!==null?"<label><input type='$T'$Ka value='$vc'".((is_array($Y)?in_array($vc,$Y):$Y===0)?" checked":"")."><i>".lang(7)."</i></label>":"");foreach($Ge[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$gb=(is_int($Y)?$Y==$s+1:(is_array($Y)?in_array($s+1,$Y):$Y===$X));$H.=" <label><input type='$T'$Ka value='".($s+1)."'".($gb?' checked':'').'>'.h($b->editVal($X,$o)).'</label>';}return$H;}function
|
|||
|
input($o,$Y,$r){global$U,$b,$x;$B=h(bracket_escape($o["field"]));echo"<td class='function'>";if(is_array($Y)&&!$r){$Fa=array($Y);if(version_compare(PHP_VERSION,5.4)>=0)$Fa[]=JSON_PRETTY_PRINT;$Y=call_user_func_array('json_encode',$Fa);$r="json";}$Og=($x=="mssql"&&$o["auto_increment"]);if($Og&&!$_POST["save"])$r=null;$md=(isset($_GET["select"])||$Og?array("orig"=>lang(8)):array())+$b->editFunctions($o);$Ka=" name='fields[$B]'";if($o["type"]=="enum")echo
|
|||
|
h($md[""])."<td>".$b->editInput($_GET["edit"],$o,$Ka,$Y);else{$wd=(in_array($r,$md)||isset($md[$r]));echo(count($md)>1?"<select name='function[$B]'>".optionlist($md,$r===null||$wd?$r:"")."</select>".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).script("qsl('select').onchange = functionChange;",""):h(reset($md))).'<td>';$Ud=$b->editInput($_GET["edit"],$o,$Ka,$Y);if($Ud!="")echo$Ud;elseif(preg_match('~bool~',$o["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($o["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$o["length"],$Ge);foreach($Ge[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$gb=(is_int($Y)?($Y>>$s)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$B][$s]' value='".(1<<$s)."'".($gb?' checked':'').">".h($b->editVal($X,$o)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$o["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$B'>";elseif(($fi=preg_match('~text|lob|memo~i',$o["type"]))||preg_match("~\n~",$Y)){if($fi&&$x!="sqlite")$Ka.=" cols='50' rows='12'";else{$J=min(12,substr_count($Y,"\n")+1);$Ka.=" cols='30' rows='$J'".($J==1?" style='height: 1.2em;'":"");}echo"<textarea$Ka>".h($Y).'</textarea>';}elseif($r=="json"||preg_match('~^jsonb?$~',$o["type"]))echo"<textarea$Ka cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$Ne=(!preg_match('~int~',$o["type"])&&preg_match('~^(\d+)(,(\d+))?$~',$o["length"],$A)?((preg_match("~binary~",$o["type"])?2:1)*$A[1]+($A[3]?1:0)+($A[2]&&!$o["unsigned"]?1:0)):($U[$o["type"]]?$U[$o["type"]]+($o["unsigned"]?0:1):0));if($x=='sql'&&min_version(5.6)&&preg_match('~time~',$o["type"]))$Ne+=7;echo"<input".((!$wd||$r==="")&&preg_match('~(?<!o)int(?!er)~',$o["type"])&&!preg_match('~\[\]~',$o["full_type"])?" type='number'":"")." value='".h($Y)."'".($Ne?" data-maxlength='$Ne'":"").(preg_match('~char|binary~',$o["type"])&&$Ne>20?" size='40'":"")."$Ka>";}echo$b->editHint($_GET["edit"],$o,$Y);$Yc=0;foreach($md
|
|||
|
as$y=>$X){if($y===""||!$X)break;$Yc++;}if($Yc)echo
|
|||
|
script("mixin(qsl('td'), {onchange: partial(skipOriginal, $Yc), oninput: function () { this.onchange(); }});");}}function
|
|||
|
process_input($o){global$b,$m;$u=bracket_escape($o["field"]);$r=$_POST["function"][$u];$Y=$_POST["fields"][$u];if($o["type"]=="enum"){if($Y==-1)return
|
|||
|
false;if($Y=="")return"NULL";return+$Y;}if($o["auto_increment"]&&$Y=="")return
|
|||
|
null;if($r=="orig")return(preg_match('~^CURRENT_TIMESTAMP~i',$o["on_update"])?idf_escape($o["field"]):false);if($r=="NULL")return"NULL";if($o["type"]=="set")return
|
|||
|
array_sum((array)$Y);if($r=="json"){$r="";$Y=json_decode($Y,true);if(!is_array($Y))return
|
|||
|
false;return$Y;}if(preg_match('~blob|bytea|raw|file~',$o["type"])&&ini_bool("file_uploads")){$Vc=get_file("fields-$u");if(!is_string($Vc))return
|
|||
|
false;return$m->quoteBinary($Vc);}return$b->processInput($o,$Y,$r);}function
|
|||
|
fields_from_edit(){global$m;$H=array();foreach((array)$_POST["field_keys"]as$y=>$X){if($X!=""){$X=bracket_escape($X);$_POST["function"][$X]=$_POST["field_funs"][$y];$_POST["fields"][$X]=$_POST["field_vals"][$y];}}foreach((array)$_POST["fields"]as$y=>$X){$B=bracket_escape($y,1);$H[$B]=array("field"=>$B,"privileges"=>array("insert"=>1,"update"=>1),"null"=>1,"auto_increment"=>($y==$m->primary),);}return$H;}function
|
|||
|
search_tables(){global$b,$h;$_GET["where"][0]["val"]=$_POST["query"];$lh="<ul>\n";foreach(table_status('',true)as$Q=>$R){$B=$b->tableName($R);if(isset($R["Engine"])&&$B!=""&&(!$_POST["tables"]||in_array($Q,$_POST["tables"]))){$G=$h->query("SELECT".limit("1 FROM ".table($Q)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($Q),array())),1));if(!$G||$G->fetch_row()){$pg="<a href='".h(ME."select=".urlencode($Q)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$B</a>";echo"$lh<li>".($G?$pg:"<p class='error'>$pg: ".error())."\n";$lh="";}}}echo($lh?"<p class='message'>".lang(9):"</ul>")."\n";}function
|
|||
|
dump_headers($Ed,$Xe=false){global$b;$H=$b->dumpHeaders($Ed,$Xe);$Nf=$_POST["output"];if($Nf!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($Ed).".$H".($Nf!="file"&&!preg_match('~[^0-9a-z]~',$Nf)?".$Nf":""));session_write_close();ob_flush();flush();return$H;}function
|
|||
|
dump_csv($I){foreach($I
|
|||
|
as$y=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X==="")$I[$y]='"'.str_replace('"','""',$X).'"';}echo
|
|||
|
implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$I)."\r\n";}function
|
|||
|
apply_sql_function($r,$e){return($r?($r=="unixepoch"?"DATETIME($e, '$r')":($r=="count distinct"?"COUNT(DISTINCT ":strtoupper("$r("))."$e)"):$e);}function
|
|||
|
get_temp_dir(){$H=ini_get("upload_tmp_dir");if(!$H){if(function_exists('sys_get_temp_dir'))$H=sys_get_temp_dir();else{$Wc=@tempnam("","");if(!$Wc)return
|
|||
|
false;$H=dirname($Wc);unlink($Wc);}}return$H;}function
|
|||
|
file_open_lock($Wc){$kd=@fopen($Wc,"r+");if(!$kd){$kd=@fopen($Wc,"w");if(!$kd)return;chmod($Wc,0660);}flock($kd,LOCK_EX);return$kd;}function
|
|||
|
file_write_unlock($kd,$Ob){rewind($kd);fwrite($kd,$Ob);ftruncate($kd,strlen($Ob));flock($kd,LOCK_UN);fclose($kd);}function
|
|||
|
password_file($Gb){$Wc=get_temp_dir()."/adminer.key";$H=@file_get_contents($Wc);if($H||!$Gb)return$H;$kd=@fopen($Wc,"w");if($kd){chmod($Wc,0660);$H=rand_string();fwrite($kd,$H);fclose($kd);}return$H;}function
|
|||
|
rand_string(){return
|
|||
|
md5(uniqid(mt_rand(),true));}function
|
|||
|
select_value($X,$_,$o,$gi){global$b;if(is_array($X)){$H="";foreach($X
|
|||
|
as$fe=>$W)$H.="<tr>".($X!=array_values($X)?"<th>".h($fe):"")."<td>".select_value($W,$_,$o,$gi);return"<table cellspacing='0'>$H</table>";}if(!$_)$_=$b->selectLink($X,$o);if($_===null){if(is_mail($X))$_="mailto:$X";if(is_url($X))$_=$X;}$H=$b->editVal($X,$o);if($H!==null){if(!is_utf8($H))$H="\0";elseif($gi!=""&&is_shortable($o))$H=shorten_utf8($H,max(0,+$gi));else$H=h($H);}return$b->selectVal($H,$_,$o,$X);}function
|
|||
|
is_mail($sc){$Ia='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$fc='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$dg="$Ia+(\\.$Ia+)*@($fc?\\.)+$fc";return
|
|||
|
is_string($sc)&&preg_match("(^$dg(,\\s*$dg)*\$)i",$sc);}function
|
|||
|
is_url($P){$fc='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return
|
|||
|
preg_match("~^(https?)://($fc?\\.)+$fc(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$P);}function
|
|||
|
is_shortable($o){return
|
|||
|
preg_match('~char|text|json|lob|geometry|point|linestring|polygon|string|bytea~',$o["type"]);}function
|
|||
|
count_rows($Q,$Z,$ae,$pd){global$x;$F=" FROM ".table($Q).($Z?" WHERE ".implode(" AND ",$Z):"");return($ae&&($x=="sql"||count($pd)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$pd).")$F":"SELECT COUNT(*)".($ae?" FROM (SELECT 1$F GROUP BY ".implode(", ",$pd).") x":$F));}function
|
|||
|
slow_query($F){global$b,$ri,$m;$l=$b->database();$ii=$b->queryTimeout();$wh=$m->slowQuery($F,$ii);if(!$wh&&support("kill")&&is_object($i=connect())&&($l==""||$i->select_db($l))){$ke=$i->result(connection_id());echo'<script',nonce(),'>
|
|||
|
var timeout = setTimeout(function () {
|
|||
|
ajax(\'',js_escape(ME),'script=kill\', function () {
|
|||
|
}, \'kill=',$ke,'&token=',$ri,'\');
|
|||
|
}, ',1000*$ii,');
|
|||
|
</script>
|
|||
|
';}else$i=null;ob_flush();flush();$H=@get_key_vals(($wh?$wh:$F),$i,false);if($i){echo
|
|||
|
script("clearTimeout(timeout);");ob_flush();flush();}return$H;}function
|
|||
|
get_token(){$Ag=rand(1,1e6);return($Ag^$_SESSION["token"]).":$Ag";}function
|
|||
|
verify_token(){list($ri,$Ag)=explode(":",$_POST["token"]);return($Ag^$_SESSION["token"])==$ri;}function
|
|||
|
lzw_decompress($Ta){$cc=256;$Ua=8;$nb=array();$Qg=0;$Rg=0;for($s=0;$s<strlen($Ta);$s++){$Qg=($Qg<<8)+ord($Ta[$s]);$Rg+=8;if($Rg>=$Ua){$Rg-=$Ua;$nb[]=$Qg>>$Rg;$Qg&=(1<<$Rg)-1;$cc++;if($cc>>$Ua)$Ua++;}}$bc=range("\0","\xFF");$H="";foreach($nb
|
|||
|
as$s=>$mb){$rc=$bc[$mb];if(!isset($rc))$rc=$pj.$pj[0];$H.=$rc;if($s)$bc[]=$pj.$rc[0];$pj=$rc;}return$H;}function
|
|||
|
on_help($tb,$th=0){return
|
|||
|
script("mixin(qsl('select, input'), {onmouseover: function (event) { helpMouseover.call(this, event, $tb, $th) }, onmouseout: helpMouseout});","");}function
|
|||
|
edit_form($a,$p,$I,$Mi){global$b,$x,$ri,$n;$Sh=$b->tableName(table_status1($a,true));page_header(($Mi?lang(10):lang(11)),$n,array("select"=>array($a,$Sh)),$Sh);if($I===false)echo"<p class='error'>".lang(12)."\n";echo'<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';if(!$p)echo"<p class='error'>".lang(13)."\n";else{echo"<table cellspacing='0' class='layout'>".script("qsl('table').onkeydown = editingKeydown;");foreach($p
|
|||
|
as$B=>$o){echo"<tr><th>".$b->fieldName($o);$Vb=$_GET["set"][bracket_escape($B)];if($Vb===null){$Vb=$o["default"];if($o["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$Vb,$Kg))$Vb=$Kg[1];}$Y=($I!==null?($I[$B]!=""&&$x=="sql"&&preg_match("~enum|set~",$o["type"])?(is_array($I[$B])?array_sum($I[$B]):+$I[$B]):$I[$B]):(!$Mi&&$o["auto_increment"]?"":(isset($_GET["select"])?false:$Vb)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$o);$r=($_POST["save"]?(string)$_POST["function"][$B]:($Mi&&preg_match('~^CURRENT_TIMESTAMP~i',$o["on_update"])?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$o["type"])&&preg_match('~^CURRENT_TIMESTAMP~i',$Y)){$Y="";$r="now";}input($o,$Y,$r);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($p){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||!$p?"":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"]),'">
|
|||
|
<input type="hidden" name="save" value="1">
|
|||
|
<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}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
|
|||
|
lzw_decompress("\0\0\0` \0<EFBFBD>\0\n @\0<EFBFBD>C<><10>\"\0`E<>Q<EFBFBD><51><01><1F>?<3F>tvM'<27>Jd<4A>d\\<19>b0\0<08>\"<13><>fӈ<66><D388>s5<73><35><EFBFBD><EFBFBD>A<EFBFBD>XPaJ<>0<18><><EFBFBD>8<>#R<>T<EFBFBD><54>z`<60>#.<2E><>c<EFBFBD>X<EFBFBD><58>Ȁ?<3F>-\0<05>Im?<3F>.<16>M<EFBFBD><16>\0ȯ(̉<><1E>/(%<25>\0");}elseif($_GET["file"]=="default.css"){header("Content-Type: text/css; charset=utf-8");echo
|
|||
|
lzw_decompress("\n1̇<>ٌ<EFBFBD>l7<6C><37>B1<42>4vb0<62><30>fs<66><73><EFBFBD>n2B<32>ѱ٘<D1B1>n:<0E>#(<28>b.\rDc)<29><>a7E<><13><><EFBFBD>l<0C>ñ<EFBFBD><C3B1>i1̎s<03><><EFBFBD>-4<><34>f<EFBFBD> <09><>i7<0E><03><><EFBFBD><EFBFBD>t4<0E><><EFBFBD>y<EFBFBD>Zf4<66><05>i<01>AT<41>VV<15><>f:Ϧ,:1<0E>Qݼ<51>b2`<60>#<0C>>:7G<37><47>1<EFBFBD><31><EFBFBD>s<EFBFBD><73>L<EFBFBD>XD*bv<܌#<23>e@<40>:4<1B><>!fo<1D><><EFBFBD>t:<<3C><>咾<EFBFBD>o<EFBFBD><6F>\ni<EFBFBD><EFBFBD><EFBFBD>',<2C><>a_<>:<3A>i<69>Bv<42>|N<>4.5Nf<4E>i<EFBFBD>vp<76>h<EFBFBD><68>l<EFBFBD><6C><EFBFBD>֚<EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD>= <20>OFQ<46><51>k\$<EFBFBD><EFBFBD>i<EFBFBD><1A><><EFBFBD>d2T<0C><>p<EFBFBD><70>6<EFBFBD><01><><EFBFBD><EFBFBD>-<2D>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD>h:<3A>a<>,<2C><><EFBFBD><10>2<EFBFBD>#8А<38>#<23><>6n<><6E><11><>J<1E><>h<EFBFBD>t<EFBFBD><74><EFBFBD><EFBFBD><EFBFBD>4O42<34><32>ok<6F><12>*r<><72><01>@p@<16>!<21><1D><><EFBFBD><EFBFBD><EFBFBD>?<3F>6<><36>r[<03><>L<06><><EFBFBD>:2B<32>j<EFBFBD>!Hb<1C><>P<EFBFBD>=!1V<>\"<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>\nS<EFBFBD><19><>D7<0E><>Dڛ<44>C!<1C>!<21><><EFBFBD>Gʌ<47> <20>+<2B>=tC<74><43>.C<><43>:+<2B><>=<3D><><EFBFBD><EFBFBD><18><><EFBFBD>%<1F>c<EFBFBD>1MR/<2F>EȒ4<C892><34><EFBFBD>2<EFBFBD>䱠<EFBFBD>`<60>8(<28>ӹ[W<0B><>=<3D>yS<0C>b<EFBFBD>=<3D>-ܹBS+ɯ<><C9AF><EFBFBD><EFBFBD><0F>@pL4Yd<><17>q<EFBFBD><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<0C>3Ĭ<0C><>Ac܌<63>Ψ<EFBFBD>k<EFBFBD>[&><3E><><EFBFBD>Z<>pkm]<5D>u-c:<3A><15><>Nt<>δpҝ<70><D29D>8<EFBFBD>=<3D>#<23><>[.<2E><>ޯ<EFBFBD>~<7E><><EFBFBD>m<EFBFBD>y<EFBFBD>PP<50>|I֛<49><EFBFBD><0F>Q<>9v[<5B>Q<EFBFBD><51>\n<EFBFBD><EFBFBD>r<EFBFBD>'g<>+<2B><>T<EFBFBD>2<EFBFBD><32>V<EFBFBD><56>z<EFBFBD>4<EFBFBD><34>8<EFBFBD><38>( <09>Ey*#j<>2]<12><>R<EFBFBD><52><06><>)<29><>[N<>R\$<EFBFBD><>:<3A><>>\$;<14>><3E><>\r<EFBFBD><EFBFBD><EFBFBD>H<EFBFBD><EFBFBD>T<>\nw<>N <20>wأ<77><D8A3><<3C><0E>Gw<47><77><EFBFBD><15>\\Y<EFBFBD>_<EFBFBD>Rt^<5E>><3E>\r}<7D><>S\rz<EFBFBD>4=<3D>\nL<EFBFBD>%J<><13>\",Z<>8<0E><><EFBFBD><EFBFBD>i<EFBFBD>0u<30>?<1A><><EFBFBD><EFBFBD><EFBFBD>s3#<23>ى<EFBFBD>:<3A><><EFBFBD><EFBFBD>㽖<18><>E]x<><78><0E>s^8<><38>K^<5E><>*0<><30>w<EFBFBD><03><><EFBFBD>~<7E><><EFBFBD>:<3A><>i<EFBFBD><69><EFBFBD>v2w<32><77><EFBFBD><07>^7<><0E><08>7<EFBFBD>c<EFBFBD><63>u+U%<25>{P<EFBFBD>*4̼<34>LX./!<21><>1C<1E><>qx!H<><02>Fd<08><>L<EFBFBD><4C><1B>Ġ<>`6<06><0C>5<><1A>f<05><>Ć<EFBFBD>=H<>l <20>V1<><31>\0a2<EFBFBD>;<3B><>6<EFBFBD><36><EFBFBD><EFBFBD>_ه<D987>\0&<26>Z<EFBFBD>S<EFBFBD>d)KE'<27><>n<EFBFBD><6E>[X<><58>\0ZɊ<EFBFBD>F[P<>ޘ@<40><>!<19><0E>Y<EFBFBD>,`<60>\"ڷ<05><>0Ee9yF><3E><>9b<><62><EFBFBD><EFBFBD>F5:<14><><EFBFBD>\0}Ĵ<><C4B4>(\$<0E><><08><><EFBFBD>37H<37><1C><> M<>A<EFBFBD><41>6R<36><52>{Mq<EFBFBD>7G<EFBFBD><EFBFBD>C<>C<0C>m2<03>(<28>Ct>[<5B>-t<>/&C<0C>]<5D>etG<74>̬4@r><06><><08><<3C>Sq<11>/<2F><><EFBFBD>Q<EFBFBD><51>hm<68><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD><4C>#<10><>K<EFBFBD>|<7C><><EFBFBD>6fKP<4B>\r%t<><08>V=\"<EFBFBD>SH\$<EFBFBD>} <20><>)w<>,W\0F<06><>u@<40>b<0B>9<EFBFBD>\rr<EFBFBD>2<EFBFBD>#<23>D<EFBFBD><44>X<EFBFBD><58><EFBFBD>yOI<4F>><14><>n<0B><>Ǣ%<25><><EFBFBD>'<27><>_<EFBFBD><5F>t\rτz<0C>\\1<EFBFBD>hl<EFBFBD>]Q5Mp6k<36><6B><EFBFBD>qh<71>\$<EFBFBD>H~<06>|<7C><14>!*4<><34><10><14>`S<><53><EFBFBD>S t<>PP\\g<EFBFBD><EFBFBD>7<EFBFBD>\n-<07>:袪p<E8A2AA><70><EFBFBD><EFBFBD>l<EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD>7Өc<>(wO0\\:<07><>w<EFBFBD><77><EFBFBD>p4<70><34><EFBFBD>{T<EFBFBD><EFBFBD>jO<EFBFBD>6HÊ<>r<EFBFBD><12><03>q\n<11><>%%<25>y']\$<EFBFBD><EFBFBD>a<EFBFBD>Z<1D>.fc<66>q*-<2D>FW<46><57>k<EFBFBD><6B>z<EFBFBD><15><>j<><1E><>lg<6C><67>:<3A>\$\"<EFBFBD>N<EFBFBD>\r#<23>d<EFBFBD>Â<EFBFBD><C382><01>sc<73><63>̠<EFBFBD><14>\"j<EFBFBD>\r<EFBFBD><EFBFBD><EFBFBD><15><>Ւ<EFBFBD>Ph<50>1/<2F><02>DA)<06><><EFBFBD>[<5B>kn<6B>p76<>Y<EFBFBD><59>R{<18>M<05>P<EFBFBD><50><EFBFBD>@\n-<2D>a<EFBFBD>6<EFBFBD><36>[<5B>zJH,<2C>dl<14>B<>h<EFBFBD>o<EFBFBD><6F><EFBFBD><03><1D>+<2B>#Dr^<1F>^<5E><>e<EFBFBD><65>E<EFBFBD><45><EFBFBD> ĜaP<61><50><EFBFBD>JG<4A>z<1A><>t<0E><>2<EFBFBD>X<EFBFBD><16><><EFBFBD><EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ȳ<13><>B_%K=E<><45>b弾<7F>§kU(.!ܮ8<DCAE><38><EFBFBD><EFBFBD>I.@<40>K<EFBFBD>xn<78><6E><EFBFBD>:<3A>P<EFBFBD>32<><32>m<EFBFBD>H C*<2A>:v<17>T<EFBFBD>\nR<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0u<01><><10><><1C>ҧ]<01><1B><><EFBFBD><EFBFBD>P/<2F>JQd<51>{L<EFBFBD>:Y<><59>2b<32><62>T <20><><EFBFBD>3<EFBFBD>4<EFBFBD><34><EFBFBD>c<EFBFBD><63>V=<3D><><15>L4<1E><>r<0C>!<21>B<03>Y<EFBFBD>6<0F><19>MeL<07><><EFBFBD><1D><><EFBFBD><EFBFBD>i<EFBFBD>o<EFBFBD>9< G<><47>ƕЙMhm^<5E>U<EFBFBD>N<EFBFBD><4E><EFBFBD><0B>Tr5HiM<69>/<2F>n<EFBFBD>흳T<ED9DB3><54>[-<__<>3/Xr(<<3C><><EFBFBD><EFBFBD><05><><EFBFBD><EFBFBD><EFBFBD>uҖGNX20<>\r\$^<5E><>:'9<><39>O<EFBFBD><4F>;<3B>k<EFBFBD><03><><0C>f<EFBFBD><66>N'a<><61><06><0E>b<EFBFBD>,<2C>V<EFBFBD><56><EFBFBD><EFBFBD>1<EFBFBD><31>HI!%6@<40><08>\$<EFBFBD>EGڜ<>1<EFBFBD>(mU<6D><55><EFBFBD>rս<72><03><>`<60><>iN+Ü<>)<29><><16>0l<30><6C>f0<66><06>[U<><55>V<EFBFBD><56>-:I^<5E><>\$<EFBFBD>s<EFBFBD>b\re<EFBFBD><EFBFBD>ug<75>h<EFBFBD>~9<>߈<EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>+0<><30> hXrݬ<72>!\$<EFBFBD>e,<2C>w+<2B><><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>_<10>A<EFBFBD>k<EFBFBD><6B>\nk<EFBFBD>r<EFBFBD>ʛcuWdY<64>\\<EFBFBD>={.<2E>č<EFBFBD><C48D><EFBFBD>g<><67>p8<70>t\rRZ<EFBFBD>v<EFBFBD>J:<3A>><3E><>Y|+<2B>@<40><><EFBFBD><EFBFBD>C<>t\r<EFBFBD><EFBFBD>jt<6A><74>6<><36>%<25>?<03><>ǎ<EFBFBD><C78E>><3E>/<0B><><EFBFBD><EFBFBD><EFBFBD>9F`ו<><D795>v~K<><4B><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>W<EFBFBD><57>z<EFBFBD><0C>lm<6C>wL<>9Y<39>*q<>x<EFBFBD>z<EFBFBD><7A>Se<53>ݛ<EFBFBD><DD9B><EFBFBD><EFBFBD>~<7E>D<1D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD>ɟi7<69>2<1F><><EFBFBD>Oݻ<07><>_{<EFBFBD><EFBFBD>53<EFBFBD><EFBFBD>t<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD>z<EFBFBD>3<EFBFBD>d)<29>C<EFBFBD><43>\$?KӪP<D3AA>%<25><>T&<26><0C>&\0P<EFBFBD>NA<EFBFBD>^<5E>~<7E><><EFBFBD>p<06> <20>Ϝ<><0F><>\r\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>b*+D6궦ψ<EAB6A6><CF88>J\$(<28>ol<6F><6C>h&<06><>KBS><3E><><EFBFBD>;z<><7A>x<EFBFBD>oz><3E><><EFBFBD>o<>Z<EFBFBD>\nʋ[<05>v<EFBFBD><76><EFBFBD>Ȝ<><C89C>2<EFBFBD>OxِV<D990>0f<30><66><EFBFBD><0F><>2Bl<42>bk<02>6Zk<5A>hXcd<>0*<2A>KT<4B><54>H=<3D><>π<>p0<70>lV<><56><0B><>\r<08><><EFBFBD>n<EFBFBD>m<EFBFBD><6D>)(<28>(<28>:#<23><><EFBFBD><EFBFBD>E<EFBFBD><45>:C<>C<EFBFBD><43><0B>\r<EFBFBD>G\ré0<><0E>i<0E><><0C><>:`Z1Q\n:<3A><>\r\0<EFBFBD><0B><>q<05><11><>:`<60>-<10>M#}1;<11><><EFBFBD><EFBFBD>q<11>#|<0E>S<11><><EFBFBD>hl<68>D<EFBFBD>\0fiDp<44>L<><4C>``<60><><EFBFBD><10>0y<30><79>1<><18><>\r<EFBFBD>=<10>MQ\\<0C><>%oq<><71>\0<EFBFBD><0B><>1<>21<32>1<7F><31> <20><18><>ќbi:<3A><>\r<EFBFBD>/Ѣ<> `)<29><>0<EFBFBD><19>@<40><15><1E>I1<>N<14>C<EFBFBD><43><EFBFBD><EFBFBD><17>O<11><>Z<EFBFBD><5A>1<><1E><>q1 <20><15><><EFBFBD>,<2C>\rdI<11>Ǧv<C7A6>j<EFBFBD><6A>1 t<>B<EFBFBD><42><EFBFBD>⁒0:<3A>0<0C><><EFBFBD>1<EFBFBD>A2V<32><56><EFBFBD>0<EFBFBD><30><1B><>%<25>fi3!&Q<>Rc%<25>q&w%<25><>\r<EFBFBD><EFBFBD>V<EFBFBD>#<23><><EFBFBD>Qw`<60>% <20><><EFBFBD>m*r<><10>y&i<>+r{*<2A><>(rg(<28>#(2<>(<28><>)R@i<>-<2D><> <20><><EFBFBD>1\"\0<EFBFBD><1A>R<EFBFBD><52><EFBFBD>.e.r<><1A>,<0C>ry(2<>C<EFBFBD><43><EFBFBD>b<EFBFBD>!Bޏ3%ҵ,R<>1<EFBFBD><31>&<26><>t<EFBFBD><74>b<EFBFBD>a\rL<EFBFBD><EFBFBD>-3<12><13><><0C><>\0<EFBFBD><0B>Bp<11>1<EFBFBD>94<39>O'R<>3*<2A><>=\$<EFBFBD>[<13>^iI;/3i<11>5<EFBFBD>&<26>}17<># ѹ8<D1B9><38>\"<EFBFBD>7<EFBFBD><EFBFBD>8<11>9*<2A>23<32>!<21><>!1\\\0<EFBFBD>8<EFBFBD><EFBFBD>rk9<13>;S<>23<32><0B>ړ*<2A>:q]5S<<3C><>#3<>83<38>#e<>=<13>>~9S螳<53>r<>)<29><>T*a<13>@і<>bes<><1B><1B>:-<2D><><EFBFBD><EFBFBD><EFBFBD>*;,<2C>ؙ3!i<><69><EFBFBD>LҲ<4C>#1 <20>+n<> <20>*<2A><>@<40>3i7<69>1<><04><>_<13>F<EFBFBD>S;3<>F<EFBFBD>\rA<EFBFBD><EFBFBD>3<>><3E>x:<3A> \r<EFBFBD>0<EFBFBD><EFBFBD>@<40>-<2D>/<0E><>w<15><>7<EFBFBD><37><EFBFBD>S<EFBFBD>J3<4A> <20>.F<>\$O<EFBFBD>B<EFBFBD><EFBFBD><EFBFBD>%4<>+t<>'g<>Lq\rJt<EFBFBD>J<EFBFBD><EFBFBD>M2\r<EFBFBD><EFBFBD>7<EFBFBD><EFBFBD>T@<40><><EFBFBD>)ⓣd<E293A3><64>2<32>P>ΰ<0E><>Fi<69>\nr\0<EFBFBD><12>b<EFBFBD>k(<28>D<EFBFBD><44><EFBFBD>KQ<4B><51><EFBFBD><EFBFBD>1<>\"2t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>P<14>\r<EFBFBD><EFBFBD>,\$KCt<EFBFBD>5<EFBFBD><EFBFBD>#<23><>)<29><>P#Pi.<0C>U2<>C<>~<7E>\"<EFBFBD>");}elseif($_GET["file"]=="functions.js"){header("Content-Type: text/javascript; charset=utf-8");echo
|
|||
|
lzw_decompress("f:<3A><>gCI<43><49>\n8<EFBFBD><EFBFBD>3)<29><>7<><37><EFBFBD>81<38><31>x:\nOg#)<29><>r7\n\"<EFBFBD><EFBFBD><EFBFBD>`<60>|2<1B>gSi<53>H)N<>S<EFBFBD><53><EFBFBD>\r<EFBFBD><EFBFBD>\"0<EFBFBD><EFBFBD>@<40>)<1D>`(\$s6O!<21><><EFBFBD>V/=<3D><>' T4<54>=<3D><>iS<69><53>6IO<49>G#<23>X<>VC<><43>s<EFBFBD><73>Z1.<2E>hp8,<1E>[<5B>H<EFBFBD><48>~Cz<43><7A><EFBFBD>2<EFBFBD>l<EFBFBD>c3<63><33><EFBFBD>s<EFBFBD><73><04>I<EFBFBD>b<EFBFBD>4\n<06>F8T<38><54>I<><49><1A>U*fz<66><04>r0<72>E<EFBFBD><13><><EFBFBD>y<1B><><EFBFBD>f<EFBFBD>Y.:<1C><14>I<EFBFBD><49>(<18>c<EFBFBD><63>!<21>_l<5F><6C>^<5E>^(<28><>N{S<EFBFBD><EFBFBD>)r<>q<EFBFBD>Y<EFBFBD><59>l٦3<D9A6>3<EFBFBD>\n<EFBFBD>+G<><47><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD>xV3w<17>uh<>^r<><72><EFBFBD><1E>a۔<61><DB94><EFBFBD>c<EFBFBD><63>\r<0E><><EFBFBD>(.<><C288>Ch<43><\r)<08>ѣ<EFBFBD>`<60>7<EFBFBD><37><EFBFBD>43'm5<><35><EFBFBD>\n<EFBFBD>P<EFBFBD>:2<>P<EFBFBD><50><EFBFBD><EFBFBD>q <20><><EFBFBD>C<EFBFBD>}ī<><C4AB><EFBFBD><EFBFBD><EFBFBD>38<33>B<18>0<EFBFBD>hR<1A><>r(<28>0<EFBFBD><30>b\\0<EFBFBD>Hr44<EFBFBD><EFBFBD>B<1A>!<21>p<EFBFBD>\$<EFBFBD>rZZ<1E>2܉.Ƀ(\\<EFBFBD>5<EFBFBD>|\nC(<28>\"<EFBFBD><03>P<13><02><>.<0B><>N<15>RT<52>Γ<><CE93>><04>HN<14><>8HP<>\\<EFBFBD>7Jp~<13><13><>2%<25><>OC<4F>1<EFBFBD>.<2E><>C8·H<><48>*<2A>j<EFBFBD><6A><04><1C>S(<0C>/<0C><><EFBFBD>6KU<4B><55><1E><><2<0C>pOI<4F><49><EFBFBD>`<60><><EFBFBD>ⳈdO<>H<EFBFBD><48>5<EFBFBD>-<2D><>4<EFBFBD><34>pX25-Ң<>ۈ<EFBFBD>z7<0C><>\"(<28>P<EFBFBD>\\32:]U<><0C><><EFBFBD>߅!]<5D><<3C>A<EFBFBD>ۤ<><DBA4><EFBFBD>iڰ<04>l\r<EFBFBD>\0v<EFBFBD><EFBFBD>#J8<4A><38>wm<77><6D>ɤ<><<3C>ɠ<EFBFBD><C9A0>%m;p#<23>`X<>D<EFBFBD><44><EFBFBD>iZ<69><5A>N0<4E><30><EFBFBD><EFBFBD>9<0B><>占<EFBFBD><E58DA0>`<13><>wJ<>D<EFBFBD><EFBFBD>2<EFBFBD>9t<39><74>*<1C><>y<EFBFBD><79>NiIh\\9<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<0E><><EFBFBD><05>xﭵyl*<2A>Ȉ<><17>Y<EFBFBD><59><17><><EFBFBD>8<EFBFBD>W<EFBFBD><57>?<3F><><EFBFBD>ޛ3<0C><><EFBFBD>!\"6<08><>n[<5B><>\r<EFBFBD>*\$<0C>Ƨ<EFBFBD>nzx<7A>9\r<EFBFBD>|*3ףp<D7A3>ﻶ<>:(p\\;<3B><>mz<1B><><EFBFBD>9<><1C><><EFBFBD>8N<18><><EFBFBD>j2<6A><32><14><>\r<EFBFBD>H<EFBFBD>H&<26><>(<28>z<EFBFBD><7A>7i<37>k<EFBFBD> <20><><EFBFBD><EFBFBD>c<EFBFBD><63>e<EFBFBD><65><EFBFBD><EFBFBD>t<EFBFBD><74><EFBFBD>2:SH<53>Ƞ<EFBFBD>/)<29>x<EFBFBD>@<40><>t<EFBFBD>ri9<69><39><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD>yҷ<79><D2B7><EFBFBD>V<EFBFBD>+^Wڦ<57><DAA6>kZ<6B>Y<EFBFBD>l<0E>ʣ<EFBFBD><0E><>4<03><>Ƌ<EFBFBD><C68B><05><><14><>\\E<EFBFBD>{<EFBFBD>7\0<EFBFBD>p<EFBFBD><12><>D<02><>i<EFBFBD>-T<><54><EFBFBD><EFBFBD>0l<30>%=<3D><><EFBFBD>˃9(<01>5<10>\n\n<EFBFBD>n,4<>\0<EFBFBD>a}܃.<2E><>Rs\02B\\<EFBFBD>b1<EFBFBD>S<EFBFBD>\0003,<2C>XPHJsp<>d<EFBFBD>K<> CA!<21>2*W<><13><><EFBFBD>2\$<EFBFBD>+<19>f^\n<EFBFBD>1<><31><EFBFBD><EFBFBD>zE<7A> Iv<49>\\<EFBFBD><EFBFBD>2<EFBFBD><03>.*A<><41><EFBFBD>E(d<07><><EFBFBD><EFBFBD>b<EFBFBD><1C>܄<EFBFBD><11>9<EFBFBD><39><EFBFBD><EFBFBD><EFBFBD>Dh<44>&<26><>?<10>H<>s<EFBFBD>Q<EFBFBD>2<EFBFBD>x~nÁJ<>T2<03>&<26><>eR<><52><EFBFBD>G<EFBFBD>Q<EFBFBD><51>Tw<54>ݑ<EFBFBD><DD91>P<02><><EFBFBD>\\<EFBFBD>)6<><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sh\\3<EFBFBD>\0R <19>'\r+*;R<1A>H<EFBFBD>.<2E>!<21>[<5B>'~<7E>%t< <20>p<EFBFBD>K#<>!<0E>l<EFBFBD><6C><EFBFBD>Le<><65><EFBFBD><12>,<06><><EFBFBD>&<26>\$ <09><>`<60><15>CX<43><0E>ӆ0֭<30><D6AD><EFBFBD><07><>:M<>h <09>ڜG<DA9C><47>!&3<>D<EFBFBD><!<21><>23<32><33>?h<>J<>e <20><>h<EFBFBD>\r<EFBFBD>m<EFBFBD><EFBFBD><EFBFBD>Ni<02><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>Hl7<6C><37>v<EFBFBD><76>WI<0C>.<0B><>-<2D>5֧ey<07>\rEJ\ni*<0B>\$@<40>RU0,\$U<1B>E<EFBFBD><45><EFBFBD><EFBFBD>ªu)@(t<>SJk<05>p!<02>~<7E><><EFBFBD>d`<60>><3E><>\n<0B>;#\rp9<70>jɹ<>]&Nc(r<><72><EFBFBD>TQU<51><55>S<EFBFBD><53>\08n`<60><>y<EFBFBD>b<EFBFBD><62><16>L<>O5<4F><35>,<2C><><EFBFBD><EFBFBD>><3E><><EFBFBD>x<EFBFBD><01><15>f䴒<66><E4B492><1B>+<2B><>\"<EFBFBD>I<EFBFBD>{kM<EFBFBD>[\r%<25>[ <09>e<0B>a<>1! <20><><EFBFBD><EFBFBD>Ԯ<EFBFBD>F@<40>b)R<><52>72<37><32>0<EFBFBD>\nW<16><><EFBFBD>L<EFBFBD>ܜҮtd<74>+<2B><><1C>0wgl<67>0n@<40><>ɢ<EFBFBD>i<EFBFBD>M<EFBFBD><4D>\nA<EFBFBD>M5n<EFBFBD>\$E<EFBFBD>ױN<><4E>l<EFBFBD><6C><12><><16>%<25>1 A<><41><EFBFBD><13><><EFBFBD>k<EFBFBD>r<EFBFBD>iFB<46><01><>ol,muNx-<2D>_<EFBFBD>֤C( <0E><>f<1C>l\r1p[9x(i<>BҖ<42><D296>zQl<51><6C>8C<03> <09><02>XU Tb<54><62>I<EFBFBD>`<60>p+V\0<EFBFBD><EFBFBD><EFBFBD>;<3B>Cb<43><62>X<EFBFBD>+ϒ<>s<EFBFBD><73>]H<><48>[<5B>k<EFBFBD>x<EFBFBD>G*<2A><><EFBFBD>]<5D>awn<77>!<21>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD>mS<6D><53><EFBFBD>I<EFBFBD><49>K<EFBFBD>~/<2F>ӥ7<D3A5><37>eeN<65><4E><EFBFBD><EFBFBD>S<EFBFBD>/;d<>A<EFBFBD>>}l~<7E><><EFBFBD> <20>%^<5E>f<>آpڜDE<44><45>a<EFBFBD><61>t\nx=<3D>kЎ<6B>*d<><64><04>T<16><><EFBFBD><EFBFBD>j2<><32>j<EFBFBD><6A>\n<EFBFBD><EFBFBD><EFBFBD> ,<2C>e=<3D><>M84<><34><EFBFBD>a<>j@<40>T<EFBFBD>s<EFBFBD><73><EFBFBD>nf<6E><66>\n<1A>6<EFBFBD>\rd<EFBFBD><10>0<EFBFBD><30><EFBFBD>Y<EFBFBD>'%ԓ<><18>~ <09>Ҩ<EFBFBD><<3C><10><0B>AH<EE8B96>G<1B><>8<EFBFBD><19><>\$z<1C><>{<EFBFBD><EFBFBD><EFBFBD>u2*<11><03>a<0F><>><17>(w<>K.bP<62>{<EFBFBD><EFBFBD>o<0F><01>´<0E>z<>#<23>2<0E>8=<3D>8><3E><><EFBFBD>A,<2C>e<EFBFBD><65><EFBFBD>+<2B>C<EFBFBD><43>x<EFBFBD>*<2A><><EFBFBD>-b=m<><6D><EFBFBD>,<2C>a<EFBFBD><61>lzk<7A><6B><EFBFBD>\$W<19>,<2C>m<EFBFBD>Ji<4A>ʧ<EFBFBD><CAA7><EFBFBD>+<2B><><EFBFBD>0<EFBFBD>[<0B><>.R<>sK<73><4B><1B>X<EFBFBD><1D>ZL<><4C>2<EFBFBD>`<17>(<28>C<EFBFBD>vZ<76><5A><EFBFBD><05><><02>\$<EFBFBD>,<2C>D?H<><48>NxX<16><>)<29><><EFBFBD>M<0F><>\$<EFBFBD>,<2C><>*\nѣ\$<q<19>şh!<21><>S<EFBFBD><17><><EFBFBD><EFBFBD>xsA!<21>:<04>K<EFBFBD><4B>}<7D><><04><><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD><52>A2k<32>X<EFBFBD>p\n<<3C><07><><EFBFBD><EFBFBD>l<EFBFBD><0E><>3<EFBFBD><33><EFBFBD><EFBFBD><1B>VV<56>}<7D>g&Yݍ!<21>+<2B>;<<3C>Y<EFBFBD><59><EFBFBD>YE3r<>َ<EFBFBD><06>C<EFBFBD>o5<6F><35><EFBFBD><EFBFBD>ճ<EFBFBD>kk<6B><6B><EFBFBD><EFBFBD><EFBFBD>ۣ<EFBFBD><DBA3>t<><74>U<EFBFBD><55><EFBFBD>)<29>[<5B><><EFBFBD><EFBFBD>}<7D><12>u<EFBFBD><75>l<15><>:D<><44>+Ϗ _o<5F><0C>h140<34><30><EFBFBD>0<EFBFBD><30>b<EFBFBD>K<EFBFBD>㬒<0C><><EFBFBD><EFBFBD><04>lG<6C><47>#<23><><EFBFBD><EFBFBD><EFBFBD><05><><EFBFBD><EFBFBD>|Ud<55><64>IK<08><><EFBFBD>7<EFBFBD>^<5E><><EFBFBD>@<40><>O\0H<04><04>Hi<48>6\r<EFBFBD><EFBFBD><02><>\\cg\0<EFBFBD><EFBFBD><EFBFBD>2<0E>B<05>*e<><65>\n<EFBFBD><EFBFBD> <09>zr<7A>!<21>nWz&<26> {H<><48>'\$X <20>w@<40>8<EFBFBD>DGr*<2A><><EFBFBD>H<>'p#<23>Į<EFBFBD><C4AE><EFBFBD>\nd<EFBFBD><EFBFBD><EFBFBD>,<2C><0F><>,<2C>;g~<0C>\0<EFBFBD>#<23><><05><>E<EFBFBD><45>\r<EFBFBD>I`<60><10>'<27><0F>%E<>.<2E>]`<60>Л<0E><0E>%&<04><>m<EFBFBD><6D>\r<EFBFBD><EFBFBD>%4S<34>v<EFBFBD>#\n<0E><>fH\$%<25>-<2D>#<23><><EFBFBD>qB<71><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Q-<2D>c2<63><32><EFBFBD>&<26><0C><>]<5D><> <20>qh\r<EFBFBD>l]<5D><>s<EFBFBD><73><07>h<EFBFBD>7<16>n#<23><><0C><>-<2D>jE<6A>Fr<46><72>l&d<0C><><EFBFBD><EFBFBD>z<EFBFBD>F6<46><36><EFBFBD><EFBFBD>\"<13><><EFBFBD>|<7C><><EFBFBD>s@<40><1A><><0E>z)0rpڏ\0<EFBFBD>X\0<EFBFBD><EFBFBD><EFBFBD>|DL<!<21><16>o<EFBFBD>*<2A>D<>{.B<E<><45><EFBFBD>0nB(<11> <20>|\r\n<EFBFBD>^<5E><06><><EFBFBD> h<>!<21><><EFBFBD>r\$<EFBFBD><EFBFBD>(^<5E>~<7E><><EFBFBD><EFBFBD>/p<>q<1F><10>B<EFBFBD><42>O<EFBFBD><07><><EFBFBD>,\\<EFBFBD><0F>#RR<52><0E>%<25><><EFBFBD>d<EFBFBD>Hj<48>`<60><05><><0B>̭ V<05> bS<62>d<EFBFBD>i<16>E<EFBFBD><06><>oh<6F>r<i/k\$-<2D>\$o<EFBFBD><EFBFBD>+<2B>ŋ<EFBFBD><C58B>l<EFBFBD><6C>O<EFBFBD>&evƒ<76>i<EFBFBD>jMPA'u'<27><><0C>( M(h/+<2B><>WD<57>So<53>.n<>.<0E>n<14><12><>(<28>(\"<EFBFBD><12><>h<EFBFBD>&p<><70>/<18>/1D̊<44>j娸E<1D><>&⦀<>,'l\$/.,<05>d<EFBFBD><64><EFBFBD>W<EFBFBD>bbO3<4F>B<EFBFBD>sH<11>:J`!<21>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><01><><EFBFBD>,F<><46>7(<08><>Կ<EFBFBD><0B>1<EFBFBD>l<EFBFBD>s <20>Ҏ<EFBFBD><D28E><EFBFBD>Ţq<C5A2>X\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>~R鰱`<60>Ҟ<04><>Y*<2A>:R<><52>rJ<72><13>%L<>+n<>\"<EFBFBD><EFBFBD>\r<EFBFBD><EFBFBD>͇H!qb<71>2<EFBFBD>Li<4C>%<25><><EFBFBD><13>Wj#9<><39>ObE.I:<0F>6<EFBFBD>7\0<EFBFBD>6+<2B>%<25>.<2E><0C><><05>a7E8VS<56>?(DG<44>ӳB<D3B3>%;<3B><><EFBFBD><EFBFBD>/<<3C><><EFBFBD><EFBFBD><EFBFBD>\r <20><07>><3E>QV<51>t/8<>c8<63>\$\0<04><><EFBFBD><EFBFBD>RV<>I8<49>RW<52><18><>\n<EFBFBD><EFBFBD>v<EFBFBD><EFBFBD>yC<EFBFBD><EFBFBD>-<2D>5F<35><46><EFBFBD>iQ0<51><30>_<EFBFBD>IE<49>sIR!<21><><EFBFBD>Xk<><04>z@<40><>`<60><05><>D<EFBFBD>`DV!C<>8<EFBFBD><38>\r<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>3<EFBFBD>!3<>@<40>33N}<7D>ZB<5A>3F.H}<7D>30<33><30>M(<28>><3E><>}<7D>\\<EFBFBD>t<EFBFBD><EFBFBD>f<EFBFBD>f<><66><EFBFBD>I\r<EFBFBD><0C><>337 X<>\"td<EFBFBD>,\nbtNO`P<>;<14>ܕҭ<05><><0E>\$\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Zѭ5U5WU<EFBFBD>^ho<1E><><EFBFBD>t<>PM/5K4Ej<07>KQ&53GX<47>Xx)<29><5D<0E>^<5E><><EFBFBD>V<EFBFBD>\n<EFBFBD>r<EFBFBD>5b܀\\J\"><3E><>1S\r[-<16><>Du<>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)00<30>Y<EFBFBD><59>ˢ<0C>k{\n<EFBFBD><EFBFBD>#<23><>\r<EFBFBD>^<5E><>|<7C>uܻU<DCBB>_n<5F>U4<55>U<EFBFBD>~Yt<59>\rI<EFBFBD><EFBFBD>@䏳<>R <20>3:<3A>uePMS<4D>0T<30>wW<77>X<><58><EFBFBD>D<EFBFBD><44><EFBFBD>KF5<46><35><EFBFBD><EFBFBD>;U<>\n<EFBFBD>OY<EFBFBD><EFBFBD>Y<EFBFBD>Q,M[\0<EFBFBD>_<EFBFBD>D<EFBFBD><EFBFBD><EFBFBD>W<EFBFBD><EFBFBD>J*<2A>\rg(]<5D><>\r\"ZC<EFBFBD><EFBFBD>6u<EFBFBD><EFBFBD>+<2B>Y<EFBFBD><0E>Y6ô<36>0<EFBFBD>q<EFBFBD>(<28><>8}<7D><>3AX3T<07>h9j<39>j<>fcMt<4D>PJbqMP5><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y<15>k%&\\<EFBFBD>1d<><64>E4<10> <20>Yn<59><6E><0C>\$<<3C>U]Ӊ1<D389>mbֶ<62>^<5E><><EFBFBD><EFBFBD><EFBFBD>\"NV<EFBFBD><EFBFBD>p<EFBFBD><EFBFBD>p<EFBFBD><EFBFBD>eM<EFBFBD><EFBFBD><EFBFBD>W<>ܢ<EFBFBD>\\<EFBFBD>)\n <20>\nf7\n<EFBFBD>2<0B>cr8<><38>=K7tV<74><56><EFBFBD><EFBFBD>7P<37><50>L<><4C>a6<0E><14>v@'<27>6i<><69>j&><3E><>;<3B><>`<60><>a \0pڨ(<28>J<EFBFBD><4A>)<29>\\<EFBFBD><EFBFBD>n<EFBFBD><EFBFBD>Ĭm\0<EFBFBD><EFBFBD>2<EFBFBD><04>eqJ<><4A>P<EFBFBD><50>h<EFBFBD><68><EFBFBD>fj<><6A>\"[\0<EFBFBD><EFBFBD><15><07>X,<\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0C><><EFBFBD>+md<6D><64>~<07><0C><><EFBFBD><EFBFBD>s%o<><6F>mn<6D>),ׄ<>ԇ<12>\r4<><34>8\r<EFBFBD><EFBFBD><0C><1C>mE<6D>H]<5D><><EFBFBD><EFBFBD><EFBFBD>HW<48>M0D<>߀
|
|||
|
lzw_decompress("v0<EFBFBD><EFBFBD>F<EFBFBD><EFBFBD><EFBFBD><EFBFBD>==<3D><>FS <09><>_6MƳ<4D><C6B3><EFBFBD>r:<3A>E<EFBFBD>CI<43><49>o:<3A>C<11><>Xc<58><63>\r<EFBFBD>J(:=<3D>E<EFBFBD><13><>a28<03>x<EFBFBD><78>?<0F>'<27>i<EFBFBD>SANN<02><><EFBFBD>xs<78>NB<><42>Vl0<6C><30><EFBFBD>S <09><>Ul<14>(D|҄<><D284>P<EFBFBD><50>><17>E<EFBFBD>㩶yHch<><68>-3Eb<45><62> <20>b<EFBFBD><62>pE<70>p<EFBFBD>9.<2E><><EFBFBD><EFBFBD>~\n<EFBFBD>?Kb<4B>iw|<7C>`<60><>d.<2E>x8EN<45><4E>!<21><>2<><05>3<EFBFBD><33><EFBFBD>\r<EFBFBD><1C><>Y<EFBFBD><59><EFBFBD>y6GFmY<6D>8o7\n\r<10>0<EFBFBD><30>\0<EFBFBD>Dbc<EFBFBD>!<21>Q7Шd8<64><38><EFBFBD>~<7E><>N)<1D>Eг`<60>Ns<4E><73>`<60>S)<29>O<EFBFBD><4F><0B><>/<2F><<0E>x<EFBFBD>9<EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3n<><6E>2<EFBFBD>!r<>:;<3B>+<2B>9<EFBFBD>CȨ<43><C8A8><EFBFBD>\n<<3C><>`<60><><EFBFBD>b<EFBFBD>\\<EFBFBD>?<3F>`<60>4\r#`<60><<3C>Be<0C>B#<1A>N <20><>\r.D`<60><>j<EFBFBD>4<EFBFBD><34><EFBFBD>p<EFBFBD>ar<61><72>㢺<>><3E>8<EFBFBD>\$<EFBFBD>c<EFBFBD><EFBFBD>1<EFBFBD>c<EFBFBD><EFBFBD><1D>c<EFBFBD><63><EFBFBD><04>{n7<12><><07><08>A<>N<15>RLi\r1<EFBFBD><EFBFBD><EFBFBD>!<21>(<28>j´<6A>+<2B><>62<36>X<>8+<18><05><><EFBFBD>.\r<EFBFBD><18><04><><EFBFBD>!x<><78><0E>h<EFBFBD>'<0C><><EFBFBD>6S<36>\0R<05><><EFBFBD><EFBFBD>O<EFBFBD>\n<EFBFBD><14>1(W0<57><30><EFBFBD><EFBFBD>7q<><71>:N<>E:68n+<2B><>մ5_(<28>s<EFBFBD>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/m<>6P<36>@<40>EQ<45><51><EFBFBD>9\n<EFBFBD>V-<2D><><EFBFBD>\"<EFBFBD>.:<3A>J<EFBFBD><4A>8we<77>q<EFBFBD>|؇<>X<EFBFBD>]<5D><>Y X<>e<EFBFBD>zW<7A><57> <20>7<EFBFBD><37>Z1<5A><31>hQf<51><66>u<EFBFBD>j<EFBFBD>4Z{p\\AU<EFBFBD>J<<3C><>k<><6B>@<40>ɍ<EFBFBD><C98D>@<14>}&<13><><EFBFBD>L7U<>wuYh<59><68>2<EFBFBD><32>@<40>u<EFBFBD> P<>7<EFBFBD>A<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>3Û<><1E>XEͅZ<CD85>]<5D>l<05>@Mplv<>)<01> <20><07>HW<48><05><>y><03>Y<59>-<2D>Y<EFBFBD><59>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0F>hC<68>[*<2A><>F<EFBFBD><46>#~<1F>!<21>`<60>\r#0P<10>C˝<43>f<03><><EFBFBD><0B><><EFBFBD>\\<EFBFBD><EFBFBD><0E>^<5E>%B<<3C>\\<EFBFBD>f<>ޱ<><DEB1><EFBFBD><EFBFBD><EFBFBD>&/<2F>O<EFBFBD><4F>L\\jF<EFBFBD><EFBFBD>jZ<EFBFBD>1<EFBFBD>\\:ƴ><04>N<EFBFBD><4E>XaF<61>A<EFBFBD><1B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>h{\"s\n<EFBFBD>64<EFBFBD><EFBFBD><EFBFBD><EFBFBD><16><>?<05>8<EFBFBD>^p<15>\"띰<EFBFBD>ȸ\\<EFBFBD>e(<28>P<05>N<EFBFBD><4E>q[g<><67>r<EFBFBD>&<26>}Ph<50><68><EFBFBD><EFBFBD>W<EFBFBD><57>*<2A><>r_s<5F>P<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD>om<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>#<23><0F><>.<2E>\0@<40>pdW <20>\$Һ<EFBFBD>Q۽Tl0<6C> <20><1D>HdH<64>)<29><>ۏ<><0C>)P<03><><EFBFBD>H<EFBFBD>g<04><>U<><55><EFBFBD><EFBFBD>B<>e\r<EFBFBD>t:<3A><>\0)\"<EFBFBD>t<EFBFBD>,<2C><><18><><EFBFBD>[<5B>(D<>O\nR8!<21>Ƭ֚<C6AC><D69A>lA<6C>V<EFBFBD><10>4<03>h<EFBFBD><1E>Sq<<15><>@}<7D><><EFBFBD>gK<67>]<5D><><EFBFBD>]<5D>=90<39><30>'<27><><1D><>wA<<3C><><EFBFBD><1D>a<EFBFBD>~<7E><>W<><57><EFBFBD>D|A<><41><EFBFBD>2<0E>X<EFBFBD>U2<55><32>yŊ<><C58A>=<05>p)<29>\0P <0C>s<0F><>n<EFBFBD>3<06><>r<EFBFBD>f\0<EFBFBD>F<EFBFBD><EFBFBD><EFBFBD>v<EFBFBD><EFBFBD>G<0C><01>I@<40>%<25><><EFBFBD>+<2B><>_I`<60><0C><><EFBFBD>\r.<2E><>N<EFBFBD><0F><>KI<4B>[<15>ʖSJ<53><05><>aUf<55>Sz<53><7A><EFBFBD>M<1F><><EFBFBD>%<25><>\"Q|9<04><>Bc<42>a<EFBFBD>q\0<EFBFBD>8<EFBFBD>#<23><a<><61>:z1Uf<15><>><3E>Z<10>l<EFBFBD><6C><01><><EFBFBD><EFBFBD>e5#U@iUG<47><C282>n<EFBFBD>%Ұs<><73><10>;gxL<07>pP<>?B<><42><EFBFBD>Q<EFBFBD>\\<15>b<1F><>龒Q<E9BE92>=7<>:<3A><0F>ݡQ<DDA1>\r:<3A>t<EFBFBD><74>:y(<28> <20>\n<EFBFBD>d)<29><07><>\n<EFBFBD>X;<3B><><EFBFBD><EFBFBD><11>CaA<61>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>P<EFBFBD>GH<EFBFBD>!<21><><EFBFBD>@<40>9\n\nAl~H<><48><EFBFBD>V\ns<><73>ի<EFBFBD>Ư<EFBFBD>bBr<42><72><EFBFBD><05><><06><><1A><>3<EFBFBD>\r<EFBFBD>P<EFBFBD>%<0B>ф\r}b/<2F>Α\$<EFBFBD>5<>P<EFBFBD>C<EFBFBD>\"w<13>B_<42><5F><EFBFBD>U<>gAt<41><74><EFBFBD><EFBFBD>夅<EFBFBD>^Q<><51>U<EFBFBD><01><>j<EFBFBD><6A><EFBFBD><EFBFBD>Bvh졄4<ECA184>)<29><>+<2B>)<<3C>j^<5E><L<><4C>4U*<2A><><EFBFBD>Bg<42><67><EFBFBD><EFBFBD><1C>*n<>ʖ<>-<2D><><EFBFBD><EFBFBD> 9O\$<EFBFBD><EFBFBD>طzyM<EFBFBD>3<0E>\\9<EFBFBD><EFBFBD><1E>.o<><6F><EFBFBD><EFBFBD><10><>E(i<><07><><0B><><EFBFBD>7 tߚ<74><DF9A>-&<26>\nj!\r<EFBFBD><EFBFBD>y<>y<EFBFBD>D1g<31><67><EFBFBD>]<5D><>yR<79>7\"<EFBFBD><EFBFBD><1D><13><><EFBFBD>~<10><><EFBFBD><EFBFBD>)TZ0E9M<39>YZtXe!<21>f<EFBFBD>@<40>{Ȭyl 8<>;<3B><><EFBFBD>R{<EFBFBD><EFBFBD>8<EFBFBD>Į<>e<EFBFBD>+UL<>'<27>F<>1<EFBFBD><04><>8PE5- <09>_!<21>7<EFBFBD><37><EFBFBD>[2<>J<EFBFBD><01>;<3B>HR<48><52>ǹ<>8p痲݇@<40><>0,ծpsK0\r<01>4<EFBFBD><34>\$sJ<73><0E><>4<EFBFBD>DZ<44><5A>I<0E><>'\$cL<EFBFBD>R<EFBFBD><EFBFBD>MpY&<1E><><EFBFBD><EFBFBD>i<EFBFBD>z3G<06>zҚJ%<25><>P<>-<2D><01>[<5B>/x<><78>T<EFBFBD>{p<EFBFBD><EFBFBD>z<>C<05>v<02><05><>:<3A>V'<27>\\<EFBFBD><EFBFBD>KJa<EFBFBD><EFBFBD>M<EFBFBD>&<26><><EFBFBD>Ӿ\"<EFBFBD><EFBFBD>e<13>o^Q+h^<5E><02>iT<69><54>1<EFBFBD>OR<4F>l<EFBFBD>,5[ݘ\$<EFBFBD><EFBFBD>)<29><>jLƁU`<60>S<EFBFBD>`Z^<5E>|<0F><>r<EFBFBD>=<3D><0F>n登<6E><E799BB>TU 1Hyk<79><6B>t+\0v<1C>D<EFBFBD>\r <<3C><>ƙ<EFBFBD><C699>jG<><1E><>t<EFBFBD>*3%k<>YܲT*<2A>|\"C<1E><>lhE<68>(<28>\r<EFBFBD>8r<EFBFBD><EFBFBD>{<EFBFBD><18>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD>_<EFBFBD><5F>.6и<EFBFBD>;<3B><><EFBFBD><EFBFBD>rBj<1B>O'ۜ<><DB9C><EFBFBD>>\$<EFBFBD><EFBFBD>`^6<><36>9<EFBFBD>#<19><><EFBFBD><14>4X<03><>mh8:<3A><>c<EFBFBD><06>0<1D><>;<3B>/ԉ<><D489><EFBFBD><EFBFBD>;<3B>\\'(<28><><EFBFBD>t<EFBFBD>'+<0B><1C><><EFBFBD><EFBFBD>̷<EFBFBD>^<0B>]<5D><>N<EFBFBD>v<EFBFBD><76>#<23>,<08>v<EFBFBD><76><EFBFBD>O<EFBFBD>i<>ϖ<EFBFBD>><3E><><S<0E>A\\<02>\\<EFBFBD><EFBFBD><EFBFBD>!<21>3*tl`<60>u<EFBFBD>\0p'<27>7<EFBFBD>P<EFBFBD>9<7F>bs<62>{<EFBFBD>v<EFBFBD>{<EFBFBD><EFBFBD>7<EFBFBD>\"{<EFBFBD><EFBFBD>r<EFBFBD>a<EFBFBD>(<28>^<5E><><EFBFBD>E<EFBFBD><45><EFBFBD><EFBFBD><EFBFBD>g<><67>/<2F><><EFBFBD>U<EFBFBD>9g<39><67><EFBFBD>/<2F><>`<60>\nL\n<EFBFBD>)<07><><14>(A<>a<EFBFBD>\" <20><03><> <09>&<26>P<EFBFBD><14>@O\n師0<>(M&<17>FJ'<27>! <20>0<EFBFBD><<3C>H<EFBFBD><48><EFBFBD><EFBFBD><0E><><EFBFBD>*<2A>|<7C><>*<2A>OZ<4F>m*n/b<>/<2F><><EFBFBD><EFBFBD><EFBFBD><0C><>.<2E><><EFBFBD>o\0<EFBFBD><EFBFBD>dn<EFBFBD>)<29><1E><><EFBFBD>i<EFBFBD>:R<><52><EFBFBD>P2<50>m<EFBFBD>\0/v<>OX<4F><58><1C>Fʳψ<CAB3><0F><><EFBFBD>\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<04>0<08><><EFBFBD><EFBFBD><16>0b<30><62>gj<><6A>\$<EFBFBD>n<EFBFBD>0}<05> <05>@<40>=MƂ0n<30>P<EFBFBD>/p<>ot<6F><10><><EFBFBD><EFBFBD><EFBFBD>.<12>̽<0B>g\0<EFBFBD>)o<>\n0<EFBFBD><EFBFBD><EFBFBD>\rF<><46><0B><07>b<EFBFBD>i<EFBFBD><69>o}\n<EFBFBD>̯<> NQ<0B>'<0B>x<EFBFBD>Fa<46>J<04><><EFBFBD><EFBFBD>L<EFBFBD><10><0F><><04><>\r<EFBFBD><EFBFBD>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<><07>'<0C><><EFBFBD>d oep<><13>4D<34><44>ʐ<>q(~<7E><> <20>\r<EFBFBD>E<10><>pr<70>QVFH<46>l<EFBFBD><6C>Kj<4B><6A><EFBFBD>N&<26>j!<21>H`<11>_bh\r1<EFBFBD><0C><>n!<21>Ɏ<>z<><7A><EFBFBD><13><><0C>\\<0F><>\r<EFBFBD><07><><EFBFBD>`V_k<5F><6B>\"\\ׂ'V<05><>\0ʾ`AC<><43><EFBFBD><EFBFBD><18><>V<EFBFBD>`\r%<25><><EFBFBD><02><><EFBFBD>\r<EFBFBD><EFBFBD><0E><>k@N<><4E><EFBFBD><EFBFBD>B<>횙<11> <20>!<21>\n<EFBFBD>\0Z<EFBFBD>6<>\$d<EFBFBD><EFBFBD>,%<03>%la<19>H<EFBFBD>\n<EFBFBD>#<23>S\$!\$@<40><>2<><32><EFBFBD>I\$r<EFBFBD>{!<21><>J<EFBFBD>2H<32>ZM\\<EFBFBD><EFBFBD>hb,<2C>'||cj~g<>r<EFBFBD>`<60>ļ<EFBFBD>\$<EFBFBD><EFBFBD><EFBFBD>+<2B>A1<41><31>E<1F><><1F><> <<3C>L<EFBFBD><11>\$<EFBFBD>Y%-FD<46><44>d<EFBFBD>L焳<><E784B3>\n@<40>bVf<56><66>;2_(<28><>L<EFBFBD>п<EFBFBD><05><%@ڜ,\"<EFBFBD>d<EFBFBD><EFBFBD>N<EFBFBD>er<EFBFBD>\0<EFBFBD><EFBFBD>`<60><0E>Z<0C><>4<EFBFBD>'ld9-<2D>#`<60><>Ŗ<EFBFBD><C596><EFBFBD><EFBFBD><EFBFBD>j6<6A>ƣ<EFBFBD>v<07><><04>N<EFBFBD>͐f<CD90><66>@܆<>&<26>B\$<0B><>(<28>Z&<26><><EFBFBD>278I <20><><EFBFBD>P\rk\\<EFBFBD><EFBFBD><EFBFBD>2`<60>\rdLb@E<14><>2`P( B'<27><0B><><0F><>0<EFBFBD>&<05><>{<EFBFBD><EFBFBD><EFBFBD>:<3A><>dB<64>1<EFBFBD>^؉*\r\0c<K<>|<06>5sZ<73>`<60><><EFBFBD>O3<4F>5=@<40>5<EFBFBD>C>@<40>W* =\0N<g<>6s67Sm7u? {<&L<04>.3~D<><44>\rŚ<0C>x<EFBFBD><13>),r<>in<>/<2F><>O\0o{0k<EFBFBD>]3>m<><05>1\0<EFBFBD>I@<40>9T34+ԙ@e<0F>GFMC<4D>\rE3<EFBFBD>Etm!<13>#1<>D @<40>H(<28><>n <20><><g,V`R]@<40><><EFBFBD><EFBFBD>3Cr7s~<7E>GI<>i@\0v<EFBFBD><EFBFBD>5\rV<EFBFBD>'<1A><><EFBFBD><0C><><08>P<05><>\r<EFBFBD>\$<b<>%(<28>Dd<44><64>PW<50><57><EFBFBD><EFBFBD>b<EFBFBD>fO <20>x\0<EFBFBD>} <20><0B><>lb<6C>&<26>vj4<>LS<1A><>ִԶ5&dsF M<>4<EFBFBD><18>\".H<>M0<4D>1uL<>\"<EFBFBD><EFBFBD>/J`<60>{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xǐYu*\"U.I53Q<33>3Q<33><51>J<EFBFBD><4A>g<EFBFBD><67>5<EFBFBD>s<><73><EFBFBD>&jь<6A><D18C>u<EFBFBD>٭ЪGQMTmGB<47>tl-c<>*<2A><>\r<02><>Z7<5A><37><1B>*hs/RUV<55><56><EFBFBD><EFBFBD>B<EFBFBD>Nˈ<4E><CB88><06><><EFBFBD>Ԋ<>i<EFBFBD>Lk<4C>.<2E><><EFBFBD>t<EFBFBD><74>龩<EFBFBD>rYi<59><69><EFBFBD>-S<><53>3<EFBFBD>\\<EFBFBD>T<EFBFBD>OM^<5E>G><3E>ZQj<51><07><>\"<EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><EFBFBD>MsS<EFBFBD>S\$Ib f<><13><>u<EFBFBD><75><08><><EFBFBD>:<04>SB|i<><69>Y¦<0F><>8 v<07>#<02><>D<EFBFBD>4`<60><>.<2E><>^<5E>H<EFBFBD>M<EFBFBD>_ռ<5F>u<EFBFBD><75>U<EFBFBD>z`Z<>J e<><65><EFBFBD>@Ce<43><65>a<EFBFBD>\"m<>b<12>6ԯJR<4A><EFBFBD><0C>T<EFBFBD>?ԣXMZ<4D><5A>І<EFBFBD><D086>p<EFBFBD><70><0F><>Qv<51>j<13>jV<6A>{<EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>\r<EFBFBD><EFBFBD>7<16>Tʞ<54> <20><>5{P<EFBFBD><EFBFBD>]<12>\r<EFBFBD>?Q<>AA<41><41><07><><EFBFBD><EFBFBD>2V)Ji<><69>-N99f<39>l Jm<><6D>;u<>@<40><F<>Ѡ<EFBFBD>e<EFBFBD>j<0C><>Ħ<>I<EFBFBD><+CW@<40><><18><><EFBFBD>Z<EFBFBD>l<EFBFBD>1<EFBFBD><2<>iF<69>7`KG<4B>~L&+N<08><>YtWH飑w <0E><1A><><19>l<EFBFBD><6C>s'g<04><>q+L<>zbiz<69><7A><EFBFBD>Ţ<EFBFBD>.Њ<>zW<7A><57> <20>zd<06>W<EFBFBD><57><EFBFBD><EFBFBD>(<17>y)v<>E4,\0<EFBFBD>\"d<><64>\$B<EFBFBD>{<EFBFBD><EFBFBD>!)1U<31>5bp#<23>}m=<3D><>@<40>w<12> P\0<EFBFBD>\r<EFBFBD><0C><><EFBFBD><EFBFBD>`O|<7C><><0E> <09>ɍ<EFBFBD><C98D><EFBFBD><EFBFBD>Y<EFBFBD><59>JՂ<15>E<EFBFBD><45>Ou<4F>_<EFBFBD>\n`F`<60>}
|
|||
|
get_lang(){global$ca;return$ca;}function
|
|||
|
lang($u,$kf=null){if(is_string($u)){$hg=array_search($u,get_translations("en"));if($hg!==false)$u=$hg;}global$ca,$xi;$wi=($xi[$u]?$xi[$u]:$u);if(is_array($wi)){$hg=($kf==1?0:($ca=='cs'||$ca=='sk'?($kf&&$kf<5?1:2):($ca=='fr'?(!$kf?0:1):($ca=='pl'?($kf%10>1&&$kf%10<5&&$kf/10%10!=1?1:2):($ca=='sl'?($kf%100==1?0:($kf%100==2?1:($kf%100==3||$kf%100==4?2:3))):($ca=='lt'?($kf%10==1&&$kf%100!=11?0:($kf%10>1&&$kf/10%10!=1?1:2)):($ca=='bs'||$ca=='ru'||$ca=='sr'||$ca=='uk'?($kf%10==1&&$kf%100!=11?0:($kf%10>1&&$kf%10<5&&$kf/10%10!=1?1:2)):1)))))));$wi=$wi[$hg];}$Fa=func_get_args();array_shift($Fa);$hd=str_replace("%d","%s",$wi);if($hd!=$wi)$Fa[0]=format_number($kf);return
|
|||
|
vsprintf($hd,$Fa);}function
|
|||
|
switch_lang(){global$ca,$pe;echo"<form action='' method='post'>\n<div id='lang'>",lang(19).": ".html_select("lang",$pe,$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($pe[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($pe[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$va=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$Ge,PREG_SET_ORDER);foreach($Ge
|
|||
|
as$A)$va[$A[1]]=(isset($A[3])?$A[3]:1);arsort($va);foreach($va
|
|||
|
as$y=>$xg){if(isset($pe[$y])){$ca=$y;break;}$y=preg_replace('~-.*~','',$y);if(!isset($va[$y])&&isset($pe[$y])){$ca=$y;break;}}}$xi=$_SESSION["translations"];if($_SESSION["translations_version"]!=824099529){$xi=array();$_SESSION["translations_version"]=824099529;}function
|
|||
|
get_translations($oe){switch($oe){case"en":$g="A9D<07>y<EFBFBD>@s:<3A>G<EFBFBD><47>(<28>ff<66><66><EFBFBD><EFBFBD><EFBFBD> <09><>:<1B>S<><53><EFBFBD>a2\"1<>..L'<27>I<EFBFBD><49>m<EFBFBD>#<23>s,<2C>K<17><>OP#I<>@%9<><39>i4<08>o2ύ<32><CF8D><EFBFBD><EFBFBD><EFBFBD>,9<>%<02>P<EFBFBD>b2<19><06>a<EFBFBD><61>r\n2<EFBFBD>NC<>(<28>r4<72><34>1C`(<28>:Eb<45>9A<14>i:<02>&㙔<>y<EFBFBD><79>F<><46><EFBFBD>Y<><59>\r<13>\n<EFBFBD> 8Z<0E>S=\$A<19><><0C><13>`<60>=<3D>܌<EFBFBD><DC8C><EFBFBD>0<EFBFBD>\n<EFBFBD><EFBFBD>dF<EFBFBD> <09><>n:Zΰ)<29><>Q<EFBFBD><51><EFBFBD>mw<6D><77><EFBFBD><EFBFBD>O<EFBFBD><4F>mfpQ<10><><CE82>q<><71>a<EFBFBD>į<EFBFBD>#q<><71>w7S<37>X3<58><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD>\n>Z<>M<EFBFBD>zi<7A><69>s;<3B>̒<EFBFBD><CC92>_<EFBFBD>:<3A><><EFBFBD>#|@<40>46<34><36>:<3A>\r-z|<7C>(j*<2A><><0E>0<EFBFBD>:-h<><68>/̸<>8)+r^1/Л<>η,<2C>ZӈKX<4B>9,<2C>p<EFBFBD>:>#<23><><08>(<28>6<EFBFBD>qC<71><43><EFBFBD>I<EFBFBD>|<7C><>Ȣ,<2C>(y <20>, %b{<06>ʢ<><CAA2><0B>9B<39><42>)B<><42><16><>+<2B>1><3E>P\r<EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>L<EFBFBD>P<EFBFBD>2\r<EFBFBD>\\*<2A><>Jb<0E>=m<><6D>1<EFBFBD>jH<6A><48><EFBFBD>O\$<EFBFBD><EFBFBD><EFBFBD><03><>4 <20>jF<6A>o<><6F><01>F4 #0z\r<03><>8a<>^<17><>\\<EFBFBD>N-<2D><><EFBFBD><EFBFBD><EFBFBD>|<7C>єp<D194>2<05><12>\r<EFBFBD>:x7<0C><<3C>ص<EFBFBD><D8B5>^0<><30>#<23>2<EFBFBD>jk6<6B><36>@<40><><EFBFBD><03><><EFBFBD><EFBFBD><EFBFBD><08>ΎA&2<><32>u<EFBFBD>\n<EFBFBD>1<EFBFBD><EFBFBD>lĠ+<2B><>s<EFBFBD> <09><><08><<3C><>M<EFBFBD>]l<>&!<21><>b_2<5F><32><EFBFBD>Oz\r<EFBFBD><EFBFBD>a7<0E><><EFBFBD>1<EFBFBD>7<EFBFBD><37><EFBFBD><0C><08>i<EFBFBD><69>\r<EFBFBD>ӊv<1D>è<>b<EFBFBD><62><EFBFBD><EFBFBD>3<EFBFBD><33><08><>c2<63>N1<4E>\0S<EFBFBD><<3C><><02>=<3D>PȤϭc<CFAD><63>%<25><><EFBFBD><EFBFBD><08><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD>accC<1F><><1B><>\n\"`@<40>_<EFBFBD>d<EFBFBD>7<EFBFBD>(<28><>[V<>n<>6<EFBFBD><36>9<EFBFBD><39><08>h8<>k<EFBFBD><04>/k˯K,<2C>)<0C>+Z\"<EFBFBD><13><1E><><EFBFBD><EFBFBD><1B>\"MF<4D><46><EFBFBD><EFBFBD><EFBFBD>'iʌB\r<13><>0<EFBFBD>6NRL<52>D<EFBFBD>B<EFBFBD>ލMpt<F28DAF96>F<EFBFBD><46>^s1<73>t<EFBFBD>!ͺ\n<EFBFBD>p<EFBFBD>7}K<><4B>`O-<2D>d<EFBFBD><64>>O<><0E>6t<36><74>P<EFBFBD>c<EFBFBD>_W<5F>6W<36>P<EFBFBD><50><EFBFBD>pҐ<70>b<EFBFBD><62>#2<>x<EFBFBD>#<05>\"<EFBFBD>2<EFBFBD>I]xP<><50><0C>L<EFBFBD><4C>tZP*1n<31>}\\گ<EFBFBD>7ԫ<37> <20>@<40>}<7D>I1T<31>/L<>t<EFBFBD>><3E>C<EFBFBD><43>N <09>S<EFBFBD>%R<><52>9W<><57>X<EFBFBD><58><12>j<>X F<><46>I<0C>@<40><><EFBFBD><EFBFBD><EFBFBD>˩-d<><64>\$<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD><17>\$<EFBFBD>꿅(T<><54>SJqO*D<> .U\n<EFBFBD>\$T<EFBFBD><15>s<07><><0E>h\$<0F><> F<><46>7<EFBFBD>0<><1E><>=<3D><>4<EFBFBD>(<28><>zw=G<>%<1F><><EFBFBD><11><>>nU<6E>'<27><16>I3B<33>`9><3E>hHCfknyܺ(A<0F><>l<EFBFBD><6C>4<>4<EFBFBD><34>K0<>E<><45>[<5B><>B?<3F>h<EFBFBD><68>bj<02>H\n-<01>b|\n\n\0)\$D<04><<3C>Lh<4C>B<EFBFBD>\r<EFBFBD><EFBFBD><EFBFBD>עdq2<><32><EFBFBD><13>@yɉ3<C989><33><EFBFBD>7<<3C> kc<6B><63><EFBFBD>!<21><>><3E><>O <09>#g<>><3E><><EFBFBD><EFBFBD><03>2 l<>(S><3E>\"QiS+<2B><>&<26>~M)%d<><64><EFBFBD><EFBFBD>6<EFBFBD>O<EFBFBD><4F>0<EFBFBD><<3C><>p<EFBFBD>O<EFBFBD>z}&<26><>Hc<>Z<EFBFBD>\$H\$<EFBFBD>A<><41>!<21><05><><1F>@@C<><43>*\$<EFBFBD><EFBFBD><EFBFBD><07>#<23><>dx<64><78><EFBFBD>|{<EFBFBD><EFBFBD><EFBFBD>r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\0<EFBFBD>£W/T)U<>5h<35>BZ<42><5A><EFBFBD>P״<50>_<EFBFBD>%9<>ɐE<C990><45>@X<><58>%)<29><><EFBFBD>2G<32><02>TT)<29><>H<EFBFBD><48><EFBFBD>#<08>RI<52><49><EFBFBD>܍<EFBFBD>x<EFBFBD><78>̃<EFBFBD>\"<EFBFBD>Pձi;/M'\0<EFBFBD>\\L<EFBFBD>je <09>8P<>T<08>*<2A><>\0<EFBFBD>B`E<>M<EFBFBD>z<EFBFBD>s}\r:Z<><5A>-\n<EFBFBD>sN0gg<67><<3C><><EFBFBD>&<26><><EFBFBD><EFBFBD>%!<21><><11>j<>9<EFBFBD>TuZ<75><5A>i-<2D>]L<05><>7<EFBFBD>,b<>RHǐ<48><C790><EFBFBD>f<EFBFBD>\\2Ʋ́<EFBFBD>\"<05>xN<78>P0n|<7C>9<02><02><>'<27>(<28> <09><>8~Ha>JrD<><44>`èg\rBIID<49>!<21><>bc<62><<3C>[ҁb<D281><62>l<>zU<7A><16>M<15>'K<>̓<>h!<21>K<EFBFBD><12><><EFBFBD><EFBFBD>H[Zh<5A><68><EFBFBD><EFBFBD><<3C>vHV<48><56>\n<EFBFBD><EFBFBD>l]<5D><>^<5E>xxC-i\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>I<><49>@dV<64>K<EFBFBD>n<0C>ڨ<EFBFBD>z<EFBFBD>K(T-,9W<39><16><>I<EFBFBD>J<EFBFBD>B*<1B>`<60>KZ/ <09><06>1Etg,Z<>NHL\"<EFBFBD><EFBFBD>`<60><><05>o(<28>l%J<>C \0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0d<EFBFBD><EFBFBD>O<07>Y<EFBFBD>S<EFBFBD><53>^=F˼<17>HLw]<5D>@<40>!0<>l<EFBFBD><6C>OX<4F><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>~Q\$N:<3A><><EFBFBD><13><><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>.<0C><>2<EFBFBD><32><EFBFBD>a<EFBFBD>2<EFBFBD>3<02><1C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><12>ߒ<EFBFBD>U<EFBFBD>͗<EFBFBD>7<04>]<5D><><EFBFBD>X<EFBFBD><58>/-<2D>L<EFBFBD>]t<13>f<EFBFBD>Ħ<EFBFBD>&Q <09><1C> wL<1F>:G<>ӌ<<3C><><1F>0<EFBFBD>AjhrJ`(+<2B>P<EFBFBD>o<12>?'<)1md<6D><08>pHGd<47>Œa5<61>l<EFBFBD>Y\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>9eg<>*j<>ËhI3<49><33>œ<EFBFBD>4vYyȖ{H<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5,<2C>X<>oi<6F><1D><>ɻ/<><D789><EFBFBD>ϵ<EFBFBD><CFB5>PC<11>*n<><6E><EFBFBD>rԖ{բn<EFBFBD><EFBFBD>f<EFBFBD><EFBFBD>cވ<EFBFBD><EFBFBD><03><><EFBFBD>,0aL2[P#<23>gQ<67><0B>F<EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>~<7E><><EFBFBD><EFBFBD>AnlXz<13>h<>Y<EFBFBD><05><16>x氧<78><05><>+b<>\r<EFBFBD>d3<><33>In<49>\r<EFBFBD><EFBFBD>-<2D>f<EFBFBD>%<25><>vU<76><55><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><01>э<0F>ݽ<EFBFBD><DDBD>D~<7E>rϦ<72>><3E><>,<2C><><EFBFBD><EFBFBD><EFBFBD>)<29>5'<27><>B<><42>{<EFBFBD><EFBFBD><EFBFBD>'d<><64><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>1KN]<5D>x4bdMs<4D><73><EFBFBD><11>:,\\<EFBFBD><14>T<EFBFBD><54>t<74><D7BB><EFBFBD>fd<>ڛ<06><>7<EFBFBD><37><0E><>aƂ\n<EFBFBD><EFBFBD>:<3A>Z<EFBFBD>X<EFBFBD><58><EFBFBD>/-<2D><<3C>\0<EFBFBD><EFBFBD>LZ<4C>\\p1M<EFBFBD><EFBFBD>ܟ<12>ɦ;S<><53><EFBFBD>!<21>Lʈ<17><><EFBFBD>\n<EFBFBD>_<EFBFBD>[O<>D<>W<EFBFBD>V<EFBFBD>g0^<><C295>^G<>Ot<4F><74>]P<><50>;<3B><><1F><><EFBFBD><EFBFBD><EFBFBD>}'F<>4<EFBFBD><34><EFBFBD>o<EFBFBD><6F><EFBFBD>~jY<6A><15><>;c<>ކ<EFBFBD>z8<7A><38><1B><>X<>5~<7E><>g<EFBFBD><1F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\)<29><06>-<2D><><05><0C><><EFBFBD>F<EFBFBD>\0<EFBFBD><EFBFBD>5P/ <20>5<EFBFBD><35>Jb<4A> <09><14><><EFBFBD><EFBFBD><EFBFBD>\")*<2A><>#b<>N<EFBFBD><4E><0F>%\0<EFBFBD>P<<3C><0E><>H<EFBFBD>p:<3A><><EFBFBD>\0If<EFBFBD><EFBFBD><EFBFBD>t&.<2E><>`<60>\0<EFBFBD>O<EFBFBD><EFBFBD>ZDdg<64><67><EFBFBD>@20n<30><6E>V<EFBFBD><56><EFBFBD>!#<23>,<2C>`b,z<><7A><EFBFBD><EFBFBD>/<2F>XP<58><50><EFBFBD><02>Ф6p<36><70><EFBFBD>P%j/<2F><>_oF<6F><46><EFBFBD>r<EFBFBD><72> <09>C<0C>0<EFBFBD><30>\\<EFBFBD>pk P<><50>oj4<6A>\$<EFBFBD>\$*<2A>\$ތ&<26>O<EFBFBD><4F><EFBFBD><EFBFBD><0E><>\n<EFBFBD><EFBFBD>\r<EFBFBD>R<EFBFBD>)b1,\n<EFBFBD>G0\n<EFBFBD>y<0C><>%<0E>>&0<>J<EFBFBD><4A>\n͌<D\0K<EFBFBD>T<EFBFBD>\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>zCN]<5D><><EFBFBD><EFBFBD><EFBFBD>\rh<EFBFBD><EFBFBD><EFBFBD>P<EFBFBD>d<EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>X<><58>B#<23>~<7E><><EFBFBD>#\"<EFBFBD>-<2D><><EFBFBD>1t\\M<EFBFBD><12><>έ]<5D><><EFBFBD><EFBFBD>f<EFBFBD>/\0`<60>B\0<EFBFBD>j\r <20>\rmvP.#0<><30><EFBFBD><0C>6/'<0F><>V\n<EFBFBD><EFBFBD><08>Zz5<7A><35>9<EFBFBD><39><EFBFBD>/<2F>%<25>>m<10>ͼ<EFBFBD>.<2E>L<><4C>b&G#0p<30><EFBFBD><C298>o<EFBFBD><6F><1B><><EFBFBD>\0ث\$&6<><36>b<>.<2E><><EFBFBD>)NV<4E><56>Dz4<11>rJrV<72>8<EFBFBD><38><EFBFBD>\$fKC<4B>!+^\n<EFBFBD>'<0B>ab<61>߂<EFBFBD><1E>N<EFBFBD>%<25>b<EFBFBD>о<EFBFBD>Z<EFBFBD>\r౭<EFBFBD><EFBFBD>2]<05><><EFBFBD><EFBFBD><06><>v<EFBFBD><10><>riQ<><51>f<EFBFBD>6\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(\n<EFBFBD><EFBFBD>+jo,<06>ohurC0L<>N<EFBFBD><4E>@<40>vd<76>F<12><>&y+<2B>N<EFBFBD><4E>R0<52>`O`<60>%<25>ȯ<EFBFBD><C8AF>Z\"<EFBFBD>\"vl<1A><>=<3D>2r<32><72>bƌ92\n5C0)<29>T<EFBFBD>D<EFBFBD>0+<2B>ʰ<><CAB0><0E>л<EFBFBD><D0BB><0B>jk<6A>ro<72><6F>)<29><><EFBFBD><EFBFBD>DK<05><0C>ZML<><4C><EFBFBD>*M3<>@<40><><EFBFBD><EFBFBD>3F<05>";break;case"ar":$g="<EFBFBD>C<EFBFBD>P<EFBFBD><><C28D>l*<2A>\r<EFBFBD>,&\n<EFBFBD>A<EFBFBD><15><><EFBFBD>(J.<19><>0Se\\<EFBFBD>\r<EFBFBD><EFBFBD>b<>@<40>0<>,\nQ,l)<29><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>A<14><>j_1<5F>C<EFBFBD>M<EFBFBD><4D>e<0B><>S<>\ng@<40>Og<4F><67><EFBFBD><EFBFBD>X<EFBFBD>DM<44>)<29><>0<18><>cA<63><41>n8<1C>e*y#au4<75><34> <20>Ir*;rS<72>U<>dJ }<7D><><EFBFBD>*z<>U<12>@<40><>X;ai1l(n<><1B><><EFBFBD><EFBFBD><EFBFBD>[<14>y<EFBFBD>d<EFBFBD>u'c(<28><>oF<><46><EFBFBD><EFBFBD>e3<65>Nb<03><><EFBFBD>p2N<>S<EFBFBD><53>ӳ:LZ<4C>z<EFBFBD>P<EFBFBD>\\b<EFBFBD><EFBFBD>u<EFBFBD>.<2E>[<5B>Q`u !<15><>Jy<4A><79>&2<11><>(gT<1C><>SњM<D19A>x<EFBFBD>5g5<67>K<EFBFBD>K<EFBFBD>¦<EFBFBD><C2A6><EFBFBD><EFBFBD><EFBFBD>0ʀ(<28>7\rm8<EFBFBD>7(<28>9\r<EFBFBD><EFBFBD>f\"7N<10>9<EFBFBD><39> <20><>4<EFBFBD>x荶<78><E88DB6><0B>x<>;<3B>#\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2ɰW\"J\nB<EFBFBD><EFBFBD>'hk<0C>ūb<14>Di<44>\\@<40><><EFBFBD>p<EFBFBD><70><EFBFBD>yf<79><66><EFBFBD>9<08><><EFBFBD><EFBFBD>V<EFBFBD>?<3F>TXW<58><57><EFBFBD>F<EFBFBD><46>{<EFBFBD><EFBFBD>3)\"<EFBFBD>W9<EFBFBD>|<7C><>eRhU<68><55>Ҫ<EFBFBD>1<EFBFBD><31>P<EFBFBD>><3E><><02>\"o{<EFBFBD>\"7<EFBFBD>^<5E><>pL\n7OM*<2A>O<><18><7cp<63>4<EFBFBD><34>Rfl<66>N<EFBFBD><4E>SJ<53><4A>\\E<EFBFBD><EFBFBD>V<EFBFBD>J<EFBFBD>+<2B>#<23><><EFBFBD>܇Jr<4A> <20>><3E>J<><4A>(ꆶ\$(<28>R<EFBFBD>M<EFBFBD><4D>v<EFBFBD>GI<47><0C><><0E><><EFBFBD>ťr<C5A5><72>Wj<57>|<7C>\"v<06><><14>< <20><>k<EFBFBD><10>(<28><><EFBFBD><EFBFBD>3\r<EFBFBD><08>1<EFBFBD>T[<5B>nڰh<DAB0><07><><EFBFBD><EFBFBD><EFBFBD><DEB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\0<EFBFBD>2<05>\0yw<EFBFBD><03><>3<07><10>:<0E><><EFBFBD><05>x<78>\r<EFBFBD>i<EFBFBD>PH<EFBFBD><17><>p_<0E>p<EFBFBD>B<17>J`|6<>-+<2B>3A#kuF\r<EFBFBD><EFBFBD>^0<><30>zC<16>ܪ<><DCAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<0C><>j<EFBFBD>Q8<51><38><EFBFBD><EFBFBD><EFBFBD><05>u,15<31><35><EFBFBD>XrZTƖ<54><C696>n<EFBFBD>\"@P<>0<EFBFBD>Cs<43>3<EFBFBD><33>(<28>Z(<08>f<EFBFBD><66><EFBFBD>\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD><1B><>:<3A><16>Yk<59><6B><12>U<EFBFBD><55><<08><><EFBFBD>:<3A><><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD>ŋ<EFBFBD>l<EFBFBD>SR<53><52><EFBFBD><EFBFBD>i<EFBFBD>Z<EFBFBD><5A>)<29>v<EFBFBD>kR<<3C><>J<EFBFBD>#[<5B>q77WSI<53>Y<ь<>l<16>MT<4D><16><>K<EFBFBD><4B><EFBFBD>#oci@<40>c<18>7S<37><04><><EFBFBD>b<EFBFBD><62><EFBFBD>!<21>jh<6A>;[3<><33>!{<EFBFBD>cT<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\!>6}<7D>TT<54>o<EFBFBD>1lk<6C>Ȧg<>[<5B><><EFBFBD>H<EFBFBD><48>rǙ`yٍr<D98D>1<EFBFBD><31>a<EFBFBD><61>]<5D>7<EFBFBD><37>(v<>
|
|||
|
Min_PDO
|
|||
|
extends
|
|||
|
PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
__construct(){global$b;$hg=array_search("SQL",$b->operators);if($hg!==false)unset($b->operators[$hg]);}function
|
|||
|
dsn($lc,$V,$E,$Af=array()){try{parent::__construct($lc,$V,$E,$Af);}catch(Exception$Cc){auth_error(h($Cc->getMessage()));}$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=@$this->getAttribute(4);}function
|
|||
|
query($F,$Fi=false){$G=parent::query($F);$this->error="";if(!$G){list(,$this->errno,$this->error)=$this->errorInfo();if(!$this->error)$this->error=lang(21);return
|
|||
|
false;}$this->store_result($G);return$G;}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result($G=null){if(!$G){$G=$this->_result;if(!$G)return
|
|||
|
false;}if($G->columnCount()){$G->num_rows=$G->rowCount();return$G;}$this->affected_rows=$G->rowCount();return
|
|||
|
true;}function
|
|||
|
next_result(){if(!$this->_result)return
|
|||
|
false;$this->_result->_offset=0;return@$this->_result->nextRowset();}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!$G)return
|
|||
|
false;$I=$G->fetch();return$I[$o];}}class
|
|||
|
Min_PDOStatement
|
|||
|
extends
|
|||
|
PDOStatement{var$_offset=0,$num_rows;function
|
|||
|
fetch_assoc(){return$this->fetch(2);}function
|
|||
|
fetch_row(){return$this->fetch(3);}function
|
|||
|
fetch_field(){$I=(object)$this->getColumnMeta($this->_offset++);$I->orgtable=$I->table;$I->orgname=$I->name;$I->charsetnr=(in_array("blob",(array)$I->flags)?63:0);return$I;}}}$gc=array();class
|
|||
|
Min_SQL{var$_conn;function
|
|||
|
__construct($h){$this->_conn=$h;}function
|
|||
|
select($Q,$K,$Z,$pd,$Cf=array(),$z=1,$D=0,$pg=false){global$b,$x;$ae=(count($pd)<count($K));$F=$b->selectQueryBuild($K,$Z,$pd,$Cf,$z,$D);if(!$F)$F="SELECT".limit(($_GET["page"]!="last"&&$z!=""&&$pd&&$ae&&$x=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$K)."\nFROM ".table($Q),($Z?"\nWHERE ".implode(" AND ",$Z):"").($pd&&$ae?"\nGROUP BY ".implode(", ",$pd):"").($Cf?"\nORDER BY ".implode(", ",$Cf):""),($z!=""?+$z:null),($D?$z*$D:0),"\n");$Gh=microtime(true);$H=$this->_conn->query($F);if($pg)echo$b->selectQuery($F,$Gh,!$H);return$H;}function
|
|||
|
delete($Q,$zg,$z=0){$F="FROM ".table($Q);return
|
|||
|
queries("DELETE".($z?limit1($Q,$F,$zg):" $F$zg"));}function
|
|||
|
update($Q,$N,$zg,$z=0,$L="\n"){$Yi=array();foreach($N
|
|||
|
as$y=>$X)$Yi[]="$y = $X";$F=table($Q)." SET$L".implode(",$L",$Yi);return
|
|||
|
queries("UPDATE".($z?limit1($Q,$F,$zg,$L):" $F$zg"));}function
|
|||
|
insert($Q,$N){return
|
|||
|
queries("INSERT INTO ".table($Q).($N?" (".implode(", ",array_keys($N)).")\nVALUES (".implode(", ",$N).")":" DEFAULT VALUES"));}function
|
|||
|
insertUpdate($Q,$J,$ng){return
|
|||
|
false;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
commit(){return
|
|||
|
queries("COMMIT");}function
|
|||
|
rollback(){return
|
|||
|
queries("ROLLBACK");}function
|
|||
|
slowQuery($F,$ii){}function
|
|||
|
convertSearch($u,$X,$o){return$u;}function
|
|||
|
value($X,$o){return(method_exists($this->_conn,'value')?$this->_conn->value($X,$o):(is_resource($X)?stream_get_contents($X):$X));}function
|
|||
|
quoteBinary($bh){return
|
|||
|
q($bh);}function
|
|||
|
warnings(){return'';}function
|
|||
|
tableHelp($B){}}$gc["sqlite"]="SQLite 3";$gc["sqlite2"]="SQLite 2";if(isset($_GET["sqlite"])||isset($_GET["sqlite2"])){$kg=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
|
|||
|
Min_SQLite{var$extension="SQLite3",$server_info,$affected_rows,$errno,$error,$_link;function
|
|||
|
__construct($Wc){$this->_link=new
|
|||
|
SQLite3($Wc);$bj=$this->_link->version();$this->server_info=$bj["versionString"];}function
|
|||
|
query($F){$G=@$this->_link->query($F);$this->error="";if(!$G){$this->errno=$this->_link->lastErrorCode();$this->error=$this->_link->lastErrorMsg();return
|
|||
|
false;}elseif($G->numColumns())return
|
|||
|
new
|
|||
|
Min_Result($G);$this->affected_rows=$this->_link->changes();return
|
|||
|
true;}function
|
|||
|
quote($P){return(is_utf8($P)?"'".$this->_link->escapeString($P)."'":"x'".reset(unpack('H*',$P))."'");}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!is_object($G))return
|
|||
|
false;$I=$G->_result->fetchArray();return$I[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($G){$this->_result=$G;}function
|
|||
|
fetch_assoc(){return$this->_result->fetchArray(SQLITE3_ASSOC);}function
|
|||
|
fetch_row(){return$this->_result->fetchArray(SQLITE3_NUM);}function
|
|||
|
fetch_field(){$e=$this->_offset++;$T=$this->_result->columnType($e);return(object)array("name"=>$this->_result->columnName($e),"type"=>$T,"charsetnr"=>($T==SQLITE3_BLOB?63:0),);}function
|
|||
|
__desctruct(){return$this->_result->finalize();}}}else{class
|
|||
|
Min_SQLite{var$extension="SQLite",$server_info,$affected_rows,$error,$_link;function
|
|||
|
__construct($Wc){$this->server_info=sqlite_libversion();$this->_link=new
|
|||
|
SQLiteDatabase($Wc);}function
|
|||
|
query($F,$Fi=false){$Ue=($Fi?"unbufferedQuery":"query");$G=@$this->_link->$Ue($F,SQLITE_BOTH,$n);$this->error="";if(!$G){$this->error=$n;return
|
|||
|
false;}elseif($G===true){$this->affected_rows=$this->changes();return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($G);}function
|
|||
|
quote($P){return"'".sqlite_escape_string($P)."'";}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!is_object($G))return
|
|||
|
false;$I=$G->_result->fetch();return$I[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($G){$this->_result=$G;if(method_exists($G,'numRows'))$this->num_rows=$G->numRows();}function
|
|||
|
fetch_assoc(){$I=$this->_result->fetch(SQLITE_ASSOC);if(!$I)return
|
|||
|
false;$H=array();foreach($I
|
|||
|
as$y=>$X)$H[($y[0]=='"'?idf_unescape($y):$y)]=$X;return$H;}function
|
|||
|
fetch_row(){return$this->_result->fetch(SQLITE_NUM);}function
|
|||
|
fetch_field(){$B=$this->_result->fieldName($this->_offset++);$dg='(\[.*]|"(?:[^"]|"")*"|(.+))';if(preg_match("~^($dg\\.)?$dg\$~",$B,$A)){$Q=($A[3]!=""?$A[3]:idf_unescape($A[2]));$B=($A[5]!=""?$A[5]:idf_unescape($A[4]));}return(object)array("name"=>$B,"orgname"=>$B,"orgtable"=>$Q,);}}}}elseif(extension_loaded("pdo_sqlite")){class
|
|||
|
Min_SQLite
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_SQLite";function
|
|||
|
__construct($Wc){$this->dsn(DRIVER.":$Wc","","");}}}if(class_exists("Min_SQLite")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_SQLite{function
|
|||
|
__construct(){parent::__construct(":memory:");$this->query("PRAGMA foreign_keys = 1");}function
|
|||
|
select_db($Wc){if(is_readable($Wc)&&$this->query("ATTACH ".$this->quote(preg_match("~(^[/\\\\]|:)~",$Wc)?$Wc:dirname($_SERVER["SCRIPT_FILENAME"])."/$Wc")." AS a")){parent::__construct($Wc);$this->query("PRAGMA foreign_keys = 1");return
|
|||
|
true;}return
|
|||
|
false;}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
next_result(){return
|
|||
|
false;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$J,$ng){$Yi=array();foreach($J
|
|||
|
as$N)$Yi[]="(".implode(", ",$N).")";return
|
|||
|
queries("REPLACE INTO ".table($Q)." (".implode(", ",array_keys(reset($J))).") VALUES\n".implode(",\n",$Yi));}function
|
|||
|
tableHelp($B){if($B=="sqlite_sequence")return"fileformat2.html#seqtab";if($B=="sqlite_master")return"fileformat2.html#$B";}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b;list(,,$E)=$b->credentials();if($E!="")return
|
|||
|
lang(22);return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
get_databases(){return
|
|||
|
array();}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return" $F$Z".($z!==null?$L."LIMIT $z".($C?" OFFSET $C":""):"");}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){global$h;return(preg_match('~^INTO~',$F)||$h->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')")?limit($F,$Z,1,0,$L):" $F WHERE rowid = (SELECT rowid FROM ".table($Q).$Z.$L."LIMIT 1)");}function
|
|||
|
db_collation($l,$qb){global$h;return$h->result("PRAGMA encoding");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){return
|
|||
|
get_current_user();}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') ORDER BY (name = 'sqlite_sequence'), name");}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($B=""){global$h;$H=array();foreach(get_rows("SELECT name AS Name, type AS Engine, 'rowid' AS Oid, '' AS Auto_increment FROM sqlite_master WHERE type IN ('table', 'view') ".($B!=""?"AND name = ".q($B):"ORDER BY name"))as$I){$I["Rows"]=$h->result("SELECT COUNT(*) FROM ".idf_escape($I["Name"]));$H[$I["Name"]]=$I;}foreach(get_rows("SELECT * FROM sqlite_sequence",null,"")as$I)$H[$I["name"]]["Auto_increment"]=$I["seq"];return($B!=""?$H[$B]:$H);}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){global$h;return!$h->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");}function
|
|||
|
fields($Q){global$h;$H=array();$ng="";foreach(get_rows("PRAGMA table_info(".table($Q).")")as$I){$B=$I["name"];$T=strtolower($I["type"]);$Vb=$I["dflt_value"];$H[$B]=array("field"=>$B,"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("~'(.*)'~",$Vb,$A)?str_replace("''","'",$A[1]):($Vb=="NULL"?null:$Vb)),"null"=>!$I["notnull"],"privileges"=>array("select"=>1,"insert"=>1,"update"=>1),"primary"=>$I["pk"],);if($I["pk"]){if($ng!="")$H[$ng]["auto_increment"]=false;elseif(preg_match('~^integer$~i',$T))$H[$B]["auto_increment"]=true;$ng=$B;}}$Bh=$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',$Bh,$Ge,PREG_SET_ORDER);foreach($Ge
|
|||
|
as$A){$B=str_replace('""','"',preg_replace('~^"|"$~','',$A[1]));if($H[$B])$H[$B]["collation"]=trim($A[3],"'");}return$H;}function
|
|||
|
indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$H=array();$Bh=$i->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));if(preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*"|`[^`]*`)++)~i',$Bh,$A)){$H[""]=array("type"=>"PRIMARY","columns"=>array(),"lengths"=>array(),"descs"=>array());preg_match_all('~((("[^"]*+")+|(?:`[^`]*+`)+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i',$A[1],$Ge,PREG_SET_ORDER);foreach($Ge
|
|||
|
as$A){$H[""]["columns"][]=idf_unescape($A[2]).$A[4];$H[""]["descs"][]=(preg_match('~DESC~i',$A[5])?'1':null);}}if(!$H){foreach(fields($Q)as$B=>$o){if($o["primary"])$H[""]=array("type"=>"PRIMARY","columns"=>array($B),"lengths"=>array(),"descs"=>array(null));}}$Eh=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$I){$B=$I["name"];$v=array("type"=>($I["unique"]?"UNIQUE":"INDEX"));$v["lengths"]=array();$v["descs"]=array();foreach(get_rows("PRAGMA index_info(".idf_escape($B).")",$i)as$ah){$v["columns"][]=$ah["name"];$v["descs"][]=null;}if(preg_match('~^CREATE( UNIQUE)? INDEX '.preg_quote(idf_escape($B).' ON '.idf_escape($Q),'~').' \((.*)\)$~i',$Eh[$B],$Kg)){preg_match_all('/("[^"]*+")+( DESC)?/',$Kg[2],$Ge);foreach($Ge[2]as$y=>$X){if($X)$v["descs"][$y]='1';}}if(!$H[""]||$v["type"]!="UNIQUE"||$v["columns"]!=$H[""]["columns"]||$v["descs"]!=$H[""]["descs"]||!preg_match("~^sqlite_~",$B))$H[$B]=$v;}return$H;}function
|
|||
|
foreign_keys($Q){$H=array();foreach(get_rows("PRAGMA foreign_key_list(".table($Q).")")as$I){$q=&$H[$I["id"]];if(!$q)$q=$I;$q["source"][]=$I["from"];$q["target"][]=$I["to"];}return$H;}function
|
|||
|
view($B){global$h;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\s+~iU','',$h->result("SELECT sql FROM sqlite_master WHERE name = ".q($B))));}function
|
|||
|
collations(){return(isset($_GET["create"])?get_vals("PRAGMA collation_list",1):array());}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
check_sqlite_name($B){global$h;$Mc="db|sdb|sqlite";if(!preg_match("~^[^\\0]*\\.($Mc)\$~",$B)){$h->error=lang(23,str_replace("|",", ",$Mc));return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
create_database($l,$d){global$h;if(file_exists($l)){$h->error=lang(24);return
|
|||
|
false;}if(!check_sqlite_name($l))return
|
|||
|
false;try{$_=new
|
|||
|
Min_SQLite($l);}catch(Exception$Cc){$h->error=$Cc->getMessage();return
|
|||
|
false;}$_->query('PRAGMA encoding = "UTF-8"');$_->query('CREATE TABLE adminer (i)');$_->query('DROP TABLE adminer');return
|
|||
|
true;}function
|
|||
|
drop_databases($k){global$h;$h->__construct(":memory:");foreach($k
|
|||
|
as$l){if(!@unlink($l)){$h->error=lang(24);return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
rename_database($B,$d){global$h;if(!check_sqlite_name($B))return
|
|||
|
false;$h->__construct(":memory:");$h->error=lang(24);return@rename(DB,$B);}function
|
|||
|
auto_increment(){return" PRIMARY KEY".(DRIVER=="sqlite"?" AUTOINCREMENT":"");}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){global$h;$Ri=($Q==""||$ed);foreach($p
|
|||
|
as$o){if($o[0]!=""||!$o[1]||$o[2]){$Ri=true;break;}}$c=array();$Lf=array();foreach($p
|
|||
|
as$o){if($o[1]){$c[]=($Ri?$o[1]:"ADD ".implode($o[1]));if($o[0]!="")$Lf[$o[0]]=$o[1][0];}}if(!$Ri){foreach($c
|
|||
|
as$X){if(!queries("ALTER TABLE ".table($Q)." $X"))return
|
|||
|
false;}if($Q!=$B&&!queries("ALTER TABLE ".table($Q)." RENAME TO ".table($B)))return
|
|||
|
false;}elseif(!recreate_table($Q,$B,$c,$Lf,$ed,$Na))return
|
|||
|
false;if($Na){queries("BEGIN");queries("UPDATE sqlite_sequence SET seq = $Na WHERE name = ".q($B));if(!$h->affected_rows)queries("INSERT INTO sqlite_sequence (name, seq) VALUES (".q($B).", $Na)");queries("COMMIT");}return
|
|||
|
true;}function
|
|||
|
recreate_table($Q,$B,$p,$Lf,$ed,$Na,$w=array()){global$h;if($Q!=""){if(!$p){foreach(fields($Q)as$y=>$o){if($w)$o["auto_increment"]=0;$p[]=process_field($o,$o);$Lf[$y]=idf_escape($y);}}$og=false;foreach($p
|
|||
|
as$o){if($o[6])$og=true;}$jc=array();foreach($w
|
|||
|
as$y=>$X){if($X[2]=="DROP"){$jc[$X[1]]=true;unset($w[$y]);}}foreach(indexes($Q)as$ie=>$v){$f=array();foreach($v["columns"]as$y=>$e){if(!$Lf[$e])continue
|
|||
|
2;$f[]=$Lf[$e].($v["descs"][$y]?" DESC":"");}if(!$jc[$ie]){if($v["type"]!="PRIMARY"||!$og)$w[]=array($v["type"],$ie,$f);}}foreach($w
|
|||
|
as$y=>$X){if($X[0]=="PRIMARY"){unset($w[$y]);$ed[]=" PRIMARY KEY (".implode(", ",$X[2]).")";}}foreach(foreign_keys($Q)as$ie=>$q){foreach($q["source"]as$y=>$e){if(!$Lf[$e])continue
|
|||
|
2;$q["source"][$y]=idf_unescape($Lf[$e]);}if(!isset($ed[" $ie"]))$ed[]=" ".format_foreign_key($q);}queries("BEGIN");}foreach($p
|
|||
|
as$y=>$o)$p[$y]=" ".implode($o);$p=array_merge($p,array_filter($ed));$ci=($Q==$B?"adminer_$B":$B);if(!queries("CREATE TABLE ".table($ci)." (\n".implode(",\n",$p)."\n)"))return
|
|||
|
false;if($Q!=""){if($Lf&&!queries("INSERT INTO ".table($ci)." (".implode(", ",$Lf).") SELECT ".implode(", ",array_map('idf_escape',array_keys($Lf)))." FROM ".table($Q)))return
|
|||
|
false;$Ci=array();foreach(triggers($Q)as$Ai=>$ji){$_i=trigger($Ai);$Ci[]="CREATE TRIGGER ".idf_escape($Ai)." ".implode(" ",$ji)." ON ".table($B)."\n$_i[Statement]";}$Na=$Na?0:$h->result("SELECT seq FROM sqlite_sequence WHERE name = ".q($Q));if(!queries("DROP TABLE ".table($Q))||($Q==$B&&!queries("ALTER TABLE ".table($ci)." RENAME TO ".table($B)))||!alter_indexes($B,$w))return
|
|||
|
false;if($Na)queries("UPDATE sqlite_sequence SET seq = $Na WHERE name = ".q($B));foreach($Ci
|
|||
|
as$_i){if(!queries($_i))return
|
|||
|
false;}queries("COMMIT");}return
|
|||
|
true;}function
|
|||
|
index_sql($Q,$T,$B,$f){return"CREATE $T ".($T!="INDEX"?"INDEX ":"").idf_escape($B!=""?$B:uniqid($Q."_"))." ON ".table($Q)." $f";}function
|
|||
|
alter_indexes($Q,$c){foreach($c
|
|||
|
as$ng){if($ng[0]=="PRIMARY")return
|
|||
|
recreate_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
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("DELETE FROM",$S);}function
|
|||
|
drop_views($dj){return
|
|||
|
apply_queries("DROP VIEW",$dj);}function
|
|||
|
drop_tables($S){return
|
|||
|
apply_queries("DROP TABLE",$S);}function
|
|||
|
move_tables($S,$dj,$ai){return
|
|||
|
false;}function
|
|||
|
trigger($B){global$h;if($B=="")return
|
|||
|
array("Statement"=>"BEGIN\n\t;\nEND");$u='(?:[^`"\s]+|`[^`]*`|"[^"]*")+';$Bi=trigger_options();preg_match("~^CREATE\\s+TRIGGER\\s*$u\\s*(".implode("|",$Bi["Timing"]).")\\s+([a-z]+)(?:\\s+OF\\s+($u))?\\s+ON\\s*$u\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",$h->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ".q($B)),$A);$mf=$A[3];return
|
|||
|
array("Timing"=>strtoupper($A[1]),"Event"=>strtoupper($A[2]).($mf?" OF":""),"Of"=>($mf[0]=='`'||$mf[0]=='"'?idf_unescape($mf):$mf),"Trigger"=>$B,"Statement"=>$A[4],);}function
|
|||
|
triggers($Q){$H=array();$Bi=trigger_options();foreach(get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q))as$I){preg_match('~^CREATE\s+TRIGGER\s*(?:[^`"\s]+|`[^`]*`|"[^"]*")+\s*('.implode("|",$Bi["Timing"]).')\s*(.*?)\s+ON\b~i',$I["sql"],$A);$H[$I["name"]]=array($A[1],$A[2]);}return$H;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER","INSTEAD OF"),"Event"=>array("INSERT","UPDATE","UPDATE OF","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
last_id(){global$h;return$h->result("SELECT LAST_INSERT_ROWID()");}function
|
|||
|
explain($h,$F){return$h->query("EXPLAIN QUERY PLAN $F");}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($eh){return
|
|||
|
true;}function
|
|||
|
create_sql($Q,$Na,$Lh){global$h;$H=$h->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = ".q($Q));foreach(indexes($Q)as$B=>$v){if($B=='')continue;$H.=";\n\n".index_sql($Q,$v['type'],$B,"(".implode(", ",array_map('idf_escape',$v['columns'])).")");}return$H;}function
|
|||
|
truncate_sql($Q){return"DELETE FROM ".table($Q);}function
|
|||
|
use_sql($j){}function
|
|||
|
trigger_sql($Q){return
|
|||
|
implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q)));}function
|
|||
|
show_variables(){global$h;$H=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$y)$H[$y]=$h->result("PRAGMA $y");return$H;}function
|
|||
|
show_status(){$H=array();foreach(get_vals("PRAGMA compile_options")as$_f){list($y,$X)=explode("=",$_f,2);$H[$y]=$X;}return$H;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match('~^(columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~',$Rc);}$x="sqlite";$U=array("integer"=>0,"real"=>0,"numeric"=>0,"text"=>0,"blob"=>0);$Kh=array_keys($U);$Li=array();$yf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$md=array("hex","length","lower","round","unixepoch","upper");$sd=array("avg","count","count distinct","group_concat","max","min","sum");$oc=array(array(),array("integer|real|numeric"=>"+/-","text"=>"||",));}$gc["pgsql"]="PostgreSQL";if(isset($_GET["pgsql"])){$kg=array("PgSQL","PDO_PgSQL");define("DRIVER","pgsql");if(extension_loaded("pgsql")){class
|
|||
|
Min_DB{var$extension="PgSQL",$_link,$_result,$_string,$_database=true,$server_info,$affected_rows,$error,$timeout;function
|
|||
|
_error($zc,$n){if(ini_bool("html_errors"))$n=html_entity_decode(strip_tags($n));$n=preg_replace('~^[^:]*: ~','',$n);$this->error=$n;}function
|
|||
|
connect($M,$V,$E){global$b;$l=$b->database();set_error_handler(array($this,'_error'));$this->_string="host='".str_replace(":","' port='",addcslashes($M,"'\\"))."' user='".addcslashes($V,"'\\")."' password='".addcslashes($E,"'\\")."'";$this->_link=@pg_connect("$this->_string dbname='".($l!=""?addcslashes($l,"'\\"):"postgres")."'",PGSQL_CONNECT_FORCE_NEW);if(!$this->_link&&$l!=""){$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
|
|||
|
quote($P){return"'".pg_escape_string($this->_link,$P)."'";}function
|
|||
|
value($X,$o){return($o["type"]=="bytea"?pg_unescape_bytea($X):$X);}function
|
|||
|
quoteBinary($P){return"'".pg_escape_bytea($this->_link,$P)."'";}function
|
|||
|
select_db($j){global$b;if($j==$b->database())return$this->_database;$H=@pg_connect("$this->_string dbname='".addcslashes($j,"'\\")."'",PGSQL_CONNECT_FORCE_NEW);if($H)$this->_link=$H;return$H;}function
|
|||
|
close(){$this->_link=@pg_connect("$this->_string dbname='postgres'");}function
|
|||
|
query($F,$Fi=false){$G=@pg_query($this->_link,$F);$this->error="";if(!$G){$this->error=pg_last_error($this->_link);$H=false;}elseif(!pg_num_fields($G)){$this->affected_rows=pg_affected_rows($G);$H=true;}else$H=new
|
|||
|
Min_Result($G);if($this->timeout){$this->timeout=0;$this->query("RESET statement_timeout");}return$H;}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!$G||!$G->num_rows)return
|
|||
|
false;return
|
|||
|
pg_fetch_result($G->_result,0,$o);}function
|
|||
|
warnings(){return
|
|||
|
h(pg_last_notice($this->_link));}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($G){$this->_result=$G;$this->num_rows=pg_num_rows($G);}function
|
|||
|
fetch_assoc(){return
|
|||
|
pg_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
pg_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$e=$this->_offset++;$H=new
|
|||
|
stdClass;if(function_exists('pg_field_table'))$H->orgtable=pg_field_table($this->_result,$e);$H->name=pg_field_name($this->_result,$e);$H->orgname=$H->name;$H->type=pg_field_type($this->_result,$e);$H->charsetnr=($H->type=="bytea"?63:0);return$H;}function
|
|||
|
__destruct(){pg_free_result($this->_result);}}}elseif(extension_loaded("pdo_pgsql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_PgSQL",$timeout;function
|
|||
|
connect($M,$V,$E){global$b;$l=$b->database();$P="pgsql:host='".str_replace(":","' port='",addcslashes($M,"'\\"))."' options='-c client_encoding=utf8'";$this->dsn("$P dbname='".($l!=""?addcslashes($l,"'\\"):"postgres")."'",$V,$E);return
|
|||
|
true;}function
|
|||
|
select_db($j){global$b;return($b->database()==$j);}function
|
|||
|
quoteBinary($bh){return
|
|||
|
q($bh);}function
|
|||
|
query($F,$Fi=false){$H=parent::query($F,$Fi);if($this->timeout){$this->timeout=0;parent::query("RESET statement_timeout");}return$H;}function
|
|||
|
warnings(){return'';}function
|
|||
|
close(){}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$J,$ng){global$h;foreach($J
|
|||
|
as$N){$Mi=array();$Z=array();foreach($N
|
|||
|
as$y=>$X){$Mi[]="$y = $X";if(isset($ng[idf_unescape($y)]))$Z[]="$y = $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($N)).") VALUES (".implode(", ",$N).")")))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
slowQuery($F,$ii){$this->_conn->query("SET statement_timeout = ".(1000*$ii));$this->_conn->timeout=1000*$ii;return$F;}function
|
|||
|
convertSearch($u,$X,$o){return(preg_match('~char|text'.(!preg_match('~LIKE~',$X["op"])?'|date|time(stamp)?|boolean|uuid|'.number_type():'').'~',$o["type"])?$u:"CAST($u AS text)");}function
|
|||
|
quoteBinary($bh){return$this->_conn->quoteBinary($bh);}function
|
|||
|
warnings(){return$this->_conn->warnings();}function
|
|||
|
tableHelp($B){$ze=array("information_schema"=>"infoschema","pg_catalog"=>"catalog",);$_=$ze[$_GET["ns"]];if($_)return"$_-".str_replace("_","-",$B).".html";}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b,$U,$Kh;$h=new
|
|||
|
Min_DB;$Jb=$b->credentials();if($h->connect($Jb[0],$Jb[1],$Jb[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
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname");}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return" $F$Z".($z!==null?$L."LIMIT $z".($C?" OFFSET $C":""):"");}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){return(preg_match('~^INTO~',$F)?limit($F,$Z,1,0,$L):" $F".(is_view(table_status1($Q))?$Z:" WHERE ctid = (SELECT ctid FROM ".table($Q).$Z.$L."LIMIT 1)"));}function
|
|||
|
db_collation($l,$qb){global$h;return$h->result("SHOW LC_COLLATE");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT user");}function
|
|||
|
tables_list(){$F="SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema()";if(support('materializedview'))$F.="
|
|||
|
UNION ALL
|
|||
|
SELECT matviewname, 'MATERIALIZED VIEW'
|
|||
|
FROM pg_matviews
|
|||
|
WHERE schemaname = current_schema()";$F.="
|
|||
|
ORDER BY 1";return
|
|||
|
get_key_vals($F);}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($B=""){$H=array();foreach(get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_relation_size(c.oid) AS \"Data_length\", pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", ".(min_version(12)?"''":"CASE WHEN c.relhasoids THEN 'oid' ELSE '' END")." AS \"Oid\", c.reltuples as \"Rows\", n.nspname
|
|||
|
FROM pg_class c
|
|||
|
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
|||
|
WHERE relkind IN ('r', 'm', 'v', 'f')
|
|||
|
".($B!=""?"AND relname = ".q($B):"ORDER BY relname"))as$I)$H[$I["Name"]]=$I;return($B!=""?$H[$B]:$H);}function
|
|||
|
is_view($R){return
|
|||
|
in_array($R["Engine"],array("view","materialized view"));}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$H=array();$Da=array('timestamp without time zone'=>'timestamp','timestamp with time zone'=>'timestamptz',);$Fd=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, pg_get_expr(d.adbin, d.adrelid) AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment, $Fd AS identity
|
|||
|
FROM pg_class c
|
|||
|
JOIN pg_namespace n ON c.relnamespace = n.oid
|
|||
|
JOIN pg_attribute a ON c.oid = a.attrelid
|
|||
|
LEFT JOIN pg_attrdef d ON c.oid = d.adrelid AND a.attnum = d.adnum
|
|||
|
WHERE c.relname = ".q($Q)."
|
|||
|
AND n.nspname = current_schema()
|
|||
|
AND NOT a.attisdropped
|
|||
|
AND a.attnum > 0
|
|||
|
ORDER BY a.attnum")as$I){preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~',$I["full_type"],$A);list(,$T,$we,$I["length"],$xa,$Ga)=$A;$I["length"].=$Ga;$fb=$T.$xa;if(isset($Da[$fb])){$I["type"]=$Da[$fb];$I["full_type"]=$I["type"].$we.$Ga;}else{$I["type"]=$T;$I["full_type"]=$I["type"].$we.$xa.$Ga;}if($I['identity'])$I['default']='GENERATED BY DEFAULT AS IDENTITY';$I["null"]=!$I["attnotnull"];$I["auto_increment"]=$I['identity']||preg_match('~^nextval\(~i',$I["default"]);$I["privileges"]=array("insert"=>1,"select"=>1,"update"=>1);if(preg_match('~(.+)::[^)]+(.*)~',$I["default"],$A))$I["default"]=($A[1]=="NULL"?null:(($A[1][0]=="'"?idf_unescape($A[1]):$A[1]).$A[2]));$H[$I["field"]]=$I;}return$H;}function
|
|||
|
indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$H=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$I){$Lg=$I["relname"];$H[$Lg]["type"]=($I["indispartial"]?"INDEX":($I["indisprimary"]?"PRIMARY":($I["indisunique"]?"UNIQUE":"INDEX")));$H[$Lg]["columns"]=array();foreach(explode(" ",$I["indkey"])as$Pd)$H[$Lg]["columns"][]=$f[$Pd];$H[$Lg]["descs"]=array();foreach(explode(" ",$I["indoption"])as$Qd)$H[$Lg]["descs"][]=($Qd&1?'1':null);$H[$Lg]["lengths"]=array();}return$H;}function
|
|||
|
foreign_keys($Q){global$tf;$H=array();foreach(get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
|
|||
|
FROM pg_constraint
|
|||
|
WHERE 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())
|
|||
|
AND contype = 'f'::char
|
|||
|
ORDER BY conkey, conname")as$I){if(preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA',$I['definition'],$A)){$I['source']=array_map('trim',explode(',',$A[1]));if(preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~',$A[2],$Fe)){$I['ns']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$Fe[2]));$I['table']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$Fe[4]));}$I['target']=array_map('trim',explode(',',$A[3]));$I['on_delete']=(preg_match("~ON DELETE ($tf)~",$A[4],$Fe)?$Fe[1]:'NO ACTION');$I['on_update']=(preg_match("~ON UPDATE ($tf)~",$A[4],$Fe)?$Fe[1]:'NO ACTION');$H[$I['conname']]=$I;}}return$H;}function
|
|||
|
view($B){global$h;return
|
|||
|
array("select"=>trim($h->result("SELECT pg_get_viewdef(".$h->result("SELECT oid FROM pg_class WHERE relname = ".q($B)).")")));}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return($l=="information_schema");}function
|
|||
|
error(){global$h;$H=h($h->error);if(preg_match('~^(.*\n)?([^\n]*)\n( *)\^(\n.*)?$~s',$H,$A))$H=$A[1].preg_replace('~((?:[^&]|&[^;]*;){'.strlen($A[3]).'})(.*)~','\1<b>\2</b>',$A[2]).$A[4];return
|
|||
|
nl_br($H);}function
|
|||
|
create_database($l,$d){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($l).($d?" ENCODING ".idf_escape($d):""));}function
|
|||
|
drop_databases($k){global$h;$h->close();return
|
|||
|
apply_queries("DROP DATABASE",$k,'idf_escape');}function
|
|||
|
rename_database($B,$d){return
|
|||
|
queries("ALTER DATABASE ".idf_escape(DB)." RENAME TO ".idf_escape($B));}function
|
|||
|
auto_increment(){return"";}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){$c=array();$yg=array();if($Q!=""&&$Q!=$B)$yg[]="ALTER TABLE ".table($Q)." RENAME TO ".table($B);foreach($p
|
|||
|
as$o){$e=idf_escape($o[0]);$X=$o[1];if(!$X)$c[]="DROP $e";else{$Xi=$X[5];unset($X[5]);if(isset($X[6])&&$o[0]=="")$X[1]=($X[1]=="bigint"?" big":" ")."serial";if($o[0]=="")$c[]=($Q!=""?"ADD ":" ").implode($X);else{if($e!=$X[0])$yg[]="ALTER TABLE ".table($B)." 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($o[0]!=""||$Xi!="")$yg[]="COMMENT ON COLUMN ".table($B).".$X[0] IS ".($Xi!=""?substr($Xi,9):"''");}}$c=array_merge($c,$ed);if($Q=="")array_unshift($yg,"CREATE TABLE ".table($B)." (\n".implode(",\n",$c)."\n)");elseif($c)array_unshift($yg,"ALTER TABLE ".table($Q)."\n".implode(",\n",$c));if($Q!=""||$vb!="")$yg[]="COMMENT ON TABLE ".table($B)." IS ".q($vb);if($Na!=""){}foreach($yg
|
|||
|
as$F){if(!queries($F))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){$Gb=array();$hc=array();$yg=array();foreach($c
|
|||
|
as$X){if($X[0]!="INDEX")$Gb[]=($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")$hc[]=idf_escape($X[1]);else$yg[]="CREATE INDEX ".idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q)." (".implode(", ",$X[2]).")";}if($Gb)array_unshift($yg,"ALTER TABLE ".table($Q).implode(",",$Gb));if($hc)array_unshift($yg,"DROP INDEX ".implode(", ",$hc));foreach($yg
|
|||
|
as$F){if(!queries($F))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){return
|
|||
|
queries("TRUNCATE ".implode(", ",array_map('table',$S)));return
|
|||
|
true;}function
|
|||
|
drop_views($dj){return
|
|||
|
drop_tables($dj);}function
|
|||
|
drop_tables($S){foreach($S
|
|||
|
as$Q){$O=table_status($Q);if(!queries("DROP ".strtoupper($O["Engine"])." ".table($Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
move_tables($S,$dj,$ai){foreach(array_merge($S,$dj)as$Q){$O=table_status($Q);if(!queries("ALTER ".strtoupper($O["Engine"])." ".table($Q)." SET SCHEMA ".idf_escape($ai)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($B,$Q=null){if($B=="")return
|
|||
|
array("Statement"=>"EXECUTE PROCEDURE ()");if($Q===null)$Q=$_GET['trigger'];$J=get_rows('SELECT t.trigger_name AS "Trigger", t.action_timing AS "Timing", (SELECT STRING_AGG(event_manipulation, \' OR \') FROM information_schema.triggers WHERE event_object_table = t.event_object_table AND trigger_name = t.trigger_name ) AS "Events", t.event_manipulation AS "Event", \'FOR EACH \' || t.action_orientation AS "Type", t.action_statement AS "Statement" FROM information_schema.triggers t WHERE t.event_object_table = '.q($Q).' AND t.trigger_name = '.q($B));return
|
|||
|
reset($J);}function
|
|||
|
triggers($Q){$H=array();foreach(get_rows("SELECT * FROM information_schema.triggers WHERE event_object_table = ".q($Q))as$I)$H[$I["trigger_name"]]=array($I["action_timing"],$I["event_manipulation"]);return$H;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW","FOR EACH STATEMENT"),);}function
|
|||
|
routine($B,$T){$J=get_rows('SELECT routine_definition AS definition, LOWER(external_language) AS language, *
|
|||
|
FROM information_schema.routines
|
|||
|
WHERE routine_schema = current_schema() AND specific_name = '.q($B));$H=$J[0];$H["returns"]=array("type"=>$H["type_udt_name"]);$H["fields"]=get_rows('SELECT parameter_name AS field, data_type AS type, character_maximum_length AS length, parameter_mode AS inout
|
|||
|
FROM information_schema.parameters
|
|||
|
WHERE specific_schema = current_schema() AND specific_name = '.q($B).'
|
|||
|
ORDER BY ordinal_position');return$H;}function
|
|||
|
routines(){return
|
|||
|
get_rows('SELECT specific_name AS "SPECIFIC_NAME", routine_type AS "ROUTINE_TYPE", routine_name AS "ROUTINE_NAME", type_udt_name AS "DTD_IDENTIFIER"
|
|||
|
FROM information_schema.routines
|
|||
|
WHERE routine_schema = current_schema()
|
|||
|
ORDER BY SPECIFIC_NAME');}function
|
|||
|
routine_languages(){return
|
|||
|
get_vals("SELECT LOWER(lanname) FROM pg_catalog.pg_language");}function
|
|||
|
routine_id($B,$I){$H=array();foreach($I["fields"]as$o)$H[]=$o["type"];return
|
|||
|
idf_escape($B)."(".implode(", ",$H).")";}function
|
|||
|
last_id(){return
|
|||
|
0;}function
|
|||
|
explain($h,$F){return$h->query("EXPLAIN $F");}function
|
|||
|
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):"")),$Kg))return$Kg[1];return
|
|||
|
false;}function
|
|||
|
types(){return
|
|||
|
get_vals("SELECT typname
|
|||
|
FROM pg_type
|
|||
|
WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
|
|||
|
AND typtype IN ('b','d','e')
|
|||
|
AND typelem = 0");}function
|
|||
|
schemas(){return
|
|||
|
get_vals("SELECT nspname FROM pg_namespace ORDER BY nspname");}function
|
|||
|
get_schema(){global$h;return$h->result("SELECT current_schema()");}function
|
|||
|
set_schema($dh,$i=null){global$h,$U,$Kh;if(!$i)$i=$h;$H=$i->query("SET search_path TO ".idf_escape($dh));foreach(types()as$T){if(!isset($U[$T])){$U[$T]=0;$Kh[lang(26)][]=$T;}}return$H;}function
|
|||
|
create_sql($Q,$Na,$Lh){global$h;$H='';$Tg=array();$nh=array();$O=table_status($Q);$p=fields($Q);$w=indexes($Q);ksort($w);$bd=foreign_keys($Q);ksort($bd);if(!$O||empty($p))return
|
|||
|
false;$H="CREATE TABLE ".idf_escape($O['nspname']).".".idf_escape($O['Name'])." (\n ";foreach($p
|
|||
|
as$Tc=>$o){$Uf=idf_escape($o['field']).' '.$o['full_type'].default_value($o).($o['attnotnull']?" NOT NULL":"");$Tg[]=$Uf;if(preg_match('~nextval\(\'([^\']+)\'\)~',$o['default'],$Ge)){$mh=$Ge[1];$Ah=reset(get_rows(min_version(10)?"SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = ".q($mh):"SELECT * FROM $mh"));$nh[]=($Lh=="DROP+CREATE"?"DROP SEQUENCE IF EXISTS $mh;\n":"")."CREATE SEQUENCE $mh INCREMENT $Ah[increment_by] MINVALUE $Ah[min_value] MAXVALUE $Ah[max_value] START ".($Na?$Ah['last_value']:1)." CACHE $Ah[cache_value];";}}if(!empty($nh))$H=implode("\n\n",$nh)."\n\n$H";foreach($w
|
|||
|
as$Kd=>$v){switch($v['type']){case'UNIQUE':$Tg[]="CONSTRAINT ".idf_escape($Kd)." UNIQUE (".implode(', ',array_map('idf_escape',$v['columns'])).")";break;case'PRIMARY':$Tg[]="CONSTRAINT ".idf_escape($Kd)." PRIMARY KEY (".implode(', ',array_map('idf_escape',$v['columns'])).")";break;}}foreach($bd
|
|||
|
as$ad=>$Zc)$Tg[]="CONSTRAINT ".idf_escape($ad)." $Zc[definition] ".($Zc['deferrable']?'DEFERRABLE':'NOT DEFERRABLE');$H.=implode(",\n ",$Tg)."\n) WITH (oids = ".($O['Oid']?'true':'false').");";foreach($w
|
|||
|
as$Kd=>$v){if($v['type']=='INDEX'){$f=array();foreach($v['columns']as$y=>$X)$f[]=idf_escape($X).($v['descs'][$y]?" DESC":"");$H.="\n\nCREATE INDEX ".idf_escape($Kd)." ON ".idf_escape($O['nspname']).".".idf_escape($O['Name'])." USING btree (".implode(', ',$f).");";}}if($O['Comment'])$H.="\n\nCOMMENT ON TABLE ".idf_escape($O['nspname']).".".idf_escape($O['Name'])." IS ".q($O['Comment']).";";foreach($p
|
|||
|
as$Tc=>$o){if($o['comment'])$H.="\n\nCOMMENT ON COLUMN ".idf_escape($O['nspname']).".".idf_escape($O['Name']).".".idf_escape($Tc)." IS ".q($o['comment']).";";}return
|
|||
|
rtrim($H,';');}function
|
|||
|
truncate_sql($Q){return"TRUNCATE ".table($Q);}function
|
|||
|
trigger_sql($Q){$O=table_status($Q);$H="";foreach(triggers($Q)as$zi=>$yi){$_i=trigger($zi,$O['Name']);$H.="\nCREATE TRIGGER ".idf_escape($_i['Trigger'])." $_i[Timing] $_i[Events] ON ".idf_escape($O["nspname"]).".".idf_escape($O['Name'])." $_i[Type] $_i[Statement];;\n";}return$H;}function
|
|||
|
use_sql($j){return"\connect ".idf_escape($j);}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals("SHOW ALL");}function
|
|||
|
process_list(){return
|
|||
|
get_rows("SELECT * FROM pg_stat_activity ORDER BY ".(min_version(9.2)?"pid":"procpid"));}function
|
|||
|
show_status(){}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
support($Rc){return
|
|||
|
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)$~',$Rc);}function
|
|||
|
kill_process($X){return
|
|||
|
queries("SELECT pg_terminate_backend(".number($X).")");}function
|
|||
|
connection_id(){return"SELECT pg_backend_pid()";}function
|
|||
|
max_connections(){global$h;return$h->result("SHOW max_connections");}$x="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$y=>$X){$U+=$X;$Kh[$y]=array_keys($X);}$Li=array();$yf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","ILIKE","ILIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$md=array("char_length","lower","round","to_hex","to_timestamp","upper");$sd=array("avg","count","count distinct","max","min","sum");$oc=array(array("char"=>"md5","date|time"=>"now",),array(number_type()=>"+/-","date|time"=>"+ interval/- interval","char|text"=>"||",));}$gc["oracle"]="Oracle (beta)";if(isset($_GET["oracle"])){$kg=array("OCI8","PDO_OCI");define("DRIVER","oracle");if(extension_loaded("oci8")){class
|
|||
|
Min_DB{var$extension="oci8",$_link,$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
_error($zc,$n){if(ini_bool("html_errors"))$n=html_entity_decode(strip_tags($n));$n=preg_replace('~^[^:]*: ~','',$n);$this->error=$n;}function
|
|||
|
connect($M,$V,$E){$this->_link=@oci_new_connect($V,$E,$M,"AL32UTF8");if($this->_link){$this->server_info=oci_server_version($this->_link);return
|
|||
|
true;}$n=oci_error();$this->error=$n["message"];return
|
|||
|
false;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($j){return
|
|||
|
true;}function
|
|||
|
query($F,$Fi=false){$G=oci_parse($this->_link,$F);$this->error="";if(!$G){$n=oci_error($this->_link);$this->errno=$n["code"];$this->error=$n["message"];return
|
|||
|
false;}set_error_handler(array($this,'_error'));$H=@oci_execute($G);restore_error_handler();if($H){if(oci_num_fields($G))return
|
|||
|
new
|
|||
|
Min_Result($G);$this->affected_rows=oci_num_rows($G);}return$H;}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($F,$o=1){$G=$this->query($F);if(!is_object($G)||!oci_fetch($G->_result))return
|
|||
|
false;return
|
|||
|
oci_result($G->_result,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=1,$num_rows;function
|
|||
|
__construct($G){$this->_result=$G;}function
|
|||
|
_convert($I){foreach((array)$I
|
|||
|
as$y=>$X){if(is_a($X,'OCI-Lob'))$I[$y]=$X->load();}return$I;}function
|
|||
|
fetch_assoc(){return$this->_convert(oci_fetch_assoc($this->_result));}function
|
|||
|
fetch_row(){return$this->_convert(oci_fetch_row($this->_result));}function
|
|||
|
fetch_field(){$e=$this->_offset++;$H=new
|
|||
|
stdClass;$H->name=oci_field_name($this->_result,$e);$H->orgname=$H->name;$H->type=oci_field_type($this->_result,$e);$H->charsetnr=(preg_match("~raw|blob|bfile~",$H->type)?63:0);return$H;}function
|
|||
|
__destruct(){oci_free_statement($this->_result);}}}elseif(extension_loaded("pdo_oci")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_OCI";function
|
|||
|
connect($M,$V,$E){$this->dsn("oci:dbname=//$M;charset=AL32UTF8",$V,$E);return
|
|||
|
true;}function
|
|||
|
select_db($j){return
|
|||
|
true;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
begin(){return
|
|||
|
true;}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Jb=$b->credentials();if($h->connect($Jb[0],$Jb[1],$Jb[2]))return$h;return$h->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT tablespace_name FROM user_tablespaces");}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return($C?" * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $F$Z) t WHERE rownum <= ".($z+$C).") WHERE rnum > $C":($z!==null?" * FROM (SELECT $F$Z) WHERE rownum <= ".($z+$C):" $F$Z"));}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){return" $F$Z";}function
|
|||
|
db_collation($l,$qb){global$h;return$h->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT USER FROM DUAL");}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals("SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = ".q(DB)."
|
|||
|
UNION SELECT view_name, 'view' FROM user_views
|
|||
|
ORDER BY 1");}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($B=""){$H=array();$fh=q($B);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).($B!=""?" AND table_name = $fh":"")."
|
|||
|
UNION SELECT view_name, 'view', 0, 0 FROM user_views".($B!=""?" WHERE view_name = $fh":"")."
|
|||
|
ORDER BY 1")as$I){if($B!="")return$I;$H[$I["Name"]]=$I;}return$H;}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$H=array();foreach(get_rows("SELECT * FROM all_tab_columns WHERE table_name = ".q($Q)." ORDER BY column_id")as$I){$T=$I["DATA_TYPE"];$we="$I[DATA_PRECISION],$I[DATA_SCALE]";if($we==",")$we=$I["DATA_LENGTH"];$H[$I["COLUMN_NAME"]]=array("field"=>$I["COLUMN_NAME"],"full_type"=>$T.($we?"($we)":""),"type"=>strtolower($T),"length"=>$we,"default"=>$I["DATA_DEFAULT"],"null"=>($I["NULLABLE"]=="Y"),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$H;}function
|
|||
|
indexes($Q,$i=null){$H=array();foreach(get_rows("SELECT uic.*, uc.constraint_type
|
|||
|
FROM user_ind_columns uic
|
|||
|
LEFT JOIN user_constraints uc ON uic.index_name = uc.constraint_name AND uic.table_name = uc.table_name
|
|||
|
WHERE uic.table_name = ".q($Q)."
|
|||
|
ORDER BY uc.constraint_type, uic.column_position",$i)as$I){$Kd=$I["INDEX_NAME"];$H[$Kd]["type"]=($I["CONSTRAINT_TYPE"]=="P"?"PRIMARY":($I["CONSTRAINT_TYPE"]=="U"?"UNIQUE":"INDEX"));$H[$Kd]["columns"][]=$I["COLUMN_NAME"];$H[$Kd]["lengths"][]=($I["CHAR_LENGTH"]&&$I["CHAR_LENGTH"]!=$I["COLUMN_LENGTH"]?$I["CHAR_LENGTH"]:null);$H[$Kd]["descs"][]=($I["DESCEND"]?'1':null);}return$H;}function
|
|||
|
view($B){$J=get_rows('SELECT text "select" FROM user_views WHERE view_name = '.q($B));return
|
|||
|
reset($J);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
explain($h,$F){$h->query("EXPLAIN PLAN FOR $F");return$h->query("SELECT * FROM plan_table");}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){$c=$hc=array();foreach($p
|
|||
|
as$o){$X=$o[1];if($X&&$o[0]!=""&&idf_escape($o[0])!=$X[0])queries("ALTER TABLE ".table($Q)." RENAME COLUMN ".idf_escape($o[0])." TO $X[0]");if($X)$c[]=($Q!=""?($o[0]!=""?"MODIFY (":"ADD ("):" ").implode($X).($Q!=""?")":"");else$hc[]=idf_escape($o[0]);}if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($B)." (\n".implode(",\n",$c)."\n)");return(!$c||queries("ALTER TABLE ".table($Q)."\n".implode("\n",$c)))&&(!$hc||queries("ALTER TABLE ".table($Q)." DROP (".implode(", ",$hc).")"))&&($Q==$B||queries("ALTER TABLE ".table($Q)." RENAME TO ".table($B)));}function
|
|||
|
foreign_keys($Q){$H=array();$F="SELECT c_list.CONSTRAINT_NAME as NAME,
|
|||
|
c_src.COLUMN_NAME as SRC_COLUMN,
|
|||
|
c_dest.OWNER as DEST_DB,
|
|||
|
c_dest.TABLE_NAME as DEST_TABLE,
|
|||
|
c_dest.COLUMN_NAME as DEST_COLUMN,
|
|||
|
c_list.DELETE_RULE as ON_DELETE
|
|||
|
FROM ALL_CONSTRAINTS c_list, ALL_CONS_COLUMNS c_src, ALL_CONS_COLUMNS c_dest
|
|||
|
WHERE c_list.CONSTRAINT_NAME = c_src.CONSTRAINT_NAME
|
|||
|
AND c_list.R_CONSTRAINT_NAME = c_dest.CONSTRAINT_NAME
|
|||
|
AND c_list.CONSTRAINT_TYPE = 'R'
|
|||
|
AND c_src.TABLE_NAME = ".q($Q);foreach(get_rows($F)as$I)$H[$I['NAME']]=array("db"=>$I['DEST_DB'],"table"=>$I['DEST_TABLE'],"source"=>array($I['SRC_COLUMN']),"target"=>array($I['DEST_COLUMN']),"on_delete"=>$I['ON_DELETE'],"on_update"=>null,);return$H;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($dj){return
|
|||
|
apply_queries("DROP VIEW",$dj);}function
|
|||
|
drop_tables($S){return
|
|||
|
apply_queries("DROP TABLE",$S);}function
|
|||
|
last_id(){return
|
|||
|
0;}function
|
|||
|
schemas(){return
|
|||
|
get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX'))");}function
|
|||
|
get_schema(){global$h;return$h->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");}function
|
|||
|
set_schema($eh,$i=null){global$h;if(!$i)$i=$h;return$i->query("ALTER SESSION SET CURRENT_SCHEMA = ".idf_escape($eh));}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals('SELECT name, display_value FROM v$parameter');}function
|
|||
|
process_list(){return
|
|||
|
get_rows('SELECT sess.process AS "process", sess.username AS "user", sess.schemaname AS "schema", sess.status AS "status", sess.wait_class AS "wait_class", sess.seconds_in_wait AS "seconds_in_wait", sql.sql_text AS "sql_text", sess.machine AS "machine", sess.port AS "port"
|
|||
|
FROM v$session sess LEFT OUTER JOIN v$sql sql
|
|||
|
ON sql.sql_id = sess.sql_id
|
|||
|
WHERE sess.type = \'USER\'
|
|||
|
ORDER BY PROCESS
|
|||
|
');}function
|
|||
|
show_status(){$J=get_rows('SELECT * FROM v$instance');return
|
|||
|
reset($J);}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view|view_trigger)$~',$Rc);}$x="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$y=>$X){$U+=$X;$Kh[$y]=array_keys($X);}$Li=array();$yf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$md=array("length","lower","round","upper");$sd=array("avg","count","count distinct","max","min","sum");$oc=array(array("date"=>"current_date","timestamp"=>"current_timestamp",),array("number|float|double"=>"+/-","date|timestamp"=>"+ interval/- interval","char|clob"=>"||",));}$gc["mssql"]="MS SQL (beta)";if(isset($_GET["mssql"])){$kg=array("SQLSRV","MSSQL","PDO_DBLIB");define("DRIVER","mssql");if(extension_loaded("sqlsrv")){class
|
|||
|
Min_DB{var$extension="sqlsrv",$_link,$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
_get_error(){$this->error="";foreach(sqlsrv_errors()as$n){$this->errno=$n["code"];$this->error.="$n[message]\n";}$this->error=rtrim($this->error);}function
|
|||
|
connect($M,$V,$E){global$b;$l=$b->database();$zb=array("UID"=>$V,"PWD"=>$E,"CharacterSet"=>"UTF-8");if($l!="")$zb["Database"]=$l;$this->_link=@sqlsrv_connect(preg_replace('~:~',',',$M),$zb);if($this->_link){$Rd=sqlsrv_server_info($this->_link);$this->server_info=$Rd['SQLServerVersion'];}else$this->_get_error();return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($j){return$this->query("USE ".idf_escape($j));}function
|
|||
|
query($F,$Fi=false){$G=sqlsrv_query($this->_link,$F);$this->error="";if(!$G){$this->_get_error();return
|
|||
|
false;}return$this->store_result($G);}function
|
|||
|
multi_query($F){$this->_result=sqlsrv_query($this->_link,$F);$this->error="";if(!$this->_result){$this->_get_error();return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
store_result($G=null){if(!$G)$G=$this->_result;if(!$G)return
|
|||
|
false;if(sqlsrv_field_metadata($G))return
|
|||
|
new
|
|||
|
Min_Result($G);$this->affected_rows=sqlsrv_rows_affected($G);return
|
|||
|
true;}function
|
|||
|
next_result(){return$this->_result?sqlsrv_next_result($this->_result):null;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!is_object($G))return
|
|||
|
false;$I=$G->fetch_row();return$I[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
__construct($G){$this->_result=$G;}function
|
|||
|
_convert($I){foreach((array)$I
|
|||
|
as$y=>$X){if(is_a($X,'DateTime'))$I[$y]=$X->format("Y-m-d H:i:s");}return$I;}function
|
|||
|
fetch_assoc(){return$this->_convert(sqlsrv_fetch_array($this->_result,SQLSRV_FETCH_ASSOC));}function
|
|||
|
fetch_row(){return$this->_convert(sqlsrv_fetch_array($this->_result,SQLSRV_FETCH_NUMERIC));}function
|
|||
|
fetch_field(){if(!$this->_fields)$this->_fields=sqlsrv_field_metadata($this->_result);$o=$this->_fields[$this->_offset++];$H=new
|
|||
|
stdClass;$H->name=$o["Name"];$H->orgname=$o["Name"];$H->type=($o["Type"]==1?254:0);return$H;}function
|
|||
|
seek($C){for($s=0;$s<$C;$s++)sqlsrv_fetch($this->_result);}function
|
|||
|
__destruct(){sqlsrv_free_stmt($this->_result);}}}elseif(extension_loaded("mssql")){class
|
|||
|
Min_DB{var$extension="MSSQL",$_link,$_result,$server_info,$affected_rows,$error;function
|
|||
|
connect($M,$V,$E){$this->_link=@mssql_connect($M,$V,$E);if($this->_link){$G=$this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");if($G){$I=$G->fetch_row();$this->server_info=$this->result("sp_server_info 2",2)." [$I[0]] $I[1]";}}else$this->error=mssql_get_last_message();return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($j){return
|
|||
|
mssql_select_db($j);}function
|
|||
|
query($F,$Fi=false){$G=@mssql_query($F,$this->_link);$this->error="";if(!$G){$this->error=mssql_get_last_message();return
|
|||
|
false;}if($G===true){$this->affected_rows=mssql_rows_affected($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($G);}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
mssql_next_result($this->_result->_result);}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!is_object($G))return
|
|||
|
false;return
|
|||
|
mssql_result($G->_result,0,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
__construct($G){$this->_result=$G;$this->num_rows=mssql_num_rows($G);}function
|
|||
|
fetch_assoc(){return
|
|||
|
mssql_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
mssql_fetch_row($this->_result);}function
|
|||
|
num_rows(){return
|
|||
|
mssql_num_rows($this->_result);}function
|
|||
|
fetch_field(){$H=mssql_fetch_field($this->_result);$H->orgtable=$H->table;$H->orgname=$H->name;return$H;}function
|
|||
|
seek($C){mssql_data_seek($this->_result,$C);}function
|
|||
|
__destruct(){mssql_free_result($this->_result);}}}elseif(extension_loaded("pdo_dblib")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_DBLIB";function
|
|||
|
connect($M,$V,$E){$this->dsn("dblib:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\d)~',';port=\1',$M)),$V,$E);return
|
|||
|
true;}function
|
|||
|
select_db($j){return$this->query("USE ".idf_escape($j));}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$J,$ng){foreach($J
|
|||
|
as$N){$Mi=array();$Z=array();foreach($N
|
|||
|
as$y=>$X){$Mi[]="$y = $X";if(isset($ng[idf_unescape($y)]))$Z[]="$y = $X";}if(!queries("MERGE ".table($Q)." USING (VALUES(".implode(", ",$N).")) AS source (c".implode(", c",range(1,count($N))).") ON ".implode(" AND ",$Z)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$Mi)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($N)).") VALUES (".implode(", ",$N).");"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN TRANSACTION");}}function
|
|||
|
idf_escape($u){return"[".str_replace("]","]]",$u)."]";}function
|
|||
|
table($u){return($_GET["ns"]!=""?idf_escape($_GET["ns"]).".":"").idf_escape($u);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Jb=$b->credentials();if($h->connect($Jb[0],$Jb[1],$Jb[2]))return$h;return$h->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')");}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return($z!==null?" TOP (".($z+$C).")":"")." $F$Z";}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){return
|
|||
|
limit($F,$Z,1,0,$L);}function
|
|||
|
db_collation($l,$qb){global$h;return$h->result("SELECT collation_name FROM sys.databases WHERE name = ".q($l));}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT SUSER_NAME()");}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals("SELECT name, type_desc FROM sys.all_objects WHERE schema_id = SCHEMA_ID(".q(get_schema()).") AND type IN ('S', 'U', 'V') ORDER BY name");}function
|
|||
|
count_tables($k){global$h;$H=array();foreach($k
|
|||
|
as$l){$h->select_db($l);$H[$l]=$h->result("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES");}return$H;}function
|
|||
|
table_status($B=""){$H=array();foreach(get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment FROM sys.all_objects AS ao WHERE schema_id = SCHEMA_ID(".q(get_schema()).") AND type IN ('S', 'U', 'V') ".($B!=""?"AND name = ".q($B):"ORDER BY name"))as$I){if($B!="")return$I;$H[$I["Name"]]=$I;}return$H;}function
|
|||
|
is_view($R){return$R["Engine"]=="VIEW";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($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)");$H=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]
|
|||
|
FROM sys.all_columns c
|
|||
|
JOIN sys.all_objects o ON c.object_id = o.object_id
|
|||
|
JOIN sys.types t ON c.user_type_id = t.user_type_id
|
|||
|
LEFT JOIN sys.default_constraints d ON c.default_object_id = d.parent_column_id
|
|||
|
WHERE o.schema_id = SCHEMA_ID(".q(get_schema()).") AND o.type IN ('S', 'U', 'V') AND o.name = ".q($Q))as$I){$T=$I["type"];$we=(preg_match("~char|binary~",$T)?$I["max_length"]:($T=="decimal"?"$I[precision],$I[scale]":""));$H[$I["name"]]=array("field"=>$I["name"],"full_type"=>$T.($we?"($we)":""),"type"=>$T,"length"=>$we,"default"=>$I["default"],"null"=>$I["is_nullable"],"auto_increment"=>$I["is_identity"],"collation"=>$I["collation_name"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"primary"=>$I["is_identity"],"comment"=>$wb[$I["name"]],);}return$H;}function
|
|||
|
indexes($Q,$i=null){$H=array();foreach(get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
|
|||
|
FROM sys.indexes i
|
|||
|
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
|
|||
|
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
|
|||
|
WHERE OBJECT_NAME(i.object_id) = ".q($Q),$i)as$I){$B=$I["name"];$H[$B]["type"]=($I["is_primary_key"]?"PRIMARY":($I["is_unique"]?"UNIQUE":"INDEX"));$H[$B]["lengths"]=array();$H[$B]["columns"][$I["key_ordinal"]]=$I["column_name"];$H[$B]["descs"][$I["key_ordinal"]]=($I["is_descending_key"]?'1':null);}return$H;}function
|
|||
|
view($B){global$h;return
|
|||
|
array("select"=>preg_replace('~^(?:[^[]|\[[^]]*])*\s+AS\s+~isU','',$h->result("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = ".q($B))));}function
|
|||
|
collations(){$H=array();foreach(get_vals("SELECT name FROM fn_helpcollations()")as$d)$H[preg_replace('~_.*~','',$d)][]=$d;return$H;}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
nl_br(h(preg_replace('~^(\[[^]]*])+~m','',$h->error)));}function
|
|||
|
create_database($l,$d){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($l).(preg_match('~^[a-z0-9_]+$~i',$d)?" COLLATE $d":""));}function
|
|||
|
drop_databases($k){return
|
|||
|
queries("DROP DATABASE ".implode(", ",array_map('idf_escape',$k)));}function
|
|||
|
rename_database($B,$d){if(preg_match('~^[a-z0-9_]+$~i',$d))queries("ALTER DATABASE ".idf_escape(DB)." COLLATE $d");queries("ALTER DATABASE ".idf_escape(DB)." MODIFY NAME = ".idf_escape($B));return
|
|||
|
true;}function
|
|||
|
auto_increment(){return" IDENTITY".($_POST["Auto_increment"]!=""?"(".number($_POST["Auto_increment"]).",1)":"")." PRIMARY KEY";}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){$c=array();$wb=array();foreach($p
|
|||
|
as$o){$e=idf_escape($o[0]);$X=$o[1];if(!$X)$c["DROP"][]=" COLUMN $e";else{$X[1]=preg_replace("~( COLLATE )'(\\w+)'~",'\1\2',$X[1]);$wb[$o[0]]=$X[5];unset($X[5]);if($o[0]=="")$c["ADD"][]="\n ".implode("",$X).($Q==""?substr($ed[$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
|
|||
|
queries("CREATE TABLE ".table($B)." (".implode(",",(array)$c["ADD"])."\n)");if($Q!=$B)queries("EXEC sp_rename ".q(table($Q)).", ".q($B));if($ed)$c[""]=$ed;foreach($c
|
|||
|
as$y=>$X){if(!queries("ALTER TABLE ".idf_escape($B)." $y".implode(",",$X)))return
|
|||
|
false;}foreach($wb
|
|||
|
as$y=>$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($B).", @level2type = N'Column', @level2name = ".q($y));queries("EXEC sp_addextendedproperty @name = N'MS_Description', @value = ".$vb.", @level0type = N'Schema', @level0name = ".q(get_schema()).", @level1type = N'Table', @level1name = ".q($B).", @level2type = N'Column', @level2name = ".q($y));}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){$v=array();$hc=array();foreach($c
|
|||
|
as$X){if($X[2]=="DROP"){if($X[0]=="PRIMARY")$hc[]=idf_escape($X[1]);else$v[]=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
|
|||
|
false;}return(!$v||queries("DROP INDEX ".implode(", ",$v)))&&(!$hc||queries("ALTER TABLE ".table($Q)." DROP ".implode(", ",$hc)));}function
|
|||
|
last_id(){global$h;return$h->result("SELECT SCOPE_IDENTITY()");}function
|
|||
|
explain($h,$F){$h->query("SET SHOWPLAN_ALL ON");$H=$h->query($F);$h->query("SET SHOWPLAN_ALL OFF");return$H;}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
foreign_keys($Q){$H=array();foreach(get_rows("EXEC sp_fkeys @fktable_name = ".q($Q))as$I){$q=&$H[$I["FK_NAME"]];$q["db"]=$I["PKTABLE_QUALIFIER"];$q["table"]=$I["PKTABLE_NAME"];$q["source"][]=$I["FKCOLUMN_NAME"];$q["target"][]=$I["PKCOLUMN_NAME"];}return$H;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($dj){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$dj)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$dj,$ai){return
|
|||
|
apply_queries("ALTER SCHEMA ".idf_escape($ai)." TRANSFER",array_merge($S,$dj));}function
|
|||
|
trigger($B){if($B=="")return
|
|||
|
array();$J=get_rows("SELECT s.name [Trigger],
|
|||
|
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(s.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(s.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
|
|||
|
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing],
|
|||
|
c.text
|
|||
|
FROM sysobjects s
|
|||
|
JOIN syscomments c ON s.id = c.id
|
|||
|
WHERE s.xtype = 'TR' AND s.name = ".q($B));$H=reset($J);if($H)$H["Statement"]=preg_replace('~^.+\s+AS\s+~isU','',$H["text"]);return$H;}function
|
|||
|
triggers($Q){$H=array();foreach(get_rows("SELECT sys1.name,
|
|||
|
CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
|
|||
|
CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing]
|
|||
|
FROM sysobjects sys1
|
|||
|
JOIN sysobjects sys2 ON sys1.parent_obj = sys2.id
|
|||
|
WHERE sys1.xtype = 'TR' AND sys2.name = ".q($Q))as$I)$H[$I["name"]]=array($I["Timing"],$I["Event"]);return$H;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("AFTER","INSTEAD OF"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("AS"),);}function
|
|||
|
schemas(){return
|
|||
|
get_vals("SELECT name FROM sys.schemas");}function
|
|||
|
get_schema(){global$h;if($_GET["ns"]!="")return$_GET["ns"];return$h->result("SELECT SCHEMA_NAME()");}function
|
|||
|
set_schema($dh){return
|
|||
|
true;}function
|
|||
|
use_sql($j){return"USE ".idf_escape($j);}function
|
|||
|
show_variables(){return
|
|||
|
array();}function
|
|||
|
show_status(){return
|
|||
|
array();}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match('~^(comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~',$Rc);}$x="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$y=>$X){$U+=$X;$Kh[$y]=array_keys($X);}$Li=array();$yf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$md=array("len","lower","round","upper");$sd=array("avg","count","count distinct","max","min","sum");$oc=array(array("date|time"=>"getdate",),array("int|decimal|real|float|money|datetime"=>"+/-","char|text"=>"+",));}$gc['firebird']='Firebird (alpha)';if(isset($_GET["firebird"])){$kg=array("interbase");define("DRIVER","firebird");if(extension_loaded("interbase")){class
|
|||
|
Min_DB{var$extension="Firebird",$server_info,$affected_rows,$errno,$error,$_link,$_result;function
|
|||
|
connect($M,$V,$E){$this->_link=ibase_connect($M,$V,$E);if($this->_link){$Pi=explode(':',$M);$this->service_link=ibase_service_attach($Pi[0],$V,$E);$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
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($j){return($j=="domain");}function
|
|||
|
query($F,$Fi=false){$G=ibase_query($F,$this->_link);if(!$G){$this->errno=ibase_errcode();$this->error=ibase_errmsg();return
|
|||
|
false;}$this->error="";if($G===true){$this->affected_rows=ibase_affected_rows($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($G);}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!$G||!$G->num_rows)return
|
|||
|
false;$I=$G->fetch_row();return$I[$o];}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
__construct($G){$this->_result=$G;}function
|
|||
|
fetch_assoc(){return
|
|||
|
ibase_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
ibase_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$o=ibase_field_info($this->_result,$this->_offset++);return(object)array('name'=>$o['name'],'orgname'=>$o['name'],'type'=>$o['type'],'charsetnr'=>$o['length'],);}function
|
|||
|
__destruct(){ibase_free_result($this->_result);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Jb=$b->credentials();if($h->connect($Jb[0],$Jb[1],$Jb[2]))return$h;return$h->error;}function
|
|||
|
get_databases($cd){return
|
|||
|
array("domain");}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){$H='';$H.=($z!==null?$L."FIRST $z".($C?" SKIP $C":""):"");$H.=" $F$Z";return$H;}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){return
|
|||
|
limit($F,$Z,1,0,$L);}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$b;$Jb=$b->credentials();return$Jb[1];}function
|
|||
|
tables_list(){global$h;$F='SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0';$G=ibase_query($h->_link,$F);$H=array();while($I=ibase_fetch_assoc($G))$H[$I['RDB$RELATION_NAME']]='table';ksort($H);return$H;}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($B="",$Qc=false){global$h;$H=array();$Ob=tables_list();foreach($Ob
|
|||
|
as$v=>$X){$v=trim($v);$H[$v]=array('Name'=>$v,'Engine'=>'standard',);if($B==$v)return$H[$v];}return$H;}function
|
|||
|
is_view($R){return
|
|||
|
false;}function
|
|||
|
fk_support($R){return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$R["Engine"]);}function
|
|||
|
fields($Q){global$h;$H=array();$F='SELECT r.RDB$FIELD_NAME AS field_name,
|
|||
|
r.RDB$DESCRIPTION AS field_description,
|
|||
|
r.RDB$DEFAULT_VALUE AS field_default_value,
|
|||
|
r.RDB$NULL_FLAG AS field_not_null_constraint,
|
|||
|
f.RDB$FIELD_LENGTH AS field_length,
|
|||
|
f.RDB$FIELD_PRECISION AS field_precision,
|
|||
|
f.RDB$FIELD_SCALE AS field_scale,
|
|||
|
CASE f.RDB$FIELD_TYPE
|
|||
|
WHEN 261 THEN \'BLOB\'
|
|||
|
WHEN 14 THEN \'CHAR\'
|
|||
|
WHEN 40 THEN \'CSTRING\'
|
|||
|
WHEN 11 THEN \'D_FLOAT\'
|
|||
|
WHEN 27 THEN \'DOUBLE\'
|
|||
|
WHEN 10 THEN \'FLOAT\'
|
|||
|
WHEN 16 THEN \'INT64\'
|
|||
|
WHEN 8 THEN \'INTEGER\'
|
|||
|
WHEN 9 THEN \'QUAD\'
|
|||
|
WHEN 7 THEN \'SMALLINT\'
|
|||
|
WHEN 12 THEN \'DATE\'
|
|||
|
WHEN 13 THEN \'TIME\'
|
|||
|
WHEN 35 THEN \'TIMESTAMP\'
|
|||
|
WHEN 37 THEN \'VARCHAR\'
|
|||
|
ELSE \'UNKNOWN\'
|
|||
|
END AS field_type,
|
|||
|
f.RDB$FIELD_SUB_TYPE AS field_subtype,
|
|||
|
coll.RDB$COLLATION_NAME AS field_collation,
|
|||
|
cset.RDB$CHARACTER_SET_NAME AS field_charset
|
|||
|
FROM RDB$RELATION_FIELDS r
|
|||
|
LEFT JOIN RDB$FIELDS f ON r.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME
|
|||
|
LEFT JOIN RDB$COLLATIONS coll ON f.RDB$COLLATION_ID = coll.RDB$COLLATION_ID
|
|||
|
LEFT JOIN RDB$CHARACTER_SETS cset ON f.RDB$CHARACTER_SET_ID = cset.RDB$CHARACTER_SET_ID
|
|||
|
WHERE r.RDB$RELATION_NAME = '.q($Q).'
|
|||
|
ORDER BY r.RDB$FIELD_POSITION';$G=ibase_query($h->_link,$F);while($I=ibase_fetch_assoc($G))$H[trim($I['FIELD_NAME'])]=array("field"=>trim($I["FIELD_NAME"]),"full_type"=>trim($I["FIELD_TYPE"]),"type"=>trim($I["FIELD_SUB_TYPE"]),"default"=>trim($I['FIELD_DEFAULT_VALUE']),"null"=>(trim($I["FIELD_NOT_NULL_CONSTRAINT"])=="YES"),"auto_increment"=>'0',"collation"=>trim($I["FIELD_COLLATION"]),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"comment"=>trim($I["FIELD_DESCRIPTION"]),);return$H;}function
|
|||
|
indexes($Q,$i=null){$H=array();return$H;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($dh){return
|
|||
|
true;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match("~^(columns|sql|status|table)$~",$Rc);}$x="firebird";$yf=array("=");$md=array();$sd=array();$oc=array();}$gc["simpledb"]="SimpleDB";if(isset($_GET["simpledb"])){$kg=array("SimpleXML + allow_url_fopen");define("DRIVER","simpledb");if(class_exists('SimpleXMLElement')&&ini_bool('allow_url_fopen')){class
|
|||
|
Min_DB{var$extension="SimpleXML",$server_info='2009-04-15',$error,$timeout,$next,$affected_rows,$_result;function
|
|||
|
select_db($j){return($j=="domain");}function
|
|||
|
query($F,$Fi=false){$Rf=array('SelectExpression'=>$F,'ConsistentRead'=>'true');if($this->next)$Rf['NextToken']=$this->next;$G=sdb_request_all('Select','Item',$Rf,$this->timeout);$this->timeout=0;if($G===false)return$G;if(preg_match('~^\s*SELECT\s+COUNT\(~i',$F)){$Oh=0;foreach($G
|
|||
|
as$de)$Oh+=$de->Attribute->Value;$G=array((object)array('Attribute'=>array((object)array('Name'=>'Count','Value'=>$Oh,))));}return
|
|||
|
new
|
|||
|
Min_Result($G);}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0;function
|
|||
|
__construct($G){foreach($G
|
|||
|
as$de){$I=array();if($de->Name!='')$I['itemName()']=(string)$de->Name;foreach($de->Attribute
|
|||
|
as$Ja){$B=$this->_processValue($Ja->Name);$Y=$this->_processValue($Ja->Value);if(isset($I[$B])){$I[$B]=(array)$I[$B];$I[$B][]=$Y;}else$I[$B]=$Y;}$this->_rows[]=$I;foreach($I
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
_processValue($rc){return(is_object($rc)&&$rc['encoding']=='base64'?base64_decode($rc):(string)$rc);}function
|
|||
|
fetch_assoc(){$I=current($this->_rows);if(!$I)return$I;$H=array();foreach($this->_rows[0]as$y=>$X)$H[$y]=$I[$y];next($this->_rows);return$H;}function
|
|||
|
fetch_row(){$H=$this->fetch_assoc();if(!$H)return$H;return
|
|||
|
array_values($H);}function
|
|||
|
fetch_field(){$je=array_keys($this->_rows[0]);return(object)array('name'=>$je[$this->_offset++]);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$ng="itemName()";function
|
|||
|
_chunkRequest($Gd,$wa,$Rf,$Gc=array()){global$h;foreach(array_chunk($Gd,25)as$jb){$Sf=$Rf;foreach($jb
|
|||
|
as$s=>$t){$Sf["Item.$s.ItemName"]=$t;foreach($Gc
|
|||
|
as$y=>$X)$Sf["Item.$s.$y"]=$X;}if(!sdb_request($wa,$Sf))return
|
|||
|
false;}$h->affected_rows=count($Gd);return
|
|||
|
true;}function
|
|||
|
_extractIds($Q,$zg,$z){$H=array();if(preg_match_all("~itemName\(\) = (('[^']*+')+)~",$zg,$Ge))$H=array_map('idf_unescape',$Ge[1]);else{foreach(sdb_request_all('Select','Item',array('SelectExpression'=>'SELECT itemName() FROM '.table($Q).$zg.($z?" LIMIT 1":"")))as$de)$H[]=$de->Name;}return$H;}function
|
|||
|
select($Q,$K,$Z,$pd,$Cf=array(),$z=1,$D=0,$pg=false){global$h;$h->next=$_GET["next"];$H=parent::select($Q,$K,$Z,$pd,$Cf,$z,$D,$pg);$h->next=0;return$H;}function
|
|||
|
delete($Q,$zg,$z=0){return$this->_chunkRequest($this->_extractIds($Q,$zg,$z),'BatchDeleteAttributes',array('DomainName'=>$Q));}function
|
|||
|
update($Q,$N,$zg,$z=0,$L="\n"){$Xb=array();$Vd=array();$s=0;$Gd=$this->_extractIds($Q,$zg,$z);$t=idf_unescape($N["`itemName()`"]);unset($N["`itemName()`"]);foreach($N
|
|||
|
as$y=>$X){$y=idf_unescape($y);if($X=="NULL"||($t!=""&&array($t)!=$Gd))$Xb["Attribute.".count($Xb).".Name"]=$y;if($X!="NULL"){foreach((array)$X
|
|||
|
as$fe=>$W){$Vd["Attribute.$s.Name"]=$y;$Vd["Attribute.$s.Value"]=(is_array($X)?$W:idf_unescape($W));if(!$fe)$Vd["Attribute.$s.Replace"]="true";$s++;}}}$Rf=array('DomainName'=>$Q);return(!$Vd||$this->_chunkRequest(($t!=""?array($t):$Gd),'BatchPutAttributes',$Rf,$Vd))&&(!$Xb||$this->_chunkRequest($Gd,'BatchDeleteAttributes',$Rf,$Xb));}function
|
|||
|
insert($Q,$N){$Rf=array("DomainName"=>$Q);$s=0;foreach($N
|
|||
|
as$B=>$Y){if($Y!="NULL"){$B=idf_unescape($B);if($B=="itemName()")$Rf["ItemName"]=idf_unescape($Y);else{foreach((array)$Y
|
|||
|
as$X){$Rf["Attribute.$s.Name"]=$B;$Rf["Attribute.$s.Value"]=(is_array($Y)?$X:idf_unescape($Y));$s++;}}}}return
|
|||
|
sdb_request('PutAttributes',$Rf);}function
|
|||
|
insertUpdate($Q,$J,$ng){foreach($J
|
|||
|
as$N){if(!$this->update($Q,$N,"WHERE `itemName()` = ".q($N["`itemName()`"])))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
begin(){return
|
|||
|
false;}function
|
|||
|
commit(){return
|
|||
|
false;}function
|
|||
|
rollback(){return
|
|||
|
false;}function
|
|||
|
slowQuery($F,$ii){$this->_conn->timeout=$ii;return$F;}}function
|
|||
|
connect(){global$b;list(,,$E)=$b->credentials();if($E!="")return
|
|||
|
lang(22);return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match('~sql~',$Rc);}function
|
|||
|
logged_user(){global$b;$Jb=$b->credentials();return$Jb[1];}function
|
|||
|
get_databases(){return
|
|||
|
array("domain");}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
tables_list(){global$h;$H=array();foreach(sdb_request_all('ListDomains','DomainName')as$Q)$H[(string)$Q]='table';if($h->error&&defined("PAGE_HEADER"))echo"<p class='error'>".error()."\n";return$H;}function
|
|||
|
table_status($B="",$Qc=false){$H=array();foreach(($B!=""?array($B=>true):tables_list())as$Q=>$T){$I=array("Name"=>$Q,"Auto_increment"=>"");if(!$Qc){$Te=sdb_request('DomainMetadata',array('DomainName'=>$Q));if($Te){foreach(array("Rows"=>"ItemCount","Data_length"=>"ItemNamesSizeBytes","Index_length"=>"AttributeValuesSizeBytes","Data_free"=>"AttributeNamesSizeBytes",)as$y=>$X)$I[$y]=(string)$Te->$X;}}if($B!="")return$I;$H[$Q]=$I;}return$H;}function
|
|||
|
explain($h,$F){}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
indexes($Q,$i=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("itemName()")),);}function
|
|||
|
fields($Q){return
|
|||
|
fields_from_edit();}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return" $F$Z".($z!==null?$L."LIMIT $z":"");}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
fk_support($R){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){return($Q==""&&sdb_request('CreateDomain',array('DomainName'=>$B)));}function
|
|||
|
drop_tables($S){foreach($S
|
|||
|
as$Q){if(!sdb_request('DeleteDomain',array('DomainName'=>$Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
count_tables($k){foreach($k
|
|||
|
as$l)return
|
|||
|
array($l=>count(tables_list()));}function
|
|||
|
found_rows($R,$Z){return($Z?null:$R["Rows"]);}function
|
|||
|
last_id(){}function
|
|||
|
hmac($Ca,$Ob,$y,$Cg=false){$Wa=64;if(strlen($y)>$Wa)$y=pack("H*",$Ca($y));$y=str_pad($y,$Wa,"\0");$ge=$y^str_repeat("\x36",$Wa);$he=$y^str_repeat("\x5C",$Wa);$H=$Ca($he.pack("H*",$Ca($ge.$Ob)));if($Cg)$H=pack("H*",$H);return$H;}function
|
|||
|
sdb_request($wa,$Rf=array()){global$b,$h;list($Cd,$Rf['AWSAccessKeyId'],$gh)=$b->credentials();$Rf['Action']=$wa;$Rf['Timestamp']=gmdate('Y-m-d\TH:i:s+00:00');$Rf['Version']='2009-04-15';$Rf['SignatureVersion']=2;$Rf['SignatureMethod']='HmacSHA1';ksort($Rf);$F='';foreach($Rf
|
|||
|
as$y=>$X)$F.='&'.rawurlencode($y).'='.rawurlencode($X);$F=str_replace('%7E','~',substr($F,1));$F.="&Signature=".urlencode(base64_encode(hmac('sha1',"POST\n".preg_replace('~^https?://~','',$Cd)."\n/\n$F",$gh,true)));@ini_set('track_errors',1);$Vc=@file_get_contents((preg_match('~^https?://~',$Cd)?$Cd:"http://$Cd"),false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$F,'ignore_errors'=>1,))));if(!$Vc){$h->error=$php_errormsg;return
|
|||
|
false;}libxml_use_internal_errors(true);$qj=simplexml_load_string($Vc);if(!$qj){$n=libxml_get_last_error();$h->error=$n->message;return
|
|||
|
false;}if($qj->Errors){$n=$qj->Errors->Error;$h->error="$n->Message ($n->Code)";return
|
|||
|
false;}$h->error='';$Zh=$wa."Result";return($qj->$Zh?$qj->$Zh:true);}function
|
|||
|
sdb_request_all($wa,$Zh,$Rf=array(),$ii=0){$H=array();$Gh=($ii?microtime(true):0);$z=(preg_match('~LIMIT\s+(\d+)\s*$~i',$Rf['SelectExpression'],$A)?$A[1]:0);do{$qj=sdb_request($wa,$Rf);if(!$qj)break;foreach($qj->$Zh
|
|||
|
as$rc)$H[]=$rc;if($z&&count($H)>=$z){$_GET["next"]=$qj->NextToken;break;}if($ii&µtime(true)-$Gh>$ii)return
|
|||
|
false;$Rf['NextToken']=$qj->NextToken;if($z)$Rf['SelectExpression']=preg_replace('~\d+\s*$~',$z-count($H),$Rf['SelectExpression']);}while($qj->NextToken);return$H;}$x="simpledb";$yf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","IS NOT NULL");$md=array();$sd=array("count");$oc=array(array("json"));}$gc["mongo"]="MongoDB";if(isset($_GET["mongo"])){$kg=array("mongo","mongodb");define("DRIVER","mongo");if(class_exists('MongoDB')){class
|
|||
|
Min_DB{var$extension="Mongo",$server_info=MongoClient::VERSION,$error,$last_id,$_link,$_db;function
|
|||
|
connect($Ni,$Af){return@new
|
|||
|
MongoClient($Ni,$Af);}function
|
|||
|
query($F){return
|
|||
|
false;}function
|
|||
|
select_db($j){try{$this->_db=$this->_link->selectDB($j);return
|
|||
|
true;}catch(Exception$Cc){$this->error=$Cc->getMessage();return
|
|||
|
false;}}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
__construct($G){foreach($G
|
|||
|
as$de){$I=array();foreach($de
|
|||
|
as$y=>$X){if(is_a($X,'MongoBinData'))$this->_charset[$y]=63;$I[$y]=(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[]=$I;foreach($I
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
fetch_assoc(){$I=current($this->_rows);if(!$I)return$I;$H=array();foreach($this->_rows[0]as$y=>$X)$H[$y]=$I[$y];next($this->_rows);return$H;}function
|
|||
|
fetch_row(){$H=$this->fetch_assoc();if(!$H)return$H;return
|
|||
|
array_values($H);}function
|
|||
|
fetch_field(){$je=array_keys($this->_rows[0]);$B=$je[$this->_offset++];return(object)array('name'=>$B,'charsetnr'=>$this->_charset[$B],);}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$ng="_id";function
|
|||
|
select($Q,$K,$Z,$pd,$Cf=array(),$z=1,$D=0,$pg=false){$K=($K==array("*")?array():array_fill_keys($K,true));$yh=array();foreach($Cf
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$Fb);$yh[$X]=($Fb?-1:1);}return
|
|||
|
new
|
|||
|
Min_Result($this->_conn->_db->selectCollection($Q)->find(array(),$K)->sort($yh)->limit($z!=""?+$z:0)->skip($D*$z));}function
|
|||
|
insert($Q,$N){try{$H=$this->_conn->_db->selectCollection($Q)->insert($N);$this->_conn->errno=$H['code'];$this->_conn->error=$H['err'];$this->_conn->last_id=$N['_id'];return!$H['err'];}catch(Exception$Cc){$this->_conn->error=$Cc->getMessage();return
|
|||
|
false;}}}function
|
|||
|
get_databases($cd){global$h;$H=array();$Tb=$h->_link->listDBs();foreach($Tb['databases']as$l)$H[]=$l['name'];return$H;}function
|
|||
|
count_tables($k){global$h;$H=array();foreach($k
|
|||
|
as$l)$H[$l]=count($h->_link->selectDB($l)->getCollectionNames(true));return$H;}function
|
|||
|
tables_list(){global$h;return
|
|||
|
array_fill_keys($h->_db->getCollectionNames(true),'table');}function
|
|||
|
drop_databases($k){global$h;foreach($k
|
|||
|
as$l){$Pg=$h->_link->selectDB($l)->drop();if(!$Pg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
indexes($Q,$i=null){global$h;$H=array();foreach($h->_db->selectCollection($Q)->getIndexInfo()as$v){$ac=array();foreach($v["key"]as$e=>$T)$ac[]=($T==-1?'1':null);$H[$v["name"]]=array("type"=>($v["name"]=="_id_"?"PRIMARY":($v["unique"]?"UNIQUE":"INDEX")),"columns"=>array_keys($v["key"]),"lengths"=>array(),"descs"=>$ac,);}return$H;}function
|
|||
|
fields($Q){return
|
|||
|
fields_from_edit();}function
|
|||
|
found_rows($R,$Z){global$h;return$h->_db->selectCollection($_GET["select"])->count($Z);}$yf=array("=");}elseif(class_exists('MongoDB\Driver\Manager')){class
|
|||
|
Min_DB{var$extension="MongoDB",$server_info=MONGODB_VERSION,$error,$last_id;var$_link;var$_db,$_db_name;function
|
|||
|
connect($Ni,$Af){$lb='MongoDB\Driver\Manager';return
|
|||
|
new$lb($Ni,$Af);}function
|
|||
|
query($F){return
|
|||
|
false;}function
|
|||
|
select_db($j){$this->_db_name=$j;return
|
|||
|
true;}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
__construct($G){foreach($G
|
|||
|
as$de){$I=array();foreach($de
|
|||
|
as$y=>$X){if(is_a($X,'MongoDB\BSON\Binary'))$this->_charset[$y]=63;$I[$y]=(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[]=$I;foreach($I
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=$G->count;}function
|
|||
|
fetch_assoc(){$I=current($this->_rows);if(!$I)return$I;$H=array();foreach($this->_rows[0]as$y=>$X)$H[$y]=$I[$y];next($this->_rows);return$H;}function
|
|||
|
fetch_row(){$H=$this->fetch_assoc();if(!$H)return$H;return
|
|||
|
array_values($H);}function
|
|||
|
fetch_field(){$je=array_keys($this->_rows[0]);$B=$je[$this->_offset++];return(object)array('name'=>$B,'charsetnr'=>$this->_charset[$B],);}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$ng="_id";function
|
|||
|
select($Q,$K,$Z,$pd,$Cf=array(),$z=1,$D=0,$pg=false){global$h;$K=($K==array("*")?array():array_fill_keys($K,1));if(count($K)&&!isset($K['_id']))$K['_id']=0;$Z=where_to_query($Z);$yh=array();foreach($Cf
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$Fb);$yh[$X]=($Fb?-1:1);}if(isset($_GET['limit'])&&is_numeric($_GET['limit'])&&$_GET['limit']>0)$z=$_GET['limit'];$z=min(200,max(1,(int)$z));$vh=$D*$z;$lb='MongoDB\Driver\Query';$F=new$lb($Z,array('projection'=>$K,'limit'=>$z,'skip'=>$vh,'sort'=>$yh));$Sg=$h->_link->executeQuery("$h->_db_name.$Q",$F);return
|
|||
|
new
|
|||
|
Min_Result($Sg);}function
|
|||
|
update($Q,$N,$zg,$z=0,$L="\n"){global$h;$l=$h->_db_name;$Z=sql_query_where_parser($zg);$lb='MongoDB\Driver\BulkWrite';$ab=new$lb(array());if(isset($N['_id']))unset($N['_id']);$Mg=array();foreach($N
|
|||
|
as$y=>$Y){if($Y=='NULL'){$Mg[$y]=1;unset($N[$y]);}}$Mi=array('$set'=>$N);if(count($Mg))$Mi['$unset']=$Mg;$ab->update($Z,$Mi,array('upsert'=>false));$Sg=$h->_link->executeBulkWrite("$l.$Q",$ab);$h->affected_rows=$Sg->getModifiedCount();return
|
|||
|
true;}function
|
|||
|
delete($Q,$zg,$z=0){global$h;$l=$h->_db_name;$Z=sql_query_where_parser($zg);$lb='MongoDB\Driver\BulkWrite';$ab=new$lb(array());$ab->delete($Z,array('limit'=>$z));$Sg=$h->_link->executeBulkWrite("$l.$Q",$ab);$h->affected_rows=$Sg->getDeletedCount();return
|
|||
|
true;}function
|
|||
|
insert($Q,$N){global$h;$l=$h->_db_name;$lb='MongoDB\Driver\BulkWrite';$ab=new$lb(array());if(isset($N['_id'])&&empty($N['_id']))unset($N['_id']);$ab->insert($N);$Sg=$h->_link->executeBulkWrite("$l.$Q",$ab);$h->affected_rows=$Sg->getInsertedCount();return
|
|||
|
true;}}function
|
|||
|
get_databases($cd){global$h;$H=array();$lb='MongoDB\Driver\Command';$tb=new$lb(array('listDatabases'=>1));$Sg=$h->_link->executeCommand('admin',$tb);foreach($Sg
|
|||
|
as$Tb){foreach($Tb->databases
|
|||
|
as$l)$H[]=$l->name;}return$H;}function
|
|||
|
count_tables($k){$H=array();return$H;}function
|
|||
|
tables_list(){global$h;$lb='MongoDB\Driver\Command';$tb=new$lb(array('listCollections'=>1));$Sg=$h->_link->executeCommand($h->_db_name,$tb);$rb=array();foreach($Sg
|
|||
|
as$G)$rb[$G->name]='table';return$rb;}function
|
|||
|
drop_databases($k){return
|
|||
|
false;}function
|
|||
|
indexes($Q,$i=null){global$h;$H=array();$lb='MongoDB\Driver\Command';$tb=new$lb(array('listIndexes'=>$Q));$Sg=$h->_link->executeCommand($h->_db_name,$tb);foreach($Sg
|
|||
|
as$v){$ac=array();$f=array();foreach(get_object_vars($v->key)as$e=>$T){$ac[]=($T==-1?'1':null);$f[]=$e;}$H[$v->name]=array("type"=>($v->name=="_id_"?"PRIMARY":(isset($v->unique)?"UNIQUE":"INDEX")),"columns"=>$f,"lengths"=>array(),"descs"=>$ac,);}return$H;}function
|
|||
|
fields($Q){$p=fields_from_edit();if(!count($p)){global$m;$G=$m->select($Q,array("*"),null,null,array(),10);while($I=$G->fetch_assoc()){foreach($I
|
|||
|
as$y=>$X){$I[$y]=null;$p[$y]=array("field"=>$y,"type"=>"string","null"=>($y!=$m->primary),"auto_increment"=>($y==$m->primary),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1,),);}}}return$p;}function
|
|||
|
found_rows($R,$Z){global$h;$Z=where_to_query($Z);$lb='MongoDB\Driver\Command';$tb=new$lb(array('count'=>$R['Name'],'query'=>$Z));$Sg=$h->_link->executeCommand($h->_db_name,$tb);$qi=$Sg->toArray();return$qi[0]->n;}function
|
|||
|
sql_query_where_parser($zg){$zg=trim(preg_replace('/WHERE[\s]?[(]?\(?/','',$zg));$zg=preg_replace('/\)\)\)$/',')',$zg);$nj=explode(' AND ',$zg);$oj=explode(') OR (',$zg);$Z=array();foreach($nj
|
|||
|
as$lj)$Z[]=trim($lj);if(count($oj)==1)$oj=array();elseif(count($oj)>1)$Z=array();return
|
|||
|
where_to_query($Z,$oj);}function
|
|||
|
where_to_query($jj=array(),$kj=array()){global$b;$Ob=array();foreach(array('and'=>$jj,'or'=>$kj)as$T=>$Z){if(is_array($Z)){foreach($Z
|
|||
|
as$Jc){list($ob,$wf,$X)=explode(" ",$Jc,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($wf,$b->operators))continue;if(preg_match('~^\(f\)(.+)~',$wf,$A)){$X=(float)$X;$wf=$A[1];}elseif(preg_match('~^\(date\)(.+)~',$wf,$A)){$Qb=new
|
|||
|
DateTime($X);$lb='MongoDB\BSON\UTCDatetime';$X=new$lb($Qb->getTimestamp()*1000);$wf=$A[1];}switch($wf){case'=':$wf='$eq';break;case'!=':$wf='$ne';break;case'>':$wf='$gt';break;case'<':$wf='$lt';break;case'>=':$wf='$gte';break;case'<=':$wf='$lte';break;case'regex':$wf='$regex';break;default:continue
|
|||
|
2;}if($T=='and')$Ob['$and'][]=array($ob=>array($wf=>$X));elseif($T=='or')$Ob['$or'][]=array($ob=>array($wf=>$X));}}}return$Ob;}$yf=array("=","!=",">","<",">=","<=","regex","(f)=","(f)!=","(f)>","(f)<","(f)>=","(f)<=","(date)=","(date)!=","(date)>","(date)<","(date)>=","(date)<=",);}function
|
|||
|
table($u){return$u;}function
|
|||
|
idf_escape($u){return$u;}function
|
|||
|
table_status($B="",$Qc=false){$H=array();foreach(tables_list()as$Q=>$T){$H[$Q]=array("Name"=>$Q);if($B==$Q)return$H[$Q];}return$H;}function
|
|||
|
create_database($l,$d){return
|
|||
|
true;}function
|
|||
|
last_id(){global$h;return$h->last_id;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$b;$Jb=$b->credentials();return$Jb[1];}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;list($M,$V,$E)=$b->credentials();$Af=array();if($V.$E!=""){$Af["username"]=$V;$Af["password"]=$E;}$l=$b->database();if($l!="")$Af["db"]=$l;if(($Ma=getenv("MONGO_AUTH_SOURCE")))$Af["authSource"]=$Ma;try{$h->_link=$h->connect("mongodb://$M",$Af);if($E!=""){$Af["password"]="";try{$h->connect("mongodb://$M",$Af);return
|
|||
|
lang(22);}catch(Exception$Cc){}}return$h;}catch(Exception$Cc){return$Cc->getMessage();}}function
|
|||
|
alter_indexes($Q,$c){global$h;foreach($c
|
|||
|
as$X){list($T,$B,$N)=$X;if($N=="DROP")$H=$h->_db->command(array("deleteIndexes"=>$Q,"index"=>$B));else{$f=array();foreach($N
|
|||
|
as$e){$e=preg_replace('~ DESC$~','',$e,1,$Fb);$f[$e]=($Fb?-1:1);}$H=$h->_db->selectCollection($Q)->ensureIndex($f,array("unique"=>($T=="UNIQUE"),"name"=>$B,));}if($H['errmsg']){$h->error=$H['errmsg'];return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match("~database|indexes|descidx~",$Rc);}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
fk_support($R){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){global$h;if($Q==""){$h->_db->createCollection($B);return
|
|||
|
true;}}function
|
|||
|
drop_tables($S){global$h;foreach($S
|
|||
|
as$Q){$Pg=$h->_db->selectCollection($Q)->drop();if(!$Pg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){global$h;foreach($S
|
|||
|
as$Q){$Pg=$h->_db->selectCollection($Q)->remove();if(!$Pg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}$x="mongo";$md=array();$sd=array();$oc=array(array("json"));}$gc["elastic"]="Elasticsearch (beta)";if(isset($_GET["elastic"])){$kg=array("json + allow_url_fopen");define("DRIVER","elastic");if(function_exists('json_decode')&&ini_bool('allow_url_fopen')){class
|
|||
|
Min_DB{var$extension="JSON",$server_info,$errno,$error,$_url;function
|
|||
|
rootQuery($bg,$Ab=array(),$Ue='GET'){@ini_set('track_errors',1);$Vc=@file_get_contents("$this->_url/".ltrim($bg,'/'),false,stream_context_create(array('http'=>array('method'=>$Ue,'content'=>$Ab===null?$Ab:json_encode($Ab),'header'=>'Content-Type: application/json','ignore_errors'=>1,))));if(!$Vc){$this->error=$php_errormsg;return$Vc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Vc;return
|
|||
|
false;}$H=json_decode($Vc,true);if($H===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$B=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$B)){$this->error=$B;break;}}}}return$H;}function
|
|||
|
query($bg,$Ab=array(),$Ue='GET'){return$this->rootQuery(($this->_db!=""?"$this->_db/":"/").ltrim($bg,'/'),$Ab,$Ue);}function
|
|||
|
connect($M,$V,$E){preg_match('~^(https?://)?(.*)~',$M,$A);$this->_url=($A[1]?$A[1]:"http://")."$V:$E@$A[2]";$H=$this->query('');if($H)$this->server_info=$H['version']['number'];return(bool)$H;}function
|
|||
|
select_db($j){$this->_db=$j;return
|
|||
|
true;}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows;function
|
|||
|
__construct($J){$this->num_rows=count($J);$this->_rows=$J;reset($this->_rows);}function
|
|||
|
fetch_assoc(){$H=current($this->_rows);next($this->_rows);return$H;}function
|
|||
|
fetch_row(){return
|
|||
|
array_values($this->fetch_assoc());}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
select($Q,$K,$Z,$pd,$Cf=array(),$z=1,$D=0,$pg=false){global$b;$Ob=array();$F="$Q/_search";if($K!=array("*"))$Ob["fields"]=$K;if($Cf){$yh=array();foreach($Cf
|
|||
|
as$ob){$ob=preg_replace('~ DESC$~','',$ob,1,$Fb);$yh[]=($Fb?array($ob=>"desc"):$ob);}$Ob["sort"]=$yh;}if($z){$Ob["size"]=+$z;if($D)$Ob["from"]=($D*$z);}foreach($Z
|
|||
|
as$X){list($ob,$wf,$X)=explode(" ",$X,3);if($ob=="_id")$Ob["query"]["ids"]["values"][]=$X;elseif($ob.$X!=""){$di=array("term"=>array(($ob!=""?$ob:"_all")=>$X));if($wf=="=")$Ob["query"]["filtered"]["filter"]["and"][]=$di;else$Ob["query"]["filtered"]["query"]["bool"]["must"][]=$di;}}if($Ob["query"]&&!$Ob["query"]["filtered"]["query"]&&!$Ob["query"]["ids"])$Ob["query"]["filtered"]["query"]=array("match_all"=>array());$Gh=microtime(true);$fh=$this->_conn->query($F,$Ob);if($pg)echo$b->selectQuery("$F: ".json_encode($Ob),$Gh,!$fh);if(!$fh)return
|
|||
|
false;$H=array();foreach($fh['hits']['hits']as$Bd){$I=array();if($K==array("*"))$I["_id"]=$Bd["_id"];$p=$Bd['_source'];if($K!=array("*")){$p=array();foreach($K
|
|||
|
as$y)$p[$y]=$Bd['fields'][$y];}foreach($p
|
|||
|
as$y=>$X){if($Ob["fields"])$X=$X[0];$I[$y]=(is_array($X)?json_encode($X):$X);}$H[]=$I;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
update($T,$Dg,$zg,$z=0,$L="\n"){$Zf=preg_split('~ *= *~',$zg);if(count($Zf)==2){$t=trim($Zf[1]);$F="$T/$t";return$this->_conn->query($F,$Dg,'POST');}return
|
|||
|
false;}function
|
|||
|
insert($T,$Dg){$t="";$F="$T/$t";$Pg=$this->_conn->query($F,$Dg,'POST');$this->_conn->last_id=$Pg['_id'];return$Pg['created'];}function
|
|||
|
delete($T,$zg,$z=0){$Gd=array();if(is_array($_GET["where"])&&$_GET["where"]["_id"])$Gd[]=$_GET["where"]["_id"];if(is_array($_POST['check'])){foreach($_POST['check']as$eb){$Zf=preg_split('~ *= *~',$eb);if(count($Zf)==2)$Gd[]=trim($Zf[1]);}}$this->_conn->affected_rows=0;foreach($Gd
|
|||
|
as$t){$F="{$T}/{$t}";$Pg=$this->_conn->query($F,'{}','DELETE');if(is_array($Pg)&&$Pg['found']==true)$this->_conn->affected_rows++;}return$this->_conn->affected_rows;}}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;list($M,$V,$E)=$b->credentials();if($E!=""&&$h->connect($M,$V,""))return
|
|||
|
lang(22);if($h->connect($M,$V,$E))return$h;return$h->error;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match("~database|table|columns~",$Rc);}function
|
|||
|
logged_user(){global$b;$Jb=$b->credentials();return$Jb[1];}function
|
|||
|
get_databases(){global$h;$H=$h->rootQuery('_aliases');if($H){$H=array_keys($H);sort($H,SORT_STRING);}return$H;}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
count_tables($k){global$h;$H=array();$G=$h->query('_stats');if($G&&$G['indices']){$Od=$G['indices'];foreach($Od
|
|||
|
as$Nd=>$Hh){$Md=$Hh['total']['indexing'];$H[$Nd]=$Md['index_total'];}}return$H;}function
|
|||
|
tables_list(){global$h;$H=$h->query('_mapping');if($H)$H=array_fill_keys(array_keys($H[$h->_db]["mappings"]),'table');return$H;}function
|
|||
|
table_status($B="",$Qc=false){global$h;$fh=$h->query("_search",array("size"=>0,"aggregations"=>array("count_by_type"=>array("terms"=>array("field"=>"_type")))),"POST");$H=array();if($fh){$S=$fh["aggregations"]["count_by_type"]["buckets"];foreach($S
|
|||
|
as$Q){$H[$Q["key"]]=array("Name"=>$Q["key"],"Engine"=>"table","Rows"=>$Q["doc_count"],);if($B!=""&&$B==$Q["key"])return$H[$B];}}return$H;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
indexes($Q,$i=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("_id")),);}function
|
|||
|
fields($Q){global$h;$G=$h->query("$Q/_mapping");$H=array();if($G){$Ce=$G[$Q]['properties'];if(!$Ce)$Ce=$G[$h->_db]['mappings'][$Q]['properties'];if($Ce){foreach($Ce
|
|||
|
as$B=>$o){$H[$B]=array("field"=>$B,"full_type"=>$o["type"],"type"=>$o["type"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);if($o["properties"]){unset($H[$B]["privileges"]["insert"]);unset($H[$B]["privileges"]["update"]);}}}}return$H;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
table($u){return$u;}function
|
|||
|
idf_escape($u){return$u;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){return$H;}function
|
|||
|
fk_support($R){}function
|
|||
|
found_rows($R,$Z){return
|
|||
|
null;}function
|
|||
|
create_database($l){global$h;return$h->rootQuery(urlencode($l),null,'PUT');}function
|
|||
|
drop_databases($k){global$h;return$h->rootQuery(urlencode(implode(',',$k)),array(),'DELETE');}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){global$h;$vg=array();foreach($p
|
|||
|
as$Oc){$Tc=trim($Oc[1][0]);$Uc=trim($Oc[1][1]?$Oc[1][1]:"text");$vg[$Tc]=array('type'=>$Uc);}if(!empty($vg))$vg=array('properties'=>$vg);return$h->query("_mapping/{$B}",$vg,'PUT');}function
|
|||
|
drop_tables($S){global$h;$H=true;foreach($S
|
|||
|
as$Q)$H=$H&&$h->query(urlencode($Q),array(),'DELETE');return$H;}function
|
|||
|
last_id(){global$h;return$h->last_id;}$x="elastic";$yf=array("=","query");$md=array();$sd=array();$oc=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$y=>$X){$U+=$X;$Kh[$y]=array_keys($X);}}$gc["clickhouse"]="ClickHouse (alpha)";if(isset($_GET["clickhouse"])){define("DRIVER","clickhouse");class
|
|||
|
Min_DB{var$extension="JSON",$server_info,$errno,$_result,$error,$_url;var$_db='default';function
|
|||
|
rootQuery($l,$F){@ini_set('track_errors',1);$Vc=@file_get_contents("$this->_url/?database=$l",false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$this->isQuerySelectLike($F)?"$F FORMAT JSONCompact":$F,'header'=>'Content-type: application/x-www-form-urlencoded','ignore_errors'=>1,))));if($Vc===false){$this->error=$php_errormsg;return$Vc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Vc;return
|
|||
|
false;}$H=json_decode($Vc,true);if($H===null){if(!$this->isQuerySelectLike($F)&&$Vc==='')return
|
|||
|
true;$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$B=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$B)){$this->error=$B;break;}}}}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
isQuerySelectLike($F){return(bool)preg_match('~^(select|show)~i',$F);}function
|
|||
|
query($F){return$this->rootQuery($this->_db,$F);}function
|
|||
|
connect($M,$V,$E){preg_match('~^(https?://)?(.*)~',$M,$A);$this->_url=($A[1]?$A[1]:"http://")."$V:$E@$A[2]";$H=$this->query('SELECT 1');return(bool)$H;}function
|
|||
|
select_db($j){$this->_db=$j;return
|
|||
|
true;}function
|
|||
|
quote($P){return"'".addcslashes($P,"\\'")."'";}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);return$G['data'];}}class
|
|||
|
Min_Result{var$num_rows,$_rows,$columns,$meta,$_offset=0;function
|
|||
|
__construct($G){$this->num_rows=$G['rows'];$this->_rows=$G['data'];$this->meta=$G['meta'];$this->columns=array_column($this->meta,'name');reset($this->_rows);}function
|
|||
|
fetch_assoc(){$I=current($this->_rows);next($this->_rows);return$I===false?false:array_combine($this->columns,$I);}function
|
|||
|
fetch_row(){$I=current($this->_rows);next($this->_rows);return$I;}function
|
|||
|
fetch_field(){$e=$this->_offset++;$H=new
|
|||
|
stdClass;if($e<count($this->columns)){$H->name=$this->meta[$e]['name'];$H->orgname=$H->name;$H->type=$this->meta[$e]['type'];}return$H;}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
delete($Q,$zg,$z=0){if($zg==='')$zg='WHERE 1=1';return
|
|||
|
queries("ALTER TABLE ".table($Q)." DELETE $zg");}function
|
|||
|
update($Q,$N,$zg,$z=0,$L="\n"){$Yi=array();foreach($N
|
|||
|
as$y=>$X)$Yi[]="$y = $X";$F=$L.implode(",$L",$Yi);return
|
|||
|
queries("ALTER TABLE ".table($Q)." UPDATE $F$zg");}}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
explain($h,$F){return'';}function
|
|||
|
found_rows($R,$Z){$J=get_vals("SELECT COUNT(*) FROM ".idf_escape($R["Name"]).($Z?" WHERE ".implode(" AND ",$Z):""));return
|
|||
|
empty($J)?false:$J[0];}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){$c=$Cf=array();foreach($p
|
|||
|
as$o){if($o[1][2]===" NULL")$o[1][1]=" Nullable({$o[1][1]})";elseif($o[1][2]===' NOT NULL')$o[1][2]='';if($o[1][3])$o[1][3]='';$c[]=($o[1]?($Q!=""?($o[0]!=""?"MODIFY COLUMN ":"ADD COLUMN "):" ").implode($o[1]):"DROP COLUMN ".idf_escape($o[0]));$Cf[]=$o[1][0];}$c=array_merge($c,$ed);$O=($wc?" ENGINE ".$wc:"");if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($B)." (\n".implode(",\n",$c)."\n)$O$Xf".' ORDER BY ('.implode(',',$Cf).')');if($Q!=$B){$G=queries("RENAME TABLE ".table($Q)." TO ".table($B));if($c)$Q=$B;else
|
|||
|
return$G;}if($O)$c[]=ltrim($O);return($c||$Xf?queries("ALTER TABLE ".table($Q)."\n".implode(",\n",$c).$Xf):true);}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($dj){return
|
|||
|
drop_tables($dj);}function
|
|||
|
drop_tables($S){return
|
|||
|
apply_queries("DROP TABLE",$S);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Jb=$b->credentials();if($h->connect($Jb[0],$Jb[1],$Jb[2]))return$h;return$h->error;}function
|
|||
|
get_databases($cd){global$h;$G=get_rows('SHOW DATABASES');$H=array();foreach($G
|
|||
|
as$I)$H[]=$I['name'];sort($H);return$H;}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return" $F$Z".($z!==null?$L."LIMIT $z".($C?", $C":""):"");}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){return
|
|||
|
limit($F,$Z,1,0,$L);}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
engines(){return
|
|||
|
array('MergeTree');}function
|
|||
|
logged_user(){global$b;$Jb=$b->credentials();return$Jb[1];}function
|
|||
|
tables_list(){$G=get_rows('SHOW TABLES');$H=array();foreach($G
|
|||
|
as$I)$H[$I['name']]='table';ksort($H);return$H;}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($B="",$Qc=false){global$h;$H=array();$S=get_rows("SELECT name, engine FROM system.tables WHERE database = ".q($h->_db));foreach($S
|
|||
|
as$Q){$H[$Q['name']]=array('Name'=>$Q['name'],'Engine'=>$Q['engine'],);if($B===$Q['name'])return$H[$Q['name']];}return$H;}function
|
|||
|
is_view($R){return
|
|||
|
false;}function
|
|||
|
fk_support($R){return
|
|||
|
false;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$H){if(in_array($o['type'],array("Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Float32","Float64")))return"to$o[type]($H)";return$H;}function
|
|||
|
fields($Q){$H=array();$G=get_rows("SELECT name, type, default_expression FROM system.columns WHERE ".idf_escape('table')." = ".q($Q));foreach($G
|
|||
|
as$I){$T=trim($I['type']);$if=strpos($T,'Nullable(')===0;$H[trim($I['name'])]=array("field"=>trim($I['name']),"full_type"=>$T,"type"=>$T,"default"=>trim($I['default_expression']),"null"=>$if,"auto_increment"=>'0',"privileges"=>array("insert"=>1,"select"=>1,"update"=>0),);}return$H;}function
|
|||
|
indexes($Q,$i=null){return
|
|||
|
array();}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($dh){return
|
|||
|
true;}function
|
|||
|
auto_increment(){return'';}function
|
|||
|
last_id(){return
|
|||
|
0;}function
|
|||
|
support($Rc){return
|
|||
|
preg_match("~^(columns|sql|status|table|drop_col)$~",$Rc);}$x="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$y=>$X){$U+=$X;$Kh[$y]=array_keys($X);}$Li=array();$yf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$md=array();$sd=array("avg","count","count distinct","max","min","sum");$oc=array();}$gc=array("server"=>"MySQL")+$gc;if(!defined("DRIVER")){$kg=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
MySQLi{var$extension="MySQLi";function
|
|||
|
__construct(){parent::init();}function
|
|||
|
connect($M="",$V="",$E="",$j=null,$gg=null,$xh=null){global$b;mysqli_report(MYSQLI_REPORT_OFF);list($Cd,$gg)=explode(":",$M,2);$Fh=$b->connectSsl();if($Fh)$this->ssl_set($Fh['key'],$Fh['cert'],$Fh['ca'],'','');$H=@$this->real_connect(($M!=""?$Cd:ini_get("mysqli.default_host")),($M.$V!=""?$V:ini_get("mysqli.default_user")),($M.$V.$E!=""?$E:ini_get("mysqli.default_pw")),$j,(is_numeric($gg)?$gg:ini_get("mysqli.default_port")),(!is_numeric($gg)?$gg:$xh),($Fh?64:0));$this->options(MYSQLI_OPT_LOCAL_INFILE,false);return$H;}function
|
|||
|
set_charset($db){if(parent::set_charset($db))return
|
|||
|
true;parent::set_charset('utf8');return$this->query("SET NAMES $db");}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!$G)return
|
|||
|
false;$I=$G->fetch_array();return$I[$o];}function
|
|||
|
quote($P){return"'".$this->escape_string($P)."'";}}}elseif(extension_loaded("mysql")&&!((ini_bool("sql.safe_mode")||ini_bool("mysql.allow_local_infile"))&&extension_loaded("pdo_mysql"))){class
|
|||
|
Min_DB{var$extension="MySQL",$server_info,$affected_rows,$errno,$error,$_link,$_result;function
|
|||
|
connect($M,$V,$E){if(ini_bool("mysql.allow_local_infile")){$this->error=lang(32,"'mysql.allow_local_infile'","MySQLi","PDO_MySQL");return
|
|||
|
false;}$this->_link=@mysql_connect(($M!=""?$M:ini_get("mysql.default_host")),("$M$V"!=""?$V:ini_get("mysql.default_user")),("$M$V$E"!=""?$E: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
|
|||
|
set_charset($db){if(function_exists('mysql_set_charset')){if(mysql_set_charset($db,$this->_link))return
|
|||
|
true;mysql_set_charset('utf8',$this->_link);}return$this->query("SET NAMES $db");}function
|
|||
|
quote($P){return"'".mysql_real_escape_string($P,$this->_link)."'";}function
|
|||
|
select_db($j){return
|
|||
|
mysql_select_db($j,$this->_link);}function
|
|||
|
query($F,$Fi=false){$G=@($Fi?mysql_unbuffered_query($F,$this->_link):mysql_query($F,$this->_link));$this->error="";if(!$G){$this->errno=mysql_errno($this->_link);$this->error=mysql_error($this->_link);return
|
|||
|
false;}if($G===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($G);}function
|
|||
|
multi_query($F){return$this->_result=$this->query($F);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($F,$o=0){$G=$this->query($F);if(!$G||!$G->num_rows)return
|
|||
|
false;return
|
|||
|
mysql_result($G->_result,0,$o);}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
__construct($G){$this->_result=$G;$this->num_rows=mysql_num_rows($G);}function
|
|||
|
fetch_assoc(){return
|
|||
|
mysql_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
mysql_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$H=mysql_fetch_field($this->_result,$this->_offset++);$H->orgtable=$H->table;$H->orgname=$H->name;$H->charsetnr=($H->blob?63:0);return$H;}function
|
|||
|
__destruct(){mysql_free_result($this->_result);}}}elseif(extension_loaded("pdo_mysql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_MySQL";function
|
|||
|
connect($M,$V,$E){global$b;$Af=array(PDO::MYSQL_ATTR_LOCAL_INFILE=>false);$Fh=$b->connectSsl();if($Fh){if(!empty($Fh['key']))$Af[PDO::MYSQL_ATTR_SSL_KEY]=$Fh['key'];if(!empty($Fh['cert']))$Af[PDO::MYSQL_ATTR_SSL_CERT]=$Fh['cert'];if(!empty($Fh['ca']))$Af[PDO::MYSQL_ATTR_SSL_CA]=$Fh['ca'];}$this->dsn("mysql:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\d)~',';port=\1',$M)),$V,$E,$Af);return
|
|||
|
true;}function
|
|||
|
set_charset($db){$this->query("SET NAMES $db");}function
|
|||
|
select_db($j){return$this->query("USE ".idf_escape($j));}function
|
|||
|
query($F,$Fi=false){$this->setAttribute(1000,!$Fi);return
|
|||
|
parent::query($F,$Fi);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insert($Q,$N){return($N?parent::insert($Q,$N):queries("INSERT INTO ".table($Q)." ()\nVALUES ()"));}function
|
|||
|
insertUpdate($Q,$J,$ng){$f=array_keys(reset($J));$lg="INSERT INTO ".table($Q)." (".implode(", ",$f).") VALUES\n";$Yi=array();foreach($f
|
|||
|
as$y)$Yi[$y]="$y = VALUES($y)";$Nh="\nON DUPLICATE KEY UPDATE ".implode(", ",$Yi);$Yi=array();$we=0;foreach($J
|
|||
|
as$N){$Y="(".implode(", ",$N).")";if($Yi&&(strlen($lg)+$we+strlen($Y)+strlen($Nh)>1e6)){if(!queries($lg.implode(",\n",$Yi).$Nh))return
|
|||
|
false;$Yi=array();$we=0;}$Yi[]=$Y;$we+=strlen($Y)+2;}return
|
|||
|
queries($lg.implode(",\n",$Yi).$Nh);}function
|
|||
|
slowQuery($F,$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 $F";elseif(preg_match('~^(SELECT\b)(.+)~is',$F,$A))return"$A[1] /*+ MAX_EXECUTION_TIME(".($ii*1000).") */ $A[2]";}}function
|
|||
|
convertSearch($u,$X,$o){return(preg_match('~char|text|enum|set~',$o["type"])&&!preg_match("~^utf8~",$o["collation"])&&preg_match('~[\x80-\xFF]~',$X['val'])?"CONVERT($u USING ".charset($this->_conn).")":$u);}function
|
|||
|
warnings(){$G=$this->_conn->query("SHOW WARNINGS");if($G&&$G->num_rows){ob_start();select($G);return
|
|||
|
ob_get_clean();}}function
|
|||
|
tableHelp($B){$De=preg_match('~MariaDB~',$this->_conn->server_info);if(information_schema(DB))return
|
|||
|
strtolower(($De?"information-schema-$B-table/":str_replace("_","-",$B)."-table.html"));if(DB=="mysql")return($De?"mysql$B-table/":"system-database.html");}}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b,$U,$Kh;$h=new
|
|||
|
Min_DB;$Jb=$b->credentials();if($h->connect($Jb[0],$Jb[1],$Jb[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;}$H=$h->error;if(function_exists('iconv')&&!is_utf8($H)&&strlen($bh=iconv("windows-1250","utf-8",$H))>strlen($H))$H=$bh;return$H;}function
|
|||
|
get_databases($cd){$H=get_session("dbs");if($H===null){$F=(min_version(5)?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME":"SHOW DATABASES");$H=($cd?slow_query($F):get_vals($F));restart_session();set_session("dbs",$H);stop_session();}return$H;}function
|
|||
|
limit($F,$Z,$z,$C=0,$L=" "){return" $F$Z".($z!==null?$L."LIMIT $z".($C?" OFFSET $C":""):"");}function
|
|||
|
limit1($Q,$F,$Z,$L="\n"){return
|
|||
|
limit($F,$Z,1,0,$L);}function
|
|||
|
db_collation($l,$qb){global$h;$H=null;$Gb=$h->result("SHOW CREATE DATABASE ".idf_escape($l),1);if(preg_match('~ COLLATE ([^ ]+)~',$Gb,$A))$H=$A[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$Gb,$A))$H=$qb[$A[1]][-1];return$H;}function
|
|||
|
engines(){$H=array();foreach(get_rows("SHOW ENGINES")as$I){if(preg_match("~YES|DEFAULT~",$I["Support"]))$H[]=$I["Engine"];}return$H;}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT USER()");}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals(min_version(5)?"SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME":"SHOW TABLES");}function
|
|||
|
count_tables($k){$H=array();foreach($k
|
|||
|
as$l)$H[$l]=count(get_vals("SHOW TABLES IN ".idf_escape($l)));return$H;}function
|
|||
|
table_status($B="",$Qc=false){$H=array();foreach(get_rows($Qc&&min_version(5)?"SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ".($B!=""?"AND TABLE_NAME = ".q($B):"ORDER BY Name"):"SHOW TABLE STATUS".($B!=""?" LIKE ".q(addcslashes($B,"%_\\")):""))as$I){if($I["Engine"]=="InnoDB")$I["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\1',$I["Comment"]);if(!isset($I["Engine"]))$I["Comment"]="";if($B!="")return$I;$H[$I["Name"]]=$I;}return$H;}function
|
|||
|
is_view($R){return$R["Engine"]===null;}function
|
|||
|
fk_support($R){return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$R["Engine"])||(preg_match('~NDB~i',$R["Engine"])&&min_version(5.6));}function
|
|||
|
fields($Q){$H=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($Q))as$I){preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~',$I["Type"],$A);$H[$I["Field"]]=array("field"=>$I["Field"],"full_type"=>$I["Type"],"type"=>$A[1],"length"=>$A[2],"unsigned"=>ltrim($A[3].$A[4]),"default"=>($I["Default"]!=""||preg_match("~char|set~",$A[1])?$I["Default"]:null),"null"=>($I["Null"]=="YES"),"auto_increment"=>($I["Extra"]=="auto_increment"),"on_update"=>(preg_match('~^on update (.+)~i',$I["Extra"],$A)?$A[1]:""),"collation"=>$I["Collation"],"privileges"=>array_flip(preg_split('~, *~',$I["Privileges"])),"comment"=>$I["Comment"],"primary"=>($I["Key"]=="PRI"),"generated"=>preg_match('~^(VIRTUAL|PERSISTENT|STORED)~',$I["Extra"]),);}return$H;}function
|
|||
|
indexes($Q,$i=null){$H=array();foreach(get_rows("SHOW INDEX FROM ".table($Q),$i)as$I){$B=$I["Key_name"];$H[$B]["type"]=($B=="PRIMARY"?"PRIMARY":($I["Index_type"]=="FULLTEXT"?"FULLTEXT":($I["Non_unique"]?($I["Index_type"]=="SPATIAL"?"SPATIAL":"INDEX"):"UNIQUE")));$H[$B]["columns"][]=$I["Column_name"];$H[$B]["lengths"][]=($I["Index_type"]=="SPATIAL"?null:$I["Sub_part"]);$H[$B]["descs"][]=null;}return$H;}function
|
|||
|
foreign_keys($Q){global$h,$tf;static$dg='(?:`(?:[^`]|``)+`|"(?:[^"]|"")+")';$H=array();$Hb=$h->result("SHOW CREATE TABLE ".table($Q),1);if($Hb){preg_match_all("~CONSTRAINT ($dg) FOREIGN KEY ?\\(((?:$dg,? ?)+)\\) REFERENCES ($dg)(?:\\.($dg))? \\(((?:$dg,? ?)+)\\)(?: ON DELETE ($tf))?(?: ON UPDATE ($tf))?~",$Hb,$Ge,PREG_SET_ORDER);foreach($Ge
|
|||
|
as$A){preg_match_all("~$dg~",$A[2],$zh);preg_match_all("~$dg~",$A[5],$ai);$H[idf_unescape($A[1])]=array("db"=>idf_unescape($A[4]!=""?$A[3]:$A[4]),"table"=>idf_unescape($A[4]!=""?$A[4]:$A[3]),"source"=>array_map('idf_unescape',$zh[0]),"target"=>array_map('idf_unescape',$ai[0]),"on_delete"=>($A[6]?$A[6]:"RESTRICT"),"on_update"=>($A[7]?$A[7]:"RESTRICT"),);}}return$H;}function
|
|||
|
view($B){global$h;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU','',$h->result("SHOW CREATE VIEW ".table($B),1)));}function
|
|||
|
collations(){$H=array();foreach(get_rows("SHOW COLLATION")as$I){if($I["Default"])$H[$I["Charset"]][-1]=$I["Collation"];else$H[$I["Charset"]][]=$I["Collation"];}ksort($H);foreach($H
|
|||
|
as$y=>$X)asort($H[$y]);return$H;}function
|
|||
|
information_schema($l){return(min_version(5)&&$l=="information_schema")||(min_version(5.5)&&$l=="performance_schema");}function
|
|||
|
error(){global$h;return
|
|||
|
h(preg_replace('~^You have an error.*syntax to use~U',"Syntax error",$h->error));}function
|
|||
|
create_database($l,$d){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($l).($d?" COLLATE ".q($d):""));}function
|
|||
|
drop_databases($k){$H=apply_queries("DROP DATABASE",$k,'idf_escape');restart_session();set_session("dbs",null);return$H;}function
|
|||
|
rename_database($B,$d){$H=false;if(create_database($B,$d)){$Ng=array();foreach(tables_list()as$Q=>$T)$Ng[]=table($Q)." TO ".idf_escape($B).".".table($Q);$H=(!$Ng||queries("RENAME TABLE ".implode(", ",$Ng)));if($H)queries("DROP DATABASE ".idf_escape(DB));restart_session();set_session("dbs",null);}return$H;}function
|
|||
|
auto_increment(){$Oa=" PRIMARY KEY";if($_GET["create"]!=""&&$_POST["auto_increment_col"]){foreach(indexes($_GET["create"])as$v){if(in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"],$v["columns"],true)){$Oa="";break;}if($v["type"]=="PRIMARY")$Oa=" UNIQUE";}}return" AUTO_INCREMENT$Oa";}function
|
|||
|
alter_table($Q,$B,$p,$ed,$vb,$wc,$d,$Na,$Xf){$c=array();foreach($p
|
|||
|
as$o)$c[]=($o[1]?($Q!=""?($o[0]!=""?"CHANGE ".idf_escape($o[0]):"ADD"):" ")." ".implode($o[1]).($Q!=""?$o[2]:""):"DROP ".idf_escape($o[0]));$c=array_merge($c,$ed);$O=($vb!==null?" COMMENT=".q($vb):"").($wc?" ENGINE=".q($wc):"").($d?" COLLATE ".q($d):"").($Na!=""?" AUTO_INCREMENT=$Na":"");if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($B)." (\n".implode(",\n",$c)."\n)$O$Xf");if($Q!=$B)$c[]="RENAME TO ".table($B);if($O)$c[]=ltrim($O);return($c||$Xf?queries("ALTER TABLE ".table($Q)."\n".implode(",\n",$c).$Xf):true);}function
|
|||
|
alter_indexes($Q,$c){foreach($c
|
|||
|
as$y=>$X)$c[$y]=($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
|
|||
|
queries("ALTER TABLE ".table($Q).implode(",",$c));}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($dj){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$dj)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$dj,$ai){$Ng=array();foreach(array_merge($S,$dj)as$Q)$Ng[]=table($Q)." TO ".idf_escape($ai).".".table($Q);return
|
|||
|
queries("RENAME TABLE ".implode(", ",$Ng));}function
|
|||
|
copy_tables($S,$dj,$ai){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($S
|
|||
|
as$Q){$B=($ai==DB?table("copy_$Q"):idf_escape($ai).".".table($Q));if(($_POST["overwrite"]&&!queries("\nDROP TABLE IF EXISTS $B"))||!queries("CREATE TABLE $B LIKE ".table($Q))||!queries("INSERT INTO $B SELECT * FROM ".table($Q)))return
|
|||
|
false;foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")))as$I){$_i=$I["Trigger"];if(!queries("CREATE TRIGGER ".($ai==DB?idf_escape("copy_$_i"):idf_escape($ai).".".idf_escape($_i))." $I[Timing] $I[Event] ON $B FOR EACH ROW\n$I[Statement];"))return
|
|||
|
false;}}foreach($dj
|
|||
|
as$Q){$B=($ai==DB?table("copy_$Q"):idf_escape($ai).".".table($Q));$cj=view($Q);if(($_POST["overwrite"]&&!queries("DROP VIEW IF EXISTS $B"))||!queries("CREATE VIEW $B AS $cj[select]"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($B){if($B=="")return
|
|||
|
array();$J=get_rows("SHOW TRIGGERS WHERE `Trigger` = ".q($B));return
|
|||
|
reset($J);}function
|
|||
|
triggers($Q){$H=array();foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")))as$I)$H[$I["Trigger"]]=array($I["Timing"],$I["Event"]);return$H;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
|
|||
|
routine($B,$T){global$h,$yc,$Td,$U;$Da=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$_h="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Ei="((".implode("|",array_merge(array_keys($U),$Da)).")\\b(?:\\s*\\(((?:[^'\")]|$yc)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";$dg="$_h*(".($T=="FUNCTION"?"":$Td).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$Ei";$Gb=$h->result("SHOW CREATE $T ".idf_escape($B),2);preg_match("~\\(((?:$dg\\s*,?)*)\\)\\s*".($T=="FUNCTION"?"RETURNS\\s+$Ei\\s+":"")."(.*)~is",$Gb,$A);$p=array();preg_match_all("~$dg\\s*,?~is",$A[1],$Ge,PREG_SET_ORDER);foreach($Ge
|
|||
|
as$Qf)$p[]=array("field"=>str_replace("``","`",$Qf[2]).$Qf[3],"type"=>strtolower($Qf[5]),"length"=>preg_replace_callback("~$yc~s",'normalize_enum',$Qf[6]),"unsigned"=>strtolower(preg_replace('~\s+~',' ',trim("$Qf[8] $Qf[7]"))),"null"=>1,"full_type"=>$Qf[4],"inout"=>strtoupper($Qf[1]),"collation"=>strtolower($Qf[9]),);if($T!="FUNCTION")return
|
|||
|
array("fields"=>$p,"definition"=>$A[11]);return
|
|||
|
array("fields"=>$p,"returns"=>array("type"=>$A[12],"length"=>$A[13],"unsigned"=>$A[15],"collation"=>$A[16]),"definition"=>$A[17],"language"=>"SQL",);}function
|
|||
|
routines(){return
|
|||
|
get_rows("SELECT ROUTINE_NAME AS SPECIFIC_NAME, ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = ".q(DB));}function
|
|||
|
routine_languages(){return
|
|||
|
array();}function
|
|||
|
routine_id($B,$I){return
|
|||
|
idf_escape($B);}function
|
|||
|
last_id(){global$h;return$h->result("SELECT LAST_INSERT_ID()");}function
|
|||
|
explain($h,$F){return$h->query("EXPLAIN ".(min_version(5.1)?"PARTITIONS ":"").$F);}function
|
|||
|
found_rows($R,$Z){return($Z||$R["Engine"]!="InnoDB"?null:$R["Rows"]);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($dh,$i=null){return
|
|||
|
true;}function
|
|||
|
create_sql($Q,$Na,$Lh){global$h;$H=$h->result("SHOW CREATE TABLE ".table($Q),1);if(!$Na)$H=preg_replace('~ AUTO_INCREMENT=\d+~','',$H);return$H;}function
|
|||
|
truncate_sql($Q){return"TRUNCATE ".table($Q);}function
|
|||
|
use_sql($j){return"USE ".idf_escape($j);}function
|
|||
|
trigger_sql($Q){$H="";foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")),null,"-- ")as$I)$H.="\nCREATE TRIGGER ".idf_escape($I["Trigger"])." $I[Timing] $I[Event] ON ".table($I["Table"])." FOR EACH ROW\n$I[Statement];;\n";return$H;}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals("SHOW VARIABLES");}function
|
|||
|
process_list(){return
|
|||
|
get_rows("SHOW FULL PROCESSLIST");}function
|
|||
|
show_status(){return
|
|||
|
get_key_vals("SHOW STATUS");}function
|
|||
|
convert_field($o){if(preg_match("~binary~",$o["type"]))return"HEX(".idf_escape($o["field"]).")";if($o["type"]=="bit")return"BIN(".idf_escape($o["field"])." + 0)";if(preg_match("~geometry|point|linestring|polygon~",$o["type"]))return(min_version(8)?"ST_":"")."AsWKT(".idf_escape($o["field"]).")";}function
|
|||
|
unconvert_field($o,$H){if(preg_match("~binary~",$o["type"]))$H="UNHEX($H)";if($o["type"]=="bit")$H="CONV($H, 2, 10) + 0";if(preg_match("~geometry|point|linestring|polygon~",$o["type"]))$H=(min_version(8)?"ST_":"")."GeomFromText($H, SRID($o[field]))";return$H;}function
|
|||
|
support($Rc){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")))."~",$Rc);}function
|
|||
|
kill_process($X){return
|
|||
|
queries("KILL ".number($X));}function
|
|||
|
connection_id(){return"SELECT CONNECTION_ID()";}function
|
|||
|
max_connections(){global$h;return$h->result("SELECT @@max_connections");}$x="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$y=>$X){$U+=$X;$Kh[$y]=array_keys($X);}$Li=array("unsigned","zerofill","unsigned zerofill");$yf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","FIND_IN_SET","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$md=array("char_length","date","from_unixtime","lower","round","floor","ceil","sec_to_time","time_to_sec","upper");$sd=array("avg","count","count distinct","group_concat","max","min","sum");$oc=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.5";class
|
|||
|
Adminer{var$operators;function
|
|||
|
name(){return"<a href='https://www.adminer.org/'".target_blank()." id='h1'>Adminer</a>";}function
|
|||
|
credentials(){return
|
|||
|
array(SERVER,$_GET["username"],get_password());}function
|
|||
|
connectSsl(){}function
|
|||
|
permanentLogin($Gb=false){return
|
|||
|
password_file($Gb);}function
|
|||
|
bruteForceKey(){return$_SERVER["REMOTE_ADDR"];}function
|
|||
|
serverName($M){return
|
|||
|
h($M);}function
|
|||
|
database(){return
|
|||
|
DB;}function
|
|||
|
databases($cd=true){return
|
|||
|
get_databases($cd);}function
|
|||
|
schemas(){return
|
|||
|
schemas();}function
|
|||
|
queryTimeout(){return
|
|||
|
2;}function
|
|||
|
headers(){}function
|
|||
|
csp(){return
|
|||
|
csp();}function
|
|||
|
head(){return
|
|||
|
true;}function
|
|||
|
css(){$H=array();$Wc="adminer.css";if(file_exists($Wc))$H[]="$Wc?v=".crc32(file_get_contents($Wc));return$H;}function
|
|||
|
loginForm(){global$gc;echo"<table cellspacing='0' class='layout'>\n",$this->loginFormField('driver','<tr><th>'.lang(34).'<td>',html_select("auth[driver]",$gc,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
|
|||
|
loginFormField($B,$zd,$Y){return$zd.$Y;}function
|
|||
|
login($Ae,$E){if($E=="")return
|
|||
|
lang(41,target_blank());return
|
|||
|
true;}function
|
|||
|
tableName($Rh){return
|
|||
|
h($Rh["Name"]);}function
|
|||
|
fieldName($o,$Cf=0){return'<span title="'.h($o["full_type"]).'">'.h($o["field"]).'</span>';}function
|
|||
|
selectLinks($Rh,$N=""){global$x,$m;echo'<p class="links">';$ze=array("select"=>lang(42));if(support("table")||support("indexes"))$ze["table"]=lang(43);if(support("table")){if(is_view($Rh))$ze["view"]=lang(44);else$ze["create"]=lang(45);}if($N!==null)$ze["edit"]=lang(46);$B=$Rh["Name"];foreach($ze
|
|||
|
as$y=>$X)echo" <a href='".h(ME)."$y=".urlencode($B).($y=="edit"?$N:"")."'".bold(isset($_GET[$y])).">$X</a>";echo
|
|||
|
doc_link(array($x=>$m->tableHelp($B)),"?"),"\n";}function
|
|||
|
foreignKeys($Q){return
|
|||
|
foreign_keys($Q);}function
|
|||
|
backwardKeys($Q,$Qh){return
|
|||
|
array();}function
|
|||
|
backwardKeysPrint($Qa,$I){}function
|
|||
|
selectQuery($F,$Gh,$Pc=false){global$x,$m;$H="</p>\n";if(!$Pc&&($gj=$m->warnings())){$t="warnings";$H=", <a href='#$t'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$t');","")."$H<div id='$t' class='hidden'>\n$gj</div>\n";}return"<p><code class='jush-$x'>".h(str_replace("\n"," ",$F))."</code> <span class='time'>(".format_time($Gh).")</span>".(support("sql")?" <a href='".h(ME)."sql=".urlencode($F)."'>".lang(10)."</a>":"").$H;}function
|
|||
|
sqlCommandQuery($F){return
|
|||
|
shorten_utf8(trim($F),1000);}function
|
|||
|
rowDescription($Q){return"";}function
|
|||
|
rowDescriptions($J,$fd){return$J;}function
|
|||
|
selectLink($X,$o){}function
|
|||
|
selectVal($X,$_,$o,$Kf){$H=($X===null?"<i>NULL</i>":(preg_match("~char|binary|boolean~",$o["type"])&&!preg_match("~var~",$o["type"])?"<code>$X</code>":$X));if(preg_match('~blob|bytea|raw|file~',$o["type"])&&!is_utf8($X))$H="<i>".lang(48,strlen($Kf))."</i>";if(preg_match('~json~',$o["type"]))$H="<code class='jush-js'>$H</code>";return($_?"<a href='".h($_)."'".(is_url($_)?target_blank():"").">$H</a>":$H);}function
|
|||
|
editVal($X,$o){return$X;}function
|
|||
|
tableStructurePrint($p){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($p
|
|||
|
as$o){echo"<tr".odd()."><th>".h($o["field"]),"<td><span title='".h($o["collation"])."'>".h($o["full_type"])."</span>",($o["null"]?" <i>NULL</i>":""),($o["auto_increment"]?" <i>".lang(52)."</i>":""),(isset($o["default"])?" <span title='".lang(53)."'>[<b>".h($o["default"])."</b>]</span>":""),(support("comment")?"<td>".h($o["comment"]):""),"\n";}echo"</table>\n","</div>\n";}function
|
|||
|
tableIndexesPrint($w){echo"<table cellspacing='0'>\n";foreach($w
|
|||
|
as$B=>$v){ksort($v["columns"]);$pg=array();foreach($v["columns"]as$y=>$X)$pg[]="<i>".h($X)."</i>".($v["lengths"][$y]?"(".$v["lengths"][$y].")":"").($v["descs"][$y]?" DESC":"");echo"<tr title='".h($B)."'><th>$v[type]<td>".implode(", ",$pg)."\n";}echo"</table>\n";}function
|
|||
|
selectColumnsPrint($K,$f){global$md,$sd;print_fieldset("select",lang(54),$K);$s=0;$K[""]=array();foreach($K
|
|||
|
as$y=>$X){$X=$_GET["columns"][$y];$e=select_input(" name='columns[$s][col]'",$f,$X["col"],($y!==""?"selectFieldChange":"selectAddRow"));echo"<div>".($md||$sd?"<select name='columns[$s][fun]'>".optionlist(array(-1=>"")+array_filter(array(lang(55)=>$md,lang(56)=>$sd)),$X["fun"])."</select>".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).script("qsl('select').onchange = function () { helpClose();".($y!==""?"":" qsl('select, input', this.parentNode).onchange();")." };","")."($e)":$e)."</div>\n";$s++;}echo"</div></fieldset>\n";}function
|
|||
|
selectSearchPrint($Z,$f,$w){print_fieldset("search",lang(57),$Z);foreach($w
|
|||
|
as$s=>$v){if($v["type"]=="FULLTEXT"){echo"<div>(<i>".implode("</i>, <i>",array_map('h',$v["columns"]))."</i>) AGAINST"," <input type='search' name='fulltext[$s]' value='".h($_GET["fulltext"][$s])."'>",script("qsl('input').oninput = selectFieldChange;",""),checkbox("boolean[$s]",1,isset($_GET["boolean"][$s]),"BOOL"),"</div>\n";}}$cb="this.parentNode.firstChild.onchange();";foreach(array_merge((array)$_GET["where"],array(array()))as$s=>$X){if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div>".select_input(" name='where[$s][col]'",$f,$X["col"],($X?"selectFieldChange":"selectAddRow"),"(".lang(58).")"),html_select("where[$s][op]",$this->operators,$X["op"],$cb),"<input type='search' name='where[$s][val]' value='".h($X["val"])."'>",script("mixin(qsl('input'), {oninput: function () { $cb }, onkeydown: selectSearchKeydown, onsearch: selectSearchSearch});",""),"</div>\n";}}echo"</div></fieldset>\n";}function
|
|||
|
selectOrderPrint($Cf,$f,$w){print_fieldset("sort",lang(59),$Cf);$s=0;foreach((array)$_GET["order"]as$y=>$X){if($X!=""){echo"<div>".select_input(" name='order[$s]'",$f,$X,"selectFieldChange"),checkbox("desc[$s]",1,isset($_GET["desc"][$y]),lang(60))."</div>\n";$s++;}}echo"<div>".select_input(" name='order[$s]'",$f,"","selectAddRow"),checkbox("desc[$s]",1,false,lang(60))."</div>\n","</div></fieldset>\n";}function
|
|||
|
selectLimitPrint($z){echo"<fieldset><legend>".lang(61)."</legend><div>";echo"<input type='number' name='limit' class='size' value='".h($z)."'>",script("qsl('input').oninput = selectFieldChange;",""),"</div></fieldset>\n";}function
|
|||
|
selectLengthPrint($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
|
|||
|
selectActionPrint($w){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($w
|
|||
|
as$v){$Nb=reset($v["columns"]);if($v["type"]!="FULLTEXT"&&$Nb)$f[$Nb]=1;}$f[""]=1;foreach($f
|
|||
|
as$y=>$X)json_row($y);echo";\n","selectFieldChange.call(qs('#form')['select']);\n","</script>\n","</div></fieldset>\n";}function
|
|||
|
selectCommandPrint(){return!information_schema(DB);}function
|
|||
|
selectImportPrint(){return!information_schema(DB);}function
|
|||
|
selectEmailPrint($tc,$f){}function
|
|||
|
selectColumnsProcess($f,$w){global$md,$sd;$K=array();$pd=array();foreach((array)$_GET["columns"]as$y=>$X){if($X["fun"]=="count"||($X["col"]!=""&&(!$X["fun"]||in_array($X["fun"],$md)||in_array($X["fun"],$sd)))){$K[$y]=apply_sql_function($X["fun"],($X["col"]!=""?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$sd))$pd[]=$K[$y];}}return
|
|||
|
array($K,$pd);}function
|
|||
|
selectSearchProcess($p,$w){global$h,$m;$H=array();foreach($w
|
|||
|
as$s=>$v){if($v["type"]=="FULLTEXT"&&$_GET["fulltext"][$s]!="")$H[]="MATCH (".implode(", ",array_map('idf_escape',$v["columns"])).") AGAINST (".q($_GET["fulltext"][$s]).(isset($_GET["boolean"][$s])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$y=>$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$lg="";$xb=" $X[op]";if(preg_match('~IN$~',$X["op"])){$Jd=process_length($X["val"]);$xb.=" ".($Jd!=""?$Jd:"(NULL)");}elseif($X["op"]=="SQL")$xb=" $X[val]";elseif($X["op"]=="LIKE %%")$xb=" LIKE ".$this->processInput($p[$X["col"]],"%$X[val]%");elseif($X["op"]=="ILIKE %%")$xb=" ILIKE ".$this->processInput($p[$X["col"]],"%$X[val]%");elseif($X["op"]=="FIND_IN_SET"){$lg="$X[op](".q($X["val"]).", ";$xb=")";}elseif(!preg_match('~NULL$~',$X["op"]))$xb.=" ".$this->processInput($p[$X["col"]],$X["val"]);if($X["col"]!="")$H[]=$lg.$m->convertSearch(idf_escape($X["col"]),$X,$p[$X["col"]]).$xb;else{$sb=array();foreach($p
|
|||
|
as$B=>$o){if((preg_match('~^[-\d.'.(preg_match('~IN$~',$X["op"])?',':'').']+$~',$X["val"])||!preg_match('~'.number_type().'|bit~',$o["type"]))&&(!preg_match("~[\x80-\xFF]~",$X["val"])||preg_match('~char|text|enum|set~',$o["type"])))$sb[]=$lg.$m->convertSearch(idf_escape($B),$X,$o).$xb;}$H[]=($sb?"(".implode(" OR ",$sb).")":"1 = 0");}}}return$H;}function
|
|||
|
selectOrderProcess($p,$w){$H=array();foreach((array)$_GET["order"]as$y=>$X){if($X!="")$H[]=(preg_match('~^((COUNT\(DISTINCT |[A-Z0-9_]+\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\)|COUNT\(\*\))$~',$X)?$X:idf_escape($X)).(isset($_GET["desc"][$y])?" DESC":"");}return$H;}function
|
|||
|
selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"50");}function
|
|||
|
selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
|
|||
|
selectEmailProcess($Z,$fd){return
|
|||
|
false;}function
|
|||
|
selectQueryBuild($K,$Z,$pd,$Cf,$z,$D){return"";}function
|
|||
|
messageQuery($F,$hi,$Pc=false){global$x,$m;restart_session();$_d=&get_session("queries");if(!$_d[$_GET["db"]])$_d[$_GET["db"]]=array();if(strlen($F)>1e6)$F=preg_replace('~[\x80-\xFF]+$~','',substr($F,0,1e6))."\n…";$_d[$_GET["db"]][]=array($F,time(),$hi);$Dh="sql-".count($_d[$_GET["db"]]);$H="<a href='#$Dh' class='toggle'>".lang(65)."</a>\n";if(!$Pc&&($gj=$m->warnings())){$t="warnings-".count($_d[$_GET["db"]]);$H="<a href='#$t' class='toggle'>".lang(47)."</a>, $H<div id='$t' class='hidden'>\n$gj</div>\n";}return" <span class='time'>".@date("H:i:s")."</span>"." $H<div id='$Dh' class='hidden'><pre><code class='jush-$x'>".shorten_utf8($F,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($_d[$_GET["db"]])-1)).'">'.lang(10).'</a>':'').'</div>';}function
|
|||
|
editFunctions($o){global$oc;$H=($o["null"]?"NULL/":"");foreach($oc
|
|||
|
as$y=>$md){if(!$y||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($md
|
|||
|
as$dg=>$X){if(!$dg||preg_match("~$dg~",$o["type"]))$H.="/$X";}if($y&&!preg_match('~set|blob|bytea|raw|file~',$o["type"]))$H.="/SQL";}}if($o["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$H=lang(52);return
|
|||
|
explode("/",$H);}function
|
|||
|
editInput($Q,$o,$Ka,$Y){if($o["type"]=="enum")return(isset($_GET["select"])?"<label><input type='radio'$Ka value='-1' checked><i>".lang(8)."</i></label> ":"").($o["null"]?"<label><input type='radio'$Ka value=''".($Y!==null||isset($_GET["select"])?"":" checked")."><i>NULL</i></label> ":"").enum_input("radio",$Ka,$o,$Y,0);return"";}function
|
|||
|
editHint($Q,$o,$Y){return"";}function
|
|||
|
processInput($o,$Y,$r=""){if($r=="SQL")return$Y;$B=$o["field"];$H=q($Y);if(preg_match('~^(now|getdate|uuid)$~',$r))$H="$r()";elseif(preg_match('~^current_(date|timestamp)$~',$r))$H=$r;elseif(preg_match('~^([+-]|\|\|)$~',$r))$H=idf_escape($B)." $r $H";elseif(preg_match('~^[+-] interval$~',$r))$H=idf_escape($B)." $r ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+\$~i",$Y)?$Y:$H);elseif(preg_match('~^(addtime|subtime|concat)$~',$r))$H="$r(".idf_escape($B).", $H)";elseif(preg_match('~^(md5|sha1|password|encrypt)$~',$r))$H="$r($H)";return
|
|||
|
unconvert_field($o,$H);}function
|
|||
|
dumpOutput(){$H=array('text'=>lang(66),'file'=>lang(67));if(function_exists('gzencode'))$H['gz']='gzip';return$H;}function
|
|||
|
dumpFormat(){return
|
|||
|
array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
|
|||
|
dumpDatabase($l){}function
|
|||
|
dumpTable($Q,$Lh,$ce=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($Lh)dump_csv(array_keys(fields($Q)));}else{if($ce==2){$p=array();foreach(fields($Q)as$B=>$o)$p[]=idf_escape($B)." $o[full_type]";$Gb="CREATE TABLE ".table($Q)." (".implode(", ",$p).")";}else$Gb=create_sql($Q,$_POST["auto_increment"],$Lh);set_utf8mb4($Gb);if($Lh&&$Gb){if($Lh=="DROP+CREATE"||$ce==1)echo"DROP ".($ce==2?"VIEW":"TABLE")." IF EXISTS ".table($Q).";\n";if($ce==1)$Gb=remove_definer($Gb);echo"$Gb;\n\n";}}}function
|
|||
|
dumpData($Q,$Lh,$F){global$h,$x;$Ie=($x=="sqlite"?0:1048576);if($Lh){if($_POST["format"]=="sql"){if($Lh=="TRUNCATE+INSERT")echo
|
|||
|
truncate_sql($Q).";\n";$p=fields($Q);}$G=$h->query($F,1);if($G){$Vd="";$Za="";$je=array();$Nh="";$Sc=($Q!=''?'fetch_assoc':'fetch_row');while($I=$G->$Sc()){if(!$je){$Yi=array();foreach($I
|
|||
|
as$X){$o=$G->fetch_field();$je[]=$o->name;$y=idf_escape($o->name);$Yi[]="$y = VALUES($y)";}$Nh=($Lh=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Yi):"").";\n";}if($_POST["format"]!="sql"){if($Lh=="table"){dump_csv($je);$Lh="INSERT";}dump_csv($I);}else{if(!$Vd)$Vd="INSERT INTO ".table($Q)." (".implode(", ",array_map('idf_escape',$je)).") VALUES";foreach($I
|
|||
|
as$y=>$X){$o=$p[$y];$I[$y]=($X!==null?unconvert_field($o,preg_match(number_type(),$o["type"])&&!preg_match('~\[~',$o["full_type"])&&is_numeric($X)?$X:q(($X===false?0:$X))):"NULL");}$bh=($Ie?"\n":" ")."(".implode(",\t",$I).")";if(!$Za)$Za=$Vd.$bh;elseif(strlen($Za)+4+strlen($bh)+strlen($Nh)<$Ie)$Za.=",$bh";else{echo$Za.$Nh;$Za=$Vd.$bh;}}}if($Za)echo$Za.$Nh;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$h->error)."\n";}}function
|
|||
|
dumpFilename($Ed){return
|
|||
|
friendly_url($Ed!=""?$Ed:(SERVER!=""?SERVER:"localhost"));}function
|
|||
|
dumpHeaders($Ed,$Xe=false){$Nf=$_POST["output"];$Kc=(preg_match('~sql~',$_POST["format"])?"sql":($Xe?"tar":"csv"));header("Content-Type: ".($Nf=="gz"?"application/x-gzip":($Kc=="tar"?"application/x-tar":($Kc=="sql"||$Nf!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($Nf=="gz")ob_start('ob_gzencode',1e6);return$Kc;}function
|
|||
|
importServerPath(){return"adminer.sql";}function
|
|||
|
homepage(){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
|
|||
|
true;}function
|
|||
|
navigation($We){global$ia,$x,$gc,$h;echo'<h1>
|
|||
|
',$this->name(),' <span class="version">',$ia,'</span>
|
|||
|
<a href="https://www.adminer.org/#download"',target_blank(),' id="version">',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'</a>
|
|||
|
</h1>
|
|||
|
';if($We=="auth"){$Nf="";foreach((array)$_SESSION["pwds"]as$aj=>$ph){foreach($ph
|
|||
|
as$M=>$Vi){foreach($Vi
|
|||
|
as$V=>$E){if($E!==null){$Tb=$_SESSION["db"][$aj][$M][$V];foreach(($Tb?array_keys($Tb):array(""))as$l)$Nf.="<li><a href='".h(auth_url($aj,$M,$V,$l))."'>($gc[$aj]) ".h($V.($M!=""?"@".$this->serverName($M):"").($l!=""?" - $l":""))."</a>\n";}}}}if($Nf)echo"<ul id='logins'>\n$Nf</ul>\n".script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});");}else{if($_GET["ns"]!==""&&!$We&&DB!=""){$h->select_db(DB);$S=table_status('',true);}echo
|
|||
|
script_src(preg_replace("~\\?.*~","",ME)."?file=jush.js&version=4.7.5");if(support("sql")){echo'<script',nonce(),'>
|
|||
|
';if($S){$ze=array();foreach($S
|
|||
|
as$Q=>$T)$ze[]=preg_quote($Q,'/');echo"var jushLinks = { $x: [ '".js_escape(ME).(support("table")?"table=":"select=")."\$&', /\\b(".implode("|",$ze).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$x;\n";}$oh=$h->server_info;echo'bodyLoad(\'',(is_object($h)?preg_replace('~^(\d\.?\d).*~s','\1',$oh):""),'\'',(preg_match('~MariaDB~',$oh)?", true":""),');
|
|||
|
</script>
|
|||
|
';}$this->databasesPrint($We);if(DB==""||!$We){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"]!==""&&!$We&&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
|
|||
|
databasesPrint($We){global$b,$h;$k=$this->databases();if($k&&!in_array(DB,$k))array_unshift($k,DB);echo'<form action="">
|
|||
|
<p id="dbs">
|
|||
|
';hidden_fields_get();$Rb=script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});");echo"<span title='".lang(76)."'>".lang(77)."</span>: ".($k?"<select name='db'>".optionlist(array(""=>"")+$k,DB)."</select>$Rb":"<input name='db' value='".h(DB)."' autocapitalize='off'>\n"),"<input type='submit' value='".lang(20)."'".($k?" class='hidden'":"").">\n";if($We!="db"&&DB!=""&&$h->select_db(DB)){if(support("scheme")){echo"<br>".lang(78).": <select name='ns'>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>$Rb";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
|
|||
|
tablesPrint($S){echo"<ul id='tables'>".script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");foreach($S
|
|||
|
as$Q=>$O){$B=$this->tableName($O);if($B!=""){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($O)?"view":"structure"))." title='".lang(43)."'>$B</a>":"<span>$B</span>")."\n";}}echo"</ul>\n";}}$b=(function_exists('adminer_object')?adminer_object():new
|
|||
|
Adminer);if($b->operators===null)$b->operators=$yf;function
|
|||
|
page_header($ki,$n="",$Ya=array(),$li=""){global$ca,$ia,$b,$gc,$x;page_headers();if(is_ajax()&&$n){page_messages($n);exit;}$mi=$ki.($li!=""?": $li":"");$ni=strip_tags($mi.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
|
|||
|
<html lang="',$ca,'" dir="',lang(80),'">
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|||
|
<meta name="robots" content="noindex">
|
|||
|
<title>',$ni,'</title>
|
|||
|
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME)."?file=default.css&version=4.7.5"),'">
|
|||
|
',script_src(preg_replace("~\\?.*~","",ME)."?file=functions.js&version=4.7.5");if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.7.5"),'">
|
|||
|
<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.7.5"),'">
|
|||
|
';foreach($b->css()as$Lb){echo'<link rel="stylesheet" type="text/css" href="',h($Lb),'">
|
|||
|
';}}echo'
|
|||
|
<body class="',lang(80),' nojs">
|
|||
|
';$Wc=get_temp_dir()."/adminer.version";if(!$_COOKIE["adminer_version"]&&function_exists('openssl_verify')&&file_exists($Wc)&&filemtime($Wc)+86400>time()){$bj=unserialize(file_get_contents($Wc));$wg="-----BEGIN PUBLIC KEY-----
|
|||
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwqWOVuF5uw7/+Z70djoK
|
|||
|
RlHIZFZPO0uYRezq90+7Amk+FDNd7KkL5eDve+vHRJBLAszF/7XKXe11xwliIsFs
|
|||
|
DFWQlsABVZB3oisKCBEuI71J4kPH8dKGEWR9jDHFw3cWmoH3PmqImX6FISWbG3B8
|
|||
|
h7FIx3jEaw5ckVPVTeo5JRm/1DZzJxjyDenXvBQ/6o9DgZKeNDgxwKzH+sw9/YCO
|
|||
|
jHnq1cFpOIISzARlrHMa/43YfeNRAm/tsBXjSxembBPo7aQZLAWHmaj5+K19H10B
|
|||
|
nCpz9Y++cipkVEiKRGih4ZEvjoFysEOdRLj6WiD/uUNky4xGeA6LaJqh5XpkFkcQ
|
|||
|
fQIDAQAB
|
|||
|
-----END PUBLIC KEY-----
|
|||
|
";if(openssl_verify($bj["version"],base64_decode($bj["signature"]),$wg)==1)$_COOKIE["adminer_version"]=$bj["version"];}echo'<script',nonce(),'>
|
|||
|
mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick',(isset($_COOKIE["adminer_version"])?"":", onload: partial(verifyVersion, '$ia', '".js_escape(ME)."', '".get_token()."')");?>});
|
|||
|
document.body.className = document.body.className.replace(/ nojs/, ' js');
|
|||
|
var offlineMessage = '<?php echo
|
|||
|
js_escape(lang(81)),'\';
|
|||
|
var thousandsSeparator = \'',js_escape(lang(5)),'\';
|
|||
|
</script>
|
|||
|
|
|||
|
<div id="help" class="jush-',$x,' jsonly hidden"></div>
|
|||
|
',script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"),'
|
|||
|
<div id="content">
|
|||
|
';if($Ya!==null){$_=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($_?$_:".").'">'.$gc[DRIVER].'</a> » ';$_=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$M=$b->serverName(SERVER);$M=($M!=""?$M:lang(35));if($Ya===false)echo"$M\n";else{echo"<a href='".($_?h($_):".")."' accesskey='1' title='Alt+Shift+1'>$M</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ya)))echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> » ';if(is_array($Ya)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> » ';foreach($Ya
|
|||
|
as$y=>$X){$Zb=(is_array($X)?$X[1]:h($X));if($Zb!="")echo"<a href='".h(ME."$y=").urlencode(is_array($X)?$X[0]:$X)."'>$Zb</a> » ";}}echo"$ki\n";}}echo"<h2>$mi</h2>\n","<div id='ajaxstatus' class='jsonly hidden'></div>\n";restart_session();page_messages($n);$k=&get_session("dbs");if(DB!=""&&$k&&!in_array(DB,$k,true))$k=null;stop_session();define("PAGE_HEADER",1);}function
|
|||
|
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$Kb){$yd=array();foreach($Kb
|
|||
|
as$y=>$X)$yd[]="$y $X";header("Content-Security-Policy: ".implode("; ",$yd));}$b->headers();}function
|
|||
|
csp(){return
|
|||
|
array(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
|
|||
|
get_nonce(){static$gf;if(!$gf)$gf=base64_encode(rand_string());return$gf;}function
|
|||
|
page_messages($n){$Ni=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Se=$_SESSION["messages"][$Ni];if($Se){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Se)."</div>".script("messagesPrint();");unset($_SESSION["messages"][$Ni]);}if($n)echo"<div class='error'>$n</div>\n";}function
|
|||
|
page_footer($We=""){global$b,$ri;echo'</div>
|
|||
|
|
|||
|
';switch_lang();if($We!="auth"){echo'<form action="" method="post">
|
|||
|
<p class="logout">
|
|||
|
<input type="submit" name="logout" value="',lang(82),'" id="logout">
|
|||
|
<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
';}echo'<div id="menu">
|
|||
|
';$b->navigation($We);echo'</div>
|
|||
|
',script("setupSubmitHighlight(document);");}function
|
|||
|
int32($Ze){while($Ze>=2147483648)$Ze-=4294967296;while($Ze<=-2147483649)$Ze+=4294967296;return(int)$Ze;}function
|
|||
|
long2str($W,$fj){$bh='';foreach($W
|
|||
|
as$X)$bh.=pack('V',$X);if($fj)return
|
|||
|
substr($bh,0,end($W));return$bh;}function
|
|||
|
str2long($bh,$fj){$W=array_values(unpack('V*',str_pad($bh,4*ceil(strlen($bh)/4),"\0")));if($fj)$W[]=strlen($bh);return$W;}function
|
|||
|
xxtea_mx($sj,$rj,$Oh,$fe){return
|
|||
|
int32((($sj>>5&0x7FFFFFF)^$rj<<2)+(($rj>>3&0x1FFFFFFF)^$sj<<4))^int32(($Oh^$rj)+($fe^$sj));}function
|
|||
|
encrypt_string($Jh,$y){if($Jh=="")return"";$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Jh,true);$Ze=count($W)-1;$sj=$W[$Ze];$rj=$W[0];$xg=floor(6+52/($Ze+1));$Oh=0;while($xg-->0){$Oh=int32($Oh+0x9E3779B9);$nc=$Oh>>2&3;for($Of=0;$Of<$Ze;$Of++){$rj=$W[$Of+1];$Ye=xxtea_mx($sj,$rj,$Oh,$y[$Of&3^$nc]);$sj=int32($W[$Of]+$Ye);$W[$Of]=$sj;}$rj=$W[0];$Ye=xxtea_mx($sj,$rj,$Oh,$y[$Of&3^$nc]);$sj=int32($W[$Ze]+$Ye);$W[$Ze]=$sj;}return
|
|||
|
long2str($W,false);}function
|
|||
|
decrypt_string($Jh,$y){if($Jh=="")return"";if(!$y)return
|
|||
|
false;$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Jh,false);$Ze=count($W)-1;$sj=$W[$Ze];$rj=$W[0];$xg=floor(6+52/($Ze+1));$Oh=int32($xg*0x9E3779B9);while($Oh){$nc=$Oh>>2&3;for($Of=$Ze;$Of>0;$Of--){$sj=$W[$Of-1];$Ye=xxtea_mx($sj,$rj,$Oh,$y[$Of&3^$nc]);$rj=int32($W[$Of]-$Ye);$W[$Of]=$rj;}$sj=$W[$Ze];$Ye=xxtea_mx($sj,$rj,$Oh,$y[$Of&3^$nc]);$rj=int32($W[0]-$Ye);$W[0]=$rj;$Oh=int32($Oh-0x9E3779B9);}return
|
|||
|
long2str($W,true);}$h='';$xd=$_SESSION["token"];if(!$xd)$_SESSION["token"]=rand(1,1e6);$ri=get_token();$eg=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($y)=explode(":",$X);$eg[$y]=$X;}}function
|
|||
|
add_invalid_login(){global$b;$kd=file_open_lock(get_temp_dir()."/adminer.invalid");if(!$kd)return;$Yd=unserialize(stream_get_contents($kd));$hi=time();if($Yd){foreach($Yd
|
|||
|
as$Zd=>$X){if($X[0]<$hi)unset($Yd[$Zd]);}}$Xd=&$Yd[$b->bruteForceKey()];if(!$Xd)$Xd=array($hi+30*60,0);$Xd[1]++;file_write_unlock($kd,serialize($Yd));}function
|
|||
|
check_invalid_login(){global$b;$Yd=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$Xd=$Yd[$b->bruteForceKey()];$ff=($Xd[1]>29?$Xd[0]-time():0);if($ff>0)auth_error(lang(83,ceil($ff/60)));}$La=$_POST["auth"];if($La){session_regenerate_id();$aj=$La["driver"];$M=$La["server"];$V=$La["username"];$E=(string)$La["password"];$l=$La["db"];set_password($aj,$M,$V,$E);$_SESSION["db"][$aj][$M][$V][$l]=true;if($La["permanent"]){$y=base64_encode($aj)."-".base64_encode($M)."-".base64_encode($V)."-".base64_encode($l);$qg=$b->permanentLogin(true);$eg[$y]="$y:".base64_encode($qg?encrypt_string($E,$qg):"");cookie("adminer_permanent",implode(" ",$eg));}if(count($_POST)==1||DRIVER!=$aj||SERVER!=$M||$_GET["username"]!==$V||DB!=$l)redirect(auth_url($aj,$M,$V,$l));}elseif($_POST["logout"]){if($xd&&!verify_token()){page_header(lang(82),lang(84));page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$y)set_session($y,null);unset_permanent();redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1),lang(85).' '.lang(86));}}elseif($eg&&!$_SESSION["pwds"]){session_regenerate_id();$qg=$b->permanentLogin();foreach($eg
|
|||
|
as$y=>$X){list(,$kb)=explode(":",$X);list($aj,$M,$V,$l)=array_map('base64_decode',explode("-",$y));set_password($aj,$M,$V,decrypt_string(base64_decode($kb),$qg));$_SESSION["db"][$aj][$M][$V][$l]=true;}}function
|
|||
|
unset_permanent(){global$eg;foreach($eg
|
|||
|
as$y=>$X){list($aj,$M,$V,$l)=array_map('base64_decode',explode("-",$y));if($aj==DRIVER&&$M==SERVER&&$V==$_GET["username"]&&$l==DB)unset($eg[$y]);}cookie("adminer_permanent",implode(" ",$eg));}function
|
|||
|
auth_error($n){global$b,$xd;$qh=session_name();if(isset($_GET["username"])){header("HTTP/1.1 403 Forbidden");if(($_COOKIE[$qh]||$_GET[$qh])&&!$xd)$n=lang(87);else{restart_session();add_invalid_login();$E=get_password();if($E!==null){if($E===false)$n.='<br>'.lang(88,target_blank(),'<code>permanentLogin()</code>');set_password(DRIVER,SERVER,$_GET["username"],null);}unset_permanent();}}if(!$_COOKIE[$qh]&&$_GET[$qh]&&ini_bool("session.use_only_cookies"))$n=lang(89);$Rf=session_get_cookie_params();cookie("adminer_key",($_COOKIE["adminer_key"]?$_COOKIE["adminer_key"]:rand_string()),$Rf["lifetime"]);page_header(lang(39),$n,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(", ",$kg)),false);page_footer("auth");exit;}stop_session(true);if(isset($_GET["username"])&&is_string(get_password())){list($Cd,$gg)=explode(":",SERVER,2);if(is_numeric($gg)&&$gg<1024)auth_error(lang(93));check_invalid_login();$h=connect();$m=new
|
|||
|
Min_Driver($h);}$Ae=null;if(!is_object($h)||($Ae=$b->login($_GET["username"],get_password()))!==true){$n=(is_string($h)?h($h):(is_string($Ae)?$Ae:lang(94)));auth_error($n.(preg_match('~^ | $~',get_password())?'<br>'.lang(95):''));}if($La&&$_POST["token"])$_POST["token"]=$ri;$n='';if($_POST){if(!verify_token()){$Sd="max_input_vars";$Me=ini_get($Sd);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$y){$X=ini_get($y);if($X&&(!$Me||$X<$Me)){$Sd=$y;$Me=$X;}}}$n=(!$_POST["token"]&&$Me?lang(96,"'$Sd'"):lang(84).' '.lang(97));}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$n=lang(98,"'post_max_size'");if(isset($_GET["sql"]))$n.=' '.lang(99);}function
|
|||
|
select($G,$i=null,$Ff=array(),$z=0){global$x;$ze=array();$w=array();$f=array();$Va=array();$U=array();$H=array();odd('');for($s=0;(!$z||$s<$z)&&($I=$G->fetch_row());$s++){if(!$s){echo"<div class='scrollable'>\n","<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($ee=0;$ee<count($I);$ee++){$o=$G->fetch_field();$B=$o->name;$Ef=$o->orgtable;$Df=$o->orgname;$H[$o->table]=$Ef;if($Ff&&$x=="sql")$ze[$ee]=($B=="table"?"table=":($B=="possible_keys"?"indexes=":null));elseif($Ef!=""){if(!isset($w[$Ef])){$w[$Ef]=array();foreach(indexes($Ef,$i)as$v){if($v["type"]=="PRIMARY"){$w[$Ef]=array_flip($v["columns"]);break;}}$f[$Ef]=$w[$Ef];}if(isset($f[$Ef][$Df])){unset($f[$Ef][$Df]);$w[$Ef][$Df]=$ee;$ze[$ee]=$Ef;}}if($o->charsetnr==63)$Va[$ee]=true;$U[$ee]=$o->type;echo"<th".($Ef!=""||$o->name!=$Df?" title='".h(($Ef!=""?"$Ef.":"").$Df)."'":"").">".h($B).($Ff?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($B),'mariadb'=>"explain/#the-columns-in-explain-select",)):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($I
|
|||
|
as$y=>$X){if($X===null)$X="<i>NULL</i>";elseif($Va[$y]&&!is_utf8($X))$X="<i>".lang(48,strlen($X))."</i>";else{$X=h($X);if($U[$y]==254)$X="<code>$X</code>";}if(isset($ze[$y])&&!$f[$ze[$y]]){if($Ff&&$x=="sql"){$Q=$I[array_search("table=",$ze)];$_=$ze[$y].urlencode($Ff[$Q]!=""?$Ff[$Q]:$Q);}else{$_="edit=".urlencode($ze[$y]);foreach($w[$ze[$y]]as$ob=>$ee)$_.="&where".urlencode("[".bracket_escape($ob)."]")."=".urlencode($I[$ee]);}$X="<a href='".h(ME.$_)."'>$X</a>";}echo"<td>$X";}}echo($s?"</table>\n</div>":"<p class='message'>".lang(12))."\n";return$H;}function
|
|||
|
referencable_primary($kh){$H=array();foreach(table_status('',true)as$Sh=>$Q){if($Sh!=$kh&&fk_support($Q)){foreach(fields($Sh)as$o){if($o["primary"]){if($H[$Sh]){unset($H[$Sh]);break;}$H[$Sh]=$o;}}}}return$H;}function
|
|||
|
adminer_settings(){parse_str($_COOKIE["adminer_settings"],$sh);return$sh;}function
|
|||
|
adminer_setting($y){$sh=adminer_settings();return$sh[$y];}function
|
|||
|
set_adminer_settings($sh){return
|
|||
|
cookie("adminer_settings",http_build_query($sh+adminer_settings()));}function
|
|||
|
textarea($B,$Y,$J=10,$sb=80){global$x;echo"<textarea name='$B' rows='$J' cols='$sb' class='sqlarea jush-$x' spellcheck='false' wrap='off'>";if(is_array($Y)){foreach($Y
|
|||
|
as$X)echo
|
|||
|
h($X[0])."\n\n\n";}else
|
|||
|
echo
|
|||
|
h($Y);echo"</textarea>";}function
|
|||
|
edit_type($y,$o,$qb,$gd=array(),$Nc=array()){global$Kh,$U,$Li,$tf;$T=$o["type"];echo'<td><select name="',h($y),'[type]" class="type" aria-labelledby="label-type">';if($T&&!isset($U[$T])&&!isset($gd[$T])&&!in_array($T,$Nc))$Nc[]=$T;if($gd)$Kh[lang(100)]=$gd;echo
|
|||
|
optionlist(array_merge($Nc,$Kh),$T),'</select>',on_help("getTarget(event).value",1),script("mixin(qsl('select'), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});",""),'<td><input name="',h($y),'[length]" value="',h($o["length"]),'" size="3"',(!$o["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($y)."[collation]'".(preg_match('~(char|text|enum|set)$~',$T)?"":" class='hidden'").'><option value="">('.lang(101).')'.optionlist($qb,$o["collation"]).'</select>',($Li?"<select name='".h($y)."[unsigned]'".(!$T||preg_match(number_type(),$T)?"":" class='hidden'").'><option>'.optionlist($Li,$o["unsigned"]).'</select>':''),(isset($o['on_update'])?"<select name='".h($y)."[on_update]'".(preg_match('~timestamp|datetime~',$T)?"":" class='hidden'").'>'.optionlist(array(""=>"(".lang(102).")","CURRENT_TIMESTAMP"),(preg_match('~^CURRENT_TIMESTAMP~i',$o["on_update"])?"CURRENT_TIMESTAMP":$o["on_update"])).'</select>':''),($gd?"<select name='".h($y)."[on_delete]'".(preg_match("~`~",$T)?"":" class='hidden'")."><option value=''>(".lang(103).")".optionlist(explode("|",$tf),$o["on_delete"])."</select> ":" ");}function
|
|||
|
process_length($we){global$yc;return(preg_match("~^\\s*\\(?\\s*$yc(?:\\s*,\\s*$yc)*+\\s*\\)?\\s*\$~",$we)&&preg_match_all("~$yc~",$we,$Ge)?"(".implode(",",$Ge[0]).")":preg_replace('~^[0-9].*~','(\0)',preg_replace('~[^-0-9,+()[\]]~','',$we)));}function
|
|||
|
process_type($o,$pb="COLLATE"){global$Li;return" $o[type]".process_length($o["length"]).(preg_match(number_type(),$o["type"])&&in_array($o["unsigned"],$Li)?" $o[unsigned]":"").(preg_match('~char|text|enum|set~',$o["type"])&&$o["collation"]?" $pb ".q($o["collation"]):"");}function
|
|||
|
process_field($o,$Di){return
|
|||
|
array(idf_escape(trim($o["field"])),process_type($Di),($o["null"]?" NULL":" NOT NULL"),default_value($o),(preg_match('~timestamp|datetime~',$o["type"])&&$o["on_update"]?" ON UPDATE $o[on_update]":""),(support("comment")&&$o["comment"]!=""?" COMMENT ".q($o["comment"]):""),($o["auto_increment"]?auto_increment():null),);}function
|
|||
|
default_value($o){$Vb=$o["default"];return($Vb===null?"":" DEFAULT ".(preg_match('~char|binary|text|enum|set~',$o["type"])||preg_match('~^(?![a-z])~i',$Vb)?q($Vb):$Vb));}function
|
|||
|
type_class($T){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$y=>$X){if(preg_match("~$y|$X~",$T))return" class='$y'";}}function
|
|||
|
edit_fields($p,$qb,$T="TABLE",$gd=array()){global$Td;$p=array_values($p);echo'<thead><tr>
|
|||
|
';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
|
|||
|
<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($p))."]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.5")."' alt='+' title='".lang(108)."'>".script("row_count = ".count($p).";"),'</thead>
|
|||
|
<tbody>
|
|||
|
',script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown, oninput: editingInput});");foreach($p
|
|||
|
as$s=>$o){$s++;$Gf=$o[($_POST?"orig":"field")];$dc=(isset($_POST["add"][$s-1])||(isset($o["field"])&&!$_POST["drop_col"][$s]))&&(support("drop_col")||$Gf=="");echo'<tr',($dc?"":" style='display: none;'"),'>
|
|||
|
',($T=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$Td),$o["inout"]):""),'<th>';if($dc){echo'<input name="fields[',$s,'][field]" value="',h($o["field"]),'" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name">',script("qsl('input').oninput = function () { editingNameChange.call(this);".($o["field"]!=""||count($p)>1?"":" editingAddRow.call(this);")." };","");}echo'<input type="hidden" name="fields[',$s,'][orig]" value="',h($Gf),'">';edit_type("fields[$s]",$o,$qb,$gd);if($T=="TABLE"){echo'<td>',checkbox("fields[$s][null]",1,$o["null"],"","","block","label-null"),'<td><label class="block"><input type="radio" name="auto_increment_col" value="',$s,'"';if($o["auto_increment"]){echo' checked';}echo' aria-labelledby="label-ai"></label><td>',checkbox("fields[$s][has_default]",1,$o["has_default"],"","","","label-default"),'<input name="fields[',$s,'][default]" value="',h($o["default"]),'" aria-labelledby="label-default">',(support("comment")?"<td><input name='fields[$s][comment]' value='".h($o["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[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.7.5")."' alt='+' title='".lang(108)."'> "."<input type='image' class='icon' name='up[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=up.gif&version=4.7.5")."' alt='↑' title='".lang(109)."'> "."<input type='image' class='icon' name='down[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=down.gif&version=4.7.5")."' alt='↓' title='".lang(110)."'> ":""),($Gf==""||support("drop_col")?"<input type='image' class='icon' name='drop_col[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.7.5")."' alt='x' title='".lang(111)."'>":"");}}function
|
|||
|
process_fields(&$p){$C=0;if($_POST["up"]){$qe=0;foreach($p
|
|||
|
as$y=>$o){if(key($_POST["up"])==$y){unset($p[$y]);array_splice($p,$qe,0,array($o));break;}if(isset($o["field"]))$qe=$C;$C++;}}elseif($_POST["down"]){$id=false;foreach($p
|
|||
|
as$y=>$o){if(isset($o["field"])&&$id){unset($p[key($_POST["down"])]);array_splice($p,$C,0,array($id));break;}if(key($_POST["down"])==$y)$id=$o;$C++;}}elseif($_POST["add"]){$p=array_values($p);array_splice($p,key($_POST["add"]),0,array(array()));}elseif(!$_POST["drop_col"])return
|
|||
|
false;return
|
|||
|
true;}function
|
|||
|
normalize_enum($A){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($A[0][0].$A[0][0],$A[0][0],substr($A[0],1,-1))),'\\'))."'";}function
|
|||
|
grant($nd,$sg,$f,$sf){if(!$sg)return
|
|||
|
true;if($sg==array("ALL PRIVILEGES","GRANT OPTION"))return($nd=="GRANT"?queries("$nd ALL PRIVILEGES$sf WITH GRANT OPTION"):queries("$nd ALL PRIVILEGES$sf")&&queries("$nd GRANT OPTION$sf"));return
|
|||
|
queries("$nd ".preg_replace('~(GRANT OPTION)\([^)]*\)~','\1',implode("$f, ",$sg).$f).$sf);}function
|
|||
|
drop_create($hc,$Gb,$ic,$ei,$kc,$_e,$Re,$Pe,$Qe,$pf,$cf){if($_POST["drop"])query_redirect($hc,$_e,$Re);elseif($pf=="")query_redirect($Gb,$_e,$Qe);elseif($pf!=$cf){$Ib=queries($Gb);queries_redirect($_e,$Pe,$Ib&&queries($hc));if($Ib)queries($ic);}else
|
|||
|
queries_redirect($_e,$Pe,queries($ei)&&queries($kc)&&queries($hc)&&queries($Gb));}function
|
|||
|
create_trigger($sf,$I){global$x;$ji=" $I[Timing] $I[Event]".($I["Event"]=="UPDATE OF"?" ".idf_escape($I["Of"]):"");return"CREATE TRIGGER ".idf_escape($I["Trigger"]).($x=="mssql"?$sf.$ji:$ji.$sf).rtrim(" $I[Type]\n$I[Statement]",";").";";}function
|
|||
|
create_routine($Xg,$I){global$Td,$x;$N=array();$p=(array)$I["fields"];ksort($p);foreach($p
|
|||
|
as$o){if($o["field"]!="")$N[]=(preg_match("~^($Td)\$~",$o["inout"])?"$o[inout] ":"").idf_escape($o["field"]).process_type($o,"CHARACTER SET");}$Wb=rtrim("\n$I[definition]",";");return"CREATE $Xg ".idf_escape(trim($I["name"]))." (".implode(", ",$N).")".(isset($_GET["function"])?" RETURNS".process_type($I["returns"],"CHARACTER SET"):"").($I["language"]?" LANGUAGE $I[language]":"").($x=="pgsql"?" AS ".q($Wb):"$Wb;");}function
|
|||
|
remove_definer($F){return
|
|||
|
preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\1)',logged_user()).'`~','\1',$F);}function
|
|||
|
format_foreign_key($q){global$tf;$l=$q["db"];$hf=$q["ns"];return" FOREIGN KEY (".implode(", ",array_map('idf_escape',$q["source"])).") REFERENCES ".($l!=""&&$l!=$_GET["db"]?idf_escape($l).".":"").($hf!=""&&$hf!=$_GET["ns"]?idf_escape($hf).".":"").table($q["table"])." (".implode(", ",array_map('idf_escape',$q["target"])).")".(preg_match("~^($tf)\$~",$q["on_delete"])?" ON DELETE $q[on_delete]":"").(preg_match("~^($tf)\$~",$q["on_update"])?" ON UPDATE $q[on_update]":"");}function
|
|||
|
tar_file($Wc,$oi){$H=pack("a100a8a8a8a12a12",$Wc,644,0,0,decoct($oi->size),decoct(time()));$ib=8*32;for($s=0;$s<strlen($H);$s++)$ib+=ord($H[$s]);$H.=sprintf("%06o",$ib)."\0 ";echo$H,str_repeat("\0",512-strlen($H));$oi->send();echo
|
|||
|
str_repeat("\0",511-($oi->size+511)%512);}function
|
|||
|
ini_bytes($Sd){$X=ini_get($Sd);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}function
|
|||
|
doc_link($cg,$fi="<sup>?</sup>"){global$x,$h;$oh=$h->server_info;$bj=preg_replace('~^(\d\.?\d).*~s','\1',$oh);$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',$oh)."&id=",);if(preg_match('~MariaDB~',$oh)){$Qi['sql']="https://mariadb.com/kb/en/library/";$cg['sql']=(isset($cg['mariadb'])?$cg['mariadb']:str_replace(".html","/",$cg['sql']));}return($cg[$x]?"<a href='$Qi[$x]$cg[$x]'".target_blank().">$fi</a>":"");}function
|
|||
|
ob_gzencode($P){return
|
|||
|
gzencode($P);}function
|
|||
|
db_size($l){global$h;if(!$h->select_db($l))return"?";$H=0;foreach(table_status()as$R)$H+=$R["Data_length"]+$R["Index_length"];return
|
|||
|
format_number($H);}function
|
|||
|
set_utf8mb4($Gb){global$h;static$N=false;if(!$N&&preg_match('~\butf8mb4~i',$Gb)){$N=true;echo"SET NAMES ".charset($h).";\n\n";}}function
|
|||
|
connect_error(){global$b,$h,$ri,$n,$gc;if(DB!=""){header("HTTP/1.1 404 Not Found");page_header(lang(38).": ".h(DB),lang(112),true);}else{if($_POST["db"]&&!$n)queries_redirect(substr(ME,0,-1),lang(113),drop_databases($_POST["db"]));page_header(lang(114),$n,false);echo"<p class='links'>\n";foreach(array('database'=>lang(115),'privileges'=>lang(72),'processlist'=>lang(116),'variables'=>lang(117),'status'=>lang(118),)as$y=>$X){if(support($y))echo"<a href='".h(ME)."$y='>$X</a>\n";}echo"<p>".lang(119,$gc[DRIVER],"<b>".h($h->server_info)."</b>","<b>$h->extension</b>")."\n","<p>".lang(120,"<b>".h(logged_user())."</b>")."\n";$k=$b->databases();if($k){$eh=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";$k=($_GET["dbsize"]?count_tables($k):array_flip($k));foreach($k
|
|||
|
as$l=>$S){$Wg=h(ME)."db=".urlencode($l);$t=h("Db-".$l);echo"<tr".odd().">".(support("database")?"<td>".checkbox("db[]",$l,in_array($l,(array)$_POST["db"]),"","","",$t):""),"<th><a href='$Wg' id='$t'>".h($l)."</a>";$d=h(db_collation($l,$qb));echo"<td>".(support("database")?"<a href='$Wg".($eh?"&ns=":"")."&database=' title='".lang(68)."'>$d</a>":$d),"<td align='right'><a href='$Wg&schema=' id='tables-".h($l)."' title='".lang(71)."'>".($_GET["dbsize"]?$S:"?")."</a>","<td align='right' id='size-".h($l)."'>".($_GET["dbsize"]?db_size($l):"?"),"\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;}}$tf="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";class
|
|||
|
TmpFile{var$handler;var$size;function
|
|||
|
__construct(){$this->handler=tmpfile();}function
|
|||
|
write($Bb){$this->size+=strlen($Bb);fwrite($this->handler,$Bb);}function
|
|||
|
send(){fseek($this->handler,0);fpassthru($this->handler);fclose($this->handler);}}$yc="'(?:''|[^'\\\\]|\\\\.)*'";$Td="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"];$p=fields($a);header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));$K=array(idf_escape($_GET["field"]));$G=$m->select($a,$K,array(where($_GET,$p)),$K);$I=($G?$G->fetch_row():array());echo$m->value($I[0],$p[$_GET["field"]]);exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$p=fields($a);if(!$p)$n=error();$R=table_status1($a,true);$B=$b->tableName($R);page_header(($p&&is_view($R)?$R['Engine']=='materialized view'?lang(129):lang(130):lang(131)).": ".($B!=""?$B:h($a)),$n);$b->selectLinks($R);$vb=$R["Comment"];if($vb!="")echo"<p class='nowrap'>".lang(51).": ".h($vb)."\n";if($p)$b->tableStructurePrint($p);if(!is_view($R)){if(support("indexes")){echo"<h3 id='indexes'>".lang(132)."</h3>\n";$w=indexes($a);if($w)$b->tableIndexesPrint($w);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";$gd=foreign_keys($a);if($gd){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(134)."<td>".lang(135)."<td>".lang(103)."<td>".lang(102)."<td></thead>\n";foreach($gd
|
|||
|
as$B=>$q){echo"<tr title='".h($B)."'>","<th><i>".implode("</i>, <i>",array_map('h',$q["source"]))."</i>","<td><a href='".h($q["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($q["db"]),ME):($q["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($q["ns"]),ME):ME))."table=".urlencode($q["table"])."'>".($q["db"]!=""?"<b>".h($q["db"])."</b>.":"").($q["ns"]!=""?"<b>".h($q["ns"])."</b>.":"").h($q["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$q["target"]))."</i>)","<td>".h($q["on_delete"])."\n","<td>".h($q["on_update"])."\n",'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($B)).'">'.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
|
|||
|
as$y=>$X)echo"<tr valign='top'><td>".h($X[0])."<td>".h($X[1])."<th>".h($y)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($y))."'>".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,$Ge,PREG_SET_ORDER);foreach($Ge
|
|||
|
as$s=>$A){$Uh[$A[1]]=array($A[2],$A[3]);$Vh[]="\n\t'".js_escape($A[1])."': [ $A[2], $A[3] ]";}$si=0;$Sa=-1;$dh=array();$Ig=array();$ue=array();foreach(table_status('',true)as$Q=>$R){if(is_view($R))continue;$hg=0;$dh[$Q]["fields"]=array();foreach(fields($Q)as$B=>$o){$hg+=1.25;$o["pos"]=$hg;$dh[$Q]["fields"][$B]=$o;}$dh[$Q]["pos"]=($Uh[$Q]?$Uh[$Q]:array($si,0));foreach($b->foreignKeys($Q)as$X){if(!$X["db"]){$se=$Sa;if($Uh[$Q][1]||$Uh[$X["table"]][1])$se=min(floatval($Uh[$Q][1]),floatval($Uh[$X["table"]][1]))-1;else$Sa-=.1;while($ue[(string)$se])$se-=.0001;$dh[$Q]["references"][$X["table"]][(string)$se]=array($X["source"],$X["target"]);$Ig[$X["table"]][$Q][(string)$se]=$X["target"];$ue[(string)$se]=true;}}$si=max($si,$dh[$Q]["pos"][0]+2.5+$hg);}echo'<div id="schema" style="height: ',$si,'em;">
|
|||
|
<script',nonce(),'>
|
|||
|
qs(\'#schema\').onselectstart = function () { return false; };
|
|||
|
var tablePos = {',implode(",",$Vh)."\n",'};
|
|||
|
var em = qs(\'#schema\').offsetHeight / ',$si,';
|
|||
|
document.onmousemove = schemaMousemove;
|
|||
|
document.onmouseup = partialArg(schemaMouseup, \'',js_escape(DB),'\');
|
|||
|
</script>
|
|||
|
';foreach($dh
|
|||
|
as$B=>$Q){echo"<div class='table' style='top: ".$Q["pos"][0]."em; left: ".$Q["pos"][1]."em;'>",'<a href="'.h(ME).'table='.urlencode($B).'"><b>'.h($B)."</b></a>",script("qsl('div').onmousedown = schemaMousedown;");foreach($Q["fields"]as$o){$X='<span'.type_class($o["type"]).' title="'.h($o["full_type"].($o["null"]?" NULL":'')).'">'.h($o["field"]).'</span>';echo"<br>".($o["primary"]?"<i>$X</i>":$X);}foreach((array)$Q["references"]as$bi=>$Jg){foreach($Jg
|
|||
|
as$se=>$Fg){$te=$se-$Uh[$B][1];$s=0;foreach($Fg[0]as$zh)echo"\n<div class='references' title='".h($bi)."' id='refs$se-".($s++)."' style='left: $te"."em; top: ".$Q["fields"][$zh]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$te)."em;'></div></div>";}}foreach((array)$Ig[$B]as$bi=>$Jg){foreach($Jg
|
|||
|
as$se=>$f){$te=$se-$Uh[$B][1];$s=0;foreach($f
|
|||
|
as$ai)echo"\n<div class='references' title='".h($bi)."' id='refd$se-".($s++)."' style='left: $te"."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.5")."'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$te)."em;'></div></div>";}}echo"\n</div>\n";}foreach($dh
|
|||
|
as$B=>$Q){foreach((array)$Q["references"]as$bi=>$Jg){foreach($Jg
|
|||
|
as$se=>$Fg){$Ve=$si;$Ke=-10;foreach($Fg[0]as$y=>$zh){$ig=$Q["pos"][0]+$Q["fields"][$zh]["pos"];$jg=$dh[$bi]["pos"][0]+$dh[$bi]["fields"][$Fg[1][$y]]["pos"];$Ve=min($Ve,$ig,$jg);$Ke=max($Ke,$ig,$jg);}echo"<div class='references' id='refl$se' style='left: $se"."em; top: $Ve"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Ke-$Ve)."em;'></div></div>\n";}}}echo'</div>
|
|||
|
<p class="links"><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">',lang(140),'</a>
|
|||
|
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$n){$Eb="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$y)$Eb.="&$y=".urlencode($_POST[$y]);cookie("adminer_export",substr($Eb,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Kc=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$be=preg_match('~sql~',$_POST["format"]);if($be){echo"-- Adminer $ia ".$gc[DRIVER]." dump\n\n";if($x=="sql"){echo"SET NAMES utf8;
|
|||
|
SET time_zone = '+00:00';
|
|||
|
".($_POST["data_style"]?"SET foreign_key_checks = 0;
|
|||
|
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
|||
|
":"")."
|
|||
|
";$h->query("SET time_zone = '+00:00';");}}$Lh=$_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($h->select_db($l)){if($be&&preg_match('~CREATE~',$Lh)&&($Gb=$h->result("SHOW CREATE DATABASE ".idf_escape($l),1))){set_utf8mb4($Gb);if($Lh=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($l).";\n";echo"$Gb;\n";}if($be){if($Lh)echo
|
|||
|
use_sql($l).";\n\n";$Mf="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$Xg){foreach(get_rows("SHOW $Xg STATUS WHERE Db = ".q($l),null,"-- ")as$I){$Gb=remove_definer($h->result("SHOW CREATE $Xg ".idf_escape($I["Name"]),2));set_utf8mb4($Gb);$Mf.=($Lh!='DROP+CREATE'?"DROP $Xg IF EXISTS ".idf_escape($I["Name"]).";;\n":"")."$Gb;;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$I){$Gb=remove_definer($h->result("SHOW CREATE EVENT ".idf_escape($I["Name"]),3));set_utf8mb4($Gb);$Mf.=($Lh!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($I["Name"]).";;\n":"")."$Gb;;\n\n";}}if($Mf)echo"DELIMITER ;;\n\n$Mf"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$dj=array();foreach(table_status('',true)as$B=>$R){$Q=(DB==""||in_array($B,(array)$_POST["tables"]));$Ob=(DB==""||in_array($B,(array)$_POST["data"]));if($Q||$Ob){if($Kc=="tar"){$oi=new
|
|||
|
TmpFile;ob_start(array($oi,'write'),1e5);}$b->dumpTable($B,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$dj[]=$B;elseif($Ob){$p=fields($B);$b->dumpData($B,$_POST["data_style"],"SELECT *".convert_fields($p,$p)." FROM ".table($B));}if($be&&$_POST["triggers"]&&$Q&&($Ci=trigger_sql($B)))echo"\nDELIMITER ;;\n$Ci\nDELIMITER ;\n";if($Kc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$l/")."$B.csv",$oi);}elseif($be)echo"\n";}}foreach($dj
|
|||
|
as$cj)$b->dumpTable($cj,$_POST["table_style"],1);if($Kc=="tar")echo
|
|||
|
pack("x512");}}}if($be)echo"-- ".$h->result("SELECT NOW()")."\n";exit;}page_header(lang(74),$n,($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),h(DB));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="layout">
|
|||
|
';$Sb=array('','USE','DROP+CREATE','CREATE');$Wh=array('','DROP+CREATE','CREATE');$Pb=array('','TRUNCATE+INSERT','INSERT');if($x=="sql")$Pb[]='INSERT+UPDATE';parse_str($_COOKIE["adminer_export"],$I);if(!$I)$I=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($I["events"])){$I["routines"]=$I["events"]=($_GET["dump"]=="");$I["triggers"]=$I["table_style"];}echo"<tr><th>".lang(141)."<td>".html_select("output",$b->dumpOutput(),$I["output"],0)."\n";echo"<tr><th>".lang(142)."<td>".html_select("format",$b->dumpFormat(),$I["format"],0)."\n";echo($x=="sqlite"?"":"<tr><th>".lang(38)."<td>".html_select('db_style',$Sb,$I["db_style"]).(support("routine")?checkbox("routines",1,$I["routines"],lang(143)):"").(support("event")?checkbox("events",1,$I["events"],lang(144)):"")),"<tr><th>".lang(123)."<td>".html_select('table_style',$Wh,$I["table_style"]).checkbox("auto_increment",1,$I["auto_increment"],lang(52)).(support("trigger")?checkbox("triggers",1,$I["triggers"],lang(138)):""),"<tr><th>".lang(145)."<td>".html_select('data_style',$Pb,$I["data_style"]),'</table>
|
|||
|
<p><input type="submit" value="',lang(74),'">
|
|||
|
<input type="hidden" name="token" value="',$ri,'">
|
|||
|
|
|||
|
<table cellspacing="0">
|
|||
|
',script("qsl('table').onclick = dumpClick;");$mg=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
|
|||
|
as$B=>$T){$lg=preg_replace('~_.*~','',$B);$gb=($a==""||$a==(substr($a,-1)=="%"?"$lg%":$B));$pg="<tr><td>".checkbox("tables[]",$B,$gb,$B,"","block");if($T!==null&&!preg_match('~table~i',$T))$dj.="$pg\n";else
|
|||
|
echo"$pg<td align='right'><label class='block'><span id='Rows-".h($B)."'></span>".checkbox("data[]",$B,$gb)."</label>\n";$mg[$lg]++;}echo$dj;if($Xh)echo
|
|||
|
script("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";$k=$b->databases();if($k){foreach($k
|
|||
|
as$l){if(!information_schema($l)){$lg=preg_replace('~_.*~','',$l);echo"<tr><td>".checkbox("databases[]",$l,$a==""||$a=="$lg%",$l,"","block")."\n";$mg[$lg]++;}}}else
|
|||
|
echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}echo'</table>
|
|||
|
</form>
|
|||
|
';$Yc=true;foreach($mg
|
|||
|
as$y=>$X){if($y!=""&&$X>1){echo($Yc?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$y%")."'>".h($y)."</a>";$Yc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(72));echo'<p class="links"><a href="'.h(ME).'user=">'.lang(146)."</a>";$G=$h->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$nd=$G;if(!$G)$G=$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",($nd?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".lang(36)."<th>".lang(35)."<th></thead>\n";while($I=$G->fetch_assoc())echo'<tr'.odd().'><td>'.h($I["User"])."<td>".h($I["Host"]).'<td><a href="'.h(ME.'user='.urlencode($I["User"]).'&host='.urlencode($I["Host"])).'">'.lang(10)."</a>\n";if(!$nd||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(!$n&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$Ad=&get_session("queries");$_d=&$Ad[DB];if(!$n&&$_POST["clear"]){$_d=array();redirect(remove_from_uri("history"));}page_header((isset($_GET["import"])?lang(73):lang(65)),$n);if(!$n&&$_POST){$kd=false;if(!isset($_GET["import"]))$F=$_POST["query"];elseif($_POST["webfile"]){$Ch=$b->importServerPath();$kd=@fopen((file_exists($Ch)?$Ch:"compress.zlib://$Ch.gz"),"rb");$F=($kd?fread($kd,1e6):false);}else$F=get_file("sql_file",true);if(is_string($F)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($F)+memory_get_usage()+8e6));if($F!=""&&strlen($F)<1e6){$xg=$F.(preg_match("~;[ \t\r\n]*\$~",$F)?"":";");if(!$_d||reset(end($_d))!=$xg){restart_session();$_d[]=array($xg,time());set_session("queries",$Ad);stop_session();}}$_h="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Yb=";";$C=0;$vc=true;$i=connect();if(is_object($i)&&DB!=""){$i->select_db(DB);if($_GET["ns"]!="")set_schema($_GET["ns"],$i);}$ub=0;$_c=array();$Tf='[\'"'.($x=="sql"?'`#':($x=="sqlite"?'`[':($x=="mssql"?'[':''))).']|/\*|-- |$'.($x=="pgsql"?'|\$[^$]*\$':'');$ti=microtime(true);parse_str($_COOKIE["adminer_export"],$ya);$mc=$b->dumpFormat();unset($mc["sql"]);while($F!=""){if(!$C&&preg_match("~^$_h*+DELIMITER\\s+(\\S+)~i",$F,$A)){$Yb=$A[1];$F=substr($F,strlen($A[0]));}else{preg_match('('.preg_quote($Yb)."\\s*|$Tf)",$F,$A,PREG_OFFSET_CAPTURE,$C);list($id,$hg)=$A[0];if(!$id&&$kd&&!feof($kd))$F.=fread($kd,1e5);else{if(!$id&&rtrim($F)=="")break;$C=$hg+strlen($id);if($id&&rtrim($id)!=$Yb){while(preg_match('('.($id=='/*'?'\*/':($id=='['?']':(preg_match('~^-- |^#~',$id)?"\n":preg_quote($id)."|\\\\."))).'|$)s',$F,$A,PREG_OFFSET_CAPTURE,$C)){$bh=$A[0][0];if(!$bh&&$kd&&!feof($kd))$F.=fread($kd,1e5);else{$C=$A[0][1]+strlen($bh);if($bh[0]!="\\")break;}}}else{$vc=false;$xg=substr($F,0,$hg);$ub++;$pg="<pre id='sql-$ub'><code class='jush-$x'>".$b->sqlCommandQuery($xg)."</code></pre>\n";if($x=="sqlite"&&preg_match("~^$_h*+ATTACH\\b~i",$xg,$A)){echo$pg,"<p class='error'>".lang(147)."\n";$_c[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break;}else{if(!$_POST["only_errors"]){echo$pg;ob_flush();flush();}$Gh=microtime(true);if($h->multi_query($xg)&&is_object($i)&&preg_match("~^$_h*+USE\\b~i",$xg))$i->query($xg);do{$G=$h->store_result();if($h->error){echo($_POST["only_errors"]?$pg:""),"<p class='error'>".lang(148).($h->errno?" ($h->errno)":"").": ".error()."\n";$_c[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break
|
|||
|
2;}else{$hi=" <span class='time'>(".format_time($Gh).")</span>".(strlen($xg)<1000?" <a href='".h(ME)."sql=".urlencode(trim($xg))."'>".lang(10)."</a>":"");$_a=$h->affected_rows;$gj=($_POST["only_errors"]?"":$m->warnings());$hj="warnings-$ub";if($gj)$hi.=", <a href='#$hj'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$hj');","");$Hc=null;$Ic="explain-$ub";if(is_object($G)){$z=$_POST["limit"];$Ff=select($G,$i,array(),$z);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n";$jf=$G->num_rows;echo"<p>".($jf?($z&&$jf>$z?lang(149,$z):"").lang(150,$jf):""),$hi;if($i&&preg_match("~^($_h|\\()*+SELECT\\b~i",$xg)&&($Hc=explain($i,$xg)))echo", <a href='#$Ic'>Explain</a>".script("qsl('a').onclick = partial(toggle, '$Ic');","");$t="export-$ub";echo", <a href='#$t'>".lang(74)."</a>".script("qsl('a').onclick = partial(toggle, '$t');","")."<span id='$t' class='hidden'>: ".html_select("output",$b->dumpOutput(),$ya["output"])." ".html_select("format",$mc,$ya["format"])."<input type='hidden' name='query' value='".h($xg)."'>"." <input type='submit' name='export' value='".lang(74)."'><input type='hidden' name='token' value='$ri'></span>\n"."</form>\n";}}else{if(preg_match("~^$_h*+(CREATE|DROP|ALTER)$_h++(DATABASE|SCHEMA)\\b~i",$xg)){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($Hc){echo"<div id='$Ic' class='hidden'>\n";select($Hc,$i,$Ff);echo"</div>\n";}}$Gh=microtime(true);}while($h->next_result());}$F=substr($F,$C);$C=0;}}}}if($vc)echo"<p class='message'>".lang(152)."\n";elseif($_POST["only_errors"]){echo"<p class='message'>".lang(153,$ub-count($_c))," <span class='time'>(".format_time($ti).")</span>\n";}elseif($_c&&$ub>1)echo"<p class='error'>".lang(148).": ".implode("",$_c)."\n";}else
|
|||
|
echo"<p class='error'>".upload_error($F)."\n";}echo'
|
|||
|
<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';$Ec="<input type='submit' value='".lang(154)."' title='Ctrl+Enter'>";if(!isset($_GET["import"])){$xg=$_GET["sql"];if($_POST)$xg=$_POST["query"];elseif($_GET["history"]=="all")$xg=$_d;elseif($_GET["history"]!="")$xg=$_d[$_GET["history"]][0];echo"<p>";textarea("query",$xg,20);echo
|
|||
|
script(($_POST?"":"qs('textarea').focus();\n")."qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '".remove_from_uri("sql|limit|error_stops|only_errors")."');"),"<p>$Ec\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>";$td=(extension_loaded("zlib")?"[.gz]":"");echo(ini_bool("file_uploads")?"SQL$td (< ".ini_get("upload_max_filesize")."B): <input type='file' name='sql_file[]' multiple>\n$Ec":lang(157)),"</div></fieldset>\n";$Id=$b->importServerPath();if($Id){echo"<fieldset><legend>".lang(158)."</legend><div>",lang(159,"<code>".h($Id)."$td</code>"),' <input type="submit" name="webfile" value="'.lang(160).'">',"</div></fieldset>\n";}echo"<p>";}echo
|
|||
|
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='$ri'>\n";if(!isset($_GET["import"])&&$_d){print_fieldset("history",lang(163),$_GET["history"]!="");for($X=end($_d);$X;$X=prev($_d)){$y=key($_d);list($xg,$hi,$qc)=$X;echo'<a href="'.h(ME."sql=&history=$y").'">'.lang(10)."</a>"." <span class='time' title='".@date('Y-m-d',$hi)."'>".@date("H:i:s",$hi)."</span>"." <code class='jush-$x'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$xg)))),80,"</code>").($qc?" <span class='time'>($qc)</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>
|
|||
|
';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$p=fields($a);$Z=(isset($_GET["select"])?($_POST["check"]&&count($_POST["check"])==1?where_check($_POST["check"][0],$p):""):where($_GET,$p));$Mi=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($p
|
|||
|
as$B=>$o){if(!isset($o["privileges"][$Mi?"update":"insert"])||$b->fieldName($o)==""||$o["generated"])unset($p[$B]);}if($_POST&&!$n&&!isset($_GET["select"])){$_e=$_POST["referer"];if($_POST["insert"])$_e=($Mi?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$_e))$_e=ME."select=".urlencode($a);$w=indexes($a);$Hi=unique_array($_GET["where"],$w);$_g="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($_e,lang(166),$m->delete($a,$_g,!$Hi));else{$N=array();foreach($p
|
|||
|
as$B=>$o){$X=process_input($o);if($X!==false&&$X!==null)$N[idf_escape($B)]=$X;}if($Mi){if(!$N)redirect($_e);queries_redirect($_e,lang(167),$m->update($a,$N,$_g,!$Hi));if(is_ajax()){page_headers();page_messages($n);exit;}}else{$G=$m->insert($a,$N);$re=($G?last_id():0);queries_redirect($_e,lang(168,($re?" $re":"")),$G);}}}$I=null;if($_POST["save"])$I=(array)$_POST["fields"];elseif($Z){$K=array();foreach($p
|
|||
|
as$B=>$o){if(isset($o["privileges"]["select"])){$Ha=convert_field($o);if($_POST["clone"]&&$o["auto_increment"])$Ha="''";if($x=="sql"&&preg_match("~enum|set~",$o["type"]))$Ha="1*".idf_escape($B);$K[]=($Ha?"$Ha AS ":"").idf_escape($B);}}$I=array();if(!support("table"))$K=array("*");if($K){$G=$m->select($a,$K,array($Z),$K,array(),(isset($_GET["select"])?2:1));if(!$G)$n=error();else{$I=$G->fetch_assoc();if(!$I)$I=false;}if(isset($_GET["select"])&&(!$I||$G->fetch_assoc()))$I=null;}}if(!support("table")&&!$p){if(!$Z){$G=$m->select($a,array("*"),$Z,array("*"));$I=($G?$G->fetch_assoc():false);if(!$I)$I=array($m->primary=>"");}if($I){foreach($I
|
|||
|
as$y=>$X){if(!$Z)$I[$y]=null;$p[$y]=array("field"=>$y,"null"=>($y!=$m->primary),"auto_increment"=>($y==$m->primary));}}}edit_form($a,$p,$I,$Mi);}elseif(isset($_GET["create"])){$a=$_GET["create"];$Vf=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$y)$Vf[$y]=$y;$Hg=referencable_primary($a);$gd=array();foreach($Hg
|
|||
|
as$Sh=>$o)$gd[str_replace("`","``",$Sh)."`".str_replace("`","``",$o["field"])]=$Sh;$If=array();$R=array();if($a!=""){$If=fields($a);$R=table_status($a);if(!$R)$n=lang(9);}$I=$_POST;$I["fields"]=(array)$I["fields"];if($I["auto_increment_col"])$I["fields"][$I["auto_increment_col"]]["auto_increment"]=true;if($_POST)set_adminer_settings(array("comments"=>$_POST["comments"],"defaults"=>$_POST["defaults"]));if($_POST&&!process_fields($I["fields"])&&!$n){if($_POST["drop"])queries_redirect(substr(ME,0,-1),lang(169),drop_tables(array($a)));else{$p=array();$Ea=array();$Ri=false;$ed=array();$Hf=reset($If);$Ba=" FIRST";foreach($I["fields"]as$y=>$o){$q=$gd[$o["type"]];$Di=($q!==null?$Hg[$q]:$o);if($o["field"]!=""){if(!$o["has_default"])$o["default"]=null;if($y==$I["auto_increment_col"])$o["auto_increment"]=true;$ug=process_field($o,$Di);$Ea[]=array($o["orig"],$ug,$Ba);if($ug!=process_field($Hf,$Hf)){$p[]=array($o["orig"],$ug,$Ba);if($o["orig"]!=""||$Ba)$Ri=true;}if($q!==null)$ed[idf_escape($o["field"])]=($a!=""&&$x!="sqlite"?"ADD":" ").format_foreign_key(array('table'=>$gd[$o["type"]],'source'=>array($o["field"]),'target'=>array($Di["field"]),'on_delete'=>$o["on_delete"],));$Ba=" AFTER ".idf_escape($o["field"]);}elseif($o["orig"]!=""){$Ri=true;$p[]=array($o["orig"]);}if($o["orig"]!=""){$Hf=next($If);if(!$Hf)$Ba="";}}$Xf="";if($Vf[$I["partition_by"]]){$Yf=array();if($I["partition_by"]=='RANGE'||$I["partition_by"]=='LIST'){foreach(array_filter($I["partition_names"])as$y=>$X){$Y=$I["partition_values"][$y];$Yf[]="\n PARTITION ".idf_escape($X)." VALUES ".($I["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Xf.="\nPARTITION BY $I[partition_by]($I[partition])".($Yf?" (".implode(",",$Yf)."\n)":($I["partitions"]?" PARTITIONS ".(+$I["partitions"]):""));}elseif(support("partitioning")&&preg_match("~partitioned~",$R["Create_options"]))$Xf.="\nREMOVE PARTITIONING";$Oe=lang(170);if($a==""){cookie("adminer_engine",$I["Engine"]);$Oe=lang(171);}$B=trim($I["name"]);queries_redirect(ME.(support("table")?"table=":"select=").urlencode($B),$Oe,alter_table($a,$B,($x=="sqlite"&&($Ri||$ed)?$Ea:$p),$ed,($I["Comment"]!=$R["Comment"]?$I["Comment"]:null),($I["Engine"]&&$I["Engine"]!=$R["Engine"]?$I["Engine"]:""),($I["Collation"]&&$I["Collation"]!=$R["Collation"]?$I["Collation"]:""),($I["Auto_increment"]!=""?number($I["Auto_increment"]):""),$Xf));}}page_header(($a!=""?lang(45):lang(75)),$n,array("table"=>$a),h($a));if(!$_POST){$I=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!=""){$I=$R;$I["name"]=$a;$I["fields"]=array();if(!$_GET["auto_increment"])$I["Auto_increment"]="";foreach($If
|
|||
|
as$o){$o["has_default"]=isset($o["default"]);$I["fields"][]=$o;}if(support("partitioning")){$ld="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$G=$h->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $ld ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($I["partition_by"],$I["partitions"],$I["partition"])=$G->fetch_row();$Yf=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $ld AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$Yf[""]="";$I["partition_names"]=array_keys($Yf);$I["partition_values"]=array_values($Yf);}}}$qb=collations();$xc=engines();foreach($xc
|
|||
|
as$wc){if(!strcasecmp($wc,$I["Engine"])){$I["Engine"]=$wc;break;}}echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>
|
|||
|
';if(support("columns")||$a==""){echo
|
|||
|
lang(172),': <input name="name" data-maxlength="64" value="',h($I["name"]),'" autocapitalize="off">
|
|||
|
';if($a==""&&!$_POST)echo
|
|||
|
script("focus(qs('#form')['name']);");echo($xc?"<select name='Engine'>".optionlist(array(""=>"(".lang(173).")")+$xc,$I["Engine"])."</select>".on_help("getTarget(event).value",1).script("qsl('select').onchange = helpClose;"):""),' ',($qb&&!preg_match("~sqlite|mssql~",$x)?html_select("Collation",array(""=>"(".lang(101).")")+$qb,$I["Collation"]):""),' <input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if(support("columns")){echo'<div class="scrollable">
|
|||
|
<table cellspacing="0" id="edit-fields" class="nowrap">
|
|||
|
';edit_fields($I["fields"],$qb,"TABLE",$gd);echo'</table>
|
|||
|
</div>
|
|||
|
<p>
|
|||
|
',lang(52),': <input type="number" name="Auto_increment" size="6" value="',h($I["Auto_increment"]),'">
|
|||
|
',checkbox("defaults",1,($_POST?$_POST["defaults"]:adminer_setting("defaults")),lang(174),"columnShow(this.checked, 5)","jsonly"),(support("comment")?checkbox("comments",1,($_POST?$_POST["comments"]:adminer_setting("comments")),lang(51),"editingCommentsClick(this, true);","jsonly").' <input name="Comment" value="'.h($I["Comment"]).'" data-maxlength="'.(min_version(5.5)?2048:60).'">':''),'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$a));}if(support("partitioning")){$Wf=preg_match('~RANGE|LIST~',$I["partition_by"]);print_fieldset("partition",lang(176),$I["partition_by"]);echo'<p>
|
|||
|
',"<select name='partition_by'>".optionlist(array(""=>"")+$Vf,$I["partition_by"])."</select>".on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')",1).script("qsl('select').onchange = partitionByChange;"),'(<input name="partition" value="',h($I["partition"]),'">)
|
|||
|
',lang(177),': <input type="number" name="partitions" class="size',($Wf||!$I["partition_by"]?" hidden":""),'" value="',h($I["partitions"]),'">
|
|||
|
<table cellspacing="0" id="partition-table"',($Wf?"":" class='hidden'"),'>
|
|||
|
<thead><tr><th>',lang(178),'<th>',lang(179),'</thead>
|
|||
|
';foreach($I["partition_names"]as$y=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'" autocapitalize="off">',($y==count($I["partition_names"])-1?script("qsl('input').oninput = partitionNameChange;"):''),'<td><input name="partition_values[]" value="'.h($I["partition_values"][$y]).'">';}echo'</table>
|
|||
|
</div></fieldset>
|
|||
|
';}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
',script("qs('#form')['defaults'].onclick();".(support("comment")?" editingCommentsClick(qs('#form')['comments']);":""));}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Ld=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"]))$Ld[]="FULLTEXT";if(preg_match('~MyISAM|M?aria'.(min_version(5.7,'10.2.2')?'|InnoDB':'').'~i',$R["Engine"]))$Ld[]="SPATIAL";$w=indexes($a);$ng=array();if($x=="mongo"){$ng=$w["_id_"];unset($Ld[0]);unset($w["_id_"]);}$I=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($I["indexes"]as$v){$B=$v["name"];if(in_array($v["type"],$Ld)){$f=array();$xe=array();$ac=array();$N=array();ksort($v["columns"]);foreach($v["columns"]as$y=>$e){if($e!=""){$we=$v["lengths"][$y];$Zb=$v["descs"][$y];$N[]=idf_escape($e).($we?"(".(+$we).")":"").($Zb?" DESC":"");$f[]=$e;$xe[]=($we?$we:null);$ac[]=$Zb;}}if($f){$Fc=$w[$B];if($Fc){ksort($Fc["columns"]);ksort($Fc["lengths"]);ksort($Fc["descs"]);if($v["type"]==$Fc["type"]&&array_values($Fc["columns"])===$f&&(!$Fc["lengths"]||array_values($Fc["lengths"])===$xe)&&array_values($Fc["descs"])===$ac){unset($w[$B]);continue;}}$c[]=array($v["type"],$B,$N);}}}foreach($w
|
|||
|
as$B=>$Fc)$c[]=array($Fc["type"],$B,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(180),alter_indexes($a,$c));}page_header(lang(132),$n,array("table"=>$a),h($a));$p=array_keys(fields($a));if($_POST["add"]){foreach($I["indexes"]as$y=>$v){if($v["columns"][count($v["columns"])]!="")$I["indexes"][$y]["columns"][]="";}$v=end($I["indexes"]);if($v["type"]||array_filter($v["columns"],'strlen'))$I["indexes"][]=array("columns"=>array(1=>""));}if(!$I){foreach($w
|
|||
|
as$y=>$v){$w[$y]["name"]=$y;$w[$y]["columns"][]="";}$w[]=array("columns"=>array(1=>""));$I["indexes"]=$w;}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<div class="scrollable">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
<thead><tr>
|
|||
|
<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.5")."' alt='+' title='".lang(108)."'>",'</noscript>
|
|||
|
</thead>
|
|||
|
';if($ng){echo"<tr><td>PRIMARY<td>";foreach($ng["columns"]as$y=>$e){echo
|
|||
|
select_input(" disabled",$p,$e),"<label><input disabled type='checkbox'>".lang(60)."</label> ";}echo"<td><td>\n";}$ee=1;foreach($I["indexes"]as$v){if(!$_POST["drop_col"]||$ee!=key($_POST["drop_col"])){echo"<tr><td>".html_select("indexes[$ee][type]",array(-1=>"")+$Ld,$v["type"],($ee==count($I["indexes"])?"indexesAddRow.call(this);":1),"label-type"),"<td>";ksort($v["columns"]);$s=1;foreach($v["columns"]as$y=>$e){echo"<span>".select_input(" name='indexes[$ee][columns][$s]' title='".lang(49)."'",($p?array_combine($p,$p):$p),$e,"partial(".($s==count($v["columns"])?"indexesAddColumn":"indexesChangeColumn").", '".js_escape($x=="sql"?"":$_GET["indexes"]."_")."')"),($x=="sql"||$x=="mssql"?"<input type='number' name='indexes[$ee][lengths][$s]' class='size' value='".h($v["lengths"][$y])."' title='".lang(106)."'>":""),(support("descidx")?checkbox("indexes[$ee][descs][$s]",1,$v["descs"][$y],lang(60)):"")," </span>";$s++;}echo"<td><input name='indexes[$ee][name]' value='".h($v["name"])."' autocapitalize='off' aria-labelledby='label-name'>\n","<td><input type='image' class='icon' name='drop_col[$ee]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.7.5")."' alt='x' title='".lang(111)."'>".script("qsl('input').onclick = partial(editingRemoveRow, 'indexes\$1[type]');");}$ee++;}echo'</table>
|
|||
|
</div>
|
|||
|
<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["database"])){$I=$_POST;if($_POST&&!$n&&!isset($_POST["add_x"])){$B=trim($I["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(184),drop_databases(array(DB)));}elseif(DB!==$B){if(DB!=""){$_GET["db"]=$B;queries_redirect(preg_replace('~\bdb=[^&]*&~','',ME)."db=".urlencode($B),lang(185),rename_database($B,$I["collation"]));}else{$k=explode("\n",str_replace("\r","",$B));$Mh=true;$qe="";foreach($k
|
|||
|
as$l){if(count($k)==1||$l!=""){if(!create_database($l,$I["collation"]))$Mh=false;$qe=$l;}}restart_session();set_session("dbs",null);queries_redirect(ME."db=".urlencode($qe),lang(186),$Mh);}}else{if(!$I["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($B).(preg_match('~^[a-z0-9_]+$~i',$I["collation"])?" COLLATE $I[collation]":""),substr(ME,0,-1),lang(187));}}page_header(DB!=""?lang(68):lang(115),$n,array(),h(DB));$qb=collations();$B=DB;if($_POST)$B=$I["name"];elseif(DB!="")$I["collation"]=db_collation(DB,$qb);elseif($x=="sql"){foreach(get_vals("SHOW GRANTS")as$nd){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~',$nd,$A)&&$A[1]){$B=stripcslashes(idf_unescape("`$A[2]`"));break;}}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
',($_POST["add_x"]||strpos($B,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($B).'</textarea><br>':'<input name="name" id="name" value="'.h($B).'" data-maxlength="64" autocapitalize="off">')."\n".($qb?html_select("collation",array(""=>"(".lang(101).")")+$qb,$I["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),'">
|
|||
|
';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.5")."' alt='+' title='".lang(108)."'>\n";echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["scheme"])){$I=$_POST;if($_POST&&!$n){$_=preg_replace('~ns=[^&]*&~','',ME)."ns=";if($_POST["drop"])query_redirect("DROP SCHEMA ".idf_escape($_GET["ns"]),$_,lang(188));else{$B=trim($I["name"]);$_.=urlencode($B);if($_GET["ns"]=="")query_redirect("CREATE SCHEMA ".idf_escape($B),$_,lang(189));elseif($_GET["ns"]!=$B)query_redirect("ALTER SCHEMA ".idf_escape($_GET["ns"])." RENAME TO ".idf_escape($B),$_,lang(190));else
|
|||
|
redirect($_);}}page_header($_GET["ns"]!=""?lang(69):lang(70),$n);if(!$I)$I["name"]=$_GET["ns"];echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" id="name" value="',h($I["name"]),'" autocapitalize="off">
|
|||
|
',script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
|
|||
|
';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,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["call"])){$da=($_GET["name"]?$_GET["name"]:$_GET["call"]);page_header(lang(191).": ".h($da),$n);$Xg=routine($_GET["call"],(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Jd=array();$Mf=array();foreach($Xg["fields"]as$s=>$o){if(substr($o["inout"],-3)=="OUT")$Mf[$s]="@".idf_escape($o["field"])." AS ".idf_escape($o["field"]);if(!$o["inout"]||substr($o["inout"],0,2)=="IN")$Jd[]=$s;}if(!$n&&$_POST){$bb=array();foreach($Xg["fields"]as$y=>$o){if(in_array($y,$Jd)){$X=process_input($o);if($X===false)$X="''";if(isset($Mf[$y]))$h->query("SET @".idf_escape($o["field"])." = $X");}$bb[]=(isset($Mf[$y])?"@".idf_escape($o["field"]):$X);}$F=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$bb).")";$Gh=microtime(true);$G=$h->multi_query($F);$_a=$h->affected_rows;echo$b->selectQuery($F,$Gh,!$G);if(!$G)echo"<p class='error'>".error()."\n";else{$i=connect();if(is_object($i))$i->select_db(DB);do{$G=$h->store_result();if(is_object($G))select($G,$i);else
|
|||
|
echo"<p class='message'>".lang(192,$_a)."\n";}while($h->next_result());if($Mf)select($h->query("SELECT ".implode(", ",$Mf)));}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
';if($Jd){echo"<table cellspacing='0' class='layout'>\n";foreach($Jd
|
|||
|
as$y){$o=$Xg["fields"][$y];$B=$o["field"];echo"<tr><th>".$b->fieldName($o);$Y=$_POST["fields"][$B];if($Y!=""){if($o["type"]=="enum")$Y=+$Y;if($o["type"]=="set")$Y=array_sum($Y);}input($o,$Y,(string)$_POST["function"][$B]);echo"\n";}echo"</table>\n";}echo'<p>
|
|||
|
<input type="submit" value="',lang(191),'">
|
|||
|
<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$B=$_GET["name"];$I=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$Oe=($_POST["drop"]?lang(193):($B!=""?lang(194):lang(195)));$_e=ME."table=".urlencode($a);if(!$_POST["drop"]){$I["source"]=array_filter($I["source"],'strlen');ksort($I["source"]);$ai=array();foreach($I["source"]as$y=>$X)$ai[$y]=$I["target"][$y];$I["target"]=$ai;}if($x=="sqlite")queries_redirect($_e,$Oe,recreate_table($a,$a,array(),array(),array(" $B"=>($_POST["drop"]?"":" ".format_foreign_key($I)))));else{$c="ALTER TABLE ".table($a);$hc="\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($B);if($_POST["drop"])query_redirect($c.$hc,$_e,$Oe);else{query_redirect($c.($B!=""?"$hc,":"")."\nADD".format_foreign_key($I),$_e,$Oe);$n=lang(196)."<br>$n";}}}page_header(lang(197),$n,array("table"=>$a),h($a));if($_POST){ksort($I["source"]);if($_POST["add"])$I["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$I["target"]=array();}elseif($B!=""){$gd=foreign_keys($a);$I=$gd[$B];$I["source"][]="";}else{$I["table"]=$a;$I["source"]=array("");}echo'
|
|||
|
<form action="" method="post">
|
|||
|
';$zh=array_keys(fields($a));if($I["db"]!="")$h->select_db($I["db"]);if($I["ns"]!="")set_schema($I["ns"]);$Gg=array_keys(array_filter(table_status('',true),'fk_support'));$ai=($a===$I["table"]?$zh:array_keys(fields(in_array($I["table"],$Gg)?$I["table"]:reset($Gg))));$uf="this.form['change-js'].value = '1'; this.form.submit();";echo"<p>".lang(198).": ".html_select("table",$Gg,$I["table"],$uf)."\n";if($x=="pgsql")echo
|
|||
|
lang(78).": ".html_select("ns",$b->schemas(),$I["ns"]!=""?$I["ns"]:$_GET["ns"],$uf);elseif($x!="sqlite"){$Tb=array();foreach($b->databases()as$l){if(!information_schema($l))$Tb[]=$l;}echo
|
|||
|
lang(77).": ".html_select("db",$Tb,$I["db"]!=""?$I["db"]:$_GET["db"],$uf);}echo'<input type="hidden" name="change-js" value="">
|
|||
|
<noscript><p><input type="submit" name="change" value="',lang(199),'"></noscript>
|
|||
|
<table cellspacing="0">
|
|||
|
<thead><tr><th id="label-source">',lang(134),'<th id="label-target">',lang(135),'</thead>
|
|||
|
';$ee=0;foreach($I["source"]as$y=>$X){echo"<tr>","<td>".html_select("source[".(+$y)."]",array(-1=>"")+$zh,$X,($ee==count($I["source"])-1?"foreignAddRow.call(this);":1),"label-source"),"<td>".html_select("target[".(+$y)."]",$ai,$I["target"][$y],1,"label-target");$ee++;}echo'</table>
|
|||
|
<p>
|
|||
|
',lang(103),': ',html_select("on_delete",array(-1=>"")+explode("|",$tf),$I["on_delete"]),' ',lang(102),': ',html_select("on_update",array(-1=>"")+explode("|",$tf),$I["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>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<noscript><p><input type="submit" name="add" value="',lang(200),'"></noscript>
|
|||
|
';if($B!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$B));}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$I=$_POST;$Jf="VIEW";if($x=="pgsql"&&$a!=""){$O=table_status($a);$Jf=strtoupper($O["Engine"]);}if($_POST&&!$n){$B=trim($I["name"]);$Ha=" AS\n$I[select]";$_e=ME."table=".urlencode($B);$Oe=lang(201);$T=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$B&&$x!="sqlite"&&$T=="VIEW"&&$Jf=="VIEW")query_redirect(($x=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($B).$Ha,$_e,$Oe);else{$ci=$B."_adminer_".uniqid();drop_create("DROP $Jf ".table($a),"CREATE $T ".table($B).$Ha,"DROP $T ".table($B),"CREATE $T ".table($ci).$Ha,"DROP $T ".table($ci),($_POST["drop"]?substr(ME,0,-1):$_e),lang(202),$Oe,lang(203),$a,$B);}}if(!$_POST&&$a!=""){$I=view($a);$I["name"]=$a;$I["materialized"]=($Jf!="VIEW");if(!$n)$n=error();}page_header(($a!=""?lang(44):lang(204)),$n,array("table"=>$a),h($a));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>',lang(183),': <input name="name" value="',h($I["name"]),'" data-maxlength="64" autocapitalize="off">
|
|||
|
',(support("materializedview")?" ".checkbox("materialized",1,$I["materialized"],lang(129)):""),'<p>';textarea("select",$I["select"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$a));}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Wd=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");$I=$_POST;if($_POST&&!$n){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(205));elseif(in_array($I["INTERVAL_FIELD"],$Wd)&&isset($Ih[$I["STATUS"]])){$ch="\nON SCHEDULE ".($I["INTERVAL_VALUE"]?"EVERY ".q($I["INTERVAL_VALUE"])." $I[INTERVAL_FIELD]".($I["STARTS"]?" STARTS ".q($I["STARTS"]):"").($I["ENDS"]?" ENDS ".q($I["ENDS"]):""):"AT ".q($I["STARTS"]))." ON COMPLETION".($I["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(206):lang(207)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$ch.($aa!=$I["EVENT_NAME"]?"\nRENAME TO ".idf_escape($I["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($I["EVENT_NAME"]).$ch)."\n".$Ih[$I["STATUS"]]." COMMENT ".q($I["EVENT_COMMENT"]).rtrim(" DO\n$I[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(208).": ".h($aa):lang(209)),$n);if(!$I&&$aa!=""){$J=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$I=reset($J);}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="layout">
|
|||
|
<tr><th>',lang(183),'<td><input name="EVENT_NAME" value="',h($I["EVENT_NAME"]),'" data-maxlength="64" autocapitalize="off">
|
|||
|
<tr><th title="datetime">',lang(210),'<td><input name="STARTS" value="',h("$I[EXECUTE_AT]$I[STARTS]"),'">
|
|||
|
<tr><th title="datetime">',lang(211),'<td><input name="ENDS" value="',h($I["ENDS"]),'">
|
|||
|
<tr><th>',lang(212),'<td><input type="number" name="INTERVAL_VALUE" value="',h($I["INTERVAL_VALUE"]),'" class="size"> ',html_select("INTERVAL_FIELD",$Wd,$I["INTERVAL_FIELD"]),'<tr><th>',lang(118),'<td>',html_select("STATUS",$Ih,$I["STATUS"]),'<tr><th>',lang(51),'<td><input name="EVENT_COMMENT" value="',h($I["EVENT_COMMENT"]),'" data-maxlength="64">
|
|||
|
<tr><th><td>',checkbox("ON_COMPLETION","PRESERVE",$I["ON_COMPLETION"]=="PRESERVE",lang(213)),'</table>
|
|||
|
<p>';textarea("EVENT_DEFINITION",$I["EVENT_DEFINITION"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($aa!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$aa));}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["procedure"])){$da=($_GET["name"]?$_GET["name"]:$_GET["procedure"]);$Xg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$I=$_POST;$I["fields"]=(array)$I["fields"];if($_POST&&!process_fields($I["fields"])&&!$n){$Gf=routine($_GET["procedure"],$Xg);$ci="$I[name]_adminer_".uniqid();drop_create("DROP $Xg ".routine_id($da,$Gf),create_routine($Xg,$I),"DROP $Xg ".routine_id($I["name"],$I),create_routine($Xg,array("name"=>$ci)+$I),"DROP $Xg ".routine_id($ci,$I),substr(ME,0,-1),lang(214),lang(215),lang(216),$da,$I["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(217):lang(218)).": ".h($da):(isset($_GET["function"])?lang(219):lang(220))),$n);if(!$_POST&&$da!=""){$I=routine($_GET["procedure"],$Xg);$I["name"]=$da;}$qb=get_vals("SHOW CHARACTER SET");sort($qb);$Yg=routine_languages();echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>',lang(183),': <input name="name" value="',h($I["name"]),'" data-maxlength="64" autocapitalize="off">
|
|||
|
',($Yg?lang(19).": ".html_select("language",$Yg,$I["language"])."\n":""),'<input type="submit" value="',lang(14),'">
|
|||
|
<div class="scrollable">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
';edit_fields($I["fields"],$qb,$Xg);if(isset($_GET["function"])){echo"<tr><td>".lang(221);edit_type("returns",$I["returns"],$qb,array(),($x=="pgsql"?array("void","trigger"):array()));}echo'</table>
|
|||
|
</div>
|
|||
|
<p>';textarea("definition",$I["definition"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($da!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$da));}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["sequence"])){$fa=$_GET["sequence"];$I=$_POST;if($_POST&&!$n){$_=substr(ME,0,-1);$B=trim($I["name"]);if($_POST["drop"])query_redirect("DROP SEQUENCE ".idf_escape($fa),$_,lang(222));elseif($fa=="")query_redirect("CREATE SEQUENCE ".idf_escape($B),$_,lang(223));elseif($fa!=$B)query_redirect("ALTER SEQUENCE ".idf_escape($fa)." RENAME TO ".idf_escape($B),$_,lang(224));else
|
|||
|
redirect($_);}page_header($fa!=""?lang(225).": ".h($fa):lang(226),$n);if(!$I)$I["name"]=$fa;echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" value="',h($I["name"]),'" autocapitalize="off">
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($fa!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$fa))."\n";echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["type"])){$ga=$_GET["type"];$I=$_POST;if($_POST&&!$n){$_=substr(ME,0,-1);if($_POST["drop"])query_redirect("DROP TYPE ".idf_escape($ga),$_,lang(227));else
|
|||
|
query_redirect("CREATE TYPE ".idf_escape(trim($I["name"]))." $I[as]",$_,lang(228));}page_header($ga!=""?lang(229).": ".h($ga):lang(230),$n);if(!$I)$I["as"]="AS ";echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($ga!="")echo"<input type='submit' name='drop' value='".lang(127)."'>".confirm(lang(175,$ga))."\n";else{echo"<input name='name' value='".h($I['name'])."' autocapitalize='off'>\n";textarea("as",$I["as"]);echo"<p><input type='submit' value='".lang(14)."'>\n";}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$B=$_GET["name"];$Bi=trigger_options();$I=(array)trigger($B)+array("Trigger"=>$a."_bi");if($_POST){if(!$n&&in_array($_POST["Timing"],$Bi["Timing"])&&in_array($_POST["Event"],$Bi["Event"])&&in_array($_POST["Type"],$Bi["Type"])){$sf=" ON ".table($a);$hc="DROP TRIGGER ".idf_escape($B).($x=="pgsql"?$sf:"");$_e=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($hc,$_e,lang(231));else{if($B!="")queries($hc);queries_redirect($_e,($B!=""?lang(232):lang(233)),queries(create_trigger($sf,$_POST)));if($B!="")queries(create_trigger($sf,$I+array("Type"=>reset($Bi["Type"]))));}}$I=$_POST;}page_header(($B!=""?lang(234).": ".h($B):lang(235)),$n,array("table"=>$a));echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<table cellspacing="0" class="layout">
|
|||
|
<tr><th>',lang(236),'<td>',html_select("Timing",$Bi["Timing"],$I["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, '".js_escape($a)."', this.form);"),'<tr><th>',lang(237),'<td>',html_select("Event",$Bi["Event"],$I["Event"],"this.form['Timing'].onchange();"),(in_array("UPDATE OF",$Bi["Event"])?" <input name='Of' value='".h($I["Of"])."' class='hidden'>":""),'<tr><th>',lang(50),'<td>',html_select("Type",$Bi["Type"],$I["Type"]),'</table>
|
|||
|
<p>',lang(183),': <input name="Trigger" value="',h($I["Trigger"]),'" data-maxlength="64" autocapitalize="off">
|
|||
|
',script("qs('#form')['Timing'].onchange();"),'<p>';textarea("Statement",$I["Statement"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($B!=""){echo'<input type="submit" name="drop" value="',lang(127),'">',confirm(lang(175,$B));}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$sg=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$I){foreach(explode(",",($I["Privilege"]=="Grant option"?"":$I["Context"]))as$Cb)$sg[$Cb][$I["Privilege"]]=$I["Comment"];}$sg["Server Admin"]+=$sg["File access on server"];$sg["Databases"]["Create routine"]=$sg["Procedures"]["Create routine"];unset($sg["Procedures"]["Create routine"]);$sg["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$sg["Columns"][$X]=$sg["Tables"][$X];unset($sg["Server Admin"]["Usage"]);foreach($sg["Tables"]as$y=>$X)unset($sg["Databases"][$y]);$bf=array();if($_POST){foreach($_POST["objects"]as$y=>$X)$bf[$X]=(array)$bf[$X]+(array)$_POST["grants"][$y];}$od=array();$qf="";if(isset($_GET["host"])&&($G=$h->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($I=$G->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$I[0],$A)&&preg_match_all('~ *([^(,]*[^ ,(])( *\([^)]+\))?~',$A[1],$Ge,PREG_SET_ORDER)){foreach($Ge
|
|||
|
as$X){if($X[1]!="USAGE")$od["$A[2]$X[2]"][$X[1]]=true;if(preg_match('~ WITH GRANT OPTION~',$I[0]))$od["$A[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$I[0],$A))$qf=$A[1];}}if($_POST&&!$n){$rf=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $rf",ME."privileges=",lang(238));else{$df=q($_POST["user"])."@".q($_POST["host"]);$ag=$_POST["pass"];if($ag!=''&&!$_POST["hashed"]&&!min_version(8)){$ag=$h->result("SELECT PASSWORD(".q($ag).")");$n=!$ag;}$Ib=false;if(!$n){if($rf!=$df){$Ib=queries((min_version(5)?"CREATE USER":"GRANT USAGE ON *.* TO")." $df IDENTIFIED BY ".(min_version(8)?"":"PASSWORD ").q($ag));$n=!$Ib;}elseif($ag!=$qf)queries("SET PASSWORD FOR $df = ".q($ag));}if(!$n){$Ug=array();foreach($bf
|
|||
|
as$lf=>$nd){if(isset($_GET["grant"]))$nd=array_filter($nd);$nd=array_keys($nd);if(isset($_GET["grant"]))$Ug=array_diff(array_keys(array_filter($bf[$lf],'strlen')),$nd);elseif($rf==$df){$of=array_keys((array)$od[$lf]);$Ug=array_diff($of,$nd);$nd=array_diff($nd,$of);unset($od[$lf]);}if(preg_match('~^(.+)\s*(\(.*\))?$~U',$lf,$A)&&(!grant("REVOKE",$Ug,$A[2]," ON $A[1] FROM $df")||!grant("GRANT",$nd,$A[2]," ON $A[1] TO $df"))){$n=true;break;}}}if(!$n&&isset($_GET["host"])){if($rf!=$df)queries("DROP USER $rf");elseif(!isset($_GET["grant"])){foreach($od
|
|||
|
as$lf=>$Ug){if(preg_match('~^(.+)(\(.*\))?$~U',$lf,$A))grant("REVOKE",array_keys($Ug),$A[2]," ON $A[1] FROM $df");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(239):lang(240)),!$n);if($Ib)$h->query("DROP USER $df");}}page_header((isset($_GET["host"])?lang(36).": ".h("$ha@$_GET[host]"):lang(146)),$n,array("privileges"=>array('',lang(72))));if($_POST){$I=$_POST;$od=$bf;}else{$I=$_GET+array("host"=>$h->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$I["pass"]=$qf;if($qf!="")$I["hashed"]=true;$od[(DB==""||$od?"":idf_escape(addcslashes(DB,"%_\\"))).".*"]=array();}echo'<form action="" method="post">
|
|||
|
<table cellspacing="0" class="layout">
|
|||
|
<tr><th>',lang(35),'<td><input name="host" data-maxlength="60" value="',h($I["host"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(36),'<td><input name="user" data-maxlength="80" value="',h($I["user"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(37),'<td><input name="pass" id="pass" value="',h($I["pass"]),'" autocomplete="new-password">
|
|||
|
';if(!$I["hashed"])echo
|
|||
|
script("typePassword(qs('#pass'));");echo(min_version(8)?"":checkbox("hashed",1,$I["hashed"],lang(241),"typePassword(this.form['pass'], this.checked);")),'</table>
|
|||
|
|
|||
|
';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'>".lang(72).doc_link(array('sql'=>"grant.html#priv_level"));$s=0;foreach($od
|
|||
|
as$lf=>$nd){echo'<th>'.($lf!="*.*"?"<input name='objects[$s]' value='".h($lf)."' size='10' autocapitalize='off'>":"<input type='hidden' name='objects[$s]' value='*.*' size='10'>*.*");$s++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>lang(35),"Databases"=>lang(38),"Tables"=>lang(131),"Columns"=>lang(49),"Procedures"=>lang(242),)as$Cb=>$Zb){foreach((array)$sg[$Cb]as$rg=>$vb){echo"<tr".odd()."><td".($Zb?">$Zb<td":" colspan='2'").' lang="en" title="'.h($vb).'">'.h($rg);$s=0;foreach($od
|
|||
|
as$lf=>$nd){$B="'grants[$s][".h(strtoupper($rg))."]'";$Y=$nd[strtoupper($rg)];if($Cb=="Server Admin"&&$lf!=(isset($od["*.*"])?"*.*":".*"))echo"<td>";elseif(isset($_GET["grant"]))echo"<td><select name=$B><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=$B value='1'".($Y?" checked":"").($rg=="All privileges"?" id='grants-$s-all'>":">".($rg=="Grant option"?"":script("qsl('input').onclick = function () { if (this.checked) formUncheck('grants-$s-all'); };"))),"</label>";}$s++;}}}echo"</table>\n",'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';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,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$n){$le=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$le++;}queries_redirect(ME."processlist=",lang(245,$le),$le||!$_POST["kill"]);}page_header(lang(116),$n);echo'
|
|||
|
<form action="" method="post">
|
|||
|
<div class="scrollable">
|
|||
|
<table cellspacing="0" class="nowrap checkable">
|
|||
|
',script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");$s=-1;foreach(process_list()as$s=>$I){if(!$s){echo"<thead><tr lang='en'>".(support("kill")?"<th>":"");foreach($I
|
|||
|
as$y=>$X)echo"<th>$y".doc_link(array('sql'=>"show-processlist.html#processlist_".strtolower($y),'pgsql'=>"monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",'oracle'=>"REFRN30223",));echo"</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$I[$x=="sql"?"Id":"pid"],0):"");foreach($I
|
|||
|
as$y=>$X)echo"<td>".(($x=="sql"&&$y=="Info"&&preg_match("~Query|Killed~",$I["Command"])&&$X!="")||($x=="pgsql"&&$y=="current_query"&&$X!="<IDLE>")||($x=="oracle"&&$y=="sql_text"&&$X!="")?"<code class='jush-$x'>".shorten_utf8($X,100,"</code>").' <a href="'.h(ME.($I["db"]!=""?"db=".urlencode($I["db"])."&":"")."sql=".urlencode($X)).'">'.lang(246).'</a>':h($X));echo"\n";}echo'</table>
|
|||
|
</div>
|
|||
|
<p>
|
|||
|
';if(support("kill")){echo($s+1)."/".lang(247,max_connections()),"<p><input type='submit' value='".lang(248)."'>\n";}echo'<input type="hidden" name="token" value="',$ri,'">
|
|||
|
</form>
|
|||
|
',script("tableCheck();");}elseif(isset($_GET["select"])){$a=$_GET["select"];$R=table_status1($a);$w=indexes($a);$p=fields($a);$gd=column_foreign_keys($a);$nf=$R["Oid"];parse_str($_COOKIE["adminer_import"],$za);$Vg=array();$f=array();$gi=null;foreach($p
|
|||
|
as$y=>$o){$B=$b->fieldName($o);if(isset($o["privileges"]["select"])&&$B!=""){$f[$y]=html_entity_decode(strip_tags($B),ENT_QUOTES);if(is_shortable($o))$gi=$b->selectLengthProcess();}$Vg+=$o["privileges"];}list($K,$pd)=$b->selectColumnsProcess($f,$w);$ae=count($pd)<count($K);$Z=$b->selectSearchProcess($p,$w);$Cf=$b->selectOrderProcess($p,$w);$z=$b->selectLimitProcess();if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Ii=>$I){$Ha=convert_field($p[key($I)]);$K=array($Ha?$Ha:idf_escape(key($I)));$Z[]=where_check($Ii,$p);$H=$m->select($a,$K,$Z,$K);if($H)echo
|
|||
|
reset($H->fetch_row());}exit;}$ng=$Ki=null;foreach($w
|
|||
|
as$v){if($v["type"]=="PRIMARY"){$ng=array_flip($v["columns"]);$Ki=($K?$ng:array());foreach($Ki
|
|||
|
as$y=>$X){if(in_array(idf_escape($y),$K))unset($Ki[$y]);}break;}}if($nf&&!$ng){$ng=$Ki=array($nf=>0);$w[]=array("type"=>"PRIMARY","columns"=>array($nf));}if($_POST&&!$n){$mj=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$hb=array();foreach($_POST["check"]as$eb)$hb[]=where_check($eb,$p);$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,"");$ld=($K?implode(", ",$K):"*").convert_fields($f,$p,$K)."\nFROM ".table($a);$rd=($pd&&$ae?"\nGROUP BY ".implode(", ",$pd):"").($Cf?"\nORDER BY ".implode(", ",$Cf):"");if(!is_array($_POST["check"])||$ng)$F="SELECT $ld$mj$rd";else{$Gi=array();foreach($_POST["check"]as$X)$Gi[]="(SELECT".limit($ld,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$p).$rd,1).")";$F=implode(" UNION ALL ",$Gi);}$b->dumpData($a,"table",$F);exit;}if(!$b->selectEmailProcess($Z,$gd)){if($_POST["save"]||$_POST["delete"]){$G=true;$_a=0;$N=array();if(!$_POST["delete"]){foreach($f
|
|||
|
as$B=>$X){$X=process_input($p[$B]);if($X!==null&&($_POST["clone"]||$X!==false))$N[idf_escape($B)]=($X!==false?$X:idf_escape($B));}}if($_POST["delete"]||$N){if($_POST["clone"])$F="INTO ".table($a)." (".implode(", ",array_keys($N)).")\nSELECT ".implode(", ",$N)."\nFROM ".table($a);if($_POST["all"]||($ng&&is_array($_POST["check"]))||$ae){$G=($_POST["delete"]?$m->delete($a,$mj):($_POST["clone"]?queries("INSERT $F$mj"):$m->update($a,$N,$mj)));$_a=$h->affected_rows;}else{foreach((array)$_POST["check"]as$X){$ij="\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$p);$G=($_POST["delete"]?$m->delete($a,$ij,1):($_POST["clone"]?queries("INSERT".limit1($a,$F,$ij)):$m->update($a,$N,$ij,1)));if(!$G)break;$_a+=$h->affected_rows;}}}$Oe=lang(249,$_a);if($_POST["clone"]&&$G&&$_a==1){$re=last_id();if($re)$Oe=lang(168," $re");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$Oe,$G);if(!$_POST["delete"]){edit_form($a,$p,(array)$_POST["fields"],!$_POST["clone"]);page_footer();exit;}}elseif(!$_POST["import"]){if(!$_POST["val"])$n=lang(250);else{$G=true;$_a=0;foreach($_POST["val"]as$Ii=>$I){$N=array();foreach($I
|
|||
|
as$y=>$X){$y=bracket_escape($y,1);$N[idf_escape($y)]=(preg_match('~char|text~',$p[$y]["type"])||$X!=""?$b->processInput($p[$y],$X):"NULL");}$G=$m->update($a,$N," WHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($Ii,$p),!$ae&&!$ng," ");if(!$G)break;$_a+=$h->affected_rows;}queries_redirect(remove_from_uri(),lang(249,$_a),$G);}}elseif(!is_string($Vc=get_file("csv_file",true)))$n=upload_error($Vc);elseif(!preg_match('~~u',$Vc))$n=lang(251);else{cookie("adminer_import","output=".urlencode($za["output"])."&format=".urlencode($_POST["separator"]));$G=true;$sb=array_keys($p);preg_match_all('~(?>"[^"]*"|[^"\r\n]+)+~',$Vc,$Ge);$_a=count($Ge[0]);$m->begin();$L=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));$J=array();foreach($Ge[0]as$y=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$L]*)$L~",$X.$L,$He);if(!$y&&!array_diff($He[1],$sb)){$sb=$He[1];$_a--;}else{$N=array();foreach($He[1]as$s=>$ob)$N[idf_escape($sb[$s])]=($ob==""&&$p[$sb[$s]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$ob))));$J[]=$N;}}$G=(!$J||$m->insertUpdate($a,$J,$ng));if($G)$G=$m->commit();queries_redirect(remove_from_uri("page"),lang(252,$_a),$G);$m->rollback();}}}$Sh=$b->tableName($R);if(is_ajax()){page_headers();ob_start();}else
|
|||
|
page_header(lang(54).": $Sh",$n);$N=null;if(isset($Vg["insert"])||!support("table")){$N="";foreach((array)$_GET["where"]as$X){if($gd[$X["col"]]&&count($gd[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!preg_match('~[_%]~',$X["val"]))))$N.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($R,$N);if(!$f&&support("table"))echo"<p class='error'>".lang(253).($p?".":": ".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($K,$f);$b->selectSearchPrint($Z,$f,$w);$b->selectOrderPrint($Cf,$f,$w);$b->selectLimitPrint($z);$b->selectLengthPrint($gi);$b->selectActionPrint($w);echo"</form>\n";$D=$_GET["page"];if($D=="last"){$jd=$h->result(count_rows($a,$Z,$ae,$pd));$D=floor(max(0,$jd-1)/$z);}$hh=$K;$qd=$pd;if(!$hh){$hh[]="*";$Db=convert_fields($f,$p,$K);if($Db)$hh[]=substr($Db,2);}foreach($K
|
|||
|
as$y=>$X){$o=$p[idf_unescape($X)];if($o&&($Ha=convert_field($o)))$hh[$y]="$Ha AS $X";}if(!$ae&&$Ki){foreach($Ki
|
|||
|
as$y=>$X){$hh[]=idf_escape($y);if($qd)$qd[]=idf_escape($y);}}$G=$m->select($a,$hh,$Z,$qd,$Cf,$z,$D,true);if(!$G)echo"<p class='error'>".error()."\n";else{if($x=="mssql"&&$D)$G->seek($z*$D);$uc=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$J=array();while($I=$G->fetch_assoc()){if($D&&$x=="oracle")unset($I["RNUM"]);$J[]=$I;}if($_GET["page"]!="last"&&$z!=""&&$pd&&$ae&&$x=="sql")$jd=$h->result(" SELECT FOUND_ROWS()");if(!$J)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>".(!$pd&&$K?"":"<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>");$af=array();$md=array();reset($K);$Bg=1;foreach($J[0]as$y=>$X){if(!isset($Ki[$y])){$X=$_GET["columns"][key($K)];$o=$p[$K?($X?$X["col"]:current($K)):$y];$B=($o?$b->fieldName($o,$Bg):($X["fun"]?"*":$y));if($B!=""){$Bg++;$af[$y]=$B;$e=idf_escape($y);$Dd=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($y);$Zb="&desc%5B0%5D=1";echo"<th>".script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});",""),'<a href="'.h($Dd.($Cf[0]==$e||$Cf[0]==$y||(!$Cf&&$ae&&$pd[0]==$e)?$Zb:'')).'">';echo
|
|||
|
apply_sql_function($X["fun"],$B)."</a>";echo"<span class='column hidden'>","<a href='".h($Dd.$Zb)."' 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($y)."');");}echo"</span>";}$md[$y]=$X["fun"];next($K);}}$xe=array();if($_GET["modify"]){foreach($J
|
|||
|
as$I){foreach($I
|
|||
|
as$y=>$X)$xe[$y]=max($xe[$y],min(40,strlen(utf8_decode($X))));}}echo($Ra?"<th>".lang(255):"")."</thead>\n";if(is_ajax()){if($z%2==1&&$D%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($J,$gd)as$Ze=>$I){$Hi=unique_array($J[$Ze],$w);if(!$Hi){$Hi=array();foreach($J[$Ze]as$y=>$X){if(!preg_match('~^(COUNT\((\*|(DISTINCT )?`(?:[^`]|``)+`)\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\(`(?:[^`]|``)+`\))$~',$y))$Hi[$y]=$X;}}$Ii="";foreach($Hi
|
|||
|
as$y=>$X){if(($x=="sql"||$x=="pgsql")&&preg_match('~char|text|enum|set~',$p[$y]["type"])&&strlen($X)>64){$y=(strpos($y,'(')?$y:idf_escape($y));$y="MD5(".($x!='sql'||preg_match("~^utf8~",$p[$y]["collation"])?$y:"CONVERT($y USING ".charset($h).")").")";$X=md5($X);}$Ii.="&".($X!==null?urlencode("where[".bracket_escape($y)."]")."=".urlencode($X):"null%5B%5D=".urlencode($y));}echo"<tr".odd().">".(!$pd&&$K?"":"<td>".checkbox("check[]",substr($Ii,1),in_array(substr($Ii,1),(array)$_POST["check"])).($ae||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$Ii)."' class='edit'>".lang(256)."</a>"));foreach($I
|
|||
|
as$y=>$X){if(isset($af[$y])){$o=$p[$y];$X=$m->value($X,$o);if($X!=""&&(!isset($uc[$y])||$uc[$y]!=""))$uc[$y]=(is_mail($X)?$af[$y]:"");$_="";if(preg_match('~blob|bytea|raw|file~',$o["type"])&&$X!="")$_=ME.'download='.urlencode($a).'&field='.urlencode($y).$Ii;if(!$_&&$X!==null){foreach((array)$gd[$y]as$q){if(count($gd[$y])==1||end($q["source"])==$y){$_="";foreach($q["source"]as$s=>$zh)$_.=where_link($s,$q["target"][$s],$J[$Ze][$zh]);$_=($q["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\1'.urlencode($q["db"]),ME):ME).'select='.urlencode($q["table"]).$_;if($q["ns"])$_=preg_replace('~([?&]ns=)[^&]+~','\1'.urlencode($q["ns"]),$_);if(count($q["source"])==1)break;}}}if($y=="COUNT(*)"){$_=ME."select=".urlencode($a);$s=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$Hi))$_.=where_link($s++,$W["col"],$W["val"],$W["op"]);}foreach($Hi
|
|||
|
as$fe=>$W)$_.=where_link($s++,$fe,$W);}$X=select_value($X,$_,$o,$gi);$t=h("val[$Ii][".bracket_escape($y)."]");$Y=$_POST["val"][$Ii][bracket_escape($y)];$pc=!is_array($I[$y])&&is_utf8($X)&&$J[$Ze][$y]==$I[$y]&&!$md[$y];$fi=preg_match('~text|lob~',$o["type"]);echo"<td id='$t'";if(($_GET["modify"]&&$pc)||$Y!==null){$ud=h($Y!==null?$Y:$I[$y]);echo">".($fi?"<textarea name='$t' cols='30' rows='".(substr_count($I[$y],"\n")+1)."'>$ud</textarea>":"<input name='$t' value='$ud' size='$xe[$y]'>");}else{$Be=strpos($X,"<i>…</i>");echo" data-text='".($Be?2:($fi?1:0))."'".($pc?"":" data-warning='".h(lang(257))."'").">$X</td>";}}}if($Ra)echo"<td>";$b->backwardKeysPrint($Ra,$J[$Ze]);echo"</tr>\n";}if(is_ajax())exit;echo"</table>\n","</div>\n";}if(!is_ajax()){if($J||$D){$Dc=true;if($_GET["page"]!="last"){if($z==""||(count($J)<$z&&($J||!$D)))$jd=($D?$D*$z:0)+count($J);elseif($x!="sql"||!$ae){$jd=($ae?false:found_rows($R,$Z));if($jd<max(1e4,2*($D+1)*$z))$jd=reset(slow_query(count_rows($a,$Z,$ae,$pd)));else$Dc=false;}}$Pf=($z!=""&&($jd===false||$jd>$z||$D));if($Pf){echo(($jd===false?count($J)+1:$jd-$D*$z)>$z?'<p><a href="'.h(remove_from_uri("page")."&page=".($D+1)).'" class="loadmore">'.lang(258).'</a>'.script("qsl('a').onclick = partial(selectLoadMore, ".(+$z).", '".lang(259)."…');",""):''),"\n";}}echo"<div class='footer'><div>\n";if($J||$D){if($Pf){$Je=($jd===false?$D+(count($J)>=$z?2:1):floor(($jd-1)/$z));echo"<fieldset>";if($x!="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)."', '".($D+1)."')); return false; };"),pagination(0,$D).($D>5?" …":"");for($s=max(1,$D-4);$s<min($Je,$D+5);$s++)echo
|
|||
|
pagination($s,$D);if($Je>0){echo($D+5<$Je?" …":""),($Dc&&$jd!==false?pagination($Je,$D):" <a href='".h(remove_from_uri("page")."&page=last")."' title='~$Je'>".lang(261)."</a>");}}else{echo"<legend>".lang(260)."</legend>",pagination(0,$D).($D>1?" …":""),($D?pagination($D,$D):""),($Je>$D?pagination($D+1,$D).($Je>$D+1?" …":""):"");}echo"</fieldset>\n";}echo"<fieldset>","<legend>".lang(262)."</legend>";$ec=($Dc?"":"~ ").$jd;echo
|
|||
|
checkbox("all",1,0,($jd!==false?($Dc?"":"~ ").lang(150,$jd):""),"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$ec' : checked); selectCount('selected2', this.checked || !checked ? '$ec' : checked);")."\n","</fieldset>\n";if($b->selectCommandPrint()){echo'<fieldset',($_GET["modify"]?'':' class="jsonly"'),'><legend>',lang(254),'</legend><div>
|
|||
|
<input type="submit" value="',lang(14),'"',($_GET["modify"]?'':' title="'.lang(250).'"'),'>
|
|||
|
</div></fieldset>
|
|||
|
<fieldset><legend>',lang(126),' <span id="selected"></span></legend><div>
|
|||
|
<input type="submit" name="edit" value="',lang(10),'">
|
|||
|
<input type="submit" name="clone" value="',lang(246),'">
|
|||
|
<input type="submit" name="delete" value="',lang(18),'">',confirm(),'</div></fieldset>
|
|||
|
';}$hd=$b->dumpFormat();foreach((array)$_GET["columns"]as$e){if($e["fun"]){unset($hd['sql']);break;}}if($hd){print_fieldset("export",lang(74)." <span id='selected2'></span>");$Nf=$b->dumpOutput();echo($Nf?html_select("output",$Nf,$za["output"])." ":""),html_select("format",$hd,$za["format"])," <input type='submit' name='export' value='".lang(74)."'>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($uc,'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",(!$pd&&$K?"":script("tableCheck();"));}}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$O=isset($_GET["status"]);page_header($O?lang(118):lang(117));$Zi=($O?show_status():show_variables());if(!$Zi)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Zi
|
|||
|
as$y=>$X){echo"<tr>","<th><code class='jush-".$x.($O?"status":"set")."'>".h($y)."</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$B=>$R){json_row("Comment-$B",h($R["Comment"]));if(!is_view($R)){foreach(array("Engine","Collation")as$y)json_row("$y-$B",h($R[$y]));foreach($Ph+array("Auto_increment"=>0,"Rows"=>0)as$y=>$X){if($R[$y]!=""){$X=format_number($R[$y]);json_row("$y-$B",($y=="Rows"&&$X&&$R["Engine"]==($Bh=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Ph[$y]))$Ph[$y]+=($R["Engine"]!="InnoDB"||$y!="Data_free"?$R[$y]:0);}elseif(array_key_exists($y,$R))json_row("$y-$B");}}}foreach($Ph
|
|||
|
as$y=>$X)json_row("sum-$y",format_number($X));json_row("");}elseif($_GET["script"]=="kill")$h->query("KILL ".number($_POST["kill"]));else{foreach(count_tables($b->databases())as$l=>$X){json_row("tables-$l",$X);json_row("size-$l",db_size($l));}json_row("");}exit;}else{$Yh=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Yh&&!$n&&!$_POST["search"]){$G=true;$Oe="";if($x=="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"])$G=truncate_tables($_POST["tables"]);$Oe=lang(263);}elseif($_POST["move"]){$G=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Oe=lang(264);}elseif($_POST["copy"]){$G=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Oe=lang(265);}elseif($_POST["drop"]){if($_POST["views"])$G=drop_views($_POST["views"]);if($G&&$_POST["tables"])$G=drop_tables($_POST["tables"]);$Oe=lang(266);}elseif($x!="sql"){$G=($x=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Oe=lang(267);}elseif(!$_POST["tables"])$Oe=lang(9);elseif($G=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"])))){while($I=$G->fetch_assoc())$Oe.="<b>".h($I["Table"])."</b>: ".h($I["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$Oe,$G);}page_header(($_GET["ns"]==""?lang(38).": ".h(DB):lang(78).": ".h($_GET["ns"])),$n,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
|
|||
|
as$B=>$T){$cj=($T!==null&&!preg_match('~table~i',$T));$t=h("Table-".$B);echo'<tr'.odd().'><td>'.checkbox(($cj?"views[]":"tables[]"),$B,in_array($B,$Yh,true),"","","",$t),'<th>'.(support("table")||support("indexes")?"<a href='".h(ME)."table=".urlencode($B)."' title='".lang(43)."' id='$t'>".h($B).'</a>':h($B));if($cj){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($B).'" title="'.lang(44).'">'.(preg_match('~materialized~i',$T)?lang(129):lang(130)).'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($B).'" 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$y=>$_){$t=" id='$y-".h($B)."'";echo($_?"<td align='right'>".(support("table")||$y=="Rows"||(support("indexes")&&$y!="Data_length")?"<a href='".h(ME."$_[0]=").urlencode($B)."'$t title='$_[1]'>?</a>":"<span$t>?</span>"):"<td id='$y-".h($B)."'>");}$S++;}echo(support("comment")?"<td id='Comment-".h($B)."'>":"");}echo"<tr><td><th>".lang(247,count($Xh)),"<td>".h($x=="sql"?$h->result("SELECT @@storage_engine"):""),"<td>".h(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$y)echo"<td align='right' id='sum-$y'>";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'");$zf="<input type='submit' name='optimize' value='".lang(276)."'> ".on_help($x=="sql"?"'OPTIMIZE TABLE'":"'VACUUM OPTIMIZE'");echo"<fieldset><legend>".lang(126)." <span id='selected'></span></legend><div>".($x=="sqlite"?$Wi:($x=="pgsql"?$Wi.$zf:($x=="sql"?"<input type='submit' value='".lang(277)."'> ".on_help("'ANALYZE TABLE'").$zf."<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($x=="sqlite"?"'DELETE'":"'TRUNCATE".($x=="pgsql"?"'":" TABLE'")).confirm()."<input type='submit' name='drop' value='".lang(127)."'>".on_help("'DROP TABLE'").confirm()."\n";$k=(support("scheme")?$b->schemas():$b->databases());if(count($k)!=1&&$x!="sqlite"){$l=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".lang(281).": ",($k?html_select("target",$k,$l):'<input name="target" value="'.h($l).'" 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
|
|||
|
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='$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";$Zg=routines();if($Zg){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.lang(183).'<td>'.lang(50).'<td>'.lang(221)."<td></thead>\n";odd('');foreach($Zg
|
|||
|
as$I){$B=($I["SPECIFIC_NAME"]==$I["ROUTINE_NAME"]?"":"&name=".urlencode($I["ROUTINE_NAME"]));echo'<tr'.odd().'>','<th><a href="'.h(ME.($I["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($I["SPECIFIC_NAME"]).$B).'">'.h($I["ROUTINE_NAME"]).'</a>','<td>'.h($I["ROUTINE_TYPE"]),'<td>'.h($I["DTD_IDENTIFIER"]),'<td><a href="'.h(ME.($I["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($I["SPECIFIC_NAME"]).$B).'">'.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";$nh=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name");if($nh){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."</thead>\n";odd('');foreach($nh
|
|||
|
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";$Ui=types();if($Ui){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."</thead>\n";odd('');foreach($Ui
|
|||
|
as$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";$J=get_rows("SHOW EVENTS");if($J){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(183)."<td>".lang(286)."<td>".lang(210)."<td>".lang(211)."<td></thead>\n";foreach($J
|
|||
|
as$I){echo"<tr>","<th>".h($I["Name"]),"<td>".($I["Execute at"]?lang(287)."<td>".$I["Execute at"]:lang(212)." ".$I["Interval value"]." ".$I["Interval field"]."<td>$I[Starts]"),"<td>$I[Ends]",'<td><a href="'.h(ME).'event='.urlencode($I["Name"]).'">'.lang(136).'</a>';}echo"</table>\n";$Bc=$h->result("SELECT @@event_scheduler");if($Bc&&$Bc!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($Bc)."\n";}echo'<p class="links"><a href="'.h(ME).'event=">'.lang(209)."</a>\n";}if($Xh)echo
|
|||
|
script("ajaxSetHtml('".js_escape(ME)."script=db');");}}}page_footer();
|