1939 lines
457 KiB
PHP
1939 lines
457 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.6.3
|
|||
|
*/error_reporting(6135);$Wc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Wc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Di=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Di)$$X=$Di;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");function
|
|||
|
connection(){global$g;return$g;}function
|
|||
|
adminer(){global$b;return$b;}function
|
|||
|
version(){global$ia;return$ia;}function
|
|||
|
idf_unescape($u){$ne=substr($u,-1);return
|
|||
|
str_replace($ne.$ne,$ne,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($ng,$Wc=false){if(get_magic_quotes_gpc()){while(list($y,$X)=each($ng)){foreach($X
|
|||
|
as$ce=>$W){unset($ng[$y][$ce]);if(is_array($W)){$ng[$y][stripslashes($ce)]=$W;$ng[]=&$ng[$y][stripslashes($ce)];}else$ng[$y][stripslashes($ce)]=($Wc?$W:stripslashes($W));}}}}function
|
|||
|
bracket_escape($u,$Oa=false){static$oi=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return
|
|||
|
strtr($u,($Oa?array_flip($oi):$oi));}function
|
|||
|
min_version($Ui,$Ae="",$h=null){global$g;if(!$h)$h=$g;$ih=$h->server_info;if($Ae&&preg_match('~([\d.]+)-MariaDB~',$ih,$B)){$ih=$B[1];$Ui=$Ae;}return(version_compare($ih,$Ui)>=0);}function
|
|||
|
charset($g){return(min_version("5.5.3",0,$g)?"utf8mb4":"utf8");}function
|
|||
|
script($sh,$ni="\n"){return"<script".nonce().">$sh</script>$ni";}function
|
|||
|
script_src($Ii){return"<script src='".h($Ii)."'".nonce()."></script>\n";}function
|
|||
|
nonce(){return' nonce="'.get_nonce().'"';}function
|
|||
|
target_blank(){return' target="_blank" rel="noreferrer noopener"';}function
|
|||
|
h($Q){return
|
|||
|
str_replace("\0","�",htmlspecialchars($Q,ENT_QUOTES,'utf-8'));}function
|
|||
|
nl_br($Q){return
|
|||
|
str_replace("\n","<br>",$Q);}function
|
|||
|
checkbox($C,$Y,$fb,$je="",$pf="",$kb="",$ke=""){$I="<input type='checkbox' name='$C' value='".h($Y)."'".($fb?" checked":"").($ke?" aria-labelledby='$ke'":"").">".($pf?script("qsl('input').onclick = function () { $pf };",""):"");return($je!=""||$kb?"<label".($kb?" class='$kb'":"").">$I".h($je)."</label>":$I);}function
|
|||
|
optionlist($vf,$ch=null,$Mi=false){$I="";foreach($vf
|
|||
|
as$ce=>$W){$wf=array($ce=>$W);if(is_array($W)){$I.='<optgroup label="'.h($ce).'">';$wf=$W;}foreach($wf
|
|||
|
as$y=>$X)$I.='<option'.($Mi||is_string($y)?' value="'.h($y).'"':'').(($Mi||is_string($y)?(string)$y:$X)===$ch?' selected':'').'>'.h($X);if(is_array($W))$I.='</optgroup>';}return$I;}function
|
|||
|
html_select($C,$vf,$Y="",$of=true,$ke=""){if($of)return"<select name='".h($C)."'".($ke?" aria-labelledby='$ke'":"").">".optionlist($vf,$Y)."</select>".(is_string($of)?script("qsl('select').onchange = function () { $of };",""):"");$I="";foreach($vf
|
|||
|
as$y=>$X)$I.="<label><input type='radio' name='".h($C)."' value='".h($y)."'".($y==$Y?" checked":"").">".h($X)."</label>";return$I;}function
|
|||
|
select_input($Ka,$vf,$Y="",$of="",$Zf=""){$Sh=($vf?"select":"input");return"<$Sh$Ka".($vf?"><option value=''>$Zf".optionlist($vf,$Y,true)."</select>":" size='10' value='".h($Y)."' placeholder='$Zf'>").($of?script("qsl('$Sh').onchange = $of;",""):"");}function
|
|||
|
confirm($Ke="",$dh="qsl('input')"){return
|
|||
|
script("$dh.onclick = function () { return confirm('".($Ke?js_escape($Ke):lang(0))."'); };","");}function
|
|||
|
print_fieldset($t,$se,$Xi=false){echo"<fieldset><legend>","<a href='#fieldset-$t'>$se</a>",script("qsl('a').onclick = partial(toggle, 'fieldset-$t');",""),"</legend>","<div id='fieldset-$t'".($Xi?"":" class='hidden'").">\n";}function
|
|||
|
bold($Wa,$kb=""){return($Wa?" class='active $kb'":($kb?" class='$kb'":""));}function
|
|||
|
odd($I=' class="odd"'){static$s=0;if(!$I)$s=-1;return($s++%2?$I:'');}function
|
|||
|
js_escape($Q){return
|
|||
|
addcslashes($Q,"\r\n'\\/");}function
|
|||
|
json_row($y,$X=null){static$Xc=true;if($Xc)echo"{";if($y!=""){echo($Xc?"":",")."\n\t\"".addcslashes($y,"\r\n\t\"\\/").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\/").'"':'null');$Xc=false;}else{echo"\n}\n";$Xc=true;}}function
|
|||
|
ini_bool($Pd){$X=ini_get($Pd);return(preg_match('~^(on|true|yes)$~i',$X)||(int)$X);}function
|
|||
|
sid(){static$I;if($I===null)$I=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));return$I;}function
|
|||
|
set_password($Ti,$N,$V,$F){$_SESSION["pwds"][$Ti][$N][$V]=($_COOKIE["adminer_key"]&&is_string($F)?array(encrypt_string($F,$_COOKIE["adminer_key"])):$F);}function
|
|||
|
get_password(){$I=get_session("pwds");if(is_array($I))$I=($_COOKIE["adminer_key"]?decrypt_string($I[0],$_COOKIE["adminer_key"]):false);return$I;}function
|
|||
|
q($Q){global$g;return$g->quote($Q);}function
|
|||
|
get_vals($G,$d=0){global$g;$I=array();$H=$g->query($G);if(is_object($H)){while($J=$H->fetch_row())$I[]=$J[$d];}return$I;}function
|
|||
|
get_key_vals($G,$h=null,$lh=true){global$g;if(!is_object($h))$h=$g;$I=array();$H=$h->query($G);if(is_object($H)){while($J=$H->fetch_row()){if($lh)$I[$J[0]]=$J[1];else$I[]=$J[0];}}return$I;}function
|
|||
|
get_rows($G,$h=null,$n="<p class='error'>"){global$g;$yb=(is_object($h)?$h:$g);$I=array();$H=$yb->query($G);if(is_object($H)){while($J=$H->fetch_assoc())$I[]=$J;}elseif(!$H&&!is_object($h)&&$n&&defined("PAGE_HEADER"))echo$n.error()."\n";return$I;}function
|
|||
|
unique_array($J,$w){foreach($w
|
|||
|
as$v){if(preg_match("~PRIMARY|UNIQUE~",$v["type"])){$I=array();foreach($v["columns"]as$y){if(!isset($J[$y]))continue
|
|||
|
2;$I[$y]=$J[$y];}return$I;}}}function
|
|||
|
escape_key($y){if(preg_match('(^([\w(]+)('.str_replace("_",".*",preg_quote(idf_escape("_"))).')([ \w)]+)$)',$y,$B))return$B[1].idf_escape(idf_unescape($B[2])).$B[3];return
|
|||
|
idf_escape($y);}function
|
|||
|
where($Z,$p=array()){global$g,$x;$I=array();foreach((array)$Z["where"]as$y=>$X){$y=bracket_escape($y,1);$d=escape_key($y);$I[]=$d.($x=="sql"&&preg_match('~^[0-9]*\.[0-9]*$~',$X)?" LIKE ".q(addcslashes($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))$I[]="$d = ".q($X)." COLLATE ".charset($g)."_bin";}foreach((array)$Z["null"]as$y)$I[]=escape_key($y)." IS NULL";return
|
|||
|
implode(" AND ",$I);}function
|
|||
|
where_check($X,$p=array()){parse_str($X,$db);remove_slashes(array(&$db));return
|
|||
|
where($db,$p);}function
|
|||
|
where_link($s,$d,$Y,$rf="="){return"&where%5B$s%5D%5Bcol%5D=".urlencode($d)."&where%5B$s%5D%5Bop%5D=".urlencode(($Y!==null?$rf:"IS NULL"))."&where%5B$s%5D%5Bval%5D=".urlencode($Y);}function
|
|||
|
convert_fields($e,$p,$L=array()){$I="";foreach($e
|
|||
|
as$y=>$X){if($L&&!in_array(idf_escape($y),$L))continue;$Ha=convert_field($p[$y]);if($Ha)$I.=", $Ha AS ".idf_escape($y);}return$I;}function
|
|||
|
cookie($C,$Y,$ve=2592000){global$ba;return
|
|||
|
header("Set-Cookie: $C=".urlencode($Y).($ve?"; expires=".gmdate("D, d M Y H:i:s",time()+$ve)." 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($cd=false){if(!ini_bool("session.use_cookies")||($cd&&@ini_set("session.use_cookies",false)!==false))session_write_close();}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($Ti,$N,$V,$l=null){global$fc;preg_match('~([^?]*)\??(.*)~',remove_from_uri(implode("|",array_keys($fc))."|username|".($l!==null?"db|":"").session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($Ti!="server"||$N!=""?urlencode($Ti)."=".urlencode($N)."&":"")."username=".urlencode($V).($l!=""?"&db=".urlencode($l):"").($B[2]?"&$B[2]":"");}function
|
|||
|
is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
|
|||
|
redirect($A,$Ke=null){if($Ke!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($A!==null?$A:$_SERVER["REQUEST_URI"]))][]=$Ke;}if($A!==null){if($A=="")$A=".";header("Location: $A");exit;}}function
|
|||
|
query_redirect($G,$A,$Ke,$zg=true,$Dc=true,$Oc=false,$ai=""){global$g,$n,$b;if($Dc){$_h=microtime(true);$Oc=!$g->query($G);$ai=format_time($_h);}$vh="";if($G)$vh=$b->messageQuery($G,$ai,$Oc);if($Oc){$n=error().$vh.script("messagesPrint();");return
|
|||
|
false;}if($zg)redirect($A,$Ke.$vh);return
|
|||
|
true;}function
|
|||
|
queries($G){global$g;static$sg=array();static$_h;if(!$_h)$_h=microtime(true);if($G===null)return
|
|||
|
array(implode("\n",$sg),format_time($_h));$sg[]=(preg_match('~;$~',$G)?"DELIMITER ;;\n$G;\nDELIMITER ":$G).";";return$g->query($G);}function
|
|||
|
apply_queries($G,$T,$_c='table'){foreach($T
|
|||
|
as$R){if(!queries("$G ".$_c($R)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
queries_redirect($A,$Ke,$zg){list($sg,$ai)=queries(null);return
|
|||
|
query_redirect($sg,$A,$Ke,$zg,false,!$zg,$ai);}function
|
|||
|
format_time($_h){return
|
|||
|
lang(1,max(0,microtime(true)-$_h));}function
|
|||
|
remove_from_uri($Kf=""){return
|
|||
|
substr(preg_replace("~(?<=[?&])($Kf".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
|
|||
|
pagination($E,$Kb){return" ".($E==$Kb?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E".($_GET["next"]?"&next=".urlencode($_GET["next"]):""):"")).'">'.($E+1)."</a>");}function
|
|||
|
get_file($y,$Sb=false){$Uc=$_FILES[$y];if(!$Uc)return
|
|||
|
null;foreach($Uc
|
|||
|
as$y=>$X)$Uc[$y]=(array)$X;$I='';foreach($Uc["error"]as$y=>$n){if($n)return$n;$C=$Uc["name"][$y];$ii=$Uc["tmp_name"][$y];$_b=file_get_contents($Sb&&preg_match('~\.gz$~',$C)?"compress.zlib://$ii":$ii);if($Sb){$_h=substr($_b,0,3);if(function_exists("iconv")&&preg_match("~^\xFE\xFF|^\xFF\xFE~",$_h,$Eg))$_b=iconv("utf-16","utf-8",$_b);elseif($_h=="\xEF\xBB\xBF")$_b=substr($_b,3);$I.=$_b."\n\n";}else$I.=$_b;}return$I;}function
|
|||
|
upload_error($n){$He=($n==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($n?lang(2).($He?" ".lang(3,$He):""):lang(4));}function
|
|||
|
repeat_pattern($Xf,$te){return
|
|||
|
str_repeat("$Xf{0,65535}",$te/65535)."$Xf{0,".($te%65535)."}";}function
|
|||
|
is_utf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\0-\x8\xB\xC\xE-\x1F]~',$X));}function
|
|||
|
shorten_utf8($Q,$te=80,$Gh=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{10FFFF}]",$te).")($)?)u",$Q,$B))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$te).")($)?)",$Q,$B);return
|
|||
|
h($B[1]).$Gh.(isset($B[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($ng,$Fd=array()){$I=false;while(list($y,$X)=each($ng)){if(!in_array($y,$Fd)){if(is_array($X)){foreach($X
|
|||
|
as$ce=>$W)$ng[$y."[$ce]"]=$W;}else{$I=true;echo'<input type="hidden" name="'.h($y).'" value="'.h($X).'">';}}}return$I;}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($R,$Pc=false){$I=table_status($R,$Pc);return($I?$I:array("Name"=>$R));}function
|
|||
|
column_foreign_keys($R){global$b;$I=array();foreach($b->foreignKeys($R)as$q){foreach($q["source"]as$X)$I[$X][]=$q;}return$I;}function
|
|||
|
enum_input($U,$Ka,$o,$Y,$uc=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$o["length"],$Ce);$I=($uc!==null?"<label><input type='$U'$Ka value='$uc'".((is_array($Y)?in_array($uc,$Y):$Y===0)?" checked":"")."><i>".lang(7)."</i></label>":"");foreach($Ce[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$fb=(is_int($Y)?$Y==$s+1:(is_array($Y)?in_array($s+1,$Y):$Y===$X));$I.=" <label><input type='$U'$Ka value='".($s+1)."'".($fb?' checked':'').'>'.h($b->editVal($X,$o)).'</label>';}return$I;}function
|
|||
|
input($o,$Y,$r){global$zi,$b,$x;$C=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";}$Ig=($x=="mssql"&&$o["auto_increment"]);if($Ig&&!$_POST["save"])$r=null;$ld=(isset($_GET["select"])||$Ig?array("orig"=>lang(8)):array())+$b->editFunctions($o);$Ka=" name='fields[$C]'";if($o["type"]=="enum")echo
|
|||
|
h($ld[""])."<td>".$b->editInput($_GET["edit"],$o,$Ka,$Y);else{$vd=(in_array($r,$ld)||isset($ld[$r]));echo(count($ld)>1?"<select name='function[$C]'>".optionlist($ld,$r===null||$vd?$r:"")."</select>".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).script("qsl('select').onchange = functionChange;",""):h(reset($ld))).'<td>';$Rd=$b->editInput($_GET["edit"],$o,$Ka,$Y);if($Rd!="")echo$Rd;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"],$Ce);foreach($Ce[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$fb=(is_int($Y)?($Y>>$s)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$C][$s]' value='".(1<<$s)."'".($fb?' 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-$C'>";elseif(($Yh=preg_match('~text|lob~',$o["type"]))||preg_match("~\n~",$Y)){if($Yh&&$x!="sqlite")$Ka.=" cols='50' rows='12'";else{$K=min(12,substr_count($Y,"\n")+1);$Ka.=" cols='30' rows='$K'".($K==1?" style='height: 1.2em;'":"");}echo"<textarea$Ka>".h($Y).'</textarea>';}elseif($r=="json"||preg_match('~^jsonb?$~',$o["type"]))echo"<textarea$Ka cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$Je=(!preg_match('~int~',$o["type"])&&preg_match('~^(\d+)(,(\d+))?$~',$o["length"],$B)?((preg_match("~binary~",$o["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$o["unsigned"]?1:0)):($zi[$o["type"]]?$zi[$o["type"]]+($o["unsigned"]?0:1):0));if($x=='sql'&&min_version(5.6)&&preg_match('~time~',$o["type"]))$Je+=7;echo"<input".((!$vd||$r==="")&&preg_match('~(?<!o)int(?!er)~',$o["type"])&&!preg_match('~\[\]~',$o["full_type"])?" type='number'":"")." value='".h($Y)."'".($Je?" data-maxlength='$Je'":"").(preg_match('~char|binary~',$o["type"])&&$Je>20?" size='40'":"")."$Ka>";}echo$b->editHint($_GET["edit"],$o,$Y);$Xc=0;foreach($ld
|
|||
|
as$y=>$X){if($y===""||!$X)break;$Xc++;}if($Xc)echo
|
|||
|
script("mixin(qsl('td'), {onchange: partial(skipOriginal, $Xc), 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($o["on_update"]=="CURRENT_TIMESTAMP"?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")){$Uc=get_file("fields-$u");if(!is_string($Uc))return
|
|||
|
false;return$m->quoteBinary($Uc);}return$b->processInput($o,$Y,$r);}function
|
|||
|
fields_from_edit(){global$m;$I=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){$C=bracket_escape($y,1);$I[$C]=array("field"=>$C,"privileges"=>array("insert"=>1,"update"=>1),"null"=>1,"auto_increment"=>($y==$m->primary),);}return$I;}function
|
|||
|
search_tables(){global$b,$g;$_GET["where"][0]["val"]=$_POST["query"];$fh="<ul>\n";foreach(table_status('',true)as$R=>$S){$C=$b->tableName($S);if(isset($S["Engine"])&&$C!=""&&(!$_POST["tables"]||in_array($R,$_POST["tables"]))){$H=$g->query("SELECT".limit("1 FROM ".table($R)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($R),array())),1));if(!$H||$H->fetch_row()){$jg="<a href='".h(ME."select=".urlencode($R)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$C</a>";echo"$fh<li>".($H?$jg:"<p class='error'>$jg: ".error())."\n";$fh="";}}}echo($fh?"<p class='message'>".lang(9):"</ul>")."\n";}function
|
|||
|
dump_headers($Dd,$Te=false){global$b;$I=$b->dumpHeaders($Dd,$Te);$Hf=$_POST["output"];if($Hf!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($Dd).".$I".($Hf!="file"&&!preg_match('~[^0-9a-z]~',$Hf)?".$Hf":""));session_write_close();ob_flush();flush();return$I;}function
|
|||
|
dump_csv($J){foreach($J
|
|||
|
as$y=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X==="")$J[$y]='"'.str_replace('"','""',$X).'"';}echo
|
|||
|
implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$J)."\r\n";}function
|
|||
|
apply_sql_function($r,$d){return($r?($r=="unixepoch"?"DATETIME($d, '$r')":($r=="count distinct"?"COUNT(DISTINCT ":strtoupper("$r("))."$d)"):$d);}function
|
|||
|
get_temp_dir(){$I=ini_get("upload_tmp_dir");if(!$I){if(function_exists('sys_get_temp_dir'))$I=sys_get_temp_dir();else{$Vc=@tempnam("","");if(!$Vc)return
|
|||
|
false;$I=dirname($Vc);unlink($Vc);}}return$I;}function
|
|||
|
file_open_lock($Vc){$jd=@fopen($Vc,"r+");if(!$jd){$jd=@fopen($Vc,"w");if(!$jd)return;chmod($Vc,0660);}flock($jd,LOCK_EX);return$jd;}function
|
|||
|
file_write_unlock($jd,$Mb){rewind($jd);fwrite($jd,$Mb);ftruncate($jd,strlen($Mb));flock($jd,LOCK_UN);fclose($jd);}function
|
|||
|
password_file($i){$Vc=get_temp_dir()."/adminer.key";$I=@file_get_contents($Vc);if($I||!$i)return$I;$jd=@fopen($Vc,"w");if($jd){chmod($Vc,0660);$I=rand_string();fwrite($jd,$I);fclose($jd);}return$I;}function
|
|||
|
rand_string(){return
|
|||
|
md5(uniqid(mt_rand(),true));}function
|
|||
|
select_value($X,$_,$o,$Zh){global$b;if(is_array($X)){$I="";foreach($X
|
|||
|
as$ce=>$W)$I.="<tr>".($X!=array_values($X)?"<th>".h($ce):"")."<td>".select_value($W,$_,$o,$Zh);return"<table cellspacing='0'>$I</table>";}if(!$_)$_=$b->selectLink($X,$o);if($_===null){if(is_mail($X))$_="mailto:$X";if(is_url($X))$_=$X;}$I=$b->editVal($X,$o);if($I!==null){if(!is_utf8($I))$I="\0";elseif($Zh!=""&&is_shortable($o))$I=shorten_utf8($I,max(0,+$Zh));else$I=h($I);}return$b->selectVal($I,$_,$o,$X);}function
|
|||
|
is_mail($rc){$Ia='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$ec='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$Xf="$Ia+(\\.$Ia+)*@($ec?\\.)+$ec";return
|
|||
|
is_string($rc)&&preg_match("(^$Xf(,\\s*$Xf)*\$)i",$rc);}function
|
|||
|
is_url($Q){$ec='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return
|
|||
|
preg_match("~^(https?)://($ec?\\.)+$ec(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$Q);}function
|
|||
|
is_shortable($o){return
|
|||
|
preg_match('~char|text|json|lob|geometry|point|linestring|polygon|string|bytea~',$o["type"]);}function
|
|||
|
count_rows($R,$Z,$Xd,$od){global$x;$G=" FROM ".table($R).($Z?" WHERE ".implode(" AND ",$Z):"");return($Xd&&($x=="sql"||count($od)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$od).")$G":"SELECT COUNT(*)".($Xd?" FROM (SELECT 1$G GROUP BY ".implode(", ",$od).") x":$G));}function
|
|||
|
slow_query($G){global$b,$ki,$m;$l=$b->database();$bi=$b->queryTimeout();$ph=$m->slowQuery($G,$bi);if(!$ph&&support("kill")&&is_object($h=connect())&&($l==""||$h->select_db($l))){$he=$h->result(connection_id());echo'<script',nonce(),'>
|
|||
|
var timeout = setTimeout(function () {
|
|||
|
ajax(\'',js_escape(ME),'script=kill\', function () {
|
|||
|
}, \'kill=',$he,'&token=',$ki,'\');
|
|||
|
}, ',1000*$bi,');
|
|||
|
</script>
|
|||
|
';}else$h=null;ob_flush();flush();$I=@get_key_vals(($ph?$ph:$G),$h,false);if($h){echo
|
|||
|
script("clearTimeout(timeout);");ob_flush();flush();}return$I;}function
|
|||
|
get_token(){$vg=rand(1,1e6);return($vg^$_SESSION["token"]).":$vg";}function
|
|||
|
verify_token(){list($ki,$vg)=explode(":",$_POST["token"]);return($vg^$_SESSION["token"])==$ki;}function
|
|||
|
lzw_decompress($Sa){$ac=256;$Ta=8;$mb=array();$Kg=0;$Lg=0;for($s=0;$s<strlen($Sa);$s++){$Kg=($Kg<<8)+ord($Sa[$s]);$Lg+=8;if($Lg>=$Ta){$Lg-=$Ta;$mb[]=$Kg>>$Lg;$Kg&=(1<<$Lg)-1;$ac++;if($ac>>$Ta)$Ta++;}}$Zb=range("\0","\xFF");$I="";foreach($mb
|
|||
|
as$s=>$lb){$qc=$Zb[$lb];if(!isset($qc))$qc=$ij.$ij[0];$I.=$qc;if($s)$Zb[]=$ij.$qc[0];$ij=$qc;}return$I;}function
|
|||
|
on_help($tb,$mh=0){return
|
|||
|
script("mixin(qsl('select, input'), {onmouseover: function (event) { helpMouseover.call(this, event, $tb, $mh) }, onmouseout: helpMouseout});","");}function
|
|||
|
edit_form($a,$p,$J,$Gi){global$b,$x,$ki,$n;$Lh=$b->tableName(table_status1($a,true));page_header(($Gi?lang(10):lang(11)),$n,array("select"=>array($a,$Lh)),$Lh);if($J===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'>".script("qsl('table').onkeydown = editingKeydown;");foreach($p
|
|||
|
as$C=>$o){echo"<tr><th>".$b->fieldName($o);$Tb=$_GET["set"][bracket_escape($C)];if($Tb===null){$Tb=$o["default"];if($o["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$Tb,$Eg))$Tb=$Eg[1];}$Y=($J!==null?($J[$C]!=""&&$x=="sql"&&preg_match("~enum|set~",$o["type"])?(is_array($J[$C])?array_sum($J[$C]):+$J[$C]):$J[$C]):(!$Gi&&$o["auto_increment"]?"":(isset($_GET["select"])?false:$Tb)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$o);$r=($_POST["save"]?(string)$_POST["function"][$C]:($Gi&&$o["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$o["type"])&&$Y=="CURRENT_TIMESTAMP"){$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='".($Gi?lang(15):lang(16))."' title='Ctrl+Shift+Enter'>\n",($Gi?script("qsl('input').onclick = function () { return !ajaxForm(this.form, '".lang(17)."...', this); };"):"");}}echo($Gi?"<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="',$ki,'">
|
|||
|
</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><07><><EFBFBD>Fé<46>vt2<74><0E><>!<21>r0<72><30><EFBFBD><EFBFBD>t~<7E>U<1D>'3M<33><4D>W<EFBFBD>B<EFBFBD>'c<>P<EFBFBD>:6T\rc<EFBFBD>A<EFBFBD>zr_<>WK<57>\r-<2D>VNFS%~<7E>c<EFBFBD><63><EFBFBD>&<26>\\^<5E>r<EFBFBD><72><EFBFBD><EFBFBD>u<>ŎÞ<C58E>ً4'7k<37><6B><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD><51>h<16>'g\rFB\ryT7SS<53>P<EFBFBD>1=ǤcI<63><49>:<18>d<EFBFBD><64>m><3E>S8L<>J<EFBFBD><4A>t.M<><01><> ϋ`'C<><43><EFBFBD><EFBFBD>889<38><39> <11>Q<7F><51><EFBFBD><EFBFBD>2<EFBFBD>#8А<38><D090><EFBFBD><EFBFBD>6m<><6D><11><>j<1E><>h<EFBFBD><<3C><><EFBFBD><EFBFBD><EFBFBD>9/<2F><><EFBFBD>:<0E>J<EFBFBD>)ʂ<>\0d>!\0Z<18><0F>v<EFBFBD><76>n<EFBFBD><6E><EFBFBD><EFBFBD>o(<28><><EFBFBD><EFBFBD>k<EFBFBD>7<EFBFBD><37>s<EFBFBD><73>><3E><0B><>!<21>R\"*nS<6E>\0@P\"<03><><EFBFBD>(<28>#[<5B><><0F>@g<0C>o<EFBFBD><01><>zn<7A>9k<39>8<18>n<EFBFBD><6E><10>1<EFBFBD>I*<2A><>=<3D>n<EFBFBD><6E><EFBFBD><0E><><EFBFBD>0<EFBFBD>c(<28>;<3B>à<EFBFBD><C3A0>!<21><><EFBFBD>*c<><63>>Ύ<>E7D<37>LJ<4C><4A>1<EFBFBD><31><16><>`<60>8(<28><>3M<33><4D>\"<EFBFBD>39<EFBFBD>?E<0C>e=Ҭ<>~<7E><><EFBFBD><1B><1C><>Ӹ7;<3B>C<EFBFBD><05><><EFBFBD>E\rd!)<29>a*<2A>5ajo\0<EFBFBD>#`<60>38<33>\0<EFBFBD><EFBFBD>]<5D>e<EFBFBD><65><EFBFBD><EFBFBD>2<EFBFBD> mk<18><0E>e]<5D><><EFBFBD>AZs<5A>StZ<74>Z!)BR<42>G+<2B>#Jv2(<28><><EFBFBD><EFBFBD>c<>4<<3C>#sB<73>0<EFBFBD><30><EFBFBD>6YL\r<EFBFBD>=<3D><><EFBFBD>[<5B>73<37><33><<3C>:<3A><>bx<62><78>J= m_ <20><><EFBFBD>f<EFBFBD>l<><19>t<EFBFBD><74>I<EFBFBD><49>H<EFBFBD>3<EFBFBD>x*<2A><><EFBFBD>6`t6<74><36>%<25>U<>L<EFBFBD>eق<65><<05>\0<EFBFBD>AQ<P<:<3A>#u/<2F>:T\\><3E><>-<2D>xJ<78>͍QH\nj<>L+j<>z<EFBFBD><7A><EFBFBD>7<EFBFBD><37><EFBFBD>`<60><><EFBFBD><EFBFBD>\nk<EFBFBD><EFBFBD>'<27>N<EFBFBD>vX><3E>C-T˩<54><CBA9><EFBFBD><EFBFBD><EFBFBD>4*L<>%Cj>7ߨ<37>ި<03><><EFBFBD>`<60><><17>;y<><79><EFBFBD>q<EFBFBD>r<EFBFBD>3#<23><>} :#n<>\r<EFBFBD><EFBFBD>^<18>=C<>Aܸ<41>Ǝ<EFBFBD>s&8<><38>K&<26><>*0<><30>t<EFBFBD>S<EFBFBD><53><EFBFBD>=<3D>[<5B><>:<1D>\\]<5D>E<45>/O<>>^]<5D>ø<><<3C><><EFBFBD><EFBFBD>gZ<01>V<EFBFBD><56>q<10><><EFBFBD><EFBFBD><EFBFBD> <20><>x\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"J<EFBFBD>\\î<EFBFBD><EFBFBD>##<23><><EFBFBD>D<EFBFBD><44>x6<06><><EFBFBD>5x<19><><05><><EFBFBD><EFBFBD><EFBFBD>\rH<>l <20><><EFBFBD><EFBFBD>b<><62>r<EFBFBD>7<EFBFBD><37>6<EFBFBD><36><EFBFBD>j|<7C><><EFBFBD><04>ۖ*<2A>FAquvyO<79><4F>WeM<65><02><1A><>D.F<><46>:R<>\$-<2D><><1F><>T!<21>DS`<60>8D<38>~<7E><>A`(<28>em<65><6D><EFBFBD><EFBFBD><EFBFBD>T@O1@<40><>X<EFBFBD><58><EFBFBD>\nLp<4C><70><EFBFBD>P<EFBFBD><50><EFBFBD><EFBFBD><EFBFBD>m<EFBFBD>yf<><0B>) <01><><EFBFBD>GSEI<45><49><02>xC(s(a<>?\$`tE<10>n<EFBFBD><6E><EFBFBD><EFBFBD>,<2C><> \$a<><61>U>,<2C>В\$Z<EFBFBD>kDm,G\0<EFBFBD><19>\\<EFBFBD><EFBFBD>i<EFBFBD><15>%ʹ<11> n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><18><>g<EFBFBD><67><1B>b y`<60><>Ԇ<EFBFBD>W<EFBFBD><57> 䗗<>_C<5F><43>T\ni<04><>H%<25>da<08><>i<EFBFBD>7<EFBFBD>At<41>,<2C><>J<EFBFBD>X4n<34><6E><EFBFBD><EFBFBD>0o<6F>9g\nzm<EFBFBD>M%`<60>'I<><49><EFBFBD>О-<2D><><EFBFBD><01>7:p<>3p<><08>Q<EFBFBD>rED<45><44><EFBFBD><EFBFBD><1B><>b2]<5D>PF<50><46><EFBFBD><EFBFBD>>e<><65><EFBFBD>3j\n<EFBFBD>߰t!<21>?4f<34>tK;<3B><>\rΞи<EFBFBD>!<21>o<10>u<>?<3F><><EFBFBD>Ph<50><68><EFBFBD>0uIC}'~<7E><>2<EFBFBD>v<EFBFBD>Q<EFBFBD><51><EFBFBD>8)<29><><EFBFBD>7<EFBFBD>DI<44>=<3D><>y&<26><>ea<65>s*hɕjlA<>(<0F><>\"<EFBFBD>\\<EFBFBD><EFBFBD>m^i<><69>M)<29><>^<5E> |~<7E>l<EFBFBD><6C>#!Y<1A>f81RS<16><><EFBFBD><EFBFBD>!<21><><EFBFBD>62P<32>C<><43>l&<26><><11>xd!<01>|<7C><>9<EFBFBD>`<60>_OY<4F>=<3D><>G<06>[E<>-eL<65>CvT<76> )<29>@<12>j-5<><06><>pSg<14>.<2E>G=<3D><><EFBFBD>ZE<0E><>\$\0<EFBFBD>цKj<4B>U<EFBFBD><55>\$<EFBFBD><14><>G'I<>P<EFBFBD><50>~<06>ځ<> ;<3B><>hNێG%*<2A>Rj<52><6A>X[<5B>XPf^<5E><>|<13><>T!<21>*N<><4E>І<EFBFBD>\rU<EFBFBD><EFBFBD>^q1V!<21><>Uz,<2C>I|7<>7<EFBFBD>r,<2C><><EFBFBD>7<EFBFBD><37><EFBFBD>ľB<C4BE><42><EFBFBD>;<3B>+<2B><><EFBFBD>ߕ<0B>A<EFBFBD>p<EFBFBD><70><1A><>^<5E><1C><>~ؼW!3P<>I8]<5D><>v<EFBFBD>J<EFBFBD><4A>f<EFBFBD>q<EFBFBD>|,<2C><><EFBFBD>9W<39>f`\0<EFBFBD>q<EFBFBD>Z<EFBFBD>p}[Jdhy<18><>N<EFBFBD><4E>Y|<7C><>Cy,<2C><s A<01>{e<EFBFBD>Q<EFBFBD><13><05>hd<68><64><EFBFBD>LJ <20>B4;ks&<26><><EFBFBD><1C><><EFBFBD><EFBFBD>a<EFBFBD><61><EFBFBD><EFBFBD><EFBFBD><0F><>;˹}<7D>S<EFBFBD><53>J<7F><4A><EFBFBD>)<29>=d<><64>|<7C><><1E>Nd<4E><0C>I<05>*8<><38><EFBFBD>dl<64>ѓ<EFBFBD>E6~Ϩ<>F<EFBFBD><46><EFBFBD><1C>X`<60>M\rʞ/<2F>%B/V<04>I<EFBFBD>N&;<3B><><1A>0<EFBFBD>UC cT&.E+<2B><><EFBFBD><EFBFBD><0E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>@<40>0`;<3B><><EFBFBD>G<EFBFBD>5<EFBFBD><35><EFBFBD>ަj'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ɛ<>Y<1B>+<2B><>QZ-i<><69><11>yv<79><76>I<EFBFBD>5<EFBFBD><35>,O|<7C>P<EFBFBD>]Fۏ<46><DB8F><EFBFBD><EFBFBD><EFBFBD>\0<EFBFBD><EFBFBD><EFBFBD>2<EFBFBD>49͢<EFBFBD><EFBFBD><EFBFBD>n/χ]س&<26><>I^<05>=<02>l<EFBFBD><6C>qfI<66><49>= <20>]x1GR<47>&<>e<>7<EFBFBD><37>)<29><>'<27><>:B<>B<EFBFBD>>a<>z<EFBFBD>-<2D><><EFBFBD>2.<2E><><04><>bz<62><7A><EFBFBD>#<23><><EFBFBD><11><><EFBFBD>Uᓍ<55>L7-<2D>w<EFBFBD>t<EFBFBD>3ɵ<33><C9B5><EFBFBD>e<><65><EFBFBD>D<EFBFBD><08>\$<EFBFBD>#<23><><EFBFBD>j<16>@<40>G<>8<EFBFBD> <20>7p<37><70><1D>R<EFBFBD>YC<59><43>~<7E><>:<06>@<10><>EU<45>J<><1F>;67v]<5D>J'<27><17><15>q1ϳ<02>El<45>QІi<D086><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><>{k<<3C><>֡M<D6A1>po<70>}<7D><11>r<EFBFBD><72>q<16>؞<0C>c<EFBFBD>ä<EFBFBD>_m<5F>w<EFBFBD><77><1F>^<5E>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ln<6C><6E><1D> <09><>_<EFBFBD>~<7E>G<EFBFBD>n<EFBFBD><6E><1D><>{kܞ<6B>w<EFBFBD><77><EFBFBD>\rj~<7E>K<EFBFBD>\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><0E>-<2D><><EFBFBD><1E>B<04>;<3B><><EFBFBD><EFBFBD>b`}<7D>CC,<2C><><EFBFBD>-<2D><>L<EFBFBD><4C>8\r,<14><>kl<6B>nj<EFBFBD>n}-5<><35><EFBFBD><EFBFBD>3u<1A>gm<67><6D>Ÿ<EFBFBD>*<2A>/<2F><><0C><><EFBFBD><EFBFBD><EFBFBD>`<60>`<60>#x<>+B?#<23>ۏN;OR\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>k<><6B>ϙ\01\0k<EFBFBD>\0<EFBFBD>8<EFBFBD><EFBFBD>a<02><>/t<0F><><EFBFBD>#(&<26>l&<26><12><>p<EFBFBD><70>삅<EFBFBD><EC8285><EFBFBD>i<04>M<>{<EFBFBD>zp*<2A>-g<0F><><EFBFBD>v<EFBFBD><76>6<EFBFBD>k<EFBFBD> <09><04><><EFBFBD>d<EFBFBD>؋<EFBFBD><D88B><EFBFBD><08>A`6<>lX)+d <20><><EFBFBD>7 <20>\r<EFBFBD><EFBFBD> <20>ځcj6<6A><36>\rp<EFBFBD>\r<EFBFBD><EFBFBD>\r\"oP<6F>7<02>\r<EFBFBD><EFBFBD>\0<EFBFBD>\0<EFBFBD>y<EFBFBD><EFBFBD>P<><0F><>\rQ7<0B><><0E>Z<EFBFBD><5A>4Q<11><><0F>ڍp/<2F>y\r<EFBFBD><0F>##D<0E>;<0F><><EFBFBD><EFBFBD><<3C>g<EFBFBD>\0fi2<69>)f<08>\\ m<0C>Gh\r<EFBFBD>#<16>n<0E><><11><>@[ <20>G<EFBFBD>\"Sqm<11><>\r<EFBFBD><EFBFBD><18>#<18><>(Aj<><0B>qѣ%<25><><EFBFBD>̑3qE<18><>\0r<EFBFBD><EFBFBD><17><16><>0<><0E>я<1C><><EFBFBD><EFBFBD><EFBFBD>.<2E><>Q7шW<D188><57><16>u<11><1B><><EFBFBD><11> <11>@<40><>H<EFBFBD><48>q'vs<76>0<EFBFBD>\n<EFBFBD>+0<><30><EFBFBD><EFBFBD>SG<53>p<>O`<60>\r)c<>#<23><17><><0E><>R=\$<EFBFBD>ƐR\r<EFBFBD>Gы\$R?%2C<0C>[\0؍<10>~<7E>!<15>\\<08><>p<>#@<40><><EFBFBD>O(rg%<25>?ra\$<EFBFBD><EFBFBD>)r](<28><>&<26>?&<26>#&R<>',\rqV3<EFBFBD>\"H<EFBFBD>m+<2B><><1E>l<EFBFBD>Q\"\0<EFBFBD>4<><02>\$r<EFBFBD>,<2C><>=<3D><><EFBFBD><12>&2;.<2E>H@`<60><><EFBFBD><EFBFBD>a<EFBFBD><61><0B><>\$<EFBFBD>_*RIS&<26><>q<EFBFBD><71>_<EFBFBD>1<0C>1+1<><31><11><><0C><>3)2<>V7<12><0C>2l<32>ڄ!1g-<11>2f`<60><><EFBFBD>,Q<18>7<17><>0qg<0F>]!q<><19>m6<6D><36><EFBFBD><EFBFBD>_<1C>M7 <20><19><>7<EFBFBD>o6Q<36><0B><><0C>kp<>3<EFBFBD>g9<13><>s<EFBFBD> 3<>6<10>\r<EFBFBD>:S<>9ӏ;<13> <20>\r9<EFBFBD>-\0<EFBFBD>Yӧ0Q<EFBFBD><b#<Ӂ<1B>w/<2F>G<15><>>r<>\r<EFBFBD><EFBFBD>=3<><11>^&Q;ѣ?q<>0\"<EFBFBD>0HЙ<EFBFBD>|<7C><10><17>ʖS<CA96><53>i<EFBFBD><0E>@*<2A>T<EFBFBD>2<EFBFBD>T#<11><> <20>\0<EFBFBD>C<08><>07]?<3F><>&<26><><EFBFBD>E<0C><>D<EFBFBD>;:/<2F>3<>E<EFBFBD>5<><35>EQ<45>e<EFBFBD><18>T\"<EFBFBD>m<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD>E;<3B><><16>#=4<>8<EFBFBD><38>*<2A><><EFBFBD><EFBFBD><EFBFBD>LS<17>5Hr<48>JE TO\rԅJ<EFBFBD><EFBFBD>J<EFBFBD><EFBFBD>J<EFBFBD><EFBFBD><1A>eG)8B<38>8<EFBFBD>,&<26><>G<EFBFBD><03><><EFBFBD><EFBFBD> <09><><EFBFBD>+M<><4D><EFBFBD>ɲ<EFBFBD><C9B2>^*<2A><18><>G<><47>14<31>6<EFBFBD>\$.\"拢<EFBFBD>I4w!\$L <20>8b<38>A2<41>L<EFBFBD>'M?MF<4D>\$<14>,<2C><><EFBFBD><EFBFBD>Nr<0C><>/4<>BJ<>¨");}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><4F>er<65>x<EFBFBD>9<1E>*ź<><C5BA>n3<6E>\rщv<D189>C<EFBFBD><43>`<60><><EFBFBD>2G%<25>Y<EFBFBD><59><EFBFBD><05><>1<EFBFBD><31>f<EFBFBD><66><EFBFBD>Ȃl<C882><6C>1<EFBFBD>\ny<>*pC\r\$<EFBFBD>n<EFBFBD>T<EFBFBD><EFBFBD>3=\\<EFBFBD>r9O\"<EFBFBD> <09><>l<<3C>\r<EFBFBD>\\<EFBFBD><EFBFBD>I,<2C>s\nA<EFBFBD><EFBFBD>eh+M<><4D>!<21>q0<71><30>f<EFBFBD>`(<28>N{c<EFBFBD><EFBFBD>+w<><77><EFBFBD>Y<EFBFBD><59>p٧3<D9A7>3<EFBFBD><1A>+I<><49>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD>k<EFBFBD><6B>n<EFBFBD>q<EFBFBD><18><>zi#^r<><72><EFBFBD><1E><>3<EFBFBD><33><EFBFBD><EFBFBD>[<5B><><EFBFBD>o;<3B><>(<28><>6<>#<23>Ґ<EFBFBD><D290>\":cz>ߣC2v<32>CX<43><<3C>P<EFBFBD><0C>c*5\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F>P97<39>|F<><0F>c0<63><30><EFBFBD><EFBFBD><EFBFBD>!<21><><08><>!<21><><EFBFBD>!<21><>\nZ%<25>ć#CH<43>!<21><>r8<72>\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Rܔ2<DC94><32><EFBFBD>^0<><30>@<40>2<EFBFBD><32>(<28>88P/<0F><><EFBFBD>݄<EFBFBD>\\<EFBFBD>\$La\\<EFBFBD>;c<>H<14><>HX<13><><EFBFBD>\nʃt<CA83><74><07>8A<<3C>sZ<04>*<2A>;I<><49>3<EFBFBD><33>@<40>2<<3C><><1A>!A8G<<3C>j<04>-K<>({*\r<EFBFBD><EFBFBD>a1<EFBFBD><EFBFBD><EFBFBD>N4Tc\"\\<13>!=1^<0C><><EFBFBD>M9O<39>:<3A>;j<><6A>\r<EFBFBD>X<EFBFBD><EFBFBD>L#H<>7<05>#Tݪ/-<2D><><07>p<EFBFBD>;<3B>B \n<05>2!<21><><EFBFBD>t]apΎ<70><CE8E>\0R<15>C<EFBFBD>v<1D>M<EFBFBD>I,\r<EFBFBD><EFBFBD><EFBFBD>\0Hv<EFBFBD><EFBFBD>?kT<6B>4<EFBFBD><34><EFBFBD><EFBFBD>uٱ<75>;&<26><><EFBFBD>+&<26><><EFBFBD><EFBFBD><EFBFBD>\r<EFBFBD>X<EFBFBD><EFBFBD><EFBFBD>bu4ݡi88<>2B<10>/⃖4<E28396><07><>N8A<38>A)52<35><32><EFBFBD><EFBFBD><08><>2<EFBFBD><32>s<EFBFBD>8<EFBFBD><38>5<><35><EFBFBD>p<EFBFBD>WC@<40>:<03>t<17>㾴<EFBFBD>e<EFBFBD><65>h\"#8_<38><5F>cp^<1F><><EFBFBD>I]OH<4F><48>:zd<7A>3g<33>(<28><><EFBFBD>Ök<C396><6B><EFBFBD>\\6<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD>ږ<EFBFBD><EFBFBD>i<EFBFBD><18>7<EFBFBD><10><>]\r<EFBFBD>xO<EFBFBD>n<EFBFBD>p<EFBFBD><<3C><>p<EFBFBD>Q<EFBFBD>U<EFBFBD>n<EFBFBD><6E>|@<40><><EFBFBD>#G3<><33>8bA<><41>6<EFBFBD>2<EFBFBD>67%#<23>\\8\r<EFBFBD><18>2<EFBFBD>c\r<EFBFBD>ݟk<DD9F><0C>.(<28> <09><>-<2D>J;<3B><><EFBFBD><EFBFBD> <20><>L<EFBFBD><4C> <20><0C><>W<EFBFBD><57>㧓ѥɤ<D1A5><C9A4><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><6E>ҧ<EFBFBD><D2A7><EFBFBD>M<EFBFBD><4D>9ZНs]<5D>z<EFBFBD><7A><EFBFBD><EFBFBD>y^[<5B><>4-<2D>U\0ta<><1E>62^<5E><>.`<60><17><>.C<>j<EFBFBD>[ᄠ% Q\0`d<>M8<4D><38><EFBFBD><EFBFBD><EFBFBD>\$O0`4<05><><EFBFBD>\n\0a\rA<EFBFBD><<02>@<40><><EFBFBD><EFBFBD>\r!<21>:<03>BA<42>9<EFBFBD>?h><3E>Ǻ<0B><>~̌<>6Ȉh<14>=<0C>-<12>A7X<37><58>և\\<1A>\r<EFBFBD><EFBFBD>Q<蚧q<>'!XΓ2<CE93>T <20>!<21>D\r<EFBFBD><13>,K<>\"<EFBFBD>%<01>H<EFBFBD>qR\r<EFBFBD>̠<EFBFBD><08>C =<3D><><EFBFBD><17><><16><><11><c<>\n#<<3C>5<EFBFBD>M<EFBFBD> <20>E<EFBFBD><45>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>o\"<EFBFBD>cJKL2<03>&<26><>eR<><52>W<>AΐTw<54>ё;<3B>J<02><><EFBFBD>\\`)5<><35>ޜB<DE9C>qhT3<54><33>R <19>'\r+\":<3A>8<0B><>tV<74>A<EFBFBD>+]<0E><>S72<37><32><EFBFBD>Y<EFBFBD>F<EFBFBD><46>Z85<>c,<2C><><EFBFBD>J<EFBFBD><4A>/+S<>nBpoW<6F>d<><64>\"<EFBFBD>Q<EFBFBD><EFBFBD>a<>ZKp<4B>ާy\$<EFBFBD><EFBFBD><EFBFBD><13><>4<EFBFBD>I<EFBFBD>@L'@<40>xC<>df<64>~}Q*<2A>ҺA<><41>Q<EFBFBD>\"B<>*2\0<EFBFBD>.<2E><>kF<6B>\"\r<EFBFBD><EFBFBD><EFBFBD> <20>o<EFBFBD>\\<EFBFBD>Ԣ<><D4A2><EFBFBD>VijY<6A><0B>M<EFBFBD><4D>O<1B>\$<EFBFBD><EFBFBD>2<14>ThH<0E><><EFBFBD><EFBFBD>0XH<58>5~kL<><4C><EFBFBD>T*:~P<><50>2<EFBFBD>t<EFBFBD><0B><>B\0<EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD><1E><><EFBFBD>j<17>vD<10>s.<2E>9<EFBFBD>s<EFBFBD><73>̤<EFBFBD>P<EFBFBD>*x<><78><EFBFBD>b<EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD>P<EFBFBD>\$<EFBFBD>W/<2F>*<2A><>z';<3B><>\$<EFBFBD>*<2A><><EFBFBD><10>d<EFBFBD>m<0C>Ã<EFBFBD>'b\r<EFBFBD>n%<25><>47W<02>-<2D><><EFBFBD><EFBFBD><EFBFBD><1B><>K<><16><>@<<3C>g<EFBFBD>èbB<01><>[7<>\\<EFBFBD>|<7C>VdR<64><52>6leQ<65>`(Ԣ,<2C>d<><64><EFBFBD>8\r<EFBFBD>]S:?<03>1<EFBFBD>`<60><>Y<EFBFBD>`<60>A<EFBFBD>ғ%<25><>ZkQ<05>sM<73>*<2A><><EFBFBD>{`<0B>J*<2A>w<EFBFBD><77>ӊ><3E>վ<>D<1D><><EFBFBD>><3E>eӾ<65>\"<EFBFBD>t+po<70><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>W\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD><EFBFBD>@<40><0E>3t`<60><01><><EFBFBD>-k7g<37><67><EFBFBD>]<5D><>l<><0C>E<EFBFBD><45>^dW>nv<0C>t<EFBFBD>lzPH<15><>FvW<76>V\n<EFBFBD>h;<3B><>B<EFBFBD>D<EFBFBD>س/<2F>:J<><4A>\\<EFBFBD>+ %<25><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]<5D><>ъ<EFBFBD><1E>wa<77>ݫ<EFBFBD><DDAB><EFBFBD>=<3D><>X<EFBFBD><58><EFBFBD><EFBFBD>N<EFBFBD>/<2F><>w<EFBFBD>J<EFBFBD>_[<5B>t)5<><35><EFBFBD>QR2l<32>-:<3A>Y9<59>&l R;<0C>u#S <09> ht<>k<EFBFBD>E!l<><6C><EFBFBD>>SH<53><48>X<,<2C><0E>O<07>YyЃ%L<>]\0<EFBFBD> <09><>^<5E>dw<64>3<EFBFBD>,Sc<53>Qt<1E>e=<3D>M:4<><34><EFBFBD>2]<5D><>P<EFBFBD>T<EFBFBD>s<EFBFBD><73>n:<3A><>u><3E>/<2F>d<EFBFBD><10> <20><><EFBFBD>a<EFBFBD>'%<25><><EFBFBD><18><0E>qҨ&@<><05><>H<EE8C96>G<EFBFBD>@w8p<38><70><EFBFBD><EFBFBD><EFBFBD>Z\n<1C><>{<EFBFBD>[<5B>t2<0B><><EFBFBD>a<0F><>> <09>w<>J<>^+u~<7E>o<0F><>µXkզBZk˱<>X=<3D><>0><3E>t<EFBFBD><74>lŃ)Wb<16>ܦ<EFBFBD><DCA6>'<27>A<EFBFBD>,<2C><>m<EFBFBD>Y<EFBFBD>,<2C>A<EFBFBD><41><EFBFBD><EFBFBD>e<EFBFBD><01>#V<><56>+<2B>n1I<31><49><EFBFBD><EFBFBD>E<07>+[<5B><><EFBFBD><EFBFBD>[<0B><>-R<>mK9<4B><0C>~<7E><><EFBFBD><EFBFBD>L<>-3O<33><4F><EFBFBD>`_0s<30><73><0E>L;<3B><><EFBFBD><16><>]<04>6<EFBFBD><36>|<7C><>h<EFBFBD>V<EFBFBD>T:<3A><>ޞerM<72><4D>a<EFBFBD>\$~e<>9<EFBFBD>><3E><><EFBFBD><EFBFBD><EFBFBD>Д<>\r<EFBFBD><EFBFBD>\\<EFBFBD><EFBFBD><EFBFBD>J1Ú<><0C><>%<25>=0{<EFBFBD> <09><04><><EFBFBD>|ޗtڼ<74>=<3D><><EFBFBD><EFBFBD>Q<EFBFBD>|\0?<3F><17>[g@u?ɝ|<7C><>4<EFBFBD>*<2A><>c-7<>4\ri'^<5E><><EFBFBD><EFBFBD>n;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>{K<EFBFBD>h<EFBFBD>nf<EFBFBD><0C><>Zϝ}l<1D><><EFBFBD><EFBFBD><EFBFBD>]\r<EFBFBD><EFBFBD><EFBFBD>pJ><3E>,gp{<EFBFBD>;<3B>\0<EFBFBD><EFBFBD>u)<29><>s<EFBFBD>N<EFBFBD>'<27><><EFBFBD><EFBFBD>H<07><>C9M5<><35>*<2A><>`<60>k<EFBFBD>㬎<0C><><EFBFBD><EFBFBD>AhY<68><0E>*<2A><><EFBFBD><EFBFBD>jJ<6A>DžPN+^<5E> D<>*<2A><>À<05><><0B>D<0B><>P<EFBFBD><50><04>LQ`O&<26><>\0<EFBFBD>}<7D>\$<EFBFBD><EFBFBD><EFBFBD>6<EFBFBD>Zn><3E><>0<EFBFBD> <20>e<EFBFBD><65>\n<EFBFBD><EFBFBD> <09>trp!<21>hV<68>'Py<07>^<5E>*|r%|\nr\r#<23><><EFBFBD>@w<02><><EFBFBD><EFBFBD>T.Rv<52>8<EFBFBD>j<EFBFBD>\nmB<EFBFBD><EFBFBD><EFBFBD>p<><70> <20>Y0<59>Ϣ<0E>m\0<EFBFBD>@P\r8<0C>Y\rG<EFBFBD><EFBFBD>d<EFBFBD> <09>QG<>P%E<>/@]\r<EFBFBD><EFBFBD><0C>{\0<EFBFBD>Q<EFBFBD><EFBFBD><EFBFBD><EFBFBD>bR M\rF<EFBFBD><0E>|<0C><>%0SDr<44><72><EFBFBD><0E><>f/<0C><><EFBFBD><EFBFBD>\":<3A>mo<>ރ<EFBFBD>%<0E>@<40>3H<33>x\0<EFBFBD>l\0<EFBFBD><0C><> <09><0E>W<15><><15><>\n<EFBFBD>8\r\0}<15>@<40>D<EFBFBD><16>`#<23>t<0C><>.<2E>jEoDrǢlb<0C><><EFBFBD><EFBFBD>t<EFBFBD>f4<66>0<EFBFBD><30><EFBFBD>%<25>0<EFBFBD><30><EFBFBD>k<>z2\r<EFBFBD><EFBFBD> <20>W@<>%\r\n~1<><31>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD>D2!<21><12>O<EFBFBD>*<2A><1C><>{0<E<><45>k*m<>0ı<30><C4B1><EFBFBD>|\r\n<EFBFBD>^i<04><><EFBFBD> <20><>!.<2E>r <20> <20><><EFBFBD><EFBFBD><EFBFBD><1A><><EFBFBD>f<EFBFBD><66>Ĭ<EFBFBD><C4AC>+:<3A><><EFBFBD>ŋJ<C58B>B5\$L<EFBFBD><EFBFBD><EFBFBD>P<EFBFBD><EFBFBD><EFBFBD>LĂ<EFBFBD><EFBFBD><EFBFBD> Z@<40><><EFBFBD><EFBFBD>`^P<>L%5%jp<6A>H<EFBFBD>W<EFBFBD><57>on<6F><6E>kA#&<26><><EFBFBD>8<EFBFBD><38><K6<4B>/<2F><><EFBFBD><EFBFBD>̏<EFBFBD><CC8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XWe+&<26>%<25><><03>c&rj<72><0C>'%<04>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD>nK<6E>2<EFBFBD>2ֶ<32>l<EFBFBD><6C>*<2A>.<16>r<EFBFBD><72><EFBFBD><CEA2><EFBFBD>*<2A>\r+jp<6A>Bg<07>{ <20><02><11>0<EFBFBD>%1(<28><><EFBFBD>Z<EFBFBD>`Q#<23>Ԏ<EFBFBD>n*h<06><><EFBFBD>v<EFBFBD>B<EFBFBD><42><0E><>\\F\n<EFBFBD>W<EFBFBD>r f\$<EFBFBD>93<EFBFBD>G4%d<07>b<11>:JZ!<21>,<2C><>_<1B><>f%2<><32>6s*F<><46><1B>Һ<EFBFBD>EQ<45>q~<7E><>`ts<1E>Ҁ<EFBFBD><D280><EFBFBD>(<28>`<60>\r<EFBFBD><EFBFBD><EFBFBD>#<23>R<EFBFBD><52><EFBFBD><EFBFBD>R<EFBFBD>r<EFBFBD><04><>X<EFBFBD><58>:R<>)<29>A*3<>\$l<EFBFBD>*ν:\"Xl<EFBFBD><EFBFBD>tbK<>-<2D><EFBFBD>O>R<>-<2D>d<EFBFBD><64>=<3D><>\$S<EFBFBD>\$<EFBFBD>2<EFBFBD><EFBFBD>}7Sf<53><66>[<02>}\"@<40>]<5D>[6S|SE_><3E>q-<2D>@z`<60>;<3B>0<EFBFBD><30>ƻ<EFBFBD><C6BB>C<13>*<2A><>[<5B><><0E>{D<0F><>jC\nf<EFBFBD>s<EFBFBD>P<EFBFBD>6'<27><><EFBFBD>ȕ QE<51><45><EFBFBD>N\\%r<>o<EFBFBD>7o<37>G+dW4A*<2A><>#TqE<71>f<EFBFBD><06>%<25>D<EFBFBD>Z<EFBFBD>3<EFBFBD><33>2.<05><><EFBFBD>Rk<><04>z@<40><>@<40>E<>D<EFBFBD>`C<>V!C<><43>ŕ\0<EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>)38<33><38>M3<4D>@<40>3L<><4C>ZB<5A>1F@L<>h~G<>1M<><4D><EFBFBD>6<EFBFBD><36><EFBFBD>4<EFBFBD>Xє<58>}ƞf<>ˢIN<0C><>34<><34>X<EFBFBD>Btd<74>8\nbtN<14><1E>Qb;<13>ܑD<DC91><44>L<EFBFBD>\0<EFBFBD><0E>\"\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>V<EFBFBD><EFBFBD>6<EFBFBD><EFBFBD>]U<>cVf<56><66><EFBFBD>D`<60>M<EFBFBD>6<EFBFBD>O4<11>4sJ<0F><>55<35>5<EFBFBD>\\x <09><5[F<08>ߵy7m<37>)@SV<53><56>Ğ#<23>x<EFBFBD><78>8 ոы<D5B8><D18B>`<60>\\`<60>-<2D>v2<76><32><1B>p<EFBFBD><06><>+v<><76><EFBFBD>U<EFBFBD><55>L<EFBFBD>xY.<2E><><EFBFBD><EFBFBD>\0005(<28>@<40><><EFBFBD>ⰵ[U@#<23>VJuX4<58>u_<>\"JO(Dt<44>_ 5s<35>^<5E><><04><><14><><EFBFBD><EFBFBD><0E>5<EFBFBD>^<15>^V<04><>I<EFBFBD><49>\rg&]<5D><>\r\"ZCI<EFBFBD>6<EFBFBD><EFBFBD>#<23><>\r<EFBFBD><EFBFBD>ܓ<08><>]7<03><><10>q<EFBFBD>0<EFBFBD><30>6}o<><6F><15>`u<><06>ab(<28>X<EFBFBD>D<07>f<14>M<EFBFBD>N)<29>V<EFBFBD>UUF<55>о<EFBFBD><D0BE>=jSWi<57>\"\\B1Ğ<>E0<10> <20>amP<6D><0C>&<<3C>O_<13>L<EFBFBD><4C><EFBFBD><16>.c<05>1Z*<08><>R\$<EFBFBD>h<EFBFBD><EFBFBD><EFBFBD>mv<EFBFBD>[v>ݭ<>p<EFBFBD><70><EFBFBD><EFBFBD>(<28><>0<EFBFBD><30><EFBFBD><0C><>cP<63>om\0R<0B><>p<EFBFBD>&<26>w+KQ<4B>s6<73>}5[s<>J<EFBFBD><4A><EFBFBD>2<EFBFBD><32>/<2F><><EFBFBD>O <20>V*)<29>R<EFBFBD>.Du33<33>F\r<EFBFBD>;<3B><>v4<76><0C><>H<> _!<21><>2<><32>k<EFBFBD><6B><EFBFBD><EFBFBD>+<2B><>%<25>:<0B>_,<2C>eo<><6F>F<EFBFBD><46>AJ<>O<EFBFBD>\"%<25>\n<EFBFBD>k5`z %|<7C>%<25>Ϋg|<7C><>}l<>v2n7<6E>~\0<EFBFBD> <09>YRH<52><48>@<40><>r<EFBFBD><72>xN-Jp\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><12>f#<23><>@ˀmv<6D>x<0E><>\r<06><><EFBFBD>2WMO/<2F>\nD<EFBFBD><EFBFBD>7<EFBFBD>}2<><32><EFBFBD><EFBFBD>VW
|
|||
|
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,$ef=null){if(is_string($u)){$bg=array_search($u,get_translations("en"));if($bg!==false)$u=$bg;}global$ca,$qi;$pi=($qi[$u]?$qi[$u]:$u);if(is_array($pi)){$bg=($ef==1?0:($ca=='cs'||$ca=='sk'?($ef&&$ef<5?1:2):($ca=='fr'?(!$ef?0:1):($ca=='pl'?($ef%10>1&&$ef%10<5&&$ef/10%10!=1?1:2):($ca=='sl'?($ef%100==1?0:($ef%100==2?1:($ef%100==3||$ef%100==4?2:3))):($ca=='lt'?($ef%10==1&&$ef%100!=11?0:($ef%10>1&&$ef/10%10!=1?1:2)):($ca=='bs'||$ca=='ru'||$ca=='sr'||$ca=='uk'?($ef%10==1&&$ef%100!=11?0:($ef%10>1&&$ef%10<5&&$ef/10%10!=1?1:2)):1)))))));$pi=$pi[$bg];}$Fa=func_get_args();array_shift($Fa);$gd=str_replace("%d","%s",$pi);if($gd!=$pi)$Fa[0]=format_number($ef);return
|
|||
|
vsprintf($gd,$Fa);}function
|
|||
|
switch_lang(){global$ca,$me;echo"<form action='' method='post'>\n<div id='lang'>",lang(19).": ".html_select("lang",$me,$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($me[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($me[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$va=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$Ce,PREG_SET_ORDER);foreach($Ce
|
|||
|
as$B)$va[$B[1]]=(isset($B[3])?$B[3]:1);arsort($va);foreach($va
|
|||
|
as$y=>$rg){if(isset($me[$y])){$ca=$y;break;}$y=preg_replace('~-.*~','',$y);if(!isset($va[$y])&&isset($me[$y])){$ca=$y;break;}}}$qi=$_SESSION["translations"];if($_SESSION["translations_version"]!=131114700){$qi=array();$_SESSION["translations_version"]=131114700;}function
|
|||
|
get_translations($le){switch($le){case"en":$f="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>.<2E>A<><41>E\r<EFBFBD><EFBFBD>W<EFBFBD>a(<28>2<EFBFBD>Ài !<21>H<11><>x<EFBFBD><78><EFBFBD>u%<25><><12><><EFBFBD>Uj\\<EFBFBD>(<28><>W<EFBFBD><57>*<2A>S\niN)<29>@<40><>\"rT<EFBFBD><EFBFBD>T<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>r<EFBFBD>Vm<EFBFBD>0h<0F><> F<><46>7<EFBFBD>0<><1E><>=<3D><>4<EFBFBD>\n<EFBFBD><EFBFBD>zw=G<><1F><><EFBFBD><11><>>nU<6E>'<27>xvT12^ '؍ a<0C>m<EFBFBD>;<3B>ET*<2A>{-<2D>0<EFBFBD>F<EFBFBD><02>Pia<69><18><><EFBFBD><EFBFBD><EFBFBD>Ky<4B>HG<48><47><1E><>MA\0P A<05>8<EFBFBD>O<EFBFBD>A@\$<EFBFBD><EFBFBD><EFBFBD>'<27>I<EFBFBD>(^<5E><>߱<EFBFBD><DFB1><EFBFBD>L<EFBFBD>n\"<EFBFBD>T<EFBFBD><EFBFBD>b|h91&pt<70><06><><EFBFBD>\rlp6<11>6bTK q0\r<EFBFBD>m\n<EFBFBD><EFBFBD>Da\$%8ᐟ<14><>M`<60><>>nj<><C78C>H<1E>0I\"<10>rC(K<><4B>?怀<>fTI!<21>&<0F>F<><46><18><><EFBFBD><EFBFBD>d<EFBFBD><64>W<><57>ׁi<D781>!<)<29>F<EFBFBD>^<5E>R&<26>8<EFBFBD>c<><63><EFBFBD><EFBFBD><EFBFBD>lS<6C><53>\$<17>INprd\$<EFBFBD><EFBFBD>0cIC<49>ig0̑<30>@<40>C<14>\nm\$<EFBFBD> <20>&H<>0T<30><54>9p<39>#z^&<26>3 <20>H<EFBFBD>5lZN<5A><4E>I<EFBFBD>(<28>*<06>BxNT(@<40>(\n<EFBFBD> <20>\"P<>i<>`^<5E><><EFBFBD>F<EFBFBD>N<EFBFBD><4E>;B<>\\ӄČ<19><>O,le <09><><EFBFBD>p Ho5Dr<44><72><EFBFBD><EFBFBD>v\0T<EFBFBD>V<EFBFBD>6R<EFBFBD>w<EFBFBD>;<3B>};<3B><><EFBFBD><18>T<EFBFBD>1<>0g<30>R1<0C><>c`lH<6C>c<EFBFBD><13><1B>'<27>@<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?Bh<<3C><1F>O<><4F>wP<><50><EFBFBD>0<EFBFBD><19>D<EFBFBD><44>r#Gtt<74><74><EFBFBD><EFBFBD><VL<56>VB@C<>%^<5E><>+<2B>SEb<45><62><EFBFBD>Fa<46><61>%<1A>MN-s<><73>(<28><><EFBFBD><EFBFBD>[hyD쐭u<EC90AD><15>Jص<4A>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>-w9<0C>2\n<1C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <09>'<0C><>2<EFBFBD>P<EFBFBD>Z-r<><72><EFBFBD><EFBFBD><16>*<2A><02>D7<44><37><EFBFBD><EFBFBD><EFBFBD>^<13>\r<EFBFBD>/!]<19>¢S<C2A2><08>4<EFBFBD>!<21><>^<5E><> ?7z<37><7A>@<40><10>@ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>o<><6F>~=<3D><>\"<EFBFBD><EFBFBD>x<EFBFBD><EFBFBD><EFBFBD>6]<5D><><10>B`ú<><C3BA><EFBFBD> <09>f<><66>z<EFBFBD>v<04>'<27><> <20><>A\"q<EFBFBD>Ο0<13><><EFBFBD><EFBFBD><EFBFBD>!<21><19>k<><6B>Y<EFBFBD><59>A<EFBFBD>JC<02>̼<>\r<EFBFBD><12>߈r<15>Ș<EFBFBD>#<04>]<5D><><EFBFBD>/¨/e<>j]rյIIĦ<49><C4A6>&Q <09><1C><>w8<1F>:G<><47>.<2E>M<1F>0<EFBFBD>6<EFBFBD>rJ`(+<2B>P<EFBFBD>o<12>'<16>)1m<14><08>pHGd<47>Œa4<61>l<EFBFBD>Xz<58>\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>9eg<>*j@ËhI3<49><33>œ<EFBFBD><C593>vYyȔ<79><C894><EFBFBD><EFBFBD><EFBFBD><EFBFBD><16><>X<><58>U<EFBFBD>[<5B>ɻ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><7F><EFBFBD>PCL*lmo<6D>rԔ<72>5<EFBFBD>lp<6C>\\f3cو<EFBFBD><EFBFBD><03><><EFBFBD>,!aL2S<32>{r<EFBFBD><11><0B><06>+<2B>˺<><CBBA>TK(<28>v@}<7D>a<EFBFBD>z<13><>ğV<C49F><05><16>x氧<78><05><>*<12>\r<EFBFBD>d3<><33>In<49>͢<EFBFBD>-<2D>\\C%s<>u<EFBFBD><75><EFBFBD>m<EFBFBD><6D><EFBFBD><EFBFBD><01><>M<0F>]m<><6D>o<>2<EFBFBD><32>֞=<3D>+<2B><>/<2F><><EFBFBD><EFBFBD>>?<3F>8<EFBFBD>4l<34>ۘM<DB98><4D>Κ<EFBFBD>'<27><04>iE0<45><30>/<2F>N]d4bdMrA<72><41><11>&,X:B<>\0<EFBFBD>\\^oꎠO<EA8EA0>N<16>}[?^+<2B><><EFBFBD><EFBFBD>ɮ<EFBFBD><C9AE><EFBFBD>ҀAJ<41>g)<29>\\ <09>vn<76>y{<EFBFBD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><10><><EFBFBD>K<EFBFBD><4B>)<29><>{<EFBFBD><EFBFBD>]67<36>k <20>w<>d0<64><30>Q<02><><<3C>P˧<50>bI<62>#<08><><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>͋<EFBFBD>\n<EFBFBD>f<>OIt<49><74><EFBFBD>><3E>y<EFBFBD><79>+ok<6F><6B><EFBFBD><1A><><EFBFBD><EFBFBD>e<EFBFBD><0B><><EFBFBD>9I<39><49>_i<5F>;+<2B>ܟ<EFBFBD><DC9F><EFBFBD><EFBFBD>+<2B><><EFBFBD>k|`<15><>Wy<57><1C>)<29><0B><>x<1C><>7<EFBFBD>흉wV<77>e<EFBFBD>x!<21>~\$<EFBFBD>j< y<08><><EFBFBD><EFBFBD>2<EFBFBD><13><><EFBFBD>9Ȕ<>I<EFBFBD>`/<2F><0F><><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><0E><>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>NT<4E>BP<42>%<25>t&.<2E><><18> <20>O<EFBFBD><4F>Z<0F>Dg<><67>o<06>20&<26>fV<66>@<40>!#<23>,<2C>b,&<26><><10><>6J0R<30><52><EFBFBD><EFBFBD>e<EFBFBD><05><><EFBFBD><0E>n<02>pi<02><><0C>v<EFBFBD><76>j<EFBFBD>0X<30>e<EFBFBD><0F><><EFBFBD>#<04><><EFBFBD><EFBFBD><EFBFBD>r<EFBFBD>н<EFBFBD>V<EFBFBD><56><EFBFBD> <09>*<2A>o <09><>\n<EFBFBD><08><> 0<>J<EFBFBD>8D!\$<EFBFBD>\n<EFBFBD>F<EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD>y\n/<2F><>p<EFBFBD>N{\0n<EFBFBD>\r<EFBFBD><EFBFBD>/<2F>%\0<EFBFBD><D\0K<EFBFBD><0C>\0<EFBFBD><EFBFBD>E<EFBFBD><EFBFBD>@<40>zCN]<5D><<3C>P\rbL\"<EFBFBD>}<10>O<><4F>7\r<EFBFBD>N<><4E><EFBFBD><7<>Lu<4C><75>.\"<EFBFBD> q%<25>Րꌛ<11>t<EFBFBD>m<EFBFBD>N<><4E>o<EFBFBD>d \r<EFBFBD>V<EFBFBD>\0<EFBFBD>`<60><>eܢ0sz\r <20>sb<73>A\"p<EFBFBD>h<EFBFBD>@<40>\n<EFBFBD><EFBFBD><05>pG<70>\\.<2E><><EFBFBD>̓Z<><5A>L<EFBFBD>L<EFBFBD><4C>-<2D>,7\r<EFBFBD>|'0p<30>x<EFBFBD>E<EFBFBD>o<EFBFBD><6F>qz<71><7A>إ<EFBFBD>&6<><36>\r<EFBFBD><EFBFBD>.<2E>־<EFBFBD>0V<30><56><17><>4prJV<><1A><><EFBFBD>\$fKC<4B><1C>\n\n<EFBFBD>'Pab<61>ڂ<EFBFBD><DA82><EFBFBD><EFBFBD><EFBFBD>%<25>b<EFBFBD><14>r<1A>R<EFBFBD>m<EFBFBD><6D><EFBFBD><18><>R5<52>\"<EFBFBD>#/<2F>\nR%2<1A>&<26>6\$⸍<EFBFBD>#<23>8<EFBFBD><38>o+<2B><>/Nuq<75>C/<2F>L<EFBFBD>N<EFBFBD><4E>@<40><>vd<76><64>v<><76>y'L<><4C><EFBFBD><EFBFBD>0<EFBFBD>O`<60>%<25>t<EFBFBD>rRZ\"<EFBFBD>\"vl<16>L=<3D> <09>,hÓcT3<02>eJ<65>L2<4C><32>@<40>,<2C>P6oJ<6F>f<EFBFBD><02><>\"<EFBFBD>-LDD<44>]<5D><><05><>\$<EFBFBD><10>\"<EFBFBD><EFBFBD><12>/)[\$\r<EFBFBD>/<2F>\\";break;case"ar":$f="<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<><76>p<EFBFBD>ý6<C3BD>+<2B><10><>q<EFBFBD>yj͗<6A>g<<3C><> Bld5<64>=<3D><><EFBFBD><12>r<0E><><19>@<40>\r(o<0C><>6-3\n~3<>X
|
|||
|
Min_PDO
|
|||
|
extends
|
|||
|
PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
__construct(){global$b;$bg=array_search("SQL",$b->operators);if($bg!==false)unset($b->operators[$bg]);}function
|
|||
|
dsn($kc,$V,$F,$vf=array()){try{parent::__construct($kc,$V,$F,$vf);}catch(Exception$Bc){auth_error(h($Bc->getMessage()));}$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=@$this->getAttribute(4);}function
|
|||
|
query($G,$_i=false){$H=parent::query($G);$this->error="";if(!$H){list(,$this->errno,$this->error)=$this->errorInfo();if(!$this->error)$this->error=lang(21);return
|
|||
|
false;}$this->store_result($H);return$H;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result($H=null){if(!$H){$H=$this->_result;if(!$H)return
|
|||
|
false;}if($H->columnCount()){$H->num_rows=$H->rowCount();return$H;}$this->affected_rows=$H->rowCount();return
|
|||
|
true;}function
|
|||
|
next_result(){if(!$this->_result)return
|
|||
|
false;$this->_result->_offset=0;return@$this->_result->nextRowset();}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H)return
|
|||
|
false;$J=$H->fetch();return$J[$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(){$J=(object)$this->getColumnMeta($this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=(in_array("blob",(array)$J->flags)?63:0);return$J;}}}$fc=array();class
|
|||
|
Min_SQL{var$_conn;function
|
|||
|
__construct($g){$this->_conn=$g;}function
|
|||
|
select($R,$L,$Z,$od,$xf=array(),$z=1,$E=0,$jg=false){global$b,$x;$Xd=(count($od)<count($L));$G=$b->selectQueryBuild($L,$Z,$od,$xf,$z,$E);if(!$G)$G="SELECT".limit(($_GET["page"]!="last"&&$z!=""&&$od&&$Xd&&$x=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$L)."\nFROM ".table($R),($Z?"\nWHERE ".implode(" AND ",$Z):"").($od&&$Xd?"\nGROUP BY ".implode(", ",$od):"").($xf?"\nORDER BY ".implode(", ",$xf):""),($z!=""?+$z:null),($E?$z*$E:0),"\n");$_h=microtime(true);$I=$this->_conn->query($G);if($jg)echo$b->selectQuery($G,$_h,!$I);return$I;}function
|
|||
|
delete($R,$tg,$z=0){$G="FROM ".table($R);return
|
|||
|
queries("DELETE".($z?limit1($R,$G,$tg):" $G$tg"));}function
|
|||
|
update($R,$O,$tg,$z=0,$M="\n"){$Ri=array();foreach($O
|
|||
|
as$y=>$X)$Ri[]="$y = $X";$G=table($R)." SET$M".implode(",$M",$Ri);return
|
|||
|
queries("UPDATE".($z?limit1($R,$G,$tg,$M):" $G$tg"));}function
|
|||
|
insert($R,$O){return
|
|||
|
queries("INSERT INTO ".table($R).($O?" (".implode(", ",array_keys($O)).")\nVALUES (".implode(", ",$O).")":" DEFAULT VALUES"));}function
|
|||
|
insertUpdate($R,$K,$hg){return
|
|||
|
false;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
commit(){return
|
|||
|
queries("COMMIT");}function
|
|||
|
rollback(){return
|
|||
|
queries("ROLLBACK");}function
|
|||
|
slowQuery($G,$bi){}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($Vg){return
|
|||
|
q($Vg);}function
|
|||
|
warnings(){return'';}function
|
|||
|
tableHelp($C){}}$fc["sqlite"]="SQLite 3";$fc["sqlite2"]="SQLite 2";if(isset($_GET["sqlite"])||isset($_GET["sqlite2"])){$eg=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($Vc){$this->_link=new
|
|||
|
SQLite3($Vc);$Ui=$this->_link->version();$this->server_info=$Ui["versionString"];}function
|
|||
|
query($G){$H=@$this->_link->query($G);$this->error="";if(!$H){$this->errno=$this->_link->lastErrorCode();$this->error=$this->_link->lastErrorMsg();return
|
|||
|
false;}elseif($H->numColumns())return
|
|||
|
new
|
|||
|
Min_Result($H);$this->affected_rows=$this->_link->changes();return
|
|||
|
true;}function
|
|||
|
quote($Q){return(is_utf8($Q)?"'".$this->_link->escapeString($Q)."'":"x'".reset(unpack('H*',$Q))."'");}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;$J=$H->_result->fetchArray();return$J[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
fetch_assoc(){return$this->_result->fetchArray(SQLITE3_ASSOC);}function
|
|||
|
fetch_row(){return$this->_result->fetchArray(SQLITE3_NUM);}function
|
|||
|
fetch_field(){$d=$this->_offset++;$U=$this->_result->columnType($d);return(object)array("name"=>$this->_result->columnName($d),"type"=>$U,"charsetnr"=>($U==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($Vc){$this->server_info=sqlite_libversion();$this->_link=new
|
|||
|
SQLiteDatabase($Vc);}function
|
|||
|
query($G,$_i=false){$Qe=($_i?"unbufferedQuery":"query");$H=@$this->_link->$Qe($G,SQLITE_BOTH,$n);$this->error="";if(!$H){$this->error=$n;return
|
|||
|
false;}elseif($H===true){$this->affected_rows=$this->changes();return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
quote($Q){return"'".sqlite_escape_string($Q)."'";}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;$J=$H->_result->fetch();return$J[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;if(method_exists($H,'numRows'))$this->num_rows=$H->numRows();}function
|
|||
|
fetch_assoc(){$J=$this->_result->fetch(SQLITE_ASSOC);if(!$J)return
|
|||
|
false;$I=array();foreach($J
|
|||
|
as$y=>$X)$I[($y[0]=='"'?idf_unescape($y):$y)]=$X;return$I;}function
|
|||
|
fetch_row(){return$this->_result->fetch(SQLITE_NUM);}function
|
|||
|
fetch_field(){$C=$this->_result->fieldName($this->_offset++);$Xf='(\[.*]|"(?:[^"]|"")*"|(.+))';if(preg_match("~^($Xf\\.)?$Xf\$~",$C,$B)){$R=($B[3]!=""?$B[3]:idf_unescape($B[2]));$C=($B[5]!=""?$B[5]:idf_unescape($B[4]));}return(object)array("name"=>$C,"orgname"=>$C,"orgtable"=>$R,);}}}}elseif(extension_loaded("pdo_sqlite")){class
|
|||
|
Min_SQLite
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_SQLite";function
|
|||
|
__construct($Vc){$this->dsn(DRIVER.":$Vc","","");}}}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($Vc){if(is_readable($Vc)&&$this->query("ATTACH ".$this->quote(preg_match("~(^[/\\\\]|:)~",$Vc)?$Vc:dirname($_SERVER["SCRIPT_FILENAME"])."/$Vc")." AS a")){parent::__construct($Vc);$this->query("PRAGMA foreign_keys = 1");return
|
|||
|
true;}return
|
|||
|
false;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
next_result(){return
|
|||
|
false;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($R,$K,$hg){$Ri=array();foreach($K
|
|||
|
as$O)$Ri[]="(".implode(", ",$O).")";return
|
|||
|
queries("REPLACE INTO ".table($R)." (".implode(", ",array_keys(reset($K))).") VALUES\n".implode(",\n",$Ri));}function
|
|||
|
tableHelp($C){if($C=="sqlite_sequence")return"fileformat2.html#seqtab";if($C=="sqlite_master")return"fileformat2.html#$C";}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b;list(,,$F)=$b->credentials();if($F!="")return
|
|||
|
lang(22);return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
get_databases(){return
|
|||
|
array();}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){return" $G$Z".($z!==null?$M."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($R,$G,$Z,$M="\n"){global$g;return(preg_match('~^INTO~',$G)||$g->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')")?limit($G,$Z,1,0,$M):" $G WHERE rowid = (SELECT rowid FROM ".table($R).$Z.$M."LIMIT 1)");}function
|
|||
|
db_collation($l,$qb){global$g;return$g->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($C=""){global$g;$I=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') ".($C!=""?"AND name = ".q($C):"ORDER BY name"))as$J){$J["Rows"]=$g->result("SELECT COUNT(*) FROM ".idf_escape($J["Name"]));$I[$J["Name"]]=$J;}foreach(get_rows("SELECT * FROM sqlite_sequence",null,"")as$J)$I[$J["name"]]["Auto_increment"]=$J["seq"];return($C!=""?$I[$C]:$I);}function
|
|||
|
is_view($S){return$S["Engine"]=="view";}function
|
|||
|
fk_support($S){global$g;return!$g->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");}function
|
|||
|
fields($R){global$g;$I=array();$hg="";foreach(get_rows("PRAGMA table_info(".table($R).")")as$J){$C=$J["name"];$U=strtolower($J["type"]);$Tb=$J["dflt_value"];$I[$C]=array("field"=>$C,"type"=>(preg_match('~int~i',$U)?"integer":(preg_match('~char|clob|text~i',$U)?"text":(preg_match('~blob~i',$U)?"blob":(preg_match('~real|floa|doub~i',$U)?"real":"numeric")))),"full_type"=>$U,"default"=>(preg_match("~'(.*)'~",$Tb,$B)?str_replace("''","'",$B[1]):($Tb=="NULL"?null:$Tb)),"null"=>!$J["notnull"],"privileges"=>array("select"=>1,"insert"=>1,"update"=>1),"primary"=>$J["pk"],);if($J["pk"]){if($hg!="")$I[$hg]["auto_increment"]=false;elseif(preg_match('~^integer$~i',$U))$I[$C]["auto_increment"]=true;$hg=$C;}}$vh=$g->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($R));preg_match_all('~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i',$vh,$Ce,PREG_SET_ORDER);foreach($Ce
|
|||
|
as$B){$C=str_replace('""','"',preg_replace('~^"|"$~','',$B[1]));if($I[$C])$I[$C]["collation"]=trim($B[3],"'");}return$I;}function
|
|||
|
indexes($R,$h=null){global$g;if(!is_object($h))$h=$g;$I=array();$vh=$h->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($R));if(preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*"|`[^`]*`)++)~i',$vh,$B)){$I[""]=array("type"=>"PRIMARY","columns"=>array(),"lengths"=>array(),"descs"=>array());preg_match_all('~((("[^"]*+")+|(?:`[^`]*+`)+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i',$B[1],$Ce,PREG_SET_ORDER);foreach($Ce
|
|||
|
as$B){$I[""]["columns"][]=idf_unescape($B[2]).$B[4];$I[""]["descs"][]=(preg_match('~DESC~i',$B[5])?'1':null);}}if(!$I){foreach(fields($R)as$C=>$o){if($o["primary"])$I[""]=array("type"=>"PRIMARY","columns"=>array($C),"lengths"=>array(),"descs"=>array(null));}}$yh=get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ".q($R),$h);foreach(get_rows("PRAGMA index_list(".table($R).")",$h)as$J){$C=$J["name"];$v=array("type"=>($J["unique"]?"UNIQUE":"INDEX"));$v["lengths"]=array();$v["descs"]=array();foreach(get_rows("PRAGMA index_info(".idf_escape($C).")",$h)as$Ug){$v["columns"][]=$Ug["name"];$v["descs"][]=null;}if(preg_match('~^CREATE( UNIQUE)? INDEX '.preg_quote(idf_escape($C).' ON '.idf_escape($R),'~').' \((.*)\)$~i',$yh[$C],$Eg)){preg_match_all('/("[^"]*+")+( DESC)?/',$Eg[2],$Ce);foreach($Ce[2]as$y=>$X){if($X)$v["descs"][$y]='1';}}if(!$I[""]||$v["type"]!="UNIQUE"||$v["columns"]!=$I[""]["columns"]||$v["descs"]!=$I[""]["descs"]||!preg_match("~^sqlite_~",$C))$I[$C]=$v;}return$I;}function
|
|||
|
foreign_keys($R){$I=array();foreach(get_rows("PRAGMA foreign_key_list(".table($R).")")as$J){$q=&$I[$J["id"]];if(!$q)$q=$J;$q["source"][]=$J["from"];$q["target"][]=$J["to"];}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\s+~iU','',$g->result("SELECT sql FROM sqlite_master WHERE name = ".q($C))));}function
|
|||
|
collations(){return(isset($_GET["create"])?get_vals("PRAGMA collation_list",1):array());}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
check_sqlite_name($C){global$g;$Lc="db|sdb|sqlite";if(!preg_match("~^[^\\0]*\\.($Lc)\$~",$C)){$g->error=lang(23,str_replace("|",", ",$Lc));return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
create_database($l,$pb){global$g;if(file_exists($l)){$g->error=lang(24);return
|
|||
|
false;}if(!check_sqlite_name($l))return
|
|||
|
false;try{$_=new
|
|||
|
Min_SQLite($l);}catch(Exception$Bc){$g->error=$Bc->getMessage();return
|
|||
|
false;}$_->query('PRAGMA encoding = "UTF-8"');$_->query('CREATE TABLE adminer (i)');$_->query('DROP TABLE adminer');return
|
|||
|
true;}function
|
|||
|
drop_databases($k){global$g;$g->__construct(":memory:");foreach($k
|
|||
|
as$l){if(!@unlink($l)){$g->error=lang(24);return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
rename_database($C,$pb){global$g;if(!check_sqlite_name($C))return
|
|||
|
false;$g->__construct(":memory:");$g->error=lang(24);return@rename(DB,$C);}function
|
|||
|
auto_increment(){return" PRIMARY KEY".(DRIVER=="sqlite"?" AUTOINCREMENT":"");}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){$Li=($R==""||$dd);foreach($p
|
|||
|
as$o){if($o[0]!=""||!$o[1]||$o[2]){$Li=true;break;}}$c=array();$Ff=array();foreach($p
|
|||
|
as$o){if($o[1]){$c[]=($Li?$o[1]:"ADD ".implode($o[1]));if($o[0]!="")$Ff[$o[0]]=$o[1][0];}}if(!$Li){foreach($c
|
|||
|
as$X){if(!queries("ALTER TABLE ".table($R)." $X"))return
|
|||
|
false;}if($R!=$C&&!queries("ALTER TABLE ".table($R)." RENAME TO ".table($C)))return
|
|||
|
false;}elseif(!recreate_table($R,$C,$c,$Ff,$dd))return
|
|||
|
false;if($Ma)queries("UPDATE sqlite_sequence SET seq = $Ma WHERE name = ".q($C));return
|
|||
|
true;}function
|
|||
|
recreate_table($R,$C,$p,$Ff,$dd,$w=array()){if($R!=""){if(!$p){foreach(fields($R)as$y=>$o){if($w)$o["auto_increment"]=0;$p[]=process_field($o,$o);$Ff[$y]=idf_escape($y);}}$ig=false;foreach($p
|
|||
|
as$o){if($o[6])$ig=true;}$ic=array();foreach($w
|
|||
|
as$y=>$X){if($X[2]=="DROP"){$ic[$X[1]]=true;unset($w[$y]);}}foreach(indexes($R)as$fe=>$v){$e=array();foreach($v["columns"]as$y=>$d){if(!$Ff[$d])continue
|
|||
|
2;$e[]=$Ff[$d].($v["descs"][$y]?" DESC":"");}if(!$ic[$fe]){if($v["type"]!="PRIMARY"||!$ig)$w[]=array($v["type"],$fe,$e);}}foreach($w
|
|||
|
as$y=>$X){if($X[0]=="PRIMARY"){unset($w[$y]);$dd[]=" PRIMARY KEY (".implode(", ",$X[2]).")";}}foreach(foreign_keys($R)as$fe=>$q){foreach($q["source"]as$y=>$d){if(!$Ff[$d])continue
|
|||
|
2;$q["source"][$y]=idf_unescape($Ff[$d]);}if(!isset($dd[" $fe"]))$dd[]=" ".format_foreign_key($q);}queries("BEGIN");}foreach($p
|
|||
|
as$y=>$o)$p[$y]=" ".implode($o);$p=array_merge($p,array_filter($dd));if(!queries("CREATE TABLE ".table($R!=""?"adminer_$C":$C)." (\n".implode(",\n",$p)."\n)"))return
|
|||
|
false;if($R!=""){if($Ff&&!queries("INSERT INTO ".table("adminer_$C")." (".implode(", ",$Ff).") SELECT ".implode(", ",array_map('idf_escape',array_keys($Ff)))." FROM ".table($R)))return
|
|||
|
false;$wi=array();foreach(triggers($R)as$ui=>$ci){$ti=trigger($ui);$wi[]="CREATE TRIGGER ".idf_escape($ui)." ".implode(" ",$ci)." ON ".table($C)."\n$ti[Statement]";}if(!queries("DROP TABLE ".table($R)))return
|
|||
|
false;queries("ALTER TABLE ".table("adminer_$C")." RENAME TO ".table($C));if(!alter_indexes($C,$w))return
|
|||
|
false;foreach($wi
|
|||
|
as$ti){if(!queries($ti))return
|
|||
|
false;}queries("COMMIT");}return
|
|||
|
true;}function
|
|||
|
index_sql($R,$U,$C,$e){return"CREATE $U ".($U!="INDEX"?"INDEX ":"").idf_escape($C!=""?$C:uniqid($R."_"))." ON ".table($R)." $e";}function
|
|||
|
alter_indexes($R,$c){foreach($c
|
|||
|
as$hg){if($hg[0]=="PRIMARY")return
|
|||
|
recreate_table($R,$R,array(),array(),array(),$c);}foreach(array_reverse($c)as$X){if(!queries($X[2]=="DROP"?"DROP INDEX ".idf_escape($X[1]):index_sql($R,$X[0],$X[1],"(".implode(", ",$X[2]).")")))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($T){return
|
|||
|
apply_queries("DELETE FROM",$T);}function
|
|||
|
drop_views($Wi){return
|
|||
|
apply_queries("DROP VIEW",$Wi);}function
|
|||
|
drop_tables($T){return
|
|||
|
apply_queries("DROP TABLE",$T);}function
|
|||
|
move_tables($T,$Wi,$Th){return
|
|||
|
false;}function
|
|||
|
trigger($C){global$g;if($C=="")return
|
|||
|
array("Statement"=>"BEGIN\n\t;\nEND");$u='(?:[^`"\s]+|`[^`]*`|"[^"]*")+';$vi=trigger_options();preg_match("~^CREATE\\s+TRIGGER\\s*$u\\s*(".implode("|",$vi["Timing"]).")\\s+([a-z]+)(?:\\s+OF\\s+($u))?\\s+ON\\s*$u\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",$g->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ".q($C)),$B);$gf=$B[3];return
|
|||
|
array("Timing"=>strtoupper($B[1]),"Event"=>strtoupper($B[2]).($gf?" OF":""),"Of"=>($gf[0]=='`'||$gf[0]=='"'?idf_unescape($gf):$gf),"Trigger"=>$C,"Statement"=>$B[4],);}function
|
|||
|
triggers($R){$I=array();$vi=trigger_options();foreach(get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($R))as$J){preg_match('~^CREATE\s+TRIGGER\s*(?:[^`"\s]+|`[^`]*`|"[^"]*")+\s*('.implode("|",$vi["Timing"]).')\s*(.*)\s+ON\b~iU',$J["sql"],$B);$I[$J["name"]]=array($B[1],$B[2]);}return$I;}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$g;return$g->result("SELECT LAST_INSERT_ROWID()");}function
|
|||
|
explain($g,$G){return$g->query("EXPLAIN QUERY PLAN $G");}function
|
|||
|
found_rows($S,$Z){}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($Yg){return
|
|||
|
true;}function
|
|||
|
create_sql($R,$Ma,$Eh){global$g;$I=$g->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = ".q($R));foreach(indexes($R)as$C=>$v){if($C=='')continue;$I.=";\n\n".index_sql($R,$v['type'],$C,"(".implode(", ",array_map('idf_escape',$v['columns'])).")");}return$I;}function
|
|||
|
truncate_sql($R){return"DELETE FROM ".table($R);}function
|
|||
|
use_sql($j){}function
|
|||
|
trigger_sql($R){return
|
|||
|
implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($R)));}function
|
|||
|
show_variables(){global$g;$I=array();foreach(array("auto_vacuum","cache_size","count_changes","default_cache_size","empty_result_callbacks","encoding","foreign_keys","full_column_names","fullfsync","journal_mode","journal_size_limit","legacy_file_format","locking_mode","page_size","max_page_count","read_uncommitted","recursive_triggers","reverse_unordered_selects","secure_delete","short_column_names","synchronous","temp_store","temp_store_directory","schema_version","integrity_check","quick_check")as$y)$I[$y]=$g->result("PRAGMA $y");return$I;}function
|
|||
|
show_status(){$I=array();foreach(get_vals("PRAGMA compile_options")as$uf){list($y,$X)=explode("=",$uf,2);$I[$y]=$X;}return$I;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match('~^(columns|database|drop_col|dump|indexes|move_col|sql|status|table|trigger|variables|view|view_trigger)$~',$Qc);}$x="sqlite";$zi=array("integer"=>0,"real"=>0,"numeric"=>0,"text"=>0,"blob"=>0);$Dh=array_keys($zi);$Fi=array();$sf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$ld=array("hex","length","lower","round","unixepoch","upper");$rd=array("avg","count","count distinct","group_concat","max","min","sum");$nc=array(array(),array("integer|real|numeric"=>"+/-","text"=>"||",));}$fc["pgsql"]="PostgreSQL";if(isset($_GET["pgsql"])){$eg=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($yc,$n){if(ini_bool("html_errors"))$n=html_entity_decode(strip_tags($n));$n=preg_replace('~^[^:]*: ~','',$n);$this->error=$n;}function
|
|||
|
connect($N,$V,$F){global$b;$l=$b->database();set_error_handler(array($this,'_error'));$this->_string="host='".str_replace(":","' port='",addcslashes($N,"'\\"))."' user='".addcslashes($V,"'\\")."' password='".addcslashes($F,"'\\")."'";$this->_link=@pg_connect("$this->_string dbname='".($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){$Ui=pg_version($this->_link);$this->server_info=$Ui["server"];pg_set_client_encoding($this->_link,"UTF8");}return(bool)$this->_link;}function
|
|||
|
quote($Q){return"'".pg_escape_string($this->_link,$Q)."'";}function
|
|||
|
value($X,$o){return($o["type"]=="bytea"?pg_unescape_bytea($X):$X);}function
|
|||
|
quoteBinary($Q){return"'".pg_escape_bytea($this->_link,$Q)."'";}function
|
|||
|
select_db($j){global$b;if($j==$b->database())return$this->_database;$I=@pg_connect("$this->_string dbname='".addcslashes($j,"'\\")."'",PGSQL_CONNECT_FORCE_NEW);if($I)$this->_link=$I;return$I;}function
|
|||
|
close(){$this->_link=@pg_connect("$this->_string dbname='postgres'");}function
|
|||
|
query($G,$_i=false){$H=@pg_query($this->_link,$G);$this->error="";if(!$H){$this->error=pg_last_error($this->_link);$I=false;}elseif(!pg_num_fields($H)){$this->affected_rows=pg_affected_rows($H);$I=true;}else$I=new
|
|||
|
Min_Result($H);if($this->timeout){$this->timeout=0;$this->query("RESET statement_timeout");}return$I;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H||!$H->num_rows)return
|
|||
|
false;return
|
|||
|
pg_fetch_result($H->_result,0,$o);}function
|
|||
|
warnings(){return
|
|||
|
h(pg_last_notice($this->_link));}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;$this->num_rows=pg_num_rows($H);}function
|
|||
|
fetch_assoc(){return
|
|||
|
pg_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
pg_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$d=$this->_offset++;$I=new
|
|||
|
stdClass;if(function_exists('pg_field_table'))$I->orgtable=pg_field_table($this->_result,$d);$I->name=pg_field_name($this->_result,$d);$I->orgname=$I->name;$I->type=pg_field_type($this->_result,$d);$I->charsetnr=($I->type=="bytea"?63:0);return$I;}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($N,$V,$F){global$b;$l=$b->database();$Q="pgsql:host='".str_replace(":","' port='",addcslashes($N,"'\\"))."' options='-c client_encoding=utf8'";$this->dsn("$Q dbname='".($l!=""?addcslashes($l,"'\\"):"postgres")."'",$V,$F);return
|
|||
|
true;}function
|
|||
|
select_db($j){global$b;return($b->database()==$j);}function
|
|||
|
quoteBinary($Vg){return
|
|||
|
q($Vg);}function
|
|||
|
query($G,$_i=false){$I=parent::query($G,$_i);if($this->timeout){$this->timeout=0;parent::query("RESET statement_timeout");}return$I;}function
|
|||
|
warnings(){return'';}function
|
|||
|
close(){}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($R,$K,$hg){global$g;foreach($K
|
|||
|
as$O){$Gi=array();$Z=array();foreach($O
|
|||
|
as$y=>$X){$Gi[]="$y = $X";if(isset($hg[idf_unescape($y)]))$Z[]="$y = $X";}if(!(($Z&&queries("UPDATE ".table($R)." SET ".implode(", ",$Gi)." WHERE ".implode(" AND ",$Z))&&$g->affected_rows)||queries("INSERT INTO ".table($R)." (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).")")))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
slowQuery($G,$bi){$this->_conn->query("SET statement_timeout = ".(1000*$bi));$this->_conn->timeout=1000*$bi;return$G;}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($Vg){return$this->_conn->quoteBinary($Vg);}function
|
|||
|
warnings(){return$this->_conn->warnings();}function
|
|||
|
tableHelp($C){$we=array("information_schema"=>"infoschema","pg_catalog"=>"catalog",);$_=$we[$_GET["ns"]];if($_)return"$_-".str_replace("_","-",$C).".html";}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b,$zi,$Dh;$g=new
|
|||
|
Min_DB;$Hb=$b->credentials();if($g->connect($Hb[0],$Hb[1],$Hb[2])){if(min_version(9,0,$g)){$g->query("SET application_name = 'Adminer'");if(min_version(9.2,0,$g)){$Dh[lang(25)][]="json";$zi["json"]=4294967295;if(min_version(9.4,0,$g)){$Dh[lang(25)][]="jsonb";$zi["jsonb"]=4294967295;}}}return$g;}return$g->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname");}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){return" $G$Z".($z!==null?$M."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($R,$G,$Z,$M="\n"){return(preg_match('~^INTO~',$G)?limit($G,$Z,1,0,$M):" $G".(is_view(table_status1($R))?$Z:" WHERE ctid = (SELECT ctid FROM ".table($R).$Z.$M."LIMIT 1)"));}function
|
|||
|
db_collation($l,$qb){global$g;return$g->result("SHOW LC_COLLATE");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$g;return$g->result("SELECT user");}function
|
|||
|
tables_list(){$G="SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema()";if(support('materializedview'))$G.="
|
|||
|
UNION ALL
|
|||
|
SELECT matviewname, 'MATERIALIZED VIEW'
|
|||
|
FROM pg_matviews
|
|||
|
WHERE schemaname = current_schema()";$G.="
|
|||
|
ORDER BY 1";return
|
|||
|
get_key_vals($G);}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){$I=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\", 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')
|
|||
|
".($C!=""?"AND relname = ".q($C):"ORDER BY relname"))as$J)$I[$J["Name"]]=$J;return($C!=""?$I[$C]:$I);}function
|
|||
|
is_view($S){return
|
|||
|
in_array($S["Engine"],array("view","materialized view"));}function
|
|||
|
fk_support($S){return
|
|||
|
true;}function
|
|||
|
fields($R){$I=array();$Da=array('timestamp without time zone'=>'timestamp','timestamp with time zone'=>'timestamptz',);foreach(get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment
|
|||
|
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($R)."
|
|||
|
AND n.nspname = current_schema()
|
|||
|
AND NOT a.attisdropped
|
|||
|
AND a.attnum > 0
|
|||
|
ORDER BY a.attnum")as$J){preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~',$J["full_type"],$B);list(,$U,$te,$J["length"],$xa,$Ga)=$B;$J["length"].=$Ga;$eb=$U.$xa;if(isset($Da[$eb])){$J["type"]=$Da[$eb];$J["full_type"]=$J["type"].$te.$Ga;}else{$J["type"]=$U;$J["full_type"]=$J["type"].$te.$xa.$Ga;}$J["null"]=!$J["attnotnull"];$J["auto_increment"]=preg_match('~^nextval\(~i',$J["default"]);$J["privileges"]=array("insert"=>1,"select"=>1,"update"=>1);if(preg_match('~(.+)::[^)]+(.*)~',$J["default"],$B))$J["default"]=($B[1]=="NULL"?null:(($B[1][0]=="'"?idf_unescape($B[1]):$B[1]).$B[2]));$I[$J["field"]]=$J;}return$I;}function
|
|||
|
indexes($R,$h=null){global$g;if(!is_object($h))$h=$g;$I=array();$Mh=$h->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = ".q($R));$e=get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Mh AND attnum > 0",$h);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 = $Mh AND ci.oid = i.indexrelid",$h)as$J){$Fg=$J["relname"];$I[$Fg]["type"]=($J["indispartial"]?"INDEX":($J["indisprimary"]?"PRIMARY":($J["indisunique"]?"UNIQUE":"INDEX")));$I[$Fg]["columns"]=array();foreach(explode(" ",$J["indkey"])as$Md)$I[$Fg]["columns"][]=$e[$Md];$I[$Fg]["descs"]=array();foreach(explode(" ",$J["indoption"])as$Nd)$I[$Fg]["descs"][]=($Nd&1?'1':null);$I[$Fg]["lengths"]=array();}return$I;}function
|
|||
|
foreign_keys($R){global$nf;$I=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($R)." AND pn.nspname = current_schema())
|
|||
|
AND contype = 'f'::char
|
|||
|
ORDER BY conkey, conname")as$J){if(preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA',$J['definition'],$B)){$J['source']=array_map('trim',explode(',',$B[1]));if(preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~',$B[2],$Be)){$J['ns']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$Be[2]));$J['table']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$Be[4]));}$J['target']=array_map('trim',explode(',',$B[3]));$J['on_delete']=(preg_match("~ON DELETE ($nf)~",$B[4],$Be)?$Be[1]:'NO ACTION');$J['on_update']=(preg_match("~ON UPDATE ($nf)~",$B[4],$Be)?$Be[1]:'NO ACTION');$I[$J['conname']]=$J;}}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>trim($g->result("SELECT view_definition
|
|||
|
FROM information_schema.views
|
|||
|
WHERE table_schema = current_schema() AND table_name = ".q($C))));}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return($l=="information_schema");}function
|
|||
|
error(){global$g;$I=h($g->error);if(preg_match('~^(.*\n)?([^\n]*)\n( *)\^(\n.*)?$~s',$I,$B))$I=$B[1].preg_replace('~((?:[^&]|&[^;]*;){'.strlen($B[3]).'})(.*)~','\1<b>\2</b>',$B[2]).$B[4];return
|
|||
|
nl_br($I);}function
|
|||
|
create_database($l,$pb){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($l).($pb?" ENCODING ".idf_escape($pb):""));}function
|
|||
|
drop_databases($k){global$g;$g->close();return
|
|||
|
apply_queries("DROP DATABASE",$k,'idf_escape');}function
|
|||
|
rename_database($C,$pb){return
|
|||
|
queries("ALTER DATABASE ".idf_escape(DB)." RENAME TO ".idf_escape($C));}function
|
|||
|
auto_increment(){return"";}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){$c=array();$sg=array();foreach($p
|
|||
|
as$o){$d=idf_escape($o[0]);$X=$o[1];if(!$X)$c[]="DROP $d";else{$Qi=$X[5];unset($X[5]);if(isset($X[6])&&$o[0]=="")$X[1]=($X[1]=="bigint"?" big":" ")."serial";if($o[0]=="")$c[]=($R!=""?"ADD ":" ").implode($X);else{if($d!=$X[0])$sg[]="ALTER TABLE ".table($R)." RENAME $d TO $X[0]";$c[]="ALTER $d TYPE$X[1]";if(!$X[6]){$c[]="ALTER $d ".($X[3]?"SET$X[3]":"DROP DEFAULT");$c[]="ALTER $d ".($X[2]==" NULL"?"DROP NOT":"SET").$X[2];}}if($o[0]!=""||$Qi!="")$sg[]="COMMENT ON COLUMN ".table($R).".$X[0] IS ".($Qi!=""?substr($Qi,9):"''");}}$c=array_merge($c,$dd);if($R=="")array_unshift($sg,"CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");elseif($c)array_unshift($sg,"ALTER TABLE ".table($R)."\n".implode(",\n",$c));if($R!=""&&$R!=$C)$sg[]="ALTER TABLE ".table($R)." RENAME TO ".table($C);if($R!=""||$vb!="")$sg[]="COMMENT ON TABLE ".table($C)." IS ".q($vb);if($Ma!=""){}foreach($sg
|
|||
|
as$G){if(!queries($G))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($R,$c){$i=array();$gc=array();$sg=array();foreach($c
|
|||
|
as$X){if($X[0]!="INDEX")$i[]=($X[2]=="DROP"?"\nDROP CONSTRAINT ".idf_escape($X[1]):"\nADD".($X[1]!=""?" CONSTRAINT ".idf_escape($X[1]):"")." $X[0] ".($X[0]=="PRIMARY"?"KEY ":"")."(".implode(", ",$X[2]).")");elseif($X[2]=="DROP")$gc[]=idf_escape($X[1]);else$sg[]="CREATE INDEX ".idf_escape($X[1]!=""?$X[1]:uniqid($R."_"))." ON ".table($R)." (".implode(", ",$X[2]).")";}if($i)array_unshift($sg,"ALTER TABLE ".table($R).implode(",",$i));if($gc)array_unshift($sg,"DROP INDEX ".implode(", ",$gc));foreach($sg
|
|||
|
as$G){if(!queries($G))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($T){return
|
|||
|
queries("TRUNCATE ".implode(", ",array_map('table',$T)));return
|
|||
|
true;}function
|
|||
|
drop_views($Wi){return
|
|||
|
drop_tables($Wi);}function
|
|||
|
drop_tables($T){foreach($T
|
|||
|
as$R){$P=table_status($R);if(!queries("DROP ".strtoupper($P["Engine"])." ".table($R)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
move_tables($T,$Wi,$Th){foreach(array_merge($T,$Wi)as$R){$P=table_status($R);if(!queries("ALTER ".strtoupper($P["Engine"])." ".table($R)." SET SCHEMA ".idf_escape($Th)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($C,$R=null){if($C=="")return
|
|||
|
array("Statement"=>"EXECUTE PROCEDURE ()");if($R===null)$R=$_GET['trigger'];$K=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($R).' AND t.trigger_name = '.q($C));return
|
|||
|
reset($K);}function
|
|||
|
triggers($R){$I=array();foreach(get_rows("SELECT * FROM information_schema.triggers WHERE event_object_table = ".q($R))as$J)$I[$J["trigger_name"]]=array($J["action_timing"],$J["event_manipulation"]);return$I;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW","FOR EACH STATEMENT"),);}function
|
|||
|
routine($C,$U){$K=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($C));$I=$K[0];$I["returns"]=array("type"=>$I["type_udt_name"]);$I["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($C).'
|
|||
|
ORDER BY ordinal_position');return$I;}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($C,$J){$I=array();foreach($J["fields"]as$o)$I[]=$o["type"];return
|
|||
|
idf_escape($C)."(".implode(", ",$I).")";}function
|
|||
|
last_id(){return
|
|||
|
0;}function
|
|||
|
explain($g,$G){return$g->query("EXPLAIN $G");}function
|
|||
|
found_rows($S,$Z){global$g;if(preg_match("~ rows=([0-9]+)~",$g->result("EXPLAIN SELECT * FROM ".idf_escape($S["Name"]).($Z?" WHERE ".implode(" AND ",$Z):"")),$Eg))return$Eg[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$g;return$g->result("SELECT current_schema()");}function
|
|||
|
set_schema($Xg){global$g,$zi,$Dh;$I=$g->query("SET search_path TO ".idf_escape($Xg));foreach(types()as$U){if(!isset($zi[$U])){$zi[$U]=0;$Dh[lang(26)][]=$U;}}return$I;}function
|
|||
|
create_sql($R,$Ma,$Eh){global$g;$I='';$Ng=array();$hh=array();$P=table_status($R);$p=fields($R);$w=indexes($R);ksort($w);$ad=foreign_keys($R);ksort($ad);if(!$P||empty($p))return
|
|||
|
false;$I="CREATE TABLE ".idf_escape($P['nspname']).".".idf_escape($P['Name'])." (\n ";foreach($p
|
|||
|
as$Sc=>$o){$Of=idf_escape($o['field']).' '.$o['full_type'].default_value($o).($o['attnotnull']?" NOT NULL":"");$Ng[]=$Of;if(preg_match('~nextval\(\'([^\']+)\'\)~',$o['default'],$Ce)){$gh=$Ce[1];$uh=reset(get_rows(min_version(10)?"SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = ".q($gh):"SELECT * FROM $gh"));$hh[]=($Eh=="DROP+CREATE"?"DROP SEQUENCE IF EXISTS $gh;\n":"")."CREATE SEQUENCE $gh INCREMENT $uh[increment_by] MINVALUE $uh[min_value] MAXVALUE $uh[max_value] START ".($Ma?$uh['last_value']:1)." CACHE $uh[cache_value];";}}if(!empty($hh))$I=implode("\n\n",$hh)."\n\n$I";foreach($w
|
|||
|
as$Hd=>$v){switch($v['type']){case'UNIQUE':$Ng[]="CONSTRAINT ".idf_escape($Hd)." UNIQUE (".implode(', ',array_map('idf_escape',$v['columns'])).")";break;case'PRIMARY':$Ng[]="CONSTRAINT ".idf_escape($Hd)." PRIMARY KEY (".implode(', ',array_map('idf_escape',$v['columns'])).")";break;}}foreach($ad
|
|||
|
as$Zc=>$Yc)$Ng[]="CONSTRAINT ".idf_escape($Zc)." $Yc[definition] ".($Yc['deferrable']?'DEFERRABLE':'NOT DEFERRABLE');$I.=implode(",\n ",$Ng)."\n) WITH (oids = ".($P['Oid']?'true':'false').");";foreach($w
|
|||
|
as$Hd=>$v){if($v['type']=='INDEX')$I.="\n\nCREATE INDEX ".idf_escape($Hd)." ON ".idf_escape($P['nspname']).".".idf_escape($P['Name'])." USING btree (".implode(', ',array_map('idf_escape',$v['columns'])).");";}if($P['Comment'])$I.="\n\nCOMMENT ON TABLE ".idf_escape($P['nspname']).".".idf_escape($P['Name'])." IS ".q($P['Comment']).";";foreach($p
|
|||
|
as$Sc=>$o){if($o['comment'])$I.="\n\nCOMMENT ON COLUMN ".idf_escape($P['nspname']).".".idf_escape($P['Name']).".".idf_escape($Sc)." IS ".q($o['comment']).";";}return
|
|||
|
rtrim($I,';');}function
|
|||
|
truncate_sql($R){return"TRUNCATE ".table($R);}function
|
|||
|
trigger_sql($R){$P=table_status($R);$I="";foreach(triggers($R)as$si=>$ri){$ti=trigger($si,$P['Name']);$I.="\nCREATE TRIGGER ".idf_escape($ti['Trigger'])." $ti[Timing] $ti[Events] ON ".idf_escape($P["nspname"]).".".idf_escape($P['Name'])." $ti[Type] $ti[Statement];;\n";}return$I;}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,$I){return$I;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match('~^(database|table|columns|sql|indexes|comment|view|'.(min_version(9.3)?'materializedview|':'').'scheme|routine|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~',$Qc);}function
|
|||
|
kill_process($X){return
|
|||
|
queries("SELECT pg_terminate_backend(".number($X).")");}function
|
|||
|
connection_id(){return"SELECT pg_backend_pid()";}function
|
|||
|
max_connections(){global$g;return$g->result("SHOW max_connections");}$x="pgsql";$zi=array();$Dh=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){$zi+=$X;$Dh[$y]=array_keys($X);}$Fi=array();$sf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","ILIKE","ILIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$ld=array("char_length","lower","round","to_hex","to_timestamp","upper");$rd=array("avg","count","count distinct","max","min","sum");$nc=array(array("char"=>"md5","date|time"=>"now",),array(number_type()=>"+/-","date|time"=>"+ interval/- interval","char|text"=>"||",));}$fc["oracle"]="Oracle (beta)";if(isset($_GET["oracle"])){$eg=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($yc,$n){if(ini_bool("html_errors"))$n=html_entity_decode(strip_tags($n));$n=preg_replace('~^[^:]*: ~','',$n);$this->error=$n;}function
|
|||
|
connect($N,$V,$F){$this->_link=@oci_new_connect($V,$F,$N,"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($Q){return"'".str_replace("'","''",$Q)."'";}function
|
|||
|
select_db($j){return
|
|||
|
true;}function
|
|||
|
query($G,$_i=false){$H=oci_parse($this->_link,$G);$this->error="";if(!$H){$n=oci_error($this->_link);$this->errno=$n["code"];$this->error=$n["message"];return
|
|||
|
false;}set_error_handler(array($this,'_error'));$I=@oci_execute($H);restore_error_handler();if($I){if(oci_num_fields($H))return
|
|||
|
new
|
|||
|
Min_Result($H);$this->affected_rows=oci_num_rows($H);}return$I;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=1){$H=$this->query($G);if(!is_object($H)||!oci_fetch($H->_result))return
|
|||
|
false;return
|
|||
|
oci_result($H->_result,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=1,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
_convert($J){foreach((array)$J
|
|||
|
as$y=>$X){if(is_a($X,'OCI-Lob'))$J[$y]=$X->load();}return$J;}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(){$d=$this->_offset++;$I=new
|
|||
|
stdClass;$I->name=oci_field_name($this->_result,$d);$I->orgname=$I->name;$I->type=oci_field_type($this->_result,$d);$I->charsetnr=(preg_match("~raw|blob|bfile~",$I->type)?63:0);return$I;}function
|
|||
|
__destruct(){oci_free_statement($this->_result);}}}elseif(extension_loaded("pdo_oci")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_OCI";function
|
|||
|
connect($N,$V,$F){$this->dsn("oci:dbname=//$N;charset=AL32UTF8",$V,$F);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;$g=new
|
|||
|
Min_DB;$Hb=$b->credentials();if($g->connect($Hb[0],$Hb[1],$Hb[2]))return$g;return$g->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT tablespace_name FROM user_tablespaces");}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){return($D?" * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $G$Z) t WHERE rownum <= ".($z+$D).") WHERE rnum > $D":($z!==null?" * FROM (SELECT $G$Z) WHERE rownum <= ".($z+$D):" $G$Z"));}function
|
|||
|
limit1($R,$G,$Z,$M="\n"){return" $G$Z";}function
|
|||
|
db_collation($l,$qb){global$g;return$g->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$g;return$g->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($C=""){$I=array();$Zg=q($C);foreach(get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = '.q(DB).($C!=""?" AND table_name = $Zg":"")."
|
|||
|
UNION SELECT view_name, 'view', 0, 0 FROM user_views".($C!=""?" WHERE view_name = $Zg":"")."
|
|||
|
ORDER BY 1")as$J){if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
|
|||
|
is_view($S){return$S["Engine"]=="view";}function
|
|||
|
fk_support($S){return
|
|||
|
true;}function
|
|||
|
fields($R){$I=array();foreach(get_rows("SELECT * FROM all_tab_columns WHERE table_name = ".q($R)." ORDER BY column_id")as$J){$U=$J["DATA_TYPE"];$te="$J[DATA_PRECISION],$J[DATA_SCALE]";if($te==",")$te=$J["DATA_LENGTH"];$I[$J["COLUMN_NAME"]]=array("field"=>$J["COLUMN_NAME"],"full_type"=>$U.($te?"($te)":""),"type"=>strtolower($U),"length"=>$te,"default"=>$J["DATA_DEFAULT"],"null"=>($J["NULLABLE"]=="Y"),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$I;}function
|
|||
|
indexes($R,$h=null){$I=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($R)."
|
|||
|
ORDER BY uc.constraint_type, uic.column_position",$h)as$J){$Hd=$J["INDEX_NAME"];$I[$Hd]["type"]=($J["CONSTRAINT_TYPE"]=="P"?"PRIMARY":($J["CONSTRAINT_TYPE"]=="U"?"UNIQUE":"INDEX"));$I[$Hd]["columns"][]=$J["COLUMN_NAME"];$I[$Hd]["lengths"][]=($J["CHAR_LENGTH"]&&$J["CHAR_LENGTH"]!=$J["COLUMN_LENGTH"]?$J["CHAR_LENGTH"]:null);$I[$Hd]["descs"][]=($J["DESCEND"]?'1':null);}return$I;}function
|
|||
|
view($C){$K=get_rows('SELECT text "select" FROM user_views WHERE view_name = '.q($C));return
|
|||
|
reset($K);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
explain($g,$G){$g->query("EXPLAIN PLAN FOR $G");return$g->query("SELECT * FROM plan_table");}function
|
|||
|
found_rows($S,$Z){}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){$c=$gc=array();foreach($p
|
|||
|
as$o){$X=$o[1];if($X&&$o[0]!=""&&idf_escape($o[0])!=$X[0])queries("ALTER TABLE ".table($R)." RENAME COLUMN ".idf_escape($o[0])." TO $X[0]");if($X)$c[]=($R!=""?($o[0]!=""?"MODIFY (":"ADD ("):" ").implode($X).($R!=""?")":"");else$gc[]=idf_escape($o[0]);}if($R=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");return(!$c||queries("ALTER TABLE ".table($R)."\n".implode("\n",$c)))&&(!$gc||queries("ALTER TABLE ".table($R)." DROP (".implode(", ",$gc).")"))&&($R==$C||queries("ALTER TABLE ".table($R)." RENAME TO ".table($C)));}function
|
|||
|
foreign_keys($R){$I=array();$G="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($R);foreach(get_rows($G)as$J)$I[$J['NAME']]=array("db"=>$J['DEST_DB'],"table"=>$J['DEST_TABLE'],"source"=>array($J['SRC_COLUMN']),"target"=>array($J['DEST_COLUMN']),"on_delete"=>$J['ON_DELETE'],"on_update"=>null,);return$I;}function
|
|||
|
truncate_tables($T){return
|
|||
|
apply_queries("TRUNCATE TABLE",$T);}function
|
|||
|
drop_views($Wi){return
|
|||
|
apply_queries("DROP VIEW",$Wi);}function
|
|||
|
drop_tables($T){return
|
|||
|
apply_queries("DROP TABLE",$T);}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$g;return$g->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");}function
|
|||
|
set_schema($Yg){global$g;return$g->query("ALTER SESSION SET CURRENT_SCHEMA = ".idf_escape($Yg));}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(){$K=get_rows('SELECT * FROM v$instance');return
|
|||
|
reset($K);}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|processlist|scheme|sql|status|table|variables|view|view_trigger)$~',$Qc);}$x="oracle";$zi=array();$Dh=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){$zi+=$X;$Dh[$y]=array_keys($X);}$Fi=array();$sf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$ld=array("length","lower","round","upper");$rd=array("avg","count","count distinct","max","min","sum");$nc=array(array("date"=>"current_date","timestamp"=>"current_timestamp",),array("number|float|double"=>"+/-","date|timestamp"=>"+ interval/- interval","char|clob"=>"||",));}$fc["mssql"]="MS SQL (beta)";if(isset($_GET["mssql"])){$eg=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($N,$V,$F){$this->_link=@sqlsrv_connect(preg_replace('~:~',',',$N),array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8"));if($this->_link){$Od=sqlsrv_server_info($this->_link);$this->server_info=$Od['SQLServerVersion'];}else$this->_get_error();return(bool)$this->_link;}function
|
|||
|
quote($Q){return"'".str_replace("'","''",$Q)."'";}function
|
|||
|
select_db($j){return$this->query("USE ".idf_escape($j));}function
|
|||
|
query($G,$_i=false){$H=sqlsrv_query($this->_link,$G);$this->error="";if(!$H){$this->_get_error();return
|
|||
|
false;}return$this->store_result($H);}function
|
|||
|
multi_query($G){$this->_result=sqlsrv_query($this->_link,$G);$this->error="";if(!$this->_result){$this->_get_error();return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
store_result($H=null){if(!$H)$H=$this->_result;if(!$H)return
|
|||
|
false;if(sqlsrv_field_metadata($H))return
|
|||
|
new
|
|||
|
Min_Result($H);$this->affected_rows=sqlsrv_rows_affected($H);return
|
|||
|
true;}function
|
|||
|
next_result(){return$this->_result?sqlsrv_next_result($this->_result):null;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;$J=$H->fetch_row();return$J[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
_convert($J){foreach((array)$J
|
|||
|
as$y=>$X){if(is_a($X,'DateTime'))$J[$y]=$X->format("Y-m-d H:i:s");}return$J;}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++];$I=new
|
|||
|
stdClass;$I->name=$o["Name"];$I->orgname=$o["Name"];$I->type=($o["Type"]==1?254:0);return$I;}function
|
|||
|
seek($D){for($s=0;$s<$D;$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($N,$V,$F){$this->_link=@mssql_connect($N,$V,$F);if($this->_link){$H=$this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");if($H){$J=$H->fetch_row();$this->server_info=$this->result("sp_server_info 2",2)." [$J[0]] $J[1]";}}else$this->error=mssql_get_last_message();return(bool)$this->_link;}function
|
|||
|
quote($Q){return"'".str_replace("'","''",$Q)."'";}function
|
|||
|
select_db($j){return
|
|||
|
mssql_select_db($j);}function
|
|||
|
query($G,$_i=false){$H=@mssql_query($G,$this->_link);$this->error="";if(!$H){$this->error=mssql_get_last_message();return
|
|||
|
false;}if($H===true){$this->affected_rows=mssql_rows_affected($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
mssql_next_result($this->_result->_result);}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;return
|
|||
|
mssql_result($H->_result,0,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;$this->num_rows=mssql_num_rows($H);}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(){$I=mssql_fetch_field($this->_result);$I->orgtable=$I->table;$I->orgname=$I->name;return$I;}function
|
|||
|
seek($D){mssql_data_seek($this->_result,$D);}function
|
|||
|
__destruct(){mssql_free_result($this->_result);}}}elseif(extension_loaded("pdo_dblib")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_DBLIB";function
|
|||
|
connect($N,$V,$F){$this->dsn("dblib:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\d)~',';port=\1',$N)),$V,$F);return
|
|||
|
true;}function
|
|||
|
select_db($j){return$this->query("USE ".idf_escape($j));}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($R,$K,$hg){foreach($K
|
|||
|
as$O){$Gi=array();$Z=array();foreach($O
|
|||
|
as$y=>$X){$Gi[]="$y = $X";if(isset($hg[idf_unescape($y)]))$Z[]="$y = $X";}if(!queries("MERGE ".table($R)." USING (VALUES(".implode(", ",$O).")) AS source (c".implode(", c",range(1,count($O))).") ON ".implode(" AND ",$Z)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$Gi)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).");"))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;$g=new
|
|||
|
Min_DB;$Hb=$b->credentials();if($g->connect($Hb[0],$Hb[1],$Hb[2]))return$g;return$g->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')");}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){return($z!==null?" TOP (".($z+$D).")":"")." $G$Z";}function
|
|||
|
limit1($R,$G,$Z,$M="\n"){return
|
|||
|
limit($G,$Z,1,0,$M);}function
|
|||
|
db_collation($l,$qb){global$g;return$g->result("SELECT collation_name FROM sys.databases WHERE name = ".q($l));}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$g;return$g->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$g;$I=array();foreach($k
|
|||
|
as$l){$g->select_db($l);$I[$l]=$g->result("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES");}return$I;}function
|
|||
|
table_status($C=""){$I=array();foreach(get_rows("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(".q(get_schema()).") AND type IN ('S', 'U', 'V') ".($C!=""?"AND name = ".q($C):"ORDER BY name"))as$J){if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
|
|||
|
is_view($S){return$S["Engine"]=="VIEW";}function
|
|||
|
fk_support($S){return
|
|||
|
true;}function
|
|||
|
fields($R){$I=array();foreach(get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default]
|
|||
|
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($R))as$J){$U=$J["type"];$te=(preg_match("~char|binary~",$U)?$J["max_length"]:($U=="decimal"?"$J[precision],$J[scale]":""));$I[$J["name"]]=array("field"=>$J["name"],"full_type"=>$U.($te?"($te)":""),"type"=>$U,"length"=>$te,"default"=>$J["default"],"null"=>$J["is_nullable"],"auto_increment"=>$J["is_identity"],"collation"=>$J["collation_name"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"primary"=>$J["is_identity"],);}return$I;}function
|
|||
|
indexes($R,$h=null){$I=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($R),$h)as$J){$C=$J["name"];$I[$C]["type"]=($J["is_primary_key"]?"PRIMARY":($J["is_unique"]?"UNIQUE":"INDEX"));$I[$C]["lengths"]=array();$I[$C]["columns"][$J["key_ordinal"]]=$J["column_name"];$I[$C]["descs"][$J["key_ordinal"]]=($J["is_descending_key"]?'1':null);}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>preg_replace('~^(?:[^[]|\[[^]]*])*\s+AS\s+~isU','',$g->result("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = ".q($C))));}function
|
|||
|
collations(){$I=array();foreach(get_vals("SELECT name FROM fn_helpcollations()")as$pb)$I[preg_replace('~_.*~','',$pb)][]=$pb;return$I;}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
nl_br(h(preg_replace('~^(\[[^]]*])+~m','',$g->error)));}function
|
|||
|
create_database($l,$pb){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($l).(preg_match('~^[a-z0-9_]+$~i',$pb)?" COLLATE $pb":""));}function
|
|||
|
drop_databases($k){return
|
|||
|
queries("DROP DATABASE ".implode(", ",array_map('idf_escape',$k)));}function
|
|||
|
rename_database($C,$pb){if(preg_match('~^[a-z0-9_]+$~i',$pb))queries("ALTER DATABASE ".idf_escape(DB)." COLLATE $pb");queries("ALTER DATABASE ".idf_escape(DB)." MODIFY NAME = ".idf_escape($C));return
|
|||
|
true;}function
|
|||
|
auto_increment(){return" IDENTITY".($_POST["Auto_increment"]!=""?"(".number($_POST["Auto_increment"]).",1)":"")." PRIMARY KEY";}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){$c=array();foreach($p
|
|||
|
as$o){$d=idf_escape($o[0]);$X=$o[1];if(!$X)$c["DROP"][]=" COLUMN $d";else{$X[1]=preg_replace("~( COLLATE )'(\\w+)'~",'\1\2',$X[1]);if($o[0]=="")$c["ADD"][]="\n ".implode("",$X).($R==""?substr($dd[$X[0]],16+strlen($X[0])):"");else{unset($X[6]);if($d!=$X[0])queries("EXEC sp_rename ".q(table($R).".$d").", ".q(idf_unescape($X[0])).", 'COLUMN'");$c["ALTER COLUMN ".implode("",$X)][]="";}}}if($R=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (".implode(",",(array)$c["ADD"])."\n)");if($R!=$C)queries("EXEC sp_rename ".q(table($R)).", ".q($C));if($dd)$c[""]=$dd;foreach($c
|
|||
|
as$y=>$X){if(!queries("ALTER TABLE ".idf_escape($C)." $y".implode(",",$X)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($R,$c){$v=array();$gc=array();foreach($c
|
|||
|
as$X){if($X[2]=="DROP"){if($X[0]=="PRIMARY")$gc[]=idf_escape($X[1]);else$v[]=idf_escape($X[1])." ON ".table($R);}elseif(!queries(($X[0]!="PRIMARY"?"CREATE $X[0] ".($X[0]!="INDEX"?"INDEX ":"").idf_escape($X[1]!=""?$X[1]:uniqid($R."_"))." ON ".table($R):"ALTER TABLE ".table($R)." ADD PRIMARY KEY")." (".implode(", ",$X[2]).")"))return
|
|||
|
false;}return(!$v||queries("DROP INDEX ".implode(", ",$v)))&&(!$gc||queries("ALTER TABLE ".table($R)." DROP ".implode(", ",$gc)));}function
|
|||
|
last_id(){global$g;return$g->result("SELECT SCOPE_IDENTITY()");}function
|
|||
|
explain($g,$G){$g->query("SET SHOWPLAN_ALL ON");$I=$g->query($G);$g->query("SET SHOWPLAN_ALL OFF");return$I;}function
|
|||
|
found_rows($S,$Z){}function
|
|||
|
foreign_keys($R){$I=array();foreach(get_rows("EXEC sp_fkeys @fktable_name = ".q($R))as$J){$q=&$I[$J["FK_NAME"]];$q["table"]=$J["PKTABLE_NAME"];$q["source"][]=$J["FKCOLUMN_NAME"];$q["target"][]=$J["PKCOLUMN_NAME"];}return$I;}function
|
|||
|
truncate_tables($T){return
|
|||
|
apply_queries("TRUNCATE TABLE",$T);}function
|
|||
|
drop_views($Wi){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Wi)));}function
|
|||
|
drop_tables($T){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$T)));}function
|
|||
|
move_tables($T,$Wi,$Th){return
|
|||
|
apply_queries("ALTER SCHEMA ".idf_escape($Th)." TRANSFER",array_merge($T,$Wi));}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array();$K=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($C));$I=reset($K);if($I)$I["Statement"]=preg_replace('~^.+\s+AS\s+~isU','',$I["text"]);return$I;}function
|
|||
|
triggers($R){$I=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($R))as$J)$I[$J["name"]]=array($J["Timing"],$J["Event"]);return$I;}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$g;if($_GET["ns"]!="")return$_GET["ns"];return$g->result("SELECT SCHEMA_NAME()");}function
|
|||
|
set_schema($Xg){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,$I){return$I;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|scheme|sql|table|trigger|view|view_trigger)$~',$Qc);}$x="mssql";$zi=array();$Dh=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){$zi+=$X;$Dh[$y]=array_keys($X);}$Fi=array();$sf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$ld=array("len","lower","round","upper");$rd=array("avg","count","count distinct","max","min","sum");$nc=array(array("date|time"=>"getdate",),array("int|decimal|real|float|money|datetime"=>"+/-","char|text"=>"+",));}$fc['firebird']='Firebird (alpha)';if(isset($_GET["firebird"])){$eg=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($N,$V,$F){$this->_link=ibase_connect($N,$V,$F);if($this->_link){$Ji=explode(':',$N);$this->service_link=ibase_service_attach($Ji[0],$V,$F);$this->server_info=ibase_server_info($this->service_link,IBASE_SVC_SERVER_VERSION);}else{$this->errno=ibase_errcode();$this->error=ibase_errmsg();}return(bool)$this->_link;}function
|
|||
|
quote($Q){return"'".str_replace("'","''",$Q)."'";}function
|
|||
|
select_db($j){return($j=="domain");}function
|
|||
|
query($G,$_i=false){$H=ibase_query($G,$this->_link);if(!$H){$this->errno=ibase_errcode();$this->error=ibase_errmsg();return
|
|||
|
false;}$this->error="";if($H===true){$this->affected_rows=ibase_affected_rows($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H||!$H->num_rows)return
|
|||
|
false;$J=$H->fetch_row();return$J[$o];}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
__construct($H){$this->_result=$H;}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;$g=new
|
|||
|
Min_DB;$Hb=$b->credentials();if($g->connect($Hb[0],$Hb[1],$Hb[2]))return$g;return$g->error;}function
|
|||
|
get_databases($bd){return
|
|||
|
array("domain");}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){$I='';$I.=($z!==null?$M."FIRST $z".($D?" SKIP $D":""):"");$I.=" $G$Z";return$I;}function
|
|||
|
limit1($R,$G,$Z,$M="\n"){return
|
|||
|
limit($G,$Z,1,0,$M);}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$b;$Hb=$b->credentials();return$Hb[1];}function
|
|||
|
tables_list(){global$g;$G='SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0';$H=ibase_query($g->_link,$G);$I=array();while($J=ibase_fetch_assoc($H))$I[$J['RDB$RELATION_NAME']]='table';ksort($I);return$I;}function
|
|||
|
count_tables($k){return
|
|||
|
array();}function
|
|||
|
table_status($C="",$Pc=false){global$g;$I=array();$Mb=tables_list();foreach($Mb
|
|||
|
as$v=>$X){$v=trim($v);$I[$v]=array('Name'=>$v,'Engine'=>'standard',);if($C==$v)return$I[$v];}return$I;}function
|
|||
|
is_view($S){return
|
|||
|
false;}function
|
|||
|
fk_support($S){return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$S["Engine"]);}function
|
|||
|
fields($R){global$g;$I=array();$G='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($R).'
|
|||
|
ORDER BY r.RDB$FIELD_POSITION';$H=ibase_query($g->_link,$G);while($J=ibase_fetch_assoc($H))$I[trim($J['FIELD_NAME'])]=array("field"=>trim($J["FIELD_NAME"]),"full_type"=>trim($J["FIELD_TYPE"]),"type"=>trim($J["FIELD_SUB_TYPE"]),"default"=>trim($J['FIELD_DEFAULT_VALUE']),"null"=>(trim($J["FIELD_NOT_NULL_CONSTRAINT"])=="YES"),"auto_increment"=>'0',"collation"=>trim($J["FIELD_COLLATION"]),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"comment"=>trim($J["FIELD_DESCRIPTION"]),);return$I;}function
|
|||
|
indexes($R,$h=null){$I=array();return$I;}function
|
|||
|
foreign_keys($R){return
|
|||
|
array();}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($l){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($Xg){return
|
|||
|
true;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match("~^(columns|sql|status|table)$~",$Qc);}$x="firebird";$sf=array("=");$ld=array();$rd=array();$nc=array();}$fc["simpledb"]="SimpleDB";if(isset($_GET["simpledb"])){$eg=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($G,$_i=false){$Lf=array('SelectExpression'=>$G,'ConsistentRead'=>'true');if($this->next)$Lf['NextToken']=$this->next;$H=sdb_request_all('Select','Item',$Lf,$this->timeout);$this->timeout=0;if($H===false)return$H;if(preg_match('~^\s*SELECT\s+COUNT\(~i',$G)){$Hh=0;foreach($H
|
|||
|
as$ae)$Hh+=$ae->Attribute->Value;$H=array((object)array('Attribute'=>array((object)array('Name'=>'Count','Value'=>$Hh,))));}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
quote($Q){return"'".str_replace("'","''",$Q)."'";}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0;function
|
|||
|
__construct($H){foreach($H
|
|||
|
as$ae){$J=array();if($ae->Name!='')$J['itemName()']=(string)$ae->Name;foreach($ae->Attribute
|
|||
|
as$Ja){$C=$this->_processValue($Ja->Name);$Y=$this->_processValue($Ja->Value);if(isset($J[$C])){$J[$C]=(array)$J[$C];$J[$C][]=$Y;}else$J[$C]=$Y;}$this->_rows[]=$J;foreach($J
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
_processValue($qc){return(is_object($qc)&&$qc['encoding']=='base64'?base64_decode($qc):(string)$qc);}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$y=>$X)$I[$y]=$J[$y];next($this->_rows);return$I;}function
|
|||
|
fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
|
|||
|
array_values($I);}function
|
|||
|
fetch_field(){$ge=array_keys($this->_rows[0]);return(object)array('name'=>$ge[$this->_offset++]);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$hg="itemName()";function
|
|||
|
_chunkRequest($Ed,$wa,$Lf,$Fc=array()){global$g;foreach(array_chunk($Ed,25)as$ib){$Mf=$Lf;foreach($ib
|
|||
|
as$s=>$t){$Mf["Item.$s.ItemName"]=$t;foreach($Fc
|
|||
|
as$y=>$X)$Mf["Item.$s.$y"]=$X;}if(!sdb_request($wa,$Mf))return
|
|||
|
false;}$g->affected_rows=count($Ed);return
|
|||
|
true;}function
|
|||
|
_extractIds($R,$tg,$z){$I=array();if(preg_match_all("~itemName\(\) = (('[^']*+')+)~",$tg,$Ce))$I=array_map('idf_unescape',$Ce[1]);else{foreach(sdb_request_all('Select','Item',array('SelectExpression'=>'SELECT itemName() FROM '.table($R).$tg.($z?" LIMIT 1":"")))as$ae)$I[]=$ae->Name;}return$I;}function
|
|||
|
select($R,$L,$Z,$od,$xf=array(),$z=1,$E=0,$jg=false){global$g;$g->next=$_GET["next"];$I=parent::select($R,$L,$Z,$od,$xf,$z,$E,$jg);$g->next=0;return$I;}function
|
|||
|
delete($R,$tg,$z=0){return$this->_chunkRequest($this->_extractIds($R,$tg,$z),'BatchDeleteAttributes',array('DomainName'=>$R));}function
|
|||
|
update($R,$O,$tg,$z=0,$M="\n"){$Vb=array();$Sd=array();$s=0;$Ed=$this->_extractIds($R,$tg,$z);$t=idf_unescape($O["`itemName()`"]);unset($O["`itemName()`"]);foreach($O
|
|||
|
as$y=>$X){$y=idf_unescape($y);if($X=="NULL"||($t!=""&&array($t)!=$Ed))$Vb["Attribute.".count($Vb).".Name"]=$y;if($X!="NULL"){foreach((array)$X
|
|||
|
as$ce=>$W){$Sd["Attribute.$s.Name"]=$y;$Sd["Attribute.$s.Value"]=(is_array($X)?$W:idf_unescape($W));if(!$ce)$Sd["Attribute.$s.Replace"]="true";$s++;}}}$Lf=array('DomainName'=>$R);return(!$Sd||$this->_chunkRequest(($t!=""?array($t):$Ed),'BatchPutAttributes',$Lf,$Sd))&&(!$Vb||$this->_chunkRequest($Ed,'BatchDeleteAttributes',$Lf,$Vb));}function
|
|||
|
insert($R,$O){$Lf=array("DomainName"=>$R);$s=0;foreach($O
|
|||
|
as$C=>$Y){if($Y!="NULL"){$C=idf_unescape($C);if($C=="itemName()")$Lf["ItemName"]=idf_unescape($Y);else{foreach((array)$Y
|
|||
|
as$X){$Lf["Attribute.$s.Name"]=$C;$Lf["Attribute.$s.Value"]=(is_array($Y)?$X:idf_unescape($Y));$s++;}}}}return
|
|||
|
sdb_request('PutAttributes',$Lf);}function
|
|||
|
insertUpdate($R,$K,$hg){foreach($K
|
|||
|
as$O){if(!$this->update($R,$O,"WHERE `itemName()` = ".q($O["`itemName()`"])))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
begin(){return
|
|||
|
false;}function
|
|||
|
commit(){return
|
|||
|
false;}function
|
|||
|
rollback(){return
|
|||
|
false;}function
|
|||
|
slowQuery($G,$bi){$this->_conn->timeout=$bi;return$G;}}function
|
|||
|
connect(){global$b;list(,,$F)=$b->credentials();if($F!="")return
|
|||
|
lang(22);return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match('~sql~',$Qc);}function
|
|||
|
logged_user(){global$b;$Hb=$b->credentials();return$Hb[1];}function
|
|||
|
get_databases(){return
|
|||
|
array("domain");}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
tables_list(){global$g;$I=array();foreach(sdb_request_all('ListDomains','DomainName')as$R)$I[(string)$R]='table';if($g->error&&defined("PAGE_HEADER"))echo"<p class='error'>".error()."\n";return$I;}function
|
|||
|
table_status($C="",$Pc=false){$I=array();foreach(($C!=""?array($C=>true):tables_list())as$R=>$U){$J=array("Name"=>$R,"Auto_increment"=>"");if(!$Pc){$Pe=sdb_request('DomainMetadata',array('DomainName'=>$R));if($Pe){foreach(array("Rows"=>"ItemCount","Data_length"=>"ItemNamesSizeBytes","Index_length"=>"AttributeValuesSizeBytes","Data_free"=>"AttributeNamesSizeBytes",)as$y=>$X)$J[$y]=(string)$Pe->$X;}}if($C!="")return$J;$I[$R]=$J;}return$I;}function
|
|||
|
explain($g,$G){}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($S){}function
|
|||
|
indexes($R,$h=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("itemName()")),);}function
|
|||
|
fields($R){return
|
|||
|
fields_from_edit();}function
|
|||
|
foreign_keys($R){return
|
|||
|
array();}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){return" $G$Z".($z!==null?$M."LIMIT $z":"");}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
fk_support($S){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){return($R==""&&sdb_request('CreateDomain',array('DomainName'=>$C)));}function
|
|||
|
drop_tables($T){foreach($T
|
|||
|
as$R){if(!sdb_request('DeleteDomain',array('DomainName'=>$R)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
count_tables($k){foreach($k
|
|||
|
as$l)return
|
|||
|
array($l=>count(tables_list()));}function
|
|||
|
found_rows($S,$Z){return($Z?null:$S["Rows"]);}function
|
|||
|
last_id(){}function
|
|||
|
hmac($Ca,$Mb,$y,$xg=false){$Va=64;if(strlen($y)>$Va)$y=pack("H*",$Ca($y));$y=str_pad($y,$Va,"\0");$de=$y^str_repeat("\x36",$Va);$ee=$y^str_repeat("\x5C",$Va);$I=$Ca($ee.pack("H*",$Ca($de.$Mb)));if($xg)$I=pack("H*",$I);return$I;}function
|
|||
|
sdb_request($wa,$Lf=array()){global$b,$g;list($Bd,$Lf['AWSAccessKeyId'],$ah)=$b->credentials();$Lf['Action']=$wa;$Lf['Timestamp']=gmdate('Y-m-d\TH:i:s+00:00');$Lf['Version']='2009-04-15';$Lf['SignatureVersion']=2;$Lf['SignatureMethod']='HmacSHA1';ksort($Lf);$G='';foreach($Lf
|
|||
|
as$y=>$X)$G.='&'.rawurlencode($y).'='.rawurlencode($X);$G=str_replace('%7E','~',substr($G,1));$G.="&Signature=".urlencode(base64_encode(hmac('sha1',"POST\n".preg_replace('~^https?://~','',$Bd)."\n/\n$G",$ah,true)));@ini_set('track_errors',1);$Uc=@file_get_contents((preg_match('~^https?://~',$Bd)?$Bd:"http://$Bd"),false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$G,'ignore_errors'=>1,))));if(!$Uc){$g->error=$php_errormsg;return
|
|||
|
false;}libxml_use_internal_errors(true);$jj=simplexml_load_string($Uc);if(!$jj){$n=libxml_get_last_error();$g->error=$n->message;return
|
|||
|
false;}if($jj->Errors){$n=$jj->Errors->Error;$g->error="$n->Message ($n->Code)";return
|
|||
|
false;}$g->error='';$Sh=$wa."Result";return($jj->$Sh?$jj->$Sh:true);}function
|
|||
|
sdb_request_all($wa,$Sh,$Lf=array(),$bi=0){$I=array();$_h=($bi?microtime(true):0);$z=(preg_match('~LIMIT\s+(\d+)\s*$~i',$Lf['SelectExpression'],$B)?$B[1]:0);do{$jj=sdb_request($wa,$Lf);if(!$jj)break;foreach($jj->$Sh
|
|||
|
as$qc)$I[]=$qc;if($z&&count($I)>=$z){$_GET["next"]=$jj->NextToken;break;}if($bi&µtime(true)-$_h>$bi)return
|
|||
|
false;$Lf['NextToken']=$jj->NextToken;if($z)$Lf['SelectExpression']=preg_replace('~\d+\s*$~',$z-count($I),$Lf['SelectExpression']);}while($jj->NextToken);return$I;}$x="simpledb";$sf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","IS NOT NULL");$ld=array();$rd=array("count");$nc=array(array("json"));}$fc["mongo"]="MongoDB";if(isset($_GET["mongo"])){$eg=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($Hi,$vf){return@new
|
|||
|
MongoClient($Hi,$vf);}function
|
|||
|
query($G){return
|
|||
|
false;}function
|
|||
|
select_db($j){try{$this->_db=$this->_link->selectDB($j);return
|
|||
|
true;}catch(Exception$Bc){$this->error=$Bc->getMessage();return
|
|||
|
false;}}function
|
|||
|
quote($Q){return$Q;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
__construct($H){foreach($H
|
|||
|
as$ae){$J=array();foreach($ae
|
|||
|
as$y=>$X){if(is_a($X,'MongoBinData'))$this->_charset[$y]=63;$J[$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[]=$J;foreach($J
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$y=>$X)$I[$y]=$J[$y];next($this->_rows);return$I;}function
|
|||
|
fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
|
|||
|
array_values($I);}function
|
|||
|
fetch_field(){$ge=array_keys($this->_rows[0]);$C=$ge[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$hg="_id";function
|
|||
|
select($R,$L,$Z,$od,$xf=array(),$z=1,$E=0,$jg=false){$L=($L==array("*")?array():array_fill_keys($L,true));$rh=array();foreach($xf
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$Eb);$rh[$X]=($Eb?-1:1);}return
|
|||
|
new
|
|||
|
Min_Result($this->_conn->_db->selectCollection($R)->find(array(),$L)->sort($rh)->limit($z!=""?+$z:0)->skip($E*$z));}function
|
|||
|
insert($R,$O){try{$I=$this->_conn->_db->selectCollection($R)->insert($O);$this->_conn->errno=$I['code'];$this->_conn->error=$I['err'];$this->_conn->last_id=$O['_id'];return!$I['err'];}catch(Exception$Bc){$this->_conn->error=$Bc->getMessage();return
|
|||
|
false;}}}function
|
|||
|
get_databases($bd){global$g;$I=array();$Rb=$g->_link->listDBs();foreach($Rb['databases']as$l)$I[]=$l['name'];return$I;}function
|
|||
|
count_tables($k){global$g;$I=array();foreach($k
|
|||
|
as$l)$I[$l]=count($g->_link->selectDB($l)->getCollectionNames(true));return$I;}function
|
|||
|
tables_list(){global$g;return
|
|||
|
array_fill_keys($g->_db->getCollectionNames(true),'table');}function
|
|||
|
drop_databases($k){global$g;foreach($k
|
|||
|
as$l){$Jg=$g->_link->selectDB($l)->drop();if(!$Jg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
indexes($R,$h=null){global$g;$I=array();foreach($g->_db->selectCollection($R)->getIndexInfo()as$v){$Yb=array();foreach($v["key"]as$d=>$U)$Yb[]=($U==-1?'1':null);$I[$v["name"]]=array("type"=>($v["name"]=="_id_"?"PRIMARY":($v["unique"]?"UNIQUE":"INDEX")),"columns"=>array_keys($v["key"]),"lengths"=>array(),"descs"=>$Yb,);}return$I;}function
|
|||
|
fields($R){return
|
|||
|
fields_from_edit();}function
|
|||
|
found_rows($S,$Z){global$g;return$g->_db->selectCollection($_GET["select"])->count($Z);}$sf=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($Hi,$vf){$kb='MongoDB\Driver\Manager';return
|
|||
|
new$kb($Hi,$vf);}function
|
|||
|
query($G){return
|
|||
|
false;}function
|
|||
|
select_db($j){$this->_db_name=$j;return
|
|||
|
true;}function
|
|||
|
quote($Q){return$Q;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
__construct($H){foreach($H
|
|||
|
as$ae){$J=array();foreach($ae
|
|||
|
as$y=>$X){if(is_a($X,'MongoDB\BSON\Binary'))$this->_charset[$y]=63;$J[$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[]=$J;foreach($J
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=$H->count;}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$y=>$X)$I[$y]=$J[$y];next($this->_rows);return$I;}function
|
|||
|
fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
|
|||
|
array_values($I);}function
|
|||
|
fetch_field(){$ge=array_keys($this->_rows[0]);$C=$ge[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$hg="_id";function
|
|||
|
select($R,$L,$Z,$od,$xf=array(),$z=1,$E=0,$jg=false){global$g;$L=($L==array("*")?array():array_fill_keys($L,1));if(count($L)&&!isset($L['_id']))$L['_id']=0;$Z=where_to_query($Z);$rh=array();foreach($xf
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$Eb);$rh[$X]=($Eb?-1:1);}if(isset($_GET['limit'])&&is_numeric($_GET['limit'])&&$_GET['limit']>0)$z=$_GET['limit'];$z=min(200,max(1,(int)$z));$oh=$E*$z;$kb='MongoDB\Driver\Query';$G=new$kb($Z,array('projection'=>$L,'limit'=>$z,'skip'=>$oh,'sort'=>$rh));$Mg=$g->_link->executeQuery("$g->_db_name.$R",$G);return
|
|||
|
new
|
|||
|
Min_Result($Mg);}function
|
|||
|
update($R,$O,$tg,$z=0,$M="\n"){global$g;$l=$g->_db_name;$Z=sql_query_where_parser($tg);$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());if(isset($O['_id']))unset($O['_id']);$Gg=array();foreach($O
|
|||
|
as$y=>$Y){if($Y=='NULL'){$Gg[$y]=1;unset($O[$y]);}}$Gi=array('$set'=>$O);if(count($Gg))$Gi['$unset']=$Gg;$Za->update($Z,$Gi,array('upsert'=>false));$Mg=$g->_link->executeBulkWrite("$l.$R",$Za);$g->affected_rows=$Mg->getModifiedCount();return
|
|||
|
true;}function
|
|||
|
delete($R,$tg,$z=0){global$g;$l=$g->_db_name;$Z=sql_query_where_parser($tg);$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());$Za->delete($Z,array('limit'=>$z));$Mg=$g->_link->executeBulkWrite("$l.$R",$Za);$g->affected_rows=$Mg->getDeletedCount();return
|
|||
|
true;}function
|
|||
|
insert($R,$O){global$g;$l=$g->_db_name;$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());if(isset($O['_id'])&&empty($O['_id']))unset($O['_id']);$Za->insert($O);$Mg=$g->_link->executeBulkWrite("$l.$R",$Za);$g->affected_rows=$Mg->getInsertedCount();return
|
|||
|
true;}}function
|
|||
|
get_databases($bd){global$g;$I=array();$kb='MongoDB\Driver\Command';$tb=new$kb(array('listDatabases'=>1));$Mg=$g->_link->executeCommand('admin',$tb);foreach($Mg
|
|||
|
as$Rb){foreach($Rb->databases
|
|||
|
as$l)$I[]=$l->name;}return$I;}function
|
|||
|
count_tables($k){$I=array();return$I;}function
|
|||
|
tables_list(){global$g;$kb='MongoDB\Driver\Command';$tb=new$kb(array('listCollections'=>1));$Mg=$g->_link->executeCommand($g->_db_name,$tb);$rb=array();foreach($Mg
|
|||
|
as$H)$rb[$H->name]='table';return$rb;}function
|
|||
|
drop_databases($k){return
|
|||
|
false;}function
|
|||
|
indexes($R,$h=null){global$g;$I=array();$kb='MongoDB\Driver\Command';$tb=new$kb(array('listIndexes'=>$R));$Mg=$g->_link->executeCommand($g->_db_name,$tb);foreach($Mg
|
|||
|
as$v){$Yb=array();$e=array();foreach(get_object_vars($v->key)as$d=>$U){$Yb[]=($U==-1?'1':null);$e[]=$d;}$I[$v->name]=array("type"=>($v->name=="_id_"?"PRIMARY":(isset($v->unique)?"UNIQUE":"INDEX")),"columns"=>$e,"lengths"=>array(),"descs"=>$Yb,);}return$I;}function
|
|||
|
fields($R){$p=fields_from_edit();if(!count($p)){global$m;$H=$m->select($R,array("*"),null,null,array(),10);while($J=$H->fetch_assoc()){foreach($J
|
|||
|
as$y=>$X){$J[$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($S,$Z){global$g;$Z=where_to_query($Z);$kb='MongoDB\Driver\Command';$tb=new$kb(array('count'=>$S['Name'],'query'=>$Z));$Mg=$g->_link->executeCommand($g->_db_name,$tb);$ji=$Mg->toArray();return$ji[0]->n;}function
|
|||
|
sql_query_where_parser($tg){$tg=trim(preg_replace('/WHERE[\s]?[(]?\(?/','',$tg));$tg=preg_replace('/\)\)\)$/',')',$tg);$gj=explode(' AND ',$tg);$hj=explode(') OR (',$tg);$Z=array();foreach($gj
|
|||
|
as$ej)$Z[]=trim($ej);if(count($hj)==1)$hj=array();elseif(count($hj)>1)$Z=array();return
|
|||
|
where_to_query($Z,$hj);}function
|
|||
|
where_to_query($cj=array(),$dj=array()){global$b;$Mb=array();foreach(array('and'=>$cj,'or'=>$dj)as$U=>$Z){if(is_array($Z)){foreach($Z
|
|||
|
as$Ic){list($nb,$qf,$X)=explode(" ",$Ic,3);if($nb=="_id"){$X=str_replace('MongoDB\BSON\ObjectID("',"",$X);$X=str_replace('")',"",$X);$kb='MongoDB\BSON\ObjectID';$X=new$kb($X);}if(!in_array($qf,$b->operators))continue;if(preg_match('~^\(f\)(.+)~',$qf,$B)){$X=(float)$X;$qf=$B[1];}elseif(preg_match('~^\(date\)(.+)~',$qf,$B)){$Ob=new
|
|||
|
DateTime($X);$kb='MongoDB\BSON\UTCDatetime';$X=new$kb($Ob->getTimestamp()*1000);$qf=$B[1];}switch($qf){case'=':$qf='$eq';break;case'!=':$qf='$ne';break;case'>':$qf='$gt';break;case'<':$qf='$lt';break;case'>=':$qf='$gte';break;case'<=':$qf='$lte';break;case'regex':$qf='$regex';break;default:continue;}if($U=='and')$Mb['$and'][]=array($nb=>array($qf=>$X));elseif($U=='or')$Mb['$or'][]=array($nb=>array($qf=>$X));}}}return$Mb;}$sf=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($C="",$Pc=false){$I=array();foreach(tables_list()as$R=>$U){$I[$R]=array("Name"=>$R);if($C==$R)return$I[$R];}return$I;}function
|
|||
|
create_database($l,$pb){return
|
|||
|
true;}function
|
|||
|
last_id(){global$g;return$g->last_id;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$b;$Hb=$b->credentials();return$Hb[1];}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;list($N,$V,$F)=$b->credentials();$vf=array();if($V.$F!=""){$vf["username"]=$V;$vf["password"]=$F;}$l=$b->database();if($l!="")$vf["db"]=$l;try{$g->_link=$g->connect("mongodb://$N",$vf);if($F!=""){$vf["password"]="";try{$g->connect("mongodb://$N",$vf);return
|
|||
|
lang(22);}catch(Exception$Bc){}}return$g;}catch(Exception$Bc){return$Bc->getMessage();}}function
|
|||
|
alter_indexes($R,$c){global$g;foreach($c
|
|||
|
as$X){list($U,$C,$O)=$X;if($O=="DROP")$I=$g->_db->command(array("deleteIndexes"=>$R,"index"=>$C));else{$e=array();foreach($O
|
|||
|
as$d){$d=preg_replace('~ DESC$~','',$d,1,$Eb);$e[$d]=($Eb?-1:1);}$I=$g->_db->selectCollection($R)->ensureIndex($e,array("unique"=>($U=="UNIQUE"),"name"=>$C,));}if($I['errmsg']){$g->error=$I['errmsg'];return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match("~database|indexes~",$Qc);}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($S){}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
foreign_keys($R){return
|
|||
|
array();}function
|
|||
|
fk_support($S){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){global$g;if($R==""){$g->_db->createCollection($C);return
|
|||
|
true;}}function
|
|||
|
drop_tables($T){global$g;foreach($T
|
|||
|
as$R){$Jg=$g->_db->selectCollection($R)->drop();if(!$Jg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($T){global$g;foreach($T
|
|||
|
as$R){$Jg=$g->_db->selectCollection($R)->remove();if(!$Jg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}$x="mongo";$ld=array();$rd=array();$nc=array(array("json"));}$fc["elastic"]="Elasticsearch (beta)";if(isset($_GET["elastic"])){$eg=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($Vf,$_b=array(),$Qe='GET'){@ini_set('track_errors',1);$Uc=@file_get_contents("$this->_url/".ltrim($Vf,'/'),false,stream_context_create(array('http'=>array('method'=>$Qe,'content'=>$_b===null?$_b:json_encode($_b),'header'=>'Content-Type: application/json','ignore_errors'=>1,))));if(!$Uc){$this->error=$php_errormsg;return$Uc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Uc;return
|
|||
|
false;}$I=json_decode($Uc,true);if($I===null){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$zb=get_defined_constants(true);foreach($zb['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return$I;}function
|
|||
|
query($Vf,$_b=array(),$Qe='GET'){return$this->rootQuery(($this->_db!=""?"$this->_db/":"/").ltrim($Vf,'/'),$_b,$Qe);}function
|
|||
|
connect($N,$V,$F){preg_match('~^(https?://)?(.*)~',$N,$B);$this->_url=($B[1]?$B[1]:"http://")."$V:$F@$B[2]";$I=$this->query('');if($I)$this->server_info=$I['version']['number'];return(bool)$I;}function
|
|||
|
select_db($j){$this->_db=$j;return
|
|||
|
true;}function
|
|||
|
quote($Q){return$Q;}}class
|
|||
|
Min_Result{var$num_rows,$_rows;function
|
|||
|
__construct($K){$this->num_rows=count($this->_rows);$this->_rows=$K;reset($this->_rows);}function
|
|||
|
fetch_assoc(){$I=current($this->_rows);next($this->_rows);return$I;}function
|
|||
|
fetch_row(){return
|
|||
|
array_values($this->fetch_assoc());}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
select($R,$L,$Z,$od,$xf=array(),$z=1,$E=0,$jg=false){global$b;$Mb=array();$G="$R/_search";if($L!=array("*"))$Mb["fields"]=$L;if($xf){$rh=array();foreach($xf
|
|||
|
as$nb){$nb=preg_replace('~ DESC$~','',$nb,1,$Eb);$rh[]=($Eb?array($nb=>"desc"):$nb);}$Mb["sort"]=$rh;}if($z){$Mb["size"]=+$z;if($E)$Mb["from"]=($E*$z);}foreach($Z
|
|||
|
as$X){list($nb,$qf,$X)=explode(" ",$X,3);if($nb=="_id")$Mb["query"]["ids"]["values"][]=$X;elseif($nb.$X!=""){$Wh=array("term"=>array(($nb!=""?$nb:"_all")=>$X));if($qf=="=")$Mb["query"]["filtered"]["filter"]["and"][]=$Wh;else$Mb["query"]["filtered"]["query"]["bool"]["must"][]=$Wh;}}if($Mb["query"]&&!$Mb["query"]["filtered"]["query"]&&!$Mb["query"]["ids"])$Mb["query"]["filtered"]["query"]=array("match_all"=>array());$_h=microtime(true);$Zg=$this->_conn->query($G,$Mb);if($jg)echo$b->selectQuery("$G: ".print_r($Mb,true),$_h,!$Zg);if(!$Zg)return
|
|||
|
false;$I=array();foreach($Zg['hits']['hits']as$Ad){$J=array();if($L==array("*"))$J["_id"]=$Ad["_id"];$p=$Ad['_source'];if($L!=array("*")){$p=array();foreach($L
|
|||
|
as$y)$p[$y]=$Ad['fields'][$y];}foreach($p
|
|||
|
as$y=>$X){if($Mb["fields"])$X=$X[0];$J[$y]=(is_array($X)?json_encode($X):$X);}$I[]=$J;}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
update($U,$yg,$tg,$z=0,$M="\n"){$Tf=preg_split('~ *= *~',$tg);if(count($Tf)==2){$t=trim($Tf[1]);$G="$U/$t";return$this->_conn->query($G,$yg,'POST');}return
|
|||
|
false;}function
|
|||
|
insert($U,$yg){$t="";$G="$U/$t";$Jg=$this->_conn->query($G,$yg,'POST');$this->_conn->last_id=$Jg['_id'];return$Jg['created'];}function
|
|||
|
delete($U,$tg,$z=0){$Ed=array();if(is_array($_GET["where"])&&$_GET["where"]["_id"])$Ed[]=$_GET["where"]["_id"];if(is_array($_POST['check'])){foreach($_POST['check']as$db){$Tf=preg_split('~ *= *~',$db);if(count($Tf)==2)$Ed[]=trim($Tf[1]);}}$this->_conn->affected_rows=0;foreach($Ed
|
|||
|
as$t){$G="{$U}/{$t}";$Jg=$this->_conn->query($G,'{}','DELETE');if(is_array($Jg)&&$Jg['found']==true)$this->_conn->affected_rows++;}return$this->_conn->affected_rows;}}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;list($N,$V,$F)=$b->credentials();if($F!=""&&$g->connect($N,$V,""))return
|
|||
|
lang(22);if($g->connect($N,$V,$F))return$g;return$g->error;}function
|
|||
|
support($Qc){return
|
|||
|
preg_match("~database|table|columns~",$Qc);}function
|
|||
|
logged_user(){global$b;$Hb=$b->credentials();return$Hb[1];}function
|
|||
|
get_databases(){global$g;$I=$g->rootQuery('_aliases');if($I){$I=array_keys($I);sort($I,SORT_STRING);}return$I;}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($l,$qb){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
count_tables($k){global$g;$I=array();$H=$g->query('_stats');if($H&&$H['indices']){$Ld=$H['indices'];foreach($Ld
|
|||
|
as$Kd=>$Ah){$Jd=$Ah['total']['indexing'];$I[$Kd]=$Jd['index_total'];}}return$I;}function
|
|||
|
tables_list(){global$g;$I=$g->query('_mapping');if($I)$I=array_fill_keys(array_keys($I[$g->_db]["mappings"]),'table');return$I;}function
|
|||
|
table_status($C="",$Pc=false){global$g;$Zg=$g->query("_search",array("size"=>0,"aggregations"=>array("count_by_type"=>array("terms"=>array("field"=>"_type")))),"POST");$I=array();if($Zg){$T=$Zg["aggregations"]["count_by_type"]["buckets"];foreach($T
|
|||
|
as$R){$I[$R["key"]]=array("Name"=>$R["key"],"Engine"=>"table","Rows"=>$R["doc_count"],);if($C!=""&&$C==$R["key"])return$I[$C];}}return$I;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($S){}function
|
|||
|
indexes($R,$h=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("_id")),);}function
|
|||
|
fields($R){global$g;$H=$g->query("$R/_mapping");$I=array();if($H){$ze=$H[$R]['properties'];if(!$ze)$ze=$H[$g->_db]['mappings'][$R]['properties'];if($ze){foreach($ze
|
|||
|
as$C=>$o){$I[$C]=array("field"=>$C,"full_type"=>$o["type"],"type"=>$o["type"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);if($o["properties"]){unset($I[$C]["privileges"]["insert"]);unset($I[$C]["privileges"]["update"]);}}}}return$I;}function
|
|||
|
foreign_keys($R){return
|
|||
|
array();}function
|
|||
|
table($u){return$u;}function
|
|||
|
idf_escape($u){return$u;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
fk_support($S){}function
|
|||
|
found_rows($S,$Z){return
|
|||
|
null;}function
|
|||
|
create_database($l){global$g;return$g->rootQuery(urlencode($l),null,'PUT');}function
|
|||
|
drop_databases($k){global$g;return$g->rootQuery(urlencode(implode(',',$k)),array(),'DELETE');}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){global$g;$pg=array();foreach($p
|
|||
|
as$Nc){$Sc=trim($Nc[1][0]);$Tc=trim($Nc[1][1]?$Nc[1][1]:"text");$pg[$Sc]=array('type'=>$Tc);}if(!empty($pg))$pg=array('properties'=>$pg);return$g->query("_mapping/{$C}",$pg,'PUT');}function
|
|||
|
drop_tables($T){global$g;$I=true;foreach($T
|
|||
|
as$R)$I=$I&&$g->query(urlencode($R),array(),'DELETE');return$I;}function
|
|||
|
last_id(){global$g;return$g->last_id;}$x="elastic";$sf=array("=","query");$ld=array();$rd=array();$nc=array(array("json"));$zi=array();$Dh=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){$zi+=$X;$Dh[$y]=array_keys($X);}}$fc=array("server"=>"MySQL")+$fc;if(!defined("DRIVER")){$eg=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($N="",$V="",$F="",$j=null,$ag=null,$qh=null){global$b;mysqli_report(MYSQLI_REPORT_OFF);list($Bd,$ag)=explode(":",$N,2);$zh=$b->connectSsl();if($zh)$this->ssl_set($zh['key'],$zh['cert'],$zh['ca'],'','');$I=@$this->real_connect(($N!=""?$Bd:ini_get("mysqli.default_host")),($N.$V!=""?$V:ini_get("mysqli.default_user")),($N.$V.$F!=""?$F:ini_get("mysqli.default_pw")),$j,(is_numeric($ag)?$ag:ini_get("mysqli.default_port")),(!is_numeric($ag)?$ag:$qh),($zh?64:0));$this->options(MYSQLI_OPT_LOCAL_INFILE,false);return$I;}function
|
|||
|
set_charset($cb){if(parent::set_charset($cb))return
|
|||
|
true;parent::set_charset('utf8');return$this->query("SET NAMES $cb");}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H)return
|
|||
|
false;$J=$H->fetch_array();return$J[$o];}function
|
|||
|
quote($Q){return"'".$this->escape_string($Q)."'";}}}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($N,$V,$F){if(ini_bool("mysql.allow_local_infile")){$this->error=lang(32,"'mysql.allow_local_infile'","MySQLi","PDO_MySQL");return
|
|||
|
false;}$this->_link=@mysql_connect(($N!=""?$N:ini_get("mysql.default_host")),("$N$V"!=""?$V:ini_get("mysql.default_user")),("$N$V$F"!=""?$F:ini_get("mysql.default_password")),true,131072);if($this->_link)$this->server_info=mysql_get_server_info($this->_link);else$this->error=mysql_error();return(bool)$this->_link;}function
|
|||
|
set_charset($cb){if(function_exists('mysql_set_charset')){if(mysql_set_charset($cb,$this->_link))return
|
|||
|
true;mysql_set_charset('utf8',$this->_link);}return$this->query("SET NAMES $cb");}function
|
|||
|
quote($Q){return"'".mysql_real_escape_string($Q,$this->_link)."'";}function
|
|||
|
select_db($j){return
|
|||
|
mysql_select_db($j,$this->_link);}function
|
|||
|
query($G,$_i=false){$H=@($_i?mysql_unbuffered_query($G,$this->_link):mysql_query($G,$this->_link));$this->error="";if(!$H){$this->errno=mysql_errno($this->_link);$this->error=mysql_error($this->_link);return
|
|||
|
false;}if($H===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H||!$H->num_rows)return
|
|||
|
false;return
|
|||
|
mysql_result($H->_result,0,$o);}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
__construct($H){$this->_result=$H;$this->num_rows=mysql_num_rows($H);}function
|
|||
|
fetch_assoc(){return
|
|||
|
mysql_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
mysql_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$I=mysql_fetch_field($this->_result,$this->_offset++);$I->orgtable=$I->table;$I->orgname=$I->name;$I->charsetnr=($I->blob?63:0);return$I;}function
|
|||
|
__destruct(){mysql_free_result($this->_result);}}}elseif(extension_loaded("pdo_mysql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_MySQL";function
|
|||
|
connect($N,$V,$F){global$b;$vf=array(PDO::MYSQL_ATTR_LOCAL_INFILE=>false);$zh=$b->connectSsl();if($zh)$vf+=array(PDO::MYSQL_ATTR_SSL_KEY=>$zh['key'],PDO::MYSQL_ATTR_SSL_CERT=>$zh['cert'],PDO::MYSQL_ATTR_SSL_CA=>$zh['ca'],);$this->dsn("mysql:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\d)~',';port=\1',$N)),$V,$F,$vf);return
|
|||
|
true;}function
|
|||
|
set_charset($cb){$this->query("SET NAMES $cb");}function
|
|||
|
select_db($j){return$this->query("USE ".idf_escape($j));}function
|
|||
|
query($G,$_i=false){$this->setAttribute(1000,!$_i);return
|
|||
|
parent::query($G,$_i);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insert($R,$O){return($O?parent::insert($R,$O):queries("INSERT INTO ".table($R)." ()\nVALUES ()"));}function
|
|||
|
insertUpdate($R,$K,$hg){$e=array_keys(reset($K));$fg="INSERT INTO ".table($R)." (".implode(", ",$e).") VALUES\n";$Ri=array();foreach($e
|
|||
|
as$y)$Ri[$y]="$y = VALUES($y)";$Gh="\nON DUPLICATE KEY UPDATE ".implode(", ",$Ri);$Ri=array();$te=0;foreach($K
|
|||
|
as$O){$Y="(".implode(", ",$O).")";if($Ri&&(strlen($fg)+$te+strlen($Y)+strlen($Gh)>1e6)){if(!queries($fg.implode(",\n",$Ri).$Gh))return
|
|||
|
false;$Ri=array();$te=0;}$Ri[]=$Y;$te+=strlen($Y)+2;}return
|
|||
|
queries($fg.implode(",\n",$Ri).$Gh);}function
|
|||
|
slowQuery($G,$bi){if(min_version('5.7.8','10.1.2')){if(preg_match('~MariaDB~',$this->_conn->server_info))return"SET STATEMENT max_statement_time=$bi FOR $G";elseif(preg_match('~^(SELECT\b)(.+)~is',$G,$B))return"$B[1] /*+ MAX_EXECUTION_TIME(".($bi*1000).") */ $B[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(){$H=$this->_conn->query("SHOW WARNINGS");if($H&&$H->num_rows){ob_start();select($H);return
|
|||
|
ob_get_clean();}}function
|
|||
|
tableHelp($C){$_e=preg_match('~MariaDB~',$this->_conn->server_info);if(information_schema(DB))return
|
|||
|
strtolower(($_e?"information-schema-$C-table/":str_replace("_","-",$C)."-table.html"));if(DB=="mysql")return($_e?"mysql$C-table/":"system-database.html");}}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b,$zi,$Dh;$g=new
|
|||
|
Min_DB;$Hb=$b->credentials();if($g->connect($Hb[0],$Hb[1],$Hb[2])){$g->set_charset(charset($g));$g->query("SET sql_quote_show_create = 1, autocommit = 1");if(min_version('5.7.8',10.2,$g)){$Dh[lang(25)][]="json";$zi["json"]=4294967295;}return$g;}$I=$g->error;if(function_exists('iconv')&&!is_utf8($I)&&strlen($Vg=iconv("windows-1250","utf-8",$I))>strlen($I))$I=$Vg;return$I;}function
|
|||
|
get_databases($bd){$I=get_session("dbs");if($I===null){$G=(min_version(5)?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME":"SHOW DATABASES");$I=($bd?slow_query($G):get_vals($G));restart_session();set_session("dbs",$I);stop_session();}return$I;}function
|
|||
|
limit($G,$Z,$z,$D=0,$M=" "){return" $G$Z".($z!==null?$M."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($R,$G,$Z,$M="\n"){return
|
|||
|
limit($G,$Z,1,0,$M);}function
|
|||
|
db_collation($l,$qb){global$g;$I=null;$i=$g->result("SHOW CREATE DATABASE ".idf_escape($l),1);if(preg_match('~ COLLATE ([^ ]+)~',$i,$B))$I=$B[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$i,$B))$I=$qb[$B[1]][-1];return$I;}function
|
|||
|
engines(){$I=array();foreach(get_rows("SHOW ENGINES")as$J){if(preg_match("~YES|DEFAULT~",$J["Support"]))$I[]=$J["Engine"];}return$I;}function
|
|||
|
logged_user(){global$g;return$g->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){$I=array();foreach($k
|
|||
|
as$l)$I[$l]=count(get_vals("SHOW TABLES IN ".idf_escape($l)));return$I;}function
|
|||
|
table_status($C="",$Pc=false){$I=array();foreach(get_rows($Pc&&min_version(5)?"SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ".($C!=""?"AND TABLE_NAME = ".q($C):"ORDER BY Name"):"SHOW TABLE STATUS".($C!=""?" LIKE ".q(addcslashes($C,"%_\\")):""))as$J){if($J["Engine"]=="InnoDB")$J["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\1',$J["Comment"]);if(!isset($J["Engine"]))$J["Comment"]="";if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
|
|||
|
is_view($S){return$S["Engine"]===null;}function
|
|||
|
fk_support($S){return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$S["Engine"])||(preg_match('~NDB~i',$S["Engine"])&&min_version(5.6));}function
|
|||
|
fields($R){$I=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($R))as$J){preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~',$J["Type"],$B);$I[$J["Field"]]=array("field"=>$J["Field"],"full_type"=>$J["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($J["Default"]!=""||preg_match("~char|set~",$B[1])?$J["Default"]:null),"null"=>($J["Null"]=="YES"),"auto_increment"=>($J["Extra"]=="auto_increment"),"on_update"=>(preg_match('~^on update (.+)~i',$J["Extra"],$B)?$B[1]:""),"collation"=>$J["Collation"],"privileges"=>array_flip(preg_split('~, *~',$J["Privileges"])),"comment"=>$J["Comment"],"primary"=>($J["Key"]=="PRI"),);}return$I;}function
|
|||
|
indexes($R,$h=null){$I=array();foreach(get_rows("SHOW INDEX FROM ".table($R),$h)as$J){$C=$J["Key_name"];$I[$C]["type"]=($C=="PRIMARY"?"PRIMARY":($J["Index_type"]=="FULLTEXT"?"FULLTEXT":($J["Non_unique"]?($J["Index_type"]=="SPATIAL"?"SPATIAL":"INDEX"):"UNIQUE")));$I[$C]["columns"][]=$J["Column_name"];$I[$C]["lengths"][]=($J["Index_type"]=="SPATIAL"?null:$J["Sub_part"]);$I[$C]["descs"][]=null;}return$I;}function
|
|||
|
foreign_keys($R){global$g,$nf;static$Xf='`(?:[^`]|``)+`';$I=array();$Fb=$g->result("SHOW CREATE TABLE ".table($R),1);if($Fb){preg_match_all("~CONSTRAINT ($Xf) FOREIGN KEY ?\\(((?:$Xf,? ?)+)\\) REFERENCES ($Xf)(?:\\.($Xf))? \\(((?:$Xf,? ?)+)\\)(?: ON DELETE ($nf))?(?: ON UPDATE ($nf))?~",$Fb,$Ce,PREG_SET_ORDER);foreach($Ce
|
|||
|
as$B){preg_match_all("~$Xf~",$B[2],$sh);preg_match_all("~$Xf~",$B[5],$Th);$I[idf_unescape($B[1])]=array("db"=>idf_unescape($B[4]!=""?$B[3]:$B[4]),"table"=>idf_unescape($B[4]!=""?$B[4]:$B[3]),"source"=>array_map('idf_unescape',$sh[0]),"target"=>array_map('idf_unescape',$Th[0]),"on_delete"=>($B[6]?$B[6]:"RESTRICT"),"on_update"=>($B[7]?$B[7]:"RESTRICT"),);}}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU','',$g->result("SHOW CREATE VIEW ".table($C),1)));}function
|
|||
|
collations(){$I=array();foreach(get_rows("SHOW COLLATION")as$J){if($J["Default"])$I[$J["Charset"]][-1]=$J["Collation"];else$I[$J["Charset"]][]=$J["Collation"];}ksort($I);foreach($I
|
|||
|
as$y=>$X)asort($I[$y]);return$I;}function
|
|||
|
information_schema($l){return(min_version(5)&&$l=="information_schema")||(min_version(5.5)&&$l=="performance_schema");}function
|
|||
|
error(){global$g;return
|
|||
|
h(preg_replace('~^You have an error.*syntax to use~U',"Syntax error",$g->error));}function
|
|||
|
create_database($l,$pb){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($l).($pb?" COLLATE ".q($pb):""));}function
|
|||
|
drop_databases($k){$I=apply_queries("DROP DATABASE",$k,'idf_escape');restart_session();set_session("dbs",null);return$I;}function
|
|||
|
rename_database($C,$pb){$I=false;if(create_database($C,$pb)){$Hg=array();foreach(tables_list()as$R=>$U)$Hg[]=table($R)." TO ".idf_escape($C).".".table($R);$I=(!$Hg||queries("RENAME TABLE ".implode(", ",$Hg)));if($I)queries("DROP DATABASE ".idf_escape(DB));restart_session();set_session("dbs",null);}return$I;}function
|
|||
|
auto_increment(){$Na=" 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)){$Na="";break;}if($v["type"]=="PRIMARY")$Na=" UNIQUE";}}return" AUTO_INCREMENT$Na";}function
|
|||
|
alter_table($R,$C,$p,$dd,$vb,$vc,$pb,$Ma,$Rf){$c=array();foreach($p
|
|||
|
as$o)$c[]=($o[1]?($R!=""?($o[0]!=""?"CHANGE ".idf_escape($o[0]):"ADD"):" ")." ".implode($o[1]).($R!=""?$o[2]:""):"DROP ".idf_escape($o[0]));$c=array_merge($c,$dd);$P=($vb!==null?" COMMENT=".q($vb):"").($vc?" ENGINE=".q($vc):"").($pb?" COLLATE ".q($pb):"").($Ma!=""?" AUTO_INCREMENT=$Ma":"");if($R=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)$P$Rf");if($R!=$C)$c[]="RENAME TO ".table($C);if($P)$c[]=ltrim($P);return($c||$Rf?queries("ALTER TABLE ".table($R)."\n".implode(",\n",$c).$Rf):true);}function
|
|||
|
alter_indexes($R,$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($R).implode(",",$c));}function
|
|||
|
truncate_tables($T){return
|
|||
|
apply_queries("TRUNCATE TABLE",$T);}function
|
|||
|
drop_views($Wi){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Wi)));}function
|
|||
|
drop_tables($T){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$T)));}function
|
|||
|
move_tables($T,$Wi,$Th){$Hg=array();foreach(array_merge($T,$Wi)as$R)$Hg[]=table($R)." TO ".idf_escape($Th).".".table($R);return
|
|||
|
queries("RENAME TABLE ".implode(", ",$Hg));}function
|
|||
|
copy_tables($T,$Wi,$Th){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($T
|
|||
|
as$R){$C=($Th==DB?table("copy_$R"):idf_escape($Th).".".table($R));if(!queries("\nDROP TABLE IF EXISTS $C")||!queries("CREATE TABLE $C LIKE ".table($R))||!queries("INSERT INTO $C SELECT * FROM ".table($R)))return
|
|||
|
false;foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($R,"%_\\")))as$J){$ti=$J["Trigger"];if(!queries("CREATE TRIGGER ".($Th==DB?idf_escape("copy_$ti"):idf_escape($Th).".".idf_escape($ti))." $J[Timing] $J[Event] ON $C FOR EACH ROW\n$J[Statement];"))return
|
|||
|
false;}}foreach($Wi
|
|||
|
as$R){$C=($Th==DB?table("copy_$R"):idf_escape($Th).".".table($R));$Vi=view($R);if(!queries("DROP VIEW IF EXISTS $C")||!queries("CREATE VIEW $C AS $Vi[select]"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array();$K=get_rows("SHOW TRIGGERS WHERE `Trigger` = ".q($C));return
|
|||
|
reset($K);}function
|
|||
|
triggers($R){$I=array();foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($R,"%_\\")))as$J)$I[$J["Trigger"]]=array($J["Timing"],$J["Event"]);return$I;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
|
|||
|
routine($C,$U){global$g,$xc,$Qd,$zi;$Da=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$th="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$yi="((".implode("|",array_merge(array_keys($zi),$Da)).")\\b(?:\\s*\\(((?:[^'\")]|$xc)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";$Xf="$th*(".($U=="FUNCTION"?"":$Qd).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$yi";$i=$g->result("SHOW CREATE $U ".idf_escape($C),2);preg_match("~\\(((?:$Xf\\s*,?)*)\\)\\s*".($U=="FUNCTION"?"RETURNS\\s+$yi\\s+":"")."(.*)~is",$i,$B);$p=array();preg_match_all("~$Xf\\s*,?~is",$B[1],$Ce,PREG_SET_ORDER);foreach($Ce
|
|||
|
as$Kf){$C=str_replace("``","`",$Kf[2]).$Kf[3];$p[]=array("field"=>$C,"type"=>strtolower($Kf[5]),"length"=>preg_replace_callback("~$xc~s",'normalize_enum',$Kf[6]),"unsigned"=>strtolower(preg_replace('~\s+~',' ',trim("$Kf[8] $Kf[7]"))),"null"=>1,"full_type"=>$Kf[4],"inout"=>strtoupper($Kf[1]),"collation"=>strtolower($Kf[9]),);}if($U!="FUNCTION")return
|
|||
|
array("fields"=>$p,"definition"=>$B[11]);return
|
|||
|
array("fields"=>$p,"returns"=>array("type"=>$B[12],"length"=>$B[13],"unsigned"=>$B[15],"collation"=>$B[16]),"definition"=>$B[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($C,$J){return
|
|||
|
idf_escape($C);}function
|
|||
|
last_id(){global$g;return$g->result("SELECT LAST_INSERT_ID()");}function
|
|||
|
explain($g,$G){return$g->query("EXPLAIN ".(min_version(5.1)?"PARTITIONS ":"").$G);}function
|
|||
|
found_rows($S,$Z){return($Z||$S["Engine"]!="InnoDB"?null:$S["Rows"]);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($Xg){return
|
|||
|
true;}function
|
|||
|
create_sql($R,$Ma,$Eh){global$g;$I=$g->result("SHOW CREATE TABLE ".table($R),1);if(!$Ma)$I=preg_replace('~ AUTO_INCREMENT=\d+~','',$I);return$I;}function
|
|||
|
truncate_sql($R){return"TRUNCATE ".table($R);}function
|
|||
|
use_sql($j){return"USE ".idf_escape($j);}function
|
|||
|
trigger_sql($R){$I="";foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($R,"%_\\")),null,"-- ")as$J)$I.="\nCREATE TRIGGER ".idf_escape($J["Trigger"])." $J[Timing] $J[Event] ON ".table($J["Table"])." FOR EACH ROW\n$J[Statement];;\n";return$I;}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,$I){if(preg_match("~binary~",$o["type"]))$I="UNHEX($I)";if($o["type"]=="bit")$I="CONV($I, 2, 10) + 0";if(preg_match("~geometry|point|linestring|polygon~",$o["type"]))$I=(min_version(8)?"ST_":"")."GeomFromText($I)";return$I;}function
|
|||
|
support($Qc){return!preg_match("~scheme|sequence|type|view_trigger|materializedview".(min_version(5.1)?"":"|event|partitioning".(min_version(5)?"":"|routine|trigger|view"))."~",$Qc);}function
|
|||
|
kill_process($X){return
|
|||
|
queries("KILL ".number($X));}function
|
|||
|
connection_id(){return"SELECT CONNECTION_ID()";}function
|
|||
|
max_connections(){global$g;return$g->result("SELECT @@max_connections");}$x="sql";$zi=array();$Dh=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){$zi+=$X;$Dh[$y]=array_keys($X);}$Fi=array("unsigned","zerofill","unsigned zerofill");$sf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","FIND_IN_SET","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$ld=array("char_length","date","from_unixtime","lower","round","floor","ceil","sec_to_time","time_to_sec","upper");$rd=array("avg","count","count distinct","group_concat","max","min","sum");$nc=array(array("char"=>"md5/sha1/password/encrypt/uuid","binary"=>"md5/sha1","date|time"=>"now",),array(number_type()=>"+/-","date"=>"+ interval/- interval","time"=>"addtime/subtime","char|text"=>"concat",));}define("SERVER",$_GET[DRIVER]);define("DB",$_GET["db"]);define("ME",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.6.3";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($i=false){return
|
|||
|
password_file($i);}function
|
|||
|
bruteForceKey(){return$_SERVER["REMOTE_ADDR"];}function
|
|||
|
serverName($N){return
|
|||
|
h($N);}function
|
|||
|
database(){return
|
|||
|
DB;}function
|
|||
|
databases($bd=true){return
|
|||
|
get_databases($bd);}function
|
|||
|
schemas(){return
|
|||
|
schemas();}function
|
|||
|
queryTimeout(){return
|
|||
|
2;}function
|
|||
|
headers(){}function
|
|||
|
csp(){return
|
|||
|
csp();}function
|
|||
|
head(){return
|
|||
|
true;}function
|
|||
|
css(){$I=array();$Vc="adminer.css";if(file_exists($Vc))$I[]=$Vc;return$I;}function
|
|||
|
loginForm(){global$fc;echo"<table cellspacing='0'>\n",$this->loginFormField('driver','<tr><th>'.lang(34).'<td>',html_select("auth[driver]",$fc,DRIVER)."\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"]).'" autocapitalize="off">'.script("focus(qs('#username'));")),$this->loginFormField('password','<tr><th>'.lang(37).'<td>','<input type="password" name="auth[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($C,$yd,$Y){return$yd.$Y;}function
|
|||
|
login($xe,$F){if($F=="")return
|
|||
|
lang(41,target_blank());return
|
|||
|
true;}function
|
|||
|
tableName($Kh){return
|
|||
|
h($Kh["Name"]);}function
|
|||
|
fieldName($o,$xf=0){return'<span title="'.h($o["full_type"]).'">'.h($o["field"]).'</span>';}function
|
|||
|
selectLinks($Kh,$O=""){global$x,$m;echo'<p class="links">';$we=array("select"=>lang(42));if(support("table")||support("indexes"))$we["table"]=lang(43);if(support("table")){if(is_view($Kh))$we["view"]=lang(44);else$we["create"]=lang(45);}if($O!==null)$we["edit"]=lang(46);$C=$Kh["Name"];foreach($we
|
|||
|
as$y=>$X)echo" <a href='".h(ME)."$y=".urlencode($C).($y=="edit"?$O:"")."'".bold(isset($_GET[$y])).">$X</a>";echo
|
|||
|
doc_link(array($x=>$m->tableHelp($C)),"?"),"\n";}function
|
|||
|
foreignKeys($R){return
|
|||
|
foreign_keys($R);}function
|
|||
|
backwardKeys($R,$Jh){return
|
|||
|
array();}function
|
|||
|
backwardKeysPrint($Pa,$J){}function
|
|||
|
selectQuery($G,$_h,$Oc=false){global$x,$m;$I="</p>\n";if(!$Oc&&($Zi=$m->warnings())){$t="warnings";$I=", <a href='#$t'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$t');","")."$I<div id='$t' class='hidden'>\n$Zi</div>\n";}return"<p><code class='jush-$x'>".h(str_replace("\n"," ",$G))."</code> <span class='time'>(".format_time($_h).")</span>".(support("sql")?" <a href='".h(ME)."sql=".urlencode($G)."'>".lang(10)."</a>":"").$I;}function
|
|||
|
sqlCommandQuery($G){return
|
|||
|
shorten_utf8(trim($G),1000);}function
|
|||
|
rowDescription($R){return"";}function
|
|||
|
rowDescriptions($K,$ed){return$K;}function
|
|||
|
selectLink($X,$o){}function
|
|||
|
selectVal($X,$_,$o,$Ef){$I=($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))$I="<i>".lang(48,strlen($Ef))."</i>";if(preg_match('~json~',$o["type"]))$I="<code class='jush-js'>$I</code>";return($_?"<a href='".h($_)."'".(is_url($_)?target_blank():"").">$I</a>":$I);}function
|
|||
|
editVal($X,$o){return$X;}function
|
|||
|
tableStructurePrint($p){echo"<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";}function
|
|||
|
tableIndexesPrint($w){echo"<table cellspacing='0'>\n";foreach($w
|
|||
|
as$C=>$v){ksort($v["columns"]);$jg=array();foreach($v["columns"]as$y=>$X)$jg[]="<i>".h($X)."</i>".($v["lengths"][$y]?"(".$v["lengths"][$y].")":"").($v["descs"][$y]?" DESC":"");echo"<tr title='".h($C)."'><th>$v[type]<td>".implode(", ",$jg)."\n";}echo"</table>\n";}function
|
|||
|
selectColumnsPrint($L,$e){global$ld,$rd;print_fieldset("select",lang(54),$L);$s=0;$L[""]=array();foreach($L
|
|||
|
as$y=>$X){$X=$_GET["columns"][$y];$d=select_input(" name='columns[$s][col]'",$e,$X["col"],($y!==""?"selectFieldChange":"selectAddRow"));echo"<div>".($ld||$rd?"<select name='columns[$s][fun]'>".optionlist(array(-1=>"")+array_filter(array(lang(55)=>$ld,lang(56)=>$rd)),$X["fun"])."</select>".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).script("qsl('select').onchange = function () { helpClose();".($y!==""?"":" qsl('select, input', this.parentNode).onchange();")." };","")."($d)":$d)."</div>\n";$s++;}echo"</div></fieldset>\n";}function
|
|||
|
selectSearchPrint($Z,$e,$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";}}$bb="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]'",$e,$X["col"],($X?"selectFieldChange":"selectAddRow"),"(".lang(58).")"),html_select("where[$s][op]",$this->operators,$X["op"],$bb),"<input type='search' name='where[$s][val]' value='".h($X["val"])."'>",script("mixin(qsl('input'), {oninput: function () { $bb }, onkeydown: selectSearchKeydown, onsearch: selectSearchSearch});",""),"</div>\n";}}echo"</div></fieldset>\n";}function
|
|||
|
selectOrderPrint($xf,$e,$w){print_fieldset("sort",lang(59),$xf);$s=0;foreach((array)$_GET["order"]as$y=>$X){if($X!=""){echo"<div>".select_input(" name='order[$s]'",$e,$X,"selectFieldChange"),checkbox("desc[$s]",1,isset($_GET["desc"][$y]),lang(60))."</div>\n";$s++;}}echo"<div>".select_input(" name='order[$s]'",$e,"","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($Zh){if($Zh!==null){echo"<fieldset><legend>".lang(62)."</legend><div>","<input type='number' name='text_length' class='size' value='".h($Zh)."'>","</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 = ";$e=array();foreach($w
|
|||
|
as$v){$Lb=reset($v["columns"]);if($v["type"]!="FULLTEXT"&&$Lb)$e[$Lb]=1;}$e[""]=1;foreach($e
|
|||
|
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($sc,$e){}function
|
|||
|
selectColumnsProcess($e,$w){global$ld,$rd;$L=array();$od=array();foreach((array)$_GET["columns"]as$y=>$X){if($X["fun"]=="count"||($X["col"]!=""&&(!$X["fun"]||in_array($X["fun"],$ld)||in_array($X["fun"],$rd)))){$L[$y]=apply_sql_function($X["fun"],($X["col"]!=""?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$rd))$od[]=$L[$y];}}return
|
|||
|
array($L,$od);}function
|
|||
|
selectSearchProcess($p,$w){global$g,$m;$I=array();foreach($w
|
|||
|
as$s=>$v){if($v["type"]=="FULLTEXT"&&$_GET["fulltext"][$s]!="")$I[]="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)){$fg="";$xb=" $X[op]";if(preg_match('~IN$~',$X["op"])){$Gd=process_length($X["val"]);$xb.=" ".($Gd!=""?$Gd:"(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"){$fg="$X[op](".q($X["val"]).", ";$xb=")";}elseif(!preg_match('~NULL$~',$X["op"]))$xb.=" ".$this->processInput($p[$X["col"]],$X["val"]);if($X["col"]!="")$I[]=$fg.$m->convertSearch(idf_escape($X["col"]),$X,$p[$X["col"]]).$xb;else{$sb=array();foreach($p
|
|||
|
as$C=>$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[]=$fg.$m->convertSearch(idf_escape($C),$X,$o).$xb;}$I[]=($sb?"(".implode(" OR ",$sb).")":"1 = 0");}}}return$I;}function
|
|||
|
selectOrderProcess($p,$w){$I=array();foreach((array)$_GET["order"]as$y=>$X){if($X!="")$I[]=(preg_match('~^((COUNT\(DISTINCT |[A-Z0-9_]+\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\)|COUNT\(\*\))$~',$X)?$X:idf_escape($X)).(isset($_GET["desc"][$y])?" DESC":"");}return$I;}function
|
|||
|
selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"50");}function
|
|||
|
selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
|
|||
|
selectEmailProcess($Z,$ed){return
|
|||
|
false;}function
|
|||
|
selectQueryBuild($L,$Z,$od,$xf,$z,$E){return"";}function
|
|||
|
messageQuery($G,$ai,$Oc=false){global$x,$m;restart_session();$zd=&get_session("queries");if(!$zd[$_GET["db"]])$zd[$_GET["db"]]=array();if(strlen($G)>1e6)$G=preg_replace('~[\x80-\xFF]+$~','',substr($G,0,1e6))."\n...";$zd[$_GET["db"]][]=array($G,time(),$ai);$xh="sql-".count($zd[$_GET["db"]]);$I="<a href='#$xh' class='toggle'>".lang(65)."</a>\n";if(!$Oc&&($Zi=$m->warnings())){$t="warnings-".count($zd[$_GET["db"]]);$I="<a href='#$t' class='toggle'>".lang(47)."</a>, $I<div id='$t' class='hidden'>\n$Zi</div>\n";}return" <span class='time'>".@date("H:i:s")."</span>"." $I<div id='$xh' class='hidden'><pre><code class='jush-$x'>".shorten_utf8($G,1000)."</code></pre>".($ai?" <span class='time'>($ai)</span>":'').(support("sql")?'<p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($zd[$_GET["db"]])-1)).'">'.lang(10).'</a>':'').'</div>';}function
|
|||
|
editFunctions($o){global$nc;$I=($o["null"]?"NULL/":"");foreach($nc
|
|||
|
as$y=>$ld){if(!$y||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($ld
|
|||
|
as$Xf=>$X){if(!$Xf||preg_match("~$Xf~",$o["type"]))$I.="/$X";}if($y&&!preg_match('~set|blob|bytea|raw|file~',$o["type"]))$I.="/SQL";}}if($o["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$I=lang(52);return
|
|||
|
explode("/",$I);}function
|
|||
|
editInput($R,$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($R,$o,$Y){return"";}function
|
|||
|
processInput($o,$Y,$r=""){if($r=="SQL")return$Y;$C=$o["field"];$I=q($Y);if(preg_match('~^(now|getdate|uuid)$~',$r))$I="$r()";elseif(preg_match('~^current_(date|timestamp)$~',$r))$I=$r;elseif(preg_match('~^([+-]|\|\|)$~',$r))$I=idf_escape($C)." $r $I";elseif(preg_match('~^[+-] interval$~',$r))$I=idf_escape($C)." $r ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+\$~i",$Y)?$Y:$I);elseif(preg_match('~^(addtime|subtime|concat)$~',$r))$I="$r(".idf_escape($C).", $I)";elseif(preg_match('~^(md5|sha1|password|encrypt)$~',$r))$I="$r($I)";return
|
|||
|
unconvert_field($o,$I);}function
|
|||
|
dumpOutput(){$I=array('text'=>lang(66),'file'=>lang(67));if(function_exists('gzencode'))$I['gz']='gzip';return$I;}function
|
|||
|
dumpFormat(){return
|
|||
|
array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
|
|||
|
dumpDatabase($l){}function
|
|||
|
dumpTable($R,$Eh,$Zd=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($Eh)dump_csv(array_keys(fields($R)));}else{if($Zd==2){$p=array();foreach(fields($R)as$C=>$o)$p[]=idf_escape($C)." $o[full_type]";$i="CREATE TABLE ".table($R)." (".implode(", ",$p).")";}else$i=create_sql($R,$_POST["auto_increment"],$Eh);set_utf8mb4($i);if($Eh&&$i){if($Eh=="DROP+CREATE"||$Zd==1)echo"DROP ".($Zd==2?"VIEW":"TABLE")." IF EXISTS ".table($R).";\n";if($Zd==1)$i=remove_definer($i);echo"$i;\n\n";}}}function
|
|||
|
dumpData($R,$Eh,$G){global$g,$x;$Ee=($x=="sqlite"?0:1048576);if($Eh){if($_POST["format"]=="sql"){if($Eh=="TRUNCATE+INSERT")echo
|
|||
|
truncate_sql($R).";\n";$p=fields($R);}$H=$g->query($G,1);if($H){$Sd="";$Ya="";$ge=array();$Gh="";$Rc=($R!=''?'fetch_assoc':'fetch_row');while($J=$H->$Rc()){if(!$ge){$Ri=array();foreach($J
|
|||
|
as$X){$o=$H->fetch_field();$ge[]=$o->name;$y=idf_escape($o->name);$Ri[]="$y = VALUES($y)";}$Gh=($Eh=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Ri):"").";\n";}if($_POST["format"]!="sql"){if($Eh=="table"){dump_csv($ge);$Eh="INSERT";}dump_csv($J);}else{if(!$Sd)$Sd="INSERT INTO ".table($R)." (".implode(", ",array_map('idf_escape',$ge)).") VALUES";foreach($J
|
|||
|
as$y=>$X){$o=$p[$y];$J[$y]=($X!==null?unconvert_field($o,preg_match(number_type(),$o["type"])&&$X!=''?$X:q(($X===false?0:$X))):"NULL");}$Vg=($Ee?"\n":" ")."(".implode(",\t",$J).")";if(!$Ya)$Ya=$Sd.$Vg;elseif(strlen($Ya)+4+strlen($Vg)+strlen($Gh)<$Ee)$Ya.=",$Vg";else{echo$Ya.$Gh;$Ya=$Sd.$Vg;}}}if($Ya)echo$Ya.$Gh;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$g->error)."\n";}}function
|
|||
|
dumpFilename($Dd){return
|
|||
|
friendly_url($Dd!=""?$Dd:(SERVER!=""?SERVER:"localhost"));}function
|
|||
|
dumpHeaders($Dd,$Te=false){$Hf=$_POST["output"];$Jc=(preg_match('~sql~',$_POST["format"])?"sql":($Te?"tar":"csv"));header("Content-Type: ".($Hf=="gz"?"application/x-gzip":($Jc=="tar"?"application/x-tar":($Jc=="sql"||$Hf!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($Hf=="gz")ob_start('ob_gzencode',1e6);return$Jc;}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($Se){global$ia,$x,$fc,$g;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($Se=="auth"){$Xc=true;foreach((array)$_SESSION["pwds"]as$Ti=>$jh){foreach($jh
|
|||
|
as$N=>$Oi){foreach($Oi
|
|||
|
as$V=>$F){if($F!==null){if($Xc){echo"<p id='logins'>".script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});");$Xc=false;}$Rb=$_SESSION["db"][$Ti][$N][$V];foreach(($Rb?array_keys($Rb):array(""))as$l)echo"<a href='".h(auth_url($Ti,$N,$V,$l))."'>($fc[$Ti]) ".h($V.($N!=""?"@".$this->serverName($N):"").($l!=""?" - $l":""))."</a><br>\n";}}}}}else{if($_GET["ns"]!==""&&!$Se&&DB!=""){$g->select_db(DB);$T=table_status('',true);}echo
|
|||
|
script_src(preg_replace("~\\?.*~","",ME)."?file=jush.js&version=4.6.3");if(support("sql")){echo'<script',nonce(),'>
|
|||
|
';if($T){$we=array();foreach($T
|
|||
|
as$R=>$U)$we[]=preg_quote($R,'/');echo"var jushLinks = { $x: [ '".js_escape(ME).(support("table")?"table=":"select=")."\$&', /\\b(".implode("|",$we).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$x;\n";}$ih=$g->server_info;echo'bodyLoad(\'',(is_object($g)?preg_replace('~^(\d\.?\d).*~s','\1',$ih):""),'\'',(preg_match('~MariaDB~',$ih)?", true":""),');
|
|||
|
</script>
|
|||
|
';}$this->databasesPrint($Se);if(DB==""||!$Se){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"]!==""&&!$Se&&DB!=""){echo'<a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".lang(75)."</a>\n";if(!$T)echo"<p class='message'>".lang(9)."\n";else$this->tablesPrint($T);}}}function
|
|||
|
databasesPrint($Se){global$b,$g;$k=$this->databases();if($k&&!in_array(DB,$k))array_unshift($k,DB);echo'<form action="">
|
|||
|
<p id="dbs">
|
|||
|
';hidden_fields_get();$Pb=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>$Pb":"<input name='db' value='".h(DB)."' autocapitalize='off'>\n"),"<input type='submit' value='".lang(20)."'".($k?" class='hidden'":"").">\n";if($Se!="db"&&DB!=""&&$g->select_db(DB)){if(support("scheme")){echo"<br>".lang(78).": <select name='ns'>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>$Pb";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($T){echo"<ul id='tables'>".script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");foreach($T
|
|||
|
as$R=>$P){$C=$this->tableName($P);if($C!=""){echo'<li><a href="'.h(ME).'select='.urlencode($R).'"'.bold($_GET["select"]==$R||$_GET["edit"]==$R,"select").">".lang(79)."</a> ",(support("table")||support("indexes")?'<a href="'.h(ME).'table='.urlencode($R).'"'.bold(in_array($R,array($_GET["table"],$_GET["create"],$_GET["indexes"],$_GET["foreign"],$_GET["trigger"])),(is_view($P)?"view":"structure"))." title='".lang(43)."'>$C</a>":"<span>$C</span>")."\n";}}echo"</ul>\n";}}$b=(function_exists('adminer_object')?adminer_object():new
|
|||
|
Adminer);if($b->operators===null)$b->operators=$sf;function
|
|||
|
page_header($di,$n="",$Xa=array(),$ei=""){global$ca,$ia,$b,$fc,$x;page_headers();if(is_ajax()&&$n){page_messages($n);exit;}$fi=$di.($ei!=""?": $ei":"");$gi=strip_tags($fi.(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>',$gi,'</title>
|
|||
|
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME)."?file=default.css&version=4.6.3"),'">
|
|||
|
',script_src(preg_replace("~\\?.*~","",ME)."?file=functions.js&version=4.6.3");if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.6.3"),'">
|
|||
|
<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.6.3"),'">
|
|||
|
';foreach($b->css()as$Jb){echo'<link rel="stylesheet" type="text/css" href="',h($Jb),'">
|
|||
|
';}}echo'
|
|||
|
<body class="',lang(80),' nojs">
|
|||
|
';$Vc=get_temp_dir()."/adminer.version";if(!$_COOKIE["adminer_version"]&&function_exists('openssl_verify')&&file_exists($Vc)&&filemtime($Vc)+86400>time()){$Ui=unserialize(file_get_contents($Vc));$qg="-----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($Ui["version"],base64_decode($Ui["signature"]),$qg)==1)$_COOKIE["adminer_version"]=$Ui["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($Xa!==null){$_=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($_?$_:".").'">'.$fc[DRIVER].'</a> » ';$_=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$N=$b->serverName(SERVER);$N=($N!=""?$N:lang(35));if($Xa===false)echo"$N\n";else{echo"<a href='".($_?h($_):".")."' accesskey='1' title='Alt+Shift+1'>$N</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Xa)))echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> » ';if(is_array($Xa)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> » ';foreach($Xa
|
|||
|
as$y=>$X){$Xb=(is_array($X)?$X[1]:h($X));if($Xb!="")echo"<a href='".h(ME."$y=").urlencode(is_array($X)?$X[0]:$X)."'>$Xb</a> » ";}}echo"$di\n";}}echo"<h2>$fi</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$Ib){$xd=array();foreach($Ib
|
|||
|
as$y=>$X)$xd[]="$y $X";header("Content-Security-Policy: ".implode("; ",$xd));}$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$cf;if(!$cf)$cf=base64_encode(rand_string());return$cf;}function
|
|||
|
page_messages($n){$Hi=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Oe=$_SESSION["messages"][$Hi];if($Oe){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Oe)."</div>".script("messagesPrint();");unset($_SESSION["messages"][$Hi]);}if($n)echo"<div class='error'>$n</div>\n";}function
|
|||
|
page_footer($Se=""){global$b,$ki;echo'</div>
|
|||
|
|
|||
|
';switch_lang();if($Se!="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="',$ki,'">
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
';}echo'<div id="menu">
|
|||
|
';$b->navigation($Se);echo'</div>
|
|||
|
',script("setupSubmitHighlight(document);");}function
|
|||
|
int32($Ve){while($Ve>=2147483648)$Ve-=4294967296;while($Ve<=-2147483649)$Ve+=4294967296;return(int)$Ve;}function
|
|||
|
long2str($W,$Yi){$Vg='';foreach($W
|
|||
|
as$X)$Vg.=pack('V',$X);if($Yi)return
|
|||
|
substr($Vg,0,end($W));return$Vg;}function
|
|||
|
str2long($Vg,$Yi){$W=array_values(unpack('V*',str_pad($Vg,4*ceil(strlen($Vg)/4),"\0")));if($Yi)$W[]=strlen($Vg);return$W;}function
|
|||
|
xxtea_mx($lj,$kj,$Hh,$ce){return
|
|||
|
int32((($lj>>5&0x7FFFFFF)^$kj<<2)+(($kj>>3&0x1FFFFFFF)^$lj<<4))^int32(($Hh^$kj)+($ce^$lj));}function
|
|||
|
encrypt_string($Ch,$y){if($Ch=="")return"";$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Ch,true);$Ve=count($W)-1;$lj=$W[$Ve];$kj=$W[0];$rg=floor(6+52/($Ve+1));$Hh=0;while($rg-->0){$Hh=int32($Hh+0x9E3779B9);$mc=$Hh>>2&3;for($If=0;$If<$Ve;$If++){$kj=$W[$If+1];$Ue=xxtea_mx($lj,$kj,$Hh,$y[$If&3^$mc]);$lj=int32($W[$If]+$Ue);$W[$If]=$lj;}$kj=$W[0];$Ue=xxtea_mx($lj,$kj,$Hh,$y[$If&3^$mc]);$lj=int32($W[$Ve]+$Ue);$W[$Ve]=$lj;}return
|
|||
|
long2str($W,false);}function
|
|||
|
decrypt_string($Ch,$y){if($Ch=="")return"";if(!$y)return
|
|||
|
false;$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($Ch,false);$Ve=count($W)-1;$lj=$W[$Ve];$kj=$W[0];$rg=floor(6+52/($Ve+1));$Hh=int32($rg*0x9E3779B9);while($Hh){$mc=$Hh>>2&3;for($If=$Ve;$If>0;$If--){$lj=$W[$If-1];$Ue=xxtea_mx($lj,$kj,$Hh,$y[$If&3^$mc]);$kj=int32($W[$If]-$Ue);$W[$If]=$kj;}$lj=$W[$Ve];$Ue=xxtea_mx($lj,$kj,$Hh,$y[$If&3^$mc]);$kj=int32($W[0]-$Ue);$W[0]=$kj;$Hh=int32($Hh-0x9E3779B9);}return
|
|||
|
long2str($W,true);}$g='';$wd=$_SESSION["token"];if(!$wd)$_SESSION["token"]=rand(1,1e6);$ki=get_token();$Yf=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($y)=explode(":",$X);$Yf[$y]=$X;}}function
|
|||
|
add_invalid_login(){global$b;$jd=file_open_lock(get_temp_dir()."/adminer.invalid");if(!$jd)return;$Vd=unserialize(stream_get_contents($jd));$ai=time();if($Vd){foreach($Vd
|
|||
|
as$Wd=>$X){if($X[0]<$ai)unset($Vd[$Wd]);}}$Ud=&$Vd[$b->bruteForceKey()];if(!$Ud)$Ud=array($ai+30*60,0);$Ud[1]++;file_write_unlock($jd,serialize($Vd));}function
|
|||
|
check_invalid_login(){global$b;$Vd=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$Ud=$Vd[$b->bruteForceKey()];$bf=($Ud[1]>29?$Ud[0]-time():0);if($bf>0)auth_error(lang(83,ceil($bf/60)));}$La=$_POST["auth"];if($La){session_regenerate_id();$Ti=$La["driver"];$N=$La["server"];$V=$La["username"];$F=(string)$La["password"];$l=$La["db"];set_password($Ti,$N,$V,$F);$_SESSION["db"][$Ti][$N][$V][$l]=true;if($La["permanent"]){$y=base64_encode($Ti)."-".base64_encode($N)."-".base64_encode($V)."-".base64_encode($l);$kg=$b->permanentLogin(true);$Yf[$y]="$y:".base64_encode($kg?encrypt_string($F,$kg):"");cookie("adminer_permanent",implode(" ",$Yf));}if(count($_POST)==1||DRIVER!=$Ti||SERVER!=$N||$_GET["username"]!==$V||DB!=$l)redirect(auth_url($Ti,$N,$V,$l));}elseif($_POST["logout"]){if($wd&&!verify_token()){page_header(lang(82),lang(84));page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$y)set_session($y,null);unset_permanent();redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1),lang(85).' '.lang(86,'https://sourceforge.net/donate/index.php?group_id=264133'));}}elseif($Yf&&!$_SESSION["pwds"]){session_regenerate_id();$kg=$b->permanentLogin();foreach($Yf
|
|||
|
as$y=>$X){list(,$jb)=explode(":",$X);list($Ti,$N,$V,$l)=array_map('base64_decode',explode("-",$y));set_password($Ti,$N,$V,decrypt_string(base64_decode($jb),$kg));$_SESSION["db"][$Ti][$N][$V][$l]=true;}}function
|
|||
|
unset_permanent(){global$Yf;foreach($Yf
|
|||
|
as$y=>$X){list($Ti,$N,$V,$l)=array_map('base64_decode',explode("-",$y));if($Ti==DRIVER&&$N==SERVER&&$V==$_GET["username"]&&$l==DB)unset($Yf[$y]);}cookie("adminer_permanent",implode(" ",$Yf));}function
|
|||
|
auth_error($n){global$b,$wd;$kh=session_name();if(isset($_GET["username"])){header("HTTP/1.1 403 Forbidden");if(($_COOKIE[$kh]||$_GET[$kh])&&!$wd)$n=lang(87);else{restart_session();add_invalid_login();$F=get_password();if($F!==null){if($F===false)$n.='<br>'.lang(88,target_blank(),'<code>permanentLogin()</code>');set_password(DRIVER,SERVER,$_GET["username"],null);}unset_permanent();}}if(!$_COOKIE[$kh]&&$_GET[$kh]&&ini_bool("session.use_only_cookies"))$n=lang(89);$Lf=session_get_cookie_params();cookie("adminer_key",($_COOKIE["adminer_key"]?$_COOKIE["adminer_key"]:rand_string()),$Lf["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(", ",$eg)),false);page_footer("auth");exit;}stop_session(true);if(isset($_GET["username"])){list($Bd,$ag)=explode(":",SERVER,2);if(is_numeric($ag)&&$ag<1024)auth_error(lang(93));check_invalid_login();$g=connect();$m=new
|
|||
|
Min_Driver($g);}$xe=null;if(!is_object($g)||($xe=$b->login($_GET["username"],get_password()))!==true)auth_error((is_string($g)?h($g):(is_string($xe)?$xe:lang(94))));if($La&&$_POST["token"])$_POST["token"]=$ki;$n='';if($_POST){if(!verify_token()){$Pd="max_input_vars";$Ie=ini_get($Pd);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$y){$X=ini_get($y);if($X&&(!$Ie||$X<$Ie)){$Pd=$y;$Ie=$X;}}}$n=(!$_POST["token"]&&$Ie?lang(95,"'$Pd'"):lang(84).' '.lang(96));}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$n=lang(97,"'post_max_size'");if(isset($_GET["sql"]))$n.=' '.lang(98);}function
|
|||
|
select($H,$h=null,$_f=array(),$z=0){global$x;$we=array();$w=array();$e=array();$Ua=array();$zi=array();$I=array();odd('');for($s=0;(!$z||$s<$z)&&($J=$H->fetch_row());$s++){if(!$s){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($be=0;$be<count($J);$be++){$o=$H->fetch_field();$C=$o->name;$zf=$o->orgtable;$yf=$o->orgname;$I[$o->table]=$zf;if($_f&&$x=="sql")$we[$be]=($C=="table"?"table=":($C=="possible_keys"?"indexes=":null));elseif($zf!=""){if(!isset($w[$zf])){$w[$zf]=array();foreach(indexes($zf,$h)as$v){if($v["type"]=="PRIMARY"){$w[$zf]=array_flip($v["columns"]);break;}}$e[$zf]=$w[$zf];}if(isset($e[$zf][$yf])){unset($e[$zf][$yf]);$w[$zf][$yf]=$be;$we[$be]=$zf;}}if($o->charsetnr==63)$Ua[$be]=true;$zi[$be]=$o->type;echo"<th".($zf!=""||$o->name!=$yf?" title='".h(($zf!=""?"$zf.":"").$yf)."'":"").">".h($C).($_f?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($C),'mariadb'=>"explain/#the-columns-in-explain-select",)):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($J
|
|||
|
as$y=>$X){if($X===null)$X="<i>NULL</i>";elseif($Ua[$y]&&!is_utf8($X))$X="<i>".lang(48,strlen($X))."</i>";else{$X=h($X);if($zi[$y]==254)$X="<code>$X</code>";}if(isset($we[$y])&&!$e[$we[$y]]){if($_f&&$x=="sql"){$R=$J[array_search("table=",$we)];$_=$we[$y].urlencode($_f[$R]!=""?$_f[$R]:$R);}else{$_="edit=".urlencode($we[$y]);foreach($w[$we[$y]]as$nb=>$be)$_.="&where".urlencode("[".bracket_escape($nb)."]")."=".urlencode($J[$be]);}$X="<a href='".h(ME.$_)."'>$X</a>";}echo"<td>$X";}}echo($s?"</table>":"<p class='message'>".lang(12))."\n";return$I;}function
|
|||
|
referencable_primary($eh){$I=array();foreach(table_status('',true)as$Lh=>$R){if($Lh!=$eh&&fk_support($R)){foreach(fields($Lh)as$o){if($o["primary"]){if($I[$Lh]){unset($I[$Lh]);break;}$I[$Lh]=$o;}}}}return$I;}function
|
|||
|
textarea($C,$Y,$K=10,$sb=80){global$x;echo"<textarea name='$C' rows='$K' 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,$fd=array(),$Mc=array()){global$Dh,$zi,$Fi,$nf;$U=$o["type"];echo'<td><select name="',h($y),'[type]" class="type" aria-labelledby="label-type">';if($U&&!isset($zi[$U])&&!isset($fd[$U])&&!in_array($U,$Mc))$Mc[]=$U;if($fd)$Dh[lang(99)]=$fd;echo
|
|||
|
optionlist(array_merge($Mc,$Dh),$U),'</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)$~',$U)?" 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)$~',$U)?"":" class='hidden'").'><option value="">('.lang(100).')'.optionlist($qb,$o["collation"]).'</select>',($Fi?"<select name='".h($y)."[unsigned]'".(!$U||preg_match(number_type(),$U)?"":" class='hidden'").'><option>'.optionlist($Fi,$o["unsigned"]).'</select>':''),(isset($o['on_update'])?"<select name='".h($y)."[on_update]'".(preg_match('~timestamp|datetime~',$U)?"":" class='hidden'").'>'.optionlist(array(""=>"(".lang(101).")","CURRENT_TIMESTAMP"),$o["on_update"]).'</select>':''),($fd?"<select name='".h($y)."[on_delete]'".(preg_match("~`~",$U)?"":" class='hidden'")."><option value=''>(".lang(102).")".optionlist(explode("|",$nf),$o["on_delete"])."</select> ":" ");}function
|
|||
|
process_length($te){global$xc;return(preg_match("~^\\s*\\(?\\s*$xc(?:\\s*,\\s*$xc)*+\\s*\\)?\\s*\$~",$te)&&preg_match_all("~$xc~",$te,$Ce)?"(".implode(",",$Ce[0]).")":preg_replace('~^[0-9].*~','(\0)',preg_replace('~[^-0-9,+()[\]]~','',$te)));}function
|
|||
|
process_type($o,$ob="COLLATE"){global$Fi;return" $o[type]".process_length($o["length"]).(preg_match(number_type(),$o["type"])&&in_array($o["unsigned"],$Fi)?" $o[unsigned]":"").(preg_match('~char|text|enum|set~',$o["type"])&&$o["collation"]?" $ob ".q($o["collation"]):"");}function
|
|||
|
process_field($o,$xi){return
|
|||
|
array(idf_escape(trim($o["field"])),process_type($xi),($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){$Tb=$o["default"];return($Tb===null?"":" DEFAULT ".(preg_match('~char|binary|text|enum|set~',$o["type"])||preg_match('~^(?![a-z])~i',$Tb)?q($Tb):$Tb));}function
|
|||
|
type_class($U){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$y=>$X){if(preg_match("~$y|$X~",$U))return" class='$y'";}}function
|
|||
|
edit_fields($p,$qb,$U="TABLE",$fd=array(),$wb=false){global$Qd;$p=array_values($p);echo'<thead><tr>
|
|||
|
';if($U=="PROCEDURE"){echo'<td>';}echo'<th id="label-name">',($U=="TABLE"?lang(103):lang(104)),'<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(105),'<td>',lang(106);if($U=="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'".($wb?"":" class='hidden'").">".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.6.3")."' alt='+' title='".lang(107)."'>".script("row_count = ".count($p).";"),'</thead>
|
|||
|
<tbody>
|
|||
|
',script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown, oninput: editingInput});");foreach($p
|
|||
|
as$s=>$o){$s++;$Af=$o[($_POST?"orig":"field")];$bc=(isset($_POST["add"][$s-1])||(isset($o["field"])&&!$_POST["drop_col"][$s]))&&(support("drop_col")||$Af=="");echo'<tr',($bc?"":" style='display: none;'"),'>
|
|||
|
',($U=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$Qd),$o["inout"]):""),'<th>';if($bc){echo'<input name="fields[',$s,'][field]" value="',h($o["field"]),'" 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($Af),'">
|
|||
|
';edit_type("fields[$s]",$o,$qb,$fd);if($U=="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".($wb?"":" class='hidden'")."><input name='fields[$s][comment]' value='".h($o["comment"])."' 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.6.3")."' alt='+' title='".lang(107)."'> "."<input type='image' class='icon' name='up[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=up.gif&version=4.6.3")."' alt='↑' title='".lang(108)."'> "."<input type='image' class='icon' name='down[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=down.gif&version=4.6.3")."' alt='↓' title='".lang(109)."'> ":""),($Af==""||support("drop_col")?"<input type='image' class='icon' name='drop_col[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.6.3")."' alt='x' title='".lang(110)."'>":"");}}function
|
|||
|
process_fields(&$p){$D=0;if($_POST["up"]){$ne=0;foreach($p
|
|||
|
as$y=>$o){if(key($_POST["up"])==$y){unset($p[$y]);array_splice($p,$ne,0,array($o));break;}if(isset($o["field"]))$ne=$D;$D++;}}elseif($_POST["down"]){$hd=false;foreach($p
|
|||
|
as$y=>$o){if(isset($o["field"])&&$hd){unset($p[key($_POST["down"])]);array_splice($p,$D,0,array($hd));break;}if(key($_POST["down"])==$y)$hd=$o;$D++;}}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($B){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($B[0][0].$B[0][0],$B[0][0],substr($B[0],1,-1))),'\\'))."'";}function
|
|||
|
grant($md,$mg,$e,$mf){if(!$mg)return
|
|||
|
true;if($mg==array("ALL PRIVILEGES","GRANT OPTION"))return($md=="GRANT"?queries("$md ALL PRIVILEGES$mf WITH GRANT OPTION"):queries("$md ALL PRIVILEGES$mf")&&queries("$md GRANT OPTION$mf"));return
|
|||
|
queries("$md ".preg_replace('~(GRANT OPTION)\([^)]*\)~','\1',implode("$e, ",$mg).$e).$mf);}function
|
|||
|
drop_create($gc,$i,$hc,$Xh,$jc,$A,$Ne,$Le,$Me,$jf,$Ye){if($_POST["drop"])query_redirect($gc,$A,$Ne);elseif($jf=="")query_redirect($i,$A,$Me);elseif($jf!=$Ye){$Gb=queries($i);queries_redirect($A,$Le,$Gb&&queries($gc));if($Gb)queries($hc);}else
|
|||
|
queries_redirect($A,$Le,queries($Xh)&&queries($jc)&&queries($gc)&&queries($i));}function
|
|||
|
create_trigger($mf,$J){global$x;$ci=" $J[Timing] $J[Event]".($J["Event"]=="UPDATE OF"?" ".idf_escape($J["Of"]):"");return"CREATE TRIGGER ".idf_escape($J["Trigger"]).($x=="mssql"?$mf.$ci:$ci.$mf).rtrim(" $J[Type]\n$J[Statement]",";").";";}function
|
|||
|
create_routine($Rg,$J){global$Qd,$x;$O=array();$p=(array)$J["fields"];ksort($p);foreach($p
|
|||
|
as$o){if($o["field"]!="")$O[]=(preg_match("~^($Qd)\$~",$o["inout"])?"$o[inout] ":"").idf_escape($o["field"]).process_type($o,"CHARACTER SET");}$Ub=rtrim("\n$J[definition]",";");return"CREATE $Rg ".idf_escape(trim($J["name"]))." (".implode(", ",$O).")".(isset($_GET["function"])?" RETURNS".process_type($J["returns"],"CHARACTER SET"):"").($J["language"]?" LANGUAGE $J[language]":"").($x=="pgsql"?" AS ".q($Ub):"$Ub;");}function
|
|||
|
remove_definer($G){return
|
|||
|
preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\1)',logged_user()).'`~','\1',$G);}function
|
|||
|
format_foreign_key($q){global$nf;return" FOREIGN KEY (".implode(", ",array_map('idf_escape',$q["source"])).") REFERENCES ".table($q["table"])." (".implode(", ",array_map('idf_escape',$q["target"])).")".(preg_match("~^($nf)\$~",$q["on_delete"])?" ON DELETE $q[on_delete]":"").(preg_match("~^($nf)\$~",$q["on_update"])?" ON UPDATE $q[on_update]":"");}function
|
|||
|
tar_file($Vc,$hi){$I=pack("a100a8a8a8a12a12",$Vc,644,0,0,decoct($hi->size),decoct(time()));$hb=8*32;for($s=0;$s<strlen($I);$s++)$hb+=ord($I[$s]);$I.=sprintf("%06o",$hb)."\0 ";echo$I,str_repeat("\0",512-strlen($I));$hi->send();echo
|
|||
|
str_repeat("\0",511-($hi->size+511)%512);}function
|
|||
|
ini_bytes($Pd){$X=ini_get($Pd);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}function
|
|||
|
doc_link($Wf,$Yh="<sup>?</sup>"){global$x,$g;$ih=$g->server_info;$Ui=preg_replace('~^(\d\.?\d).*~s','\1',$ih);$Ki=array('sql'=>"https://dev.mysql.com/doc/refman/$Ui/en/",'sqlite'=>"https://www.sqlite.org/",'pgsql'=>"https://www.postgresql.org/docs/$Ui/static/",'mssql'=>"https://msdn.microsoft.com/library/",'oracle'=>"https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",);if(preg_match('~MariaDB~',$ih)){$Ki['sql']="https://mariadb.com/kb/en/library/";$Wf['sql']=(isset($Wf['mariadb'])?$Wf['mariadb']:str_replace(".html","/",$Wf['sql']));}return($Wf[$x]?"<a href='$Ki[$x]$Wf[$x]'".target_blank().">$Yh</a>":"");}function
|
|||
|
ob_gzencode($Q){return
|
|||
|
gzencode($Q);}function
|
|||
|
db_size($l){global$g;if(!$g->select_db($l))return"?";$I=0;foreach(table_status()as$S)$I+=$S["Data_length"]+$S["Index_length"];return
|
|||
|
format_number($I);}function
|
|||
|
set_utf8mb4($i){global$g;static$O=false;if(!$O&&preg_match('~\butf8mb4~i',$i)){$O=true;echo"SET NAMES ".charset($g).";\n\n";}}function
|
|||
|
connect_error(){global$b,$g,$ki,$n,$fc;if(DB!=""){header("HTTP/1.1 404 Not Found");page_header(lang(38).": ".h(DB),lang(111),true);}else{if($_POST["db"]&&!$n)queries_redirect(substr(ME,0,-1),lang(112),drop_databases($_POST["db"]));page_header(lang(113),$n,false);echo"<p class='links'>\n";foreach(array('database'=>lang(114),'privileges'=>lang(72),'processlist'=>lang(115),'variables'=>lang(116),'status'=>lang(117),)as$y=>$X){if(support($y))echo"<a href='".h(ME)."$y='>$X</a>\n";}echo"<p>".lang(118,$fc[DRIVER],"<b>".h($g->server_info)."</b>","<b>$g->extension</b>")."\n","<p>".lang(119,"<b>".h(logged_user())."</b>")."\n";$k=$b->databases();if($k){$Yg=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(120)."</a>"."<td>".lang(121)."<td>".lang(122)."<td>".lang(123)." - <a href='".h(ME)."dbsize=1'>".lang(124)."</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=>$T){$Qg=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='$Qg' id='$t'>".h($l)."</a>";$pb=h(db_collation($l,$qb));echo"<td>".(support("database")?"<a href='$Qg".($Yg?"&ns=":"")."&database=' title='".lang(68)."'>$pb</a>":$pb),"<td align='right'><a href='$Qg&schema=' id='tables-".h($l)."' title='".lang(71)."'>".($_GET["dbsize"]?$T:"?")."</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(125)." <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(126)."'>".confirm()."\n"."</div></fieldset>\n"."</div></div>\n":""),"<input type='hidden' name='token' value='$ki'>\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!=""?$g->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(127),true);page_footer("ns");exit;}}$nf="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";class
|
|||
|
TmpFile{var$handler;var$size;function
|
|||
|
__construct(){$this->handler=tmpfile();}function
|
|||
|
write($Ab){$this->size+=strlen($Ab);fwrite($this->handler,$Ab);}function
|
|||
|
send(){fseek($this->handler,0);fpassthru($this->handler);fclose($this->handler);}}$xc="'(?:''|[^'\\\\]|\\\\.)*'";$Qd="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"]));$L=array(idf_escape($_GET["field"]));$H=$m->select($a,$L,array(where($_GET,$p)),$L);$J=($H?$H->fetch_row():array());echo$m->value($J[0],$p[$_GET["field"]]);exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$p=fields($a);if(!$p)$n=error();$S=table_status1($a,true);$C=$b->tableName($S);page_header(($p&&is_view($S)?$S['Engine']=='materialized view'?lang(128):lang(129):lang(130)).": ".($C!=""?$C:h($a)),$n);$b->selectLinks($S);$vb=$S["Comment"];if($vb!="")echo"<p class='nowrap'>".lang(51).": ".h($vb)."\n";if($p)$b->tableStructurePrint($p);if(!is_view($S)){if(support("indexes")){echo"<h3 id='indexes'>".lang(131)."</h3>\n";$w=indexes($a);if($w)$b->tableIndexesPrint($w);echo'<p class="links"><a href="'.h(ME).'indexes='.urlencode($a).'">'.lang(132)."</a>\n";}if(fk_support($S)){echo"<h3 id='foreign-keys'>".lang(99)."</h3>\n";$fd=foreign_keys($a);if($fd){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(133)."<td>".lang(134)."<td>".lang(102)."<td>".lang(101)."<td></thead>\n";foreach($fd
|
|||
|
as$C=>$q){echo"<tr title='".h($C)."'>","<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($C)).'">'.lang(135).'</a>';}echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'foreign='.urlencode($a).'">'.lang(136)."</a>\n";}}if(support(is_view($S)?"view_trigger":"trigger")){echo"<h3 id='triggers'>".lang(137)."</h3>\n";$wi=triggers($a);if($wi){echo"<table cellspacing='0'>\n";foreach($wi
|
|||
|
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(135)."</a>\n";echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'trigger='.urlencode($a).'">'.lang(138)."</a>\n";}}elseif(isset($_GET["schema"])){page_header(lang(71),"",array(),h(DB.($_GET["ns"]?".$_GET[ns]":"")));$Nh=array();$Oh=array();$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE["adminer_schema-".str_replace(".","_",DB)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$Ce,PREG_SET_ORDER);foreach($Ce
|
|||
|
as$s=>$B){$Nh[$B[1]]=array($B[2],$B[3]);$Oh[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$li=0;$Ra=-1;$Xg=array();$Cg=array();$re=array();foreach(table_status('',true)as$R=>$S){if(is_view($S))continue;$bg=0;$Xg[$R]["fields"]=array();foreach(fields($R)as$C=>$o){$bg+=1.25;$o["pos"]=$bg;$Xg[$R]["fields"][$C]=$o;}$Xg[$R]["pos"]=($Nh[$R]?$Nh[$R]:array($li,0));foreach($b->foreignKeys($R)as$X){if(!$X["db"]){$pe=$Ra;if($Nh[$R][1]||$Nh[$X["table"]][1])$pe=min(floatval($Nh[$R][1]),floatval($Nh[$X["table"]][1]))-1;else$Ra-=.1;while($re[(string)$pe])$pe-=.0001;$Xg[$R]["references"][$X["table"]][(string)$pe]=array($X["source"],$X["target"]);$Cg[$X["table"]][$R][(string)$pe]=$X["target"];$re[(string)$pe]=true;}}$li=max($li,$Xg[$R]["pos"][0]+2.5+$bg);}echo'<div id="schema" style="height: ',$li,'em;">
|
|||
|
<script',nonce(),'>
|
|||
|
qs(\'#schema\').onselectstart = function () { return false; };
|
|||
|
var tablePos = {',implode(",",$Oh)."\n",'};
|
|||
|
var em = qs(\'#schema\').offsetHeight / ',$li,';
|
|||
|
document.onmousemove = schemaMousemove;
|
|||
|
document.onmouseup = partialArg(schemaMouseup, \'',js_escape(DB),'\');
|
|||
|
</script>
|
|||
|
';foreach($Xg
|
|||
|
as$C=>$R){echo"<div class='table' style='top: ".$R["pos"][0]."em; left: ".$R["pos"][1]."em;'>",'<a href="'.h(ME).'table='.urlencode($C).'"><b>'.h($C)."</b></a>",script("qsl('div').onmousedown = schemaMousedown;");foreach($R["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)$R["references"]as$Uh=>$Dg){foreach($Dg
|
|||
|
as$pe=>$_g){$qe=$pe-$Nh[$C][1];$s=0;foreach($_g[0]as$sh)echo"\n<div class='references' title='".h($Uh)."' id='refs$pe-".($s++)."' style='left: $qe"."em; top: ".$R["fields"][$sh]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$qe)."em;'></div></div>";}}foreach((array)$Cg[$C]as$Uh=>$Dg){foreach($Dg
|
|||
|
as$pe=>$e){$qe=$pe-$Nh[$C][1];$s=0;foreach($e
|
|||
|
as$Th)echo"\n<div class='references' title='".h($Uh)."' id='refd$pe-".($s++)."' style='left: $qe"."em; top: ".$R["fields"][$Th]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME)."?file=arrow.gif) no-repeat right center;&version=4.6.3")."'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$qe)."em;'></div></div>";}}echo"\n</div>\n";}foreach($Xg
|
|||
|
as$C=>$R){foreach((array)$R["references"]as$Uh=>$Dg){foreach($Dg
|
|||
|
as$pe=>$_g){$Re=$li;$Ge=-10;foreach($_g[0]as$y=>$sh){$cg=$R["pos"][0]+$R["fields"][$sh]["pos"];$dg=$Xg[$Uh]["pos"][0]+$Xg[$Uh]["fields"][$_g[1][$y]]["pos"];$Re=min($Re,$cg,$dg);$Ge=max($Ge,$cg,$dg);}echo"<div class='references' id='refl$pe' style='left: $pe"."em; top: $Re"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Ge-$Re)."em;'></div></div>\n";}}}echo'</div>
|
|||
|
<p class="links"><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">',lang(139),'</a>
|
|||
|
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$n){$Db="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$y)$Db.="&$y=".urlencode($_POST[$y]);cookie("adminer_export",substr($Db,1));$T=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Jc=dump_headers((count($T)==1?key($T):DB),(DB==""||count($T)>1));$Yd=preg_match('~sql~',$_POST["format"]);if($Yd){echo"-- Adminer $ia ".$fc[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';
|
|||
|
":"")."
|
|||
|
";$g->query("SET time_zone = '+00:00';");}}$Eh=$_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($g->select_db($l)){if($Yd&&preg_match('~CREATE~',$Eh)&&($i=$g->result("SHOW CREATE DATABASE ".idf_escape($l),1))){set_utf8mb4($i);if($Eh=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($l).";\n";echo"$i;\n";}if($Yd){if($Eh)echo
|
|||
|
use_sql($l).";\n\n";$Gf="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$Rg){foreach(get_rows("SHOW $Rg STATUS WHERE Db = ".q($l),null,"-- ")as$J){$i=remove_definer($g->result("SHOW CREATE $Rg ".idf_escape($J["Name"]),2));set_utf8mb4($i);$Gf.=($Eh!='DROP+CREATE'?"DROP $Rg IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$i;;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$J){$i=remove_definer($g->result("SHOW CREATE EVENT ".idf_escape($J["Name"]),3));set_utf8mb4($i);$Gf.=($Eh!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$i;;\n\n";}}if($Gf)echo"DELIMITER ;;\n\n$Gf"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$Wi=array();foreach(table_status('',true)as$C=>$S){$R=(DB==""||in_array($C,(array)$_POST["tables"]));$Mb=(DB==""||in_array($C,(array)$_POST["data"]));if($R||$Mb){if($Jc=="tar"){$hi=new
|
|||
|
TmpFile;ob_start(array($hi,'write'),1e5);}$b->dumpTable($C,($R?$_POST["table_style"]:""),(is_view($S)?2:0));if(is_view($S))$Wi[]=$C;elseif($Mb){$p=fields($C);$b->dumpData($C,$_POST["data_style"],"SELECT *".convert_fields($p,$p)." FROM ".table($C));}if($Yd&&$_POST["triggers"]&&$R&&($wi=trigger_sql($C)))echo"\nDELIMITER ;;\n$wi\nDELIMITER ;\n";if($Jc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$l/")."$C.csv",$hi);}elseif($Yd)echo"\n";}}foreach($Wi
|
|||
|
as$Vi)$b->dumpTable($Vi,$_POST["table_style"],1);if($Jc=="tar")echo
|
|||
|
pack("x512");}}}if($Yd)echo"-- ".$g->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">
|
|||
|
';$Qb=array('','USE','DROP+CREATE','CREATE');$Ph=array('','DROP+CREATE','CREATE');$Nb=array('','TRUNCATE+INSERT','INSERT');if($x=="sql")$Nb[]='INSERT+UPDATE';parse_str($_COOKIE["adminer_export"],$J);if(!$J)$J=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($J["events"])){$J["routines"]=$J["events"]=($_GET["dump"]=="");$J["triggers"]=$J["table_style"];}echo"<tr><th>".lang(140)."<td>".html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"<tr><th>".lang(141)."<td>".html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($x=="sqlite"?"":"<tr><th>".lang(38)."<td>".html_select('db_style',$Qb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(142)):"").(support("event")?checkbox("events",1,$J["events"],lang(143)):"")),"<tr><th>".lang(122)."<td>".html_select('table_style',$Ph,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(52)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(137)):""),"<tr><th>".lang(144)."<td>".html_select('data_style',$Nb,$J["data_style"]),'</table>
|
|||
|
<p><input type="submit" value="',lang(74),'">
|
|||
|
<input type="hidden" name="token" value="',$ki,'">
|
|||
|
|
|||
|
<table cellspacing="0">
|
|||
|
',script("qsl('table').onclick = dumpClick;");$gg=array();if(DB!=""){$fb=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$fb>".lang(122)."</label>".script("qs('#check-tables').onclick = partial(formCheck, /^tables\\[/);",""),"<th style='text-align: right;'><label class='block'>".lang(144)."<input type='checkbox' id='check-data'$fb></label>".script("qs('#check-data').onclick = partial(formCheck, /^data\\[/);",""),"</thead>\n";$Wi="";$Qh=tables_list();foreach($Qh
|
|||
|
as$C=>$U){$fg=preg_replace('~_.*~','',$C);$fb=($a==""||$a==(substr($a,-1)=="%"?"$fg%":$C));$jg="<tr><td>".checkbox("tables[]",$C,$fb,$C,"","block");if($U!==null&&!preg_match('~table~i',$U))$Wi.="$jg\n";else
|
|||
|
echo"$jg<td align='right'><label class='block'><span id='Rows-".h($C)."'></span>".checkbox("data[]",$C,$fb)."</label>\n";$gg[$fg]++;}echo$Wi;if($Qh)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)){$fg=preg_replace('~_.*~','',$l);echo"<tr><td>".checkbox("databases[]",$l,$a==""||$a=="$fg%",$l,"","block")."\n";$gg[$fg]++;}}}else
|
|||
|
echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}echo'</table>
|
|||
|
</form>
|
|||
|
';$Xc=true;foreach($gg
|
|||
|
as$y=>$X){if($y!=""&&$X>1){echo($Xc?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$y%")."'>".h($y)."</a>";$Xc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(72));echo'<p class="links"><a href="'.h(ME).'user=">'.lang(145)."</a>";$H=$g->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$md=$H;if(!$H)$H=$g->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($md?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".lang(36)."<th>".lang(35)."<th></thead>\n";while($J=$H->fetch_assoc())echo'<tr'.odd().'><td>'.h($J["User"])."<td>".h($J["Host"]).'<td><a href="'.h(ME.'user='.urlencode($J["User"]).'&host='.urlencode($J["Host"])).'">'.lang(10)."</a>\n";if(!$md||DB!="")echo"<tr".odd()."><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='".lang(10)."'>\n";echo"</table>\n","</form>\n";}elseif(isset($_GET["sql"])){if(!$n&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$_d=&get_session("queries");$zd=&$_d[DB];if(!$n&&$_POST["clear"]){$zd=array();redirect(remove_from_uri("history"));}page_header((isset($_GET["import"])?lang(73):lang(65)),$n);if(!$n&&$_POST){$jd=false;if(!isset($_GET["import"]))$G=$_POST["query"];elseif($_POST["webfile"]){$wh=$b->importServerPath();$jd=@fopen((file_exists($wh)?$wh:"compress.zlib://$wh.gz"),"rb");$G=($jd?fread($jd,1e6):false);}else$G=get_file("sql_file",true);if(is_string($G)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($G)+memory_get_usage()+8e6));if($G!=""&&strlen($G)<1e6){$rg=$G.(preg_match("~;[ \t\r\n]*\$~",$G)?"":";");if(!$zd||reset(end($zd))!=$rg){restart_session();$zd[]=array($rg,time());set_session("queries",$_d);stop_session();}}$th="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Wb=";";$D=0;$uc=true;$h=connect();if(is_object($h)&&DB!="")$h->select_db(DB);$ub=0;$zc=array();$Nf='[\'"'.($x=="sql"?'`#':($x=="sqlite"?'`[':($x=="mssql"?'[':''))).']|/\*|-- |$'.($x=="pgsql"?'|\$[^$]*\$':'');$mi=microtime(true);parse_str($_COOKIE["adminer_export"],$ya);$lc=$b->dumpFormat();unset($lc["sql"]);while($G!=""){if(!$D&&preg_match("~^$th*+DELIMITER\\s+(\\S+)~i",$G,$B)){$Wb=$B[1];$G=substr($G,strlen($B[0]));}else{preg_match('('.preg_quote($Wb)."\\s*|$Nf)",$G,$B,PREG_OFFSET_CAPTURE,$D);list($hd,$bg)=$B[0];if(!$hd&&$jd&&!feof($jd))$G.=fread($jd,1e5);else{if(!$hd&&rtrim($G)=="")break;$D=$bg+strlen($hd);if($hd&&rtrim($hd)!=$Wb){while(preg_match('('.($hd=='/*'?'\*/':($hd=='['?']':(preg_match('~^-- |^#~',$hd)?"\n":preg_quote($hd)."|\\\\."))).'|$)s',$G,$B,PREG_OFFSET_CAPTURE,$D)){$Vg=$B[0][0];if(!$Vg&&$jd&&!feof($jd))$G.=fread($jd,1e5);else{$D=$B[0][1]+strlen($Vg);if($Vg[0]!="\\")break;}}}else{$uc=false;$rg=substr($G,0,$bg);$ub++;$jg="<pre id='sql-$ub'><code class='jush-$x'>".$b->sqlCommandQuery($rg)."</code></pre>\n";if($x=="sqlite"&&preg_match("~^$th*+ATTACH\\b~i",$rg,$B)){echo$jg,"<p class='error'>".lang(146)."\n";$zc[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break;}else{if(!$_POST["only_errors"]){echo$jg;ob_flush();flush();}$_h=microtime(true);if($g->multi_query($rg)&&is_object($h)&&preg_match("~^$th*+USE\\b~i",$rg))$h->query($rg);do{$H=$g->store_result();if($g->error){echo($_POST["only_errors"]?$jg:""),"<p class='error'>".lang(147).($g->errno?" ($g->errno)":"").": ".error()."\n";$zc[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break
|
|||
|
2;}else{$ai=" <span class='time'>(".format_time($_h).")</span>".(strlen($rg)<1000?" <a href='".h(ME)."sql=".urlencode(trim($rg))."'>".lang(10)."</a>":"");$_a=$g->affected_rows;$Zi=($_POST["only_errors"]?"":$m->warnings());$aj="warnings-$ub";if($Zi)$ai.=", <a href='#$aj'>".lang(47)."</a>".script("qsl('a').onclick = partial(toggle, '$aj');","");$Gc=null;$Hc="explain-$ub";if(is_object($H)){$z=$_POST["limit"];$_f=select($H,$h,array(),$z);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n";$df=$H->num_rows;echo"<p>".($df?($z&&$df>$z?lang(148,$z):"").lang(149,$df):""),$ai;if($h&&preg_match("~^($th|\\()*+SELECT\\b~i",$rg)&&($Gc=explain($h,$rg)))echo", <a href='#$Hc'>Explain</a>".script("qsl('a').onclick = partial(toggle, '$Hc');","");$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",$lc,$ya["format"])."<input type='hidden' name='query' value='".h($rg)."'>"." <input type='submit' name='export' value='".lang(74)."'><input type='hidden' name='token' value='$ki'></span>\n"."</form>\n";}}else{if(preg_match("~^$th*+(CREATE|DROP|ALTER)$th++(DATABASE|SCHEMA)\\b~i",$rg)){restart_session();set_session("dbs",null);stop_session();}if(!$_POST["only_errors"])echo"<p class='message' title='".h($g->info)."'>".lang(150,$_a)."$ai\n";}echo($Zi?"<div id='$aj' class='hidden'>\n$Zi</div>\n":"");if($Gc){echo"<div id='$Hc' class='hidden'>\n";select($Gc,$h,$_f);echo"</div>\n";}}$_h=microtime(true);}while($g->next_result());}$G=substr($G,$D);$D=0;}}}}if($uc)echo"<p class='message'>".lang(151)."\n";elseif($_POST["only_errors"]){echo"<p class='message'>".lang(152,$ub-count($zc))," <span class='time'>(".format_time($mi).")</span>\n";}elseif($zc&&$ub>1)echo"<p class='error'>".lang(147).": ".implode("",$zc)."\n";}else
|
|||
|
echo"<p class='error'>".upload_error($G)."\n";}echo'
|
|||
|
<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';$Dc="<input type='submit' value='".lang(153)."' title='Ctrl+Enter'>";if(!isset($_GET["import"])){$rg=$_GET["sql"];if($_POST)$rg=$_POST["query"];elseif($_GET["history"]=="all")$rg=$zd;elseif($_GET["history"]!="")$rg=$zd[$_GET["history"]][0];echo"<p>";textarea("query",$rg,20);echo($_POST?"":script("qs('textarea').focus();")),"<p>$Dc\n",lang(154).": <input type='number' name='limit' class='size' value='".h($_POST?$_POST["limit"]:$_GET["limit"])."'>\n";}else{echo"<fieldset><legend>".lang(155)."</legend><div>";$sd=(extension_loaded("zlib")?"[.gz]":"");echo(ini_bool("file_uploads")?"SQL$sd (< ".ini_get("upload_max_filesize")."B): <input type='file' name='sql_file[]' multiple>\n$Dc":lang(156)),"</div></fieldset>\n","<fieldset><legend>".lang(157)."</legend><div>",lang(158,"<code>".h($b->importServerPath())."$sd</code>"),' <input type="submit" name="webfile" value="'.lang(159).'">',"</div></fieldset>\n","<p>";}echo
|
|||
|
checkbox("error_stops",1,($_POST?$_POST["error_stops"]:isset($_GET["import"])),lang(160))."\n",checkbox("only_errors",1,($_POST?$_POST["only_errors"]:isset($_GET["import"])),lang(161))."\n","<input type='hidden' name='token' value='$ki'>\n";if(!isset($_GET["import"])&&$zd){print_fieldset("history",lang(162),$_GET["history"]!="");for($X=end($zd);$X;$X=prev($zd)){$y=key($zd);list($rg,$ai,$pc)=$X;echo'<a href="'.h(ME."sql=&history=$y").'">'.lang(10)."</a>"." <span class='time' title='".@date('Y-m-d',$ai)."'>".@date("H:i:s",$ai)."</span>"." <code class='jush-$x'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$rg)))),80,"</code>").($pc?" <span class='time'>($pc)</span>":"")."<br>\n";}echo"<input type='submit' name='clear' value='".lang(163)."'>\n","<a href='".h(ME."sql=&history=all")."'>".lang(164)."</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));$Gi=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($p
|
|||
|
as$C=>$o){if(!isset($o["privileges"][$Gi?"update":"insert"])||$b->fieldName($o)=="")unset($p[$C]);}if($_POST&&!$n&&!isset($_GET["select"])){$A=$_POST["referer"];if($_POST["insert"])$A=($Gi?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$A))$A=ME."select=".urlencode($a);$w=indexes($a);$Bi=unique_array($_GET["where"],$w);$ug="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($A,lang(165),$m->delete($a,$ug,!$Bi));else{$O=array();foreach($p
|
|||
|
as$C=>$o){$X=process_input($o);if($X!==false&&$X!==null)$O[idf_escape($C)]=$X;}if($Gi){if(!$O)redirect($A);queries_redirect($A,lang(166),$m->update($a,$O,$ug,!$Bi));if(is_ajax()){page_headers();page_messages($n);exit;}}else{$H=$m->insert($a,$O);$oe=($H?last_id():0);queries_redirect($A,lang(167,($oe?" $oe":"")),$H);}}}$J=null;if($_POST["save"])$J=(array)$_POST["fields"];elseif($Z){$L=array();foreach($p
|
|||
|
as$C=>$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($C);$L[]=($Ha?"$Ha AS ":"").idf_escape($C);}}$J=array();if(!support("table"))$L=array("*");if($L){$H=$m->select($a,$L,array($Z),$L,array(),(isset($_GET["select"])?2:1));if(!$H)$n=error();else{$J=$H->fetch_assoc();if(!$J)$J=false;}if(isset($_GET["select"])&&(!$J||$H->fetch_assoc()))$J=null;}}if(!support("table")&&!$p){if(!$Z){$H=$m->select($a,array("*"),$Z,array("*"));$J=($H?$H->fetch_assoc():false);if(!$J)$J=array($m->primary=>"");}if($J){foreach($J
|
|||
|
as$y=>$X){if(!$Z)$J[$y]=null;$p[$y]=array("field"=>$y,"null"=>($y!=$m->primary),"auto_increment"=>($y==$m->primary));}}}edit_form($a,$p,$J,$Gi);}elseif(isset($_GET["create"])){$a=$_GET["create"];$Pf=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$y)$Pf[$y]=$y;$Bg=referencable_primary($a);$fd=array();foreach($Bg
|
|||
|
as$Lh=>$o)$fd[str_replace("`","``",$Lh)."`".str_replace("`","``",$o["field"])]=$Lh;$Cf=array();$S=array();if($a!=""){$Cf=fields($a);$S=table_status($a);if(!$S)$n=lang(9);}$J=$_POST;$J["fields"]=(array)$J["fields"];if($J["auto_increment_col"])$J["fields"][$J["auto_increment_col"]]["auto_increment"]=true;if($_POST&&!process_fields($J["fields"])&&!$n){if($_POST["drop"])queries_redirect(substr(ME,0,-1),lang(168),drop_tables(array($a)));else{$p=array();$Ea=array();$Li=false;$dd=array();$Bf=reset($Cf);$Ba=" FIRST";foreach($J["fields"]as$y=>$o){$q=$fd[$o["type"]];$xi=($q!==null?$Bg[$q]:$o);if($o["field"]!=""){if(!$o["has_default"])$o["default"]=null;if($y==$J["auto_increment_col"])$o["auto_increment"]=true;$og=process_field($o,$xi);$Ea[]=array($o["orig"],$og,$Ba);if($og!=process_field($Bf,$Bf)){$p[]=array($o["orig"],$og,$Ba);if($o["orig"]!=""||$Ba)$Li=true;}if($q!==null)$dd[idf_escape($o["field"])]=($a!=""&&$x!="sqlite"?"ADD":" ").format_foreign_key(array('table'=>$fd[$o["type"]],'source'=>array($o["field"]),'target'=>array($xi["field"]),'on_delete'=>$o["on_delete"],));$Ba=" AFTER ".idf_escape($o["field"]);}elseif($o["orig"]!=""){$Li=true;$p[]=array($o["orig"]);}if($o["orig"]!=""){$Bf=next($Cf);if(!$Bf)$Ba="";}}$Rf="";if($Pf[$J["partition_by"]]){$Sf=array();if($J["partition_by"]=='RANGE'||$J["partition_by"]=='LIST'){foreach(array_filter($J["partition_names"])as$y=>$X){$Y=$J["partition_values"][$y];$Sf[]="\n PARTITION ".idf_escape($X)." VALUES ".($J["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Rf.="\nPARTITION BY $J[partition_by]($J[partition])".($Sf?" (".implode(",",$Sf)."\n)":($J["partitions"]?" PARTITIONS ".(+$J["partitions"]):""));}elseif(support("partitioning")&&preg_match("~partitioned~",$S["Create_options"]))$Rf.="\nREMOVE PARTITIONING";$Ke=lang(169);if($a==""){cookie("adminer_engine",$J["Engine"]);$Ke=lang(170);}$C=trim($J["name"]);queries_redirect(ME.(support("table")?"table=":"select=").urlencode($C),$Ke,alter_table($a,$C,($x=="sqlite"&&($Li||$dd)?$Ea:$p),$dd,($J["Comment"]!=$S["Comment"]?$J["Comment"]:null),($J["Engine"]&&$J["Engine"]!=$S["Engine"]?$J["Engine"]:""),($J["Collation"]&&$J["Collation"]!=$S["Collation"]?$J["Collation"]:""),($J["Auto_increment"]!=""?number($J["Auto_increment"]):""),$Rf));}}page_header(($a!=""?lang(45):lang(75)),$n,array("table"=>$a),h($a));if(!$_POST){$J=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($zi["int"])?"int":(isset($zi["integer"])?"integer":"")),"on_update"=>"")),"partition_names"=>array(""),);if($a!=""){$J=$S;$J["name"]=$a;$J["fields"]=array();if(!$_GET["auto_increment"])$J["Auto_increment"]="";foreach($Cf
|
|||
|
as$o){$o["has_default"]=isset($o["default"]);$J["fields"][]=$o;}if(support("partitioning")){$kd="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$H=$g->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $kd ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($J["partition_by"],$J["partitions"],$J["partition"])=$H->fetch_row();$Sf=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $kd AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$Sf[""]="";$J["partition_names"]=array_keys($Sf);$J["partition_values"]=array_values($Sf);}}}$qb=collations();$wc=engines();foreach($wc
|
|||
|
as$vc){if(!strcasecmp($vc,$J["Engine"])){$J["Engine"]=$vc;break;}}echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>
|
|||
|
';if(support("columns")||$a==""){echo
|
|||
|
lang(171),': <input name="name" maxlength="64" value="',h($J["name"]),'" autocapitalize="off">
|
|||
|
';if($a==""&&!$_POST)echo
|
|||
|
script("focus(qs('#form')['name']);");echo($wc?"<select name='Engine'>".optionlist(array(""=>"(".lang(172).")")+$wc,$J["Engine"])."</select>".on_help("getTarget(event).value",1).script("qsl('select').onchange = helpClose;"):""),' ',($qb&&!preg_match("~sqlite|mssql~",$x)?html_select("Collation",array(""=>"(".lang(100).")")+$qb,$J["Collation"]):""),' <input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if(support("columns")){echo'<table cellspacing="0" id="edit-fields" class="nowrap">
|
|||
|
';$wb=($_POST?$_POST["comments"]:$J["Comment"]!="");if(!$_POST&&!$wb){foreach($J["fields"]as$o){if($o["comment"]!=""){$wb=true;break;}}}edit_fields($J["fields"],$qb,"TABLE",$fd,$wb);echo'</table>
|
|||
|
<p>
|
|||
|
',lang(52),': <input type="number" name="Auto_increment" size="6" value="',h($J["Auto_increment"]),'">
|
|||
|
',checkbox("defaults",1,!$_POST||$_POST["defaults"],lang(173),"columnShow(this.checked, 5)","jsonly"),($_POST?"":script("editingHideDefaults();")),(support("comment")?"<label><input type='checkbox' name='comments' value='1' class='jsonly'".($wb?" checked":"").">".lang(51)."</label>".script("qsl('input').onclick = partial(editingCommentsClick, true);").' <input name="Comment" value="'.h($J["Comment"]).'" maxlength="'.(min_version(5.5)?2048:60).'"'.($wb?'':' class="hidden"').'>':''),'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(126),'">',confirm(lang(174,$a));}if(support("partitioning")){$Qf=preg_match('~RANGE|LIST~',$J["partition_by"]);print_fieldset("partition",lang(175),$J["partition_by"]);echo'<p>
|
|||
|
',"<select name='partition_by'>".optionlist(array(""=>"")+$Pf,$J["partition_by"])."</select>".on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')",1).script("qsl('select').onchange = partitionByChange;"),'(<input name="partition" value="',h($J["partition"]),'">)
|
|||
|
',lang(176),': <input type="number" name="partitions" class="size',($Qf||!$J["partition_by"]?" hidden":""),'" value="',h($J["partitions"]),'">
|
|||
|
<table cellspacing="0" id="partition-table"',($Qf?"":" class='hidden'"),'>
|
|||
|
<thead><tr><th>',lang(177),'<th>',lang(178),'</thead>
|
|||
|
';foreach($J["partition_names"]as$y=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'" autocapitalize="off">',($y==count($J["partition_names"])-1?script("qsl('input').oninput = partitionNameChange;"):''),'<td><input name="partition_values[]" value="'.h($J["partition_values"][$y]).'">';}echo'</table>
|
|||
|
</div></fieldset>
|
|||
|
';}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
',script("qs('#form')['defaults'].onclick();".(support("comment")?" editingCommentsClick.call(qs('#form')['comments']);":""));}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Id=array("PRIMARY","UNIQUE","INDEX");$S=table_status($a,true);if(preg_match('~MyISAM|M?aria'.(min_version(5.6,'10.0.5')?'|InnoDB':'').'~i',$S["Engine"]))$Id[]="FULLTEXT";if(preg_match('~MyISAM|M?aria'.(min_version(5.7,'10.2.2')?'|InnoDB':'').'~i',$S["Engine"]))$Id[]="SPATIAL";$w=indexes($a);$hg=array();if($x=="mongo"){$hg=$w["_id_"];unset($Id[0]);unset($w["_id_"]);}$J=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($J["indexes"]as$v){$C=$v["name"];if(in_array($v["type"],$Id)){$e=array();$ue=array();$Yb=array();$O=array();ksort($v["columns"]);foreach($v["columns"]as$y=>$d){if($d!=""){$te=$v["lengths"][$y];$Xb=$v["descs"][$y];$O[]=idf_escape($d).($te?"(".(+$te).")":"").($Xb?" DESC":"");$e[]=$d;$ue[]=($te?$te:null);$Yb[]=$Xb;}}if($e){$Ec=$w[$C];if($Ec){ksort($Ec["columns"]);ksort($Ec["lengths"]);ksort($Ec["descs"]);if($v["type"]==$Ec["type"]&&array_values($Ec["columns"])===$e&&(!$Ec["lengths"]||array_values($Ec["lengths"])===$ue)&&array_values($Ec["descs"])===$Yb){unset($w[$C]);continue;}}$c[]=array($v["type"],$C,$O);}}}foreach($w
|
|||
|
as$C=>$Ec)$c[]=array($Ec["type"],$C,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(179),alter_indexes($a,$c));}page_header(lang(131),$n,array("table"=>$a),h($a));$p=array_keys(fields($a));if($_POST["add"]){foreach($J["indexes"]as$y=>$v){if($v["columns"][count($v["columns"])]!="")$J["indexes"][$y]["columns"][]="";}$v=end($J["indexes"]);if($v["type"]||array_filter($v["columns"],'strlen'))$J["indexes"][]=array("columns"=>array(1=>""));}if(!$J){foreach($w
|
|||
|
as$y=>$v){$w[$y]["name"]=$y;$w[$y]["columns"][]="";}$w[]=array("columns"=>array(1=>""));$J["indexes"]=$w;}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
<thead><tr>
|
|||
|
<th id="label-type">',lang(180),'<th><input type="submit" class="wayoff">',lang(181),'<th id="label-name">',lang(182),'<th><noscript>',"<input type='image' class='icon' name='add[0]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.6.3")."' alt='+' title='".lang(107)."'>",'</noscript>
|
|||
|
</thead>
|
|||
|
';if($hg){echo"<tr><td>PRIMARY<td>";foreach($hg["columns"]as$y=>$d){echo
|
|||
|
select_input(" disabled",$p,$d),"<label><input disabled type='checkbox'>".lang(60)."</label> ";}echo"<td><td>\n";}$be=1;foreach($J["indexes"]as$v){if(!$_POST["drop_col"]||$be!=key($_POST["drop_col"])){echo"<tr><td>".html_select("indexes[$be][type]",array(-1=>"")+$Id,$v["type"],($be==count($J["indexes"])?"indexesAddRow.call(this);":1),"label-type"),"<td>";ksort($v["columns"]);$s=1;foreach($v["columns"]as$y=>$d){echo"<span>".select_input(" name='indexes[$be][columns][$s]' title='".lang(49)."'",($p?array_combine($p,$p):$p),$d,"partial(".($s==count($v["columns"])?"indexesAddColumn":"indexesChangeColumn").", '".js_escape($x=="sql"?"":$_GET["indexes"]."_")."')"),($x=="sql"||$x=="mssql"?"<input type='number' name='indexes[$be][lengths][$s]' class='size' value='".h($v["lengths"][$y])."' title='".lang(105)."'>":""),($x!="sql"?checkbox("indexes[$be][descs][$s]",1,$v["descs"][$y],lang(60)):"")," </span>";$s++;}echo"<td><input name='indexes[$be][name]' value='".h($v["name"])."' autocapitalize='off' aria-labelledby='label-name'>\n","<td><input type='image' class='icon' name='drop_col[$be]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.6.3")."' alt='x' title='".lang(110)."'>".script("qsl('input').onclick = partial(editingRemoveRow, 'indexes\$1[type]');");}$be++;}echo'</table>
|
|||
|
<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$n&&!isset($_POST["add_x"])){$C=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(183),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace('~\bdb=[^&]*&~','',ME)."db=".urlencode($C),lang(184),rename_database($C,$J["collation"]));}else{$k=explode("\n",str_replace("\r","",$C));$Fh=true;$ne="";foreach($k
|
|||
|
as$l){if(count($k)==1||$l!=""){if(!create_database($l,$J["collation"]))$Fh=false;$ne=$l;}}restart_session();set_session("dbs",null);queries_redirect(ME."db=".urlencode($ne),lang(185),$Fh);}}else{if(!$J["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($C).(preg_match('~^[a-z0-9_]+$~i',$J["collation"])?" COLLATE $J[collation]":""),substr(ME,0,-1),lang(186));}}page_header(DB!=""?lang(68):lang(114),$n,array(),h(DB));$qb=collations();$C=DB;if($_POST)$C=$J["name"];elseif(DB!="")$J["collation"]=db_collation(DB,$qb);elseif($x=="sql"){foreach(get_vals("SHOW GRANTS")as$md){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~',$md,$B)&&$B[1]){$C=stripcslashes(idf_unescape("`$B[2]`"));break;}}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
',($_POST["add_x"]||strpos($C,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($C).'</textarea><br>':'<input name="name" id="name" value="'.h($C).'" maxlength="64" autocapitalize="off">')."\n".($qb?html_select("collation",array(""=>"(".lang(100).")")+$qb,$J["collation"]).doc_link(array('sql'=>"charset-charsets.html",'mariadb'=>"supported-character-sets-and-collations/",'mssql'=>"ms187963.aspx",)):""),script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
|
|||
|
';if(DB!="")echo"<input type='submit' name='drop' value='".lang(126)."'>".confirm(lang(174,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.6.3")."' alt='+' title='".lang(107)."'>\n";echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["scheme"])){$J=$_POST;if($_POST&&!$n){$_=preg_replace('~ns=[^&]*&~','',ME)."ns=";if($_POST["drop"])query_redirect("DROP SCHEMA ".idf_escape($_GET["ns"]),$_,lang(187));else{$C=trim($J["name"]);$_.=urlencode($C);if($_GET["ns"]=="")query_redirect("CREATE SCHEMA ".idf_escape($C),$_,lang(188));elseif($_GET["ns"]!=$C)query_redirect("ALTER SCHEMA ".idf_escape($_GET["ns"])." RENAME TO ".idf_escape($C),$_,lang(189));else
|
|||
|
redirect($_);}}page_header($_GET["ns"]!=""?lang(69):lang(70),$n);if(!$J)$J["name"]=$_GET["ns"];echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" id="name" value="',h($J["name"]),'" autocapitalize="off">
|
|||
|
',script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
|
|||
|
';if($_GET["ns"]!="")echo"<input type='submit' name='drop' value='".lang(126)."'>".confirm(lang(174,$_GET["ns"]))."\n";echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["call"])){$da=($_GET["name"]?$_GET["name"]:$_GET["call"]);page_header(lang(190).": ".h($da),$n);$Rg=routine($_GET["call"],(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Gd=array();$Gf=array();foreach($Rg["fields"]as$s=>$o){if(substr($o["inout"],-3)=="OUT")$Gf[$s]="@".idf_escape($o["field"])." AS ".idf_escape($o["field"]);if(!$o["inout"]||substr($o["inout"],0,2)=="IN")$Gd[]=$s;}if(!$n&&$_POST){$ab=array();foreach($Rg["fields"]as$y=>$o){if(in_array($y,$Gd)){$X=process_input($o);if($X===false)$X="''";if(isset($Gf[$y]))$g->query("SET @".idf_escape($o["field"])." = $X");}$ab[]=(isset($Gf[$y])?"@".idf_escape($o["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$ab).")";$_h=microtime(true);$H=$g->multi_query($G);$_a=$g->affected_rows;echo$b->selectQuery($G,$_h,!$H);if(!$H)echo"<p class='error'>".error()."\n";else{$h=connect();if(is_object($h))$h->select_db(DB);do{$H=$g->store_result();if(is_object($H))select($H,$h);else
|
|||
|
echo"<p class='message'>".lang(191,$_a)."\n";}while($g->next_result());if($Gf)select($g->query("SELECT ".implode(", ",$Gf)));}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
';if($Gd){echo"<table cellspacing='0'>\n";foreach($Gd
|
|||
|
as$y){$o=$Rg["fields"][$y];$C=$o["field"];echo"<tr><th>".$b->fieldName($o);$Y=$_POST["fields"][$C];if($Y!=""){if($o["type"]=="enum")$Y=+$Y;if($o["type"]=="set")$Y=array_sum($Y);}input($o,$Y,(string)$_POST["function"][$C]);echo"\n";}echo"</table>\n";}echo'<p>
|
|||
|
<input type="submit" value="',lang(190),'">
|
|||
|
<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$J=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$Ke=($_POST["drop"]?lang(192):($C!=""?lang(193):lang(194)));$A=ME."table=".urlencode($a);if(!$_POST["drop"]){$J["source"]=array_filter($J["source"],'strlen');ksort($J["source"]);$Th=array();foreach($J["source"]as$y=>$X)$Th[$y]=$J["target"][$y];$J["target"]=$Th;}if($x=="sqlite")queries_redirect($A,$Ke,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($J)))));else{$c="ALTER TABLE ".table($a);$gc="\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$gc,$A,$Ke);else{query_redirect($c.($C!=""?"$gc,":"")."\nADD".format_foreign_key($J),$A,$Ke);$n=lang(195)."<br>$n";}}}page_header(lang(196),$n,array("table"=>$a),h($a));if($_POST){ksort($J["source"]);if($_POST["add"])$J["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$J["target"]=array();}elseif($C!=""){$fd=foreign_keys($a);$J=$fd[$C];$J["source"][]="";}else{$J["table"]=$a;$J["source"]=array("");}$sh=array_keys(fields($a));$Th=($a===$J["table"]?$sh:array_keys(fields($J["table"])));$Ag=array_keys(array_filter(table_status('',true),'fk_support'));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($J["db"]==""&&$J["ns"]==""){echo
|
|||
|
lang(197),':
|
|||
|
',html_select("table",$Ag,$J["table"],"this.form['change-js'].value = '1'; this.form.submit();"),'<input type="hidden" name="change-js" value="">
|
|||
|
<noscript><p><input type="submit" name="change" value="',lang(198),'"></noscript>
|
|||
|
<table cellspacing="0">
|
|||
|
<thead><tr><th id="label-source">',lang(133),'<th id="label-target">',lang(134),'</thead>
|
|||
|
';$be=0;foreach($J["source"]as$y=>$X){echo"<tr>","<td>".html_select("source[".(+$y)."]",array(-1=>"")+$sh,$X,($be==count($J["source"])-1?"foreignAddRow.call(this);":1),"label-source"),"<td>".html_select("target[".(+$y)."]",$Th,$J["target"][$y],1,"label-target");$be++;}echo'</table>
|
|||
|
<p>
|
|||
|
',lang(102),': ',html_select("on_delete",array(-1=>"")+explode("|",$nf),$J["on_delete"]),' ',lang(101),': ',html_select("on_update",array(-1=>"")+explode("|",$nf),$J["on_update"]),doc_link(array('sql'=>"innodb-foreign-key-constraints.html",'mariadb'=>"foreign-keys/",'pgsql'=>"sql-createtable.html#SQL-CREATETABLE-REFERENCES",'mssql'=>"ms174979.aspx",'oracle'=>"clauses002.htm#sthref2903",)),'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<noscript><p><input type="submit" name="add" value="',lang(199),'"></noscript>
|
|||
|
';}if($C!=""){echo'<input type="submit" name="drop" value="',lang(126),'">',confirm(lang(174,$C));}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;$Df="VIEW";if($x=="pgsql"&&$a!=""){$P=table_status($a);$Df=strtoupper($P["Engine"]);}if($_POST&&!$n){$C=trim($J["name"]);$Ha=" AS\n$J[select]";$A=ME."table=".urlencode($C);$Ke=lang(200);$U=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$C&&$x!="sqlite"&&$U=="VIEW"&&$Df=="VIEW")query_redirect(($x=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ha,$A,$Ke);else{$Vh=$C."_adminer_".uniqid();drop_create("DROP $Df ".table($a),"CREATE $U ".table($C).$Ha,"DROP $U ".table($C),"CREATE $U ".table($Vh).$Ha,"DROP $U ".table($Vh),($_POST["drop"]?substr(ME,0,-1):$A),lang(201),$Ke,lang(202),$a,$C);}}if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;$J["materialized"]=($Df!="VIEW");if(!$n)$n=error();}page_header(($a!=""?lang(44):lang(203)),$n,array("table"=>$a),h($a));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>',lang(182),': <input name="name" value="',h($J["name"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',(support("materializedview")?" ".checkbox("materialized",1,$J["materialized"],lang(128)):""),'<p>';textarea("select",$J["select"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(126),'">',confirm(lang(174,$a));}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Td=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Bh=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$n){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(204));elseif(in_array($J["INTERVAL_FIELD"],$Td)&&isset($Bh[$J["STATUS"]])){$Wg="\nON SCHEDULE ".($J["INTERVAL_VALUE"]?"EVERY ".q($J["INTERVAL_VALUE"])." $J[INTERVAL_FIELD]".($J["STARTS"]?" STARTS ".q($J["STARTS"]):"").($J["ENDS"]?" ENDS ".q($J["ENDS"]):""):"AT ".q($J["STARTS"]))." ON COMPLETION".($J["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(205):lang(206)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$Wg.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$Wg)."\n".$Bh[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(207).": ".h($aa):lang(208)),$n);if(!$J&&$aa!=""){$K=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$J=reset($K);}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(182),'<td><input name="EVENT_NAME" value="',h($J["EVENT_NAME"]),'" maxlength="64" autocapitalize="off">
|
|||
|
<tr><th title="datetime">',lang(209),'<td><input name="STARTS" value="',h("$J[EXECUTE_AT]$J[STARTS]"),'">
|
|||
|
<tr><th title="datetime">',lang(210),'<td><input name="ENDS" value="',h($J["ENDS"]),'">
|
|||
|
<tr><th>',lang(211),'<td><input type="number" name="INTERVAL_VALUE" value="',h($J["INTERVAL_VALUE"]),'" class="size"> ',html_select("INTERVAL_FIELD",$Td,$J["INTERVAL_FIELD"]),'<tr><th>',lang(117),'<td>',html_select("STATUS",$Bh,$J["STATUS"]),'<tr><th>',lang(51),'<td><input name="EVENT_COMMENT" value="',h($J["EVENT_COMMENT"]),'" maxlength="64">
|
|||
|
<tr><th><td>',checkbox("ON_COMPLETION","PRESERVE",$J["ON_COMPLETION"]=="PRESERVE",lang(212)),'</table>
|
|||
|
<p>';textarea("EVENT_DEFINITION",$J["EVENT_DEFINITION"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($aa!=""){echo'<input type="submit" name="drop" value="',lang(126),'">',confirm(lang(174,$aa));}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["procedure"])){$da=($_GET["name"]?$_GET["name"]:$_GET["procedure"]);$Rg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$n){$Af=routine($_GET["procedure"],$Rg);$Vh="$J[name]_adminer_".uniqid();drop_create("DROP $Rg ".routine_id($da,$Af),create_routine($Rg,$J),"DROP $Rg ".routine_id($J["name"],$J),create_routine($Rg,array("name"=>$Vh)+$J),"DROP $Rg ".routine_id($Vh,$J),substr(ME,0,-1),lang(213),lang(214),lang(215),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(216):lang(217)).": ".h($da):(isset($_GET["function"])?lang(218):lang(219))),$n);if(!$_POST&&$da!=""){$J=routine($_GET["procedure"],$Rg);$J["name"]=$da;}$qb=get_vals("SHOW CHARACTER SET");sort($qb);$Sg=routine_languages();echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>',lang(182),': <input name="name" value="',h($J["name"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',($Sg?lang(19).": ".html_select("language",$Sg,$J["language"])."\n":""),'<input type="submit" value="',lang(14),'">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
';edit_fields($J["fields"],$qb,$Rg);if(isset($_GET["function"])){echo"<tr><td>".lang(220);edit_type("returns",$J["returns"],$qb,array(),($x=="pgsql"?array("void","trigger"):array()));}echo'</table>
|
|||
|
<p>';textarea("definition",$J["definition"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($da!=""){echo'<input type="submit" name="drop" value="',lang(126),'">',confirm(lang(174,$da));}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["sequence"])){$fa=$_GET["sequence"];$J=$_POST;if($_POST&&!$n){$_=substr(ME,0,-1);$C=trim($J["name"]);if($_POST["drop"])query_redirect("DROP SEQUENCE ".idf_escape($fa),$_,lang(221));elseif($fa=="")query_redirect("CREATE SEQUENCE ".idf_escape($C),$_,lang(222));elseif($fa!=$C)query_redirect("ALTER SEQUENCE ".idf_escape($fa)." RENAME TO ".idf_escape($C),$_,lang(223));else
|
|||
|
redirect($_);}page_header($fa!=""?lang(224).": ".h($fa):lang(225),$n);if(!$J)$J["name"]=$fa;echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" value="',h($J["name"]),'" autocapitalize="off">
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($fa!="")echo"<input type='submit' name='drop' value='".lang(126)."'>".confirm(lang(174,$fa))."\n";echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["type"])){$ga=$_GET["type"];$J=$_POST;if($_POST&&!$n){$_=substr(ME,0,-1);if($_POST["drop"])query_redirect("DROP TYPE ".idf_escape($ga),$_,lang(226));else
|
|||
|
query_redirect("CREATE TYPE ".idf_escape(trim($J["name"]))." $J[as]",$_,lang(227));}page_header($ga!=""?lang(228).": ".h($ga):lang(229),$n);if(!$J)$J["as"]="AS ";echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($ga!="")echo"<input type='submit' name='drop' value='".lang(126)."'>".confirm(lang(174,$ga))."\n";else{echo"<input name='name' value='".h($J['name'])."' autocapitalize='off'>\n";textarea("as",$J["as"]);echo"<p><input type='submit' value='".lang(14)."'>\n";}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$vi=trigger_options();$J=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$n&&in_array($_POST["Timing"],$vi["Timing"])&&in_array($_POST["Event"],$vi["Event"])&&in_array($_POST["Type"],$vi["Type"])){$mf=" ON ".table($a);$gc="DROP TRIGGER ".idf_escape($C).($x=="pgsql"?$mf:"");$A=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($gc,$A,lang(230));else{if($C!="")queries($gc);queries_redirect($A,($C!=""?lang(231):lang(232)),queries(create_trigger($mf,$_POST)));if($C!="")queries(create_trigger($mf,$J+array("Type"=>reset($vi["Type"]))));}}$J=$_POST;}page_header(($C!=""?lang(233).": ".h($C):lang(234)),$n,array("table"=>$a));echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(235),'<td>',html_select("Timing",$vi["Timing"],$J["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, '".js_escape($a)."', this.form);"),'<tr><th>',lang(236),'<td>',html_select("Event",$vi["Event"],$J["Event"],"this.form['Timing'].onchange();"),(in_array("UPDATE OF",$vi["Event"])?" <input name='Of' value='".h($J["Of"])."' class='hidden'>":""),'<tr><th>',lang(50),'<td>',html_select("Type",$vi["Type"],$J["Type"]),'</table>
|
|||
|
<p>',lang(182),': <input name="Trigger" value="',h($J["Trigger"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',script("qs('#form')['Timing'].onchange();"),'<p>';textarea("Statement",$J["Statement"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($C!=""){echo'<input type="submit" name="drop" value="',lang(126),'">',confirm(lang(174,$C));}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$mg=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$Bb)$mg[$Bb][$J["Privilege"]]=$J["Comment"];}$mg["Server Admin"]+=$mg["File access on server"];$mg["Databases"]["Create routine"]=$mg["Procedures"]["Create routine"];unset($mg["Procedures"]["Create routine"]);$mg["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$mg["Columns"][$X]=$mg["Tables"][$X];unset($mg["Server Admin"]["Usage"]);foreach($mg["Tables"]as$y=>$X)unset($mg["Databases"][$y]);$Xe=array();if($_POST){foreach($_POST["objects"]as$y=>$X)$Xe[$X]=(array)$Xe[$X]+(array)$_POST["grants"][$y];}$nd=array();$kf="";if(isset($_GET["host"])&&($H=$g->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$J[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\([^)]+\))?~',$B[1],$Ce,PREG_SET_ORDER)){foreach($Ce
|
|||
|
as$X){if($X[1]!="USAGE")$nd["$B[2]$X[2]"][$X[1]]=true;if(preg_match('~ WITH GRANT OPTION~',$J[0]))$nd["$B[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$J[0],$B))$kf=$B[1];}}if($_POST&&!$n){$lf=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $lf",ME."privileges=",lang(237));else{$Ze=q($_POST["user"])."@".q($_POST["host"]);$Uf=$_POST["pass"];if($Uf!=''&&!$_POST["hashed"]){$Uf=$g->result("SELECT PASSWORD(".q($Uf).")");$n=!$Uf;}$Gb=false;if(!$n){if($lf!=$Ze){$Gb=queries((min_version(5)?"CREATE USER":"GRANT USAGE ON *.* TO")." $Ze IDENTIFIED BY PASSWORD ".q($Uf));$n=!$Gb;}elseif($Uf!=$kf)queries("SET PASSWORD FOR $Ze = ".q($Uf));}if(!$n){$Og=array();foreach($Xe
|
|||
|
as$ff=>$md){if(isset($_GET["grant"]))$md=array_filter($md);$md=array_keys($md);if(isset($_GET["grant"]))$Og=array_diff(array_keys(array_filter($Xe[$ff],'strlen')),$md);elseif($lf==$Ze){$if=array_keys((array)$nd[$ff]);$Og=array_diff($if,$md);$md=array_diff($md,$if);unset($nd[$ff]);}if(preg_match('~^(.+)\s*(\(.*\))?$~U',$ff,$B)&&(!grant("REVOKE",$Og,$B[2]," ON $B[1] FROM $Ze")||!grant("GRANT",$md,$B[2]," ON $B[1] TO $Ze"))){$n=true;break;}}}if(!$n&&isset($_GET["host"])){if($lf!=$Ze)queries("DROP USER $lf");elseif(!isset($_GET["grant"])){foreach($nd
|
|||
|
as$ff=>$Og){if(preg_match('~^(.+)(\(.*\))?$~U',$ff,$B))grant("REVOKE",array_keys($Og),$B[2]," ON $B[1] FROM $Ze");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(238):lang(239)),!$n);if($Gb)$g->query("DROP USER $Ze");}}page_header((isset($_GET["host"])?lang(36).": ".h("$ha@$_GET[host]"):lang(145)),$n,array("privileges"=>array('',lang(72))));if($_POST){$J=$_POST;$nd=$Xe;}else{$J=$_GET+array("host"=>$g->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$J["pass"]=$kf;if($kf!="")$J["hashed"]=true;$nd[(DB==""||$nd?"":idf_escape(addcslashes(DB,"%_\\"))).".*"]=array();}echo'<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(35),'<td><input name="host" maxlength="60" value="',h($J["host"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(36),'<td><input name="user" maxlength="16" value="',h($J["user"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(37),'<td><input name="pass" id="pass" value="',h($J["pass"]),'" autocomplete="new-password">
|
|||
|
';if(!$J["hashed"])echo
|
|||
|
script("typePassword(qs('#pass'));");echo
|
|||
|
checkbox("hashed",1,$J["hashed"],lang(240),"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($nd
|
|||
|
as$ff=>$md){echo'<th>'.($ff!="*.*"?"<input name='objects[$s]' value='".h($ff)."' 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(130),"Columns"=>lang(49),"Procedures"=>lang(241),)as$Bb=>$Xb){foreach((array)$mg[$Bb]as$lg=>$vb){echo"<tr".odd()."><td".($Xb?">$Xb<td":" colspan='2'").' lang="en" title="'.h($vb).'">'.h($lg);$s=0;foreach($nd
|
|||
|
as$ff=>$md){$C="'grants[$s][".h(strtoupper($lg))."]'";$Y=$md[strtoupper($lg)];if($Bb=="Server Admin"&&$ff!=(isset($nd["*.*"])?"*.*":".*"))echo"<td>";elseif(isset($_GET["grant"]))echo"<td><select name=$C><option><option value='1'".($Y?" selected":"").">".lang(242)."<option value='0'".($Y=="0"?" selected":"").">".lang(243)."</select>";else{echo"<td align='center'><label class='block'>","<input type='checkbox' name=$C value='1'".($Y?" checked":"").($lg=="All privileges"?" id='grants-$s-all'>":">".($lg=="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(126),'">',confirm(lang(174,"$ha@$_GET[host]"));}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$n){$ie=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$ie++;}queries_redirect(ME."processlist=",lang(244,$ie),$ie||!$_POST["kill"]);}page_header(lang(115),$n);echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="nowrap checkable">
|
|||
|
',script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");$s=-1;foreach(process_list()as$s=>$J){if(!$s){echo"<thead><tr lang='en'>".(support("kill")?"<th>":"");foreach($J
|
|||
|
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'=>"../b14237/dynviews_2088.htm",));echo"</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$J[$x=="sql"?"Id":"pid"],0):"");foreach($J
|
|||
|
as$y=>$X)echo"<td>".(($x=="sql"&&$y=="Info"&&preg_match("~Query|Killed~",$J["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.($J["db"]!=""?"db=".urlencode($J["db"])."&":"")."sql=".urlencode($X)).'">'.lang(245).'</a>':h($X));echo"\n";}echo'</table>
|
|||
|
<p>
|
|||
|
';if(support("kill")){echo($s+1)."/".lang(246,max_connections()),"<p><input type='submit' value='".lang(247)."'>\n";}echo'<input type="hidden" name="token" value="',$ki,'">
|
|||
|
</form>
|
|||
|
',script("tableCheck();");}elseif(isset($_GET["select"])){$a=$_GET["select"];$S=table_status1($a);$w=indexes($a);$p=fields($a);$fd=column_foreign_keys($a);$hf=$S["Oid"];parse_str($_COOKIE["adminer_import"],$za);$Pg=array();$e=array();$Zh=null;foreach($p
|
|||
|
as$y=>$o){$C=$b->fieldName($o);if(isset($o["privileges"]["select"])&&$C!=""){$e[$y]=html_entity_decode(strip_tags($C),ENT_QUOTES);if(is_shortable($o))$Zh=$b->selectLengthProcess();}$Pg+=$o["privileges"];}list($L,$od)=$b->selectColumnsProcess($e,$w);$Xd=count($od)<count($L);$Z=$b->selectSearchProcess($p,$w);$xf=$b->selectOrderProcess($p,$w);$z=$b->selectLimitProcess();if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Ci=>$J){$Ha=convert_field($p[key($J)]);$L=array($Ha?$Ha:idf_escape(key($J)));$Z[]=where_check($Ci,$p);$I=$m->select($a,$L,$Z,$L);if($I)echo
|
|||
|
reset($I->fetch_row());}exit;}$hg=$Ei=null;foreach($w
|
|||
|
as$v){if($v["type"]=="PRIMARY"){$hg=array_flip($v["columns"]);$Ei=($L?$hg:array());foreach($Ei
|
|||
|
as$y=>$X){if(in_array(idf_escape($y),$L))unset($Ei[$y]);}break;}}if($hf&&!$hg){$hg=$Ei=array($hf=>0);$w[]=array("type"=>"PRIMARY","columns"=>array($hf));}if($_POST&&!$n){$fj=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$gb=array();foreach($_POST["check"]as$db)$gb[]=where_check($db,$p);$fj[]="((".implode(") OR (",$gb)."))";}$fj=($fj?"\nWHERE ".implode(" AND ",$fj):"");if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");$kd=($L?implode(", ",$L):"*").convert_fields($e,$p,$L)."\nFROM ".table($a);$qd=($od&&$Xd?"\nGROUP BY ".implode(", ",$od):"").($xf?"\nORDER BY ".implode(", ",$xf):"");if(!is_array($_POST["check"])||$hg)$G="SELECT $kd$fj$qd";else{$Ai=array();foreach($_POST["check"]as$X)$Ai[]="(SELECT".limit($kd,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$p).$qd,1).")";$G=implode(" UNION ALL ",$Ai);}$b->dumpData($a,"table",$G);exit;}if(!$b->selectEmailProcess($Z,$fd)){if($_POST["save"]||$_POST["delete"]){$H=true;$_a=0;$O=array();if(!$_POST["delete"]){foreach($e
|
|||
|
as$C=>$X){$X=process_input($p[$C]);if($X!==null&&($_POST["clone"]||$X!==false))$O[idf_escape($C)]=($X!==false?$X:idf_escape($C));}}if($_POST["delete"]||$O){if($_POST["clone"])$G="INTO ".table($a)." (".implode(", ",array_keys($O)).")\nSELECT ".implode(", ",$O)."\nFROM ".table($a);if($_POST["all"]||($hg&&is_array($_POST["check"]))||$Xd){$H=($_POST["delete"]?$m->delete($a,$fj):($_POST["clone"]?queries("INSERT $G$fj"):$m->update($a,$O,$fj)));$_a=$g->affected_rows;}else{foreach((array)$_POST["check"]as$X){$bj="\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$p);$H=($_POST["delete"]?$m->delete($a,$bj,1):($_POST["clone"]?queries("INSERT".limit1($a,$G,$bj)):$m->update($a,$O,$bj,1)));if(!$H)break;$_a+=$g->affected_rows;}}}$Ke=lang(248,$_a);if($_POST["clone"]&&$H&&$_a==1){$oe=last_id();if($oe)$Ke=lang(167," $oe");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$Ke,$H);if(!$_POST["delete"]){edit_form($a,$p,(array)$_POST["fields"],!$_POST["clone"]);page_footer();exit;}}elseif(!$_POST["import"]){if(!$_POST["val"])$n=lang(249);else{$H=true;$_a=0;foreach($_POST["val"]as$Ci=>$J){$O=array();foreach($J
|
|||
|
as$y=>$X){$y=bracket_escape($y,1);$O[idf_escape($y)]=(preg_match('~char|text~',$p[$y]["type"])||$X!=""?$b->processInput($p[$y],$X):"NULL");}$H=$m->update($a,$O," WHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($Ci,$p),!$Xd&&!$hg," ");if(!$H)break;$_a+=$g->affected_rows;}queries_redirect(remove_from_uri(),lang(248,$_a),$H);}}elseif(!is_string($Uc=get_file("csv_file",true)))$n=upload_error($Uc);elseif(!preg_match('~~u',$Uc))$n=lang(250);else{cookie("adminer_import","output=".urlencode($za["output"])."&format=".urlencode($_POST["separator"]));$H=true;$sb=array_keys($p);preg_match_all('~(?>"[^"]*"|[^"\r\n]+)+~',$Uc,$Ce);$_a=count($Ce[0]);$m->begin();$M=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));$K=array();foreach($Ce[0]as$y=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$M]*)$M~",$X.$M,$De);if(!$y&&!array_diff($De[1],$sb)){$sb=$De[1];$_a--;}else{$O=array();foreach($De[1]as$s=>$nb)$O[idf_escape($sb[$s])]=($nb==""&&$p[$sb[$s]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$nb))));$K[]=$O;}}$H=(!$K||$m->insertUpdate($a,$K,$hg));if($H)$H=$m->commit();queries_redirect(remove_from_uri("page"),lang(251,$_a),$H);$m->rollback();}}}$Lh=$b->tableName($S);if(is_ajax()){page_headers();ob_start();}else
|
|||
|
page_header(lang(54).": $Lh",$n);$O=null;if(isset($Pg["insert"])||!support("table")){$O="";foreach((array)$_GET["where"]as$X){if($fd[$X["col"]]&&count($fd[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!preg_match('~[_%]~',$X["val"]))))$O.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($S,$O);if(!$e&&support("table"))echo"<p class='error'>".lang(252).($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($L,$e);$b->selectSearchPrint($Z,$e,$w);$b->selectOrderPrint($xf,$e,$w);$b->selectLimitPrint($z);$b->selectLengthPrint($Zh);$b->selectActionPrint($w);echo"</form>\n";$E=$_GET["page"];if($E=="last"){$id=$g->result(count_rows($a,$Z,$Xd,$od));$E=floor(max(0,$id-1)/$z);}$bh=$L;$pd=$od;if(!$bh){$bh[]="*";$Cb=convert_fields($e,$p,$L);if($Cb)$bh[]=substr($Cb,2);}foreach($L
|
|||
|
as$y=>$X){$o=$p[idf_unescape($X)];if($o&&($Ha=convert_field($o)))$bh[$y]="$Ha AS $X";}if(!$Xd&&$Ei){foreach($Ei
|
|||
|
as$y=>$X){$bh[]=idf_escape($y);if($pd)$pd[]=idf_escape($y);}}$H=$m->select($a,$bh,$Z,$pd,$xf,$z,$E,true);if(!$H)echo"<p class='error'>".error()."\n";else{if($x=="mssql"&&$E)$H->seek($z*$E);$tc=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$K=array();while($J=$H->fetch_assoc()){if($E&&$x=="oracle")unset($J["RNUM"]);$K[]=$J;}if($_GET["page"]!="last"&&$z!=""&&$od&&$Xd&&$x=="sql")$id=$g->result(" SELECT FOUND_ROWS()");if(!$K)echo"<p class='message'>".lang(12)."\n";else{$Qa=$b->backwardKeys($a,$Lh);echo"<table id='table' cellspacing='0' class='nowrap checkable'>",script("mixin(qs('#table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown});"),"<thead><tr>".(!$od&&$L?"":"<td><input type='checkbox' id='all-page' class='jsonly'>".script("qs('#all-page').onclick = partial(formCheck, /check/);","")." <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".lang(253)."</a>");$We=array();$ld=array();reset($L);$wg=1;foreach($K[0]as$y=>$X){if(!isset($Ei[$y])){$X=$_GET["columns"][key($L)];$o=$p[$L?($X?$X["col"]:current($L)):$y];$C=($o?$b->fieldName($o,$wg):($X["fun"]?"*":$y));if($C!=""){$wg++;$We[$y]=$C;$d=idf_escape($y);$Cd=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($y);$Xb="&desc%5B0%5D=1";echo"<th>".script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});",""),'<a href="'.h($Cd.($xf[0]==$d||$xf[0]==$y||(!$xf&&$Xd&&$od[0]==$d)?$Xb:'')).'">';echo
|
|||
|
apply_sql_function($X["fun"],$C)."</a>";echo"<span class='column hidden'>","<a href='".h($Cd.$Xb)."' 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>";}$ld[$y]=$X["fun"];next($L);}}$ue=array();if($_GET["modify"]){foreach($K
|
|||
|
as$J){foreach($J
|
|||
|
as$y=>$X)$ue[$y]=max($ue[$y],min(40,strlen(utf8_decode($X))));}}echo($Qa?"<th>".lang(254):"")."</thead>\n";if(is_ajax()){if($z%2==1&&$E%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($K,$fd)as$Ve=>$J){$Bi=unique_array($K[$Ve],$w);if(!$Bi){$Bi=array();foreach($K[$Ve]as$y=>$X){if(!preg_match('~^(COUNT\((\*|(DISTINCT )?`(?:[^`]|``)+`)\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\(`(?:[^`]|``)+`\))$~',$y))$Bi[$y]=$X;}}$Ci="";foreach($Bi
|
|||
|
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($g).")").")";$X=md5($X);}$Ci.="&".($X!==null?urlencode("where[".bracket_escape($y)."]")."=".urlencode($X):"null%5B%5D=".urlencode($y));}echo"<tr".odd().">".(!$od&&$L?"":"<td>".checkbox("check[]",substr($Ci,1),in_array(substr($Ci,1),(array)$_POST["check"])).($Xd||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$Ci)."' class='edit'>".lang(255)."</a>"));foreach($J
|
|||
|
as$y=>$X){if(isset($We[$y])){$o=$p[$y];$X=$m->value($X,$o);if($X!=""&&(!isset($tc[$y])||$tc[$y]!=""))$tc[$y]=(is_mail($X)?$We[$y]:"");$_="";if(preg_match('~blob|bytea|raw|file~',$o["type"])&&$X!="")$_=ME.'download='.urlencode($a).'&field='.urlencode($y).$Ci;if(!$_&&$X!==null){foreach((array)$fd[$y]as$q){if(count($fd[$y])==1||end($q["source"])==$y){$_="";foreach($q["source"]as$s=>$sh)$_.=where_link($s,$q["target"][$s],$K[$Ve][$sh]);$_=($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"],$Bi))$_.=where_link($s++,$W["col"],$W["val"],$W["op"]);}foreach($Bi
|
|||
|
as$ce=>$W)$_.=where_link($s++,$ce,$W);}$X=select_value($X,$_,$o,$Zh);$t=h("val[$Ci][".bracket_escape($y)."]");$Y=$_POST["val"][$Ci][bracket_escape($y)];$oc=!is_array($J[$y])&&is_utf8($X)&&$K[$Ve][$y]==$J[$y]&&!$ld[$y];$Yh=preg_match('~text|lob~',$o["type"]);if(($_GET["modify"]&&$oc)||$Y!==null){$td=h($Y!==null?$Y:$J[$y]);echo"<td>".($Yh?"<textarea name='$t' cols='30' rows='".(substr_count($J[$y],"\n")+1)."'>$td</textarea>":"<input name='$t' value='$td' size='$ue[$y]'>");}else{$ye=strpos($X,"<i>...</i>");echo"<td id='$t' data-text='".($ye?2:($Yh?1:0))."'".($oc?"":" data-warning='".h(lang(256))."'").">$X</td>";}}}if($Qa)echo"<td>";$b->backwardKeysPrint($Qa,$K[$Ve]);echo"</tr>\n";}if(is_ajax())exit;echo"</table>\n";}if(!is_ajax()){if($K||$E){$Cc=true;if($_GET["page"]!="last"){if($z==""||(count($K)<$z&&($K||!$E)))$id=($E?$E*$z:0)+count($K);elseif($x!="sql"||!$Xd){$id=($Xd?false:found_rows($S,$Z));if($id<max(1e4,2*($E+1)*$z))$id=reset(slow_query(count_rows($a,$Z,$Xd,$od)));else$Cc=false;}}$Jf=($z!=""&&($id===false||$id>$z||$E));if($Jf){echo(($id===false?count($K)+1:$id-$E*$z)>$z?'<p><a href="'.h(remove_from_uri("page")."&page=".($E+1)).'" class="loadmore">'.lang(257).'</a>'.script("qsl('a').onclick = partial(selectLoadMore, ".(+$z).", '".lang(258)."...');",""):''),"\n";}}echo"<div class='footer'><div>\n";if($K||$E){if($Jf){$Fe=($id===false?$E+(count($K)>=$z?2:1):floor(($id-1)/$z));echo"<fieldset>";if($x!="simpledb"){echo"<legend><a href='".h(remove_from_uri("page"))."'>".lang(259)."</a></legend>",script("qsl('a').onclick = function () { pageClick(this.href, +prompt('".lang(259)."', '".($E+1)."')); return false; };"),pagination(0,$E).($E>5?" ...":"");for($s=max(1,$E-4);$s<min($Fe,$E+5);$s++)echo
|
|||
|
pagination($s,$E);if($Fe>0){echo($E+5<$Fe?" ...":""),($Cc&&$id!==false?pagination($Fe,$E):" <a href='".h(remove_from_uri("page")."&page=last")."' title='~$Fe'>".lang(260)."</a>");}}else{echo"<legend>".lang(259)."</legend>",pagination(0,$E).($E>1?" ...":""),($E?pagination($E,$E):""),($Fe>$E?pagination($E+1,$E).($Fe>$E+1?" ...":""):"");}echo"</fieldset>\n";}echo"<fieldset>","<legend>".lang(261)."</legend>";$cc=($Cc?"":"~ ").$id;echo
|
|||
|
checkbox("all",1,0,($id!==false?($Cc?"":"~ ").lang(149,$id):""),"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$cc' : checked); selectCount('selected2', this.checked || !checked ? '$cc' : checked);")."\n","</fieldset>\n";if($b->selectCommandPrint()){echo'<fieldset',($_GET["modify"]?'':' class="jsonly"'),'><legend>',lang(253),'</legend><div>
|
|||
|
<input type="submit" value="',lang(14),'"',($_GET["modify"]?'':' title="'.lang(249).'"'),'>
|
|||
|
</div></fieldset>
|
|||
|
<fieldset><legend>',lang(125),' <span id="selected"></span></legend><div>
|
|||
|
<input type="submit" name="edit" value="',lang(10),'">
|
|||
|
<input type="submit" name="clone" value="',lang(245),'">
|
|||
|
<input type="submit" name="delete" value="',lang(18),'">',confirm(),'</div></fieldset>
|
|||
|
';}$gd=$b->dumpFormat();foreach((array)$_GET["columns"]as$d){if($d["fun"]){unset($gd['sql']);break;}}if($gd){print_fieldset("export",lang(74)." <span id='selected2'></span>");$Hf=$b->dumpOutput();echo($Hf?html_select("output",$Hf,$za["output"])." ":""),html_select("format",$gd,$za["format"])," <input type='submit' name='export' value='".lang(74)."'>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($tc,'strlen'),$e);}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='$ki'>\n","</form>\n",(!$od&&$L?"":script("tableCheck();"));}}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$P=isset($_GET["status"]);page_header($P?lang(117):lang(116));$Si=($P?show_status():show_variables());if(!$Si)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Si
|
|||
|
as$y=>$X){echo"<tr>","<th><code class='jush-".$x.($P?"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"){$Ih=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$C=>$S){json_row("Comment-$C",h($S["Comment"]));if(!is_view($S)){foreach(array("Engine","Collation")as$y)json_row("$y-$C",h($S[$y]));foreach($Ih+array("Auto_increment"=>0,"Rows"=>0)as$y=>$X){if($S[$y]!=""){$X=format_number($S[$y]);json_row("$y-$C",($y=="Rows"&&$X&&$S["Engine"]==($vh=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Ih[$y]))$Ih[$y]+=($S["Engine"]!="InnoDB"||$y!="Data_free"?$S[$y]:0);}elseif(array_key_exists($y,$S))json_row("$y-$C");}}}foreach($Ih
|
|||
|
as$y=>$X)json_row("sum-$y",format_number($X));json_row("");}elseif($_GET["script"]=="kill")$g->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{$Rh=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Rh&&!$n&&!$_POST["search"]){$H=true;$Ke="";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"])$H=truncate_tables($_POST["tables"]);$Ke=lang(262);}elseif($_POST["move"]){$H=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Ke=lang(263);}elseif($_POST["copy"]){$H=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Ke=lang(264);}elseif($_POST["drop"]){if($_POST["views"])$H=drop_views($_POST["views"]);if($H&&$_POST["tables"])$H=drop_tables($_POST["tables"]);$Ke=lang(265);}elseif($x!="sql"){$H=($x=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Ke=lang(266);}elseif(!$_POST["tables"])$Ke=lang(9);elseif($H=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"])))){while($J=$H->fetch_assoc())$Ke.="<b>".h($J["Table"])."</b>: ".h($J["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$Ke,$H);}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(267)."</h3>\n";$Qh=tables_list();if(!$Qh)echo"<p class='message'>".lang(9)."\n";else{echo"<form action='' method='post'>\n";if(support("table")){echo"<fieldset><legend>".lang(268)." <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();}}$dc=doc_link(array('sql'=>'show-table-status.html'));echo"<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(130),'<td>'.lang(269).doc_link(array('sql'=>'storage-engines.html')),'<td>'.lang(121).doc_link(array('sql'=>'charset-charsets.html','mariadb'=>'supported-character-sets-and-collations/')),'<td>'.lang(270).$dc,'<td>'.lang(271).$dc,'<td>'.lang(272).$dc,'<td>'.lang(52).doc_link(array('sql'=>'example-auto-increment.html','mariadb'=>'auto_increment/')),'<td>'.lang(273).$dc,(support("comment")?'<td>'.lang(51).$dc:''),"</thead>\n";$T=0;foreach($Qh
|
|||
|
as$C=>$U){$Vi=($U!==null&&!preg_match('~table~i',$U));$t=h("Table-".$C);echo'<tr'.odd().'><td>'.checkbox(($Vi?"views[]":"tables[]"),$C,in_array($C,$Rh,true),"","","",$t),'<th>'.(support("table")||support("indexes")?"<a href='".h(ME)."table=".urlencode($C)."' title='".lang(43)."' id='$t'>".h($C).'</a>':h($C));if($Vi){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($C).'" title="'.lang(44).'">'.(preg_match('~materialized~i',$U)?lang(128):lang(129)).'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($C).'" title="'.lang(42).'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",lang(45)),"Index_length"=>array("indexes",lang(132)),"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($C)."'";echo($_?"<td align='right'>".(support("table")||$y=="Rows"||(support("indexes")&&$y!="Data_length")?"<a href='".h(ME."$_[0]=").urlencode($C)."'$t title='$_[1]'>?</a>":"<span$t>?</span>"):"<td id='$y-".h($C)."'>");}$T++;}echo(support("comment")?"<td id='Comment-".h($C)."'>":"");}echo"<tr><td><th>".lang(246,count($Qh)),"<td>".h($x=="sql"?$g->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";if(!information_schema(DB)){echo"<div class='footer'><div>\n";$Pi="<input type='submit' value='".lang(274)."'> ".on_help("'VACUUM'");$tf="<input type='submit' name='optimize' value='".lang(275)."'> ".on_help($x=="sql"?"'OPTIMIZE TABLE'":"'VACUUM OPTIMIZE'");echo"<fieldset><legend>".lang(125)." <span id='selected'></span></legend><div>".($x=="sqlite"?$Pi:($x=="pgsql"?$Pi.$tf:($x=="sql"?"<input type='submit' value='".lang(276)."'> ".on_help("'ANALYZE TABLE'").$tf."<input type='submit' name='check' value='".lang(277)."'> ".on_help("'CHECK TABLE'")."<input type='submit' name='repair' value='".lang(278)."'> ".on_help("'REPAIR TABLE'"):"")))."<input type='submit' name='truncate' value='".lang(279)."'> ".on_help($x=="sqlite"?"'DELETE'":"'TRUNCATE".($x=="pgsql"?"'":" TABLE'")).confirm()."<input type='submit' name='drop' value='".lang(126)."'>".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(280).": ",($k?html_select("target",$k,$l):'<input name="target" value="'.h($l).'" autocapitalize="off">')," <input type='submit' name='move' value='".lang(281)."'>",(support("copy")?" <input type='submit' name='copy' value='".lang(282)."'>":""),"\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\[/) || $T);":"")." }"),"<input type='hidden' name='token' value='$ki'>\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(203)."</a>\n":"");if(support("routine")){echo"<h3 id='routines'>".lang(142)."</h3>\n";$Tg=routines();if($Tg){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.lang(182).'<td>'.lang(50).'<td>'.lang(220)."<td></thead>\n";odd('');foreach($Tg
|
|||
|
as$J){$C=($J["SPECIFIC_NAME"]==$J["ROUTINE_NAME"]?"":"&name=".urlencode($J["ROUTINE_NAME"]));echo'<tr'.odd().'>','<th><a href="'.h(ME.($J["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($J["SPECIFIC_NAME"]).$C).'">'.h($J["ROUTINE_NAME"]).'</a>','<td>'.h($J["ROUTINE_TYPE"]),'<td>'.h($J["DTD_IDENTIFIER"]),'<td><a href="'.h(ME.($J["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($J["SPECIFIC_NAME"]).$C).'">'.lang(135)."</a>";}echo"</table>\n";}echo'<p class="links">'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.lang(219).'</a>':'').'<a href="'.h(ME).'function=">'.lang(218)."</a>\n";}if(support("sequence")){echo"<h3 id='sequences'>".lang(283)."</h3>\n";$hh=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name");if($hh){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(182)."</thead>\n";odd('');foreach($hh
|
|||
|
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(225)."</a>\n";}if(support("type")){echo"<h3 id='user-types'>".lang(26)."</h3>\n";$Ni=types();if($Ni){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(182)."</thead>\n";odd('');foreach($Ni
|
|||
|
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(229)."</a>\n";}if(support("event")){echo"<h3 id='events'>".lang(143)."</h3>\n";$K=get_rows("SHOW EVENTS");if($K){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(182)."<td>".lang(284)."<td>".lang(209)."<td>".lang(210)."<td></thead>\n";foreach($K
|
|||
|
as$J){echo"<tr>","<th>".h($J["Name"]),"<td>".($J["Execute at"]?lang(285)."<td>".$J["Execute at"]:lang(211)." ".$J["Interval value"]." ".$J["Interval field"]."<td>$J[Starts]"),"<td>$J[Ends]",'<td><a href="'.h(ME).'event='.urlencode($J["Name"]).'">'.lang(135).'</a>';}echo"</table>\n";$Ac=$g->result("SELECT @@event_scheduler");if($Ac&&$Ac!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($Ac)."\n";}echo'<p class="links"><a href="'.h(ME).'event=">'.lang(208)."</a>\n";}if($Qh)echo
|
|||
|
script("ajaxSetHtml('".js_escape(ME)."script=db');");}}}page_footer();
|