2014-05-08 19:46:08 +02:00
< ? php
/** Adminer - Compact database management
2017-06-25 00:56:50 +02:00
* @ link https :// www . adminer . org /
* @ author Jakub Vrana , https :// www . vrana . cz /
2014-05-08 19:46:08 +02:00
* @ copyright 2007 Jakub Vrana
2018-04-01 23:34:54 +02:00
* @ 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 )
2018-12-25 21:50:48 +01:00
* @ version 4.7 . 0
*/ 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 ){ $Hi = filter_input_array ( constant ( " INPUT $X " ), FILTER_UNSAFE_RAW ); if ( $Hi ) $$X = $Hi ;}} if ( function_exists ( " mb_internal_encoding " )) mb_internal_encoding ( " 8bit " ); function
connection (){ global $h ; return $h ;} function
2018-04-01 23:34:54 +02:00
adminer (){ global $b ; return $b ;} function
version (){ global $ia ; return $ia ;} function
2018-12-25 21:50:48 +01:00
idf_unescape ( $v ){ $pe = substr ( $v , - 1 ); return
str_replace ( $pe . $pe , $pe , substr ( $v , 1 , - 1 ));} function
2014-05-08 19:46:08 +02:00
escape_string ( $X ){ return
substr ( q ( $X ), 1 , - 1 );} function
2015-07-03 19:50:03 +02:00
number ( $X ){ return
preg_replace ( '~[^0-9]+~' , '' , $X );} function
2018-04-01 23:34:54 +02:00
number_type (){ return '((?<!o)int(?!er)|numeric|real|float|double|decimal|money)' ;} function
2018-12-25 21:50:48 +01:00
remove_slashes ( $rg , $Wc = false ){ if ( get_magic_quotes_gpc ()){ while ( list ( $z , $X ) = each ( $rg )){ foreach ( $X
as $ee => $W ){ unset ( $rg [ $z ][ $ee ]); if ( is_array ( $W )){ $rg [ $z ][ stripslashes ( $ee )] = $W ; $rg [] =& $rg [ $z ][ stripslashes ( $ee )];} else $rg [ $z ][ stripslashes ( $ee )] = ( $Wc ? $W : stripslashes ( $W ));}}}} function
bracket_escape ( $v , $Oa = false ){ static $ti = array ( ':' => ':1' , ']' => ':2' , '[' => ':3' , '"' => ':4' ); return
strtr ( $v ,( $Oa ? array_flip ( $ti ) : $ti ));} function
min_version ( $Yi , $De = " " , $i = null ){ global $h ; if ( ! $i ) $i = $h ; $mh = $i -> server_info ; if ( $De && preg_match ( '~([\d.]+)-MariaDB~' , $mh , $B )){ $mh = $B [ 1 ]; $Yi = $De ;} return ( version_compare ( $mh , $Yi ) >= 0 );} function
charset ( $h ){ return ( min_version ( " 5.5.3 " , 0 , $h ) ? " utf8mb4 " : " utf8 " );} function
script ( $wh , $si = " \n " ){ return " <script " . nonce () . " > $wh </script> $si " ;} function
script_src ( $Mi ){ return " <script src=' " . h ( $Mi ) . " ' " . nonce () . " ></script> \n " ;} function
2018-04-01 23:34:54 +02:00
nonce (){ return ' nonce="' . get_nonce () . '"' ;} function
target_blank (){ return ' target="_blank" rel="noreferrer noopener"' ;} function
2018-12-25 21:50:48 +01:00
h ( $P ){ return
str_replace ( " \0 " , " � " , htmlspecialchars ( $P , ENT_QUOTES , 'utf-8' ));} function
nl_br ( $P ){ return
str_replace ( " \n " , " <br> " , $P );} function
checkbox ( $C , $Y , $fb , $le = " " , $tf = " " , $kb = " " , $me = " " ){ $I = " <input type='checkbox' name=' $C ' value=' " . h ( $Y ) . " ' " . ( $fb ? " checked " : " " ) . ( $me ? " aria-labelledby=' $me ' " : " " ) . " > " . ( $tf ? script ( " qsl('input').onclick = function () { $tf }; " , " " ) : " " ); return ( $le != " " || $kb ? " <label " . ( $kb ? " class=' $kb ' " : " " ) . " > $I " . h ( $le ) . " </label> " : $I );} function
optionlist ( $zf , $gh = null , $Qi = false ){ $I = " " ; foreach ( $zf
as $ee => $W ){ $_f = array ( $ee => $W ); if ( is_array ( $W )){ $I .= '<optgroup label="' . h ( $ee ) . '">' ; $_f = $W ;} foreach ( $_f
as $z => $X ) $I .= '<option' . ( $Qi || is_string ( $z ) ? ' value="' . h ( $z ) . '"' : '' ) . (( $Qi || is_string ( $z ) ? ( string ) $z : $X ) === $gh ? ' selected' : '' ) . '>' . h ( $X ); if ( is_array ( $W )) $I .= '</optgroup>' ;} return $I ;} function
html_select ( $C , $zf , $Y = " " , $sf = true , $me = " " ){ if ( $sf ) return " <select name=' " . h ( $C ) . " ' " . ( $me ? " aria-labelledby=' $me ' " : " " ) . " > " . optionlist ( $zf , $Y ) . " </select> " . ( is_string ( $sf ) ? script ( " qsl('select').onchange = function () { $sf }; " , " " ) : " " ); $I = " " ; foreach ( $zf
as $z => $X ) $I .= " <label><input type='radio' name=' " . h ( $C ) . " ' value=' " . h ( $z ) . " ' " . ( $z == $Y ? " checked " : " " ) . " > " . h ( $X ) . " </label> " ; return $I ;} function
select_input ( $Ka , $zf , $Y = " " , $sf = " " , $dg = " " ){ $Xh = ( $zf ? " select " : " input " ); return " < $Xh $Ka " . ( $zf ? " ><option value=''> $dg " . optionlist ( $zf , $Y , true ) . " </select> " : " size='10' value=' " . h ( $Y ) . " ' placeholder=' $dg '> " ) . ( $sf ? script ( " qsl(' $Xh ').onchange = $sf ; " , " " ) : " " );} function
confirm ( $Ne = " " , $hh = " qsl('input') " ){ return
script ( " $hh .onclick = function () { return confirm(' " . ( $Ne ? js_escape ( $Ne ) : lang ( 0 )) . " '); }; " , " " );} function
print_fieldset ( $u , $ue , $bj = false ){ echo " <fieldset><legend> " , " <a href='#fieldset- $u '> $ue </a> " , script ( " qsl('a').onclick = partial(toggle, 'fieldset- $u '); " , " " ), " </legend> " , " <div id='fieldset- $u ' " . ( $bj ? " " : " class='hidden' " ) . " > \n " ;} function
2018-04-01 23:34:54 +02:00
bold ( $Wa , $kb = " " ){ return ( $Wa ? " class='active $kb ' " : ( $kb ? " class=' $kb ' " : " " ));} function
2018-12-25 21:50:48 +01:00
odd ( $I = ' class="odd"' ){ static $t = 0 ; if ( ! $I ) $t =- 1 ; return ( $t ++% 2 ? $I : '' );} function
js_escape ( $P ){ return
addcslashes ( $P , " \r \n ' \\ / " );} function
json_row ( $z , $X = null ){ static $Xc = true ; if ( $Xc ) echo " { " ; if ( $z != " " ){ echo ( $Xc ? " " : " , " ) . " \n \t \" " . addcslashes ( $z , " \r \n \t \" \\ / " ) . '": ' . ( $X !== null ? '"' . addcslashes ( $X , " \r \n \" \\ / " ) . '"' : 'null' ); $Xc = false ;} else { echo " \n } \n " ; $Xc = true ;}} function
ini_bool ( $Rd ){ $X = ini_get ( $Rd ); return ( preg_match ( '~^(on|true|yes)$~i' , $X ) || ( int ) $X );} function
2018-06-30 00:38:01 +02:00
sid (){ static $I ; if ( $I === null ) $I = ( SID &&! ( $_COOKIE && ini_bool ( " session.use_cookies " ))); return $I ;} function
2018-12-25 21:50:48 +01:00
set_password ( $Xi , $N , $V , $F ){ $_SESSION [ " pwds " ][ $Xi ][ $N ][ $V ] = ( $_COOKIE [ " adminer_key " ] && is_string ( $F ) ? array ( encrypt_string ( $F , $_COOKIE [ " adminer_key " ])) : $F );} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
q ( $P ){ global $h ; return $h -> quote ( $P );} function
get_vals ( $G , $e = 0 ){ global $h ; $I = array (); $H = $h -> query ( $G ); if ( is_object ( $H )){ while ( $J = $H -> fetch_row ()) $I [] = $J [ $e ];} return $I ;} function
get_key_vals ( $G , $i = null , $ph = true ){ global $h ; if ( ! is_object ( $i )) $i = $h ; $I = array (); $H = $i -> query ( $G ); if ( is_object ( $H )){ while ( $J = $H -> fetch_row ()){ if ( $ph ) $I [ $J [ 0 ]] = $J [ 1 ]; else $I [] = $J [ 0 ];}} return $I ;} function
get_rows ( $G , $i = null , $o = " <p class='error'> " ){ global $h ; $xb = ( is_object ( $i ) ? $i : $h ); $I = array (); $H = $xb -> query ( $G ); if ( is_object ( $H )){ while ( $J = $H -> fetch_assoc ()) $I [] = $J ;} elseif ( ! $H &&! is_object ( $i ) && $o && defined ( " PAGE_HEADER " )) echo $o . error () . " \n " ; return $I ;} function
unique_array ( $J , $x ){ foreach ( $x
as $w ){ if ( preg_match ( " ~PRIMARY|UNIQUE~ " , $w [ " type " ])){ $I = array (); foreach ( $w [ " columns " ] as $z ){ if ( ! isset ( $J [ $z ])) continue
2 ; $I [ $z ] = $J [ $z ];} return $I ;}}} function
escape_key ( $z ){ if ( preg_match ( '(^([\w(]+)(' . str_replace ( " _ " , " .* " , preg_quote ( idf_escape ( " _ " ))) . ')([ \w)]+)$)' , $z , $B )) return $B [ 1 ] . idf_escape ( idf_unescape ( $B [ 2 ])) . $B [ 3 ]; return
idf_escape ( $z );} function
where ( $Z , $q = array ()){ global $h , $y ; $I = array (); foreach (( array ) $Z [ " where " ] as $z => $X ){ $z = bracket_escape ( $z , 1 ); $e = escape_key ( $z ); $I [] = $e . ( $y == " sql " && preg_match ( '~^[0-9]*\.[0-9]*$~' , $X ) ? " LIKE " . q ( addcslashes ( $X , " %_ \\ " )) : ( $y == " mssql " ? " LIKE " . q ( preg_replace ( '~[_%[]~' , '[\0]' , $X )) : " = " . unconvert_field ( $q [ $z ], q ( $X )))); if ( $y == " sql " && preg_match ( '~char|text~' , $q [ $z ][ " type " ]) && preg_match ( " ~[^ -@]~ " , $X )) $I [] = " $e = " . q ( $X ) . " COLLATE " . charset ( $h ) . " _bin " ;} foreach (( array ) $Z [ " null " ] as $z ) $I [] = escape_key ( $z ) . " IS NULL " ; return
2018-06-30 00:38:01 +02:00
implode ( " AND " , $I );} function
2018-12-25 21:50:48 +01:00
where_check ( $X , $q = array ()){ parse_str ( $X , $db ); remove_slashes ( array ( & $db )); return
where ( $db , $q );} function
where_link ( $t , $e , $Y , $vf = " = " ){ return " &where%5B $t %5D%5Bcol%5D= " . urlencode ( $e ) . " &where%5B $t %5D%5Bop%5D= " . urlencode (( $Y !== null ? $vf : " IS NULL " )) . " &where%5B $t %5D%5Bval%5D= " . urlencode ( $Y );} function
convert_fields ( $f , $q , $L = array ()){ $I = " " ; foreach ( $f
as $z => $X ){ if ( $L &&! in_array ( idf_escape ( $z ), $L )) continue ; $Ha = convert_field ( $q [ $z ]); if ( $Ha ) $I .= " , $Ha AS " . idf_escape ( $z );} return $I ;} function
cookie ( $C , $Y , $xe = 2592000 ){ global $ba ; return
header ( " Set-Cookie: $C = " . urlencode ( $Y ) . ( $xe ? " ; expires= " . gmdate ( " D, d M Y H:i:s " , time () + $xe ) . " GMT " : " " ) . " ; path= " . preg_replace ( '~\?.*~' , '' , $_SERVER [ " REQUEST_URI " ]) . ( $ba ? " ; secure " : " " ) . " ; HttpOnly; SameSite=lax " , false );} function
2014-05-08 19:46:08 +02:00
restart_session (){ if ( ! ini_bool ( " session.use_cookies " )) session_start ();} function
2018-12-25 21:50:48 +01:00
stop_session ( $cd = false ){ if ( ! ini_bool ( " session.use_cookies " ) || ( $cd &&@ ini_set ( " session.use_cookies " , false ) !== false )) session_write_close ();} function & get_session ( $z ){ return $_SESSION [ $z ][ DRIVER ][ SERVER ][ $_GET [ " username " ]];} function
set_session ( $z , $X ){ $_SESSION [ $z ][ DRIVER ][ SERVER ][ $_GET [ " username " ]] = $X ;} function
auth_url ( $Xi , $N , $V , $m = null ){ global $fc ; preg_match ( '~([^?]*)\??(.*)~' , remove_from_uri ( implode ( " | " , array_keys ( $fc )) . " |username| " . ( $m !== null ? " db| " : " " ) . session_name ()), $B ); return " $B[1] ? " . ( sid () ? SID . " & " : " " ) . ( $Xi != " server " || $N != " " ? urlencode ( $Xi ) . " = " . urlencode ( $N ) . " & " : " " ) . " username= " . urlencode ( $V ) . ( $m != " " ? " &db= " . urlencode ( $m ) : " " ) . ( $B [ 2 ] ? " & $B[2] " : " " );} function
2014-05-08 19:46:08 +02:00
is_ajax (){ return ( $_SERVER [ " HTTP_X_REQUESTED_WITH " ] == " XMLHttpRequest " );} function
2018-12-25 21:50:48 +01:00
redirect ( $ze , $Ne = null ){ if ( $Ne !== null ){ restart_session (); $_SESSION [ " messages " ][ preg_replace ( '~^[^?]*~' , '' ,( $ze !== null ? $ze : $_SERVER [ " REQUEST_URI " ]))][] = $Ne ;} if ( $ze !== null ){ if ( $ze == " " ) $ze = " . " ; header ( " Location: $ze " ); exit ;}} function
query_redirect ( $G , $ze , $Ne , $Cg = true , $Dc = true , $Oc = false , $fi = " " ){ global $h , $o , $b ; if ( $Dc ){ $Dh = microtime ( true ); $Oc =! $h -> query ( $G ); $fi = format_time ( $Dh );} $zh = " " ; if ( $G ) $zh = $b -> messageQuery ( $G , $fi , $Oc ); if ( $Oc ){ $o = error () . $zh . script ( " messagesPrint(); " ); return
false ;} if ( $Cg ) redirect ( $ze , $Ne . $zh ); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
queries ( $G ){ global $h ; static $wg = array (); static $Dh ; if ( ! $Dh ) $Dh = microtime ( true ); if ( $G === null ) return
array ( implode ( " \n " , $wg ), format_time ( $Dh )); $wg [] = ( preg_match ( '~;$~' , $G ) ? " DELIMITER ;; \n $G ; \n DELIMITER " : $G ) . " ; " ; return $h -> query ( $G );} function
apply_queries ( $G , $S , $_c = 'table' ){ foreach ( $S
as $Q ){ if ( ! queries ( " $G " . $_c ( $Q ))) return
2014-05-08 19:46:08 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
queries_redirect ( $ze , $Ne , $Cg ){ list ( $wg , $fi ) = queries ( null ); return
query_redirect ( $wg , $ze , $Ne , $Cg , false , ! $Cg , $fi );} function
format_time ( $Dh ){ return
lang ( 1 , max ( 0 , microtime ( true ) - $Dh ));} function
remove_from_uri ( $Of = " " ){ return
substr ( preg_replace ( " ~(?<=[?&])( $Of " . ( SID ? " " : " | " . session_name ()) . " )=[^&]*&~ " , '' , " $_SERVER[REQUEST_URI] & " ), 0 , - 1 );} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
get_file ( $z , $Sb = false ){ $Uc = $_FILES [ $z ]; if ( ! $Uc ) return
2018-06-30 00:38:01 +02:00
null ; foreach ( $Uc
2018-12-25 21:50:48 +01:00
as $z => $X ) $Uc [ $z ] = ( array ) $X ; $I = '' ; foreach ( $Uc [ " error " ] as $z => $o ){ if ( $o ) return $o ; $C = $Uc [ " name " ][ $z ]; $ni = $Uc [ " tmp_name " ][ $z ]; $_b = file_get_contents ( $Sb && preg_match ( '~\.gz$~' , $C ) ? " compress.zlib:// $ni " : $ni ); if ( $Sb ){ $Dh = substr ( $_b , 0 , 3 ); if ( function_exists ( " iconv " ) && preg_match ( " ~^ \xFE \xFF |^ \xFF \xFE ~ " , $Dh , $Ig )) $_b = iconv ( " utf-16 " , " utf-8 " , $_b ); elseif ( $Dh == " \xEF \xBB \xBF " ) $_b = substr ( $_b , 3 ); $I .= $_b . " \n \n " ;} else $I .= $_b ;} return $I ;} function
upload_error ( $o ){ $Ke = ( $o == UPLOAD_ERR_INI_SIZE ? ini_get ( " upload_max_filesize " ) : 0 ); return ( $o ? lang ( 2 ) . ( $Ke ? " " . lang ( 3 , $Ke ) : " " ) : lang ( 4 ));} function
repeat_pattern ( $bg , $ve ){ return
str_repeat ( " $bg { 0,65535} " , $ve / 65535 ) . " $bg { 0, " . ( $ve % 65535 ) . " } " ;} function
2018-06-30 00:38:01 +02:00
is_utf8 ( $X ){ return ( preg_match ( '~~u' , $X ) &&! preg_match ( '~[\0-\x8\xB\xC\xE-\x1F]~' , $X ));} function
2018-12-25 21:50:48 +01:00
shorten_utf8 ( $P , $ve = 80 , $Lh = " " ){ if ( ! preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n - \ x { 10FFFF}] " , $ve ) . " )( $ )?)u " , $P , $B )) preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n -~] " , $ve ) . " )( $ )?) " , $P , $B ); return
h ( $B [ 1 ]) . $Lh . ( isset ( $B [ 2 ]) ? " " : " <i>...</i> " );} function
2014-05-08 19:46:08 +02:00
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
2018-12-25 21:50:48 +01:00
hidden_fields ( $rg , $Gd = array ()){ $I = false ; while ( list ( $z , $X ) = each ( $rg )){ if ( ! in_array ( $z , $Gd )){ if ( is_array ( $X )){ foreach ( $X
as $ee => $W ) $rg [ $z . " [ $ee ] " ] = $W ;} else { $I = true ; echo '<input type="hidden" name="' . h ( $z ) . '" value="' . h ( $X ) . '">' ;}}} return $I ;} function
2014-05-08 19:46:08 +02:00
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
2018-12-25 21:50:48 +01:00
table_status1 ( $Q , $Pc = false ){ $I = table_status ( $Q , $Pc ); return ( $I ? $I : array ( " Name " => $Q ));} function
column_foreign_keys ( $Q ){ global $b ; $I = array (); foreach ( $b -> foreignKeys ( $Q ) as $r ){ foreach ( $r [ " source " ] as $X ) $I [ $X ][] = $r ;} return $I ;} function
enum_input ( $T , $Ka , $p , $Y , $uc = null ){ global $b ; preg_match_all ( " ~'((?:[^']|'')*)'~ " , $p [ " length " ], $Fe ); $I = ( $uc !== null ? " <label><input type=' $T ' $Ka value=' $uc ' " . (( is_array ( $Y ) ? in_array ( $uc , $Y ) : $Y === 0 ) ? " checked " : " " ) . " ><i> " . lang ( 7 ) . " </i></label> " : " " ); foreach ( $Fe [ 1 ] as $t => $X ){ $X = stripcslashes ( str_replace ( " '' " , " ' " , $X )); $fb = ( is_int ( $Y ) ? $Y == $t + 1 : ( is_array ( $Y ) ? in_array ( $t + 1 , $Y ) : $Y === $X )); $I .= " <label><input type=' $T ' $Ka value=' " . ( $t + 1 ) . " ' " . ( $fb ? ' checked' : '' ) . '>' . h ( $b -> editVal ( $X , $p )) . '</label>' ;} return $I ;} function
input ( $p , $Y , $s ){ global $U , $b , $y ; $C = h ( bracket_escape ( $p [ " field " ])); echo " <td class='function'> " ; if ( is_array ( $Y ) &&! $s ){ $Fa = array ( $Y ); if ( version_compare ( PHP_VERSION , 5.4 ) >= 0 ) $Fa [] = JSON_PRETTY_PRINT ; $Y = call_user_func_array ( 'json_encode' , $Fa ); $s = " json " ;} $Mg = ( $y == " mssql " && $p [ " auto_increment " ]); if ( $Mg &&! $_POST [ " save " ]) $s = null ; $ld = ( isset ( $_GET [ " select " ]) || $Mg ? array ( " orig " => lang ( 8 )) : array ()) + $b -> editFunctions ( $p ); $Ka = " name='fields[ $C ]' " ; if ( $p [ " type " ] == " enum " ) echo
h ( $ld [ " " ]) . " <td> " . $b -> editInput ( $_GET [ " edit " ], $p , $Ka , $Y ); else { $vd = ( in_array ( $s , $ld ) || isset ( $ld [ $s ])); echo ( count ( $ld ) > 1 ? " <select name='function[ $C ]'> " . optionlist ( $ld , $s === null || $vd ? $s : " " ) . " </select> " . on_help ( " getTarget(event).value.replace(/^SQL \$ /, '') " , 1 ) . script ( " qsl('select').onchange = functionChange; " , " " ) : h ( reset ( $ld ))) . '<td>' ; $Td = $b -> editInput ( $_GET [ " edit " ], $p , $Ka , $Y ); if ( $Td != " " ) echo $Td ; elseif ( preg_match ( '~bool~' , $p [ " type " ])) echo " <input type='hidden' $Ka value='0'> " . " <input type='checkbox' " . ( preg_match ( '~^(1|t|true|y|yes|on)$~i' , $Y ) ? " checked='checked' " : " " ) . " $Ka value='1'> " ; elseif ( $p [ " type " ] == " set " ){ preg_match_all ( " ~'((?:[^']|'')*)'~ " , $p [ " length " ], $Fe ); foreach ( $Fe [ 1 ] as $t => $X ){ $X = stripcslashes ( str_replace ( " '' " , " ' " , $X )); $fb = ( is_int ( $Y ) ? ( $Y >> $t ) & 1 : in_array ( $X , explode ( " , " , $Y ), true )); echo " <label><input type='checkbox' name='fields[ $C ][ $t ]' value=' " . ( 1 << $t ) . " ' " . ( $fb ? ' checked' : '' ) . " > " . h ( $b -> editVal ( $X , $p )) . '</label>' ;}} elseif ( preg_match ( '~blob|bytea|raw|file~' , $p [ " type " ]) && ini_bool ( " file_uploads " )) echo " <input type='file' name='fields- $C '> " ; elseif (( $di = preg_match ( '~text|lob~' , $p [ " type " ])) || preg_match ( " ~ \n ~ " , $Y )){ if ( $di && $y != " sqlite " ) $Ka .= " cols='50' rows='12' " ; else { $K = min ( 12 , substr_count ( $Y , " \n " ) + 1 ); $Ka .= " cols='30' rows=' $K ' " . ( $K == 1 ? " style='height: 1.2em;' " : " " );} echo " <textarea $Ka > " . h ( $Y ) . '</textarea>' ;} elseif ( $s == " json " || preg_match ( '~^jsonb?$~' , $p [ " type " ])) echo " <textarea $Ka cols='50' rows='12' class='jush-js'> " . h ( $Y ) . '</textarea>' ; else { $Me = ( ! preg_match ( '~int~' , $p [ " type " ]) && preg_match ( '~^(\d+)(,(\d+))?$~' , $p [ " length " ], $B ) ? (( preg_match ( " ~binary~ " , $p [ " type " ]) ? 2 : 1 ) * $B [ 1 ] + ( $B [ 3 ] ? 1 : 0 ) + ( $B [ 2 ] &&! $p [ " unsigned " ] ? 1 : 0 )) : ( $U [ $p [ " type " ]] ? $U [ $p [ " type " ]] + ( $p [ " unsigned " ] ? 0 : 1 ) : 0 )); if ( $y == 'sql' && min_version ( 5.6 ) && preg_match ( '~time~' , $p [ " type " ])) $Me += 7 ; echo " <input " . (( ! $vd || $s === " " ) && preg_match ( '~(?<!o)int(?!er)~' , $p [ " type " ]) &&! preg_match ( '~\[\]~' , $p [ " full_type " ]) ? " type='number' " : " " ) . " value=' " . h ( $Y ) . " ' " . ( $Me ? " data-maxlength=' $Me ' " : " " ) . ( preg_match ( '~char|binary~' , $p [ " type " ]) && $Me > 20 ? " size='40' " : " " ) . " $Ka > " ;} echo $b -> editHint ( $_GET [ " edit " ], $p , $Y ); $Xc = 0 ; foreach ( $ld
as $z => $X ){ if ( $z === " " ||! $X ) break ; $Xc ++ ;} if ( $Xc ) echo
2018-06-30 00:38:01 +02:00
script ( " mixin(qsl('td'), { onchange: partial(skipOriginal, $Xc ), oninput: function () { this.onchange(); }}); " );}} function
2018-12-25 21:50:48 +01:00
process_input ( $p ){ global $b , $n ; $v = bracket_escape ( $p [ " field " ]); $s = $_POST [ " function " ][ $v ]; $Y = $_POST [ " fields " ][ $v ]; if ( $p [ " type " ] == " enum " ){ if ( $Y ==- 1 ) return
false ; if ( $Y == " " ) return " NULL " ; return + $Y ;} if ( $p [ " auto_increment " ] && $Y == " " ) return
null ; if ( $s == " orig " ) return ( preg_match ( '~^CURRENT_TIMESTAMP~i' , $p [ " on_update " ]) ? idf_escape ( $p [ " field " ]) : false ); if ( $s == " NULL " ) return " NULL " ; if ( $p [ " type " ] == " set " ) return
array_sum (( array ) $Y ); if ( $s == " json " ){ $s = " " ; $Y = json_decode ( $Y , true ); if ( ! is_array ( $Y )) return
false ; return $Y ;} if ( preg_match ( '~blob|bytea|raw|file~' , $p [ " type " ]) && ini_bool ( " file_uploads " )){ $Uc = get_file ( " fields- $v " ); if ( ! is_string ( $Uc )) return
false ; return $n -> quoteBinary ( $Uc );} return $b -> processInput ( $p , $Y , $s );} function
fields_from_edit (){ global $n ; $I = array (); foreach (( array ) $_POST [ " field_keys " ] as $z => $X ){ if ( $X != " " ){ $X = bracket_escape ( $X ); $_POST [ " function " ][ $X ] = $_POST [ " field_funs " ][ $z ]; $_POST [ " fields " ][ $X ] = $_POST [ " field_vals " ][ $z ];}} foreach (( array ) $_POST [ " fields " ] as $z => $X ){ $C = bracket_escape ( $z , 1 ); $I [ $C ] = array ( " field " => $C , " privileges " => array ( " insert " => 1 , " update " => 1 ), " null " => 1 , " auto_increment " => ( $z == $n -> primary ),);} return $I ;} function
search_tables (){ global $b , $h ; $_GET [ " where " ][ 0 ][ " val " ] = $_POST [ " query " ]; $jh = " <ul> \n " ; foreach ( table_status ( '' , true ) as $Q => $R ){ $C = $b -> tableName ( $R ); if ( isset ( $R [ " Engine " ]) && $C != " " && ( ! $_POST [ " tables " ] || in_array ( $Q , $_POST [ " tables " ]))){ $H = $h -> query ( " SELECT " . limit ( " 1 FROM " . table ( $Q ), " WHERE " . implode ( " AND " , $b -> selectSearchProcess ( fields ( $Q ), array ())), 1 )); if ( ! $H || $H -> fetch_row ()){ $ng = " <a href=' " . h ( ME . " select= " . urlencode ( $Q ) . " &where[0][op]= " . urlencode ( $_GET [ " where " ][ 0 ][ " op " ]) . " &where[0][val]= " . urlencode ( $_GET [ " where " ][ 0 ][ " val " ])) . " '> $C </a> " ; echo " $jh <li> " . ( $H ? $ng : " <p class='error'> $ng : " . error ()) . " \n " ; $jh = " " ;}}} echo ( $jh ? " <p class='message'> " . lang ( 9 ) : " </ul> " ) . " \n " ;} function
dump_headers ( $Dd , $We = false ){ global $b ; $I = $b -> dumpHeaders ( $Dd , $We ); $Lf = $_POST [ " output " ]; if ( $Lf != " text " ) header ( " Content-Disposition: attachment; filename= " . $b -> dumpFilename ( $Dd ) . " . $I " . ( $Lf != " file " &&! preg_match ( '~[^0-9a-z]~' , $Lf ) ? " . $Lf " : " " )); session_write_close (); ob_flush (); flush (); return $I ;} function
2018-06-30 00:38:01 +02:00
dump_csv ( $J ){ foreach ( $J
2018-12-25 21:50:48 +01:00
as $z => $X ){ if ( preg_match ( " ~[ \" \n ,; \t ]~ " , $X ) || $X === " " ) $J [ $z ] = '"' . str_replace ( '"' , '""' , $X ) . '"' ;} echo
2018-06-30 00:38:01 +02:00
implode (( $_POST [ " format " ] == " csv " ? " , " : ( $_POST [ " format " ] == " tsv " ? " \t " : " ; " )), $J ) . " \r \n " ;} function
2018-12-25 21:50:48 +01:00
apply_sql_function ( $s , $e ){ return ( $s ? ( $s == " unixepoch " ? " DATETIME( $e , ' $s ') " : ( $s == " count distinct " ? " COUNT(DISTINCT " : strtoupper ( " $s ( " )) . " $e ) " ) : $e );} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
password_file ( $j ){ $Vc = get_temp_dir () . " /adminer.key " ; $I =@ file_get_contents ( $Vc ); if ( $I ||! $j ) return $I ; $jd =@ fopen ( $Vc , " w " ); if ( $jd ){ chmod ( $Vc , 0660 ); $I = rand_string (); fwrite ( $jd , $I ); fclose ( $jd );} return $I ;} function
2014-05-08 19:46:08 +02:00
rand_string (){ return
md5 ( uniqid ( mt_rand (), true ));} function
2018-12-25 21:50:48 +01:00
select_value ( $X , $A , $p , $ei ){ global $b ; if ( is_array ( $X )){ $I = " " ; foreach ( $X
as $ee => $W ) $I .= " <tr> " . ( $X != array_values ( $X ) ? " <th> " . h ( $ee ) : " " ) . " <td> " . select_value ( $W , $A , $p , $ei ); return " <table cellspacing='0'> $I </table> " ;} if ( ! $A ) $A = $b -> selectLink ( $X , $p ); if ( $A === null ){ if ( is_mail ( $X )) $A = " mailto: $X " ; if ( is_url ( $X )) $A = $X ;} $I = $b -> editVal ( $X , $p ); if ( $I !== null ){ if ( ! is_utf8 ( $I )) $I = " \0 " ; elseif ( $ei != " " && is_shortable ( $p )) $I = shorten_utf8 ( $I , max ( 0 , + $ei )); else $I = h ( $I );} return $b -> selectVal ( $I , $A , $p , $X );} function
is_mail ( $rc ){ $Ia = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]' ; $ec = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; $bg = " $Ia +( \\ . $Ia +)*@( $ec ? \\ .)+ $ec " ; return
is_string ( $rc ) && preg_match ( " (^ $bg (, \\ s* $bg )* \$ )i " , $rc );} function
is_url ( $P ){ $ec = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; return
preg_match ( " ~^(https?)://( $ec ? \\ .)+ $ec (: \\ d+)?(/.*)?( \\ ?.*)?(#.*)? \$ ~i " , $P );} function
is_shortable ( $p ){ return
preg_match ( '~char|text|json|lob|geometry|point|linestring|polygon|string|bytea~' , $p [ " type " ]);} function
count_rows ( $Q , $Z , $Zd , $od ){ global $y ; $G = " FROM " . table ( $Q ) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " ); return ( $Zd && ( $y == " sql " || count ( $od ) == 1 ) ? " SELECT COUNT(DISTINCT " . implode ( " , " , $od ) . " ) $G " : " SELECT COUNT(*) " . ( $Zd ? " FROM (SELECT 1 $G GROUP BY " . implode ( " , " , $od ) . " ) x " : $G ));} function
slow_query ( $G ){ global $b , $pi , $n ; $m = $b -> database (); $gi = $b -> queryTimeout (); $th = $n -> slowQuery ( $G , $gi ); if ( ! $th && support ( " kill " ) && is_object ( $i = connect ()) && ( $m == " " || $i -> select_db ( $m ))){ $je = $i -> result ( connection_id ()); echo '<script' , nonce (), ' >
2014-05-08 19:46:08 +02:00
var timeout = setTimeout ( function () {
ajax ( \ '' , js_escape ( ME ), ' script = kill\ ' , function () {
2018-12-25 21:50:48 +01:00
}, \ 'kill=' , $je , '&token=' , $pi , ' \ ' );
}, ',1000*$gi,' );
2014-05-08 19:46:08 +02:00
</ script >
2018-12-25 21:50:48 +01:00
' ;} else $i = null ; ob_flush (); flush (); $I =@ get_key_vals (( $th ? $th : $G ), $i , false ); if ( $i ){ echo
2018-06-30 00:38:01 +02:00
script ( " clearTimeout(timeout); " ); ob_flush (); flush ();} return $I ;} function
2018-12-25 21:50:48 +01:00
get_token (){ $zg = rand ( 1 , 1e6 ); return ( $zg ^ $_SESSION [ " token " ]) . " : $zg " ;} function
verify_token (){ list ( $pi , $zg ) = explode ( " : " , $_POST [ " token " ]); return ( $zg ^ $_SESSION [ " token " ]) == $pi ;} function
lzw_decompress ( $Sa ){ $ac = 256 ; $Ta = 8 ; $mb = array (); $Og = 0 ; $Pg = 0 ; for ( $t = 0 ; $t < strlen ( $Sa ); $t ++ ){ $Og = ( $Og << 8 ) + ord ( $Sa [ $t ]); $Pg += 8 ; if ( $Pg >= $Ta ){ $Pg -= $Ta ; $mb [] = $Og >> $Pg ; $Og &= ( 1 << $Pg ) - 1 ; $ac ++ ; if ( $ac >> $Ta ) $Ta ++ ;}} $Zb = range ( " \0 " , " \xFF " ); $I = " " ; foreach ( $mb
as $t => $lb ){ $qc = $Zb [ $lb ]; if ( ! isset ( $qc )) $qc = $mj . $mj [ 0 ]; $I .= $qc ; if ( $t ) $Zb [] = $mj . $qc [ 0 ]; $mj = $qc ;} return $I ;} function
on_help ( $sb , $qh = 0 ){ return
script ( " mixin(qsl('select, input'), { onmouseover: function (event) { helpMouseover.call(this, event, $sb , $qh ) }, onmouseout: helpMouseout}); " , " " );} function
edit_form ( $a , $q , $J , $Ki ){ global $b , $y , $pi , $o ; $Qh = $b -> tableName ( table_status1 ( $a , true )); page_header (( $Ki ? lang ( 10 ) : lang ( 11 )), $o , array ( " select " => array ( $a , $Qh )), $Qh ); if ( $J === false ) echo " <p class='error'> " . lang ( 12 ) . " \n " ; echo ' < form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
';if(!$q)echo"<p class=' error '>".lang(13)."\n";else{echo"<table cellspacing=' 0 ' class=' layout '>".script("qsl(' table ' ) . onkeydown = editingKeydown ; " );foreach( $q
as $C => $p ){ echo " <tr><th> " . $b -> fieldName ( $p ); $Tb = $_GET [ " set " ][ bracket_escape ( $C )]; if ( $Tb === null ){ $Tb = $p [ " default " ]; if ( $p [ " type " ] == " bit " && preg_match ( " ~^b'([01]*)' \$ ~ " , $Tb , $Ig )) $Tb = $Ig [ 1 ];} $Y = ( $J !== null ? ( $J [ $C ] != " " && $y == " sql " && preg_match ( " ~enum|set~ " , $p [ " type " ]) ? ( is_array ( $J [ $C ]) ? array_sum ( $J [ $C ]) :+ $J [ $C ]) : $J [ $C ]) : ( ! $Ki && $p [ " auto_increment " ] ? " " : ( isset ( $_GET [ " select " ]) ? false : $Tb ))); if ( ! $_POST [ " save " ] && is_string ( $Y )) $Y = $b -> editVal ( $Y , $p ); $s = ( $_POST [ " save " ] ? ( string ) $_POST [ " function " ][ $C ] : ( $Ki && preg_match ( '~^CURRENT_TIMESTAMP~i' , $p [ " on_update " ]) ? " now " : ( $Y === false ? null : ( $Y !== null ? '' : 'NULL' )))); if ( preg_match ( " ~time~ " , $p [ " type " ]) && preg_match ( '~^CURRENT_TIMESTAMP~i' , $Y )){ $Y = " " ; $s = " now " ;} input ( $p , $Y , $s ); echo " \n " ;} if ( ! support ( " table " )) echo " <tr> " . " <th><input name='field_keys[]'> " . script ( " qsl('input').oninput = fieldChange; " ) . " <td class='function'> " . html_select ( " field_funs[] " , $b -> editFunctions ( array ( " null " => isset ( $_GET [ " select " ])))) . " <td><input name='field_vals[]'> " . " \n " ; echo " </table> \n " ;} echo " <p> \n " ; if ( $q ){ echo " <input type='submit' value=' " . lang ( 14 ) . " '> \n " ; if ( ! isset ( $_GET [ " select " ])){ echo " <input type='submit' name='insert' value=' " . ( $Ki ? lang ( 15 ) : lang ( 16 )) . " ' title='Ctrl+Shift+Enter'> \n " ,( $Ki ? script ( " qsl('input').onclick = function () { return !ajaxForm(this.form, ' " . lang ( 17 ) . " ...', this); }; " ) : " " );}} echo ( $Ki ? " <input type='submit' name='delete' value=' " . lang ( 18 ) . " '> " . confirm () . " \n " : ( $_POST ||! $q ? " " : script ( " focus(qsa('td', qs('#form'))[1].firstChild); " ))); if ( isset ( $_GET [ " select " ])) hidden_fields ( array ( " check " => ( array ) $_POST [ " check " ], " clone " => $_POST [ " clone " ], " all " => $_POST [ " all " ])); echo '<input type="hidden" name="referer" value="' , h ( isset ( $_POST [ " referer " ]) ? $_POST [ " referer " ] : $_SERVER [ " HTTP_REFERER " ]), ' " >
2014-05-08 19:46:08 +02:00
< input type = " hidden " name = " save " value = " 1 " >
2018-12-25 21:50:48 +01:00
< input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-04-01 23:34:54 +02:00
' ;} 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> X P a J<> 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
2018-12-25 21:50:48 +01:00
lzw_decompress ( " \n 1 ̇<> ٌ<EFBFBD> l7<6C> <37> B1<42> 4vb0<62> <30> fs<66> <73> <EFBFBD> n2B<32> ѱ٘<D1B1> n:<0E> # (<28> b. \r D c)<29> <> a7 E<> <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 \r c<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 \r FB \r y T7SS<53> P<EFBFBD> 1=Ǥ cI<63> <49> :<18> d<EFBFBD> <64> m><3E> S8 L<> J<EFBFBD> <4A> t. M<> <01> <> ϋ`'C<> <43> <EFBFBD> <EFBFBD> 8 89<38> <39> <11> Q<7F> <51> <EFBFBD> <EFBFBD> 2<EFBFBD> #8А <38> <D090> <EFBFBD> <EFBFBD> 6 m<> <6D> <11> <> j<1E> <> h<EFBFBD> <<3C> <> <EFBFBD> <EFBFBD> <EFBFBD> 9/<2F> <> <EFBFBD> :<0E> J<EFBFBD> )ʂ<> \0 d >! \0 Z<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\r d!)<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> A Q<P<:<3A> #u/<2F> :T\\ ><3E> <> -<2D> xJ<78> ͍ QH \n j<> L+ j<> z<EFBFBD> <7A> <EFBFBD> 7<EFBFBD> <37> <EFBFBD> `<60> <> <EFBFBD> <EFBFBD> \n k<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> \r H<> l <20> <> <EFBFBD> <EFBFBD> b<> <62> r<EFBFBD> 7<EFBFBD> <37> 6<EFBFBD> <36> <EFBFBD> j|<7C> <> <EFBFBD> <04> ۖ*<2A> F Aq uvyO<79> <4F> WeM<65> <02> <1A> <> D.F<> <46> 0<> ECb<43> Q<EFBFBD> <9 b<1D> hx Nt<4E> <74> b<EFBFBD> <1D> @pl<70> .'<27> ֪<> \$ t<> D<08> <14> <EFBFBD> <05> <> <1D> <> <0E> <> <EFBFBD> <EFBFBD> I<<3C> \" <EFBFBD> c+<2B> L( 1<> <31> ZEC<45> <43> O <09> <> E<EFBFBD> <19> <> .<2E> <> \$ &<26> \n #<23> IM && \n <EFBFBD> !<21> m<0C> ̡<EFBFBD> t<EFBFBD> <74> <EFBFBD> <EFBFBD> B<> <42> <13> 洳<EFBFBD> T<EFBFBD> <54> <EFBFBD> <EFBFBD> K-T<> <54> <EFBFBD> <EFBFBD> H<EFBFBD> <48> ŭ<11> <> <20> <> x<EFBFBD> r<EFBFBD> J<EFBFBD> <4A> V<EFBFBD> <56> *<2A> F<EFBFBD> <46> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߰cwq<77> L\$ @n<11> t<%<25> <> T<EFBFBD> r 1߲܃ <DFB2> <DC83> g<EFBFBD> i<EFBFBD> P)<29> L= \\ @<40> T<EFBFBD> <54> <EFBFBD> ,# Y<> 9_<39> <05> <08> <06> N `Ѻ \" FR)<29> Y<EFBFBD> ;g|<7C> <> i<EFBFBD> <69> ,9X<39> <58> \$ <EFBFBD> '<27> J= Bx<42> <78> Z<EFBFBD> @<40> <> <EFBFBD> <EFBFBD> <EFBFBD> E<EFBFBD> \" 5F]<5D> j<> bt FAk<41> <6B> ,<2C> <1F> <> '̹?Q<> mE<6D> <1B> <0E> <> 8'<27> <> <EFBFBD> <0E> a t<> A<EFBFBD> <41> <EFBFBD> <15> < \r <EFBFBD> <EFBFBD> @b<> <62> <EFBFBD> <EFBFBD> P*\r <13> *i<12> u7<75> /<2F> { v<> Q<EFBFBD> Z<EFBFBD> 8)<29> <> <EFBFBD> 7<EFBFBD> DI<44> =<3D> <> y&<26> <> ea<65> s *hɕj<C995> A<> ( ꣢<> \\ <EFBFBD> <EFBFBD> <EFBFBD> ni<EFBFBD> <EFBFBD> V)<29> <> ^<5E> |~լ<> <D5AC> #!]<1A> v8 yRT&<26> <> <EFBFBD> <EFBFBD> 2<EFBFBD> <32> <EFBFBD> 62P<32> C<> <43> l&<26> <> <11> xd!<01> |<7C> <> 9<EFBFBD> `<60> _OY<4F> =<3D> <> G<06> [J -eL<65> CvT<76> )<29> @<12> j -<2D> <> <06> <> pSk<14> .<2E> <> =<3D> <> <EFBFBD> ZE<0E> <> \$ \0 <EFBFBD> ن kn<6B> շ<EFBFBD> \$ <EFBFBD> <14> <> G+<2B> I<EFBFBD> P<EFBFBD> <06> .ځ<> ;<3B> <> qO<71> <4F> G%<25> <> Rj<52> <6A> Y[<5B> X Pf^<5E> <> |<13> <> T!<21> ;N<> <4E> І <EFBFBD> \r Y<EFBFBD> pq1<71> *<2A> <> y~-CI|7<> 7<EFBFBD> r,<2C> <> <EFBFBD> 7<EFBFBD> (<28> ̾B<CCBE> <42> <EFBFBD> ;<3B> +<2B> <> <EFBFBD> <EFBFBD> <EFBFBD> <0B> A<EFBFBD> p<EFBFBD> <70> <1A> <> b<> <1C> \r <EFBFBD> <EFBFBD> <0F> 7<> \n <EFBFBD> &b<> I'<0B> w<EFBFBD> ZiRXl<58> .4o<EFBFBD> <EFBFBD> <EFBFBD> m *<2A> <14> @ .<2E> <> Y<EFBFBD> <59> <0F> ip<69> #<15> <> <EFBFBD> V<EFBFBD> <56> B<EFBFBD> <42> <EFBFBD> Ha<48> . @G<> <47> <EFBFBD> 0/l<> <6C> :<3A> s<EFBFBD> <73> ^<0C> <> =<3D> H<EFBFBD> <48> <EFBFBD> A<EFBFBD> [<5B> x<EFBFBD> `<60> <> g~L<0E> 8<> H<EFBFBD> <48> <EFBFBD> tG<74> 4><3E> <<3C> T/<2F> xO<78> '/<2F> <> <EFBFBD> v`<60> <> X<EFBFBD> <58> / e<> H/<2F> Q<EFBFBD> <51> m #f<1E> <> \n )<29> <> <EFBFBD> D<EFBFBD> b`<60> 0<EFBFBD> \" <EFBFBD> p<EFBFBD> <0C> hnT<6E> <06> *¸ & O.<2E> <> <EFBFBD> W<EFBFBD> <57> \" *<2A> !<21> <1A> ѓ<01> <> <EFBFBD> õN/<> da<64> w<EFBFBD> <01> <> <EFBFBD> K<EFBFBD> c<EFBFBD> <63> j<EFBFBD> O3 725<32> 1<EFBFBD> ?z<> <7A> 7<EFBFBD> w<EFBFBD> <12> <> Z<EFBFBD> 4)Ǚ<> 9d<39> <64> ]<5D> <> M <09> <> Me<4D> m\n <EFBFBD> -O<> P <0F> <> )<29> <> <EFBFBD> <EFBFBD> )<29> d<16> \0 l<EFBFBD> vIk2jj<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> -6<> Ꟗd<EA9F96> l<EFBFBD> `b \r e u/<2F> h<EFBFBD> a6Z<17> <> ¯3<02> c<EFBFBD> +,<2C> <13> h8r<38> <72> <EFBFBD> \" <EFBFBD> dJˆ '<27> <> <EFBFBD> a}<7D> <> <EFBFBD> \$ <EFBFBD> )<29> <> <EFBFBD> <EFBFBD> &<1B> <> L<EFBFBD> 0<EFBFBD> <12> <> Gc /K<> }6<> 1<EFBFBD> \\ ~O<> ӓ<EFBFBD> [ \\ <EFBFBD> T]\" <EFBFBD> <EFBFBD> 8<EFBFBD> L<EFBFBD> <EFBFBD> <EFBFBD> Pw<EFBFBD> J<EFBFBD> e<EFBFBD> @<40> <> <20> \0 hC<1B> W \$ M/<2F> <> n<EFBFBD> !<21> v<EFBFBD> L<EFBFBD> `_zW<7A> <0C> w<EFBFBD> <77> <0B> <> <EFBFBD> <EFBFBD> 'B<19> <> W < <20> <> =<3D> <> <EFBFBD> C<EFBFBD> Z<EFBFBD> <5A> \r <EFBFBD> <EFBFBD> <EFBFBD> =,X4<58> 3<EFBFBD> { GƝ<EFBFBD> <EFBFBD> <EFBFBD> u +<2B> <> <EFBFBD> <05> c<EFBFBD> <63> <EFBFBD> N<EFBFBD> \r <EFBFBD> S`w<> }&<26> <> { <EFBFBD> <EFBFBD> 7 \\ <0B> ̖ɞ֤<C99E> 3<7F> |<7C> ps<0E> <> =<3D> <> <EFBFBD> \" n { <EFBFBD> 5<EFBFBD> <EFBFBD> <EFBFBD> L<EFBFBD> <<0F> <> X<EFBFBD> <58> y<EFBFBD> <U<04> ;<3B> <> <EFBFBD> <EFBFBD> `}<7D> CC,<2C> <> <EFBFBD> -<2D> <> P<EFBFBD> <50> 8\r ,<14> <> <EFBFBD> p<EFBFBD> <1F> <> Y { <EFBFBD> <EFBFBD> <EFBFBD> z*+:3j<33> <6A> <EFBFBD> lЯ>[<5B> <20> <> \n <EFBFBD> ORN<EFBFBD> <EFBFBD> -\0 <04> `ˀ<> #x<> <78> b<EFBFBD> \n r o`;Od<4F> <64> <EFBFBD> \0 <EFBFBD> ~<7E> )& l O<04> <> <EFBFBD> <08> 0<1A> ;<03> <> M<> <04> <> <0F> <> <EFBFBD> #(&̎&<26> 0<EFBFBD> <30> κ<EFBFBD> <CEBA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> N<EFBFBD> \0 <EFBFBD> C L<> <4C> <EFBFBD> P><3E> <> <EFBFBD> <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <F28A8D8E> <EFBFBD> \n h<EFBFBD> <EFBFBD> h<EFBFBD> ϭ<EFBFBD> <EFBFBD> <EFBFBD> h6ł<36> <02> B <09> <0C> r<0E> <> <0B> \r <EFBFBD> 6<> n<EFBFBD> <6E> <EFBFBD> p<> \r <EFBFBD> <EFBFBD> F<> <0E> p-<2D> <> \r @<40> \r \0 <EFBFBD> <0B> <> p<> q p<> <10> q <20> <0F> <> <05> <11> E<11> \$ q }<7D> <> <EFBFBD> <02> <> <EFBFBD> <EFBFBD> <11> <12> 4@<40> Q<0B> <1E> Ɋ|\0 ` `f<> k<02> <> <EFBFBD> ``<60> <10> Nv<4E> <76> <12> u<17> <> \r <EFBFBD> ) q><05> <0C> y<12> 7 q\" <EFBFBD> @<40> <0B> <> ј <> <D198> <EFBFBD> <EFBFBD> <11> <> `<60> <17> <> ь_I0<49> L<EFBFBD> <13> ` )<29> <> <EFBFBD> <EFBFBD> <11> t<0B> <> )<29> M q<> <71> <EFBFBD> <EFBFBD> <19> <> )<29> <> <EFBFBD> b<EFBFBD> ޱo %y 1s<17> <> Q<> <1F> A<1F> q<> *<2A> <> <EFBFBD> <EFBFBD> 1 wg>C<0E> <> B<EFBFBD> <0B> M<0C> 4~<7E> <> d<> <0C> ܒ<EFBFBD> <DC92> =<3D> B<EFBFBD> <42> <EFBFBD> - <20> <1A> \$ rR i)!<10> %<11> RO \$ <EFBFBD> ]\$ <EFBFBD> <EFBFBD> &Q<> \r <EFBFBD> <EFBFBD> <0C> <> \" <EFBFBD> e `<60> <08> <> \r R><0B> %<25> <> ' c \$ <EFBFBD> <EFBFBD> &<26> R<EFBFBD> R<EFBFBD> &r<> *Rs\$ <EFBFBD> w<12> o)r{ #`<60> = \" Ď<EFBFBD> <12> <08> <> <EFBFBD> <EFBFBD> I<12> <> \r <EFBFBD> <EFBFBD> #<23> <> /q; 2Q-R<> <19> <> *<2A> <> .Rm\$ R<EFBFBD> % \$ <0E> <1C> <> Zp<5A> /<2F> U&<26> <> %1<> 0<EFBFBD> v<EFBFBD> G E<> <45> <10> <05> 11<31> #,<2C> &\r `<60> 1-337& q)<29> <> 3<EFBFBD> <33> .HA1<41> !2<> :7 &2f`<60> <12> ,<2C> <19> A<18> 1 q si \" <11> <1A> y7Jƍ <4A> k RW7<57> <37> \" <EFBFBD> 8s{ 7<11> <0B> <> <0C> w 4Ss9Ӡ <39> s<EFBFBD> ә6<D399> \r <EFBFBD> );<13> :<3A> <> ;ӣ!3 :Q -\0 <EFBFBD> Yӳ0<EFBFBD> <EFBFBD> =\" #=<3D> <> r<> 0@G `<60> ?2<> e<> =<3D> <> -|&Q#<<3C> <> @1<> 0 \" <EFBFBD> 0<EFBFBD> <EFBFBD> <EFBFBD> ц<EFBFBD> p<EFBFBD> s֘<73> 용<EFBFBD> <0F> @*<2A> `<60> 2<EFBFBD> <13> / .<2E> <20> <20> C<08> <> V(ӱ@Q<> ƪ<> Q\r S<EFBFBD> E<EFBFBD> E:<3A> <> <12> Fq \" 5<EFBFBD> <EFBFBD> F<11> e<EFBFBD> \" <EFBFBD> t.<2E> m<EFBFBD> <6D> <EFBFBD> <EFBFBD> 6QO<<3C> <> T/=<3D> <> 9<EFBFBD> <39> *<2A> <16> <> LS r?I2<49> J<EFBFBD> O <20> [ t<> Kt<4B> KS<4B> K<EFBFBD> <4B> `eG<65> 08B<38> 8<EFBFBD> 0,&<26> <> <EFBFBD> <EFBFBD> <03> <> <EFBFBD> <EFBFBD> <09> <> <EFBFBD> k!N@<40> <> <EFBFBD> ֮<EFBFBD> ~*<2A> \" <EFBFBD> <EFBFBD> :G<> <47> 14<31> 6<EFBFBD> D.\" <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> I<EFBFBD> <EFBFBD> !<21> L<> <4C> 8b<38> A3 M<> 'M<> ?N<06> \$ <14> ,<2C> <> <EFBFBD> 0 O2<0C> <> /4<> B<EFBFBD> J<EFBFBD> b<EFBFBD> " );} elseif ( $_GET [ " file " ] == " functions.js " ){ header ( " Content-Type: text/javascript; charset=utf-8 " ); echo
lzw_decompress ( " f:<3A> <> gCI<43> <49> \n 8<EFBFBD> <EFBFBD> 3)<29> <> 7<> <37> <EFBFBD> 81<38> <31> x: \n Og#)<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> \n y<> *pC\r \$ <EFBFBD> n<EFBFBD> T<EFBFBD> <EFBFBD> 3=\\ <EFBFBD> r9 O\" <EFBFBD> <09> <> l<<3C> \r <EFBFBD> \\ <EFBFBD> <EFBFBD> I,<2C> s\n A<EFBFBD> <EFBFBD> e h +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> <> z i#^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> <> \n Z %<25> ć#CH<43> !<21> <> r8<72> \$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,<2C> Rܔ2<DC94> <32> <EFBFBD> ^0<> <30> @<40> 2<EFBFBD> <32> (<28> 8 8P/<0F> <> <EFBFBD> ݄<EFBFBD> \\ <EFBFBD> \$ La \\ <EFBFBD> ; c<> H<14> <> HX<13> <> <EFBFBD> \n ʃt<CA83> <74> <07> 8A<<3C> s Z<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> \0 R<15> C<EFBFBD> v<1D> M<EFBFBD> I, \r <EFBFBD> <EFBFBD> <EFBFBD> \0 Hv<EFBFBD> <EFBFBD> ? kT<6B> 4<EFBFBD> <34> <EFBFBD> <EFBFBD> uٱ<75> ;&<26> <> <EFBFBD> +&<26> <> <EFBFBD> <EFBFBD> <EFBFBD> \r <EFBFBD> X<EFBFBD> <EFBFBD> <EFBFBD> bu 4 ݡi8 8<> 2B<10> /⃖4<E28396> <07> <> N 8A<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> #G 3<> <33> 8b A<> <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\0 t a<> <1E> 62^<5E> <> . `<60> <17> <> .C<> j<EFBFBD> [ᄠ% Q \0 ` d<> M8<4D> <38> <EFBFBD> <EFBFBD> <EFBFBD> \$ O0`4<05> <> <EFBFBD> \n \0 a \r A<EFBFBD> <<02> @<40> <> <EFBFBD> <EFBFBD> \r !<21> :<03> BA<42> 9<EFBFBD> ? h><3E> Ǻ<0B> <> ~ ̌<> 6Ȉh<14> =<0C> -<12> A 7X<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> <> e R<> <52> W<> AΐTw<54> ё;<3B> J<02> <> <EFBFBD> \\ `)5<> <35> ޜB<DE9C> q hT3<54> <33> R <19> ' \r + \" :<3A> <> <EFBFBD> <EFBFBD> <08> .<2E> <01> ZM'|<7C> et:3%L<> <4C> # f!<0E> h<EFBFBD> ׀ e<> <65> <EFBFBD> <12> + ļ<> N<EFBFBD> <4E> <09> <> _<15> CX<43> <58> G<EFBFBD> <47> 1<EFBFBD> <31> i-ãz<C3A3> \$ <EFBFBD> oK@O@T<> =&<26> 0<> \$ <09> DA<44> <41> <EFBFBD> <EFBFBD> <EFBFBD> D<EFBFBD> <44> SJ<53> x9 ׁFȈm l<> <6C> p<> Gխ<1C> T<EFBFBD> 6Rf<52> @<40> a<EFBFBD> \r s<EFBFBD> R<> Fgih]<5D> <> f<EFBFBD> .<2E> 7+<2B> <n hh<68> * <20> SH P]<5D> : Ғ<> <D292> a \" <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 2<> & R<> )<29> B<EFBFBD> Pʙ<50> H/<0B> <03> f { r|<15> 0^<19> hCA<43> 0<EFBFBD> @<40> M<EFBFBD> <4D> <EFBFBD> 2<EFBFBD> B<> @<40> <> z<EFBFBD> U<EFBFBD> <55> <EFBFBD> O<EFBFBD> <4F> <EFBFBD> Cpp<70> <70> \\ <EFBFBD> L<EFBFBD> %<25> <> 𛄒y<F09B8492> <79> odå<64> <C3A5> <EFBFBD> p 3<> <10> <> 7E<37> <45> <10> <> A\\ <0B> <> <EFBFBD> K<EFBFBD> <4B> Xn<58> <6E> i.<2E> Z<EFBFBD> <5A> <20> <15> <> s<0E> <> G<> m^<5E> tI<74> Y<> J<EFBFBD> <4A> ٱ<EFBFBD> G1<47> <31> R<EFBFBD> <52> D<EFBFBD> <44> c<EFBFBD> <63> <EFBFBD> 6<EFBFBD> t Mi h<> <68> 9<EFBFBD> <39> 9g<39> <67> q<07> RL<52> <4C> Mj-T Q<> 6i<36> G_!<21> <> .<2E> h<EFBFBD> v<EFBFBD> <76> cN<63> <4E> <EFBFBD> <EFBFBD> <EFBFBD> ^<5E> <> 0w@n|<7C> <> <EFBFBD> V<EFBFBD> ܫ<EFBFBD> AЭ<41> <D0AD> 3<EFBFBD> [<5B> <> ]<13> s7<73> G<EFBFBD> P@ :<0C> 1т<31> b<> <20> <> ݟ<EFBFBD> <DD9F> <EFBFBD> w<EFBFBD> (i<> <69> :<3A> <02> z\\ <EFBFBD> <EFBFBD> ;<02> <> <EFBFBD> A<EFBFBD> PU T^<5E> ]9<> `UX+U<> <55> <EFBFBD> Q+<2B> <12> b<EFBFBD> <62> <18> *ϔ s<> <73> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> [<5B> ۉxk<78> F*<2A> <> <EFBFBD> ݧ_w.<2E> <1F> 6~<7E> b<EFBFBD> <62> mK<6D> <4B> sI<73> MK<4D> }<7D> <> ҥ<17> <> <EFBFBD> eHɲ<48> d<EFBFBD> *md<6D> l<EFBFBD> Q<EFBFBD> <51> eH<14> 2<EFBFBD> ԍL<D48D> <04> <> a҂<61> =<18> <> s<EFBFBD> P<EFBFBD> aM\" ap<61> <70> : <<1E> <> <EFBFBD> GB<0C> \r 2Yt x& L }}<7D> <> A<EFBFBD> ԱN<0E> GЬ za<7A> <61> D 4<> t<EFBFBD> 4 Q<> vS<76> ùS \r <EFBFBD> ;U<11> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ~<7E> pB<70> <42> { <EFBFBD> <EFBFBD> <EFBFBD> ,<2C> <> <EFBFBD> O<EFBFBD> <4F> t;<05> J<EFBFBD> <4A> ZC,&Y<07> :Y\" <EFBFBD> #<23> <> <EFBFBD> <EFBFBD> <EFBFBD> t :\n <EFBFBD> h8r<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n<EFBFBD> <EFBFBD> <EFBFBD> h><0F> <> >Z<> <5A> `&<26> a<EFBFBD> pY+<2B> x<EFBFBD> U<> <55> A<> <?<3F> <> PxWա <> W<EFBFBD> i<> <69> .<2E> \r `<60> \$ ,<2C> <> <EFBFBD> Ҿ<EFBFBD> <D2BE> V<10> ]<5D> Z r<> <72> <14> H<> <48> 5<EFBFBD> f \\ <EFBFBD> - K Ʃ<> v<07> <> Z<EFBFBD> <5A> <EFBFBD> A<EFBFBD> <41> (<28> { 3<08> o<EFBFBD> <6F> <EFBFBD> <EFBFBD> l.<2E> <> <EFBFBD> J<EFBFBD> <4A> .<2E> \\ t2<EFBFBD> ;<3B> <> <EFBFBD> 2 \0 <EFBFBD> <EFBFBD> >c+<05> |<7C> <> * ;-0<> n<EFBFBD> <6E> [<0B> t @<40> ڕ<EFBFBD> <DA95> <1D> =c Q\n . z<> <7A> <EFBFBD> wC&<26> <> @<40> <> <EFBFBD> F<EFBFBD> <46> <03> <> <EFBFBD> ' cBS 7_*rs Ѩ<> ? j<> 3 @<40> <> <EFBFBD> <EFBFBD> !<21> .@ 7<7F> s<EFBFBD> ]Ӫ<> L<EFBFBD> G<CE81> <47> @<40> <> _<EFBFBD> q<EFBFBD> <71> <EFBFBD> &u<> <14> <> t<EFBFBD> \n Վ<EFBFBD> L<EFBFBD> E<EFBFBD> T<11> <> <EFBFBD> }gG<67> <47> <EFBFBD> <EFBFBD> w<EFBFBD> o<EFBFBD> (*<2A> <> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <41> -<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> 3<EFBFBD> mk<6D> <6B> <EFBFBD> <EFBFBD> <EFBFBD> פ<EFBFBD> <D7A4> t<> <74> S<EFBFBD> <53> <EFBFBD> (<28> d<EFBFBD> <64> A<EFBFBD> ~<7E> x \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> k<EFBFBD> ϣ:D<> <44> +<2B> <> g<> <0C> h14 <20> <> \n .<2E> <> d<64> <EAAB96> <EFBFBD> <0C> <> <EFBFBD> <EFBFBD> A lY<6C> <0E> j<EFBFBD> <6A> <EFBFBD> <EFBFBD> jJ<6A> <4A> <EFBFBD> PN+b<> D<> j<EFBFBD> <6A> <03> <05> <> <0B> D<0B> <> P<EFBFBD> <50> <04> LQ`O f<> <66> @<40> }<7D> (<28> <> <EFBFBD> 6<EFBFBD> ^ nB<6E> 4<> `<60> e<EFBFBD> <65> \n <EFBFBD> <EFBFBD> <09> trp !<21> lV<6C> '<07> } b<> *<2A> r%|\n r\r #<23> <> <EFBFBD> @w<02> <> -<2D> T.Vv<56> 8<EFBFBD> <38> <EFBFBD> \n mF<EFBFBD> /<2F> p<> <70> `<60> Y0<59> <30> <EFBFBD> <0E> <> <04> <> P \r 8<0C> Y\r <EFBFBD> <EFBFBD> ݤ<EFBFBD> <09> Q<0E> <> <0E> %E<> /@]\0 <EFBFBD> <0C> { @<40> Q<EFBFBD> <51> <EFBFBD> \0 bR M \r <EFBFBD> <EFBFBD> '|<0C> <> %0SDr<44> <02> <0E> <> f/<10> <> <EFBFBD> <EFBFBD> b:ܭ<13> <> <EFBFBD> <EFBFBD> <EFBFBD> %߀ <> 3H<33> x\0 <EFBFBD> l\0 <EFBFBD> <0C> <> <09> <0E> W<15> <> %<25> \n <EFBFBD> 8\r \0 }<15> D<EFBFBD> <44> <EFBFBD> 1d#<23> x<0C> <> .<2E> jEoHrǢl b<0C> <> <EFBFBD> %t<> <74> 4<EFBFBD> p<EFBFBD> <70> <EFBFBD> %<25> 4<EFBFBD> <34> <EFBFBD> k<> z 2 \r <EFBFBD> <EFBFBD> `<60> W@ <> %\r J<EFBFBD> 1<EFBFBD> <EFBFBD> X<EFBFBD> <EFBFBD> <EFBFBD> 1<EFBFBD> D 6!<21> <16> <> <EFBFBD> *<2A> <1C> <> { 4<E<> <45> k.m<> 4<EFBFBD> <34> <02> <0E> \r \n <EFBFBD> ^i<04> <> <EFBFBD> <20> <> !n<> <1E> !2\$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <1E> (<28> f<EFBFBD> <66> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> k><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> N<EFBFBD> <4E> 5\$ <EFBFBD> <EFBFBD> <EFBFBD> 2T<EFBFBD> ,<2C> LĂ<4C> <20> Z @<40> <> *<2A> `^P<> P %5%<25> t<EFBFBD> H<EFBFBD> W<EFBFBD> <57> on<6F> <6E> <EFBFBD> E#f<> <66> <EFBFBD> <<3C> 2@ K:<3A> o<EFBFBD> <6F> <EFBFBD> <EFBFBD> <EFBFBD> Ϧ<EFBFBD> -<2D> <> 2\\ W i+f<> &<04> <03> g&<26> n<EFBFBD> L<EFBFBD> 'e<04> |<7C> <> <EFBFBD> <EFBFBD> nK<6E> 2<EFBFBD> rڶ<72> p<EFBFBD> *.<2E> n<1A> <> <EFBFBD> <EFBFBD> <0E> <> <EFBFBD> <EFBFBD> *<2A> +<2B> t<EFBFBD> Bg * <20> <06> Q<EFBFBD> 1+)1h<31> <68> <EFBFBD> ^<5E> `Q#<23> ؎<EFBFBD> n*h<06> <> <EFBFBD> v<EFBFBD> B<EFBFBD> <12> \0 \\ F \n <EFBFBD> W<EFBFBD> r f\$ <EFBFBD> =4\$ G4ed<07> b<11> :J^!<21> 0<EFBFBD> <30> _<1B> <> <01> %2<> <32> 6<EFBFBD> .F<> <46> <1B> Һ<EFBFBD> EQ<45> <19> <> <EFBFBD> <EFBFBD> dts \" <EFBFBD> <12> <> <EFBFBD> <EFBFBD> B(<28> `<60> \r <EFBFBD> <EFBFBD> <EFBFBD> c<EFBFBD> R<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> V<EFBFBD> <EFBFBD> <EFBFBD> <04> <> X<EFBFBD> <58> :R<> *2E*s<> \$ <EFBFBD> <EFBFBD> +<0E> :bXl<58> <6C> tb<15> <> -<2D> S><3E> <> -<2D> d<EFBFBD> =<3D> <> \$ S<EFBFBD> \$ <EFBFBD> 2<EFBFBD> ʁ7<EFBFBD> j<EFBFBD> \" [ ́ \" <EFBFBD> <EFBFBD> ]<5D> [6<> <36> SE_><3E> q.\$ @z`<60> ;<3B> 4<EFBFBD> 3ʼ <0B> CS<43> *<2A> <> [<5B> <> <0E> { DO<EFBFBD> ު CJj峚P<E5B39A> : '<27> <> <EFBFBD> ȕ QEӖ<45> <D396> ` %r<> <72> <EFBFBD> 7<EFBFBD> <37> G+hW4E*<2A> <> #TuF j<> \n <EFBFBD> e<EFBFBD> D<EFBFBD> ^<5E> s<EFBFBD> <73> r .<05> <> <EFBFBD> R k<> <04> z @<40> <> @<40> <05> <> D<EFBFBD> `C<> V!C<> <43> <05> \0 <EFBFBD> <EFBFBD> ۊ )3<<3C> <> Q4 @<40> 3SP<53> <50> ZB<5A> 5F<35> L<EFBFBD> <4C> ~G<> 5<1D> <> <EFBFBD> :<3A> <> <EFBFBD> 5\$ X<EFBFBD> <EFBFBD> <EFBFBD> }ƞ f<> <66> <EFBFBD> I<1D> <0C> <> 3S8<53> \0 XԂtd<EFBFBD> < \n btN<14> Q<> ; \r <1E> <> H<EFBFBD> <48> P<EFBFBD> \0 <EFBFBD> <0E> &\n <EFBFBD> <EFBFBD> <EFBFBD> \$ V<EFBFBD> \r :<3A> \0 ]V5gV<67> <56> <EFBFBD> D `<60> N1:<3A> SS4Q<34> 4<EFBFBD> N<0F> <> 5u<35> 5<EFBFBD> `x <09> <5_FH<46> <48> <EFBFBD> }7<> <37> )<29> SV<53> <56> Ğ#<23> |<7C> <> < ռ <> ˰<EFBFBD> <CBB0> <EFBFBD> \\ <EFBFBD> <EFBFBD> -<2D> z2<7A> \0 <EFBFBD> #<23> WJU6kv<6B> <76> <EFBFBD> #<23> <> \r <EFBFBD> 췐<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> U<EFBFBD> <EFBFBD> i<EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> ^<5E> UVJ|Y.<2E> <> ɛ\0 u,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _UQD#<23> ZJu<4A> Xt<58> <13> _<> &JO,Du `N \r 5<EFBFBD> <EFBFBD> `<60> }ZQM^m<> P<EFBFBD> G[<5B> <> a<0C> b<EFBFBD> N 䞮<> <E49EAE> re<72> \n <EFBFBD> <EFBFBD> %<25> 4<EFBFBD> <34> o_(<28> ^<5E> q @Y6 t;I\n G SM<53> 3<EFBFBD> <33> ^SAY H<07> h B<> <16> 5<EFBFBD> f N ?Nj W U<> J<EFBFBD> <4A> <EFBFBD> <EFBFBD> ֯Yֳke \" \\ B1<04> 0<10> <20> en<65> <6E> <0C> *<<3C> O`S<> L<EFBFBD> \n <EFBFBD> <16> . g<05> 5Zj<0C> \0 R \$ <EFBFBD> h<EFBFBD> <EFBFBD> n<> [<5B> \\ <EFBFBD> <EFBFBD> <EFBFBD> r<15> <> <EFBFBD> ,<2C> 4<> <34> <EFBFBD> <0C> <> cP<63> p<EFBFBD> q @R<0B> rw><3E> wCK<43> <4B> t<EFBFBD> <74> }5_uvh<76> <14> ` /<2F> <> <EFBFBD> <EFBFBD> \$ <EFBFBD> <EFBFBD> J )<29> R<EFBFBD> 2Du73<37> d\r <EFBFBD> ;<3B> <> w<EFBFBD> <77> <0C> H<> I_\" 4<EFBFBD> r<> <72> <EFBFBD> <EFBFBD> <EFBFBD> Ͽ+<2B> <> &0><0B> _- e qeD<65> <44> V<EFBFBD> <56> n<EFBFBD> <6E> f<> h<EFBFBD> <68> \" Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Z<07> W<> 6 \\ L<EFBFBD> <0C> <> <EFBFBD> ke&<26> ~<7E> <> <0C> <> <EFBFBD> <EFBFBD> i \$ ϰ<EFBFBD> Mr<EFBFBD> i*<2A> <> <EFBFBD> <EFBFBD> <EFBFBD> \0 <0B> .Q,<2C> <> 8\r <EFBFBD> <EFBFBD> <0C> \$ K<EFBFBD> <EFBFBD> Y<EFBFBD> <20> io<69>
lzw_decompress ( " v0<EFBFBD> <EFBFBD> F<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ==<3D> <> FS <09> <> _6 MƳ<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> SA NN<02> <> <EFBFBD> xs<78> N B<> <42> Vl0<6C> <30> <EFBFBD> S <09> <> U l<14> (D| ҄<> <D284> P<EFBFBD> <50> ><17> E<EFBFBD> 㩶yH c h<> <68> -3 Eb<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> y6 GFmY<6D> 8o7\n \r <10> 0<EFBFBD> <30> \0 <EFBFBD> Dbc<EFBFBD> !<21> Q 7 Ш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> 3 n<> <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 \r 1<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> \0 R<05> <> <EFBFBD> <EFBFBD> O<EFBFBD> \n <EFBFBD> <14> 1(W0<57> <30> <EFBFBD> <EFBFBD> 7 q<> <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> L7 U<> 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> @Mp l v<> )<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۽T l0<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\n R8!<21> Ƭ֚<C6AC> <D69A> lA<6C> V<EFBFBD> <10> 4<03> h<EFBFBD> <1E> S q<<15> <> @}<7D> <> <EFBFBD> gK<67> ]<5D> <> <EFBFBD> ]<5D> =90<39> <30> '<27> <> <1D> <> w A <<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> \0 P <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> <> a Uf<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> p P<> ?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 \n Al~H<> <48> <EFBFBD> V \n s<> <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> 9 O \$ <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> \n j!\r <EFBFBD> <EFBFBD> y<> y<EFBFBD> D1g<31> <67> <EFBFBD> ]<5D> <> yR<79> 7\" <EFBFBD> <EFBFBD> <1D> <13> <> <EFBFBD> ~<10> <> <EFBFBD> <EFBFBD> )TZ0E9M<39> YZ t Xe !<21> f<EFBFBD> @<40> { Ȭyl 8<> ;<3B> <> <EFBFBD> R { <EFBFBD> <EFBFBD> 8<EFBFBD> Į<> e<EFBFBD> +U L<> '<27> F<> 1<EFBFBD> <04> <> 8PE5- <09> _ !<21> 7<EFBFBD> <37> <EFBFBD> [2<> J<EFBFBD> <01> ;<3B> HR<48> <52> ǹ<> 8 p痲݇@<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+\0 v<1C> D<EFBFBD> \r <<3C> <> ƙ<EFBFBD> <C699> j G<> <1E> <> t<EFBFBD> *3%k<> Y ܲT *<2A> |\" C<1E> <> l hE<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> 4 X<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> \0 p '<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> \n L\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> g j<> <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<> \n 0<EFBFBD> <EFBFBD> <EFBFBD> \r F<> <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 oe p<> <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\r 1<EFBFBD> <0C> <> n !<21> Ɏ<> z<> <7A> <EFBFBD> <13> <> <0C> \\ <0F> <> \r <EFBFBD> <07> <> <EFBFBD> `V_k<5F> <6B> \" \\ ׂ' V<05> <> \0 ʾ `A C<> <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> \0 Z<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> Z M \\ <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> 27 8I <20> <> <EFBFBD> P\r k \\ <EFBFBD> <EFBFBD> <EFBFBD> 2`<60> \r dL b@ E<14> <> 2`P( B'<27> <0B> <> <0F> <> 0<EFBFBD> &<05> <> { <EFBFBD> <EFBFBD> <EFBFBD> :<3A> <> dB<64> 1<EFBFBD> ^؉*\r \0 c< K<> |<06> 5sZ<73> `<60> <> <EFBFBD> O3<4F> 5=@<40> 5<EFBFBD> C>@<40> W* = \0 N<g<> 6s67Sm7 u? { <&L<04> . 3~D<> <44> \r Ś<0C> x<EFBFBD> <13> ) ,r<> i n<> /<2F> <> O \0 o { 0k<EFBFBD> ]3> m<> <05> 1 \0 <EFBFBD> I@<40> 9 T34+ԙ@e<0F> GF MC<4D> \r E3<EFBFBD> Etm!<13> #1<> D @<40> H(<28> <> n <20> <> <g,V`R]@<40> <> <EFBFBD> <EFBFBD> 3Cr7s~<7E> G I<> i@ \0 v<EFBFBD> <EFBFBD> 5 \r V<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> v j 4<> LS<1A> <> ִԶ5&d sF M<> 4<EFBFBD> <18> \" .H<> M0<4D> 1u L<> \" <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> ٭ ЪG Q MTmGB<47> t l- 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)J i<> <69> -N 9 9f<39> l J m<> <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> 5b p#<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> }
2018-04-01 23:34:54 +02:00
get_lang (){ global $ca ; return $ca ;} function
2018-12-25 21:50:48 +01:00
lang ( $v , $if = null ){ if ( is_string ( $v )){ $fg = array_search ( $v , get_translations ( " en " )); if ( $fg !== false ) $v = $fg ;} global $ca , $vi ; $ui = ( $vi [ $v ] ? $vi [ $v ] : $v ); if ( is_array ( $ui )){ $fg = ( $if == 1 ? 0 : ( $ca == 'cs' || $ca == 'sk' ? ( $if && $if < 5 ? 1 : 2 ) : ( $ca == 'fr' ? ( ! $if ? 0 : 1 ) : ( $ca == 'pl' ? ( $if % 10 > 1 && $if % 10 < 5 && $if / 10 % 10 != 1 ? 1 : 2 ) : ( $ca == 'sl' ? ( $if % 100 == 1 ? 0 : ( $if % 100 == 2 ? 1 : ( $if % 100 == 3 || $if % 100 == 4 ? 2 : 3 ))) : ( $ca == 'lt' ? ( $if % 10 == 1 && $if % 100 != 11 ? 0 : ( $if % 10 > 1 && $if / 10 % 10 != 1 ? 1 : 2 )) : ( $ca == 'bs' || $ca == 'ru' || $ca == 'sr' || $ca == 'uk' ? ( $if % 10 == 1 && $if % 100 != 11 ? 0 : ( $if % 10 > 1 && $if % 10 < 5 && $if / 10 % 10 != 1 ? 1 : 2 )) : 1 ))))))); $ui = $ui [ $fg ];} $Fa = func_get_args (); array_shift ( $Fa ); $gd = str_replace ( " %d " , " %s " , $ui ); if ( $gd != $ui ) $Fa [ 0 ] = format_number ( $if ); return
2018-06-30 00:38:01 +02:00
vsprintf ( $gd , $Fa );} function
2018-12-25 21:50:48 +01:00
switch_lang (){ global $ca , $oe ; echo " <form action='' method='post'> \n <div id='lang'> " , lang ( 19 ) . " : " . html_select ( " lang " , $oe , $ca , " this.form.submit(); " ), " <input type='submit' value=' " . lang ( 20 ) . " ' class='hidden'> \n " , " <input type='hidden' name='token' value=' " . get_token () . " '> \n " ; echo " </div> \n </form> \n " ;} if ( isset ( $_POST [ " lang " ]) && verify_token ()){ cookie ( " adminer_lang " , $_POST [ " lang " ]); $_SESSION [ " lang " ] = $_POST [ " lang " ]; $_SESSION [ " translations " ] = array (); redirect ( remove_from_uri ());} $ca = " en " ; if ( isset ( $oe [ $_COOKIE [ " adminer_lang " ]])){ cookie ( " adminer_lang " , $_COOKIE [ " adminer_lang " ]); $ca = $_COOKIE [ " adminer_lang " ];} elseif ( isset ( $oe [ $_SESSION [ " lang " ]])) $ca = $_SESSION [ " lang " ]; else { $va = array (); preg_match_all ( '~([-a-z]+)(;q=([0-9.]+))?~' , str_replace ( " _ " , " - " , strtolower ( $_SERVER [ " HTTP_ACCEPT_LANGUAGE " ])), $Fe , PREG_SET_ORDER ); foreach ( $Fe
2018-06-30 00:38:01 +02:00
as $B ) $va [ $B [ 1 ]] = ( isset ( $B [ 3 ]) ? $B [ 3 ] : 1 ); arsort ( $va ); foreach ( $va
2018-12-25 21:50:48 +01:00
as $z => $vg ){ if ( isset ( $oe [ $z ])){ $ca = $z ; break ;} $z = preg_replace ( '~-.*~' , '' , $z ); if ( ! isset ( $va [ $z ]) && isset ( $oe [ $z ])){ $ca = $z ; break ;}}} $vi = $_SESSION [ " translations " ]; if ( $_SESSION [ " translations_version " ] != 2049098341 ){ $vi = array (); $_SESSION [ " translations_version " ] = 2049098341 ;} function
get_translations ( $ne ){ switch ( $ne ){ case " en " : $g = " A9 D<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\n 2<EFBFBD> N C<> (<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> <> 8 a<> ^<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> \0 S<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> h 8<> 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> ލM pt<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]x P<> <50> <0C> L<EFBFBD> <4C> t ZP*1n<31> }\\ گ<EFBFBD> 7ԫ<37> <20> @<40> }<7D> I1T<31> /L<> t<EFBFBD> ><3E> C<EFBFBD> <43> N <09> S<EFBFBD> %R<> <52> 9 W<> <57> X<EFBFBD> <58> <12> j<> X F<> <46> I<0C> @<40> <> <EFBFBD> <EFBFBD> <EFBFBD> ˩-d<> <64> \$ <EFBFBD> <EFBFBD> <EFBFBD> R<EFBFBD> <17> \$ <EFBFBD> 꿅( T<> <54> SJqO* D<> .U\n <EFBFBD> \$ T<EFBFBD> <15> s<07> <> <0E> h \$ <0F> <> F<> <46> 7<EFBFBD> 0<> <1E> <> =<3D> <> 4<EFBFBD> (<28> <> zw=G<> %<1F> <> <EFBFBD> <11> <> >nU<6E> '<27> <16> I3B<33> `9><3E> hHC fknyܺ(A<0F> <> l<EFBFBD> <6C> 4<> 4<EFBFBD> <34> K 0<> E<> <45> [<5B> <> B?<3F> h<EFBFBD> <68> bj<02> H\n -<01> b|\n \n \0 ) \$ D<04> <<3C> Lh<4C> B<EFBFBD> \r <EFBFBD> <EFBFBD> <EFBFBD> עd q 2<> <32> <EFBFBD> <13> @yɉ3<C989> <33> <EFBFBD> 7<<3C> kc<6B> <63> <EFBFBD> !<21> <> ><3E> <> O <09> # g<> ><3E> <> <EFBFBD> <EFBFBD> <03> 2 l<> (S><3E> \" QiS+<2B> <> &<26> ~M )%d<> <64> <EFBFBD> <EFBFBD> 6<EFBFBD> O<EFBFBD> <4F> 0<EFBFBD> <<3C> <> p<EFBFBD> O<EFBFBD> z}&<26> <> H c<> Z<EFBFBD> \$ H\$ <EFBFBD> A<> <41> !<21> <05> <> <1F> @@C<> <43> *\$ <EFBFBD> <EFBFBD> <EFBFBD> <07> #<23> <> dx<64> <78> <EFBFBD> |{ <EFBFBD> <EFBFBD> <EFBFBD> r<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \0 <EFBFBD> £W /T) U<> 5h<35> BZ<42> <5A> <EFBFBD> P״<50> _<EFBFBD> %9<> ɐE<C990> <45> @X<> <58> % )<29> <> <EFBFBD> 2G<32> <02> TT)<29> <> H<EFBFBD> <48> <EFBFBD> #<08> RI<52> <49> <EFBFBD> ܍<EFBFBD> x<EFBFBD> <78> ̃<EFBFBD> \" <EFBFBD> Pձi;/M'\0 <EFBFBD> \\ L<EFBFBD> je <09> 8 P<> T<08> *<2A> <> \0 <EFBFBD> B`E<> M<EFBFBD> z<EFBFBD> s}\r :Z<> <5A> - \n <EFBFBD> sN 0gg<67> <<3C> <> <EFBFBD> &<26> <> <EFBFBD> <EFBFBD> %!<21> <> <11> j<> 9<EFBFBD> TuZ<75> <5A> i-<2D> ] L<05> <> 7<EFBFBD> ,b<> R Hǐ<48> <C790> <EFBFBD> f<EFBFBD> \\ 2Ʋ́<EFBFBD> \" <05> xN<78> P0n|<7C> 9<02> <02> <> '<27> (<28> <09> <> 8~Ha>Jr D<> <44> `èg\r BIID<49> !<21> <> bc<62> <<3C> [ҁb<D281> <62> l<> zU<7A> <16> M<15> 'K<> ̓<> h !<21> K<EFBFBD> <12> <> <EFBFBD> <EFBFBD> H[Zh<5A> <68> <EFBFBD> <EFBFBD> <<3C> vHV<48> <56> \n <EFBFBD> <EFBFBD> l]<5D> <> ^<5E> xxC-i\n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B<EFBFBD> I<> <49> @dV<64> K<EFBFBD> n<0C> ڨ<EFBFBD> z<EFBFBD> K(T- ,9W<39> <16> <> I<EFBFBD> J<EFBFBD> B*<1B> `<60> KZ/ <09> <06> 1Etg,Z<> NHL\" <EFBFBD> <EFBFBD> `<60> <> <05> o(<28> l%J<> C \0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 0d<EFBFBD> <EFBFBD> O<07> Y<EFBFBD> S<EFBFBD> <53> ^=F˼<17> HL w]<5D> @<40> !0<> l<EFBFBD> <6C> OX<4F> <58> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ~Q\$ N:<3A> <> <EFBFBD> <13> <> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> .<0C> <> 2<EFBFBD> <32> <EFBFBD> a<EFBFBD> 2<EFBFBD> 3<02> <1C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <12> ߒ<EFBFBD> U<EFBFBD> ͗<EFBFBD> 7<04> ]<5D> <> <EFBFBD> X<EFBFBD> <58> /-<2D> L<EFBFBD> ]t<13> f<EFBFBD> Ħ<EFBFBD> &Q <09> <1C> wL<1F> :G<> ӌ<<3C> <> <1F> 0<EFBFBD> AjhrJ`(+<2B> P<EFBFBD> o<12> ?' <)1md<6D> <08> pHGd<47> Œa5<61> l<EFBFBD> Y \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 9e g<> * j<> ËhI3<49> <33> œ<EFBFBD> 4vYyȖ{ H<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 5,<2C> X<> oi<6F> <1D> <> ɻ/<> <D789> <EFBFBD> ϵ<EFBFBD> <CFB5> PC<11> *n<> <6E> <EFBFBD> rԖ { բn<EFBFBD> <EFBFBD> f<EFBFBD> <EFBFBD> cވ<EFBFBD> <EFBFBD> <03> <> <EFBFBD> ,0aL2[P#<23> gQ<67> <0B> F<EFBFBD> 3<EFBFBD> <33> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ~<7E> <> <EFBFBD> <EFBFBD> An lXz<13> h<> Y<EFBFBD> <05> <16> x氧<78> <05> <> +b<> \r <EFBFBD> d 3<> <33> In<49> \r <EFBFBD> <EFBFBD> -<2D> f<EFBFBD> %<25> <> vU<76> <55> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <01> э<0F> ݽ<EFBFBD> <DDBD> D~<7E> rϦ<72> ><3E> <> ,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> )<29> 5'<27> <> B<> <42> { <EFBFBD> <EFBFBD> <EFBFBD> 'd<> <64> <EFBFBD> <EFBFBD> <EFBFBD> 0<EFBFBD> <30> 1K N]<5D> x4bdMs<4D> <73> <EFBFBD> <11> :,\\ <EFBFBD> <14> T<EFBFBD> <54> t<74> <D7BB> <EFBFBD> f d<> ڛ<06> <> 7<EFBFBD> <37> <0E> <> a Ƃ\n <EFBFBD> <EFBFBD> :<3A> Z<EFBFBD> X<EFBFBD> <58> <EFBFBD> /-<2D> <<3C> \0 <EFBFBD> <EFBFBD> LZ<4C> \\ p1M<EFBFBD> <EFBFBD> ܟ<12> ɦ;S<> <53> <EFBFBD> !<21> Lʈ<17> <> <EFBFBD> \n <EFBFBD> _<EFBFBD> [ O<> D<> W<EFBFBD> V<EFBFBD> g0^ <> <C295> ^G<> Ot<4F> <74> ]P<> <50> ;<3B> <> <1F> <> <EFBFBD> <EFBFBD> <EFBFBD> }'F<> 4<EFBFBD> <34> <EFBFBD> o<EFBFBD> <6F> <EFBFBD> ~jY<6A> <15> <> ; c<> ކ<EFBFBD> z8<7A> <38> <1B> <> X<> 5~<7E> <> g<EFBFBD> <1F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \\ )<29> <06> -<2D> <> <05> <0C> <> <EFBFBD> F<EFBFBD> \0 <EFBFBD> <EFBFBD> 5 P/ <20> 5<EFBFBD> <35> Jb<4A> <09> <14> <> <EFBFBD> <EFBFBD> <EFBFBD> \" )*<2A> <> #b<> N<EFBFBD> <4E> <0F> % \0 <EFBFBD> P<<3C> <0E> <> H<EFBFBD> p:<3A> <> <EFBFBD> \0 If<EFBFBD> <EFBFBD> <EFBFBD> t&.<2E> <> `<60> \0 <EFBFBD> O<EFBFBD> <EFBFBD> Z D dg<64> <67> <EFBFBD> @20n<30> <6E> V<EFBFBD> <56> <EFBFBD> !#<23> ,<2C> `b,z<> <7A> <EFBFBD> <EFBFBD> /<2F> XP<58> <50> <EFBFBD> <02> Ф6p<36> <70> <EFBFBD> P% j/<2F> <> _oF<6F> <46> <EFBFBD> r<EFBFBD> <72> <09> C<0C> 0<EFBFBD> <30> \\ <EFBFBD> pk P<> <50> oj4<6A> \$ <EFBFBD> \$ *<2A> \$ ތ&<26> O<EFBFBD> <4F> <EFBFBD> <EFBFBD> <0E> <> \n <EFBFBD> <EFBFBD> \r <EFBFBD> R<EFBFBD> ) b1 ,\n <EFBFBD> G 0\n <EFBFBD> y<0C> <> %<0E> >&0<> J<EFBFBD> <4A> \n ͌<D \0 K<EFBFBD> T<EFBFBD> \0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> zCN]<5D> <> <EFBFBD> <EFBFBD> <EFBFBD> \r h<EFBFBD> <EFBFBD> <EFBFBD> P<EFBFBD> d<EFBFBD> <EFBFBD> <EFBFBD> p<EFBFBD> X<> <58> B#<23> ~<7E> <> <EFBFBD> # \" <EFBFBD> -<2D> <> <EFBFBD> 1t\\ M<EFBFBD> <12> <> έ ]<5D> <> <EFBFBD> <EFBFBD> f<EFBFBD> / \0 `<60> B \0 <EFBFBD> j\r <20> \r mvP. # 0<> <30> <EFBFBD> <0C> 6/ '<0F> <> V \n <EFBFBD> <EFBFBD> <08> Z z5<7A> <35> 9<EFBFBD> <39> <EFBFBD> /<2F> %<25> >m<10> ͼ<EFBFBD> .<2E> L<> <4C> b&G#0p<30> <EFBFBD> <C298> o<EFBFBD> <6F> <1B> <> <EFBFBD> \0 ث \$ &6<> <36> b<> .<2E> <> <EFBFBD> )NV<4E> <56> Dz4<11> rJrV<72> 8<EFBFBD> <38> <EFBFBD> \$ fKC<4B> !+^\n <EFBFBD> '<0B> ab<61> ߂<EFBFBD> <1E> N<EFBFBD> %<25> b<EFBFBD> о <EFBFBD> Z<EFBFBD> \r ౭<EFBFBD> <EFBFBD> 2]<05> <> <EFBFBD> <EFBFBD> <06> <> v<EFBFBD> <10> <> ri Q<> <51> f<EFBFBD> 6 \$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (\n <EFBFBD> <EFBFBD> +jo,<06> ohur C0 L<> N<EFBFBD> <4E> @<40> vd<76> F<12> <> &y+<2B> N<EFBFBD> <4E> R0<52> `O`<60> %<25> ȯ<EFBFBD> <C8AF> Z\" <EFBFBD> \" vl<1A> <> =<3D> 2r<32> <72> bƌ92 \n 5C0)<29> T<EFBFBD> D<EFBFBD> 0+<2B> <02> <09> <> s<EFBFBD> <13> Z \" <EFBFBD> -L\\ DD<EFBFBD> ]<5D> <> <05> <> \$ <EFBFBD> 쟂<EFBFBD> <EFBFBD> 33iy(.<2E> 3<EFBFBD> \\ " ; break ; case " ar " : $g = " <EFBFBD> C<EFBFBD> P<EFBFBD> <> <C28D> l*<2A> \r <EFBFBD> ,&\n <EFBFBD> A<EFBFBD> <15> <> <EFBFBD> (J.<19> <> 0Se\\ <EFBFBD> \r <EFBFBD> <EFBFBD> b<> @<40> 0<> ,\n Q,l)<29> <> <EFBFBD> µ<EFBFBD> <C2B5> <EFBFBD> A<14> <> j _1<5F> C<EFBFBD> M<EFBFBD> <4D> e<0B> <> S<> \n g@<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> <> o F<> <46> <EFBFBD> <EFBFBD> e3<65> Nb<03> <> <EFBFBD> p2 N<> 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 \r m8<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 \n B<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 \n 7OM*<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> \0 yw<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> q7 7WSI<53> Y<ь<> l<16> MT<4D> <16> <> K<EFBFBD> <4B> <EFBFBD> #o ci@<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> <70>
2014-05-08 19:46:08 +02:00
Min_PDO
extends
PDO { var $_result , $server_info , $affected_rows , $errno , $error ; function
2018-12-25 21:50:48 +01:00
__construct (){ global $b ; $fg = array_search ( " SQL " , $b -> operators ); if ( $fg !== false ) unset ( $b -> operators [ $fg ]);} function
dsn ( $kc , $V , $F , $zf = array ()){ try { parent :: __construct ( $kc , $V , $F , $zf );} catch ( Exception $Bc ){ auth_error ( h ( $Bc -> getMessage ()));} $this -> setAttribute ( 13 , array ( 'Min_PDOStatement' )); $this -> server_info =@ $this -> getAttribute ( 4 );} function
query ( $G , $Di = false ){ $H = parent :: query ( $G ); $this -> error = " " ; if ( ! $H ){ list (, $this -> errno , $this -> error ) = $this -> errorInfo (); if ( ! $this -> error ) $this -> error = lang ( 21 ); return
2018-06-30 00:38:01 +02:00
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
2014-05-08 19:46:08 +02:00
true ;} function
next_result (){ if ( ! $this -> _result ) return
false ; $this -> _result -> _offset = 0 ; return @ $this -> _result -> nextRowset ();} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! $H ) return
false ; $J = $H -> fetch (); return $J [ $p ];}} class
2014-05-08 19:46:08 +02:00
Min_PDOStatement
extends
PDOStatement { var $_offset = 0 , $num_rows ; function
fetch_assoc (){ return $this -> fetch ( 2 );} function
fetch_row (){ return $this -> fetch ( 3 );} function
2018-06-30 00:38:01 +02:00
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
2014-05-08 19:46:08 +02:00
Min_SQL { var $_conn ; function
2018-12-25 21:50:48 +01:00
__construct ( $h ){ $this -> _conn = $h ;} function
select ( $Q , $L , $Z , $od , $Af = array (), $_ = 1 , $E = 0 , $ng = false ){ global $b , $y ; $Zd = ( count ( $od ) < count ( $L )); $G = $b -> selectQueryBuild ( $L , $Z , $od , $Af , $_ , $E ); if ( ! $G ) $G = " SELECT " . limit (( $_GET [ " page " ] != " last " && $_ != " " && $od && $Zd && $y == " sql " ? " SQL_CALC_FOUND_ROWS " : " " ) . implode ( " , " , $L ) . " \n FROM " . table ( $Q ),( $Z ? " \n WHERE " . implode ( " AND " , $Z ) : " " ) . ( $od && $Zd ? " \n GROUP BY " . implode ( " , " , $od ) : " " ) . ( $Af ? " \n ORDER BY " . implode ( " , " , $Af ) : " " ),( $_ != " " ? + $_ : null ),( $E ? $_ * $E : 0 ), " \n " ); $Dh = microtime ( true ); $I = $this -> _conn -> query ( $G ); if ( $ng ) echo $b -> selectQuery ( $G , $Dh , ! $I ); return $I ;} function
delete ( $Q , $xg , $_ = 0 ){ $G = " FROM " . table ( $Q ); return
queries ( " DELETE " . ( $_ ? limit1 ( $Q , $G , $xg ) : " $G $xg " ));} function
update ( $Q , $O , $xg , $_ = 0 , $M = " \n " ){ $Vi = array (); foreach ( $O
as $z => $X ) $Vi [] = " $z = $X " ; $G = table ( $Q ) . " SET $M " . implode ( " , $M " , $Vi ); return
queries ( " UPDATE " . ( $_ ? limit1 ( $Q , $G , $xg , $M ) : " $G $xg " ));} function
insert ( $Q , $O ){ return
queries ( " INSERT INTO " . table ( $Q ) . ( $O ? " ( " . implode ( " , " , array_keys ( $O )) . " ) \n VALUES ( " . implode ( " , " , $O ) . " ) " : " DEFAULT VALUES " ));} function
insertUpdate ( $Q , $K , $lg ){ return
2014-05-08 19:46:08 +02:00
false ;} function
begin (){ return
queries ( " BEGIN " );} function
commit (){ return
queries ( " COMMIT " );} function
rollback (){ return
2018-04-01 23:34:54 +02:00
queries ( " ROLLBACK " );} function
2018-12-25 21:50:48 +01:00
slowQuery ( $G , $gi ){} function
convertSearch ( $v , $X , $p ){ return $v ;} function
value ( $X , $p ){ return ( method_exists ( $this -> _conn , 'value' ) ? $this -> _conn -> value ( $X , $p ) : ( is_resource ( $X ) ? stream_get_contents ( $X ) : $X ));} function
quoteBinary ( $Zg ){ return
q ( $Zg );} function
2018-04-01 23:34:54 +02:00
warnings (){ return '' ;} function
2018-12-25 21:50:48 +01:00
tableHelp ( $C ){}} $fc [ " sqlite " ] = " SQLite 3 " ; $fc [ " sqlite2 " ] = " SQLite 2 " ; if ( isset ( $_GET [ " sqlite " ]) || isset ( $_GET [ " sqlite2 " ])){ $ig = 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
2018-04-01 23:34:54 +02:00
Min_SQLite { var $extension = " SQLite3 " , $server_info , $affected_rows , $errno , $error , $_link ; function
2018-06-30 00:38:01 +02:00
__construct ( $Vc ){ $this -> _link = new
2018-12-25 21:50:48 +01:00
SQLite3 ( $Vc ); $Yi = $this -> _link -> version (); $this -> server_info = $Yi [ " versionString " ];} function
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H ); $this -> affected_rows = $this -> _link -> changes (); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return ( is_utf8 ( $P ) ? " ' " . $this -> _link -> escapeString ( $P ) . " ' " : " x' " . reset ( unpack ( 'H*' , $P )) . " ' " );} function
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; $J = $H -> _result -> fetchArray (); return $J [ $p ];}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ;} function
2018-04-01 23:34:54 +02:00
fetch_assoc (){ return $this -> _result -> fetchArray ( SQLITE3_ASSOC );} function
fetch_row (){ return $this -> _result -> fetchArray ( SQLITE3_NUM );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $e = $this -> _offset ++ ; $T = $this -> _result -> columnType ( $e ); return ( object ) array ( " name " => $this -> _result -> columnName ( $e ), " type " => $T , " charsetnr " => ( $T == SQLITE3_BLOB ? 63 : 0 ),);} function
2018-04-01 23:34:54 +02:00
__desctruct (){ return $this -> _result -> finalize ();}}} else { class
Min_SQLite { var $extension = " SQLite " , $server_info , $affected_rows , $error , $_link ; function
2018-06-30 00:38:01 +02:00
__construct ( $Vc ){ $this -> server_info = sqlite_libversion (); $this -> _link = new
SQLiteDatabase ( $Vc );} function
2018-12-25 21:50:48 +01:00
query ( $G , $Di = false ){ $Te = ( $Di ? " unbufferedQuery " : " query " ); $H =@ $this -> _link -> $Te ( $G , SQLITE_BOTH , $o ); $this -> error = " " ; if ( ! $H ){ $this -> error = $o ; return
2018-06-30 00:38:01 +02:00
false ;} elseif ( $H === true ){ $this -> affected_rows = $this -> changes (); return
2018-04-01 23:34:54 +02:00
true ;} return
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H );} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return " ' " . sqlite_escape_string ( $P ) . " ' " ;} function
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; $J = $H -> _result -> fetch (); return $J [ $p ];}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2018-06-30 00:38:01 +02:00
__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
2018-12-25 21:50:48 +01:00
as $z => $X ) $I [( $z [ 0 ] == '"' ? idf_unescape ( $z ) : $z )] = $X ; return $I ;} function
2018-04-01 23:34:54 +02:00
fetch_row (){ return $this -> _result -> fetch ( SQLITE_NUM );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $C = $this -> _result -> fieldName ( $this -> _offset ++ ); $bg = '(\[.*]|"(?:[^"]|"")*"|(.+))' ; if ( preg_match ( " ~^( $bg\\ .)? $bg\ $ ~ " , $C , $B )){ $Q = ( $B [ 3 ] != " " ? $B [ 3 ] : idf_unescape ( $B [ 2 ])); $C = ( $B [ 5 ] != " " ? $B [ 5 ] : idf_unescape ( $B [ 4 ]));} return ( object ) array ( " name " => $C , " orgname " => $C , " orgtable " => $Q ,);}}}} elseif ( extension_loaded ( " pdo_sqlite " )){ class
2018-04-01 23:34:54 +02:00
Min_SQLite
extends
Min_PDO { var $extension = " PDO_SQLite " ; function
2018-06-30 00:38:01 +02:00
__construct ( $Vc ){ $this -> dsn ( DRIVER . " : $Vc " , " " , " " );}}} if ( class_exists ( " Min_SQLite " )){ class
2018-04-01 23:34:54 +02:00
Min_DB
extends
Min_SQLite { function
__construct (){ parent :: __construct ( " :memory: " ); $this -> query ( " PRAGMA foreign_keys = 1 " );} function
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
true ;} return
false ;} function
2018-06-30 00:38:01 +02:00
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2018-04-01 23:34:54 +02:00
next_result (){ return
false ;}}} class
Min_Driver
extends
Min_SQL { function
2018-12-25 21:50:48 +01:00
insertUpdate ( $Q , $K , $lg ){ $Vi = array (); foreach ( $K
as $O ) $Vi [] = " ( " . implode ( " , " , $O ) . " ) " ; return
queries ( " REPLACE INTO " . table ( $Q ) . " ( " . implode ( " , " , array_keys ( reset ( $K ))) . " ) VALUES \n " . implode ( " , \n " , $Vi ));} function
2018-06-30 00:38:01 +02:00
tableHelp ( $C ){ if ( $C == " sqlite_sequence " ) return " fileformat2.html#seqtab " ; if ( $C == " sqlite_master " ) return " fileformat2.html# $C " ;}} function
2018-12-25 21:50:48 +01:00
idf_escape ( $v ){ return '"' . str_replace ( '"' , '""' , $v ) . '"' ;} function
table ( $v ){ return
idf_escape ( $v );} function
2018-06-30 00:38:01 +02:00
connect (){ global $b ; list (,, $F ) = $b -> credentials (); if ( $F != " " ) return
lang ( 22 ); return
2018-04-01 23:34:54 +02:00
new
Min_DB ;} function
get_databases (){ return
array ();} function
2018-12-25 21:50:48 +01:00
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return " $G $Z " . ( $_ !== null ? $M . " LIMIT $_ " . ( $D ? " OFFSET $D " : " " ) : " " );} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ global $h ; return ( preg_match ( '~^INTO~' , $G ) || $h -> result ( " SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT') " ) ? limit ( $G , $Z , 1 , 0 , $M ) : " $G WHERE rowid = (SELECT rowid FROM " . table ( $Q ) . $Z . $M . " LIMIT 1) " );} function
db_collation ( $m , $pb ){ global $h ; return $h -> result ( " PRAGMA encoding " );} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
logged_user (){ return
get_current_user ();} function
tables_list (){ return
2018-06-30 00:38:01 +02:00
get_key_vals ( " SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') ORDER BY (name = 'sqlite_sequence'), name " );} function
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-12-25 21:50:48 +01:00
table_status ( $C = " " ){ global $h ; $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 " ] = $h -> 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 ( $R ){ return $R [ " Engine " ] == " view " ;} function
fk_support ( $R ){ global $h ; return ! $h -> result ( " SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY') " );} function
fields ( $Q ){ global $h ; $I = array (); $lg = " " ; foreach ( get_rows ( " PRAGMA table_info( " . table ( $Q ) . " ) " ) as $J ){ $C = $J [ " name " ]; $T = strtolower ( $J [ " type " ]); $Tb = $J [ " dflt_value " ]; $I [ $C ] = array ( " field " => $C , " type " => ( preg_match ( '~int~i' , $T ) ? " integer " : ( preg_match ( '~char|clob|text~i' , $T ) ? " text " : ( preg_match ( '~blob~i' , $T ) ? " blob " : ( preg_match ( '~real|floa|doub~i' , $T ) ? " real " : " numeric " )))), " full_type " => $T , " default " => ( preg_match ( " ~'(.*)'~ " , $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 ( $lg != " " ) $I [ $lg ][ " auto_increment " ] = false ; elseif ( preg_match ( '~^integer$~i' , $T )) $I [ $C ][ " auto_increment " ] = true ; $lg = $C ;}} $zh = $h -> result ( " SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q ( $Q )); preg_match_all ( '~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i' , $zh , $Fe , PREG_SET_ORDER ); foreach ( $Fe
2018-06-30 00:38:01 +02:00
as $B ){ $C = str_replace ( '""' , '"' , preg_replace ( '~^"|"$~' , '' , $B [ 1 ])); if ( $I [ $C ]) $I [ $C ][ " collation " ] = trim ( $B [ 3 ], " ' " );} return $I ;} function
2018-12-25 21:50:48 +01:00
indexes ( $Q , $i = null ){ global $h ; if ( ! is_object ( $i )) $i = $h ; $I = array (); $zh = $i -> result ( " SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q ( $Q )); if ( preg_match ( '~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*"|`[^`]*`)++)~i' , $zh , $B )){ $I [ " " ] = array ( " type " => " PRIMARY " , " columns " => array (), " lengths " => array (), " descs " => array ()); preg_match_all ( '~((("[^"]*+")+|(?:`[^`]*+`)+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i' , $B [ 1 ], $Fe , PREG_SET_ORDER ); foreach ( $Fe
as $B ){ $I [ " " ][ " columns " ][] = idf_unescape ( $B [ 2 ]) . $B [ 4 ]; $I [ " " ][ " descs " ][] = ( preg_match ( '~DESC~i' , $B [ 5 ]) ? '1' : null );}} if ( ! $I ){ foreach ( fields ( $Q ) as $C => $p ){ if ( $p [ " primary " ]) $I [ " " ] = array ( " type " => " PRIMARY " , " columns " => array ( $C ), " lengths " => array (), " descs " => array ( null ));}} $Bh = get_key_vals ( " SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q ( $Q ), $i ); foreach ( get_rows ( " PRAGMA index_list( " . table ( $Q ) . " ) " , $i ) as $J ){ $C = $J [ " name " ]; $w = array ( " type " => ( $J [ " unique " ] ? " UNIQUE " : " INDEX " )); $w [ " lengths " ] = array (); $w [ " descs " ] = array (); foreach ( get_rows ( " PRAGMA index_info( " . idf_escape ( $C ) . " ) " , $i ) as $Yg ){ $w [ " columns " ][] = $Yg [ " name " ]; $w [ " descs " ][] = null ;} if ( preg_match ( '~^CREATE( UNIQUE)? INDEX ' . preg_quote ( idf_escape ( $C ) . ' ON ' . idf_escape ( $Q ), '~' ) . ' \((.*)\)$~i' , $Bh [ $C ], $Ig )){ preg_match_all ( '/("[^"]*+")+( DESC)?/' , $Ig [ 2 ], $Fe ); foreach ( $Fe [ 2 ] as $z => $X ){ if ( $X ) $w [ " descs " ][ $z ] = '1' ;}} if ( ! $I [ " " ] || $w [ " type " ] != " UNIQUE " || $w [ " columns " ] != $I [ " " ][ " columns " ] || $w [ " descs " ] != $I [ " " ][ " descs " ] ||! preg_match ( " ~^sqlite_~ " , $C )) $I [ $C ] = $w ;} return $I ;} function
foreign_keys ( $Q ){ $I = array (); foreach ( get_rows ( " PRAGMA foreign_key_list( " . table ( $Q ) . " ) " ) as $J ){ $r =& $I [ $J [ " id " ]]; if ( ! $r ) $r = $J ; $r [ " source " ][] = $J [ " from " ]; $r [ " target " ][] = $J [ " to " ];} return $I ;} function
view ( $C ){ global $h ; return
array ( " select " => preg_replace ( '~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\s+~iU' , '' , $h -> result ( " SELECT sql FROM sqlite_master WHERE name = " . q ( $C ))));} function
2018-04-01 23:34:54 +02:00
collations (){ return ( isset ( $_GET [ " create " ]) ? get_vals ( " PRAGMA collation_list " , 1 ) : array ());} function
2018-12-25 21:50:48 +01:00
information_schema ( $m ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
error (){ global $h ; return
h ( $h -> error );} function
check_sqlite_name ( $C ){ global $h ; $Lc = " db|sdb|sqlite " ; if ( ! preg_match ( " ~^[^ \\ 0]* \\ .( $Lc ) \$ ~ " , $C )){ $h -> error = lang ( 23 , str_replace ( " | " , " , " , $Lc )); return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
create_database ( $m , $d ){ global $h ; if ( file_exists ( $m )){ $h -> error = lang ( 24 ); return
false ;} if ( ! check_sqlite_name ( $m )) return
false ; try { $A = new
Min_SQLite ( $m );} catch ( Exception $Bc ){ $h -> error = $Bc -> getMessage (); return
false ;} $A -> query ( 'PRAGMA encoding = "UTF-8"' ); $A -> query ( 'CREATE TABLE adminer (i)' ); $A -> query ( 'DROP TABLE adminer' ); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
drop_databases ( $l ){ global $h ; $h -> __construct ( " :memory: " ); foreach ( $l
as $m ){ if ( !@ unlink ( $m )){ $h -> error = lang ( 24 ); return
2018-04-01 23:34:54 +02:00
false ;}} return
true ;} function
2018-12-25 21:50:48 +01:00
rename_database ( $C , $d ){ global $h ; if ( ! check_sqlite_name ( $C )) return
false ; $h -> __construct ( " :memory: " ); $h -> error = lang ( 24 ); return @ rename ( DB , $C );} function
2018-04-01 23:34:54 +02:00
auto_increment (){ return " PRIMARY KEY " . ( DRIVER == " sqlite " ? " AUTOINCREMENT " : " " );} function
2018-12-25 21:50:48 +01:00
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ $Pi = ( $Q == " " || $dd ); foreach ( $q
as $p ){ if ( $p [ 0 ] != " " ||! $p [ 1 ] || $p [ 2 ]){ $Pi = true ; break ;}} $c = array (); $Jf = array (); foreach ( $q
as $p ){ if ( $p [ 1 ]){ $c [] = ( $Pi ? $p [ 1 ] : " ADD " . implode ( $p [ 1 ])); if ( $p [ 0 ] != " " ) $Jf [ $p [ 0 ]] = $p [ 1 ][ 0 ];}} if ( ! $Pi ){ foreach ( $c
as $X ){ if ( ! queries ( " ALTER TABLE " . table ( $Q ) . " $X " )) return
false ;} if ( $Q != $C &&! queries ( " ALTER TABLE " . table ( $Q ) . " RENAME TO " . table ( $C ))) return
false ;} elseif ( ! recreate_table ( $Q , $C , $c , $Jf , $dd )) return
2018-06-30 00:38:01 +02:00
false ; if ( $Ma ) queries ( " UPDATE sqlite_sequence SET seq = $Ma WHERE name = " . q ( $C )); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
recreate_table ( $Q , $C , $q , $Jf , $dd , $x = array ()){ if ( $Q != " " ){ if ( ! $q ){ foreach ( fields ( $Q ) as $z => $p ){ if ( $x ) $p [ " auto_increment " ] = 0 ; $q [] = process_field ( $p , $p ); $Jf [ $z ] = idf_escape ( $z );}} $mg = false ; foreach ( $q
as $p ){ if ( $p [ 6 ]) $mg = true ;} $ic = array (); foreach ( $x
as $z => $X ){ if ( $X [ 2 ] == " DROP " ){ $ic [ $X [ 1 ]] = true ; unset ( $x [ $z ]);}} foreach ( indexes ( $Q ) as $he => $w ){ $f = array (); foreach ( $w [ " columns " ] as $z => $e ){ if ( ! $Jf [ $e ]) continue
2 ; $f [] = $Jf [ $e ] . ( $w [ " descs " ][ $z ] ? " DESC " : " " );} if ( ! $ic [ $he ]){ if ( $w [ " type " ] != " PRIMARY " ||! $mg ) $x [] = array ( $w [ " type " ], $he , $f );}} foreach ( $x
as $z => $X ){ if ( $X [ 0 ] == " PRIMARY " ){ unset ( $x [ $z ]); $dd [] = " PRIMARY KEY ( " . implode ( " , " , $X [ 2 ]) . " ) " ;}} foreach ( foreign_keys ( $Q ) as $he => $r ){ foreach ( $r [ " source " ] as $z => $e ){ if ( ! $Jf [ $e ]) continue
2 ; $r [ " source " ][ $z ] = idf_unescape ( $Jf [ $e ]);} if ( ! isset ( $dd [ " $he " ])) $dd [] = " " . format_foreign_key ( $r );} queries ( " BEGIN " );} foreach ( $q
as $z => $p ) $q [ $z ] = " " . implode ( $p ); $q = array_merge ( $q , array_filter ( $dd )); if ( ! queries ( " CREATE TABLE " . table ( $Q != " " ? " adminer_ $C " : $C ) . " ( \n " . implode ( " , \n " , $q ) . " \n ) " )) return
false ; if ( $Q != " " ){ if ( $Jf &&! queries ( " INSERT INTO " . table ( " adminer_ $C " ) . " ( " . implode ( " , " , $Jf ) . " ) SELECT " . implode ( " , " , array_map ( 'idf_escape' , array_keys ( $Jf ))) . " FROM " . table ( $Q ))) return
false ; $Ai = array (); foreach ( triggers ( $Q ) as $zi => $hi ){ $yi = trigger ( $zi ); $Ai [] = " CREATE TRIGGER " . idf_escape ( $zi ) . " " . implode ( " " , $hi ) . " ON " . table ( $C ) . " \n $yi[Statement] " ;} if ( ! queries ( " DROP TABLE " . table ( $Q ))) return
false ; queries ( " ALTER TABLE " . table ( " adminer_ $C " ) . " RENAME TO " . table ( $C )); if ( ! alter_indexes ( $C , $x )) return
false ; foreach ( $Ai
as $yi ){ if ( ! queries ( $yi )) return
2018-04-01 23:34:54 +02:00
false ;} queries ( " COMMIT " );} return
true ;} function
2018-12-25 21:50:48 +01:00
index_sql ( $Q , $T , $C , $f ){ return " CREATE $T " . ( $T != " INDEX " ? " INDEX " : " " ) . idf_escape ( $C != " " ? $C : uniqid ( $Q . " _ " )) . " ON " . table ( $Q ) . " $f " ;} function
alter_indexes ( $Q , $c ){ foreach ( $c
as $lg ){ if ( $lg [ 0 ] == " PRIMARY " ) return
recreate_table ( $Q , $Q , array (), array (), array (), $c );} foreach ( array_reverse ( $c ) as $X ){ if ( ! queries ( $X [ 2 ] == " DROP " ? " DROP INDEX " . idf_escape ( $X [ 1 ]) : index_sql ( $Q , $X [ 0 ], $X [ 1 ], " ( " . implode ( " , " , $X [ 2 ]) . " ) " ))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
truncate_tables ( $S ){ return
apply_queries ( " DELETE FROM " , $S );} function
drop_views ( $aj ){ return
apply_queries ( " DROP VIEW " , $aj );} function
drop_tables ( $S ){ return
apply_queries ( " DROP TABLE " , $S );} function
move_tables ( $S , $aj , $Yh ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
trigger ( $C ){ global $h ; if ( $C == " " ) return
array ( " Statement " => " BEGIN \n \t ; \n END " ); $v = '(?:[^`"\s]+|`[^`]*`|"[^"]*")+' ; $_i = trigger_options (); preg_match ( " ~^CREATE \\ s+TRIGGER \\ s* $v\\s *( " . implode ( " | " , $_i [ " Timing " ]) . " ) \\ s+([a-z]+)(?: \\ s+OF \\ s+( $v ))? \\ s+ON \\ s* $v\\s *(?:FOR \\ s+EACH \\ s+ROW \\ s)?(.*)~is " , $h -> result ( " SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = " . q ( $C )), $B ); $kf = $B [ 3 ]; return
array ( " Timing " => strtoupper ( $B [ 1 ]), " Event " => strtoupper ( $B [ 2 ]) . ( $kf ? " OF " : " " ), " Of " => ( $kf [ 0 ] == '`' || $kf [ 0 ] == '"' ? idf_unescape ( $kf ) : $kf ), " Trigger " => $C , " Statement " => $B [ 4 ],);} function
triggers ( $Q ){ $I = array (); $_i = trigger_options (); foreach ( get_rows ( " SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $Q )) as $J ){ preg_match ( '~^CREATE\s+TRIGGER\s*(?:[^`"\s]+|`[^`]*`|"[^"]*")+\s*(' . implode ( " | " , $_i [ " Timing " ]) . ')\s*(.*)\s+ON\b~iU' , $J [ " sql " ], $B ); $I [ $J [ " name " ]] = array ( $B [ 1 ], $B [ 2 ]);} return $I ;} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
last_id (){ global $h ; return $h -> result ( " SELECT LAST_INSERT_ROWID() " );} function
explain ( $h , $G ){ return $h -> query ( " EXPLAIN QUERY PLAN $G " );} function
found_rows ( $R , $Z ){} function
2018-04-01 23:34:54 +02:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2018-12-25 21:50:48 +01:00
set_schema ( $ch ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
create_sql ( $Q , $Ma , $Jh ){ global $h ; $I = $h -> result ( " SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q ( $Q )); foreach ( indexes ( $Q ) as $C => $w ){ if ( $C == '' ) continue ; $I .= " ; \n \n " . index_sql ( $Q , $w [ 'type' ], $C , " ( " . implode ( " , " , array_map ( 'idf_escape' , $w [ 'columns' ])) . " ) " );} return $I ;} function
truncate_sql ( $Q ){ return " DELETE FROM " . table ( $Q );} function
use_sql ( $k ){} function
trigger_sql ( $Q ){ return
implode ( get_vals ( " SELECT sql || ';; \n ' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $Q )));} function
show_variables (){ global $h ; $I = array (); foreach ( array ( " auto_vacuum " , " cache_size " , " count_changes " , " default_cache_size " , " empty_result_callbacks " , " encoding " , " foreign_keys " , " full_column_names " , " fullfsync " , " journal_mode " , " journal_size_limit " , " legacy_file_format " , " locking_mode " , " page_size " , " max_page_count " , " read_uncommitted " , " recursive_triggers " , " reverse_unordered_selects " , " secure_delete " , " short_column_names " , " synchronous " , " temp_store " , " temp_store_directory " , " schema_version " , " integrity_check " , " quick_check " ) as $z ) $I [ $z ] = $h -> result ( " PRAGMA $z " ); return $I ;} function
show_status (){ $I = array (); foreach ( get_vals ( " PRAGMA compile_options " ) as $yf ){ list ( $z , $X ) = explode ( " = " , $yf , 2 ); $I [ $z ] = $X ;} return $I ;} function
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ return $I ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
2018-12-25 21:50:48 +01:00
preg_match ( '~^(columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~' , $Qc );} $y = " sqlite " ; $U = array ( " integer " => 0 , " real " => 0 , " numeric " => 0 , " text " => 0 , " blob " => 0 ); $Ih = array_keys ( $U ); $Ji = array (); $wf = 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 " ])){ $ig = array ( " PgSQL " , " PDO_PgSQL " ); define ( " DRIVER " , " pgsql " ); if ( extension_loaded ( " pgsql " )){ class
2018-06-30 00:38:01 +02:00
Min_DB { var $extension = " PgSQL " , $_link , $_result , $_string , $_database = true , $server_info , $affected_rows , $error , $timeout ; function
2018-12-25 21:50:48 +01:00
_error ( $yc , $o ){ if ( ini_bool ( " html_errors " )) $o = html_entity_decode ( strip_tags ( $o )); $o = preg_replace ( '~^[^:]*: ~' , '' , $o ); $this -> error = $o ;} function
connect ( $N , $V , $F ){ global $b ; $m = $b -> database (); set_error_handler ( array ( $this , '_error' )); $this -> _string = " host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $N , " ' \\ " )) . " ' user=' " . addcslashes ( $V , " ' \\ " ) . " ' password=' " . addcslashes ( $F , " ' \\ " ) . " ' " ; $this -> _link =@ pg_connect ( " $this->_string dbname=' " . ( $m != " " ? addcslashes ( $m , " ' \\ " ) : " postgres " ) . " ' " , PGSQL_CONNECT_FORCE_NEW ); if ( ! $this -> _link && $m != " " ){ $this -> _database = false ; $this -> _link =@ pg_connect ( " $this->_string dbname='postgres' " , PGSQL_CONNECT_FORCE_NEW );} restore_error_handler (); if ( $this -> _link ){ $Yi = pg_version ( $this -> _link ); $this -> server_info = $Yi [ " server " ]; pg_set_client_encoding ( $this -> _link , " UTF8 " );} return ( bool ) $this -> _link ;} function
quote ( $P ){ return " ' " . pg_escape_string ( $this -> _link , $P ) . " ' " ;} function
value ( $X , $p ){ return ( $p [ " type " ] == " bytea " ? pg_unescape_bytea ( $X ) : $X );} function
quoteBinary ( $P ){ return " ' " . pg_escape_bytea ( $this -> _link , $P ) . " ' " ;} function
select_db ( $k ){ global $b ; if ( $k == $b -> database ()) return $this -> _database ; $I =@ pg_connect ( " $this->_string dbname=' " . addcslashes ( $k , " ' \\ " ) . " ' " , PGSQL_CONNECT_FORCE_NEW ); if ( $I ) $this -> _link = $I ; return $I ;} function
2018-04-01 23:34:54 +02:00
close (){ $this -> _link =@ pg_connect ( " $this->_string dbname='postgres' " );} function
2018-12-25 21:50:48 +01:00
query ( $G , $Di = false ){ $H =@ pg_query ( $this -> _link , $G ); $this -> error = " " ; if ( ! $H ){ $this -> error = pg_last_error ( $this -> _link ); $I = false ;} elseif ( ! pg_num_fields ( $H )){ $this -> affected_rows = pg_affected_rows ( $H ); $I = true ;} else $I = new
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! $H ||! $H -> num_rows ) return
2018-04-01 23:34:54 +02:00
false ; return
2018-12-25 21:50:48 +01:00
pg_fetch_result ( $H -> _result , 0 , $p );} function
2018-04-01 23:34:54 +02:00
warnings (){ return
h ( pg_last_notice ( $this -> _link ));}} class
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ; $this -> num_rows = pg_num_rows ( $H );} function
2018-04-01 23:34:54 +02:00
fetch_assoc (){ return
pg_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
pg_fetch_row ( $this -> _result );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $e = $this -> _offset ++ ; $I = new
stdClass ; if ( function_exists ( 'pg_field_table' )) $I -> orgtable = pg_field_table ( $this -> _result , $e ); $I -> name = pg_field_name ( $this -> _result , $e ); $I -> orgname = $I -> name ; $I -> type = pg_field_type ( $this -> _result , $e ); $I -> charsetnr = ( $I -> type == " bytea " ? 63 : 0 ); return $I ;} function
2018-04-01 23:34:54 +02:00
__destruct (){ pg_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_pgsql " )){ class
Min_DB
extends
2018-06-30 00:38:01 +02:00
Min_PDO { var $extension = " PDO_PgSQL " , $timeout ; function
2018-12-25 21:50:48 +01:00
connect ( $N , $V , $F ){ global $b ; $m = $b -> database (); $P = " pgsql:host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $N , " ' \\ " )) . " ' options='-c client_encoding=utf8' " ; $this -> dsn ( " $P dbname=' " . ( $m != " " ? addcslashes ( $m , " ' \\ " ) : " postgres " ) . " ' " , $V , $F ); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ global $b ; return ( $b -> database () == $k );} function
quoteBinary ( $Zg ){ return
q ( $Zg );} function
query ( $G , $Di = false ){ $I = parent :: query ( $G , $Di ); if ( $this -> timeout ){ $this -> timeout = 0 ; parent :: query ( " RESET statement_timeout " );} return $I ;} function
2018-04-01 23:34:54 +02:00
warnings (){ return '' ;} function
close (){}}} class
Min_Driver
extends
Min_SQL { function
2018-12-25 21:50:48 +01:00
insertUpdate ( $Q , $K , $lg ){ global $h ; foreach ( $K
as $O ){ $Ki = array (); $Z = array (); foreach ( $O
as $z => $X ){ $Ki [] = " $z = $X " ; if ( isset ( $lg [ idf_unescape ( $z )])) $Z [] = " $z = $X " ;} if ( ! (( $Z && queries ( " UPDATE " . table ( $Q ) . " SET " . implode ( " , " , $Ki ) . " WHERE " . implode ( " AND " , $Z )) && $h -> affected_rows ) || queries ( " INSERT INTO " . table ( $Q ) . " ( " . implode ( " , " , array_keys ( $O )) . " ) VALUES ( " . implode ( " , " , $O ) . " ) " ))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
slowQuery ( $G , $gi ){ $this -> _conn -> query ( " SET statement_timeout = " . ( 1000 * $gi )); $this -> _conn -> timeout = 1000 * $gi ; return $G ;} function
convertSearch ( $v , $X , $p ){ return ( preg_match ( '~char|text' . ( ! preg_match ( '~LIKE~' , $X [ " op " ]) ? '|date|time(stamp)?|boolean|uuid|' . number_type () : '' ) . '~' , $p [ " type " ]) ? $v : " CAST( $v AS text) " );} function
quoteBinary ( $Zg ){ return $this -> _conn -> quoteBinary ( $Zg );} function
2018-04-01 23:34:54 +02:00
warnings (){ return $this -> _conn -> warnings ();} function
2018-12-25 21:50:48 +01:00
tableHelp ( $C ){ $ye = array ( " information_schema " => " infoschema " , " pg_catalog " => " catalog " ,); $A = $ye [ $_GET [ " ns " ]]; if ( $A ) return " $A - " . str_replace ( " _ " , " - " , $C ) . " .html " ;}} function
idf_escape ( $v ){ return '"' . str_replace ( '"' , '""' , $v ) . '"' ;} function
table ( $v ){ return
idf_escape ( $v );} function
connect (){ global $b , $U , $Ih ; $h = new
Min_DB ; $Hb = $b -> credentials (); if ( $h -> connect ( $Hb [ 0 ], $Hb [ 1 ], $Hb [ 2 ])){ if ( min_version ( 9 , 0 , $h )){ $h -> query ( " SET application_name = 'Adminer' " ); if ( min_version ( 9.2 , 0 , $h )){ $Ih [ lang ( 25 )][] = " json " ; $U [ " json " ] = 4294967295 ; if ( min_version ( 9.4 , 0 , $h )){ $Ih [ lang ( 25 )][] = " jsonb " ; $U [ " jsonb " ] = 4294967295 ;}}} return $h ;} return $h -> error ;} function
2018-04-01 23:34:54 +02:00
get_databases (){ return
get_vals ( " SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname " );} function
2018-12-25 21:50:48 +01:00
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return " $G $Z " . ( $_ !== null ? $M . " LIMIT $_ " . ( $D ? " OFFSET $D " : " " ) : " " );} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ return ( preg_match ( '~^INTO~' , $G ) ? limit ( $G , $Z , 1 , 0 , $M ) : " $G " . ( is_view ( table_status1 ( $Q )) ? $Z : " WHERE ctid = (SELECT ctid FROM " . table ( $Q ) . $Z . $M . " LIMIT 1) " ));} function
db_collation ( $m , $pb ){ global $h ; return $h -> result ( " SHOW LC_COLLATE " );} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-12-25 21:50:48 +01:00
logged_user (){ global $h ; return $h -> result ( " SELECT user " );} function
2018-06-30 00:38:01 +02:00
tables_list (){ $G = " SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() " ; if ( support ( 'materializedview' )) $G .= "
2018-04-01 23:34:54 +02:00
UNION ALL
SELECT matviewname , 'MATERIALIZED VIEW'
FROM pg_matviews
2018-06-30 00:38:01 +02:00
WHERE schemaname = current_schema () " ; $G .= "
2018-04-01 23:34:54 +02:00
ORDER BY 1 " ;return
2018-06-30 00:38:01 +02:00
get_key_vals ( $G );} function
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
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' )
2018-06-30 00:38:01 +02:00
" .( $C != " " ? " AND relname = " .q( $C ): " ORDER BY relname " ))as $J ) $I[$J["Name"] ]= $J ;return( $C != " " ? $I[$C] : $I );}function
2018-12-25 21:50:48 +01:00
is_view ( $R ){ return
in_array ( $R [ " Engine " ], array ( " view " , " materialized view " ));} function
fk_support ( $R ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
fields ( $Q ){ $I = array (); $Da = array ( 'timestamp without time zone' => 'timestamp' , 'timestamp with time zone' => 'timestamptz' ,); $Ed = min_version ( 10 ) ? " (a.attidentity = 'd')::int " : '0' ; foreach ( get_rows ( " SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment, $Ed AS identity
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
WHERE c . relname = " .q( $Q ). "
2018-04-01 23:34:54 +02:00
AND n . nspname = current_schema ()
AND NOT a . attisdropped
AND a . attnum > 0
2018-12-25 21:50:48 +01:00
ORDER BY a . attnum " )as $J ) { preg_match('~([^([]+)( \ ((.*) \ ))?([a-z ]+)?(( \ [[0-9]*])*) $ ~', $J["full_type"] , $B );list(, $T , $ve , $J["length"] , $xa , $Ga )= $B ; $J["length"] .= $Ga ; $eb = $T . $xa ;if(isset( $Da[$eb] )) { $J [ " type " ] = $Da [ $eb ]; $J [ " full_type " ] = $J [ " type " ] . $ve . $Ga ; } else { $J [ " type " ] = $T ; $J [ " full_type " ] = $J [ " type " ] . $ve . $xa . $Ga ; } if( $J['identity'] ) $J['default'] ='GENERATED BY DEFAULT AS IDENTITY'; $J["null"] =! $J["attnotnull"] ; $J["auto_increment"] = $J['identity'] ||preg_match('~^nextval \ (~i', $J["default"] ); $J["privileges"] =array( " insert " =>1, " select " =>1, " update " =>1);if(preg_match('~(.+)::[^)]+(.*)~', $J["default"] , $B )) $J["default"] =( $B[1] == " NULL " ?null:(( $B[1] [0]== " ' " ?idf_unescape( $B[1] ): $B[1] ). $B[2] )); $I[$J["field"] ]= $J ;}return $I ;}function
indexes ( $Q , $i = null ){ global $h ; if ( ! is_object ( $i )) $i = $h ; $I = array (); $Rh = $i -> result ( " SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q ( $Q )); $f = get_key_vals ( " SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Rh AND attnum > 0 " , $i ); foreach ( get_rows ( " SELECT relname, indisunique::int, indisprimary::int, indkey, indoption , (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $Rh AND ci.oid = i.indexrelid " , $i ) as $J ){ $Jg = $J [ " relname " ]; $I [ $Jg ][ " type " ] = ( $J [ " indispartial " ] ? " INDEX " : ( $J [ " indisprimary " ] ? " PRIMARY " : ( $J [ " indisunique " ] ? " UNIQUE " : " INDEX " ))); $I [ $Jg ][ " columns " ] = array (); foreach ( explode ( " " , $J [ " indkey " ]) as $Od ) $I [ $Jg ][ " columns " ][] = $f [ $Od ]; $I [ $Jg ][ " descs " ] = array (); foreach ( explode ( " " , $J [ " indoption " ]) as $Pd ) $I [ $Jg ][ " descs " ][] = ( $Pd & 1 ? '1' : null ); $I [ $Jg ][ " lengths " ] = array ();} return $I ;} function
foreign_keys ( $Q ){ global $rf ; $I = array (); foreach ( get_rows ( " SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
2018-04-01 23:34:54 +02:00
FROM pg_constraint
2018-12-25 21:50:48 +01:00
WHERE conrelid = ( SELECT pc . oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON ( pn . oid = pc . relnamespace ) WHERE pc . relname = " .q( $Q ). " AND pn . nspname = current_schema ())
2018-04-01 23:34:54 +02:00
AND contype = 'f' :: char
2018-12-25 21:50:48 +01:00
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 ], $Ee )){ $J [ 'ns' ] = str_replace ( '""' , '"' , preg_replace ( '~^"(.+)"$~' , '\1' , $Ee [ 2 ])); $J [ 'table' ] = str_replace ( '""' , '"' , preg_replace ( '~^"(.+)"$~' , '\1' , $Ee [ 4 ])); } $J['target'] =array_map('trim',explode(',', $B[3] )); $J['on_delete'] =(preg_match( " ~ ON DELETE ( $rf ) ~ " , $B[4] , $Ee )? $Ee[1] :'NO ACTION'); $J['on_update'] =(preg_match( " ~ ON UPDATE ( $rf ) ~ " , $B[4] , $Ee )? $Ee[1] :'NO ACTION'); $I[$J['conname'] ]= $J ;}}return $I ;}function
view ( $C ){ global $h ; return
array ( " select " => trim ( $h -> result ( " SELECT view_definition
2018-04-01 23:34:54 +02:00
FROM information_schema . views
2018-06-30 00:38:01 +02:00
WHERE table_schema = current_schema () AND table_name = " .q( $C ))));}function
2018-04-01 23:34:54 +02:00
collations (){ return
array ();} function
2018-12-25 21:50:48 +01:00
information_schema ( $m ){ return ( $m == " information_schema " );} function
error (){ global $h ; $I = h ( $h -> 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
2018-06-30 00:38:01 +02:00
nl_br ( $I );} function
2018-12-25 21:50:48 +01:00
create_database ( $m , $d ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $d ? " ENCODING " . idf_escape ( $d ) : " " ));} function
drop_databases ( $l ){ global $h ; $h -> close (); return
apply_queries ( " DROP DATABASE " , $l , 'idf_escape' );} function
rename_database ( $C , $d ){ return
2018-06-30 00:38:01 +02:00
queries ( " ALTER DATABASE " . idf_escape ( DB ) . " RENAME TO " . idf_escape ( $C ));} function
2018-04-01 23:34:54 +02:00
auto_increment (){ return " " ;} function
2018-12-25 21:50:48 +01:00
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ $c = array (); $wg = array (); foreach ( $q
as $p ){ $e = idf_escape ( $p [ 0 ]); $X = $p [ 1 ]; if ( ! $X ) $c [] = " DROP $e " ; else { $Ui = $X [ 5 ]; unset ( $X [ 5 ]); if ( isset ( $X [ 6 ]) && $p [ 0 ] == " " ) $X [ 1 ] = ( $X [ 1 ] == " bigint " ? " big " : " " ) . " serial " ; if ( $p [ 0 ] == " " ) $c [] = ( $Q != " " ? " ADD " : " " ) . implode ( $X ); else { if ( $e != $X [ 0 ]) $wg [] = " ALTER TABLE " . table ( $Q ) . " RENAME $e TO $X[0] " ; $c [] = " ALTER $e TYPE $X[1] " ; if ( ! $X [ 6 ]){ $c [] = " ALTER $e " . ( $X [ 3 ] ? " SET $X[3] " : " DROP DEFAULT " ); $c [] = " ALTER $e " . ( $X [ 2 ] == " NULL " ? " DROP NOT " : " SET " ) . $X [ 2 ];}} if ( $p [ 0 ] != " " || $Ui != " " ) $wg [] = " COMMENT ON COLUMN " . table ( $Q ) . " . $X[0] IS " . ( $Ui != " " ? substr ( $Ui , 9 ) : " '' " );}} $c = array_merge ( $c , $dd ); if ( $Q == " " ) array_unshift ( $wg , " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); elseif ( $c ) array_unshift ( $wg , " ALTER TABLE " . table ( $Q ) . " \n " . implode ( " , \n " , $c )); if ( $Q != " " && $Q != $C ) $wg [] = " ALTER TABLE " . table ( $Q ) . " RENAME TO " . table ( $C ); if ( $Q != " " || $ub != " " ) $wg [] = " COMMENT ON TABLE " . table ( $C ) . " IS " . q ( $ub ); if ( $Ma != " " ){} foreach ( $wg
2018-06-30 00:38:01 +02:00
as $G ){ if ( ! queries ( $G )) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
alter_indexes ( $Q , $c ){ $j = array (); $gc = array (); $wg = array (); foreach ( $c
as $X ){ if ( $X [ 0 ] != " INDEX " ) $j [] = ( $X [ 2 ] == " DROP " ? " \n DROP CONSTRAINT " . idf_escape ( $X [ 1 ]) : " \n ADD " . ( $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 $wg [] = " CREATE INDEX " . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $Q . " _ " )) . " ON " . table ( $Q ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " ;} if ( $j ) array_unshift ( $wg , " ALTER TABLE " . table ( $Q ) . implode ( " , " , $j )); if ( $gc ) array_unshift ( $wg , " DROP INDEX " . implode ( " , " , $gc )); foreach ( $wg
2018-06-30 00:38:01 +02:00
as $G ){ if ( ! queries ( $G )) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
truncate_tables ( $S ){ return
queries ( " TRUNCATE " . implode ( " , " , array_map ( 'table' , $S ))); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
drop_views ( $aj ){ return
drop_tables ( $aj );} function
drop_tables ( $S ){ foreach ( $S
as $Q ){ $Fh = table_status ( $Q ); if ( ! queries ( " DROP " . strtoupper ( $Fh [ " Engine " ]) . " " . table ( $Q ))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
move_tables ( $S , $aj , $Yh ){ foreach ( array_merge ( $S , $aj ) as $Q ){ $Fh = table_status ( $Q ); if ( ! queries ( " ALTER " . strtoupper ( $Fh [ " Engine " ]) . " " . table ( $Q ) . " SET SCHEMA " . idf_escape ( $Yh ))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
trigger ( $C , $Q = null ){ if ( $C == " " ) return
array ( " Statement " => " EXECUTE PROCEDURE () " ); if ( $Q === null ) $Q = $_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 ( $Q ) . ' AND t.trigger_name = ' . q ( $C )); return
2018-06-30 00:38:01 +02:00
reset ( $K );} function
2018-12-25 21:50:48 +01:00
triggers ( $Q ){ $I = array (); foreach ( get_rows ( " SELECT * FROM information_schema.triggers WHERE event_object_table = " . q ( $Q )) as $J ) $I [ $J [ " trigger_name " ]] = array ( $J [ " action_timing " ], $J [ " event_manipulation " ]); return $I ;} function
2018-04-01 23:34:54 +02:00
trigger_options (){ return
array ( " Timing " => array ( " BEFORE " , " AFTER " ), " Event " => array ( " INSERT " , " UPDATE " , " DELETE " ), " Type " => array ( " FOR EACH ROW " , " FOR EACH STATEMENT " ),);} function
2018-12-25 21:50:48 +01:00
routine ( $C , $T ){ $K = get_rows ( ' SELECT routine_definition AS definition , LOWER ( external_language ) AS language , *
2018-04-01 23:34:54 +02:00
FROM information_schema . routines
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
FROM information_schema . parameters
2018-06-30 00:38:01 +02:00
WHERE specific_schema = current_schema () AND specific_name = '.q($C).'
ORDER BY ordinal_position ' ); return $I ;} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
routine_id ( $C , $J ){ $I = array (); foreach ( $J [ " fields " ] as $p ) $I [] = $p [ " type " ]; return
2018-06-30 00:38:01 +02:00
idf_escape ( $C ) . " ( " . implode ( " , " , $I ) . " ) " ;} function
2018-04-01 23:34:54 +02:00
last_id (){ return
0 ;} function
2018-12-25 21:50:48 +01:00
explain ( $h , $G ){ return $h -> query ( " EXPLAIN $G " );} function
found_rows ( $R , $Z ){ global $h ; if ( preg_match ( " ~ rows=([0-9]+)~ " , $h -> result ( " EXPLAIN SELECT * FROM " . idf_escape ( $R [ " Name " ]) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " )), $Ig )) return $Ig [ 1 ]; return
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
get_schema (){ global $h ; return $h -> result ( " SELECT current_schema() " );} function
set_schema ( $bh ){ global $h , $U , $Ih ; $I = $h -> query ( " SET search_path TO " . idf_escape ( $bh )); foreach ( types () as $T ){ if ( ! isset ( $U [ $T ])){ $U [ $T ] = 0 ; $Ih [ lang ( 26 )][] = $T ;}} return $I ;} function
create_sql ( $Q , $Ma , $Jh ){ global $h ; $I = '' ; $Rg = array (); $lh = array (); $Fh = table_status ( $Q ); $q = fields ( $Q ); $x = indexes ( $Q ); ksort ( $x ); $ad = foreign_keys ( $Q ); ksort ( $ad ); if ( ! $Fh || empty ( $q )) return
false ; $I = " CREATE TABLE " . idf_escape ( $Fh [ 'nspname' ]) . " . " . idf_escape ( $Fh [ 'Name' ]) . " ( \n " ; foreach ( $q
as $Sc => $p ){ $Sf = idf_escape ( $p [ 'field' ]) . ' ' . $p [ 'full_type' ] . default_value ( $p ) . ( $p [ 'attnotnull' ] ? " NOT NULL " : " " ); $Rg [] = $Sf ; if ( preg_match ( '~nextval\(\'([^\']+)\'\)~' , $p [ 'default' ], $Fe )){ $kh = $Fe [ 1 ]; $yh = reset ( get_rows ( min_version ( 10 ) ? " SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = " . q ( $kh ) : " SELECT * FROM $kh " )); $lh [] = ( $Jh == " DROP+CREATE " ? " DROP SEQUENCE IF EXISTS $kh ; \n " : " " ) . " CREATE SEQUENCE $kh INCREMENT $yh[increment_by] MINVALUE $yh[min_value] MAXVALUE $yh[max_value] START " . ( $Ma ? $yh [ 'last_value' ] : 1 ) . " CACHE $yh[cache_value] ; " ;}} if ( ! empty ( $lh )) $I = implode ( " \n \n " , $lh ) . " \n \n $I " ; foreach ( $x
as $Jd => $w ){ switch ( $w [ 'type' ]){ case 'UNIQUE' : $Rg [] = " CONSTRAINT " . idf_escape ( $Jd ) . " UNIQUE ( " . implode ( ', ' , array_map ( 'idf_escape' , $w [ 'columns' ])) . " ) " ; break ; case 'PRIMARY' : $Rg [] = " CONSTRAINT " . idf_escape ( $Jd ) . " PRIMARY KEY ( " . implode ( ', ' , array_map ( 'idf_escape' , $w [ 'columns' ])) . " ) " ; break ;}} foreach ( $ad
as $Zc => $Yc ) $Rg [] = " CONSTRAINT " . idf_escape ( $Zc ) . " $Yc[definition] " . ( $Yc [ 'deferrable' ] ? 'DEFERRABLE' : 'NOT DEFERRABLE' ); $I .= implode ( " , \n " , $Rg ) . " \n ) WITH (oids = " . ( $Fh [ 'Oid' ] ? 'true' : 'false' ) . " ); " ; foreach ( $x
as $Jd => $w ){ if ( $w [ 'type' ] == 'INDEX' ){ $f = array (); foreach ( $w [ 'columns' ] as $z => $X ) $f [] = idf_escape ( $X ) . ( $w [ 'descs' ][ $z ] ? " DESC " : " " ); $I .= " \n \n CREATE INDEX " . idf_escape ( $Jd ) . " ON " . idf_escape ( $Fh [ 'nspname' ]) . " . " . idf_escape ( $Fh [ 'Name' ]) . " USING btree ( " . implode ( ', ' , $f ) . " ); " ;}} if ( $Fh [ 'Comment' ]) $I .= " \n \n COMMENT ON TABLE " . idf_escape ( $Fh [ 'nspname' ]) . " . " . idf_escape ( $Fh [ 'Name' ]) . " IS " . q ( $Fh [ 'Comment' ]) . " ; " ; foreach ( $q
as $Sc => $p ){ if ( $p [ 'comment' ]) $I .= " \n \n COMMENT ON COLUMN " . idf_escape ( $Fh [ 'nspname' ]) . " . " . idf_escape ( $Fh [ 'Name' ]) . " . " . idf_escape ( $Sc ) . " IS " . q ( $p [ 'comment' ]) . " ; " ;} return
2018-06-30 00:38:01 +02:00
rtrim ( $I , ';' );} function
2018-12-25 21:50:48 +01:00
truncate_sql ( $Q ){ return " TRUNCATE " . table ( $Q );} function
trigger_sql ( $Q ){ $Fh = table_status ( $Q ); $I = " " ; foreach ( triggers ( $Q ) as $xi => $wi ){ $yi = trigger ( $xi , $Fh [ 'Name' ]); $I .= " \n CREATE TRIGGER " . idf_escape ( $yi [ 'Trigger' ]) . " $yi[Timing] $yi[Events] ON " . idf_escape ( $Fh [ " nspname " ]) . " . " . idf_escape ( $Fh [ 'Name' ]) . " $yi[Type] $yi[Statement] ;; \n " ;} return $I ;} function
use_sql ( $k ){ return " \ connect " . idf_escape ( $k );} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ return $I ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
2018-12-25 21:50:48 +01:00
preg_match ( '~^(database|table|columns|sql|indexes|descidx|comment|view|' . ( min_version ( 9.3 ) ? 'materializedview|' : '' ) . 'scheme|routine|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~' , $Qc );} function
2018-04-01 23:34:54 +02:00
kill_process ( $X ){ return
queries ( " SELECT pg_terminate_backend( " . number ( $X ) . " ) " );} function
connection_id (){ return " SELECT pg_backend_pid() " ;} function
2018-12-25 21:50:48 +01:00
max_connections (){ global $h ; return $h -> result ( " SHOW max_connections " );} $y = " pgsql " ; $U = array (); $Ih = array (); foreach ( array ( lang ( 27 ) => array ( " smallint " => 5 , " integer " => 10 , " bigint " => 19 , " boolean " => 1 , " numeric " => 0 , " real " => 7 , " double precision " => 16 , " money " => 20 ), lang ( 28 ) => array ( " date " => 13 , " time " => 17 , " timestamp " => 20 , " timestamptz " => 21 , " interval " => 0 ), lang ( 25 ) => array ( " character " => 0 , " character varying " => 0 , " text " => 0 , " tsquery " => 0 , " tsvector " => 0 , " uuid " => 0 , " xml " => 0 ), lang ( 29 ) => array ( " bit " => 0 , " bit varying " => 0 , " bytea " => 0 ), lang ( 30 ) => array ( " cidr " => 43 , " inet " => 43 , " macaddr " => 17 , " txid_snapshot " => 0 ), lang ( 31 ) => array ( " box " => 0 , " circle " => 0 , " line " => 0 , " lseg " => 0 , " path " => 0 , " point " => 0 , " polygon " => 0 ),) as $z => $X ){ $U += $X ; $Ih [ $z ] = array_keys ( $X );} $Ji = array (); $wf = 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 " ])){ $ig = array ( " OCI8 " , " PDO_OCI " ); define ( " DRIVER " , " oracle " ); if ( extension_loaded ( " oci8 " )){ class
2018-04-01 23:34:54 +02:00
Min_DB { var $extension = " oci8 " , $_link , $_result , $server_info , $affected_rows , $errno , $error ; function
2018-12-25 21:50:48 +01:00
_error ( $yc , $o ){ if ( ini_bool ( " html_errors " )) $o = html_entity_decode ( strip_tags ( $o )); $o = preg_replace ( '~^[^:]*: ~' , '' , $o ); $this -> error = $o ;} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
true ;} $o = oci_error (); $this -> error = $o [ " message " ]; return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
select_db ( $k ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
query ( $G , $Di = false ){ $H = oci_parse ( $this -> _link , $G ); $this -> error = " " ; if ( ! $H ){ $o = oci_error ( $this -> _link ); $this -> errno = $o [ " code " ]; $this -> error = $o [ " message " ]; return
2018-06-30 00:38:01 +02:00
false ;} set_error_handler ( array ( $this , '_error' )); $I =@ oci_execute ( $H ); restore_error_handler (); if ( $I ){ if ( oci_num_fields ( $H )) return
2018-04-01 23:34:54 +02:00
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H ); $this -> affected_rows = oci_num_rows ( $H );} return $I ;} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 1 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H ) ||! oci_fetch ( $H -> _result )) return
2018-04-01 23:34:54 +02:00
false ; return
2018-12-25 21:50:48 +01:00
oci_result ( $H -> _result , $p );}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $_result , $_offset = 1 , $num_rows ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ;} function
_convert ( $J ){ foreach (( array ) $J
2018-12-25 21:50:48 +01:00
as $z => $X ){ if ( is_a ( $X , 'OCI-Lob' )) $J [ $z ] = $X -> load ();} return $J ;} function
2018-04-01 23:34:54 +02:00
fetch_assoc (){ return $this -> _convert ( oci_fetch_assoc ( $this -> _result ));} function
fetch_row (){ return $this -> _convert ( oci_fetch_row ( $this -> _result ));} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $e = $this -> _offset ++ ; $I = new
stdClass ; $I -> name = oci_field_name ( $this -> _result , $e ); $I -> orgname = $I -> name ; $I -> type = oci_field_type ( $this -> _result , $e ); $I -> charsetnr = ( preg_match ( " ~raw|blob|bfile~ " , $I -> type ) ? 63 : 0 ); return $I ;} function
2018-04-01 23:34:54 +02:00
__destruct (){ oci_free_statement ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_oci " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_OCI " ; function
2018-06-30 00:38:01 +02:00
connect ( $N , $V , $F ){ $this -> dsn ( " oci:dbname=// $N ;charset=AL32UTF8 " , $V , $F ); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ return
2018-04-01 23:34:54 +02:00
true ;}}} class
Min_Driver
extends
Min_SQL { function
begin (){ return
true ;}} function
2018-12-25 21:50:48 +01:00
idf_escape ( $v ){ return '"' . str_replace ( '"' , '""' , $v ) . '"' ;} function
table ( $v ){ return
idf_escape ( $v );} function
connect (){ global $b ; $h = new
Min_DB ; $Hb = $b -> credentials (); if ( $h -> connect ( $Hb [ 0 ], $Hb [ 1 ], $Hb [ 2 ])) return $h ; return $h -> error ;} function
2018-04-01 23:34:54 +02:00
get_databases (){ return
get_vals ( " SELECT tablespace_name FROM user_tablespaces " );} function
2018-12-25 21:50:48 +01:00
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return ( $D ? " * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $G $Z ) t WHERE rownum <= " . ( $_ + $D ) . " ) WHERE rnum > $D " : ( $_ !== null ? " * FROM (SELECT $G $Z ) WHERE rownum <= " . ( $_ + $D ) : " $G $Z " ));} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ return " $G $Z " ;} function
db_collation ( $m , $pb ){ global $h ; return $h -> result ( " SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET' " );} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-12-25 21:50:48 +01:00
logged_user (){ global $h ; return $h -> result ( " SELECT USER FROM DUAL " );} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-12-25 21:50:48 +01:00
table_status ( $C = " " ){ $I = array (); $dh = 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 = $dh " : " " ) . "
UNION SELECT view_name , 'view' , 0 , 0 FROM user_views " .( $C != " " ? " WHERE view_name = $dh " : " " ). "
2018-06-30 00:38:01 +02:00
ORDER BY 1 " )as $J ) { if( $C != " " )return $J ; $I[$J["Name"] ]= $J ;}return $I ;}function
2018-12-25 21:50:48 +01:00
is_view ( $R ){ return $R [ " Engine " ] == " view " ;} function
fk_support ( $R ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
fields ( $Q ){ $I = array (); foreach ( get_rows ( " SELECT * FROM all_tab_columns WHERE table_name = " . q ( $Q ) . " ORDER BY column_id " ) as $J ){ $T = $J [ " DATA_TYPE " ]; $ve = " $J[DATA_PRECISION] , $J[DATA_SCALE] " ; if ( $ve == " , " ) $ve = $J [ " DATA_LENGTH " ]; $I [ $J [ " COLUMN_NAME " ]] = array ( " field " => $J [ " COLUMN_NAME " ], " full_type " => $T . ( $ve ? " ( $ve ) " : " " ), " type " => strtolower ( $T ), " length " => $ve , " default " => $J [ " DATA_DEFAULT " ], " null " => ( $J [ " NULLABLE " ] == " Y " ), " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ),);} return $I ;} function
indexes ( $Q , $i = null ){ $I = array (); foreach ( get_rows ( " SELECT uic.*, uc.constraint_type
2018-04-01 23:34:54 +02:00
FROM user_ind_columns uic
LEFT JOIN user_constraints uc ON uic . index_name = uc . constraint_name AND uic . table_name = uc . table_name
2018-12-25 21:50:48 +01:00
WHERE uic . table_name = " .q( $Q ). "
ORDER BY uc . constraint_type , uic . column_position " , $i )as $J ) { $Jd = $J [ " INDEX_NAME " ]; $I [ $Jd ][ " type " ] = ( $J [ " CONSTRAINT_TYPE " ] == " P " ? " PRIMARY " : ( $J [ " CONSTRAINT_TYPE " ] == " U " ? " UNIQUE " : " INDEX " )); $I [ $Jd ][ " columns " ][] = $J [ " COLUMN_NAME " ]; $I [ $Jd ][ " lengths " ][] = ( $J [ " CHAR_LENGTH " ] && $J [ " CHAR_LENGTH " ] != $J [ " COLUMN_LENGTH " ] ? $J [ " CHAR_LENGTH " ] : null ); $I [ $Jd ][ " descs " ][] = ( $J [ " DESCEND " ] ? '1' : null ); } return $I ;}function
2018-06-30 00:38:01 +02:00
view ( $C ){ $K = get_rows ( 'SELECT text "select" FROM user_views WHERE view_name = ' . q ( $C )); return
reset ( $K );} function
2018-04-01 23:34:54 +02:00
collations (){ return
array ();} function
2018-12-25 21:50:48 +01:00
information_schema ( $m ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
error (){ global $h ; return
h ( $h -> error );} function
explain ( $h , $G ){ $h -> query ( " EXPLAIN PLAN FOR $G " ); return $h -> query ( " SELECT * FROM plan_table " );} function
found_rows ( $R , $Z ){} function
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ $c = $gc = array (); foreach ( $q
as $p ){ $X = $p [ 1 ]; if ( $X && $p [ 0 ] != " " && idf_escape ( $p [ 0 ]) != $X [ 0 ]) queries ( " ALTER TABLE " . table ( $Q ) . " RENAME COLUMN " . idf_escape ( $p [ 0 ]) . " TO $X[0] " ); if ( $X ) $c [] = ( $Q != " " ? ( $p [ 0 ] != " " ? " MODIFY ( " : " ADD ( " ) : " " ) . implode ( $X ) . ( $Q != " " ? " ) " : " " ); else $gc [] = idf_escape ( $p [ 0 ]);} if ( $Q == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); return ( ! $c || queries ( " ALTER TABLE " . table ( $Q ) . " \n " . implode ( " \n " , $c ))) && ( ! $gc || queries ( " ALTER TABLE " . table ( $Q ) . " DROP ( " . implode ( " , " , $gc ) . " ) " )) && ( $Q == $C || queries ( " ALTER TABLE " . table ( $Q ) . " RENAME TO " . table ( $C )));} function
foreign_keys ( $Q ){ $I = array (); $G = " SELECT c_list.CONSTRAINT_NAME as NAME,
2018-04-01 23:34:54 +02:00
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'
2018-12-25 21:50:48 +01:00
AND c_src . TABLE_NAME = " .q( $Q );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 ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
drop_views ( $aj ){ return
apply_queries ( " DROP VIEW " , $aj );} function
drop_tables ( $S ){ return
apply_queries ( " DROP TABLE " , $S );} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
get_schema (){ global $h ; return $h -> result ( " SELECT sys_context('USERENV', 'SESSION_USER') FROM dual " );} function
set_schema ( $ch ){ global $h ; return $h -> query ( " ALTER SESSION SET CURRENT_SCHEMA = " . idf_escape ( $ch ));} function
2018-04-01 23:34:54 +02:00
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
2018-06-30 00:38:01 +02:00
show_status (){ $K = get_rows ( 'SELECT * FROM v$instance' ); return
reset ( $K );} function
2018-12-25 21:50:48 +01:00
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ return $I ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
2018-12-25 21:50:48 +01:00
preg_match ( '~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view|view_trigger)$~' , $Qc );} $y = " oracle " ; $U = array (); $Ih = array (); foreach ( array ( lang ( 27 ) => array ( " number " => 38 , " binary_float " => 12 , " binary_double " => 21 ), lang ( 28 ) => array ( " date " => 10 , " timestamp " => 29 , " interval year " => 12 , " interval day " => 28 ), lang ( 25 ) => array ( " char " => 2000 , " varchar2 " => 4000 , " nchar " => 2000 , " nvarchar2 " => 4000 , " clob " => 4294967295 , " nclob " => 4294967295 ), lang ( 29 ) => array ( " raw " => 2000 , " long raw " => 2147483648 , " blob " => 4294967295 , " bfile " => 4294967296 ),) as $z => $X ){ $U += $X ; $Ih [ $z ] = array_keys ( $X );} $Ji = array (); $wf = 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 " ])){ $ig = array ( " SQLSRV " , " MSSQL " , " PDO_DBLIB " ); define ( " DRIVER " , " mssql " ); if ( extension_loaded ( " sqlsrv " )){ class
2018-04-01 23:34:54 +02:00
Min_DB { var $extension = " sqlsrv " , $_link , $_result , $server_info , $affected_rows , $errno , $error ; function
2018-12-25 21:50:48 +01:00
_get_error (){ $this -> error = " " ; foreach ( sqlsrv_errors () as $o ){ $this -> errno = $o [ " code " ]; $this -> error .= " $o[message] \n " ;} $this -> error = rtrim ( $this -> error );} function
connect ( $N , $V , $F ){ global $b ; $m = $b -> database (); $yb = array ( " UID " => $V , " PWD " => $F , " CharacterSet " => " UTF-8 " ); if ( $m != " " ) $yb [ " Database " ] = $m ; $this -> _link =@ sqlsrv_connect ( preg_replace ( '~:~' , ',' , $N ), $yb ); if ( $this -> _link ){ $Qd = sqlsrv_server_info ( $this -> _link ); $this -> server_info = $Qd [ 'SQLServerVersion' ];} else $this -> _get_error (); return ( bool ) $this -> _link ;} function
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
select_db ( $k ){ return $this -> query ( " USE " . idf_escape ( $k ));} function
query ( $G , $Di = false ){ $H = sqlsrv_query ( $this -> _link , $G ); $this -> error = " " ; if ( ! $H ){ $this -> _get_error (); return
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-06-30 00:38:01 +02:00
store_result ( $H = null ){ if ( ! $H ) $H = $this -> _result ; if ( ! $H ) return
false ; if ( sqlsrv_field_metadata ( $H )) return
2018-04-01 23:34:54 +02:00
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H ); $this -> affected_rows = sqlsrv_rows_affected ( $H ); return
2018-04-01 23:34:54 +02:00
true ;} function
next_result (){ return $this -> _result ? sqlsrv_next_result ( $this -> _result ) : null ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; $J = $H -> fetch_row (); return $J [ $p ];}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $_result , $_offset = 0 , $_fields , $num_rows ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ;} function
_convert ( $J ){ foreach (( array ) $J
2018-12-25 21:50:48 +01:00
as $z => $X ){ if ( is_a ( $X , 'DateTime' )) $J [ $z ] = $X -> format ( " Y-m-d H:i:s " );} return $J ;} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
fetch_field (){ if ( ! $this -> _fields ) $this -> _fields = sqlsrv_field_metadata ( $this -> _result ); $p = $this -> _fields [ $this -> _offset ++ ]; $I = new
stdClass ; $I -> name = $p [ " Name " ]; $I -> orgname = $p [ " Name " ]; $I -> type = ( $p [ " Type " ] == 1 ? 254 : 0 ); return $I ;} function
seek ( $D ){ for ( $t = 0 ; $t < $D ; $t ++ ) sqlsrv_fetch ( $this -> _result );} function
2018-04-01 23:34:54 +02:00
__destruct (){ sqlsrv_free_stmt ( $this -> _result );}}} elseif ( extension_loaded ( " mssql " )){ class
Min_DB { var $extension = " MSSQL " , $_link , $_result , $server_info , $affected_rows , $error ; function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
select_db ( $k ){ return
mssql_select_db ( $k );} function
query ( $G , $Di = false ){ $H =@ mssql_query ( $G , $this -> _link ); $this -> error = " " ; if ( ! $H ){ $this -> error = mssql_get_last_message (); return
2018-06-30 00:38:01 +02:00
false ;} if ( $H === true ){ $this -> affected_rows = mssql_rows_affected ( $this -> _link ); return
2018-04-01 23:34:54 +02:00
true ;} return
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
mssql_next_result ( $this -> _result -> _result );} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
2018-04-01 23:34:54 +02:00
false ; return
2018-12-25 21:50:48 +01:00
mssql_result ( $H -> _result , 0 , $p );}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $_result , $_offset = 0 , $_fields , $num_rows ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ; $this -> num_rows = mssql_num_rows ( $H );} function
2018-04-01 23:34:54 +02:00
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
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
__destruct (){ mssql_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_dblib " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_DBLIB " ; function
2018-06-30 00:38:01 +02:00
connect ( $N , $V , $F ){ $this -> dsn ( " dblib:charset=utf8;host= " . str_replace ( " : " , " ;unix_socket= " , preg_replace ( '~:(\d)~' , ';port=\1' , $N )), $V , $F ); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ return $this -> query ( " USE " . idf_escape ( $k ));}}} class
2018-04-01 23:34:54 +02:00
Min_Driver
extends
Min_SQL { function
2018-12-25 21:50:48 +01:00
insertUpdate ( $Q , $K , $lg ){ foreach ( $K
as $O ){ $Ki = array (); $Z = array (); foreach ( $O
as $z => $X ){ $Ki [] = " $z = $X " ; if ( isset ( $lg [ idf_unescape ( $z )])) $Z [] = " $z = $X " ;} if ( ! queries ( " MERGE " . table ( $Q ) . " USING (VALUES( " . implode ( " , " , $O ) . " )) AS source (c " . implode ( " , c " , range ( 1 , count ( $O ))) . " ) ON " . implode ( " AND " , $Z ) . " WHEN MATCHED THEN UPDATE SET " . implode ( " , " , $Ki ) . " WHEN NOT MATCHED THEN INSERT ( " . implode ( " , " , array_keys ( $O )) . " ) VALUES ( " . implode ( " , " , $O ) . " ); " )) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
begin (){ return
queries ( " BEGIN TRANSACTION " );}} function
2018-12-25 21:50:48 +01:00
idf_escape ( $v ){ return " [ " . str_replace ( " ] " , " ]] " , $v ) . " ] " ;} function
table ( $v ){ return ( $_GET [ " ns " ] != " " ? idf_escape ( $_GET [ " ns " ]) . " . " : " " ) . idf_escape ( $v );} function
connect (){ global $b ; $h = new
Min_DB ; $Hb = $b -> credentials (); if ( $h -> connect ( $Hb [ 0 ], $Hb [ 1 ], $Hb [ 2 ])) return $h ; return $h -> error ;} function
2018-04-01 23:34:54 +02:00
get_databases (){ return
get_vals ( " SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb') " );} function
2018-12-25 21:50:48 +01:00
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return ( $_ !== null ? " TOP ( " . ( $_ + $D ) . " ) " : " " ) . " $G $Z " ;} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ return
2018-06-30 00:38:01 +02:00
limit ( $G , $Z , 1 , 0 , $M );} function
2018-12-25 21:50:48 +01:00
db_collation ( $m , $pb ){ global $h ; return $h -> result ( " SELECT collation_name FROM sys.databases WHERE name = " . q ( $m ));} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-12-25 21:50:48 +01:00
logged_user (){ global $h ; return $h -> result ( " SELECT SUSER_NAME() " );} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ global $h ; $I = array (); foreach ( $l
as $m ){ $h -> select_db ( $m ); $I [ $m ] = $h -> result ( " SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " );} return $I ;} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
is_view ( $R ){ return $R [ " Engine " ] == " VIEW " ;} function
fk_support ( $R ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
fields ( $Q ){ $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]
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
WHERE o . schema_id = SCHEMA_ID ( " .q(get_schema()). " ) AND o . type IN ( 'S' , 'U' , 'V' ) AND o . name = " .q( $Q ))as $J ) { $T = $J [ " type " ]; $ve = ( preg_match ( " ~char|binary~ " , $T ) ? $J [ " max_length " ] : ( $T == " decimal " ? " $J[precision] , $J[scale] " : " " )); $I [ $J [ " name " ]] = array ( " field " => $J [ " name " ], " full_type " => $T . ( $ve ? " ( $ve ) " : " " ), " type " => $T , " length " => $ve , " default " => $J [ " default " ], " null " => $J [ " is_nullable " ], " auto_increment " => $J [ " is_identity " ], " collation " => $J [ " collation_name " ], " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ), " primary " => $J [ " is_identity " ],); } return $I ;}function
indexes ( $Q , $i = null ){ $I = array (); foreach ( get_rows ( " SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
WHERE OBJECT_NAME ( i . object_id ) = " .q( $Q ), $i )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 $h ; return
array ( " select " => preg_replace ( '~^(?:[^[]|\[[^]]*])*\s+AS\s+~isU' , '' , $h -> result ( " SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = " . q ( $C ))));} function
collations (){ $I = array (); foreach ( get_vals ( " SELECT name FROM fn_helpcollations() " ) as $d ) $I [ preg_replace ( '~_.*~' , '' , $d )][] = $d ; return $I ;} function
information_schema ( $m ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
error (){ global $h ; return
nl_br ( h ( preg_replace ( '~^(\[[^]]*])+~m' , '' , $h -> error )));} function
create_database ( $m , $d ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( preg_match ( '~^[a-z0-9_]+$~i' , $d ) ? " COLLATE $d " : " " ));} function
drop_databases ( $l ){ return
queries ( " DROP DATABASE " . implode ( " , " , array_map ( 'idf_escape' , $l )));} function
rename_database ( $C , $d ){ if ( preg_match ( '~^[a-z0-9_]+$~i' , $d )) queries ( " ALTER DATABASE " . idf_escape ( DB ) . " COLLATE $d " ); queries ( " ALTER DATABASE " . idf_escape ( DB ) . " MODIFY NAME = " . idf_escape ( $C )); return
2018-04-01 23:34:54 +02:00
true ;} function
auto_increment (){ return " IDENTITY " . ( $_POST [ " Auto_increment " ] != " " ? " ( " . number ( $_POST [ " Auto_increment " ]) . " ,1) " : " " ) . " PRIMARY KEY " ;} function
2018-12-25 21:50:48 +01:00
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ $c = array (); foreach ( $q
as $p ){ $e = idf_escape ( $p [ 0 ]); $X = $p [ 1 ]; if ( ! $X ) $c [ " DROP " ][] = " COLUMN $e " ; else { $X [ 1 ] = preg_replace ( " ~( COLLATE )'( \\ w+)'~ " , '\1\2' , $X [ 1 ]); if ( $p [ 0 ] == " " ) $c [ " ADD " ][] = " \n " . implode ( " " , $X ) . ( $Q == " " ? substr ( $dd [ $X [ 0 ]], 16 + strlen ( $X [ 0 ])) : " " ); else { unset ( $X [ 6 ]); if ( $e != $X [ 0 ]) queries ( " EXEC sp_rename " . q ( table ( $Q ) . " . $e " ) . " , " . q ( idf_unescape ( $X [ 0 ])) . " , 'COLUMN' " ); $c [ " ALTER COLUMN " . implode ( " " , $X )][] = " " ;}}} if ( $Q == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( " . implode ( " , " ,( array ) $c [ " ADD " ]) . " \n ) " ); if ( $Q != $C ) queries ( " EXEC sp_rename " . q ( table ( $Q )) . " , " . q ( $C )); if ( $dd ) $c [ " " ] = $dd ; foreach ( $c
as $z => $X ){ if ( ! queries ( " ALTER TABLE " . idf_escape ( $C ) . " $z " . implode ( " , " , $X ))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
alter_indexes ( $Q , $c ){ $w = array (); $gc = array (); foreach ( $c
as $X ){ if ( $X [ 2 ] == " DROP " ){ if ( $X [ 0 ] == " PRIMARY " ) $gc [] = idf_escape ( $X [ 1 ]); else $w [] = idf_escape ( $X [ 1 ]) . " ON " . table ( $Q );} elseif ( ! queries (( $X [ 0 ] != " PRIMARY " ? " CREATE $X[0] " . ( $X [ 0 ] != " INDEX " ? " INDEX " : " " ) . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $Q . " _ " )) . " ON " . table ( $Q ) : " ALTER TABLE " . table ( $Q ) . " ADD PRIMARY KEY " ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " )) return
false ;} return ( ! $w || queries ( " DROP INDEX " . implode ( " , " , $w ))) && ( ! $gc || queries ( " ALTER TABLE " . table ( $Q ) . " DROP " . implode ( " , " , $gc )));} function
last_id (){ global $h ; return $h -> result ( " SELECT SCOPE_IDENTITY() " );} function
explain ( $h , $G ){ $h -> query ( " SET SHOWPLAN_ALL ON " ); $I = $h -> query ( $G ); $h -> query ( " SET SHOWPLAN_ALL OFF " ); return $I ;} function
found_rows ( $R , $Z ){} function
foreign_keys ( $Q ){ $I = array (); foreach ( get_rows ( " EXEC sp_fkeys @fktable_name = " . q ( $Q )) as $J ){ $r =& $I [ $J [ " FK_NAME " ]]; $r [ " table " ] = $J [ " PKTABLE_NAME " ]; $r [ " source " ][] = $J [ " FKCOLUMN_NAME " ]; $r [ " target " ][] = $J [ " PKCOLUMN_NAME " ];} return $I ;} function
truncate_tables ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
drop_views ( $aj ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $aj )));} function
drop_tables ( $S ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $S )));} function
move_tables ( $S , $aj , $Yh ){ return
apply_queries ( " ALTER SCHEMA " . idf_escape ( $Yh ) . " TRANSFER " , array_merge ( $S , $aj ));} function
2018-06-30 00:38:01 +02:00
trigger ( $C ){ if ( $C == " " ) return
array (); $K = get_rows ( " SELECT s.name [Trigger],
2018-04-01 23:34:54 +02:00
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
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
triggers ( $Q ){ $I = array (); foreach ( get_rows ( " SELECT sys1.name,
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
WHERE sys1 . xtype = 'TR' AND sys2 . name = " .q( $Q ))as $J ) $I[$J["name"] ]=array( $J["Timing"] , $J["Event"] );return $I ;}function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
get_schema (){ global $h ; if ( $_GET [ " ns " ] != " " ) return $_GET [ " ns " ]; return $h -> result ( " SELECT SCHEMA_NAME() " );} function
set_schema ( $bh ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
use_sql ( $k ){ return " USE " . idf_escape ( $k );} function
2018-04-01 23:34:54 +02:00
show_variables (){ return
array ();} function
show_status (){ return
array ();} function
2018-12-25 21:50:48 +01:00
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ return $I ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
2018-12-25 21:50:48 +01:00
preg_match ( '~^(columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~' , $Qc );} $y = " mssql " ; $U = array (); $Ih = array (); foreach ( array ( lang ( 27 ) => array ( " tinyint " => 3 , " smallint " => 5 , " int " => 10 , " bigint " => 20 , " bit " => 1 , " decimal " => 0 , " real " => 12 , " float " => 53 , " smallmoney " => 10 , " money " => 20 ), lang ( 28 ) => array ( " date " => 10 , " smalldatetime " => 19 , " datetime " => 19 , " datetime2 " => 19 , " time " => 8 , " datetimeoffset " => 10 ), lang ( 25 ) => array ( " char " => 8000 , " varchar " => 8000 , " text " => 2147483647 , " nchar " => 4000 , " nvarchar " => 4000 , " ntext " => 1073741823 ), lang ( 29 ) => array ( " binary " => 8000 , " varbinary " => 8000 , " image " => 2147483647 ),) as $z => $X ){ $U += $X ; $Ih [ $z ] = array_keys ( $X );} $Ji = array (); $wf = 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 " ])){ $ig = array ( " interbase " ); define ( " DRIVER " , " firebird " ); if ( extension_loaded ( " interbase " )){ class
2018-04-01 23:34:54 +02:00
Min_DB { var $extension = " Firebird " , $server_info , $affected_rows , $errno , $error , $_link , $_result ; function
2018-12-25 21:50:48 +01:00
connect ( $N , $V , $F ){ $this -> _link = ibase_connect ( $N , $V , $F ); if ( $this -> _link ){ $Ni = explode ( ':' , $N ); $this -> service_link = ibase_service_attach ( $Ni [ 0 ], $V , $F ); $this -> server_info = ibase_server_info ( $this -> service_link , IBASE_SVC_SERVER_VERSION );} else { $this -> errno = ibase_errcode (); $this -> error = ibase_errmsg ();} return ( bool ) $this -> _link ;} function
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
select_db ( $k ){ return ( $k == " domain " );} function
query ( $G , $Di = false ){ $H = ibase_query ( $G , $this -> _link ); if ( ! $H ){ $this -> errno = ibase_errcode (); $this -> error = ibase_errmsg (); return
2018-06-30 00:38:01 +02:00
false ;} $this -> error = " " ; if ( $H === true ){ $this -> affected_rows = ibase_affected_rows ( $this -> _link ); return
2018-04-01 23:34:54 +02:00
true ;} return
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! $H ||! $H -> num_rows ) return
false ; $J = $H -> fetch_row (); return $J [ $p ];}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $num_rows , $_result , $_offset = 0 ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ;} function
2018-04-01 23:34:54 +02:00
fetch_assoc (){ return
ibase_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
ibase_fetch_row ( $this -> _result );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $p = ibase_field_info ( $this -> _result , $this -> _offset ++ ); return ( object ) array ( 'name' => $p [ 'name' ], 'orgname' => $p [ 'name' ], 'type' => $p [ 'type' ], 'charsetnr' => $p [ 'length' ],);} function
2018-04-01 23:34:54 +02:00
__destruct (){ ibase_free_result ( $this -> _result );}}} class
Min_Driver
extends
Min_SQL {} function
2018-12-25 21:50:48 +01:00
idf_escape ( $v ){ return '"' . str_replace ( '"' , '""' , $v ) . '"' ;} function
table ( $v ){ return
idf_escape ( $v );} function
connect (){ global $b ; $h = new
Min_DB ; $Hb = $b -> credentials (); if ( $h -> connect ( $Hb [ 0 ], $Hb [ 1 ], $Hb [ 2 ])) return $h ; return $h -> error ;} function
2018-06-30 00:38:01 +02:00
get_databases ( $bd ){ return
2018-04-01 23:34:54 +02:00
array ( " domain " );} function
2018-12-25 21:50:48 +01:00
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ $I = '' ; $I .= ( $_ !== null ? $M . " FIRST $_ " . ( $D ? " SKIP $D " : " " ) : " " ); $I .= " $G $Z " ; return $I ;} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ return
2018-06-30 00:38:01 +02:00
limit ( $G , $Z , 1 , 0 , $M );} function
2018-12-25 21:50:48 +01:00
db_collation ( $m , $pb ){} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-06-30 00:38:01 +02:00
logged_user (){ global $b ; $Hb = $b -> credentials (); return $Hb [ 1 ];} function
2018-12-25 21:50:48 +01:00
tables_list (){ global $h ; $G = 'SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0' ; $H = ibase_query ( $h -> _link , $G ); $I = array (); while ( $J = ibase_fetch_assoc ( $H )) $I [ $J [ 'RDB$RELATION_NAME' ]] = 'table' ; ksort ( $I ); return $I ;} function
count_tables ( $l ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-12-25 21:50:48 +01:00
table_status ( $C = " " , $Pc = false ){ global $h ; $I = array (); $Mb = tables_list (); foreach ( $Mb
as $w => $X ){ $w = trim ( $w ); $I [ $w ] = array ( 'Name' => $w , 'Engine' => 'standard' ,); if ( $C == $w ) return $I [ $w ];} return $I ;} function
is_view ( $R ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
fk_support ( $R ){ return
preg_match ( '~InnoDB|IBMDB2I~i' , $R [ " Engine " ]);} function
fields ( $Q ){ global $h ; $I = array (); $G = ' SELECT r . RDB $FIELD_NAME AS field_name ,
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
WHERE r . RDB $RELATION_NAME = '.q($Q).'
ORDER BY r . RDB $FIELD_POSITION ';$H=ibase_query($h->_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 ( $Q , $i = null ){ $I = array (); return $I ;} function
foreign_keys ( $Q ){ return
2018-04-01 23:34:54 +02:00
array ();} function
collations (){ return
array ();} function
2018-12-25 21:50:48 +01:00
information_schema ( $m ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
error (){ global $h ; return
h ( $h -> error );} function
2018-04-01 23:34:54 +02:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2018-12-25 21:50:48 +01:00
set_schema ( $bh ){ return
2018-04-01 23:34:54 +02:00
true ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
2018-12-25 21:50:48 +01:00
preg_match ( " ~^(columns|sql|status|table) $ ~ " , $Qc );} $y = " firebird " ; $wf = array ( " = " ); $ld = array (); $rd = array (); $nc = array ();} $fc [ " simpledb " ] = " SimpleDB " ; if ( isset ( $_GET [ " simpledb " ])){ $ig = array ( " SimpleXML + allow_url_fopen " ); define ( " DRIVER " , " simpledb " ); if ( class_exists ( 'SimpleXMLElement' ) && ini_bool ( 'allow_url_fopen' )){ class
2018-04-01 23:34:54 +02:00
Min_DB { var $extension = " SimpleXML " , $server_info = '2009-04-15' , $error , $timeout , $next , $affected_rows , $_result ; function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ return ( $k == " domain " );} function
query ( $G , $Di = false ){ $Pf = array ( 'SelectExpression' => $G , 'ConsistentRead' => 'true' ); if ( $this -> next ) $Pf [ 'NextToken' ] = $this -> next ; $H = sdb_request_all ( 'Select' , 'Item' , $Pf , $this -> timeout ); $this -> timeout = 0 ; if ( $H === false ) return $H ; if ( preg_match ( '~^\s*SELECT\s+COUNT\(~i' , $G )){ $Mh = 0 ; foreach ( $H
as $ce ) $Mh += $ce -> Attribute -> Value ; $H = array (( object ) array ( 'Attribute' => array (( object ) array ( 'Name' => 'Count' , 'Value' => $Mh ,))));} return
2018-04-01 23:34:54 +02:00
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2018-04-01 23:34:54 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ foreach ( $H
2018-12-25 21:50:48 +01:00
as $ce ){ $J = array (); if ( $ce -> Name != '' ) $J [ 'itemName()' ] = ( string ) $ce -> Name ; foreach ( $ce -> Attribute
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
as $z => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $z ])) $this -> _rows [ 0 ][ $z ] = null ;}} $this -> num_rows = count ( $this -> _rows );} function
2018-06-30 00:38:01 +02:00
_processValue ( $qc ){ return ( is_object ( $qc ) && $qc [ 'encoding' ] == 'base64' ? base64_decode ( $qc ) : ( string ) $qc );} function
2018-12-25 21:50:48 +01:00
fetch_assoc (){ $J = current ( $this -> _rows ); if ( ! $J ) return $J ; $I = array (); foreach ( $this -> _rows [ 0 ] as $z => $X ) $I [ $z ] = $J [ $z ]; next ( $this -> _rows ); return $I ;} function
2018-06-30 00:38:01 +02:00
fetch_row (){ $I = $this -> fetch_assoc (); if ( ! $I ) return $I ; return
array_values ( $I );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $ie = array_keys ( $this -> _rows [ 0 ]); return ( object ) array ( 'name' => $ie [ $this -> _offset ++ ]);}}} class
2018-04-01 23:34:54 +02:00
Min_Driver
extends
2018-12-25 21:50:48 +01:00
Min_SQL { public $lg = " itemName() " ; function
_chunkRequest ( $Fd , $wa , $Pf , $Fc = array ()){ global $h ; foreach ( array_chunk ( $Fd , 25 ) as $ib ){ $Qf = $Pf ; foreach ( $ib
as $t => $u ){ $Qf [ " Item. $t .ItemName " ] = $u ; foreach ( $Fc
as $z => $X ) $Qf [ " Item. $t . $z " ] = $X ;} if ( ! sdb_request ( $wa , $Qf )) return
false ;} $h -> affected_rows = count ( $Fd ); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
_extractIds ( $Q , $xg , $_ ){ $I = array (); if ( preg_match_all ( " ~itemName \ ( \ ) = (('[^']*+')+)~ " , $xg , $Fe )) $I = array_map ( 'idf_unescape' , $Fe [ 1 ]); else { foreach ( sdb_request_all ( 'Select' , 'Item' , array ( 'SelectExpression' => 'SELECT itemName() FROM ' . table ( $Q ) . $xg . ( $_ ? " LIMIT 1 " : " " ))) as $ce ) $I [] = $ce -> Name ;} return $I ;} function
select ( $Q , $L , $Z , $od , $Af = array (), $_ = 1 , $E = 0 , $ng = false ){ global $h ; $h -> next = $_GET [ " next " ]; $I = parent :: select ( $Q , $L , $Z , $od , $Af , $_ , $E , $ng ); $h -> next = 0 ; return $I ;} function
delete ( $Q , $xg , $_ = 0 ){ return $this -> _chunkRequest ( $this -> _extractIds ( $Q , $xg , $_ ), 'BatchDeleteAttributes' , array ( 'DomainName' => $Q ));} function
update ( $Q , $O , $xg , $_ = 0 , $M = " \n " ){ $Vb = array (); $Ud = array (); $t = 0 ; $Fd = $this -> _extractIds ( $Q , $xg , $_ ); $u = idf_unescape ( $O [ " `itemName()` " ]); unset ( $O [ " `itemName()` " ]); foreach ( $O
as $z => $X ){ $z = idf_unescape ( $z ); if ( $X == " NULL " || ( $u != " " && array ( $u ) != $Fd )) $Vb [ " Attribute. " . count ( $Vb ) . " .Name " ] = $z ; if ( $X != " NULL " ){ foreach (( array ) $X
as $ee => $W ){ $Ud [ " Attribute. $t .Name " ] = $z ; $Ud [ " Attribute. $t .Value " ] = ( is_array ( $X ) ? $W : idf_unescape ( $W )); if ( ! $ee ) $Ud [ " Attribute. $t .Replace " ] = " true " ; $t ++ ;}}} $Pf = array ( 'DomainName' => $Q ); return ( ! $Ud || $this -> _chunkRequest (( $u != " " ? array ( $u ) : $Fd ), 'BatchPutAttributes' , $Pf , $Ud )) && ( ! $Vb || $this -> _chunkRequest ( $Fd , 'BatchDeleteAttributes' , $Pf , $Vb ));} function
insert ( $Q , $O ){ $Pf = array ( " DomainName " => $Q ); $t = 0 ; foreach ( $O
as $C => $Y ){ if ( $Y != " NULL " ){ $C = idf_unescape ( $C ); if ( $C == " itemName() " ) $Pf [ " ItemName " ] = idf_unescape ( $Y ); else { foreach (( array ) $Y
as $X ){ $Pf [ " Attribute. $t .Name " ] = $C ; $Pf [ " Attribute. $t .Value " ] = ( is_array ( $Y ) ? $X : idf_unescape ( $Y )); $t ++ ;}}}} return
sdb_request ( 'PutAttributes' , $Pf );} function
insertUpdate ( $Q , $K , $lg ){ foreach ( $K
as $O ){ if ( ! $this -> update ( $Q , $O , " WHERE `itemName()` = " . q ( $O [ " `itemName()` " ]))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
begin (){ return
false ;} function
commit (){ return
false ;} function
rollback (){ return
2018-06-30 00:38:01 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
slowQuery ( $G , $gi ){ $this -> _conn -> timeout = $gi ; return $G ;}} function
2018-06-30 00:38:01 +02:00
connect (){ global $b ; list (,, $F ) = $b -> credentials (); if ( $F != " " ) return
lang ( 22 ); return
2018-04-01 23:34:54 +02:00
new
Min_DB ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
preg_match ( '~sql~' , $Qc );} function
logged_user (){ global $b ; $Hb = $b -> credentials (); return $Hb [ 1 ];} function
2018-04-01 23:34:54 +02:00
get_databases (){ return
array ( " domain " );} function
collations (){ return
array ();} function
2018-12-25 21:50:48 +01:00
db_collation ( $m , $pb ){} function
tables_list (){ global $h ; $I = array (); foreach ( sdb_request_all ( 'ListDomains' , 'DomainName' ) as $Q ) $I [( string ) $Q ] = 'table' ; if ( $h -> error && defined ( " PAGE_HEADER " )) echo " <p class='error'> " . error () . " \n " ; return $I ;} function
table_status ( $C = " " , $Pc = false ){ $I = array (); foreach (( $C != " " ? array ( $C => true ) : tables_list ()) as $Q => $T ){ $J = array ( " Name " => $Q , " Auto_increment " => " " ); if ( ! $Pc ){ $Se = sdb_request ( 'DomainMetadata' , array ( 'DomainName' => $Q )); if ( $Se ){ foreach ( array ( " Rows " => " ItemCount " , " Data_length " => " ItemNamesSizeBytes " , " Index_length " => " AttributeValuesSizeBytes " , " Data_free " => " AttributeNamesSizeBytes " ,) as $z => $X ) $J [ $z ] = ( string ) $Se -> $X ;}} if ( $C != " " ) return $J ; $I [ $Q ] = $J ;} return $I ;} function
explain ( $h , $G ){} function
error (){ global $h ; return
h ( $h -> error );} function
2018-04-01 23:34:54 +02:00
information_schema (){} function
2018-12-25 21:50:48 +01:00
is_view ( $R ){} function
indexes ( $Q , $i = null ){ return
2018-04-01 23:34:54 +02:00
array ( array ( " type " => " PRIMARY " , " columns " => array ( " itemName() " )),);} function
2018-12-25 21:50:48 +01:00
fields ( $Q ){ return
2018-04-01 23:34:54 +02:00
fields_from_edit ();} function
2018-12-25 21:50:48 +01:00
foreign_keys ( $Q ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-12-25 21:50:48 +01:00
table ( $v ){ return
idf_escape ( $v );} function
idf_escape ( $v ){ return " ` " . str_replace ( " ` " , " `` " , $v ) . " ` " ;} function
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return " $G $Z " . ( $_ !== null ? $M . " LIMIT $_ " : " " );} function
unconvert_field ( $p , $I ){ return $I ;} function
fk_support ( $R ){} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-12-25 21:50:48 +01:00
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ return ( $Q == " " && sdb_request ( 'CreateDomain' , array ( 'DomainName' => $C )));} function
drop_tables ( $S ){ foreach ( $S
as $Q ){ if ( ! sdb_request ( 'DeleteDomain' , array ( 'DomainName' => $Q ))) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ foreach ( $l
as $m ) return
array ( $m => count ( tables_list ()));} function
found_rows ( $R , $Z ){ return ( $Z ? null : $R [ " Rows " ]);} function
2018-04-01 23:34:54 +02:00
last_id (){} function
2018-12-25 21:50:48 +01:00
hmac ( $Ca , $Mb , $z , $Ag = false ){ $Va = 64 ; if ( strlen ( $z ) > $Va ) $z = pack ( " H* " , $Ca ( $z )); $z = str_pad ( $z , $Va , " \0 " ); $fe = $z ^ str_repeat ( " \x36 " , $Va ); $ge = $z ^ str_repeat ( " \x5C " , $Va ); $I = $Ca ( $ge . pack ( " H* " , $Ca ( $fe . $Mb ))); if ( $Ag ) $I = pack ( " H* " , $I ); return $I ;} function
sdb_request ( $wa , $Pf = array ()){ global $b , $h ; list ( $Bd , $Pf [ 'AWSAccessKeyId' ], $eh ) = $b -> credentials (); $Pf [ 'Action' ] = $wa ; $Pf [ 'Timestamp' ] = gmdate ( 'Y-m-d\TH:i:s+00:00' ); $Pf [ 'Version' ] = '2009-04-15' ; $Pf [ 'SignatureVersion' ] = 2 ; $Pf [ 'SignatureMethod' ] = 'HmacSHA1' ; ksort ( $Pf ); $G = '' ; foreach ( $Pf
as $z => $X ) $G .= '&' . rawurlencode ( $z ) . '=' . rawurlencode ( $X ); $G = str_replace ( '%7E' , '~' , substr ( $G , 1 )); $G .= " &Signature= " . urlencode ( base64_encode ( hmac ( 'sha1' , " POST \n " . preg_replace ( '~^https?://~' , '' , $Bd ) . " \n / \n $G " , $eh , true ))); @ ini_set ( 'track_errors' , 1 ); $Uc =@ file_get_contents (( preg_match ( '~^https?://~' , $Bd ) ? $Bd : " http:// $Bd " ), false , stream_context_create ( array ( 'http' => array ( 'method' => 'POST' , 'content' => $G , 'ignore_errors' => 1 ,)))); if ( ! $Uc ){ $h -> error = $php_errormsg ; return
false ;} libxml_use_internal_errors ( true ); $nj = simplexml_load_string ( $Uc ); if ( ! $nj ){ $o = libxml_get_last_error (); $h -> error = $o -> message ; return
false ;} if ( $nj -> Errors ){ $o = $nj -> Errors -> Error ; $h -> error = " $o->Message ( $o->Code ) " ; return
false ;} $h -> error = '' ; $Xh = $wa . " Result " ; return ( $nj -> $Xh ? $nj -> $Xh : true );} function
sdb_request_all ( $wa , $Xh , $Pf = array (), $gi = 0 ){ $I = array (); $Dh = ( $gi ? microtime ( true ) : 0 ); $_ = ( preg_match ( '~LIMIT\s+(\d+)\s*$~i' , $Pf [ 'SelectExpression' ], $B ) ? $B [ 1 ] : 0 ); do { $nj = sdb_request ( $wa , $Pf ); if ( ! $nj ) break ; foreach ( $nj -> $Xh
as $qc ) $I [] = $qc ; if ( $_ && count ( $I ) >= $_ ){ $_GET [ " next " ] = $nj -> NextToken ; break ;} if ( $gi && microtime ( true ) - $Dh > $gi ) return
false ; $Pf [ 'NextToken' ] = $nj -> NextToken ; if ( $_ ) $Pf [ 'SelectExpression' ] = preg_replace ( '~\d+\s*$~' , $_ - count ( $I ), $Pf [ 'SelectExpression' ]);} while ( $nj -> NextToken ); return $I ;} $y = " simpledb " ; $wf = 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 " ])){ $ig = array ( " mongo " , " mongodb " ); define ( " DRIVER " , " mongo " ); if ( class_exists ( 'MongoDB' )){ class
2018-06-30 00:38:01 +02:00
Min_DB { var $extension = " Mongo " , $server_info = MongoClient :: VERSION , $error , $last_id , $_link , $_db ; function
2018-12-25 21:50:48 +01:00
connect ( $Li , $zf ){ return @ new
MongoClient ( $Li , $zf );} function
2018-06-30 00:38:01 +02:00
query ( $G ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ try { $this -> _db = $this -> _link -> selectDB ( $k ); return
2018-06-30 00:38:01 +02:00
true ;} catch ( Exception $Bc ){ $this -> error = $Bc -> getMessage (); return
2018-04-01 23:34:54 +02:00
false ;}} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return $P ;}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 , $_charset = array (); function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ foreach ( $H
2018-12-25 21:50:48 +01:00
as $ce ){ $J = array (); foreach ( $ce
as $z => $X ){ if ( is_a ( $X , 'MongoBinData' )) $this -> _charset [ $z ] = 63 ; $J [ $z ] = ( is_a ( $X , 'MongoId' ) ? 'ObjectId("' . strval ( $X ) . '")' : ( is_a ( $X , 'MongoDate' ) ? gmdate ( " Y-m-d H:i:s " , $X -> sec ) . " GMT " : ( is_a ( $X , 'MongoBinData' ) ? $X -> bin : ( is_a ( $X , 'MongoRegex' ) ? strval ( $X ) : ( is_object ( $X ) ? get_class ( $X ) : $X )))));} $this -> _rows [] = $J ; foreach ( $J
as $z => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $z ])) $this -> _rows [ 0 ][ $z ] = 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 $z => $X ) $I [ $z ] = $J [ $z ]; next ( $this -> _rows ); return $I ;} function
2018-06-30 00:38:01 +02:00
fetch_row (){ $I = $this -> fetch_assoc (); if ( ! $I ) return $I ; return
array_values ( $I );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $ie = array_keys ( $this -> _rows [ 0 ]); $C = $ie [ $this -> _offset ++ ]; return ( object ) array ( 'name' => $C , 'charsetnr' => $this -> _charset [ $C ],);}} class
2018-04-01 23:34:54 +02:00
Min_Driver
extends
2018-12-25 21:50:48 +01:00
Min_SQL { public $lg = " _id " ; function
select ( $Q , $L , $Z , $od , $Af = array (), $_ = 1 , $E = 0 , $ng = false ){ $L = ( $L == array ( " * " ) ? array () : array_fill_keys ( $L , true )); $vh = array (); foreach ( $Af
as $X ){ $X = preg_replace ( '~ DESC$~' , '' , $X , 1 , $Eb ); $vh [ $X ] = ( $Eb ? - 1 : 1 );} return
2018-04-01 23:34:54 +02:00
new
2018-12-25 21:50:48 +01:00
Min_Result ( $this -> _conn -> _db -> selectCollection ( $Q ) -> find ( array (), $L ) -> sort ( $vh ) -> limit ( $_ != " " ? + $_ : 0 ) -> skip ( $E * $_ ));} function
insert ( $Q , $O ){ try { $I = $this -> _conn -> _db -> selectCollection ( $Q ) -> insert ( $O ); $this -> _conn -> errno = $I [ 'code' ]; $this -> _conn -> error = $I [ 'err' ]; $this -> _conn -> last_id = $O [ '_id' ]; return ! $I [ 'err' ];} catch ( Exception $Bc ){ $this -> _conn -> error = $Bc -> getMessage (); return
2018-04-01 23:34:54 +02:00
false ;}}} function
2018-12-25 21:50:48 +01:00
get_databases ( $bd ){ global $h ; $I = array (); $Rb = $h -> _link -> listDBs (); foreach ( $Rb [ 'databases' ] as $m ) $I [] = $m [ 'name' ]; return $I ;} function
count_tables ( $l ){ global $h ; $I = array (); foreach ( $l
as $m ) $I [ $m ] = count ( $h -> _link -> selectDB ( $m ) -> getCollectionNames ( true )); return $I ;} function
tables_list (){ global $h ; return
array_fill_keys ( $h -> _db -> getCollectionNames ( true ), 'table' );} function
drop_databases ( $l ){ global $h ; foreach ( $l
as $m ){ $Ng = $h -> _link -> selectDB ( $m ) -> drop (); if ( ! $Ng [ 'ok' ]) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
indexes ( $Q , $i = null ){ global $h ; $I = array (); foreach ( $h -> _db -> selectCollection ( $Q ) -> getIndexInfo () as $w ){ $Yb = array (); foreach ( $w [ " key " ] as $e => $T ) $Yb [] = ( $T ==- 1 ? '1' : null ); $I [ $w [ " name " ]] = array ( " type " => ( $w [ " name " ] == " _id_ " ? " PRIMARY " : ( $w [ " unique " ] ? " UNIQUE " : " INDEX " )), " columns " => array_keys ( $w [ " key " ]), " lengths " => array (), " descs " => $Yb ,);} return $I ;} function
fields ( $Q ){ return
2018-04-01 23:34:54 +02:00
fields_from_edit ();} function
2018-12-25 21:50:48 +01:00
found_rows ( $R , $Z ){ global $h ; return $h -> _db -> selectCollection ( $_GET [ " select " ]) -> count ( $Z );} $wf = array ( " = " );} elseif ( class_exists ( 'MongoDB\Driver\Manager' )){ class
2018-06-30 00:38:01 +02:00
Min_DB { var $extension = " MongoDB " , $server_info = MONGODB_VERSION , $error , $last_id ; var $_link ; var $_db , $_db_name ; function
2018-12-25 21:50:48 +01:00
connect ( $Li , $zf ){ $kb = 'MongoDB\Driver\Manager' ; return
new $kb ( $Li , $zf );} function
2018-06-30 00:38:01 +02:00
query ( $G ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ $this -> _db_name = $k ; return
2018-06-30 00:38:01 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return $P ;}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 , $_charset = array (); function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ foreach ( $H
2018-12-25 21:50:48 +01:00
as $ce ){ $J = array (); foreach ( $ce
as $z => $X ){ if ( is_a ( $X , 'MongoDB\BSON\Binary' )) $this -> _charset [ $z ] = 63 ; $J [ $z ] = ( is_a ( $X , 'MongoDB\BSON\ObjectID' ) ? 'MongoDB\BSON\ObjectID("' . strval ( $X ) . '")' : ( is_a ( $X , 'MongoDB\BSON\UTCDatetime' ) ? $X -> toDateTime () -> format ( 'Y-m-d H:i:s' ) : ( is_a ( $X , 'MongoDB\BSON\Binary' ) ? $X -> bin : ( is_a ( $X , 'MongoDB\BSON\Regex' ) ? strval ( $X ) : ( is_object ( $X ) ? json_encode ( $X , 256 ) : $X )))));} $this -> _rows [] = $J ; foreach ( $J
as $z => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $z ])) $this -> _rows [ 0 ][ $z ] = null ;}} $this -> num_rows = $H -> count ;} function
fetch_assoc (){ $J = current ( $this -> _rows ); if ( ! $J ) return $J ; $I = array (); foreach ( $this -> _rows [ 0 ] as $z => $X ) $I [ $z ] = $J [ $z ]; next ( $this -> _rows ); return $I ;} function
2018-06-30 00:38:01 +02:00
fetch_row (){ $I = $this -> fetch_assoc (); if ( ! $I ) return $I ; return
array_values ( $I );} function
2018-12-25 21:50:48 +01:00
fetch_field (){ $ie = array_keys ( $this -> _rows [ 0 ]); $C = $ie [ $this -> _offset ++ ]; return ( object ) array ( 'name' => $C , 'charsetnr' => $this -> _charset [ $C ],);}} class
2018-04-01 23:34:54 +02:00
Min_Driver
extends
2018-12-25 21:50:48 +01:00
Min_SQL { public $lg = " _id " ; function
select ( $Q , $L , $Z , $od , $Af = array (), $_ = 1 , $E = 0 , $ng = false ){ global $h ; $L = ( $L == array ( " * " ) ? array () : array_fill_keys ( $L , 1 )); if ( count ( $L ) &&! isset ( $L [ '_id' ])) $L [ '_id' ] = 0 ; $Z = where_to_query ( $Z ); $vh = array (); foreach ( $Af
as $X ){ $X = preg_replace ( '~ DESC$~' , '' , $X , 1 , $Eb ); $vh [ $X ] = ( $Eb ? - 1 : 1 );} if ( isset ( $_GET [ 'limit' ]) && is_numeric ( $_GET [ 'limit' ]) && $_GET [ 'limit' ] > 0 ) $_ = $_GET [ 'limit' ]; $_ = min ( 200 , max ( 1 ,( int ) $_ )); $sh = $E * $_ ; $kb = 'MongoDB\Driver\Query' ; $G = new $kb ( $Z , array ( 'projection' => $L , 'limit' => $_ , 'skip' => $sh , 'sort' => $vh )); $Qg = $h -> _link -> executeQuery ( " $h->_db_name . $Q " , $G ); return
2018-04-01 23:34:54 +02:00
new
2018-12-25 21:50:48 +01:00
Min_Result ( $Qg );} function
update ( $Q , $O , $xg , $_ = 0 , $M = " \n " ){ global $h ; $m = $h -> _db_name ; $Z = sql_query_where_parser ( $xg ); $kb = 'MongoDB\Driver\BulkWrite' ; $Za = new $kb ( array ()); if ( isset ( $O [ '_id' ])) unset ( $O [ '_id' ]); $Kg = array (); foreach ( $O
as $z => $Y ){ if ( $Y == 'NULL' ){ $Kg [ $z ] = 1 ; unset ( $O [ $z ]);}} $Ki = array ( '$set' => $O ); if ( count ( $Kg )) $Ki [ '$unset' ] = $Kg ; $Za -> update ( $Z , $Ki , array ( 'upsert' => false )); $Qg = $h -> _link -> executeBulkWrite ( " $m . $Q " , $Za ); $h -> affected_rows = $Qg -> getModifiedCount (); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
delete ( $Q , $xg , $_ = 0 ){ global $h ; $m = $h -> _db_name ; $Z = sql_query_where_parser ( $xg ); $kb = 'MongoDB\Driver\BulkWrite' ; $Za = new $kb ( array ()); $Za -> delete ( $Z , array ( 'limit' => $_ )); $Qg = $h -> _link -> executeBulkWrite ( " $m . $Q " , $Za ); $h -> affected_rows = $Qg -> getDeletedCount (); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
insert ( $Q , $O ){ global $h ; $m = $h -> _db_name ; $kb = 'MongoDB\Driver\BulkWrite' ; $Za = new $kb ( array ()); if ( isset ( $O [ '_id' ]) && empty ( $O [ '_id' ])) unset ( $O [ '_id' ]); $Za -> insert ( $O ); $Qg = $h -> _link -> executeBulkWrite ( " $m . $Q " , $Za ); $h -> affected_rows = $Qg -> getInsertedCount (); return
2018-04-01 23:34:54 +02:00
true ;}} function
2018-12-25 21:50:48 +01:00
get_databases ( $bd ){ global $h ; $I = array (); $kb = 'MongoDB\Driver\Command' ; $sb = new $kb ( array ( 'listDatabases' => 1 )); $Qg = $h -> _link -> executeCommand ( 'admin' , $sb ); foreach ( $Qg
2018-06-30 00:38:01 +02:00
as $Rb ){ foreach ( $Rb -> databases
2018-12-25 21:50:48 +01:00
as $m ) $I [] = $m -> name ;} return $I ;} function
count_tables ( $l ){ $I = array (); return $I ;} function
tables_list (){ global $h ; $kb = 'MongoDB\Driver\Command' ; $sb = new $kb ( array ( 'listCollections' => 1 )); $Qg = $h -> _link -> executeCommand ( $h -> _db_name , $sb ); $qb = array (); foreach ( $Qg
as $H ) $qb [ $H -> name ] = 'table' ; return $qb ;} function
drop_databases ( $l ){ return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
indexes ( $Q , $i = null ){ global $h ; $I = array (); $kb = 'MongoDB\Driver\Command' ; $sb = new $kb ( array ( 'listIndexes' => $Q )); $Qg = $h -> _link -> executeCommand ( $h -> _db_name , $sb ); foreach ( $Qg
as $w ){ $Yb = array (); $f = array (); foreach ( get_object_vars ( $w -> key ) as $e => $T ){ $Yb [] = ( $T ==- 1 ? '1' : null ); $f [] = $e ;} $I [ $w -> name ] = array ( " type " => ( $w -> name == " _id_ " ? " PRIMARY " : ( isset ( $w -> unique ) ? " UNIQUE " : " INDEX " )), " columns " => $f , " lengths " => array (), " descs " => $Yb ,);} return $I ;} function
fields ( $Q ){ $q = fields_from_edit (); if ( ! count ( $q )){ global $n ; $H = $n -> select ( $Q , array ( " * " ), null , null , array (), 10 ); while ( $J = $H -> fetch_assoc ()){ foreach ( $J
as $z => $X ){ $J [ $z ] = null ; $q [ $z ] = array ( " field " => $z , " type " => " string " , " null " => ( $z != $n -> primary ), " auto_increment " => ( $z == $n -> primary ), " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ,),);}}} return $q ;} function
found_rows ( $R , $Z ){ global $h ; $Z = where_to_query ( $Z ); $kb = 'MongoDB\Driver\Command' ; $sb = new $kb ( array ( 'count' => $R [ 'Name' ], 'query' => $Z )); $Qg = $h -> _link -> executeCommand ( $h -> _db_name , $sb ); $oi = $Qg -> toArray (); return $oi [ 0 ] -> n ;} function
sql_query_where_parser ( $xg ){ $xg = trim ( preg_replace ( '/WHERE[\s]?[(]?\(?/' , '' , $xg )); $xg = preg_replace ( '/\)\)\)$/' , ')' , $xg ); $kj = explode ( ' AND ' , $xg ); $lj = explode ( ') OR (' , $xg ); $Z = array (); foreach ( $kj
as $ij ) $Z [] = trim ( $ij ); if ( count ( $lj ) == 1 ) $lj = array (); elseif ( count ( $lj ) > 1 ) $Z = array (); return
where_to_query ( $Z , $lj );} function
where_to_query ( $gj = array (), $hj = array ()){ global $b ; $Mb = array (); foreach ( array ( 'and' => $gj , 'or' => $hj ) as $T => $Z ){ if ( is_array ( $Z )){ foreach ( $Z
as $Ic ){ list ( $nb , $uf , $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 ( $uf , $b -> operators )) continue ; if ( preg_match ( '~^\(f\)(.+)~' , $uf , $B )){ $X = ( float ) $X ; $uf = $B [ 1 ];} elseif ( preg_match ( '~^\(date\)(.+)~' , $uf , $B )){ $Ob = new
DateTime ( $X ); $kb = 'MongoDB\BSON\UTCDatetime' ; $X = new $kb ( $Ob -> getTimestamp () * 1000 ); $uf = $B [ 1 ];} switch ( $uf ){ case '=' : $uf = '$eq' ; break ; case '!=' : $uf = '$ne' ; break ; case '>' : $uf = '$gt' ; break ; case '<' : $uf = '$lt' ; break ; case '>=' : $uf = '$gte' ; break ; case '<=' : $uf = '$lte' ; break ; case 'regex' : $uf = '$regex' ; break ; default : continue ;} if ( $T == 'and' ) $Mb [ '$and' ][] = array ( $nb => array ( $uf => $X )); elseif ( $T == 'or' ) $Mb [ '$or' ][] = array ( $nb => array ( $uf => $X ));}}} return $Mb ;} $wf = array ( " = " , " != " , " > " , " < " , " >= " , " <= " , " regex " , " (f)= " , " (f)!= " , " (f)> " , " (f)< " , " (f)>= " , " (f)<= " , " (date)= " , " (date)!= " , " (date)> " , " (date)< " , " (date)>= " , " (date)<= " ,);} function
table ( $v ){ return $v ;} function
idf_escape ( $v ){ return $v ;} function
table_status ( $C = " " , $Pc = false ){ $I = array (); foreach ( tables_list () as $Q => $T ){ $I [ $Q ] = array ( " Name " => $Q ); if ( $C == $Q ) return $I [ $Q ];} return $I ;} function
create_database ( $m , $d ){ return
2018-06-30 00:38:01 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
last_id (){ global $h ; return $h -> last_id ;} function
error (){ global $h ; return
h ( $h -> error );} function
2018-04-01 23:34:54 +02:00
collations (){ return
array ();} function
2018-06-30 00:38:01 +02:00
logged_user (){ global $b ; $Hb = $b -> credentials (); return $Hb [ 1 ];} function
2018-12-25 21:50:48 +01:00
connect (){ global $b ; $h = new
Min_DB ; list ( $N , $V , $F ) = $b -> credentials (); $zf = array (); if ( $V . $F != " " ){ $zf [ " username " ] = $V ; $zf [ " password " ] = $F ;} $m = $b -> database (); if ( $m != " " ) $zf [ " db " ] = $m ; try { $h -> _link = $h -> connect ( " mongodb:// $N " , $zf ); if ( $F != " " ){ $zf [ " password " ] = " " ; try { $h -> connect ( " mongodb:// $N " , $zf ); return
lang ( 22 );} catch ( Exception $Bc ){}} return $h ;} catch ( Exception $Bc ){ return $Bc -> getMessage ();}} function
alter_indexes ( $Q , $c ){ global $h ; foreach ( $c
as $X ){ list ( $T , $C , $O ) = $X ; if ( $O == " DROP " ) $I = $h -> _db -> command ( array ( " deleteIndexes " => $Q , " index " => $C )); else { $f = array (); foreach ( $O
as $e ){ $e = preg_replace ( '~ DESC$~' , '' , $e , 1 , $Eb ); $f [ $e ] = ( $Eb ? - 1 : 1 );} $I = $h -> _db -> selectCollection ( $Q ) -> ensureIndex ( $f , array ( " unique " => ( $T == " UNIQUE " ), " name " => $C ,));} if ( $I [ 'errmsg' ]){ $h -> error = $I [ 'errmsg' ]; return
2018-04-01 23:34:54 +02:00
false ;}} return
true ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
2018-12-25 21:50:48 +01:00
preg_match ( " ~database|indexes|descidx~ " , $Qc );} function
db_collation ( $m , $pb ){} function
2018-04-01 23:34:54 +02:00
information_schema (){} function
2018-12-25 21:50:48 +01:00
is_view ( $R ){} function
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ return $I ;} function
foreign_keys ( $Q ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-12-25 21:50:48 +01:00
fk_support ( $R ){} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-12-25 21:50:48 +01:00
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ global $h ; if ( $Q == " " ){ $h -> _db -> createCollection ( $C ); return
2018-04-01 23:34:54 +02:00
true ;}} function
2018-12-25 21:50:48 +01:00
drop_tables ( $S ){ global $h ; foreach ( $S
as $Q ){ $Ng = $h -> _db -> selectCollection ( $Q ) -> drop (); if ( ! $Ng [ 'ok' ]) return
2018-04-01 23:34:54 +02:00
false ;} return
true ;} function
2018-12-25 21:50:48 +01:00
truncate_tables ( $S ){ global $h ; foreach ( $S
as $Q ){ $Ng = $h -> _db -> selectCollection ( $Q ) -> remove (); if ( ! $Ng [ 'ok' ]) return
2018-04-01 23:34:54 +02:00
false ;} return
2018-12-25 21:50:48 +01:00
true ;} $y = " mongo " ; $ld = array (); $rd = array (); $nc = array ( array ( " json " ));} $fc [ " elastic " ] = " Elasticsearch (beta) " ; if ( isset ( $_GET [ " elastic " ])){ $ig = array ( " json + allow_url_fopen " ); define ( " DRIVER " , " elastic " ); if ( function_exists ( 'json_decode' ) && ini_bool ( 'allow_url_fopen' )){ class
2018-04-01 23:34:54 +02:00
Min_DB { var $extension = " JSON " , $server_info , $errno , $error , $_url ; function
2018-12-25 21:50:48 +01:00
rootQuery ( $Zf , $_b = array (), $Te = 'GET' ){ @ ini_set ( 'track_errors' , 1 ); $Uc =@ file_get_contents ( " $this->_url / " . ltrim ( $Zf , '/' ), false , stream_context_create ( array ( 'http' => array ( 'method' => $Te , '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
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
query ( $Zf , $_b = array (), $Te = 'GET' ){ return $this -> rootQuery (( $this -> _db != " " ? " $this->_db / " : " / " ) . ltrim ( $Zf , '/' ), $_b , $Te );} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
select_db ( $k ){ $this -> _db = $k ; return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
quote ( $P ){ return $P ;}} class
2018-04-01 23:34:54 +02:00
Min_Result { var $num_rows , $_rows ; function
2018-06-30 00:38:01 +02:00
__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
2018-04-01 23:34:54 +02:00
fetch_row (){ return
array_values ( $this -> fetch_assoc ());}}} class
Min_Driver
extends
Min_SQL { function
2018-12-25 21:50:48 +01:00
select ( $Q , $L , $Z , $od , $Af = array (), $_ = 1 , $E = 0 , $ng = false ){ global $b ; $Mb = array (); $G = " $Q /_search " ; if ( $L != array ( " * " )) $Mb [ " fields " ] = $L ; if ( $Af ){ $vh = array (); foreach ( $Af
as $nb ){ $nb = preg_replace ( '~ DESC$~' , '' , $nb , 1 , $Eb ); $vh [] = ( $Eb ? array ( $nb => " desc " ) : $nb );} $Mb [ " sort " ] = $vh ;} if ( $_ ){ $Mb [ " size " ] =+ $_ ; if ( $E ) $Mb [ " from " ] = ( $E * $_ );} foreach ( $Z
as $X ){ list ( $nb , $uf , $X ) = explode ( " " , $X , 3 ); if ( $nb == " _id " ) $Mb [ " query " ][ " ids " ][ " values " ][] = $X ; elseif ( $nb . $X != " " ){ $bi = array ( " term " => array (( $nb != " " ? $nb : " _all " ) => $X )); if ( $uf == " = " ) $Mb [ " query " ][ " filtered " ][ " filter " ][ " and " ][] = $bi ; else $Mb [ " query " ][ " filtered " ][ " query " ][ " bool " ][ " must " ][] = $bi ;}} if ( $Mb [ " query " ] &&! $Mb [ " query " ][ " filtered " ][ " query " ] &&! $Mb [ " query " ][ " ids " ]) $Mb [ " query " ][ " filtered " ][ " query " ] = array ( " match_all " => array ()); $Dh = microtime ( true ); $dh = $this -> _conn -> query ( $G , $Mb ); if ( $ng ) echo $b -> selectQuery ( " $G : " . print_r ( $Mb , true ), $Dh , ! $dh ); if ( ! $dh ) return
false ; $I = array (); foreach ( $dh [ 'hits' ][ 'hits' ] as $Ad ){ $J = array (); if ( $L == array ( " * " )) $J [ " _id " ] = $Ad [ " _id " ]; $q = $Ad [ '_source' ]; if ( $L != array ( " * " )){ $q = array (); foreach ( $L
as $z ) $q [ $z ] = $Ad [ 'fields' ][ $z ];} foreach ( $q
as $z => $X ){ if ( $Mb [ " fields " ]) $X = $X [ 0 ]; $J [ $z ] = ( is_array ( $X ) ? json_encode ( $X ) : $X );} $I [] = $J ;} return
2018-04-01 23:34:54 +02:00
new
2018-06-30 00:38:01 +02:00
Min_Result ( $I );} function
2018-12-25 21:50:48 +01:00
update ( $T , $Bg , $xg , $_ = 0 , $M = " \n " ){ $Xf = preg_split ( '~ *= *~' , $xg ); if ( count ( $Xf ) == 2 ){ $u = trim ( $Xf [ 1 ]); $G = " $T / $u " ; return $this -> _conn -> query ( $G , $Bg , 'POST' );} return
2018-04-01 23:34:54 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
insert ( $T , $Bg ){ $u = " " ; $G = " $T / $u " ; $Ng = $this -> _conn -> query ( $G , $Bg , 'POST' ); $this -> _conn -> last_id = $Ng [ '_id' ]; return $Ng [ 'created' ];} function
delete ( $T , $xg , $_ = 0 ){ $Fd = array (); if ( is_array ( $_GET [ " where " ]) && $_GET [ " where " ][ " _id " ]) $Fd [] = $_GET [ " where " ][ " _id " ]; if ( is_array ( $_POST [ 'check' ])){ foreach ( $_POST [ 'check' ] as $db ){ $Xf = preg_split ( '~ *= *~' , $db ); if ( count ( $Xf ) == 2 ) $Fd [] = trim ( $Xf [ 1 ]);}} $this -> _conn -> affected_rows = 0 ; foreach ( $Fd
as $u ){ $G = " { $T } / { $u } " ; $Ng = $this -> _conn -> query ( $G , '{}' , 'DELETE' ); if ( is_array ( $Ng ) && $Ng [ 'found' ] == true ) $this -> _conn -> affected_rows ++ ;} return $this -> _conn -> affected_rows ;}} function
connect (){ global $b ; $h = new
Min_DB ; list ( $N , $V , $F ) = $b -> credentials (); if ( $F != " " && $h -> connect ( $N , $V , " " )) return
lang ( 22 ); if ( $h -> connect ( $N , $V , $F )) return $h ; return $h -> error ;} function
2018-06-30 00:38:01 +02:00
support ( $Qc ){ return
preg_match ( " ~database|table|columns~ " , $Qc );} function
logged_user (){ global $b ; $Hb = $b -> credentials (); return $Hb [ 1 ];} function
2018-12-25 21:50:48 +01:00
get_databases (){ global $h ; $I = $h -> rootQuery ( '_aliases' ); if ( $I ){ $I = array_keys ( $I ); sort ( $I , SORT_STRING );} return $I ;} function
2018-04-01 23:34:54 +02:00
collations (){ return
array ();} function
2018-12-25 21:50:48 +01:00
db_collation ( $m , $pb ){} function
2018-04-01 23:34:54 +02:00
engines (){ return
array ();} function
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ global $h ; $I = array (); $H = $h -> query ( '_stats' ); if ( $H && $H [ 'indices' ]){ $Nd = $H [ 'indices' ]; foreach ( $Nd
as $Md => $Eh ){ $Ld = $Eh [ 'total' ][ 'indexing' ]; $I [ $Md ] = $Ld [ 'index_total' ];}} return $I ;} function
tables_list (){ global $h ; $I = $h -> query ( '_mapping' ); if ( $I ) $I = array_fill_keys ( array_keys ( $I [ $h -> _db ][ " mappings " ]), 'table' ); return $I ;} function
table_status ( $C = " " , $Pc = false ){ global $h ; $dh = $h -> query ( " _search " , array ( " size " => 0 , " aggregations " => array ( " count_by_type " => array ( " terms " => array ( " field " => " _type " )))), " POST " ); $I = array (); if ( $dh ){ $S = $dh [ " aggregations " ][ " count_by_type " ][ " buckets " ]; foreach ( $S
as $Q ){ $I [ $Q [ " key " ]] = array ( " Name " => $Q [ " key " ], " Engine " => " table " , " Rows " => $Q [ " doc_count " ],); if ( $C != " " && $C == $Q [ " key " ]) return $I [ $C ];}} return $I ;} function
error (){ global $h ; return
h ( $h -> error );} function
2018-04-01 23:34:54 +02:00
information_schema (){} function
2018-12-25 21:50:48 +01:00
is_view ( $R ){} function
indexes ( $Q , $i = null ){ return
2018-04-01 23:34:54 +02:00
array ( array ( " type " => " PRIMARY " , " columns " => array ( " _id " )),);} function
2018-12-25 21:50:48 +01:00
fields ( $Q ){ global $h ; $H = $h -> query ( " $Q /_mapping " ); $I = array (); if ( $H ){ $Be = $H [ $Q ][ 'properties' ]; if ( ! $Be ) $Be = $H [ $h -> _db ][ 'mappings' ][ $Q ][ 'properties' ]; if ( $Be ){ foreach ( $Be
as $C => $p ){ $I [ $C ] = array ( " field " => $C , " full_type " => $p [ " type " ], " type " => $p [ " type " ], " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ),); if ( $p [ " properties " ]){ unset ( $I [ $C ][ " privileges " ][ " insert " ]); unset ( $I [ $C ][ " privileges " ][ " update " ]);}}}} return $I ;} function
foreign_keys ( $Q ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-12-25 21:50:48 +01:00
table ( $v ){ return $v ;} function
idf_escape ( $v ){ return $v ;} function
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ return $I ;} function
fk_support ( $R ){} function
found_rows ( $R , $Z ){ return
2018-04-01 23:34:54 +02:00
null ;} function
2018-12-25 21:50:48 +01:00
create_database ( $m ){ global $h ; return $h -> rootQuery ( urlencode ( $m ), null , 'PUT' );} function
drop_databases ( $l ){ global $h ; return $h -> rootQuery ( urlencode ( implode ( ',' , $l )), array (), 'DELETE' );} function
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ global $h ; $tg = array (); foreach ( $q
as $Nc ){ $Sc = trim ( $Nc [ 1 ][ 0 ]); $Tc = trim ( $Nc [ 1 ][ 1 ] ? $Nc [ 1 ][ 1 ] : " text " ); $tg [ $Sc ] = array ( 'type' => $Tc );} if ( ! empty ( $tg )) $tg = array ( 'properties' => $tg ); return $h -> query ( " _mapping/ { $C } " , $tg , 'PUT' );} function
drop_tables ( $S ){ global $h ; $I = true ; foreach ( $S
as $Q ) $I = $I && $h -> query ( urlencode ( $Q ), array (), 'DELETE' ); return $I ;} function
last_id (){ global $h ; return $h -> last_id ;} $y = " elastic " ; $wf = array ( " = " , " query " ); $ld = array (); $rd = array (); $nc = array ( array ( " json " )); $U = array (); $Ih = array (); foreach ( array ( lang ( 27 ) => array ( " long " => 3 , " integer " => 5 , " short " => 8 , " byte " => 10 , " double " => 20 , " float " => 66 , " half_float " => 12 , " scaled_float " => 21 ), lang ( 28 ) => array ( " date " => 10 ), lang ( 25 ) => array ( " string " => 65535 , " text " => 65535 ), lang ( 29 ) => array ( " binary " => 255 ),) as $z => $X ){ $U += $X ; $Ih [ $z ] = array_keys ( $X );}} $fc [ " clickhouse " ] = " ClickHouse (alpha) " ; if ( isset ( $_GET [ " clickhouse " ])){ define ( " DRIVER " , " clickhouse " ); class
Min_DB { var $extension = " JSON " , $server_info , $errno , $_result , $error , $_url ; var $_db = 'default' ; function
rootQuery ( $m , $G ){ @ ini_set ( 'track_errors' , 1 ); $Uc =@ file_get_contents ( " $this->_url /?database= $m " , false , stream_context_create ( array ( 'http' => array ( 'method' => 'POST' , 'content' => $this -> isQuerySelectLike ( $G ) ? " $G FORMAT JSONCompact " : $G , 'header' => 'Content-type: application/x-www-form-urlencoded' , 'ignore_errors' => 1 ,)))); if ( $Uc === false ){ $this -> error = $php_errormsg ; return $Uc ;} if ( ! preg_match ( '~^HTTP/[0-9.]+ 2~i' , $http_response_header [ 0 ])){ $this -> error = $Uc ; return
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
new
Min_Result ( $I );} function
isQuerySelectLike ( $G ){ return ( bool ) preg_match ( '~^(select|show)~i' , $G );} function
query ( $G ){ return $this -> rootQuery ( $this -> _db , $G );} function
connect ( $N , $V , $F ){ preg_match ( '~^(https?://)?(.*)~' , $N , $B ); $this -> _url = ( $B [ 1 ] ? $B [ 1 ] : " http:// " ) . " $V : $F @ $B[2] " ; $I = $this -> query ( 'SELECT 1' ); return ( bool ) $I ;} function
select_db ( $k ){ $this -> _db = $k ; return
true ;} function
quote ( $P ){ return " ' " . addcslashes ( $P , " \\ ' " ) . " ' " ;} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); return $H [ 'data' ];}} class
Min_Result { var $num_rows , $_rows , $columns , $meta , $_offset = 0 ; function
__construct ( $H ){ $this -> num_rows = $H [ 'rows' ]; $this -> _rows = $H [ 'data' ]; $this -> meta = $H [ 'meta' ]; $this -> columns = array_column ( $this -> meta , 'name' ); reset ( $this -> _rows );} function
fetch_assoc (){ $J = current ( $this -> _rows ); next ( $this -> _rows ); return $J === false ? false : array_combine ( $this -> columns , $J );} function
fetch_row (){ $J = current ( $this -> _rows ); next ( $this -> _rows ); return $J ;} function
fetch_field (){ $e = $this -> _offset ++ ; $I = new
stdClass ; if ( $e < count ( $this -> columns )){ $I -> name = $this -> meta [ $e ][ 'name' ]; $I -> orgname = $I -> name ; $I -> type = $this -> meta [ $e ][ 'type' ];} return $I ;}} class
Min_Driver
extends
Min_SQL { function
delete ( $Q , $xg , $_ = 0 ){ return
queries ( " ALTER TABLE " . table ( $Q ) . " DELETE $xg " );} function
update ( $Q , $O , $xg , $_ = 0 , $M = " \n " ){ $Vi = array (); foreach ( $O
as $z => $X ) $Vi [] = " $z = $X " ; $G = $M . implode ( " , $M " , $Vi ); return
queries ( " ALTER TABLE " . table ( $Q ) . " UPDATE $G $xg " );}} function
idf_escape ( $v ){ return " ` " . str_replace ( " ` " , " `` " , $v ) . " ` " ;} function
table ( $v ){ return
idf_escape ( $v );} function
explain ( $h , $G ){ return '' ;} function
found_rows ( $R , $Z ){ $K = get_vals ( " SELECT COUNT(*) FROM " . idf_escape ( $R [ " Name " ]) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " )); return
empty ( $K ) ? false : $K [ 0 ];} function
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ foreach ( $q
as $p ){ if ( $p [ 1 ][ 2 ] === " NULL " ) $p [ 1 ][ 1 ] = " Nullable( { $p [ 1 ][ 1 ] } ) " ; unset ( $p [ 1 ][ 2 ]);}} function
truncate_tables ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
drop_views ( $aj ){ return
drop_tables ( $aj );} function
drop_tables ( $S ){ return
apply_queries ( " DROP TABLE " , $S );} function
connect (){ global $b ; $h = new
Min_DB ; $Hb = $b -> credentials (); if ( $h -> connect ( $Hb [ 0 ], $Hb [ 1 ], $Hb [ 2 ])) return $h ; return $h -> error ;} function
get_databases ( $bd ){ global $h ; $H = get_rows ( 'SHOW DATABASES' ); $I = array (); foreach ( $H
as $J ) $I [] = $J [ 'name' ]; sort ( $I ); return $I ;} function
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return " $G $Z " . ( $_ !== null ? $M . " LIMIT $_ " . ( $D ? " , $D " : " " ) : " " );} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ return
limit ( $G , $Z , 1 , 0 , $M );} function
db_collation ( $m , $pb ){} function
engines (){ return
array ( 'MergeTree' );} function
logged_user (){ global $b ; $Hb = $b -> credentials (); return $Hb [ 1 ];} function
tables_list (){ $H = get_rows ( 'SHOW TABLES' ); $I = array (); foreach ( $H
as $J ) $I [ $J [ 'name' ]] = 'table' ; ksort ( $I ); return $I ;} function
count_tables ( $l ){ return
array ();} function
table_status ( $C = " " , $Pc = false ){ global $h ; $I = array (); $S = get_rows ( " SELECT name, engine FROM system.tables WHERE database = " . q ( $h -> _db )); foreach ( $S
as $Q ){ $I [ $Q [ 'name' ]] = array ( 'Name' => $Q [ 'name' ], 'Engine' => $Q [ 'engine' ],); if ( $C === $Q [ 'name' ]) return $I [ $Q [ 'name' ]];} return $I ;} function
is_view ( $R ){ return
false ;} function
fk_support ( $R ){ return
false ;} function
convert_field ( $p ){} function
unconvert_field ( $p , $I ){ if ( in_array ( $p [ 'type' ],[ " Int8 " , " Int16 " , " Int32 " , " Int64 " , " UInt8 " , " UInt16 " , " UInt32 " , " UInt64 " , " Float32 " , " Float64 " ])) return " to $p[type] ( $I ) " ; return $I ;} function
fields ( $Q ){ $I = array (); $H = get_rows ( " SELECT name, type, default_expression FROM system.columns WHERE " . idf_escape ( 'table' ) . " = " . q ( $Q )); foreach ( $H
as $J ){ $T = trim ( $J [ 'type' ]); $gf = strpos ( $T , 'Nullable(' ) === 0 ; $I [ trim ( $J [ 'name' ])] = array ( " field " => trim ( $J [ 'name' ]), " full_type " => $T , " type " => $T , " default " => trim ( $J [ 'default_expression' ]), " null " => $gf , " auto_increment " => '0' , " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 0 ),);} return $I ;} function
indexes ( $Q , $i = null ){ return
array ();} function
foreign_keys ( $Q ){ return
array ();} function
collations (){ return
array ();} function
information_schema ( $m ){ return
false ;} function
error (){ global $h ; return
h ( $h -> error );} function
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
set_schema ( $bh ){ return
true ;} function
auto_increment (){ return '' ;} function
last_id (){ return
0 ;} function
support ( $Qc ){ return
preg_match ( " ~^(columns|sql|status|table) $ ~ " , $Qc );} $y = " clickhouse " ; $U = array (); $Ih = array (); foreach ( array ( lang ( 27 ) => array ( " Int8 " => 3 , " Int16 " => 5 , " Int32 " => 10 , " Int64 " => 19 , " UInt8 " => 3 , " UInt16 " => 5 , " UInt32 " => 10 , " UInt64 " => 20 , " Float32 " => 7 , " Float64 " => 16 , 'Decimal' => 38 , 'Decimal32' => 9 , 'Decimal64' => 18 , 'Decimal128' => 38 ), lang ( 28 ) => array ( " Date " => 13 , " DateTime " => 20 ), lang ( 25 ) => array ( " String " => 0 ), lang ( 29 ) => array ( " FixedString " => 0 ),) as $z => $X ){ $U += $X ; $Ih [ $z ] = array_keys ( $X );} $Ji = array (); $wf = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " ~ " , " !~ " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " , " SQL " ); $ld = array (); $rd = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $nc = array ();} $fc = array ( " server " => " MySQL " ) + $fc ; if ( ! defined ( " DRIVER " )){ $ig = array ( " MySQLi " , " MySQL " , " PDO_MySQL " ); define ( " DRIVER " , " server " ); if ( extension_loaded ( " mysqli " )){ class
2014-05-08 19:46:08 +02:00
Min_DB
extends
MySQLi { var $extension = " MySQLi " ; function
2017-06-25 00:56:50 +02:00
__construct (){ parent :: init ();} function
2018-12-25 21:50:48 +01:00
connect ( $N = " " , $V = " " , $F = " " , $k = null , $eg = null , $uh = null ){ global $b ; mysqli_report ( MYSQLI_REPORT_OFF ); list ( $Bd , $eg ) = explode ( " : " , $N , 2 ); $Ch = $b -> connectSsl (); if ( $Ch ) $this -> ssl_set ( $Ch [ 'key' ], $Ch [ 'cert' ], $Ch [ 'ca' ], '' , '' ); $I =@ $this -> real_connect (( $N != " " ? $Bd : ini_get ( " mysqli.default_host " )),( $N . $V != " " ? $V : ini_get ( " mysqli.default_user " )),( $N . $V . $F != " " ? $F : ini_get ( " mysqli.default_pw " )), $k ,( is_numeric ( $eg ) ? $eg : ini_get ( " mysqli.default_port " )),( ! is_numeric ( $eg ) ? $eg : $uh ),( $Ch ? 64 : 0 )); $this -> options ( MYSQLI_OPT_LOCAL_INFILE , false ); return $I ;} function
2018-04-01 23:34:54 +02:00
set_charset ( $cb ){ if ( parent :: set_charset ( $cb )) return
true ; parent :: set_charset ( 'utf8' ); return $this -> query ( " SET NAMES $cb " );} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! $H ) return
false ; $J = $H -> fetch_array (); return $J [ $p ];} function
quote ( $P ){ return " ' " . $this -> escape_string ( $P ) . " ' " ;}}} elseif ( extension_loaded ( " mysql " ) &&! (( ini_bool ( " sql.safe_mode " ) || ini_bool ( " mysql.allow_local_infile " )) && extension_loaded ( " pdo_mysql " ))){ class
2014-05-08 19:46:08 +02:00
Min_DB { var $extension = " MySQL " , $server_info , $affected_rows , $errno , $error , $_link , $_result ; function
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
quote ( $P ){ return " ' " . mysql_real_escape_string ( $P , $this -> _link ) . " ' " ;} function
select_db ( $k ){ return
mysql_select_db ( $k , $this -> _link );} function
query ( $G , $Di = false ){ $H =@ ( $Di ? mysql_unbuffered_query ( $G , $this -> _link ) : mysql_query ( $G , $this -> _link )); $this -> error = " " ; if ( ! $H ){ $this -> errno = mysql_errno ( $this -> _link ); $this -> error = mysql_error ( $this -> _link ); return
2018-06-30 00:38:01 +02:00
false ;} if ( $H === true ){ $this -> affected_rows = mysql_affected_rows ( $this -> _link ); $this -> info = mysql_info ( $this -> _link ); return
2014-05-08 19:46:08 +02:00
true ;} return
new
2018-06-30 00:38:01 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2014-05-08 19:46:08 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2018-12-25 21:50:48 +01:00
result ( $G , $p = 0 ){ $H = $this -> query ( $G ); if ( ! $H ||! $H -> num_rows ) return
2014-05-08 19:46:08 +02:00
false ; return
2018-12-25 21:50:48 +01:00
mysql_result ( $H -> _result , 0 , $p );}} class
2014-05-08 19:46:08 +02:00
Min_Result { var $num_rows , $_result , $_offset = 0 ; function
2018-06-30 00:38:01 +02:00
__construct ( $H ){ $this -> _result = $H ; $this -> num_rows = mysql_num_rows ( $H );} function
2014-05-08 19:46:08 +02:00
fetch_assoc (){ return
mysql_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
mysql_fetch_row ( $this -> _result );} function
2018-06-30 00:38:01 +02:00
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
2014-05-08 19:46:08 +02:00
__destruct (){ mysql_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_mysql " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_MySQL " ; function
2018-12-25 21:50:48 +01:00
connect ( $N , $V , $F ){ global $b ; $zf = array ( PDO :: MYSQL_ATTR_LOCAL_INFILE => false ); $Ch = $b -> connectSsl (); if ( $Ch ) $zf += array ( PDO :: MYSQL_ATTR_SSL_KEY => $Ch [ 'key' ], PDO :: MYSQL_ATTR_SSL_CERT => $Ch [ 'cert' ], PDO :: MYSQL_ATTR_SSL_CA => $Ch [ 'ca' ],); $this -> dsn ( " mysql:charset=utf8;host= " . str_replace ( " : " , " ;unix_socket= " , preg_replace ( '~:(\d)~' , ';port=\1' , $N )), $V , $F , $zf ); return
2014-05-08 19:46:08 +02:00
true ;} function
2018-04-01 23:34:54 +02:00
set_charset ( $cb ){ $this -> query ( " SET NAMES $cb " );} function
2018-12-25 21:50:48 +01:00
select_db ( $k ){ return $this -> query ( " USE " . idf_escape ( $k ));} function
query ( $G , $Di = false ){ $this -> setAttribute ( 1000 , ! $Di ); return
parent :: query ( $G , $Di );}}} class
2014-05-08 19:46:08 +02:00
Min_Driver
extends
Min_SQL { function
2018-12-25 21:50:48 +01:00
insert ( $Q , $O ){ return ( $O ? parent :: insert ( $Q , $O ) : queries ( " INSERT INTO " . table ( $Q ) . " () \n VALUES () " ));} function
insertUpdate ( $Q , $K , $lg ){ $f = array_keys ( reset ( $K )); $jg = " INSERT INTO " . table ( $Q ) . " ( " . implode ( " , " , $f ) . " ) VALUES \n " ; $Vi = array (); foreach ( $f
as $z ) $Vi [ $z ] = " $z = VALUES( $z ) " ; $Lh = " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $Vi ); $Vi = array (); $ve = 0 ; foreach ( $K
as $O ){ $Y = " ( " . implode ( " , " , $O ) . " ) " ; if ( $Vi && ( strlen ( $jg ) + $ve + strlen ( $Y ) + strlen ( $Lh ) > 1e6 )){ if ( ! queries ( $jg . implode ( " , \n " , $Vi ) . $Lh )) return
false ; $Vi = array (); $ve = 0 ;} $Vi [] = $Y ; $ve += strlen ( $Y ) + 2 ;} return
queries ( $jg . implode ( " , \n " , $Vi ) . $Lh );} function
slowQuery ( $G , $gi ){ if ( min_version ( '5.7.8' , '10.1.2' )){ if ( preg_match ( '~MariaDB~' , $this -> _conn -> server_info )) return " SET STATEMENT max_statement_time= $gi FOR $G " ; elseif ( preg_match ( '~^(SELECT\b)(.+)~is' , $G , $B )) return " $B[1] /*+ MAX_EXECUTION_TIME( " . ( $gi * 1000 ) . " ) */ $B[2] " ;}} function
convertSearch ( $v , $X , $p ){ return ( preg_match ( '~char|text|enum|set~' , $p [ " type " ]) &&! preg_match ( " ~^utf8~ " , $p [ " collation " ]) && preg_match ( '~[\x80-\xFF]~' , $X [ 'val' ]) ? " CONVERT( $v USING " . charset ( $this -> _conn ) . " ) " : $v );} function
2018-06-30 00:38:01 +02:00
warnings (){ $H = $this -> _conn -> query ( " SHOW WARNINGS " ); if ( $H && $H -> num_rows ){ ob_start (); select ( $H ); return
2018-04-01 23:34:54 +02:00
ob_get_clean ();}} function
2018-12-25 21:50:48 +01:00
tableHelp ( $C ){ $Ce = preg_match ( '~MariaDB~' , $this -> _conn -> server_info ); if ( information_schema ( DB )) return
strtolower (( $Ce ? " information-schema- $C -table/ " : str_replace ( " _ " , " - " , $C ) . " -table.html " )); if ( DB == " mysql " ) return ( $Ce ? " mysql $C -table/ " : " system-database.html " );}} function
idf_escape ( $v ){ return " ` " . str_replace ( " ` " , " `` " , $v ) . " ` " ;} function
table ( $v ){ return
idf_escape ( $v );} function
connect (){ global $b , $U , $Ih ; $h = new
Min_DB ; $Hb = $b -> credentials (); if ( $h -> connect ( $Hb [ 0 ], $Hb [ 1 ], $Hb [ 2 ])){ $h -> set_charset ( charset ( $h )); $h -> query ( " SET sql_quote_show_create = 1, autocommit = 1 " ); if ( min_version ( '5.7.8' , 10.2 , $h )){ $Ih [ lang ( 25 )][] = " json " ; $U [ " json " ] = 4294967295 ;} return $h ;} $I = $h -> error ; if ( function_exists ( 'iconv' ) &&! is_utf8 ( $I ) && strlen ( $Zg = iconv ( " windows-1250 " , " utf-8 " , $I )) > strlen ( $I )) $I = $Zg ; return $I ;} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
limit ( $G , $Z , $_ , $D = 0 , $M = " " ){ return " $G $Z " . ( $_ !== null ? $M . " LIMIT $_ " . ( $D ? " OFFSET $D " : " " ) : " " );} function
limit1 ( $Q , $G , $Z , $M = " \n " ){ return
2018-06-30 00:38:01 +02:00
limit ( $G , $Z , 1 , 0 , $M );} function
2018-12-25 21:50:48 +01:00
db_collation ( $m , $pb ){ global $h ; $I = null ; $j = $h -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ); if ( preg_match ( '~ COLLATE ([^ ]+)~' , $j , $B )) $I = $B [ 1 ]; elseif ( preg_match ( '~ CHARACTER SET ([^ ]+)~' , $j , $B )) $I = $pb [ $B [ 1 ]][ - 1 ]; return $I ;} function
2018-06-30 00:38:01 +02:00
engines (){ $I = array (); foreach ( get_rows ( " SHOW ENGINES " ) as $J ){ if ( preg_match ( " ~YES|DEFAULT~ " , $J [ " Support " ])) $I [] = $J [ " Engine " ];} return $I ;} function
2018-12-25 21:50:48 +01:00
logged_user (){ global $h ; return $h -> result ( " SELECT USER() " );} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
count_tables ( $l ){ $I = array (); foreach ( $l
as $m ) $I [ $m ] = count ( get_vals ( " SHOW TABLES IN " . idf_escape ( $m ))); return $I ;} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
is_view ( $R ){ return $R [ " Engine " ] === null ;} function
fk_support ( $R ){ return
preg_match ( '~InnoDB|IBMDB2I~i' , $R [ " Engine " ]) || ( preg_match ( '~NDB~i' , $R [ " Engine " ]) && min_version ( 5.6 ));} function
fields ( $Q ){ $I = array (); foreach ( get_rows ( " SHOW FULL COLUMNS FROM " . table ( $Q )) as $J ){ preg_match ( '~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~' , $J [ " Type " ], $B ); $I [ $J [ " Field " ]] = array ( " field " => $J [ " Field " ], " full_type " => $J [ " Type " ], " type " => $B [ 1 ], " length " => $B [ 2 ], " unsigned " => ltrim ( $B [ 3 ] . $B [ 4 ]), " default " => ( $J [ " Default " ] != " " || preg_match ( " ~char|set~ " , $B [ 1 ]) ? $J [ " Default " ] : null ), " null " => ( $J [ " Null " ] == " YES " ), " auto_increment " => ( $J [ " Extra " ] == " auto_increment " ), " on_update " => ( preg_match ( '~^on update (.+)~i' , $J [ " Extra " ], $B ) ? $B [ 1 ] : " " ), " collation " => $J [ " Collation " ], " privileges " => array_flip ( preg_split ( '~, *~' , $J [ " Privileges " ])), " comment " => $J [ " Comment " ], " primary " => ( $J [ " Key " ] == " PRI " ),);} return $I ;} function
indexes ( $Q , $i = null ){ $I = array (); foreach ( get_rows ( " SHOW INDEX FROM " . table ( $Q ), $i ) as $J ){ $C = $J [ " Key_name " ]; $I [ $C ][ " type " ] = ( $C == " PRIMARY " ? " PRIMARY " : ( $J [ " Index_type " ] == " FULLTEXT " ? " FULLTEXT " : ( $J [ " Non_unique " ] ? ( $J [ " Index_type " ] == " SPATIAL " ? " SPATIAL " : " INDEX " ) : " UNIQUE " ))); $I [ $C ][ " columns " ][] = $J [ " Column_name " ]; $I [ $C ][ " lengths " ][] = ( $J [ " Index_type " ] == " SPATIAL " ? null : $J [ " Sub_part " ]); $I [ $C ][ " descs " ][] = null ;} return $I ;} function
foreign_keys ( $Q ){ global $h , $rf ; static $bg = '(?:`(?:[^`]|``)+`)|(?:"(?:[^"]|"")+")' ; $I = array (); $Fb = $h -> result ( " SHOW CREATE TABLE " . table ( $Q ), 1 ); if ( $Fb ){ preg_match_all ( " ~CONSTRAINT ( $bg ) FOREIGN KEY ? \\ (((?: $bg ,? ?)+) \\ ) REFERENCES ( $bg )(?: \\ .( $bg ))? \\ (((?: $bg ,? ?)+) \\ )(?: ON DELETE ( $rf ))?(?: ON UPDATE ( $rf ))?~ " , $Fb , $Fe , PREG_SET_ORDER ); foreach ( $Fe
as $B ){ preg_match_all ( " ~ $bg ~ " , $B [ 2 ], $wh ); preg_match_all ( " ~ $bg ~ " , $B [ 5 ], $Yh ); $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' , $wh [ 0 ]), " target " => array_map ( 'idf_unescape' , $Yh [ 0 ]), " on_delete " => ( $B [ 6 ] ? $B [ 6 ] : " RESTRICT " ), " on_update " => ( $B [ 7 ] ? $B [ 7 ] : " RESTRICT " ),);}} return $I ;} function
view ( $C ){ global $h ; return
array ( " select " => preg_replace ( '~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU' , '' , $h -> result ( " SHOW CREATE VIEW " . table ( $C ), 1 )));} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
as $z => $X ) asort ( $I [ $z ]); return $I ;} function
information_schema ( $m ){ return ( min_version ( 5 ) && $m == " information_schema " ) || ( min_version ( 5.5 ) && $m == " performance_schema " );} function
error (){ global $h ; return
h ( preg_replace ( '~^You have an error.*syntax to use~U' , " Syntax error " , $h -> error ));} function
create_database ( $m , $d ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $d ? " COLLATE " . q ( $d ) : " " ));} function
drop_databases ( $l ){ $I = apply_queries ( " DROP DATABASE " , $l , 'idf_escape' ); restart_session (); set_session ( " dbs " , null ); return $I ;} function
rename_database ( $C , $d ){ $I = false ; if ( create_database ( $C , $d )){ $Lg = array (); foreach ( tables_list () as $Q => $T ) $Lg [] = table ( $Q ) . " TO " . idf_escape ( $C ) . " . " . table ( $Q ); $I = ( ! $Lg || queries ( " RENAME TABLE " . implode ( " , " , $Lg ))); 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 $w ){ if ( in_array ( $_POST [ " fields " ][ $_POST [ " auto_increment_col " ]][ " orig " ], $w [ " columns " ], true )){ $Na = " " ; break ;} if ( $w [ " type " ] == " PRIMARY " ) $Na = " UNIQUE " ;}} return " AUTO_INCREMENT $Na " ;} function
alter_table ( $Q , $C , $q , $dd , $ub , $vc , $d , $Ma , $Vf ){ $c = array (); foreach ( $q
as $p ) $c [] = ( $p [ 1 ] ? ( $Q != " " ? ( $p [ 0 ] != " " ? " CHANGE " . idf_escape ( $p [ 0 ]) : " ADD " ) : " " ) . " " . implode ( $p [ 1 ]) . ( $Q != " " ? $p [ 2 ] : " " ) : " DROP " . idf_escape ( $p [ 0 ])); $c = array_merge ( $c , $dd ); $Fh = ( $ub !== null ? " COMMENT= " . q ( $ub ) : " " ) . ( $vc ? " ENGINE= " . q ( $vc ) : " " ) . ( $d ? " COLLATE " . q ( $d ) : " " ) . ( $Ma != " " ? " AUTO_INCREMENT= $Ma " : " " ); if ( $Q == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) $Fh $Vf " ); if ( $Q != $C ) $c [] = " RENAME TO " . table ( $C ); if ( $Fh ) $c [] = ltrim ( $Fh ); return ( $c || $Vf ? queries ( " ALTER TABLE " . table ( $Q ) . " \n " . implode ( " , \n " , $c ) . $Vf ) : true );} function
alter_indexes ( $Q , $c ){ foreach ( $c
as $z => $X ) $c [ $z ] = ( $X [ 2 ] == " DROP " ? " \n DROP INDEX " . idf_escape ( $X [ 1 ]) : " \n ADD $X[0] " . ( $X [ 0 ] == " PRIMARY " ? " KEY " : " " ) . ( $X [ 1 ] != " " ? idf_escape ( $X [ 1 ]) . " " : " " ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " ); return
queries ( " ALTER TABLE " . table ( $Q ) . implode ( " , " , $c ));} function
truncate_tables ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
drop_views ( $aj ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $aj )));} function
drop_tables ( $S ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $S )));} function
move_tables ( $S , $aj , $Yh ){ $Lg = array (); foreach ( array_merge ( $S , $aj ) as $Q ) $Lg [] = table ( $Q ) . " TO " . idf_escape ( $Yh ) . " . " . table ( $Q ); return
queries ( " RENAME TABLE " . implode ( " , " , $Lg ));} function
copy_tables ( $S , $aj , $Yh ){ queries ( " SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' " ); foreach ( $S
as $Q ){ $C = ( $Yh == DB ? table ( " copy_ $Q " ) : idf_escape ( $Yh ) . " . " . table ( $Q )); if ( ! queries ( " CREATE TABLE $C LIKE " . table ( $Q )) ||! queries ( " INSERT INTO $C SELECT * FROM " . table ( $Q ))) return
false ; foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $Q , " %_ \\ " ))) as $J ){ $yi = $J [ " Trigger " ]; if ( ! queries ( " CREATE TRIGGER " . ( $Yh == DB ? idf_escape ( " copy_ $yi " ) : idf_escape ( $Yh ) . " . " . idf_escape ( $yi )) . " $J[Timing] $J[Event] ON $C FOR EACH ROW \n $J[Statement] ; " )) return
false ;}} foreach ( $aj
as $Q ){ $C = ( $Yh == DB ? table ( " copy_ $Q " ) : idf_escape ( $Yh ) . " . " . table ( $Q )); $Zi = view ( $Q ); if ( ! queries ( " CREATE VIEW $C AS $Zi[select] " )) return
2014-05-08 19:46:08 +02:00
false ;} return
true ;} function
2018-06-30 00:38:01 +02:00
trigger ( $C ){ if ( $C == " " ) return
array (); $K = get_rows ( " SHOW TRIGGERS WHERE `Trigger` = " . q ( $C )); return
reset ( $K );} function
2018-12-25 21:50:48 +01:00
triggers ( $Q ){ $I = array (); foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $Q , " %_ \\ " ))) as $J ) $I [ $J [ " Trigger " ]] = array ( $J [ " Timing " ], $J [ " Event " ]); return $I ;} function
2014-05-08 19:46:08 +02:00
trigger_options (){ return
array ( " Timing " => array ( " BEFORE " , " AFTER " ), " Event " => array ( " INSERT " , " UPDATE " , " DELETE " ), " Type " => array ( " FOR EACH ROW " ),);} function
2018-12-25 21:50:48 +01:00
routine ( $C , $T ){ global $h , $xc , $Sd , $U ; $Da = array ( " bool " , " boolean " , " integer " , " double precision " , " real " , " dec " , " numeric " , " fixed " , " national char " , " national varchar " ); $xh = " (?: \\ s|/ \\ *[ \ s \ S]*? \\ */|(?:#|-- )[^ \n ]* \n ?|-- \r ? \n ) " ; $Ci = " (( " . implode ( " | " , array_merge ( array_keys ( $U ), $Da )) . " ) \\ b(?: \\ s* \\ (((?:[^' \" )]| $xc )++) \\ ))? \\ s*(zerofill \\ s*)?(unsigned(?: \\ s+zerofill)?)?)(?: \\ s*(?:CHARSET|CHARACTER \\ s+SET) \\ s*[' \" ]?([^' \" \\ s,]+)[' \" ]?)? " ; $bg = " $xh *( " . ( $T == " FUNCTION " ? " " : $Sd ) . " )? \\ s*(?:`((?:[^`]|``)*)` \\ s*| \\ b( \\ S+) \\ s+) $Ci " ; $j = $h -> result ( " SHOW CREATE $T " . idf_escape ( $C ), 2 ); preg_match ( " ~ \\ (((?: $bg\\s *,?)*) \\ ) \\ s* " . ( $T == " FUNCTION " ? " RETURNS \\ s+ $Ci\\s + " : " " ) . " (.*)~is " , $j , $B ); $q = array (); preg_match_all ( " ~ $bg\\s *,?~is " , $B [ 1 ], $Fe , PREG_SET_ORDER ); foreach ( $Fe
as $Of ){ $C = str_replace ( " `` " , " ` " , $Of [ 2 ]) . $Of [ 3 ]; $q [] = array ( " field " => $C , " type " => strtolower ( $Of [ 5 ]), " length " => preg_replace_callback ( " ~ $xc ~s " , 'normalize_enum' , $Of [ 6 ]), " unsigned " => strtolower ( preg_replace ( '~\s+~' , ' ' , trim ( " $Of[8] $Of[7] " ))), " null " => 1 , " full_type " => $Of [ 4 ], " inout " => strtoupper ( $Of [ 1 ]), " collation " => strtolower ( $Of [ 9 ]),);} if ( $T != " FUNCTION " ) return
array ( " fields " => $q , " definition " => $B [ 11 ]); return
array ( " fields " => $q , " returns " => array ( " type " => $B [ 12 ], " length " => $B [ 13 ], " unsigned " => $B [ 15 ], " collation " => $B [ 16 ]), " definition " => $B [ 17 ], " language " => " SQL " ,);} function
2014-05-08 19:46:08 +02:00
routines (){ return
2018-04-01 23:34:54 +02:00
get_rows ( " SELECT ROUTINE_NAME AS SPECIFIC_NAME, ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q ( DB ));} function
2014-05-08 19:46:08 +02:00
routine_languages (){ return
array ();} function
2018-06-30 00:38:01 +02:00
routine_id ( $C , $J ){ return
idf_escape ( $C );} function
2018-12-25 21:50:48 +01:00
last_id (){ global $h ; return $h -> result ( " SELECT LAST_INSERT_ID() " );} function
explain ( $h , $G ){ return $h -> query ( " EXPLAIN " . ( min_version ( 5.1 ) ? " PARTITIONS " : " " ) . $G );} function
found_rows ( $R , $Z ){ return ( $Z || $R [ " Engine " ] != " InnoDB " ? null : $R [ " Rows " ]);} function
2014-05-08 19:46:08 +02:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2018-12-25 21:50:48 +01:00
set_schema ( $bh ){ return
2014-05-08 19:46:08 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
create_sql ( $Q , $Ma , $Jh ){ global $h ; $I = $h -> result ( " SHOW CREATE TABLE " . table ( $Q ), 1 ); if ( ! $Ma ) $I = preg_replace ( '~ AUTO_INCREMENT=\d+~' , '' , $I ); return $I ;} function
truncate_sql ( $Q ){ return " TRUNCATE " . table ( $Q );} function
use_sql ( $k ){ return " USE " . idf_escape ( $k );} function
trigger_sql ( $Q ){ $I = " " ; foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $Q , " %_ \\ " )), null , " -- " ) as $J ) $I .= " \n CREATE TRIGGER " . idf_escape ( $J [ " Trigger " ]) . " $J[Timing] $J[Event] ON " . table ( $J [ " Table " ]) . " FOR EACH ROW \n $J[Statement] ;; \n " ; return $I ;} function
2014-05-08 19:46:08 +02:00
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
2018-12-25 21:50:48 +01:00
convert_field ( $p ){ if ( preg_match ( " ~binary~ " , $p [ " type " ])) return " HEX( " . idf_escape ( $p [ " field " ]) . " ) " ; if ( $p [ " type " ] == " bit " ) return " BIN( " . idf_escape ( $p [ " field " ]) . " + 0) " ; if ( preg_match ( " ~geometry|point|linestring|polygon~ " , $p [ " type " ])) return ( min_version ( 8 ) ? " ST_ " : " " ) . " AsWKT( " . idf_escape ( $p [ " field " ]) . " ) " ;} function
unconvert_field ( $p , $I ){ if ( preg_match ( " ~binary~ " , $p [ " type " ])) $I = " UNHEX( $I ) " ; if ( $p [ " type " ] == " bit " ) $I = " CONV( $I , 2, 10) + 0 " ; if ( preg_match ( " ~geometry|point|linestring|polygon~ " , $p [ " type " ])) $I = ( min_version ( 8 ) ? " ST_ " : " " ) . " GeomFromText( $I ) " ; return $I ;} function
support ( $Qc ){ return ! preg_match ( " ~scheme|sequence|type|view_trigger|materializedview " . ( min_version ( 8 ) ? " " : " |descidx " . ( min_version ( 5.1 ) ? " " : " |event|partitioning " . ( min_version ( 5 ) ? " " : " |routine|trigger|view " ))) . " ~ " , $Qc );} function
2017-06-25 00:56:50 +02:00
kill_process ( $X ){ return
queries ( " KILL " . number ( $X ));} function
connection_id (){ return " SELECT CONNECTION_ID() " ;} function
2018-12-25 21:50:48 +01:00
max_connections (){ global $h ; return $h -> result ( " SELECT @@max_connections " );} $y = " sql " ; $U = array (); $Ih = array (); foreach ( array ( lang ( 27 ) => array ( " tinyint " => 3 , " smallint " => 5 , " mediumint " => 8 , " int " => 10 , " bigint " => 20 , " decimal " => 66 , " float " => 12 , " double " => 21 ), lang ( 28 ) => array ( " date " => 10 , " datetime " => 19 , " timestamp " => 19 , " time " => 10 , " year " => 4 ), lang ( 25 ) => array ( " char " => 255 , " varchar " => 65535 , " tinytext " => 255 , " text " => 65535 , " mediumtext " => 16777215 , " longtext " => 4294967295 ), lang ( 33 ) => array ( " enum " => 65535 , " set " => 64 ), lang ( 29 ) => array ( " bit " => 20 , " binary " => 255 , " varbinary " => 65535 , " tinyblob " => 255 , " blob " => 65535 , " mediumblob " => 16777215 , " longblob " => 4294967295 ), lang ( 31 ) => array ( " geometry " => 0 , " point " => 0 , " linestring " => 0 , " polygon " => 0 , " multipoint " => 0 , " multilinestring " => 0 , " multipolygon " => 0 , " geometrycollection " => 0 ),) as $z => $X ){ $U += $X ; $Ih [ $z ] = array_keys ( $X );} $Ji = array ( " unsigned " , " zerofill " , " unsigned zerofill " ); $wf = 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.7.0 " ; class
2014-05-08 19:46:08 +02:00
Adminer { var $operators ; function
2018-04-01 23:34:54 +02:00
name (){ return " <a href='https://www.adminer.org/' " . target_blank () . " id='h1'>Adminer</a> " ;} function
2014-05-08 19:46:08 +02:00
credentials (){ return
array ( SERVER , $_GET [ " username " ], get_password ());} function
2018-04-01 23:34:54 +02:00
connectSsl (){} function
2018-12-25 21:50:48 +01:00
permanentLogin ( $j = false ){ return
password_file ( $j );} function
2014-05-08 19:46:08 +02:00
bruteForceKey (){ return $_SERVER [ " REMOTE_ADDR " ];} function
2018-06-30 00:38:01 +02:00
serverName ( $N ){ return
h ( $N );} function
2014-05-08 19:46:08 +02:00
database (){ return
DB ;} function
2018-06-30 00:38:01 +02:00
databases ( $bd = true ){ return
get_databases ( $bd );} function
2014-05-08 19:46:08 +02:00
schemas (){ return
schemas ();} function
queryTimeout (){ return
2018-06-30 00:38:01 +02:00
2 ;} function
2018-04-01 23:34:54 +02:00
headers (){} function
csp (){ return
csp ();} function
2014-05-08 19:46:08 +02:00
head (){ return
true ;} function
2018-06-30 00:38:01 +02:00
css (){ $I = array (); $Vc = " adminer.css " ; if ( file_exists ( $Vc )) $I [] = $Vc ; return $I ;} function
2018-12-25 21:50:48 +01:00
loginForm (){ global $fc ; echo " <table cellspacing='0' class='layout'> \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
2018-06-30 00:38:01 +02:00
loginFormField ( $C , $yd , $Y ){ return $yd . $Y ;} function
2018-12-25 21:50:48 +01:00
login ( $_e , $F ){ if ( $F == " " ) return
2018-06-30 00:38:01 +02:00
lang ( 41 , target_blank ()); return
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
tableName ( $Ph ){ return
h ( $Ph [ " Name " ]);} function
fieldName ( $p , $Af = 0 ){ return '<span title="' . h ( $p [ " full_type " ]) . '">' . h ( $p [ " field " ]) . '</span>' ;} function
selectLinks ( $Ph , $O = " " ){ global $y , $n ; echo '<p class="links">' ; $ye = array ( " select " => lang ( 42 )); if ( support ( " table " ) || support ( " indexes " )) $ye [ " table " ] = lang ( 43 ); if ( support ( " table " )){ if ( is_view ( $Ph )) $ye [ " view " ] = lang ( 44 ); else $ye [ " create " ] = lang ( 45 );} if ( $O !== null ) $ye [ " edit " ] = lang ( 46 ); $C = $Ph [ " Name " ]; foreach ( $ye
as $z => $X ) echo " <a href=' " . h ( ME ) . " $z = " . urlencode ( $C ) . ( $z == " edit " ? $O : " " ) . " ' " . bold ( isset ( $_GET [ $z ])) . " > $X </a> " ; echo
doc_link ( array ( $y => $n -> tableHelp ( $C )), " ? " ), " \n " ;} function
foreignKeys ( $Q ){ return
foreign_keys ( $Q );} function
backwardKeys ( $Q , $Oh ){ return
2018-04-01 23:34:54 +02:00
array ();} function
2018-06-30 00:38:01 +02:00
backwardKeysPrint ( $Pa , $J ){} function
2018-12-25 21:50:48 +01:00
selectQuery ( $G , $Dh , $Oc = false ){ global $y , $n ; $I = " </p> \n " ; if ( ! $Oc && ( $dj = $n -> warnings ())){ $u = " warnings " ; $I = " , <a href='# $u '> " . lang ( 47 ) . " </a> " . script ( " qsl('a').onclick = partial(toggle, ' $u '); " , " " ) . " $I <div id=' $u ' class='hidden'> \n $dj </div> \n " ;} return " <p><code class='jush- $y '> " . h ( str_replace ( " \n " , " " , $G )) . " </code> <span class='time'>( " . format_time ( $Dh ) . " )</span> " . ( support ( " sql " ) ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( $G ) . " '> " . lang ( 10 ) . " </a> " : " " ) . $I ;} function
2018-06-30 00:38:01 +02:00
sqlCommandQuery ( $G ){ return
shorten_utf8 ( trim ( $G ), 1000 );} function
2018-12-25 21:50:48 +01:00
rowDescription ( $Q ){ return " " ;} function
2018-06-30 00:38:01 +02:00
rowDescriptions ( $K , $ed ){ return $K ;} function
2018-12-25 21:50:48 +01:00
selectLink ( $X , $p ){} function
selectVal ( $X , $A , $p , $If ){ $I = ( $X === null ? " <i>NULL</i> " : ( preg_match ( " ~char|binary|boolean~ " , $p [ " type " ]) &&! preg_match ( " ~var~ " , $p [ " type " ]) ? " <code> $X </code> " : $X )); if ( preg_match ( '~blob|bytea|raw|file~' , $p [ " type " ]) &&! is_utf8 ( $X )) $I = " <i> " . lang ( 48 , strlen ( $If )) . " </i> " ; if ( preg_match ( '~json~' , $p [ " type " ])) $I = " <code class='jush-js'> $I </code> " ; return ( $A ? " <a href=' " . h ( $A ) . " ' " . ( is_url ( $A ) ? target_blank () : " " ) . " > $I </a> " : $I );} function
editVal ( $X , $p ){ return $X ;} function
tableStructurePrint ( $q ){ echo " <div class='scrollable'> \n " , " <table cellspacing='0' class='nowrap'> \n " , " <thead><tr><th> " . lang ( 49 ) . " <td> " . lang ( 50 ) . ( support ( " comment " ) ? " <td> " . lang ( 51 ) : " " ) . " </thead> \n " ; foreach ( $q
as $p ){ echo " <tr " . odd () . " ><th> " . h ( $p [ " field " ]), " <td><span title=' " . h ( $p [ " collation " ]) . " '> " . h ( $p [ " full_type " ]) . " </span> " ,( $p [ " null " ] ? " <i>NULL</i> " : " " ),( $p [ " auto_increment " ] ? " <i> " . lang ( 52 ) . " </i> " : " " ),( isset ( $p [ " default " ]) ? " <span title=' " . lang ( 53 ) . " '>[<b> " . h ( $p [ " default " ]) . " </b>]</span> " : " " ),( support ( " comment " ) ? " <td> " . h ( $p [ " comment " ]) : " " ), " \n " ;} echo " </table> \n " , " </div> \n " ;} function
tableIndexesPrint ( $x ){ echo " <table cellspacing='0'> \n " ; foreach ( $x
as $C => $w ){ ksort ( $w [ " columns " ]); $ng = array (); foreach ( $w [ " columns " ] as $z => $X ) $ng [] = " <i> " . h ( $X ) . " </i> " . ( $w [ " lengths " ][ $z ] ? " ( " . $w [ " lengths " ][ $z ] . " ) " : " " ) . ( $w [ " descs " ][ $z ] ? " DESC " : " " ); echo " <tr title=' " . h ( $C ) . " '><th> $w[type] <td> " . implode ( " , " , $ng ) . " \n " ;} echo " </table> \n " ;} function
selectColumnsPrint ( $L , $f ){ global $ld , $rd ; print_fieldset ( " select " , lang ( 54 ), $L ); $t = 0 ; $L [ " " ] = array (); foreach ( $L
as $z => $X ){ $X = $_GET [ " columns " ][ $z ]; $e = select_input ( " name='columns[ $t ][col]' " , $f , $X [ " col " ],( $z !== " " ? " selectFieldChange " : " selectAddRow " )); echo " <div> " . ( $ld || $rd ? " <select name='columns[ $t ][fun]'> " . optionlist ( array ( - 1 => " " ) + array_filter ( array ( lang ( 55 ) => $ld , lang ( 56 ) => $rd )), $X [ " fun " ]) . " </select> " . on_help ( " getTarget(event).value && getTarget(event).value.replace(/ | \$ /, '(') + ')' " , 1 ) . script ( " qsl('select').onchange = function () { helpClose(); " . ( $z !== " " ? " " : " qsl('select, input', this.parentNode).onchange(); " ) . " }; " , " " ) . " ( $e ) " : $e ) . " </div> \n " ; $t ++ ;} echo " </div></fieldset> \n " ;} function
selectSearchPrint ( $Z , $f , $x ){ print_fieldset ( " search " , lang ( 57 ), $Z ); foreach ( $x
as $t => $w ){ if ( $w [ " type " ] == " FULLTEXT " ){ echo " <div>(<i> " . implode ( " </i>, <i> " , array_map ( 'h' , $w [ " columns " ])) . " </i>) AGAINST " , " <input type='search' name='fulltext[ $t ]' value=' " . h ( $_GET [ " fulltext " ][ $t ]) . " '> " , script ( " qsl('input').oninput = selectFieldChange; " , " " ), checkbox ( " boolean[ $t ] " , 1 , isset ( $_GET [ " boolean " ][ $t ]), " BOOL " ), " </div> \n " ;}} $bb = " this.parentNode.firstChild.onchange(); " ; foreach ( array_merge (( array ) $_GET [ " where " ], array ( array ())) as $t => $X ){ if ( ! $X || ( " $X[col] $X[val] " != " " && in_array ( $X [ " op " ], $this -> operators ))){ echo " <div> " . select_input ( " name='where[ $t ][col]' " , $f , $X [ " col " ],( $X ? " selectFieldChange " : " selectAddRow " ), " ( " . lang ( 58 ) . " ) " ), html_select ( " where[ $t ][op] " , $this -> operators , $X [ " op " ], $bb ), " <input type='search' name='where[ $t ][val]' value=' " . h ( $X [ " val " ]) . " '> " , script ( " mixin(qsl('input'), { oninput: function () { $bb }, onkeydown: selectSearchKeydown, onsearch: selectSearchSearch}); " , " " ), " </div> \n " ;}} echo " </div></fieldset> \n " ;} function
selectOrderPrint ( $Af , $f , $x ){ print_fieldset ( " sort " , lang ( 59 ), $Af ); $t = 0 ; foreach (( array ) $_GET [ " order " ] as $z => $X ){ if ( $X != " " ){ echo " <div> " . select_input ( " name='order[ $t ]' " , $f , $X , " selectFieldChange " ), checkbox ( " desc[ $t ] " , 1 , isset ( $_GET [ " desc " ][ $z ]), lang ( 60 )) . " </div> \n " ; $t ++ ;}} echo " <div> " . select_input ( " name='order[ $t ]' " , $f , " " , " selectAddRow " ), checkbox ( " desc[ $t ] " , 1 , false , lang ( 60 )) . " </div> \n " , " </div></fieldset> \n " ;} function
selectLimitPrint ( $_ ){ echo " <fieldset><legend> " . lang ( 61 ) . " </legend><div> " ; echo " <input type='number' name='limit' class='size' value=' " . h ( $_ ) . " '> " , script ( " qsl('input').oninput = selectFieldChange; " , " " ), " </div></fieldset> \n " ;} function
selectLengthPrint ( $ei ){ if ( $ei !== null ){ echo " <fieldset><legend> " . lang ( 62 ) . " </legend><div> " , " <input type='number' name='text_length' class='size' value=' " . h ( $ei ) . " '> " , " </div></fieldset> \n " ;}} function
selectActionPrint ( $x ){ echo " <fieldset><legend> " . lang ( 63 ) . " </legend><div> " , " <input type='submit' value=' " . lang ( 54 ) . " '> " , " <span id='noindex' title=' " . lang ( 64 ) . " '></span> " , " <script " . nonce () . " > \n " , " var indexColumns = " ; $f = array (); foreach ( $x
as $w ){ $Lb = reset ( $w [ " columns " ]); if ( $w [ " type " ] != " FULLTEXT " && $Lb ) $f [ $Lb ] = 1 ;} $f [ " " ] = 1 ; foreach ( $f
as $z => $X ) json_row ( $z ); echo " ; \n " , " selectFieldChange.call(qs('#form')['select']); \n " , " </script> \n " , " </div></fieldset> \n " ;} function
2014-05-08 19:46:08 +02:00
selectCommandPrint (){ return ! information_schema ( DB );} function
selectImportPrint (){ return ! information_schema ( DB );} function
2018-12-25 21:50:48 +01:00
selectEmailPrint ( $sc , $f ){} function
selectColumnsProcess ( $f , $x ){ global $ld , $rd ; $L = array (); $od = array (); foreach (( array ) $_GET [ " columns " ] as $z => $X ){ if ( $X [ " fun " ] == " count " || ( $X [ " col " ] != " " && ( ! $X [ " fun " ] || in_array ( $X [ " fun " ], $ld ) || in_array ( $X [ " fun " ], $rd )))){ $L [ $z ] = apply_sql_function ( $X [ " fun " ],( $X [ " col " ] != " " ? idf_escape ( $X [ " col " ]) : " * " )); if ( ! in_array ( $X [ " fun " ], $rd )) $od [] = $L [ $z ];}} return
2018-06-30 00:38:01 +02:00
array ( $L , $od );} function
2018-12-25 21:50:48 +01:00
selectSearchProcess ( $q , $x ){ global $h , $n ; $I = array (); foreach ( $x
as $t => $w ){ if ( $w [ " type " ] == " FULLTEXT " && $_GET [ " fulltext " ][ $t ] != " " ) $I [] = " MATCH ( " . implode ( " , " , array_map ( 'idf_escape' , $w [ " columns " ])) . " ) AGAINST ( " . q ( $_GET [ " fulltext " ][ $t ]) . ( isset ( $_GET [ " boolean " ][ $t ]) ? " IN BOOLEAN MODE " : " " ) . " ) " ;} foreach (( array ) $_GET [ " where " ] as $z => $X ){ if ( " $X[col] $X[val] " != " " && in_array ( $X [ " op " ], $this -> operators )){ $jg = " " ; $wb = " $X[op] " ; if ( preg_match ( '~IN$~' , $X [ " op " ])){ $Id = process_length ( $X [ " val " ]); $wb .= " " . ( $Id != " " ? $Id : " (NULL) " );} elseif ( $X [ " op " ] == " SQL " ) $wb = " $X[val] " ; elseif ( $X [ " op " ] == " LIKE %% " ) $wb = " LIKE " . $this -> processInput ( $q [ $X [ " col " ]], " % $X[val] % " ); elseif ( $X [ " op " ] == " ILIKE %% " ) $wb = " ILIKE " . $this -> processInput ( $q [ $X [ " col " ]], " % $X[val] % " ); elseif ( $X [ " op " ] == " FIND_IN_SET " ){ $jg = " $X[op] ( " . q ( $X [ " val " ]) . " , " ; $wb = " ) " ;} elseif ( ! preg_match ( '~NULL$~' , $X [ " op " ])) $wb .= " " . $this -> processInput ( $q [ $X [ " col " ]], $X [ " val " ]); if ( $X [ " col " ] != " " ) $I [] = $jg . $n -> convertSearch ( idf_escape ( $X [ " col " ]), $X , $q [ $X [ " col " ]]) . $wb ; else { $rb = array (); foreach ( $q
as $C => $p ){ if (( preg_match ( '~^[-\d.' . ( preg_match ( '~IN$~' , $X [ " op " ]) ? ',' : '' ) . ']+$~' , $X [ " val " ]) ||! preg_match ( '~' . number_type () . '|bit~' , $p [ " type " ])) && ( ! preg_match ( " ~[ \x80 - \xFF ]~ " , $X [ " val " ]) || preg_match ( '~char|text|enum|set~' , $p [ " type " ]))) $rb [] = $jg . $n -> convertSearch ( idf_escape ( $C ), $X , $p ) . $wb ;} $I [] = ( $rb ? " ( " . implode ( " OR " , $rb ) . " ) " : " 1 = 0 " );}}} return $I ;} function
selectOrderProcess ( $q , $x ){ $I = array (); foreach (( array ) $_GET [ " order " ] as $z => $X ){ if ( $X != " " ) $I [] = ( preg_match ( '~^((COUNT\(DISTINCT |[A-Z0-9_]+\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\)|COUNT\(\*\))$~' , $X ) ? $X : idf_escape ( $X )) . ( isset ( $_GET [ " desc " ][ $z ]) ? " DESC " : " " );} return $I ;} function
2014-05-08 19:46:08 +02:00
selectLimitProcess (){ return ( isset ( $_GET [ " limit " ]) ? $_GET [ " limit " ] : " 50 " );} function
selectLengthProcess (){ return ( isset ( $_GET [ " text_length " ]) ? $_GET [ " text_length " ] : " 100 " );} function
2018-06-30 00:38:01 +02:00
selectEmailProcess ( $Z , $ed ){ return
2014-05-08 19:46:08 +02:00
false ;} function
2018-12-25 21:50:48 +01:00
selectQueryBuild ( $L , $Z , $od , $Af , $_ , $E ){ return " " ;} function
messageQuery ( $G , $fi , $Oc = false ){ global $y , $n ; restart_session (); $zd =& get_session ( " queries " ); if ( ! $zd [ $_GET [ " db " ]]) $zd [ $_GET [ " db " ]] = array (); if ( strlen ( $G ) > 1e6 ) $G = preg_replace ( '~[\x80-\xFF]+$~' , '' , substr ( $G , 0 , 1e6 )) . " \n ... " ; $zd [ $_GET [ " db " ]][] = array ( $G , time (), $fi ); $Ah = " sql- " . count ( $zd [ $_GET [ " db " ]]); $I = " <a href='# $Ah ' class='toggle'> " . lang ( 65 ) . " </a> \n " ; if ( ! $Oc && ( $dj = $n -> warnings ())){ $u = " warnings- " . count ( $zd [ $_GET [ " db " ]]); $I = " <a href='# $u ' class='toggle'> " . lang ( 47 ) . " </a>, $I <div id=' $u ' class='hidden'> \n $dj </div> \n " ;} return " <span class='time'> " .@ date ( " H:i:s " ) . " </span> " . " $I <div id=' $Ah ' class='hidden'><pre><code class='jush- $y '> " . shorten_utf8 ( $G , 1000 ) . " </code></pre> " . ( $fi ? " <span class='time'>( $fi )</span> " : '' ) . ( support ( " sql " ) ? '<p><a href="' . h ( str_replace ( " db= " . urlencode ( DB ), " db= " . urlencode ( $_GET [ " db " ]), ME ) . 'sql=&history=' . ( count ( $zd [ $_GET [ " db " ]]) - 1 )) . '">' . lang ( 10 ) . '</a>' : '' ) . '</div>' ;} function
editFunctions ( $p ){ global $nc ; $I = ( $p [ " null " ] ? " NULL/ " : " " ); foreach ( $nc
as $z => $ld ){ if ( ! $z || ( ! isset ( $_GET [ " call " ]) && ( isset ( $_GET [ " select " ]) || where ( $_GET )))){ foreach ( $ld
as $bg => $X ){ if ( ! $bg || preg_match ( " ~ $bg ~ " , $p [ " type " ])) $I .= " / $X " ;} if ( $z &&! preg_match ( '~set|blob|bytea|raw|file~' , $p [ " type " ])) $I .= " /SQL " ;}} if ( $p [ " auto_increment " ] &&! isset ( $_GET [ " select " ]) &&! where ( $_GET )) $I = lang ( 52 ); return
2018-06-30 00:38:01 +02:00
explode ( " / " , $I );} function
2018-12-25 21:50:48 +01:00
editInput ( $Q , $p , $Ka , $Y ){ if ( $p [ " type " ] == " enum " ) return ( isset ( $_GET [ " select " ]) ? " <label><input type='radio' $Ka value='-1' checked><i> " . lang ( 8 ) . " </i></label> " : " " ) . ( $p [ " null " ] ? " <label><input type='radio' $Ka value='' " . ( $Y !== null || isset ( $_GET [ " select " ]) ? " " : " checked " ) . " ><i>NULL</i></label> " : " " ) . enum_input ( " radio " , $Ka , $p , $Y , 0 ); return " " ;} function
editHint ( $Q , $p , $Y ){ return " " ;} function
processInput ( $p , $Y , $s = " " ){ if ( $s == " SQL " ) return $Y ; $C = $p [ " field " ]; $I = q ( $Y ); if ( preg_match ( '~^(now|getdate|uuid)$~' , $s )) $I = " $s () " ; elseif ( preg_match ( '~^current_(date|timestamp)$~' , $s )) $I = $s ; elseif ( preg_match ( '~^([+-]|\|\|)$~' , $s )) $I = idf_escape ( $C ) . " $s $I " ; elseif ( preg_match ( '~^[+-] interval$~' , $s )) $I = idf_escape ( $C ) . " $s " . ( preg_match ( " ~^( \\ d+|'[0-9.: -]') [A-Z_]+ \$ ~i " , $Y ) ? $Y : $I ); elseif ( preg_match ( '~^(addtime|subtime|concat)$~' , $s )) $I = " $s ( " . idf_escape ( $C ) . " , $I ) " ; elseif ( preg_match ( '~^(md5|sha1|password|encrypt)$~' , $s )) $I = " $s ( $I ) " ; return
unconvert_field ( $p , $I );} function
2018-06-30 00:38:01 +02:00
dumpOutput (){ $I = array ( 'text' => lang ( 66 ), 'file' => lang ( 67 )); if ( function_exists ( 'gzencode' )) $I [ 'gz' ] = 'gzip' ; return $I ;} function
2014-05-08 19:46:08 +02:00
dumpFormat (){ return
array ( 'sql' => 'SQL' , 'csv' => 'CSV,' , 'csv;' => 'CSV;' , 'tsv' => 'TSV' );} function
2018-12-25 21:50:48 +01:00
dumpDatabase ( $m ){} function
dumpTable ( $Q , $Jh , $be = 0 ){ if ( $_POST [ " format " ] != " sql " ){ echo " \xef \xbb \xbf " ; if ( $Jh ) dump_csv ( array_keys ( fields ( $Q )));} else { if ( $be == 2 ){ $q = array (); foreach ( fields ( $Q ) as $C => $p ) $q [] = idf_escape ( $C ) . " $p[full_type] " ; $j = " CREATE TABLE " . table ( $Q ) . " ( " . implode ( " , " , $q ) . " ) " ;} else $j = create_sql ( $Q , $_POST [ " auto_increment " ], $Jh ); set_utf8mb4 ( $j ); if ( $Jh && $j ){ if ( $Jh == " DROP+CREATE " || $be == 1 ) echo " DROP " . ( $be == 2 ? " VIEW " : " TABLE " ) . " IF EXISTS " . table ( $Q ) . " ; \n " ; if ( $be == 1 ) $j = remove_definer ( $j ); echo " $j ; \n \n " ;}}} function
dumpData ( $Q , $Jh , $G ){ global $h , $y ; $He = ( $y == " sqlite " ? 0 : 1048576 ); if ( $Jh ){ if ( $_POST [ " format " ] == " sql " ){ if ( $Jh == " TRUNCATE+INSERT " ) echo
truncate_sql ( $Q ) . " ; \n " ; $q = fields ( $Q );} $H = $h -> query ( $G , 1 ); if ( $H ){ $Ud = " " ; $Ya = " " ; $ie = array (); $Lh = " " ; $Rc = ( $Q != '' ? 'fetch_assoc' : 'fetch_row' ); while ( $J = $H -> $Rc ()){ if ( ! $ie ){ $Vi = array (); foreach ( $J
as $X ){ $p = $H -> fetch_field (); $ie [] = $p -> name ; $z = idf_escape ( $p -> name ); $Vi [] = " $z = VALUES( $z ) " ;} $Lh = ( $Jh == " INSERT+UPDATE " ? " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $Vi ) : " " ) . " ; \n " ;} if ( $_POST [ " format " ] != " sql " ){ if ( $Jh == " table " ){ dump_csv ( $ie ); $Jh = " INSERT " ;} dump_csv ( $J );} else { if ( ! $Ud ) $Ud = " INSERT INTO " . table ( $Q ) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $ie )) . " ) VALUES " ; foreach ( $J
as $z => $X ){ $p = $q [ $z ]; $J [ $z ] = ( $X !== null ? unconvert_field ( $p , preg_match ( number_type (), $p [ " type " ]) && $X != '' &&! preg_match ( '~\[~' , $p [ " full_type " ]) ? $X : q (( $X === false ? 0 : $X ))) : " NULL " );} $Zg = ( $He ? " \n " : " " ) . " ( " . implode ( " , \t " , $J ) . " ) " ; if ( ! $Ya ) $Ya = $Ud . $Zg ; elseif ( strlen ( $Ya ) + 4 + strlen ( $Zg ) + strlen ( $Lh ) < $He ) $Ya .= " , $Zg " ; else { echo $Ya . $Lh ; $Ya = $Ud . $Zg ;}}} if ( $Ya ) echo $Ya . $Lh ;} elseif ( $_POST [ " format " ] == " sql " ) echo " -- " . str_replace ( " \n " , " " , $h -> error ) . " \n " ;}} function
2018-06-30 00:38:01 +02:00
dumpFilename ( $Dd ){ return
friendly_url ( $Dd != " " ? $Dd : ( SERVER != " " ? SERVER : " localhost " ));} function
2018-12-25 21:50:48 +01:00
dumpHeaders ( $Dd , $We = false ){ $Lf = $_POST [ " output " ]; $Jc = ( preg_match ( '~sql~' , $_POST [ " format " ]) ? " sql " : ( $We ? " tar " : " csv " )); header ( " Content-Type: " . ( $Lf == " gz " ? " application/x-gzip " : ( $Jc == " tar " ? " application/x-tar " : ( $Jc == " sql " || $Lf != " file " ? " text/plain " : " text/csv " ) . " ; charset=utf-8 " ))); if ( $Lf == " gz " ) ob_start ( 'ob_gzencode' , 1e6 ); return $Jc ;} function
2018-04-01 23:34:54 +02:00
importServerPath (){ return " adminer.sql " ;} function
2018-06-30 00:38:01 +02:00
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
2018-04-01 23:34:54 +02:00
true ;} function
2018-12-25 21:50:48 +01:00
navigation ( $Ve ){ global $ia , $y , $fc , $h ; echo ' < h1 >
2018-04-01 23:34:54 +02:00
',$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 >
2014-05-08 19:46:08 +02:00
</ h1 >
2018-12-25 21:50:48 +01:00
' ; if ( $Ve == " auth " ){ $Xc = true ; foreach (( array ) $_SESSION [ " pwds " ] as $Xi => $nh ){ foreach ( $nh
as $N => $Si ){ foreach ( $Si
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 " ][ $Xi ][ $N ][ $V ]; foreach (( $Rb ? array_keys ( $Rb ) : array ( " " )) as $m ) echo " <a href=' " . h ( auth_url ( $Xi , $N , $V , $m )) . " '>( $fc[$Xi] ) " . h ( $V . ( $N != " " ? " @ " . $this -> serverName ( $N ) : " " ) . ( $m != " " ? " - $m " : " " )) . " </a><br> \n " ;}}}}} else { if ( $_GET [ " ns " ] !== " " &&! $Ve && DB != " " ){ $h -> select_db ( DB ); $S = table_status ( '' , true );} echo
script_src ( preg_replace ( " ~ \\ ?.*~ " , " " , ME ) . " ?file=jush.js&version=4.7.0 " ); if ( support ( " sql " )){ echo '<script' , nonce (), ' >
' ; if ( $S ){ $ye = array (); foreach ( $S
as $Q => $T ) $ye [] = preg_quote ( $Q , '/' ); echo " var jushLinks = { $y : [ ' " . js_escape ( ME ) . ( support ( " table " ) ? " table= " : " select= " ) . " \$ &', / \\ b( " . implode ( " | " , $ye ) . " ) \\ b/g ] }; \n " ; foreach ( array ( " bac " , " bra " , " sqlite_quo " , " mssql_bra " ) as $X ) echo " jushLinks. $X = jushLinks. $y ; \n " ;} $mh = $h -> server_info ; echo 'bodyLoad(\'' ,( is_object ( $h ) ? preg_replace ( '~^(\d\.?\d).*~s' , '\1' , $mh ) : " " ), '\'' ,( preg_match ( '~MariaDB~' , $mh ) ? " , true " : " " ), ' );
2014-05-08 19:46:08 +02:00
</ script >
2018-12-25 21:50:48 +01:00
';}$this->databasesPrint($Ve);if(DB==""||!$Ve){echo"<p class=' links '>".(support("sql")?"<a href=' " .h(ME). " sql = '".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(65)."</a>\n<a href=' " .h(ME). " import = '".bold(isset($_GET["import"])).">".lang(73)."</a>\n":"")."";if(support("dump"))echo"<a href=' " .h(ME). " dump = " .urlencode(isset( $_GET["table"] )? $_GET["table"] : $_GET["select"] ). " ' id=' dump '".bold(isset($_GET["dump"])).">".lang(74)."</a>\n";}if($_GET["ns"]!==""&&!$Ve&&DB!=""){echo' < a href = " '.h(ME).'create= " '.bold($_GET["create"]==="").">".lang(75)."</a>\n";if(!$S)echo"<p class=' message ' > " .lang(9). " \n " ;else $this->tablesPrint ( $S );}}}function
databasesPrint ( $Ve ){ global $b , $h ; $l = $this -> databases (); if ( $l &&! in_array ( DB , $l )) array_unshift ( $l , DB ); echo ' < form action = " " >
2014-05-08 19:46:08 +02:00
< p id = " dbs " >
2018-12-25 21:50:48 +01:00
';hidden_fields_get();$Pb=script("mixin(qsl(' select '), {onmousedown: dbMouseDown, onchange: dbChange});");echo"<span title=' " .lang(76). " '>".lang(77)."</span>: ".($l?"<select name=' db '>".optionlist(array(""=>"")+$l,DB)."</select>$Pb":"<input name=' db ' value=' " .h(DB). " ' autocapitalize=' off '>\n"),"<input type=' submit ' value=' " .lang(20). " '".($l?" class=' hidden '":"").">\n";if($Ve!="db"&&DB!=""&&$h->select_db(DB)){if(support("scheme")){echo"<br>".lang(78).": <select name=' ns '>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>$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 ( $S ){ echo " <ul id='tables'> " . script ( " mixin(qs('#tables'), { onmouseover: menuOver, onmouseout: menuOut}); " ); foreach ( $S
as $Q => $Fh ){ $C = $this -> tableName ( $Fh ); if ( $C != " " ){ echo '<li><a href="' . h ( ME ) . 'select=' . urlencode ( $Q ) . '"' . bold ( $_GET [ " select " ] == $Q || $_GET [ " edit " ] == $Q , " select " ) . " > " . lang ( 79 ) . " </a> " ,( support ( " table " ) || support ( " indexes " ) ? '<a href="' . h ( ME ) . 'table=' . urlencode ( $Q ) . '"' . bold ( in_array ( $Q , array ( $_GET [ " table " ], $_GET [ " create " ], $_GET [ " indexes " ], $_GET [ " foreign " ], $_GET [ " trigger " ])),( is_view ( $Fh ) ? " view " : " structure " )) . " title=' " . lang ( 43 ) . " '> $C </a> " : " <span> $C </span> " ) . " \n " ;}} echo " </ul> \n " ;}} $b = ( function_exists ( 'adminer_object' ) ? adminer_object () : new
Adminer ); if ( $b -> operators === null ) $b -> operators = $wf ; function
page_header ( $ii , $o = " " , $Xa = array (), $ji = " " ){ global $ca , $ia , $b , $fc , $y ; page_headers (); if ( is_ajax () && $o ){ page_messages ( $o ); exit ;} $ki = $ii . ( $ji != " " ? " : $ji " : " " ); $li = strip_tags ( $ki . ( SERVER != " " && SERVER != " localhost " ? h ( " - " . SERVER ) : " " ) . " - " . $b -> name ()); echo ' <! DOCTYPE html >
2018-06-30 00:38:01 +02:00
< html lang = " ', $ca ,' " dir = " ',lang(80),' " >
2014-05-08 19:46:08 +02:00
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " >
< meta name = " robots " content = " noindex " >
2018-12-25 21:50:48 +01:00
< title > ',$li,' </ title >
< link rel = " stylesheet " type = " text/css " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = default . css & version = 4.7 . 0 " ),' " >
',script_src(preg_replace("~\\?.*~","",ME)."?file=functions.js&version=4.7.0");if($b->head()){echo' < link rel = " shortcut icon " type = " image/x-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = favicon . ico & version = 4.7 . 0 " ),' " >
< link rel = " apple-touch-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = favicon . ico & version = 4.7 . 0 " ),' " >
2018-06-30 00:38:01 +02:00
';foreach($b->css()as$Jb){echo' < link rel = " stylesheet " type = " text/css " href = " ',h( $Jb ),' " >
2014-05-08 19:46:08 +02:00
';}}echo'
2018-06-30 00:38:01 +02:00
< body class = " ',lang(80),' nojs " >
2018-12-25 21:50:48 +01:00
';$Vc=get_temp_dir()."/adminer.version";if(!$_COOKIE["adminer_version"]&&function_exists(' openssl_verify ' ) && file_exists ( $Vc ) && filemtime ( $Vc ) + 86400 > time ()){ $Yi = unserialize ( file_get_contents ( $Vc )); $ug = " -----BEGIN PUBLIC KEY-----
2018-04-01 23:34:54 +02:00
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwqWOVuF5uw7 /+ Z70djoK
RlHIZFZPO0uYRezq90 + 7 Amk + FDNd7KkL5eDve + vHRJBLAszF / 7 XKXe11xwliIsFs
DFWQlsABVZB3oisKCBEuI71J4kPH8dKGEWR9jDHFw3cWmoH3PmqImX6FISWbG3B8
h7FIx3jEaw5ckVPVTeo5JRm / 1 DZzJxjyDenXvBQ / 6 o9DgZKeNDgxwKzH + sw9 / YCO
jHnq1cFpOIISzARlrHMa / 43 YfeNRAm / tsBXjSxembBPo7aQZLAWHmaj5 + K19H10B
nCpz9Y ++ cipkVEiKRGih4ZEvjoFysEOdRLj6WiD / uUNky4xGeA6LaJqh5XpkFkcQ
fQIDAQAB
----- END PUBLIC KEY -----
2018-12-25 21:50:48 +01:00
" ;if(openssl_verify( $Yi["version"] ,base64_decode( $Yi["signature"] ), $ug )==1) $_COOKIE["adminer_version"] = $Yi["version"] ;}echo'<script',nonce(),'>
2018-04-01 23:34:54 +02:00
mixin ( document . body , { onkeydown : bodyKeydown , onclick : bodyClick ',(isset($_COOKIE["adminer_version"])?"":", onload: partial(verifyVersion, ' $ia ', ' " .js_escape(ME). " ', ' " .get_token(). " ' ) " );?>});
2015-07-03 19:50:03 +02:00
document . body . className = document . body . className . replace ( / nojs / , ' js' );
var offlineMessage = ' < ? php echo
2018-06-30 00:38:01 +02:00
js_escape ( lang ( 81 )), ' \ ' ;
2018-04-01 23:34:54 +02:00
var thousandsSeparator = \ '' , js_escape ( lang ( 5 )), ' \ ' ;
2014-05-08 19:46:08 +02:00
</ script >
2018-12-25 21:50:48 +01:00
< div id = " help " class = " jush-', $y ,' jsonly hidden " ></ div >
2018-04-01 23:34:54 +02:00
',script("mixin(qs(' #help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"),'
2014-05-08 19:46:08 +02:00
< div id = " content " >
2018-12-25 21:50:48 +01:00
';if($Xa!==null){$A=substr(preg_replace(' ~ \b ( username | db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);echo' < p id = " breadcrumb " >< a href = " '.h( $A ? $A : " . " ).' " > '.$fc[DRIVER].' </ a > & raquo ; ';$A=substr(preg_replace(' ~ \b ( db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);$N=$b->serverName(SERVER);$N=($N!=""?$N:lang(35));if($Xa===false)echo"$N\n";else{echo"<a href=' " .( $A ?h( $A ): " . " ). " ' accesskey=' 1 ' title=' Alt + Shift + 1 '>$N</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Xa)))echo' < a href = " '.h( $A . " & db = " .urlencode(DB).(support( " scheme " )? " & ns = " : " " )).' " > '.h(DB).' </ a > & raquo ; ';if(is_array($Xa)){if($_GET["ns"]!="")echo' < a href = " '.h(substr(ME,0,-1)).' " > '.h($_GET["ns"]).' </ a > & raquo ; ' ; foreach ( $Xa
as $z => $X ){ $Xb = ( is_array ( $X ) ? $X [ 1 ] : h ( $X )); if ( $Xb != " " ) echo " <a href=' " . h ( ME . " $z = " ) . urlencode ( is_array ( $X ) ? $X [ 0 ] : $X ) . " '> $Xb </a> » " ;}} echo " $ii\n " ;}} echo " <h2> $ki </h2> \n " , " <div id='ajaxstatus' class='jsonly hidden'></div> \n " ; restart_session (); page_messages ( $o ); $l =& get_session ( " dbs " ); if ( DB != " " && $l &&! in_array ( DB , $l , true )) $l = null ; stop_session (); define ( " PAGE_HEADER " , 1 );} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
as $z => $X ) $xd [] = " $z $X " ; header ( " Content-Security-Policy: " . implode ( " ; " , $xd ));} $b -> headers ();} function
2018-04-01 23:34:54 +02:00
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
2018-12-25 21:50:48 +01:00
get_nonce (){ static $ff ; if ( ! $ff ) $ff = base64_encode ( rand_string ()); return $ff ;} function
page_messages ( $o ){ $Li = preg_replace ( '~^[^?]*~' , '' , $_SERVER [ " REQUEST_URI " ]); $Re = $_SESSION [ " messages " ][ $Li ]; if ( $Re ){ echo " <div class='message'> " . implode ( " </div> \n <div class='message'> " , $Re ) . " </div> " . script ( " messagesPrint(); " ); unset ( $_SESSION [ " messages " ][ $Li ]);} if ( $o ) echo " <div class='error'> $o </div> \n " ;} function
page_footer ( $Ve = " " ){ global $b , $pi ; echo ' </ div >
2014-05-08 19:46:08 +02:00
2018-12-25 21:50:48 +01:00
';switch_lang();if($Ve!="auth"){echo' < form action = " " method = " post " >
2014-05-08 19:46:08 +02:00
< p class = " logout " >
2018-06-30 00:38:01 +02:00
< input type = " submit " name = " logout " value = " ',lang(82),' " id = " logout " >
2018-12-25 21:50:48 +01:00
< input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ p >
</ form >
';}echo' < div id = " menu " >
2018-12-25 21:50:48 +01:00
';$b->navigation($Ve);echo' </ div >
2018-04-01 23:34:54 +02:00
' , script ( " setupSubmitHighlight(document); " );} function
2018-12-25 21:50:48 +01:00
int32 ( $Ye ){ while ( $Ye >= 2147483648 ) $Ye -= 4294967296 ; while ( $Ye <=- 2147483649 ) $Ye += 4294967296 ; return ( int ) $Ye ;} function
long2str ( $W , $cj ){ $Zg = '' ; foreach ( $W
as $X ) $Zg .= pack ( 'V' , $X ); if ( $cj ) return
substr ( $Zg , 0 , end ( $W )); return $Zg ;} function
str2long ( $Zg , $cj ){ $W = array_values ( unpack ( 'V*' , str_pad ( $Zg , 4 * ceil ( strlen ( $Zg ) / 4 ), " \0 " ))); if ( $cj ) $W [] = strlen ( $Zg ); return $W ;} function
xxtea_mx ( $pj , $oj , $Mh , $ee ){ return
int32 ((( $pj >> 5 & 0x7FFFFFF ) ^ $oj << 2 ) + (( $oj >> 3 & 0x1FFFFFFF ) ^ $pj << 4 )) ^ int32 (( $Mh ^ $oj ) + ( $ee ^ $pj ));} function
encrypt_string ( $Hh , $z ){ if ( $Hh == " " ) return " " ; $z = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $z )))); $W = str2long ( $Hh , true ); $Ye = count ( $W ) - 1 ; $pj = $W [ $Ye ]; $oj = $W [ 0 ]; $vg = floor ( 6 + 52 / ( $Ye + 1 )); $Mh = 0 ; while ( $vg --> 0 ){ $Mh = int32 ( $Mh + 0x9E3779B9 ); $mc = $Mh >> 2 & 3 ; for ( $Mf = 0 ; $Mf < $Ye ; $Mf ++ ){ $oj = $W [ $Mf + 1 ]; $Xe = xxtea_mx ( $pj , $oj , $Mh , $z [ $Mf & 3 ^ $mc ]); $pj = int32 ( $W [ $Mf ] + $Xe ); $W [ $Mf ] = $pj ;} $oj = $W [ 0 ]; $Xe = xxtea_mx ( $pj , $oj , $Mh , $z [ $Mf & 3 ^ $mc ]); $pj = int32 ( $W [ $Ye ] + $Xe ); $W [ $Ye ] = $pj ;} return
2014-05-08 19:46:08 +02:00
long2str ( $W , false );} function
2018-12-25 21:50:48 +01:00
decrypt_string ( $Hh , $z ){ if ( $Hh == " " ) return " " ; if ( ! $z ) return
false ; $z = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $z )))); $W = str2long ( $Hh , false ); $Ye = count ( $W ) - 1 ; $pj = $W [ $Ye ]; $oj = $W [ 0 ]; $vg = floor ( 6 + 52 / ( $Ye + 1 )); $Mh = int32 ( $vg * 0x9E3779B9 ); while ( $Mh ){ $mc = $Mh >> 2 & 3 ; for ( $Mf = $Ye ; $Mf > 0 ; $Mf -- ){ $pj = $W [ $Mf - 1 ]; $Xe = xxtea_mx ( $pj , $oj , $Mh , $z [ $Mf & 3 ^ $mc ]); $oj = int32 ( $W [ $Mf ] - $Xe ); $W [ $Mf ] = $oj ;} $pj = $W [ $Ye ]; $Xe = xxtea_mx ( $pj , $oj , $Mh , $z [ $Mf & 3 ^ $mc ]); $oj = int32 ( $W [ 0 ] - $Xe ); $W [ 0 ] = $oj ; $Mh = int32 ( $Mh - 0x9E3779B9 );} return
long2str ( $W , true );} $h = '' ; $wd = $_SESSION [ " token " ]; if ( ! $wd ) $_SESSION [ " token " ] = rand ( 1 , 1e6 ); $pi = get_token (); $cg = array (); if ( $_COOKIE [ " adminer_permanent " ]){ foreach ( explode ( " " , $_COOKIE [ " adminer_permanent " ]) as $X ){ list ( $z ) = explode ( " : " , $X ); $cg [ $z ] = $X ;}} function
add_invalid_login (){ global $b ; $jd = file_open_lock ( get_temp_dir () . " /adminer.invalid " ); if ( ! $jd ) return ; $Xd = unserialize ( stream_get_contents ( $jd )); $fi = time (); if ( $Xd ){ foreach ( $Xd
as $Yd => $X ){ if ( $X [ 0 ] < $fi ) unset ( $Xd [ $Yd ]);}} $Wd =& $Xd [ $b -> bruteForceKey ()]; if ( ! $Wd ) $Wd = array ( $fi + 30 * 60 , 0 ); $Wd [ 1 ] ++ ; file_write_unlock ( $jd , serialize ( $Xd ));} function
check_invalid_login (){ global $b ; $Xd = unserialize ( @ file_get_contents ( get_temp_dir () . " /adminer.invalid " )); $Wd = $Xd [ $b -> bruteForceKey ()]; $ef = ( $Wd [ 1 ] > 29 ? $Wd [ 0 ] - time () : 0 ); if ( $ef > 0 ) auth_error ( lang ( 83 , ceil ( $ef / 60 )));} $La = $_POST [ " auth " ]; if ( $La ){ session_regenerate_id (); $Xi = $La [ " driver " ]; $N = $La [ " server " ]; $V = $La [ " username " ]; $F = ( string ) $La [ " password " ]; $m = $La [ " db " ]; set_password ( $Xi , $N , $V , $F ); $_SESSION [ " db " ][ $Xi ][ $N ][ $V ][ $m ] = true ; if ( $La [ " permanent " ]){ $z = base64_encode ( $Xi ) . " - " . base64_encode ( $N ) . " - " . base64_encode ( $V ) . " - " . base64_encode ( $m ); $og = $b -> permanentLogin ( true ); $cg [ $z ] = " $z : " . base64_encode ( $og ? encrypt_string ( $F , $og ) : " " ); cookie ( " adminer_permanent " , implode ( " " , $cg ));} if ( count ( $_POST ) == 1 || DRIVER != $Xi || SERVER != $N || $_GET [ " username " ] !== $V || DB != $m ) redirect ( auth_url ( $Xi , $N , $V , $m ));} elseif ( $_POST [ " logout " ]){ if ( $wd &&! verify_token ()){ page_header ( lang ( 82 ), lang ( 84 )); page_footer ( " db " ); exit ;} else { foreach ( array ( " pwds " , " db " , " dbs " , " queries " ) as $z ) set_session ( $z , null ); unset_permanent (); redirect ( substr ( preg_replace ( '~\b(username|db|ns)=[^&]*&~' , '' , ME ), 0 , - 1 ), lang ( 85 ) . ' ' . lang ( 86 ));}} elseif ( $cg &&! $_SESSION [ " pwds " ]){ session_regenerate_id (); $og = $b -> permanentLogin (); foreach ( $cg
as $z => $X ){ list (, $jb ) = explode ( " : " , $X ); list ( $Xi , $N , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $z )); set_password ( $Xi , $N , $V , decrypt_string ( base64_decode ( $jb ), $og )); $_SESSION [ " db " ][ $Xi ][ $N ][ $V ][ $m ] = true ;}} function
unset_permanent (){ global $cg ; foreach ( $cg
as $z => $X ){ list ( $Xi , $N , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $z )); if ( $Xi == DRIVER && $N == SERVER && $V == $_GET [ " username " ] && $m == DB ) unset ( $cg [ $z ]);} cookie ( " adminer_permanent " , implode ( " " , $cg ));} function
auth_error ( $o ){ global $b , $wd ; $oh = session_name (); if ( isset ( $_GET [ " username " ])){ header ( " HTTP/1.1 403 Forbidden " ); if (( $_COOKIE [ $oh ] || $_GET [ $oh ]) &&! $wd ) $o = lang ( 87 ); else { restart_session (); add_invalid_login (); $F = get_password (); if ( $F !== null ){ if ( $F === false ) $o .= '<br>' . lang ( 88 , target_blank (), '<code>permanentLogin()</code>' ); set_password ( DRIVER , SERVER , $_GET [ " username " ], null );} unset_permanent ();}} if ( ! $_COOKIE [ $oh ] && $_GET [ $oh ] && ini_bool ( " session.use_only_cookies " )) $o = lang ( 89 ); $Pf = session_get_cookie_params (); cookie ( " adminer_key " ,( $_COOKIE [ " adminer_key " ] ? $_COOKIE [ " adminer_key " ] : rand_string ()), $Pf [ " lifetime " ]); page_header ( lang ( 39 ), $o , null ); echo " <form action='' method='post'> \n " , " <div> " ; if ( hidden_fields ( $_POST , array ( " auth " ))) echo " <p class='message'> " . lang ( 90 ) . " \n " ; echo " </div> \n " ; $b -> loginForm (); echo " </form> \n " ; page_footer ( " auth " ); exit ;} if ( isset ( $_GET [ " username " ]) &&! class_exists ( " Min_DB " )){ unset ( $_SESSION [ " pwds " ][ DRIVER ]); unset_permanent (); page_header ( lang ( 91 ), lang ( 92 , implode ( " , " , $ig )), false ); page_footer ( " auth " ); exit ;} stop_session ( true ); if ( isset ( $_GET [ " username " ])){ list ( $Bd , $eg ) = explode ( " : " , SERVER , 2 ); if ( is_numeric ( $eg ) && $eg < 1024 ) auth_error ( lang ( 93 )); check_invalid_login (); $h = connect (); $n = new
Min_Driver ( $h );} $_e = null ; if ( ! is_object ( $h ) || ( $_e = $b -> login ( $_GET [ " username " ], get_password ())) !== true ){ $o = ( is_string ( $h ) ? h ( $h ) : ( is_string ( $_e ) ? $_e : lang ( 94 ))); auth_error ( $o . ( preg_match ( '~^ | $~' , get_password ()) ? '<br>' . lang ( 95 ) : '' ));} if ( $La && $_POST [ " token " ]) $_POST [ " token " ] = $pi ; $o = '' ; if ( $_POST ){ if ( ! verify_token ()){ $Rd = " max_input_vars " ; $Le = ini_get ( $Rd ); if ( extension_loaded ( " suhosin " )){ foreach ( array ( " suhosin.request.max_vars " , " suhosin.post.max_vars " ) as $z ){ $X = ini_get ( $z ); if ( $X && ( ! $Le || $X < $Le )){ $Rd = $z ; $Le = $X ;}}} $o = ( ! $_POST [ " token " ] && $Le ? lang ( 96 , " ' $Rd ' " ) : lang ( 84 ) . ' ' . lang ( 97 ));}} elseif ( $_SERVER [ " REQUEST_METHOD " ] == " POST " ){ $o = lang ( 98 , " 'post_max_size' " ); if ( isset ( $_GET [ " sql " ])) $o .= ' ' . lang ( 99 );} function
select ( $H , $i = null , $Df = array (), $_ = 0 ){ global $y ; $ye = array (); $x = array (); $f = array (); $Ua = array (); $U = array (); $I = array (); odd ( '' ); for ( $t = 0 ;( ! $_ || $t < $_ ) && ( $J = $H -> fetch_row ()); $t ++ ){ if ( ! $t ){ echo " <div class='scrollable'> \n " , " <table cellspacing='0' class='nowrap'> \n " , " <thead><tr> " ; for ( $de = 0 ; $de < count ( $J ); $de ++ ){ $p = $H -> fetch_field (); $C = $p -> name ; $Cf = $p -> orgtable ; $Bf = $p -> orgname ; $I [ $p -> table ] = $Cf ; if ( $Df && $y == " sql " ) $ye [ $de ] = ( $C == " table " ? " table= " : ( $C == " possible_keys " ? " indexes= " : null )); elseif ( $Cf != " " ){ if ( ! isset ( $x [ $Cf ])){ $x [ $Cf ] = array (); foreach ( indexes ( $Cf , $i ) as $w ){ if ( $w [ " type " ] == " PRIMARY " ){ $x [ $Cf ] = array_flip ( $w [ " columns " ]); break ;}} $f [ $Cf ] = $x [ $Cf ];} if ( isset ( $f [ $Cf ][ $Bf ])){ unset ( $f [ $Cf ][ $Bf ]); $x [ $Cf ][ $Bf ] = $de ; $ye [ $de ] = $Cf ;}} if ( $p -> charsetnr == 63 ) $Ua [ $de ] = true ; $U [ $de ] = $p -> type ; echo " <th " . ( $Cf != " " || $p -> name != $Bf ? " title=' " . h (( $Cf != " " ? " $Cf . " : " " ) . $Bf ) . " ' " : " " ) . " > " . h ( $C ) . ( $Df ? 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 $z => $X ){ if ( $X === null ) $X = " <i>NULL</i> " ; elseif ( $Ua [ $z ] &&! is_utf8 ( $X )) $X = " <i> " . lang ( 48 , strlen ( $X )) . " </i> " ; else { $X = h ( $X ); if ( $U [ $z ] == 254 ) $X = " <code> $X </code> " ;} if ( isset ( $ye [ $z ]) &&! $f [ $ye [ $z ]]){ if ( $Df && $y == " sql " ){ $Q = $J [ array_search ( " table= " , $ye )]; $A = $ye [ $z ] . urlencode ( $Df [ $Q ] != " " ? $Df [ $Q ] : $Q );} else { $A = " edit= " . urlencode ( $ye [ $z ]); foreach ( $x [ $ye [ $z ]] as $nb => $de ) $A .= " &where " . urlencode ( " [ " . bracket_escape ( $nb ) . " ] " ) . " = " . urlencode ( $J [ $de ]);} $X = " <a href=' " . h ( ME . $A ) . " '> $X </a> " ;} echo " <td> $X " ;}} echo ( $t ? " </table> \n </div> " : " <p class='message'> " . lang ( 12 )) . " \n " ; return $I ;} function
referencable_primary ( $ih ){ $I = array (); foreach ( table_status ( '' , true ) as $Qh => $Q ){ if ( $Qh != $ih && fk_support ( $Q )){ foreach ( fields ( $Qh ) as $p ){ if ( $p [ " primary " ]){ if ( $I [ $Qh ]){ unset ( $I [ $Qh ]); break ;} $I [ $Qh ] = $p ;}}}} return $I ;} function
textarea ( $C , $Y , $K = 10 , $rb = 80 ){ global $y ; echo " <textarea name=' $C ' rows=' $K ' cols=' $rb ' class='sqlarea jush- $y ' spellcheck='false' wrap='off'> " ; if ( is_array ( $Y )){ foreach ( $Y
2014-05-08 19:46:08 +02:00
as $X ) echo
h ( $X [ 0 ]) . " \n \n \n " ;} else
echo
h ( $Y ); echo " </textarea> " ;} function
2018-12-25 21:50:48 +01:00
edit_type ( $z , $p , $pb , $fd = array (), $Mc = array ()){ global $Ih , $U , $Ji , $rf ; $T = $p [ " type " ]; echo '<td><select name="' , h ( $z ), '[type]" class="type" aria-labelledby="label-type">' ; if ( $T &&! isset ( $U [ $T ]) &&! isset ( $fd [ $T ]) &&! in_array ( $T , $Mc )) $Mc [] = $T ; if ( $fd ) $Ih [ lang ( 100 )] = $fd ; echo
optionlist ( array_merge ( $Mc , $Ih ), $T ), ' </ select >
',on_help("getTarget(event).value",1),script("mixin(qsl(' select '), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});",""),' < td >< input name = " ',h( $z ),'[length] " value = " ',h( $p["length"] ),' " size = " 3 " ',(!$p["length"]&&preg_match(' ~ var ( char | binary ) $ ~ ',$T)?" class=' required '":"");echo' aria - labelledby = " label-length " > ',script("mixin(qsl(' input '), {onfocus: editingLengthFocus, oninput: editingLengthChange});",""),' < td class = " options " > ',"<select name=' " .h( $z ). " [ collation ] '".(preg_match(' ~ ( char | text | enum | set ) $ ~ ',$T)?"":" class=' hidden '").' >< option value = " " > ( '.lang(101).' ) '.optionlist($pb,$p["collation"]).' </ select > ',($Ji?"<select name=' " .h( $z ). " [ unsigned ] '".(!$T||preg_match(number_type(),$T)?"":" class=' hidden '").' >< option > '.optionlist($Ji,$p["unsigned"]).' </ select > ':' '),(isset($p[' on_update '])?"<select name=' " .h( $z ). " [ on_update ] '".(preg_match(' ~ timestamp | datetime ~ ',$T)?"":" class=' hidden '").' > '.optionlist(array(""=>"(".lang(102).")","CURRENT_TIMESTAMP"),(preg_match(' ~^ CURRENT_TIMESTAMP ~ i ',$p["on_update"])?"CURRENT_TIMESTAMP":$p["on_update"])).' </ select > ':' '),($fd?"<select name=' " .h( $z ). " [ on_delete ] '".(preg_match("~`~",$T)?"":" class=' hidden '")."><option value=' ' > ( " .lang(103). " ) " .optionlist(explode( " | " , $rf ), $p["on_delete"] ). " </ select > " : " " );}function
process_length ( $ve ){ global $xc ; return ( preg_match ( " ~^ \\ s* \\ (? \\ s* $xc (?: \\ s*, \\ s* $xc )*+ \\ s* \\ )? \\ s* \$ ~ " , $ve ) && preg_match_all ( " ~ $xc ~ " , $ve , $Fe ) ? " ( " . implode ( " , " , $Fe [ 0 ]) . " ) " : preg_replace ( '~^[0-9].*~' , '(\0)' , preg_replace ( '~[^-0-9,+()[\]]~' , '' , $ve )));} function
process_type ( $p , $ob = " COLLATE " ){ global $Ji ; return " $p[type] " . process_length ( $p [ " length " ]) . ( preg_match ( number_type (), $p [ " type " ]) && in_array ( $p [ " unsigned " ], $Ji ) ? " $p[unsigned] " : " " ) . ( preg_match ( '~char|text|enum|set~' , $p [ " type " ]) && $p [ " collation " ] ? " $ob " . q ( $p [ " collation " ]) : " " );} function
process_field ( $p , $Bi ){ return
array ( idf_escape ( trim ( $p [ " field " ])), process_type ( $Bi ),( $p [ " null " ] ? " NULL " : " NOT NULL " ), default_value ( $p ),( preg_match ( '~timestamp|datetime~' , $p [ " type " ]) && $p [ " on_update " ] ? " ON UPDATE $p[on_update] " : " " ),( support ( " comment " ) && $p [ " comment " ] != " " ? " COMMENT " . q ( $p [ " comment " ]) : " " ),( $p [ " auto_increment " ] ? auto_increment () : null ),);} function
default_value ( $p ){ $Tb = $p [ " default " ]; return ( $Tb === null ? " " : " DEFAULT " . ( preg_match ( '~char|binary|text|enum|set~' , $p [ " type " ]) || preg_match ( '~^(?![a-z])~i' , $Tb ) ? q ( $Tb ) : $Tb ));} function
type_class ( $T ){ foreach ( array ( 'char' => 'text' , 'date' => 'time|year' , 'binary' => 'blob' , 'enum' => 'set' ,) as $z => $X ){ if ( preg_match ( " ~ $z | $X ~ " , $T )) return " class=' $z ' " ;}} function
edit_fields ( $q , $pb , $T = " TABLE " , $fd = array (), $vb = false ){ global $Sd ; $q = array_values ( $q ); echo ' < thead >< tr >
';if($T=="PROCEDURE"){echo' < td > ';}echo' < th id = " label-name " > ',($T=="TABLE"?lang(104):lang(105)),' < td id = " label-type " > ',lang(50),' < textarea id = " enum-edit " rows = " 4 " cols = " 12 " wrap = " off " style = " display: none; " ></ textarea > ',script("qs(' #enum-edit').onblur = editingLengthBlur;"),'<td id="label-length">',lang(106),'<td>',lang(107);if($T=="TABLE"){echo'<td id="label-null">NULL
< td >< input type = " radio " name = " auto_increment_col " value = " " >< acronym id = " label-ai " title = " ',lang(52),' " > AI </ acronym > ',doc_link(array(' sql '=>"example-auto-increment.html",' mariadb '=>"auto_increment/",' sqlite '=>"autoinc.html",' pgsql '=>"datatype.html#DATATYPE-SERIAL",' mssql '=>"ms186775.aspx",)),' < td id = " label-default " > ',lang(53),(support("comment")?"<td id=' label - comment '".($vb?"":" class=' hidden '").">".lang(51):"");}echo' < td > ',"<input type=' image ' class=' icon ' name=' add [ " .(support( " move_col " )?0:count( $q )). " ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = plus . gif & version = 4.7 . 0 " ). " ' alt=' + ' title=' " .lang(108). " '>".script("row_count = ".count($q).";"),' </ thead >
2018-04-01 23:34:54 +02:00
< tbody >
2018-12-25 21:50:48 +01:00
',script("mixin(qsl(' tbody ' ), { onclick : editingClick , onkeydown : editingKeydown , oninput : editingInput }); " );foreach( $q
as $t => $p ){ $t ++ ; $Ef = $p [( $_POST ? " orig " : " field " )]; $bc = ( isset ( $_POST [ " add " ][ $t - 1 ]) || ( isset ( $p [ " field " ]) &&! $_POST [ " drop_col " ][ $t ])) && ( support ( " drop_col " ) || $Ef == " " ); echo '<tr' ,( $bc ? " " : " style='display: none;' " ), ' >
',($T=="PROCEDURE"?"<td>".html_select("fields[$t][inout]",explode("|",$Sd),$p["inout"]):""),' < th > ';if($bc){echo' < input name = " fields[', $t ,'][field] " value = " ',h( $p["field"] ),' " data - maxlength = " 64 " autocapitalize = " off " aria - labelledby = " label-name " > ',script("qsl(' input ').oninput = function () { editingNameChange.call(this);".($p["field"]!=""||count($q)>1?"":" editingAddRow.call(this);")." };","");}echo' < input type = " hidden " name = " fields[', $t ,'][orig] " value = " ',h( $Ef ),' " >
';edit_type("fields[$t]",$p,$pb,$fd);if($T=="TABLE"){echo' < td > ',checkbox("fields[$t][null]",1,$p["null"],"","","block","label-null"),' < td >< label class = " block " >< input type = " radio " name = " auto_increment_col " value = " ', $t ,' " ';if($p["auto_increment"]){echo' checked ';}echo' aria - labelledby = " label-ai " ></ label >< td > ',checkbox("fields[$t][has_default]",1,$p["has_default"],"","","","label-default"),' < input name = " fields[', $t ,'][default] " value = " ',h( $p["default"] ),' " aria - labelledby = " label-default " > ',(support("comment")?"<td".($vb?"":" class=' hidden '")."><input name=' fields [ $t ][ comment ] ' value=' " .h( $p["comment"] ). " ' data-maxlength=' " .(min_version(5.5)?1024:255). " ' aria-labelledby=' label - comment '>":"");}echo"<td>",(support("move_col")?"<input type=' image ' class=' icon ' name=' add [ $t ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = plus . gif & version = 4.7 . 0 " ). " ' alt=' + ' title=' " .lang(108). " '> "."<input type=' image ' class=' icon ' name=' up [ $t ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = up . gif & version = 4.7 . 0 " ). " ' alt=' ↑ ' title=' " .lang(109). " '> "."<input type=' image ' class=' icon ' name=' down [ $t ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = down . gif & version = 4.7 . 0 " ). " ' alt=' ↓ ' title=' " .lang(110). " '> ":""),($Ef==""||support("drop_col")?"<input type=' image ' class=' icon ' name=' drop_col [ $t ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = cross . gif & version = 4.7 . 0 " ). " ' alt=' x ' title=' " .lang(111). " ' > " : " " );}}function
process_fields ( & $q ){ $D = 0 ; if ( $_POST [ " up " ]){ $pe = 0 ; foreach ( $q
as $z => $p ){ if ( key ( $_POST [ " up " ]) == $z ){ unset ( $q [ $z ]); array_splice ( $q , $pe , 0 , array ( $p )); break ;} if ( isset ( $p [ " field " ])) $pe = $D ; $D ++ ;}} elseif ( $_POST [ " down " ]){ $hd = false ; foreach ( $q
as $z => $p ){ if ( isset ( $p [ " field " ]) && $hd ){ unset ( $q [ key ( $_POST [ " down " ])]); array_splice ( $q , $D , 0 , array ( $hd )); break ;} if ( key ( $_POST [ " down " ]) == $z ) $hd = $p ; $D ++ ;}} elseif ( $_POST [ " add " ]){ $q = array_values ( $q ); array_splice ( $q , key ( $_POST [ " add " ]), 0 , array ( array ()));} elseif ( ! $_POST [ " drop_col " ]) return
2014-05-08 19:46:08 +02:00
false ; return
true ;} function
2018-06-30 00:38:01 +02:00
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
2018-12-25 21:50:48 +01:00
grant ( $md , $qg , $f , $qf ){ if ( ! $qg ) return
true ; if ( $qg == array ( " ALL PRIVILEGES " , " GRANT OPTION " )) return ( $md == " GRANT " ? queries ( " $md ALL PRIVILEGES $qf WITH GRANT OPTION " ) : queries ( " $md ALL PRIVILEGES $qf " ) && queries ( " $md GRANT OPTION $qf " )); return
queries ( " $md " . preg_replace ( '~(GRANT OPTION)\([^)]*\)~' , '\1' , implode ( " $f , " , $qg ) . $f ) . $qf );} function
drop_create ( $gc , $j , $hc , $ci , $jc , $ze , $Qe , $Oe , $Pe , $nf , $bf ){ if ( $_POST [ " drop " ]) query_redirect ( $gc , $ze , $Qe ); elseif ( $nf == " " ) query_redirect ( $j , $ze , $Pe ); elseif ( $nf != $bf ){ $Gb = queries ( $j ); queries_redirect ( $ze , $Oe , $Gb && queries ( $gc )); if ( $Gb ) queries ( $hc );} else
queries_redirect ( $ze , $Oe , queries ( $ci ) && queries ( $jc ) && queries ( $gc ) && queries ( $j ));} function
create_trigger ( $qf , $J ){ global $y ; $hi = " $J[Timing] $J[Event] " . ( $J [ " Event " ] == " UPDATE OF " ? " " . idf_escape ( $J [ " Of " ]) : " " ); return " CREATE TRIGGER " . idf_escape ( $J [ " Trigger " ]) . ( $y == " mssql " ? $qf . $hi : $hi . $qf ) . rtrim ( " $J[Type] \n $J[Statement] " , " ; " ) . " ; " ;} function
create_routine ( $Vg , $J ){ global $Sd , $y ; $O = array (); $q = ( array ) $J [ " fields " ]; ksort ( $q ); foreach ( $q
as $p ){ if ( $p [ " field " ] != " " ) $O [] = ( preg_match ( " ~^( $Sd ) \$ ~ " , $p [ " inout " ]) ? " $p[inout] " : " " ) . idf_escape ( $p [ " field " ]) . process_type ( $p , " CHARACTER SET " );} $Ub = rtrim ( " \n $J[definition] " , " ; " ); return " CREATE $Vg " . idf_escape ( trim ( $J [ " name " ])) . " ( " . implode ( " , " , $O ) . " ) " . ( isset ( $_GET [ " function " ]) ? " RETURNS " . process_type ( $J [ " returns " ], " CHARACTER SET " ) : " " ) . ( $J [ " language " ] ? " LANGUAGE $J[language] " : " " ) . ( $y == " pgsql " ? " AS " . q ( $Ub ) : " $Ub ; " );} function
2018-06-30 00:38:01 +02:00
remove_definer ( $G ){ return
preg_replace ( '~^([A-Z =]+) DEFINER=`' . preg_replace ( '~@(.*)~' , '`@`(%|\1)' , logged_user ()) . '`~' , '\1' , $G );} function
2018-12-25 21:50:48 +01:00
format_foreign_key ( $r ){ global $rf ; return " FOREIGN KEY ( " . implode ( " , " , array_map ( 'idf_escape' , $r [ " source " ])) . " ) REFERENCES " . table ( $r [ " table " ]) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $r [ " target " ])) . " ) " . ( preg_match ( " ~^( $rf ) \$ ~ " , $r [ " on_delete " ]) ? " ON DELETE $r[on_delete] " : " " ) . ( preg_match ( " ~^( $rf ) \$ ~ " , $r [ " on_update " ]) ? " ON UPDATE $r[on_update] " : " " );} function
tar_file ( $Vc , $mi ){ $I = pack ( " a100a8a8a8a12a12 " , $Vc , 644 , 0 , 0 , decoct ( $mi -> size ), decoct ( time ())); $hb = 8 * 32 ; for ( $t = 0 ; $t < strlen ( $I ); $t ++ ) $hb += ord ( $I [ $t ]); $I .= sprintf ( " %06o " , $hb ) . " \0 " ; echo $I , str_repeat ( " \0 " , 512 - strlen ( $I )); $mi -> send (); echo
str_repeat ( " \0 " , 511 - ( $mi -> size + 511 ) % 512 );} function
ini_bytes ( $Rd ){ $X = ini_get ( $Rd ); switch ( strtolower ( substr ( $X , - 1 ))){ case 'g' : $X *= 1024 ; case 'm' : $X *= 1024 ; case 'k' : $X *= 1024 ;} return $X ;} function
doc_link ( $ag , $di = " <sup>?</sup> " ){ global $y , $h ; $mh = $h -> server_info ; $Yi = preg_replace ( '~^(\d\.?\d).*~s' , '\1' , $mh ); $Oi = array ( 'sql' => " https://dev.mysql.com/doc/refman/ $Yi /en/ " , 'sqlite' => " https://www.sqlite.org/ " , 'pgsql' => " https://www.postgresql.org/docs/ $Yi /static/ " , 'mssql' => " https://msdn.microsoft.com/library/ " , 'oracle' => " https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/ " ,); if ( preg_match ( '~MariaDB~' , $mh )){ $Oi [ 'sql' ] = " https://mariadb.com/kb/en/library/ " ; $ag [ 'sql' ] = ( isset ( $ag [ 'mariadb' ]) ? $ag [ 'mariadb' ] : str_replace ( " .html " , " / " , $ag [ 'sql' ]));} return ( $ag [ $y ] ? " <a href=' $Oi[$y] $ag[$y] ' " . target_blank () . " > $di </a> " : " " );} function
ob_gzencode ( $P ){ return
gzencode ( $P );} function
db_size ( $m ){ global $h ; if ( ! $h -> select_db ( $m )) return " ? " ; $I = 0 ; foreach ( table_status () as $R ) $I += $R [ " Data_length " ] + $R [ " Index_length " ]; return
2018-06-30 00:38:01 +02:00
format_number ( $I );} function
2018-12-25 21:50:48 +01:00
set_utf8mb4 ( $j ){ global $h ; static $O = false ; if ( ! $O && preg_match ( '~\butf8mb4~i' , $j )){ $O = true ; echo " SET NAMES " . charset ( $h ) . " ; \n \n " ;}} function
connect_error (){ global $b , $h , $pi , $o , $fc ; if ( DB != " " ){ header ( " HTTP/1.1 404 Not Found " ); page_header ( lang ( 38 ) . " : " . h ( DB ), lang ( 112 ), true );} else { if ( $_POST [ " db " ] &&! $o ) queries_redirect ( substr ( ME , 0 , - 1 ), lang ( 113 ), drop_databases ( $_POST [ " db " ])); page_header ( lang ( 114 ), $o , false ); echo " <p class='links'> \n " ; foreach ( array ( 'database' => lang ( 115 ), 'privileges' => lang ( 72 ), 'processlist' => lang ( 116 ), 'variables' => lang ( 117 ), 'status' => lang ( 118 ),) as $z => $X ){ if ( support ( $z )) echo " <a href=' " . h ( ME ) . " $z ='> $X </a> \n " ;} echo " <p> " . lang ( 119 , $fc [ DRIVER ], " <b> " . h ( $h -> server_info ) . " </b> " , " <b> $h->extension </b> " ) . " \n " , " <p> " . lang ( 120 , " <b> " . h ( logged_user ()) . " </b> " ) . " \n " ; $l = $b -> databases (); if ( $l ){ $ch = support ( " scheme " ); $pb = collations (); echo " <form action='' method='post'> \n " , " <table cellspacing='0' class='checkable'> \n " , script ( " mixin(qsl('table'), { onclick: tableClick, ondblclick: partialArg(tableClick, true)}); " ), " <thead><tr> " . ( support ( " database " ) ? " <td> " : " " ) . " <th> " . lang ( 38 ) . " - <a href=' " . h ( ME ) . " refresh=1'> " . lang ( 121 ) . " </a> " . " <td> " . lang ( 122 ) . " <td> " . lang ( 123 ) . " <td> " . lang ( 124 ) . " - <a href=' " . h ( ME ) . " dbsize=1'> " . lang ( 125 ) . " </a> " . script ( " qsl('a').onclick = partial(ajaxSetHtml, ' " . js_escape ( ME ) . " script=connect'); " , " " ) . " </thead> \n " ; $l = ( $_GET [ " dbsize " ] ? count_tables ( $l ) : array_flip ( $l )); foreach ( $l
as $m => $S ){ $Ug = h ( ME ) . " db= " . urlencode ( $m ); $u = h ( " Db- " . $m ); echo " <tr " . odd () . " > " . ( support ( " database " ) ? " <td> " . checkbox ( " db[] " , $m , in_array ( $m ,( array ) $_POST [ " db " ]), " " , " " , " " , $u ) : " " ), " <th><a href=' $Ug ' id=' $u '> " . h ( $m ) . " </a> " ; $d = h ( db_collation ( $m , $pb )); echo " <td> " . ( support ( " database " ) ? " <a href=' $Ug " . ( $ch ? " &ns= " : " " ) . " &database=' title=' " . lang ( 68 ) . " '> $d </a> " : $d ), " <td align='right'><a href=' $Ug &schema=' id='tables- " . h ( $m ) . " ' title=' " . lang ( 71 ) . " '> " . ( $_GET [ " dbsize " ] ? $S : " ? " ) . " </a> " , " <td align='right' id='size- " . h ( $m ) . " '> " . ( $_GET [ " dbsize " ] ? db_size ( $m ) : " ? " ), " \n " ;} echo " </table> \n " ,( support ( " database " ) ? " <div class='footer'><div> \n " . " <fieldset><legend> " . lang ( 126 ) . " <span id='selected'></span></legend><div> \n " . " <input type='hidden' name='all' value=''> " . script ( " qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^db/)); }; " ) . " <input type='submit' name='drop' value=' " . lang ( 127 ) . " '> " . confirm () . " \n " . " </div></fieldset> \n " . " </div></div> \n " : " " ), " <input type='hidden' name='token' value=' $pi '> \n " , " </form> \n " , script ( " tableCheck(); " );}} page_footer ( " db " );} if ( isset ( $_GET [ " status " ])) $_GET [ " variables " ] = $_GET [ " status " ]; if ( isset ( $_GET [ " import " ])) $_GET [ " sql " ] = $_GET [ " import " ]; if ( ! ( DB != " " ? $h -> select_db ( DB ) : isset ( $_GET [ " sql " ]) || isset ( $_GET [ " dump " ]) || isset ( $_GET [ " database " ]) || isset ( $_GET [ " processlist " ]) || isset ( $_GET [ " privileges " ]) || isset ( $_GET [ " user " ]) || isset ( $_GET [ " variables " ]) || $_GET [ " script " ] == " connect " || $_GET [ " script " ] == " kill " )){ if ( DB != " " || $_GET [ " refresh " ]){ restart_session (); set_session ( " dbs " , null );} connect_error (); exit ;} if ( support ( " scheme " ) && DB != " " && $_GET [ " ns " ] !== " " ){ if ( ! isset ( $_GET [ " ns " ])) redirect ( preg_replace ( '~ns=[^&]*&~' , '' , ME ) . " ns= " . get_schema ()); if ( ! set_schema ( $_GET [ " ns " ])){ header ( " HTTP/1.1 404 Not Found " ); page_header ( lang ( 78 ) . " : " . h ( $_GET [ " ns " ]), lang ( 128 ), true ); page_footer ( " ns " ); exit ;}} $rf = " RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT " ; class
2014-05-08 19:46:08 +02:00
TmpFile { var $handler ; var $size ; function
2017-06-25 00:56:50 +02:00
__construct (){ $this -> handler = tmpfile ();} function
2018-04-01 23:34:54 +02:00
write ( $Ab ){ $this -> size += strlen ( $Ab ); fwrite ( $this -> handler , $Ab );} function
2018-12-25 21:50:48 +01:00
send (){ fseek ( $this -> handler , 0 ); fpassthru ( $this -> handler ); fclose ( $this -> handler );}} $xc = " '(?:''|[^' \\ \\ ]| \\ \\ .)*' " ; $Sd = " IN|OUT|INOUT " ; if ( isset ( $_GET [ " select " ]) && ( $_POST [ " edit " ] || $_POST [ " clone " ]) &&! $_POST [ " save " ]) $_GET [ " edit " ] = $_GET [ " select " ]; if ( isset ( $_GET [ " callf " ])) $_GET [ " call " ] = $_GET [ " callf " ]; if ( isset ( $_GET [ " function " ])) $_GET [ " procedure " ] = $_GET [ " function " ]; if ( isset ( $_GET [ " download " ])){ $a = $_GET [ " download " ]; $q = fields ( $a ); header ( " Content-Type: application/octet-stream " ); header ( " Content-Disposition: attachment; filename= " . friendly_url ( " $a - " . implode ( " _ " , $_GET [ " where " ])) . " . " . friendly_url ( $_GET [ " field " ])); $L = array ( idf_escape ( $_GET [ " field " ])); $H = $n -> select ( $a , $L , array ( where ( $_GET , $q )), $L ); $J = ( $H ? $H -> fetch_row () : array ()); echo $n -> value ( $J [ 0 ], $q [ $_GET [ " field " ]]); exit ;} elseif ( isset ( $_GET [ " table " ])){ $a = $_GET [ " table " ]; $q = fields ( $a ); if ( ! $q ) $o = error (); $R = table_status1 ( $a , true ); $C = $b -> tableName ( $R ); page_header (( $q && is_view ( $R ) ? $R [ 'Engine' ] == 'materialized view' ? lang ( 129 ) : lang ( 130 ) : lang ( 131 )) . " : " . ( $C != " " ? $C : h ( $a )), $o ); $b -> selectLinks ( $R ); $ub = $R [ " Comment " ]; if ( $ub != " " ) echo " <p class='nowrap'> " . lang ( 51 ) . " : " . h ( $ub ) . " \n " ; if ( $q ) $b -> tableStructurePrint ( $q ); if ( ! is_view ( $R )){ if ( support ( " indexes " )){ echo " <h3 id='indexes'> " . lang ( 132 ) . " </h3> \n " ; $x = indexes ( $a ); if ( $x ) $b -> tableIndexesPrint ( $x ); echo '<p class="links"><a href="' . h ( ME ) . 'indexes=' . urlencode ( $a ) . '">' . lang ( 133 ) . " </a> \n " ;} if ( fk_support ( $R )){ echo " <h3 id='foreign-keys'> " . lang ( 100 ) . " </h3> \n " ; $fd = foreign_keys ( $a ); if ( $fd ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 134 ) . " <td> " . lang ( 135 ) . " <td> " . lang ( 103 ) . " <td> " . lang ( 102 ) . " <td></thead> \n " ; foreach ( $fd
as $C => $r ){ echo " <tr title=' " . h ( $C ) . " '> " , " <th><i> " . implode ( " </i>, <i> " , array_map ( 'h' , $r [ " source " ])) . " </i> " , " <td><a href=' " . h ( $r [ " db " ] != " " ? preg_replace ( '~db=[^&]*~' , " db= " . urlencode ( $r [ " db " ]), ME ) : ( $r [ " ns " ] != " " ? preg_replace ( '~ns=[^&]*~' , " ns= " . urlencode ( $r [ " ns " ]), ME ) : ME )) . " table= " . urlencode ( $r [ " table " ]) . " '> " . ( $r [ " db " ] != " " ? " <b> " . h ( $r [ " db " ]) . " </b>. " : " " ) . ( $r [ " ns " ] != " " ? " <b> " . h ( $r [ " ns " ]) . " </b>. " : " " ) . h ( $r [ " table " ]) . " </a> " , " (<i> " . implode ( " </i>, <i> " , array_map ( 'h' , $r [ " target " ])) . " </i>) " , " <td> " . h ( $r [ " on_delete " ]) . " \n " , " <td> " . h ( $r [ " on_update " ]) . " \n " , '<td><a href="' . h ( ME . 'foreign=' . urlencode ( $a ) . '&name=' . urlencode ( $C )) . '">' . lang ( 136 ) . '</a>' ;} echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'foreign=' . urlencode ( $a ) . '">' . lang ( 137 ) . " </a> \n " ;}} if ( support ( is_view ( $R ) ? " view_trigger " : " trigger " )){ echo " <h3 id='triggers'> " . lang ( 138 ) . " </h3> \n " ; $Ai = triggers ( $a ); if ( $Ai ){ echo " <table cellspacing='0'> \n " ; foreach ( $Ai
as $z => $X ) echo " <tr valign='top'><td> " . h ( $X [ 0 ]) . " <td> " . h ( $X [ 1 ]) . " <th> " . h ( $z ) . " <td><a href=' " . h ( ME . 'trigger=' . urlencode ( $a ) . '&name=' . urlencode ( $z )) . " '> " . lang ( 136 ) . " </a> \n " ; echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'trigger=' . urlencode ( $a ) . '">' . lang ( 139 ) . " </a> \n " ;}} elseif ( isset ( $_GET [ " schema " ])){ page_header ( lang ( 71 ), " " , array (), h ( DB . ( $_GET [ " ns " ] ? " . $_GET[ns] " : " " ))); $Sh = array (); $Th = array (); $ea = ( $_GET [ " schema " ] ? $_GET [ " schema " ] : $_COOKIE [ " adminer_schema- " . str_replace ( " . " , " _ " , DB )]); preg_match_all ( '~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~' , $ea , $Fe , PREG_SET_ORDER ); foreach ( $Fe
as $t => $B ){ $Sh [ $B [ 1 ]] = array ( $B [ 2 ], $B [ 3 ]); $Th [] = " \n \t ' " . js_escape ( $B [ 1 ]) . " ': [ $B[2] , $B[3] ] " ;} $qi = 0 ; $Ra =- 1 ; $bh = array (); $Gg = array (); $te = array (); foreach ( table_status ( '' , true ) as $Q => $R ){ if ( is_view ( $R )) continue ; $fg = 0 ; $bh [ $Q ][ " fields " ] = array (); foreach ( fields ( $Q ) as $C => $p ){ $fg += 1.25 ; $p [ " pos " ] = $fg ; $bh [ $Q ][ " fields " ][ $C ] = $p ;} $bh [ $Q ][ " pos " ] = ( $Sh [ $Q ] ? $Sh [ $Q ] : array ( $qi , 0 )); foreach ( $b -> foreignKeys ( $Q ) as $X ){ if ( ! $X [ " db " ]){ $re = $Ra ; if ( $Sh [ $Q ][ 1 ] || $Sh [ $X [ " table " ]][ 1 ]) $re = min ( floatval ( $Sh [ $Q ][ 1 ]), floatval ( $Sh [ $X [ " table " ]][ 1 ])) - 1 ; else $Ra -=. 1 ; while ( $te [( string ) $re ]) $re -=. 0001 ; $bh [ $Q ][ " references " ][ $X [ " table " ]][( string ) $re ] = array ( $X [ " source " ], $X [ " target " ]); $Gg [ $X [ " table " ]][ $Q ][( string ) $re ] = $X [ " target " ]; $te [( string ) $re ] = true ;}} $qi = max ( $qi , $bh [ $Q ][ " pos " ][ 0 ] + 2.5 + $fg );} echo '<div id="schema" style="height: ' , $qi , ' em ; " >
2018-04-01 23:34:54 +02:00
< script ',nonce(),' >
qs ( \ ' #schema\').onselectstart = function () { return false; };
2018-12-25 21:50:48 +01:00
var tablePos = { ',implode(",",$Th)."\n",' };
var em = qs ( \ '#schema\').offsetHeight / ' , $qi , ' ;
2014-05-08 19:46:08 +02:00
document . onmousemove = schemaMousemove ;
2018-04-01 23:34:54 +02:00
document . onmouseup = partialArg ( schemaMouseup , \ '' , js_escape ( DB ), ' \ ' );
2014-05-08 19:46:08 +02:00
</ script >
2018-12-25 21:50:48 +01:00
' ; foreach ( $bh
as $C => $Q ){ echo " <div class='table' style='top: " . $Q [ " pos " ][ 0 ] . " em; left: " . $Q [ " pos " ][ 1 ] . " em;'> " , '<a href="' . h ( ME ) . 'table=' . urlencode ( $C ) . '"><b>' . h ( $C ) . " </b></a> " , script ( " qsl('div').onmousedown = schemaMousedown; " ); foreach ( $Q [ " fields " ] as $p ){ $X = '<span' . type_class ( $p [ " type " ]) . ' title="' . h ( $p [ " full_type " ] . ( $p [ " null " ] ? " NULL " : '' )) . '">' . h ( $p [ " field " ]) . '</span>' ; echo " <br> " . ( $p [ " primary " ] ? " <i> $X </i> " : $X );} foreach (( array ) $Q [ " references " ] as $Zh => $Hg ){ foreach ( $Hg
as $re => $Dg ){ $se = $re - $Sh [ $C ][ 1 ]; $t = 0 ; foreach ( $Dg [ 0 ] as $wh ) echo " \n <div class='references' title=' " . h ( $Zh ) . " ' id='refs $re - " . ( $t ++ ) . " ' style='left: $se " . " em; top: " . $Q [ " fields " ][ $wh ][ " pos " ] . " em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: " . ( - $se ) . " em;'></div></div> " ;}} foreach (( array ) $Gg [ $C ] as $Zh => $Hg ){ foreach ( $Hg
as $re => $f ){ $se = $re - $Sh [ $C ][ 1 ]; $t = 0 ; foreach ( $f
as $Yh ) echo " \n <div class='references' title=' " . h ( $Zh ) . " ' id='refd $re - " . ( $t ++ ) . " ' style='left: $se " . " em; top: " . $Q [ " fields " ][ $Yh ][ " pos " ] . " em; height: 1.25em; background: url( " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME ) . " ?file=arrow.gif) no-repeat right center;&version=4.7.0 " ) . " '><div style='height: .5em; border-bottom: 1px solid Gray; width: " . ( - $se ) . " em;'></div></div> " ;}} echo " \n </div> \n " ;} foreach ( $bh
as $C => $Q ){ foreach (( array ) $Q [ " references " ] as $Zh => $Hg ){ foreach ( $Hg
as $re => $Dg ){ $Ue = $qi ; $Je =- 10 ; foreach ( $Dg [ 0 ] as $z => $wh ){ $gg = $Q [ " pos " ][ 0 ] + $Q [ " fields " ][ $wh ][ " pos " ]; $hg = $bh [ $Zh ][ " pos " ][ 0 ] + $bh [ $Zh ][ " fields " ][ $Dg [ 1 ][ $z ]][ " pos " ]; $Ue = min ( $Ue , $gg , $hg ); $Je = max ( $Je , $gg , $hg );} echo " <div class='references' id='refl $re ' style='left: $re " . " em; top: $Ue " . " em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: " . ( $Je - $Ue ) . " em;'></div></div> \n " ;}}} echo ' </ div >
< p class = " links " >< a href = " ',h(ME. " schema = " .urlencode( $ea )),' " id = " schema-link " > ',lang(140),' </ a >
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$o){$Db="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$z)$Db.="&$z=".urlencode($_POST[$z]);cookie("adminer_export",substr($Db,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Jc=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$ae=preg_match(' ~ sql ~ ' , $_POST [ " format " ]); if ( $ae ){ echo " -- Adminer $ia " . $fc [ DRIVER ] . " dump \n \n " ; if ( $y == " sql " ){ echo " SET NAMES utf8;
2014-05-08 19:46:08 +02:00
SET time_zone = '+00:00' ;
" .( $_POST["data_style"] ? " SET foreign_key_checks = 0 ;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' ;
" : " " ). "
2018-12-25 21:50:48 +01:00
" ; $h->query ( " SET time_zone = '+00:00' ; " );}} $Jh = $_POST["db_style"] ; $l =array(DB);if(DB== " " ) { $l = $_POST [ " databases " ]; if ( is_string ( $l )) $l = explode ( " \n " , rtrim ( str_replace ( " \r " , " " , $l ), " \n " )); } foreach((array) $l
as $m ){ $b -> dumpDatabase ( $m ); if ( $h -> select_db ( $m )){ if ( $ae && preg_match ( '~CREATE~' , $Jh ) && ( $j = $h -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ))){ set_utf8mb4 ( $j ); if ( $Jh == " DROP+CREATE " ) echo " DROP DATABASE IF EXISTS " . idf_escape ( $m ) . " ; \n " ; echo " $j ; \n " ;} if ( $ae ){ if ( $Jh ) echo
use_sql ( $m ) . " ; \n \n " ; $Kf = " " ; if ( $_POST [ " routines " ]){ foreach ( array ( " FUNCTION " , " PROCEDURE " ) as $Vg ){ foreach ( get_rows ( " SHOW $Vg STATUS WHERE Db = " . q ( $m ), null , " -- " ) as $J ){ $j = remove_definer ( $h -> result ( " SHOW CREATE $Vg " . idf_escape ( $J [ " Name " ]), 2 )); set_utf8mb4 ( $j ); $Kf .= ( $Jh != 'DROP+CREATE' ? " DROP $Vg IF EXISTS " . idf_escape ( $J [ " Name " ]) . " ;; \n " : " " ) . " $j ;; \n \n " ;}}} if ( $_POST [ " events " ]){ foreach ( get_rows ( " SHOW EVENTS " , null , " -- " ) as $J ){ $j = remove_definer ( $h -> result ( " SHOW CREATE EVENT " . idf_escape ( $J [ " Name " ]), 3 )); set_utf8mb4 ( $j ); $Kf .= ( $Jh != 'DROP+CREATE' ? " DROP EVENT IF EXISTS " . idf_escape ( $J [ " Name " ]) . " ;; \n " : " " ) . " $j ;; \n \n " ;}} if ( $Kf ) echo " DELIMITER ;; \n \n $Kf " . " DELIMITER ; \n \n " ;} if ( $_POST [ " table_style " ] || $_POST [ " data_style " ]){ $aj = array (); foreach ( table_status ( '' , true ) as $C => $R ){ $Q = ( DB == " " || in_array ( $C ,( array ) $_POST [ " tables " ])); $Mb = ( DB == " " || in_array ( $C ,( array ) $_POST [ " data " ])); if ( $Q || $Mb ){ if ( $Jc == " tar " ){ $mi = new
TmpFile ; ob_start ( array ( $mi , 'write' ), 1e5 );} $b -> dumpTable ( $C ,( $Q ? $_POST [ " table_style " ] : " " ),( is_view ( $R ) ? 2 : 0 )); if ( is_view ( $R )) $aj [] = $C ; elseif ( $Mb ){ $q = fields ( $C ); $b -> dumpData ( $C , $_POST [ " data_style " ], " SELECT * " . convert_fields ( $q , $q ) . " FROM " . table ( $C ));} if ( $ae && $_POST [ " triggers " ] && $Q && ( $Ai = trigger_sql ( $C ))) echo " \n DELIMITER ;; \n $Ai\nDELIMITER ; \n " ; if ( $Jc == " tar " ){ ob_end_flush (); tar_file (( DB != " " ? " " : " $m / " ) . " $C .csv " , $mi );} elseif ( $ae ) echo " \n " ;}} foreach ( $aj
as $Zi ) $b -> dumpTable ( $Zi , $_POST [ " table_style " ], 1 ); if ( $Jc == " tar " ) echo
pack ( " x512 " );}}} if ( $ae ) echo " -- " . $h -> result ( " SELECT NOW() " ) . " \n " ; exit ;} page_header ( lang ( 74 ), $o ,( $_GET [ " export " ] != " " ? array ( " table " => $_GET [ " export " ]) : array ()), h ( DB )); echo '
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
2018-12-25 21:50:48 +01:00
< table cellspacing = " 0 " class = " layout " >
';$Qb=array(' ',' USE ',' DROP + CREATE ',' CREATE ');$Uh=array(' ',' DROP + CREATE ',' CREATE ');$Nb=array(' ',' TRUNCATE + INSERT ',' INSERT ');if($y=="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(141)."<td>".html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"<tr><th>".lang(142)."<td>".html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($y=="sqlite"?"":"<tr><th>".lang(38)."<td>".html_select(' db_style ',$Qb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(143)):"").(support("event")?checkbox("events",1,$J["events"],lang(144)):"")),"<tr><th>".lang(123)."<td>".html_select(' table_style ',$Uh,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(52)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(138)):""),"<tr><th>".lang(145)."<td>".html_select(' data_style ',$Nb,$J["data_style"]),' </ table >
2018-06-30 00:38:01 +02:00
< p >< input type = " submit " value = " ',lang(74),' " >
2018-12-25 21:50:48 +01:00
< input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
< table cellspacing = " 0 " >
2018-12-25 21:50:48 +01:00
',script("qsl(' table ').onclick = dumpClick;");$kg=array();if(DB!=""){$fb=($a!=""?"":" checked");echo"<thead><tr>","<th style=' text - align : left ; '><label class=' block '><input type=' checkbox ' id=' check - tables '$fb>".lang(123)."</label>".script("qs(' #check-tables').onclick = partial(formCheck, /^tables\\[/);",""),"<th style='text-align: right;'><label class='block'>".lang(145)."<input type='checkbox' id='check-data'$fb></label>".script("qs('#check-data').onclick = partial(formCheck, /^data\\[/);",""),"</thead>\n";$aj="";$Vh=tables_list();foreach($Vh
as $C => $T ){ $jg = preg_replace ( '~_.*~' , '' , $C ); $fb = ( $a == " " || $a == ( substr ( $a , - 1 ) == " % " ? " $jg % " : $C )); $ng = " <tr><td> " . checkbox ( " tables[] " , $C , $fb , $C , " " , " block " ); if ( $T !== null &&! preg_match ( '~table~i' , $T )) $aj .= " $ng\n " ; else
echo " $ng <td align='right'><label class='block'><span id='Rows- " . h ( $C ) . " '></span> " . checkbox ( " data[] " , $C , $fb ) . " </label> \n " ; $kg [ $jg ] ++ ;} echo $aj ; if ( $Vh ) 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 " ; $l = $b -> databases (); if ( $l ){ foreach ( $l
as $m ){ if ( ! information_schema ( $m )){ $jg = preg_replace ( '~_.*~' , '' , $m ); echo " <tr><td> " . checkbox ( " databases[] " , $m , $a == " " || $a == " $jg % " , $m , " " , " block " ) . " \n " ; $kg [ $jg ] ++ ;}}} else
2014-05-08 19:46:08 +02:00
echo " <tr><td><textarea name='databases' rows='10' cols='20'></textarea> " ;} echo ' </ table >
</ form >
2018-12-25 21:50:48 +01:00
' ; $Xc = true ; foreach ( $kg
as $z => $X ){ if ( $z != " " && $X > 1 ){ echo ( $Xc ? " <p> " : " " ) . " <a href=' " . h ( ME ) . " dump= " . urlencode ( " $z % " ) . " '> " . h ( $z ) . " </a> " ; $Xc = false ;}}} elseif ( isset ( $_GET [ " privileges " ])){ page_header ( lang ( 72 )); echo '<p class="links"><a href="' . h ( ME ) . 'user=">' . lang ( 146 ) . " </a> " ; $H = $h -> query ( " SELECT User, Host FROM mysql. " . ( DB == " " ? " user " : " db WHERE " . q ( DB ) . " LIKE Db " ) . " ORDER BY Host, User " ); $md = $H ; if ( ! $H ) $H = $h -> query ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host " ); echo " <form action=''><p> \n " ; hidden_fields_get (); echo " <input type='hidden' name='db' value=' " . h ( DB ) . " '> \n " ,( $md ? " " : " <input type='hidden' name='grant' value=''> \n " ), " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 36 ) . " <th> " . lang ( 35 ) . " <th></thead> \n " ; while ( $J = $H -> fetch_assoc ()) echo '<tr' . odd () . '><td>' . h ( $J [ " User " ]) . " <td> " . h ( $J [ " Host " ]) . '<td><a href="' . h ( ME . 'user=' . urlencode ( $J [ " User " ]) . '&host=' . urlencode ( $J [ " Host " ])) . '">' . lang ( 10 ) . " </a> \n " ; if ( ! $md || DB != " " ) echo " <tr " . odd () . " ><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value=' " . lang ( 10 ) . " '> \n " ; echo " </table> \n " , " </form> \n " ;} elseif ( isset ( $_GET [ " sql " ])){ if ( ! $o && $_POST [ " export " ]){ dump_headers ( " sql " ); $b -> dumpTable ( " " , " " ); $b -> dumpData ( " " , " table " , $_POST [ " query " ]); exit ;} restart_session (); $_d =& get_session ( " queries " ); $zd =& $_d [ DB ]; if ( ! $o && $_POST [ " clear " ]){ $zd = array (); redirect ( remove_from_uri ( " history " ));} page_header (( isset ( $_GET [ " import " ]) ? lang ( 73 ) : lang ( 65 )), $o ); if ( ! $o && $_POST ){ $jd = false ; if ( ! isset ( $_GET [ " import " ])) $G = $_POST [ " query " ]; elseif ( $_POST [ " webfile " ]){ $_h = $b -> importServerPath (); $jd =@ fopen (( file_exists ( $_h ) ? $_h : " compress.zlib:// $_h .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 ){ $vg = $G . ( preg_match ( " ~;[ \t \r \n ]* \$ ~ " , $G ) ? " " : " ; " ); if ( ! $zd || reset ( end ( $zd )) != $vg ){ restart_session (); $zd [] = array ( $vg , time ()); set_session ( " queries " , $_d ); stop_session ();}} $xh = " (?: \\ s|/ \\ *[ \ s \ S]*? \\ */|(?:#|-- )[^ \n ]* \n ?|-- \r ? \n ) " ; $Wb = " ; " ; $D = 0 ; $uc = true ; $i = connect (); if ( is_object ( $i ) && DB != " " ) $i -> select_db ( DB ); $tb = 0 ; $zc = array (); $Rf = '[\'"' . ( $y == " sql " ? '`#' : ( $y == " sqlite " ? '`[' : ( $y == " mssql " ? '[' : '' ))) . ']|/\*|-- |$' . ( $y == " pgsql " ? '|\$[^$]*\$' : '' ); $ri = microtime ( true ); parse_str ( $_COOKIE [ " adminer_export " ], $ya ); $lc = $b -> dumpFormat (); unset ( $lc [ " sql " ]); while ( $G != " " ){ if ( ! $D && preg_match ( " ~^ $xh *+DELIMITER \\ s+( \\ S+)~i " , $G , $B )){ $Wb = $B [ 1 ]; $G = substr ( $G , strlen ( $B [ 0 ]));} else { preg_match ( '(' . preg_quote ( $Wb ) . " \\ s*| $Rf ) " , $G , $B , PREG_OFFSET_CAPTURE , $D ); list ( $hd , $fg ) = $B [ 0 ]; if ( ! $hd && $jd &&! feof ( $jd )) $G .= fread ( $jd , 1e5 ); else { if ( ! $hd && rtrim ( $G ) == " " ) break ; $D = $fg + 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 )){ $Zg = $B [ 0 ][ 0 ]; if ( ! $Zg && $jd &&! feof ( $jd )) $G .= fread ( $jd , 1e5 ); else { $D = $B [ 0 ][ 1 ] + strlen ( $Zg ); if ( $Zg [ 0 ] != " \\ " ) break ;}}} else { $uc = false ; $vg = substr ( $G , 0 , $fg ); $tb ++ ; $ng = " <pre id='sql- $tb '><code class='jush- $y '> " . $b -> sqlCommandQuery ( $vg ) . " </code></pre> \n " ; if ( $y == " sqlite " && preg_match ( " ~^ $xh *+ATTACH \\ b~i " , $vg , $B )){ echo $ng , " <p class='error'> " . lang ( 147 ) . " \n " ; $zc [] = " <a href='#sql- $tb '> $tb </a> " ; if ( $_POST [ " error_stops " ]) break ;} else { if ( ! $_POST [ " only_errors " ]){ echo $ng ; ob_flush (); flush ();} $Dh = microtime ( true ); if ( $h -> multi_query ( $vg ) && is_object ( $i ) && preg_match ( " ~^ $xh *+USE \\ b~i " , $vg )) $i -> query ( $vg ); do { $H = $h -> store_result (); if ( $h -> error ){ echo ( $_POST [ " only_errors " ] ? $ng : " " ), " <p class='error'> " . lang ( 148 ) . ( $h -> errno ? " ( $h->errno ) " : " " ) . " : " . error () . " \n " ; $zc [] = " <a href='#sql- $tb '> $tb </a> " ; if ( $_POST [ " error_stops " ]) break
2 ;} else { $fi = " <span class='time'>( " . format_time ( $Dh ) . " )</span> " . ( strlen ( $vg ) < 1000 ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( trim ( $vg )) . " '> " . lang ( 10 ) . " </a> " : " " ); $_a = $h -> affected_rows ; $dj = ( $_POST [ " only_errors " ] ? " " : $n -> warnings ()); $ej = " warnings- $tb " ; if ( $dj ) $fi .= " , <a href='# $ej '> " . lang ( 47 ) . " </a> " . script ( " qsl('a').onclick = partial(toggle, ' $ej '); " , " " ); $Gc = null ; $Hc = " explain- $tb " ; if ( is_object ( $H )){ $_ = $_POST [ " limit " ]; $Df = select ( $H , $i , array (), $_ ); if ( ! $_POST [ " only_errors " ]){ echo " <form action='' method='post'> \n " ; $hf = $H -> num_rows ; echo " <p> " . ( $hf ? ( $_ && $hf > $_ ? lang ( 149 , $_ ) : " " ) . lang ( 150 , $hf ) : " " ), $fi ; if ( $i && preg_match ( " ~^( $xh | \\ ()*+SELECT \\ b~i " , $vg ) && ( $Gc = explain ( $i , $vg ))) echo " , <a href='# $Hc '>Explain</a> " . script ( " qsl('a').onclick = partial(toggle, ' $Hc '); " , " " ); $u = " export- $tb " ; echo " , <a href='# $u '> " . lang ( 74 ) . " </a> " . script ( " qsl('a').onclick = partial(toggle, ' $u '); " , " " ) . " <span id=' $u ' class='hidden'>: " . html_select ( " output " , $b -> dumpOutput (), $ya [ " output " ]) . " " . html_select ( " format " , $lc , $ya [ " format " ]) . " <input type='hidden' name='query' value=' " . h ( $vg ) . " '> " . " <input type='submit' name='export' value=' " . lang ( 74 ) . " '><input type='hidden' name='token' value=' $pi '></span> \n " . " </form> \n " ;}} else { if ( preg_match ( " ~^ $xh *+(CREATE|DROP|ALTER) $xh ++(DATABASE|SCHEMA) \\ b~i " , $vg )){ restart_session (); set_session ( " dbs " , null ); stop_session ();} if ( ! $_POST [ " only_errors " ]) echo " <p class='message' title=' " . h ( $h -> info ) . " '> " . lang ( 151 , $_a ) . " $fi\n " ;} echo ( $dj ? " <div id=' $ej ' class='hidden'> \n $dj </div> \n " : " " ); if ( $Gc ){ echo " <div id=' $Hc ' class='hidden'> \n " ; select ( $Gc , $i , $Df ); echo " </div> \n " ;}} $Dh = microtime ( true );} while ( $h -> next_result ());} $G = substr ( $G , $D ); $D = 0 ;}}}} if ( $uc ) echo " <p class='message'> " . lang ( 152 ) . " \n " ; elseif ( $_POST [ " only_errors " ]){ echo " <p class='message'> " . lang ( 153 , $tb - count ( $zc )), " <span class='time'>( " . format_time ( $ri ) . " )</span> \n " ;} elseif ( $zc && $tb > 1 ) echo " <p class='error'> " . lang ( 148 ) . " : " . implode ( " " , $zc ) . " \n " ;} else
2018-06-30 00:38:01 +02:00
echo " <p class='error'> " . upload_error ( $G ) . " \n " ;} echo '
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
2018-12-25 21:50:48 +01:00
';$Dc="<input type=' submit ' value=' " .lang(154). " ' title=' Ctrl + Enter ' > " ;if(!isset( $_GET["import"] )) { $vg = $_GET["sql"] ;if( $_POST ) $vg = $_POST["query"] ;elseif( $_GET["history"] == " all " ) $vg = $zd ;elseif( $_GET["history"] != " " ) $vg = $zd[$_GET["history"] ][0];echo " < p > " ;textarea( " query " , $vg ,20);echo
script (( $_POST ? " " : " qs('textarea').focus(); \n " ) . " qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), ' " . remove_from_uri ( " sql|limit|error_stops|only_errors " ) . " '); " ), " <p> $Dc\n " , lang ( 155 ) . " : <input type='number' name='limit' class='size' value=' " . h ( $_POST ? $_POST [ " limit " ] : $_GET [ " limit " ]) . " '> \n " ;} else { echo " <fieldset><legend> " . lang ( 156 ) . " </legend><div> " ; $sd = ( extension_loaded ( " zlib " ) ? " [.gz] " : " " ); echo ( ini_bool ( " file_uploads " ) ? " SQL $sd (< " . ini_get ( " upload_max_filesize " ) . " B): <input type='file' name='sql_file[]' multiple> \n $Dc " : lang ( 157 )), " </div></fieldset> \n " ; $Hd = $b -> importServerPath (); if ( $Hd ){ echo " <fieldset><legend> " . lang ( 158 ) . " </legend><div> " , lang ( 159 , " <code> " . h ( $Hd ) . " $sd </code> " ), ' <input type="submit" name="webfile" value="' . lang ( 160 ) . '">' , " </div></fieldset> \n " ;} echo " <p> " ;} echo
checkbox ( " error_stops " , 1 ,( $_POST ? $_POST [ " error_stops " ] : isset ( $_GET [ " import " ])), lang ( 161 )) . " \n " , checkbox ( " only_errors " , 1 ,( $_POST ? $_POST [ " only_errors " ] : isset ( $_GET [ " import " ])), lang ( 162 )) . " \n " , " <input type='hidden' name='token' value=' $pi '> \n " ; if ( ! isset ( $_GET [ " import " ]) && $zd ){ print_fieldset ( " history " , lang ( 163 ), $_GET [ " history " ] != " " ); for ( $X = end ( $zd ); $X ; $X = prev ( $zd )){ $z = key ( $zd ); list ( $vg , $fi , $pc ) = $X ; echo '<a href="' . h ( ME . " sql=&history= $z " ) . '">' . lang ( 10 ) . " </a> " . " <span class='time' title=' " .@ date ( 'Y-m-d' , $fi ) . " '> " .@ date ( " H:i:s " , $fi ) . " </span> " . " <code class='jush- $y '> " . shorten_utf8 ( ltrim ( str_replace ( " \n " , " " , str_replace ( " \r " , " " , preg_replace ( '~^(#|-- ).*~m' , '' , $vg )))), 80 , " </code> " ) . ( $pc ? " <span class='time'>( $pc )</span> " : " " ) . " <br> \n " ;} echo " <input type='submit' name='clear' value=' " . lang ( 164 ) . " '> \n " , " <a href=' " . h ( ME . " sql=&history=all " ) . " '> " . lang ( 165 ) . " </a> \n " , " </div></fieldset> \n " ;} echo ' </ form >
' ;} elseif ( isset ( $_GET [ " edit " ])){ $a = $_GET [ " edit " ]; $q = fields ( $a ); $Z = ( isset ( $_GET [ " select " ]) ? ( $_POST [ " check " ] && count ( $_POST [ " check " ]) == 1 ? where_check ( $_POST [ " check " ][ 0 ], $q ) : " " ) : where ( $_GET , $q )); $Ki = ( isset ( $_GET [ " select " ]) ? $_POST [ " edit " ] : $Z ); foreach ( $q
as $C => $p ){ if ( ! isset ( $p [ " privileges " ][ $Ki ? " update " : " insert " ]) || $b -> fieldName ( $p ) == " " ) unset ( $q [ $C ]);} if ( $_POST &&! $o &&! isset ( $_GET [ " select " ])){ $ze = $_POST [ " referer " ]; if ( $_POST [ " insert " ]) $ze = ( $Ki ? null : $_SERVER [ " REQUEST_URI " ]); elseif ( ! preg_match ( '~^.+&select=.+$~' , $ze )) $ze = ME . " select= " . urlencode ( $a ); $x = indexes ( $a ); $Fi = unique_array ( $_GET [ " where " ], $x ); $yg = " \n WHERE $Z " ; if ( isset ( $_POST [ " delete " ])) queries_redirect ( $ze , lang ( 166 ), $n -> delete ( $a , $yg , ! $Fi )); else { $O = array (); foreach ( $q
as $C => $p ){ $X = process_input ( $p ); if ( $X !== false && $X !== null ) $O [ idf_escape ( $C )] = $X ;} if ( $Ki ){ if ( ! $O ) redirect ( $ze ); queries_redirect ( $ze , lang ( 167 ), $n -> update ( $a , $O , $yg , ! $Fi )); if ( is_ajax ()){ page_headers (); page_messages ( $o ); exit ;}} else { $H = $n -> insert ( $a , $O ); $qe = ( $H ? last_id () : 0 ); queries_redirect ( $ze , lang ( 168 ,( $qe ? " $qe " : " " )), $H );}}} $J = null ; if ( $_POST [ " save " ]) $J = ( array ) $_POST [ " fields " ]; elseif ( $Z ){ $L = array (); foreach ( $q
as $C => $p ){ if ( isset ( $p [ " privileges " ][ " select " ])){ $Ha = convert_field ( $p ); if ( $_POST [ " clone " ] && $p [ " auto_increment " ]) $Ha = " '' " ; if ( $y == " sql " && preg_match ( " ~enum|set~ " , $p [ " type " ])) $Ha = " 1* " . idf_escape ( $C ); $L [] = ( $Ha ? " $Ha AS " : " " ) . idf_escape ( $C );}} $J = array (); if ( ! support ( " table " )) $L = array ( " * " ); if ( $L ){ $H = $n -> select ( $a , $L , array ( $Z ), $L , array (),( isset ( $_GET [ " select " ]) ? 2 : 1 )); if ( ! $H ) $o = error (); else { $J = $H -> fetch_assoc (); if ( ! $J ) $J = false ;} if ( isset ( $_GET [ " select " ]) && ( ! $J || $H -> fetch_assoc ())) $J = null ;}} if ( ! support ( " table " ) &&! $q ){ if ( ! $Z ){ $H = $n -> select ( $a , array ( " * " ), $Z , array ( " * " )); $J = ( $H ? $H -> fetch_assoc () : false ); if ( ! $J ) $J = array ( $n -> primary => " " );} if ( $J ){ foreach ( $J
as $z => $X ){ if ( ! $Z ) $J [ $z ] = null ; $q [ $z ] = array ( " field " => $z , " null " => ( $z != $n -> primary ), " auto_increment " => ( $z == $n -> primary ));}}} edit_form ( $a , $q , $J , $Ki );} elseif ( isset ( $_GET [ " create " ])){ $a = $_GET [ " create " ]; $Tf = array (); foreach ( array ( 'HASH' , 'LINEAR HASH' , 'KEY' , 'LINEAR KEY' , 'RANGE' , 'LIST' ) as $z ) $Tf [ $z ] = $z ; $Fg = referencable_primary ( $a ); $fd = array (); foreach ( $Fg
as $Qh => $p ) $fd [ str_replace ( " ` " , " `` " , $Qh ) . " ` " . str_replace ( " ` " , " `` " , $p [ " field " ])] = $Qh ; $Gf = array (); $R = array (); if ( $a != " " ){ $Gf = fields ( $a ); $R = table_status ( $a ); if ( ! $R ) $o = lang ( 9 );} $J = $_POST ; $J [ " fields " ] = ( array ) $J [ " fields " ]; if ( $J [ " auto_increment_col " ]) $J [ " fields " ][ $J [ " auto_increment_col " ]][ " auto_increment " ] = true ; if ( $_POST &&! process_fields ( $J [ " fields " ]) &&! $o ){ if ( $_POST [ " drop " ]) queries_redirect ( substr ( ME , 0 , - 1 ), lang ( 169 ), drop_tables ( array ( $a ))); else { $q = array (); $Ea = array (); $Pi = false ; $dd = array (); $Ff = reset ( $Gf ); $Ba = " FIRST " ; foreach ( $J [ " fields " ] as $z => $p ){ $r = $fd [ $p [ " type " ]]; $Bi = ( $r !== null ? $Fg [ $r ] : $p ); if ( $p [ " field " ] != " " ){ if ( ! $p [ " has_default " ]) $p [ " default " ] = null ; if ( $z == $J [ " auto_increment_col " ]) $p [ " auto_increment " ] = true ; $sg = process_field ( $p , $Bi ); $Ea [] = array ( $p [ " orig " ], $sg , $Ba ); if ( $sg != process_field ( $Ff , $Ff )){ $q [] = array ( $p [ " orig " ], $sg , $Ba ); if ( $p [ " orig " ] != " " || $Ba ) $Pi = true ;} if ( $r !== null ) $dd [ idf_escape ( $p [ " field " ])] = ( $a != " " && $y != " sqlite " ? " ADD " : " " ) . format_foreign_key ( array ( 'table' => $fd [ $p [ " type " ]], 'source' => array ( $p [ " field " ]), 'target' => array ( $Bi [ " field " ]), 'on_delete' => $p [ " on_delete " ],)); $Ba = " AFTER " . idf_escape ( $p [ " field " ]);} elseif ( $p [ " orig " ] != " " ){ $Pi = true ; $q [] = array ( $p [ " orig " ]);} if ( $p [ " orig " ] != " " ){ $Ff = next ( $Gf ); if ( ! $Ff ) $Ba = " " ;}} $Vf = " " ; if ( $Tf [ $J [ " partition_by " ]]){ $Wf = array (); if ( $J [ " partition_by " ] == 'RANGE' || $J [ " partition_by " ] == 'LIST' ){ foreach ( array_filter ( $J [ " partition_names " ]) as $z => $X ){ $Y = $J [ " partition_values " ][ $z ]; $Wf [] = " \n PARTITION " . idf_escape ( $X ) . " VALUES " . ( $J [ " partition_by " ] == 'RANGE' ? " LESS THAN " : " IN " ) . ( $Y != " " ? " ( $Y ) " : " MAXVALUE " );}} $Vf .= " \n PARTITION BY $J[partition_by] ( $J[partition] ) " . ( $Wf ? " ( " . implode ( " , " , $Wf ) . " \n ) " : ( $J [ " partitions " ] ? " PARTITIONS " . ( + $J [ " partitions " ]) : " " ));} elseif ( support ( " partitioning " ) && preg_match ( " ~partitioned~ " , $R [ " Create_options " ])) $Vf .= " \n REMOVE PARTITIONING " ; $Ne = lang ( 170 ); if ( $a == " " ){ cookie ( " adminer_engine " , $J [ " Engine " ]); $Ne = lang ( 171 );} $C = trim ( $J [ " name " ]); queries_redirect ( ME . ( support ( " table " ) ? " table= " : " select= " ) . urlencode ( $C ), $Ne , alter_table ( $a , $C ,( $y == " sqlite " && ( $Pi || $dd ) ? $Ea : $q ), $dd ,( $J [ " Comment " ] != $R [ " Comment " ] ? $J [ " Comment " ] : null ),( $J [ " Engine " ] && $J [ " Engine " ] != $R [ " Engine " ] ? $J [ " Engine " ] : " " ),( $J [ " Collation " ] && $J [ " Collation " ] != $R [ " Collation " ] ? $J [ " Collation " ] : " " ),( $J [ " Auto_increment " ] != " " ? number ( $J [ " Auto_increment " ]) : " " ), $Vf ));}} page_header (( $a != " " ? lang ( 45 ) : lang ( 75 )), $o , array ( " table " => $a ), h ( $a )); if ( ! $_POST ){ $J = array ( " Engine " => $_COOKIE [ " adminer_engine " ], " fields " => array ( array ( " field " => " " , " type " => ( isset ( $U [ " int " ]) ? " int " : ( isset ( $U [ " integer " ]) ? " integer " : " " )), " on_update " => " " )), " partition_names " => array ( " " ),); if ( $a != " " ){ $J = $R ; $J [ " name " ] = $a ; $J [ " fields " ] = array (); if ( ! $_GET [ " auto_increment " ]) $J [ " Auto_increment " ] = " " ; foreach ( $Gf
as $p ){ $p [ " has_default " ] = isset ( $p [ " default " ]); $J [ " fields " ][] = $p ;} if ( support ( " partitioning " )){ $kd = " FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q ( DB ) . " AND TABLE_NAME = " . q ( $a ); $H = $h -> query ( " SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $kd ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1 " ); list ( $J [ " partition_by " ], $J [ " partitions " ], $J [ " partition " ]) = $H -> fetch_row (); $Wf = get_key_vals ( " SELECT PARTITION_NAME, PARTITION_DESCRIPTION $kd AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION " ); $Wf [ " " ] = " " ; $J [ " partition_names " ] = array_keys ( $Wf ); $J [ " partition_values " ] = array_values ( $Wf );}}} $pb = collations (); $wc = engines (); foreach ( $wc
2018-06-30 00:38:01 +02:00
as $vc ){ if ( ! strcasecmp ( $vc , $J [ " Engine " ])){ $J [ " Engine " ] = $vc ; break ;}} echo '
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " id = " form " >
< p >
2018-04-01 23:34:54 +02:00
' ; if ( support ( " columns " ) || $a == " " ){ echo
2018-12-25 21:50:48 +01:00
lang ( 172 ), ': <input name="name" data-maxlength="64" value="' , h ( $J [ " name " ]), ' " autocapitalize= " off " >
2018-04-01 23:34:54 +02:00
' ; if ( $a == " " &&! $_POST ) echo
2018-12-25 21:50:48 +01:00
script ( " focus(qs('#form')['name']); " ); echo ( $wc ? " <select name='Engine'> " . optionlist ( array ( " " => " ( " . lang ( 173 ) . " ) " ) + $wc , $J [ " Engine " ]) . " </select> " . on_help ( " getTarget(event).value " , 1 ) . script ( " qsl('select').onchange = helpClose; " ) : " " ), ' ' ,( $pb &&! preg_match ( " ~sqlite|mssql~ " , $y ) ? html_select ( " Collation " , array ( " " => " ( " . lang ( 101 ) . " ) " ) + $pb , $J [ " Collation " ]) : " " ), ' <input type="submit" value="' , lang ( 14 ), ' " >
2014-05-08 19:46:08 +02:00
';}echo'
2018-12-25 21:50:48 +01:00
';if(support("columns")){echo' < div class = " scrollable " >
< table cellspacing = " 0 " id = " edit-fields " class = " nowrap " >
';$vb=($_POST?$_POST["comments"]:$J["Comment"]!="");if(!$_POST&&!$vb){foreach($J["fields"]as$p){if($p["comment"]!=""){$vb=true;break;}}}edit_fields($J["fields"],$pb,"TABLE",$fd,$vb);echo' </ table >
</ div >
2014-05-08 19:46:08 +02:00
< p >
2018-06-30 00:38:01 +02:00
',lang(52),' : < input type = " number " name = " Auto_increment " size = " 6 " value = " ',h( $J["Auto_increment"] ),' " >
2018-12-25 21:50:48 +01:00
',checkbox("defaults",1,!$_POST||$_POST["defaults"],lang(174),"columnShow(this.checked, 5)","jsonly"),($_POST?"":script("editingHideDefaults();")),(support("comment")?"<label><input type=' checkbox ' name=' comments ' value=' 1 ' class=' jsonly '".($vb?" checked":"").">".lang(51)."</label>".script("qsl(' input ').onclick = partial(editingCommentsClick, true);").' < input name = " Comment " value = " '.h( $J["Comment"] ).' " data - maxlength = " '.(min_version(5.5)?2048:60).' " '.($vb?' ':' class = " hidden " ').' > ':' '),' < p >
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
';}echo'
2018-12-25 21:50:48 +01:00
';if($a!=""){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,$a));}if(support("partitioning")){$Uf=preg_match(' ~ RANGE | LIST ~ ',$J["partition_by"]);print_fieldset("partition",lang(176),$J["partition_by"]);echo' < p >
',"<select name=' partition_by '>".optionlist(array(""=>"")+$Tf,$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(177),' : < input type = " number " name = " partitions " class = " size',( $Uf ||! $J["partition_by"] ? " hidden " : " " ),' " value = " ',h( $J["partitions"] ),' " >
< table cellspacing = " 0 " id = " partition-table " ',($Uf?"":" class=' hidden '"),' >
< thead >< tr >< th > ',lang(178),' < th > ',lang(179),' </ thead >
';foreach($J["partition_names"]as$z=>$X){echo' < tr > ',' < td >< input name = " partition_names[] " value = " '.h( $X ).' " autocapitalize = " off " > ',($z==count($J["partition_names"])-1?script("qsl(' input ').oninput = partitionNameChange;"):' '),' < td >< input name = " partition_values[] " value = " '.h( $J["partition_values"] [ $z ]).' " > ';}echo' </ table >
2014-05-08 19:46:08 +02:00
</ div ></ fieldset >
2018-12-25 21:50:48 +01:00
';}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
',script("qs(' #form')['defaults'].onclick();".(support("comment")?" editingCommentsClick.call(qs('#form')['comments']);":""));}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Kd=array("PRIMARY","UNIQUE","INDEX");$R=table_status($a,true);if(preg_match('~MyISAM|M?aria'.(min_version(5.6,'10.0.5')?'|InnoDB':'').'~i',$R["Engine"]))$Kd[]="FULLTEXT";if(preg_match('~MyISAM|M?aria'.(min_version(5.7,'10.2.2')?'|InnoDB':'').'~i',$R["Engine"]))$Kd[]="SPATIAL";$x=indexes($a);$lg=array();if($y=="mongo"){$lg=$x["_id_"];unset($Kd[0]);unset($x["_id_"]);}$J=$_POST;if($_POST&&!$o&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($J["indexes"]as$w){$C=$w["name"];if(in_array($w["type"],$Kd)){$f=array();$we=array();$Yb=array();$O=array();ksort($w["columns"]);foreach($w["columns"]as$z=>$e){if($e!=""){$ve=$w["lengths"][$z];$Xb=$w["descs"][$z];$O[]=idf_escape($e).($ve?"(".(+$ve).")":"").($Xb?" DESC":"");$f[]=$e;$we[]=($ve?$ve:null);$Yb[]=$Xb;}}if($f){$Ec=$x[$C];if($Ec){ksort($Ec["columns"]);ksort($Ec["lengths"]);ksort($Ec["descs"]);if($w["type"]==$Ec["type"]&&array_values($Ec["columns"])===$f&&(!$Ec["lengths"]||array_values($Ec["lengths"])===$we)&&array_values($Ec["descs"])===$Yb){unset($x[$C]);continue;}}$c[]=array($w["type"],$C,$O);}}}foreach($x
as $C => $Ec ) $c [] = array ( $Ec [ " type " ], $C , " DROP " ); if ( ! $c ) redirect ( ME . " table= " . urlencode ( $a )); queries_redirect ( ME . " table= " . urlencode ( $a ), lang ( 180 ), alter_indexes ( $a , $c ));} page_header ( lang ( 132 ), $o , array ( " table " => $a ), h ( $a )); $q = array_keys ( fields ( $a )); if ( $_POST [ " add " ]){ foreach ( $J [ " indexes " ] as $z => $w ){ if ( $w [ " columns " ][ count ( $w [ " columns " ])] != " " ) $J [ " indexes " ][ $z ][ " columns " ][] = " " ;} $w = end ( $J [ " indexes " ]); if ( $w [ " type " ] || array_filter ( $w [ " columns " ], 'strlen' )) $J [ " indexes " ][] = array ( " columns " => array ( 1 => " " ));} if ( ! $J ){ foreach ( $x
as $z => $w ){ $x [ $z ][ " name " ] = $z ; $x [ $z ][ " columns " ][] = " " ;} $x [] = array ( " columns " => array ( 1 => " " )); $J [ " indexes " ] = $x ;} echo '
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
2018-12-25 21:50:48 +01:00
< div class = " scrollable " >
2014-05-08 19:46:08 +02:00
< table cellspacing = " 0 " class = " nowrap " >
< thead >< tr >
2018-12-25 21:50:48 +01:00
< th id = " label-type " > ',lang(181),' < th >< input type = " submit " class = " wayoff " > ',lang(182),' < th id = " label-name " > ',lang(183),' < th >< noscript > ',"<input type=' image ' class=' icon ' name=' add [ 0 ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = plus . gif & version = 4.7 . 0 " ). " ' alt=' + ' title=' " .lang(108). " '>",' </ noscript >
2014-05-08 19:46:08 +02:00
</ thead >
2018-12-25 21:50:48 +01:00
' ; if ( $lg ){ echo " <tr><td>PRIMARY<td> " ; foreach ( $lg [ " columns " ] as $z => $e ){ echo
select_input ( " disabled " , $q , $e ), " <label><input disabled type='checkbox'> " . lang ( 60 ) . " </label> " ;} echo " <td><td> \n " ;} $de = 1 ; foreach ( $J [ " indexes " ] as $w ){ if ( ! $_POST [ " drop_col " ] || $de != key ( $_POST [ " drop_col " ])){ echo " <tr><td> " . html_select ( " indexes[ $de ][type] " , array ( - 1 => " " ) + $Kd , $w [ " type " ],( $de == count ( $J [ " indexes " ]) ? " indexesAddRow.call(this); " : 1 ), " label-type " ), " <td> " ; ksort ( $w [ " columns " ]); $t = 1 ; foreach ( $w [ " columns " ] as $z => $e ){ echo " <span> " . select_input ( " name='indexes[ $de ][columns][ $t ]' title=' " . lang ( 49 ) . " ' " ,( $q ? array_combine ( $q , $q ) : $q ), $e , " partial( " . ( $t == count ( $w [ " columns " ]) ? " indexesAddColumn " : " indexesChangeColumn " ) . " , ' " . js_escape ( $y == " sql " ? " " : $_GET [ " indexes " ] . " _ " ) . " ') " ),( $y == " sql " || $y == " mssql " ? " <input type='number' name='indexes[ $de ][lengths][ $t ]' class='size' value=' " . h ( $w [ " lengths " ][ $z ]) . " ' title=' " . lang ( 106 ) . " '> " : " " ),( support ( " descidx " ) ? checkbox ( " indexes[ $de ][descs][ $t ] " , 1 , $w [ " descs " ][ $z ], lang ( 60 )) : " " ), " </span> " ; $t ++ ;} echo " <td><input name='indexes[ $de ][name]' value=' " . h ( $w [ " name " ]) . " ' autocapitalize='off' aria-labelledby='label-name'> \n " , " <td><input type='image' class='icon' name='drop_col[ $de ]' src=' " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME ) . " ?file=cross.gif&version=4.7.0 " ) . " ' alt='x' title=' " . lang ( 111 ) . " '> " . script ( " qsl('input').onclick = partial(editingRemoveRow, 'indexes \$ 1[type]'); " );} $de ++ ;} echo ' </ table >
</ div >
2014-05-08 19:46:08 +02:00
< p >
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
< input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$o&&!isset($_POST["add_x"])){$C=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(184),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace(' ~ \bdb = [ ^& ] *&~ ',' ' , ME ) . " db= " . urlencode ( $C ), lang ( 185 ), rename_database ( $C , $J [ " collation " ]));} else { $l = explode ( " \n " , str_replace ( " \r " , " " , $C )); $Kh = true ; $pe = " " ; foreach ( $l
as $m ){ if ( count ( $l ) == 1 || $m != " " ){ if ( ! create_database ( $m , $J [ " collation " ])) $Kh = false ; $pe = $m ;}} restart_session (); set_session ( " dbs " , null ); queries_redirect ( ME . " db= " . urlencode ( $pe ), lang ( 186 ), $Kh );}} else { if ( ! $J [ " collation " ]) redirect ( substr ( ME , 0 , - 1 )); query_redirect ( " ALTER DATABASE " . idf_escape ( $C ) . ( preg_match ( '~^[a-z0-9_]+$~i' , $J [ " collation " ]) ? " COLLATE $J[collation] " : " " ), substr ( ME , 0 , - 1 ), lang ( 187 ));}} page_header ( DB != " " ? lang ( 68 ) : lang ( 115 ), $o , array (), h ( DB )); $pb = collations (); $C = DB ; if ( $_POST ) $C = $J [ " name " ]; elseif ( DB != " " ) $J [ " collation " ] = db_collation ( DB , $pb ); elseif ( $y == " sql " ){ foreach ( get_vals ( " SHOW GRANTS " ) as $md ){ if ( preg_match ( '~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~' , $md , $B ) && $B [ 1 ]){ $C = stripcslashes ( idf_unescape ( " ` $B[2] ` " )); break ;}}} echo '
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
< p >
2018-12-25 21:50:48 +01:00
',($_POST["add_x"]||strpos($C,"\n")?' < textarea id = " name " name = " name " rows = " 10 " cols = " 40 " > '.h($C).' </ textarea >< br > ':' < input name = " name " id = " name " value = " '.h( $C ).' " data - maxlength = " 64 " autocapitalize = " off " > ')."\n".($pb?html_select("collation",array(""=>"(".lang(101).")")+$pb,$J["collation"]).doc_link(array(' sql '=>"charset-charsets.html",' mariadb '=>"supported-character-sets-and-collations/",' mssql '=>"ms187963.aspx",)):""),script("focus(qs(' #name'));"),'<input type="submit" value="',lang(14),'">
';if(DB!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(127). " '>".confirm(lang(175,DB))."\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type=' image ' class=' icon ' name=' add ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME). " ? file = plus . gif & version = 4.7 . 0 " ). " ' alt=' + ' title=' " .lang(108). " '>\n";echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2018-04-01 23:34:54 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["scheme"])){$J=$_POST;if($_POST&&!$o){$A=preg_replace(' ~ ns = [ ^& ] *&~ ',' ' , ME ) . " ns= " ; if ( $_POST [ " drop " ]) query_redirect ( " DROP SCHEMA " . idf_escape ( $_GET [ " ns " ]), $A , lang ( 188 )); else { $C = trim ( $J [ " name " ]); $A .= urlencode ( $C ); if ( $_GET [ " ns " ] == " " ) query_redirect ( " CREATE SCHEMA " . idf_escape ( $C ), $A , lang ( 189 )); elseif ( $_GET [ " ns " ] != $C ) query_redirect ( " ALTER SCHEMA " . idf_escape ( $_GET [ " ns " ]) . " RENAME TO " . idf_escape ( $C ), $A , lang ( 190 )); else
redirect ( $A );}} page_header ( $_GET [ " ns " ] != " " ? lang ( 69 ) : lang ( 70 ), $o ); if ( ! $J ) $J [ " name " ] = $_GET [ " ns " ]; echo '
2018-04-01 23:34:54 +02:00
< form action = " " method = " post " >
2018-06-30 00:38:01 +02:00
< p >< input name = " name " id = " name " value = " ',h( $J["name"] ),' " autocapitalize = " off " >
2018-04-01 23:34:54 +02:00
',script("focus(qs(' #name'));"),'<input type="submit" value="',lang(14),'">
2018-12-25 21:50:48 +01:00
';if($_GET["ns"]!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(127). " '>".confirm(lang(175,$_GET["ns"]))."\n";echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["call"])){$da=($_GET["name"]?$_GET["name"]:$_GET["call"]);page_header(lang(191).": ".h($da),$o);$Vg=routine($_GET["call"],(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Id=array();$Kf=array();foreach($Vg["fields"]as$t=>$p){if(substr($p["inout"],-3)=="OUT")$Kf[$t]="@".idf_escape($p["field"])." AS ".idf_escape($p["field"]);if(!$p["inout"]||substr($p["inout"],0,2)=="IN")$Id[]=$t;}if(!$o&&$_POST){$ab=array();foreach($Vg["fields"]as$z=>$p){if(in_array($z,$Id)){$X=process_input($p);if($X===false)$X="' '";if(isset($Kf[$z]))$h->query("SET @".idf_escape($p["field"])." = $X");}$ab[]=(isset($Kf[$z])?"@".idf_escape($p["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$ab).")";$Dh=microtime(true);$H=$h->multi_query($G);$_a=$h->affected_rows;echo$b->selectQuery($G,$Dh,!$H);if(!$H)echo"<p class=' error ' > " .error(). " \n " ;else { $i =connect();if(is_object( $i )) $i->select_db (DB);do { $H = $h->store_result ();if(is_object( $H ))select( $H , $i );else
echo " <p class='message'> " . lang ( 192 , $_a ) . " \n " ;} while ( $h -> next_result ()); if ( $Kf ) select ( $h -> query ( " SELECT " . implode ( " , " , $Kf )));}} echo '
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
2018-12-25 21:50:48 +01:00
';if($Id){echo"<table cellspacing=' 0 ' class=' layout ' > \n " ;foreach( $Id
as $z ){ $p = $Vg [ " fields " ][ $z ]; $C = $p [ " field " ]; echo " <tr><th> " . $b -> fieldName ( $p ); $Y = $_POST [ " fields " ][ $C ]; if ( $Y != " " ){ if ( $p [ " type " ] == " enum " ) $Y =+ $Y ; if ( $p [ " type " ] == " set " ) $Y = array_sum ( $Y );} input ( $p , $Y ,( string ) $_POST [ " function " ][ $C ]); echo " \n " ;} echo " </table> \n " ;} echo ' < p >
< input type = " submit " value = " ',lang(191),' " >
< input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$J=$_POST;if($_POST&&!$o&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$Ne=($_POST["drop"]?lang(193):($C!=""?lang(194):lang(195)));$ze=ME."table=".urlencode($a);if(!$_POST["drop"]){$J["source"]=array_filter($J["source"],' strlen ');ksort($J["source"]);$Yh=array();foreach($J["source"]as$z=>$X)$Yh[$z]=$J["target"][$z];$J["target"]=$Yh;}if($y=="sqlite")queries_redirect($ze,$Ne,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($J)))));else{$c="ALTER TABLE ".table($a);$gc="\nDROP ".($y=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$gc,$ze,$Ne);else{query_redirect($c.($C!=""?"$gc,":"")."\nADD".format_foreign_key($J),$ze,$Ne);$o=lang(196)."<br>$o";}}}page_header(lang(197),$o,array("table"=>$a),h($a));if($_POST){ksort($J["source"]);if($_POST["add"])$J["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$J["target"]=array();}elseif($C!=""){$fd=foreign_keys($a);$J=$fd[$C];$J["source"][]="";}else{$J["table"]=$a;$J["source"]=array("");}$wh=array_keys(fields($a));$Yh=($a===$J["table"]?$wh:array_keys(fields($J["table"])));$Eg=array_keys(array_filter(table_status(' ',true),' fk_support '));echo'
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
< p >
2018-06-30 00:38:01 +02:00
' ; if ( $J [ " db " ] == " " && $J [ " ns " ] == " " ){ echo
2018-12-25 21:50:48 +01:00
lang ( 198 ), ' :
',html_select("table",$Eg,$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(199),' " ></ noscript >
2014-05-08 19:46:08 +02:00
< table cellspacing = " 0 " >
2018-12-25 21:50:48 +01:00
< thead >< tr >< th id = " label-source " > ',lang(134),' < th id = " label-target " > ',lang(135),' </ thead >
';$de=0;foreach($J["source"]as$z=>$X){echo"<tr>","<td>".html_select("source[".(+$z)."]",array(-1=>"")+$wh,$X,($de==count($J["source"])-1?"foreignAddRow.call(this);":1),"label-source"),"<td>".html_select("target[".(+$z)."]",$Yh,$J["target"][$z],1,"label-target");$de++;}echo' </ table >
2014-05-08 19:46:08 +02:00
< p >
2018-12-25 21:50:48 +01:00
',lang(103),' : ',html_select("on_delete",array(-1=>"")+explode("|",$rf),$J["on_delete"]),' ',lang(102),' : ',html_select("on_update",array(-1=>"")+explode("|",$rf),$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 >
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
< noscript >< p >< input type = " submit " name = " add " value = " ',lang(200),' " ></ noscript >
';}if($C!=""){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,$C));}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;$Hf="VIEW";if($y=="pgsql"&&$a!=""){$Fh=table_status($a);$Hf=strtoupper($Fh["Engine"]);}if($_POST&&!$o){$C=trim($J["name"]);$Ha=" AS\n$J[select]";$ze=ME."table=".urlencode($C);$Ne=lang(201);$T=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$C&&$y!="sqlite"&&$T=="VIEW"&&$Hf=="VIEW")query_redirect(($y=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ha,$ze,$Ne);else{$ai=$C."_adminer_".uniqid();drop_create("DROP $Hf ".table($a),"CREATE $T ".table($C).$Ha,"DROP $T ".table($C),"CREATE $T ".table($ai).$Ha,"DROP $T ".table($ai),($_POST["drop"]?substr(ME,0,-1):$ze),lang(202),$Ne,lang(203),$a,$C);}}if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;$J["materialized"]=($Hf!="VIEW");if(!$o)$o=error();}page_header(($a!=""?lang(44):lang(204)),$o,array("table"=>$a),h($a));echo'
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
2018-12-25 21:50:48 +01:00
< p > ',lang(183),' : < input name = " name " value = " ',h( $J["name"] ),' " data - maxlength = " 64 " autocapitalize = " off " >
',(support("materializedview")?" ".checkbox("materialized",1,$J["materialized"],lang(129)):""),' < p > ';textarea("select",$J["select"]);echo' < p >
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
';if($a!=""){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,$a));}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Vd=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Gh=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$o){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(205));elseif(in_array($J["INTERVAL_FIELD"],$Vd)&&isset($Gh[$J["STATUS"]])){$ah="\nON SCHEDULE ".($J["INTERVAL_VALUE"]?"EVERY ".q($J["INTERVAL_VALUE"])." $J[INTERVAL_FIELD]".($J["STARTS"]?" STARTS ".q($J["STARTS"]):"").($J["ENDS"]?" ENDS ".q($J["ENDS"]):""):"AT ".q($J["STARTS"]))." ON COMPLETION".($J["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(206):lang(207)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$ah.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$ah)."\n".$Gh[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(208).": ".h($aa):lang(209)),$o);if(!$J&&$aa!=""){$K=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$J=reset($K);}echo'
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
2018-12-25 21:50:48 +01:00
< table cellspacing = " 0 " class = " layout " >
< tr >< th > ',lang(183),' < td >< input name = " EVENT_NAME " value = " ',h( $J["EVENT_NAME"] ),' " data - maxlength = " 64 " autocapitalize = " off " >
< tr >< th title = " datetime " > ',lang(210),' < td >< input name = " STARTS " value = " ',h( " $J [ EXECUTE_AT ] $J [ STARTS ] " ),' " >
< tr >< th title = " datetime " > ',lang(211),' < td >< input name = " ENDS " value = " ',h( $J["ENDS"] ),' " >
< tr >< th > ',lang(212),' < td >< input type = " number " name = " INTERVAL_VALUE " value = " ',h( $J["INTERVAL_VALUE"] ),' " class = " size " > ',html_select("INTERVAL_FIELD",$Vd,$J["INTERVAL_FIELD"]),' < tr >< th > ',lang(118),' < td > ',html_select("STATUS",$Gh,$J["STATUS"]),' < tr >< th > ',lang(51),' < td >< input name = " EVENT_COMMENT " value = " ',h( $J["EVENT_COMMENT"] ),' " data - maxlength = " 64 " >
< tr >< th >< td > ',checkbox("ON_COMPLETION","PRESERVE",$J["ON_COMPLETION"]=="PRESERVE",lang(213)),' </ table >
2018-06-30 00:38:01 +02:00
< p > ';textarea("EVENT_DEFINITION",$J["EVENT_DEFINITION"]);echo' < p >
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
';if($aa!=""){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,$aa));}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["procedure"])){$da=($_GET["name"]?$_GET["name"]:$_GET["procedure"]);$Vg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$o){$Ef=routine($_GET["procedure"],$Vg);$ai="$J[name]_adminer_".uniqid();drop_create("DROP $Vg ".routine_id($da,$Ef),create_routine($Vg,$J),"DROP $Vg ".routine_id($J["name"],$J),create_routine($Vg,array("name"=>$ai)+$J),"DROP $Vg ".routine_id($ai,$J),substr(ME,0,-1),lang(214),lang(215),lang(216),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(217):lang(218)).": ".h($da):(isset($_GET["function"])?lang(219):lang(220))),$o);if(!$_POST&&$da!=""){$J=routine($_GET["procedure"],$Vg);$J["name"]=$da;}$pb=get_vals("SHOW CHARACTER SET");sort($pb);$Wg=routine_languages();echo'
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " id = " form " >
2018-12-25 21:50:48 +01:00
< p > ',lang(183),' : < input name = " name " value = " ',h( $J["name"] ),' " data - maxlength = " 64 " autocapitalize = " off " >
',($Wg?lang(19).": ".html_select("language",$Wg,$J["language"])."\n":""),' < input type = " submit " value = " ',lang(14),' " >
< div class = " scrollable " >
2014-05-08 19:46:08 +02:00
< table cellspacing = " 0 " class = " nowrap " >
2018-12-25 21:50:48 +01:00
';edit_fields($J["fields"],$pb,$Vg);if(isset($_GET["function"])){echo"<tr><td>".lang(221);edit_type("returns",$J["returns"],$pb,array(),($y=="pgsql"?array("void","trigger"):array()));}echo' </ table >
</ div >
2018-06-30 00:38:01 +02:00
< p > ';textarea("definition",$J["definition"]);echo' < p >
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
';if($da!=""){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,$da));}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
' ;} elseif ( isset ( $_GET [ " sequence " ])){ $fa = $_GET [ " sequence " ]; $J = $_POST ; if ( $_POST &&! $o ){ $A = substr ( ME , 0 , - 1 ); $C = trim ( $J [ " name " ]); if ( $_POST [ " drop " ]) query_redirect ( " DROP SEQUENCE " . idf_escape ( $fa ), $A , lang ( 222 )); elseif ( $fa == " " ) query_redirect ( " CREATE SEQUENCE " . idf_escape ( $C ), $A , lang ( 223 )); elseif ( $fa != $C ) query_redirect ( " ALTER SEQUENCE " . idf_escape ( $fa ) . " RENAME TO " . idf_escape ( $C ), $A , lang ( 224 )); else
redirect ( $A );} page_header ( $fa != " " ? lang ( 225 ) . " : " . h ( $fa ) : lang ( 226 ), $o ); if ( ! $J ) $J [ " name " ] = $fa ; echo '
2018-04-01 23:34:54 +02:00
< form action = " " method = " post " >
2018-06-30 00:38:01 +02:00
< p >< input name = " name " value = " ',h( $J["name"] ),' " autocapitalize = " off " >
2018-04-01 23:34:54 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
';if($fa!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(127). " '>".confirm(lang(175,$fa))."\n";echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2018-04-01 23:34:54 +02:00
</ form >
2018-12-25 21:50:48 +01:00
' ;} elseif ( isset ( $_GET [ " type " ])){ $ga = $_GET [ " type " ]; $J = $_POST ; if ( $_POST &&! $o ){ $A = substr ( ME , 0 , - 1 ); if ( $_POST [ " drop " ]) query_redirect ( " DROP TYPE " . idf_escape ( $ga ), $A , lang ( 227 )); else
query_redirect ( " CREATE TYPE " . idf_escape ( trim ( $J [ " name " ])) . " $J[as] " , $A , lang ( 228 ));} page_header ( $ga != " " ? lang ( 229 ) . " : " . h ( $ga ) : lang ( 230 ), $o ); if ( ! $J ) $J [ " as " ] = " AS " ; echo '
2018-04-01 23:34:54 +02:00
< form action = " " method = " post " >
< p >
2018-12-25 21:50:48 +01:00
';if($ga!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(127). " '>".confirm(lang(175,$ga))."\n";else{echo"<input name=' name ' value=' " .h( $J['name'] ). " ' autocapitalize=' off '>\n";textarea("as",$J["as"]);echo"<p><input type=' submit ' value=' " .lang(14). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2018-04-01 23:34:54 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$_i=trigger_options();$J=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$o&&in_array($_POST["Timing"],$_i["Timing"])&&in_array($_POST["Event"],$_i["Event"])&&in_array($_POST["Type"],$_i["Type"])){$qf=" ON ".table($a);$gc="DROP TRIGGER ".idf_escape($C).($y=="pgsql"?$qf:"");$ze=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($gc,$ze,lang(231));else{if($C!="")queries($gc);queries_redirect($ze,($C!=""?lang(232):lang(233)),queries(create_trigger($qf,$_POST)));if($C!="")queries(create_trigger($qf,$J+array("Type"=>reset($_i["Type"]))));}}$J=$_POST;}page_header(($C!=""?lang(234).": ".h($C):lang(235)),$o,array("table"=>$a));echo'
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " id = " form " >
2018-12-25 21:50:48 +01:00
< table cellspacing = " 0 " class = " layout " >
< tr >< th > ',lang(236),' < td > ',html_select("Timing",$_i["Timing"],$J["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, ' " .js_escape( $a ). " ', this.form);"),' < tr >< th > ',lang(237),' < td > ',html_select("Event",$_i["Event"],$J["Event"],"this.form[' Timing '].onchange();"),(in_array("UPDATE OF",$_i["Event"])?" <input name=' Of ' value=' " .h( $J["Of"] ). " ' class=' hidden '>":""),' < tr >< th > ',lang(50),' < td > ',html_select("Type",$_i["Type"],$J["Type"]),' </ table >
< p > ',lang(183),' : < input name = " Trigger " value = " ',h( $J["Trigger"] ),' " data - maxlength = " 64 " autocapitalize = " off " >
2018-06-30 00:38:01 +02:00
',script("qs(' #form')['Timing'].onchange();"),'<p>';textarea("Statement",$J["Statement"]);echo'<p>
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
';if($C!=""){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,$C));}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$qg=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$Bb)$qg[$Bb][$J["Privilege"]]=$J["Comment"];}$qg["Server Admin"]+=$qg["File access on server"];$qg["Databases"]["Create routine"]=$qg["Procedures"]["Create routine"];unset($qg["Procedures"]["Create routine"]);$qg["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$qg["Columns"][$X]=$qg["Tables"][$X];unset($qg["Server Admin"]["Usage"]);foreach($qg["Tables"]as$z=>$X)unset($qg["Databases"][$z]);$af=array();if($_POST){foreach($_POST["objects"]as$z=>$X)$af[$X]=(array)$af[$X]+(array)$_POST["grants"][$z];}$nd=array();$of="";if(isset($_GET["host"])&&($H=$h->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match(' ~ GRANT ( .* ) ON ( .* ) TO ~ ',$J[0],$B)&&preg_match_all(' ~ * ([ ^ (,] * [ ^ ,(])( * \ ([ ^ )] + \ )) ? ~ ' , $B [ 1 ], $Fe , PREG_SET_ORDER )){ foreach ( $Fe
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 )) $of = $B [ 1 ];}} if ( $_POST &&! $o ){ $pf = ( isset ( $_GET [ " host " ]) ? q ( $ha ) . " @ " . q ( $_GET [ " host " ]) : " '' " ); if ( $_POST [ " drop " ]) query_redirect ( " DROP USER $pf " , ME . " privileges= " , lang ( 238 )); else { $cf = q ( $_POST [ " user " ]) . " @ " . q ( $_POST [ " host " ]); $Yf = $_POST [ " pass " ]; if ( $Yf != '' &&! $_POST [ " hashed " ]){ $Yf = $h -> result ( " SELECT PASSWORD( " . q ( $Yf ) . " ) " ); $o =! $Yf ;} $Gb = false ; if ( ! $o ){ if ( $pf != $cf ){ $Gb = queries (( min_version ( 5 ) ? " CREATE USER " : " GRANT USAGE ON *.* TO " ) . " $cf IDENTIFIED BY PASSWORD " . q ( $Yf )); $o =! $Gb ;} elseif ( $Yf != $of ) queries ( " SET PASSWORD FOR $cf = " . q ( $Yf ));} if ( ! $o ){ $Sg = array (); foreach ( $af
as $jf => $md ){ if ( isset ( $_GET [ " grant " ])) $md = array_filter ( $md ); $md = array_keys ( $md ); if ( isset ( $_GET [ " grant " ])) $Sg = array_diff ( array_keys ( array_filter ( $af [ $jf ], 'strlen' )), $md ); elseif ( $pf == $cf ){ $mf = array_keys (( array ) $nd [ $jf ]); $Sg = array_diff ( $mf , $md ); $md = array_diff ( $md , $mf ); unset ( $nd [ $jf ]);} if ( preg_match ( '~^(.+)\s*(\(.*\))?$~U' , $jf , $B ) && ( ! grant ( " REVOKE " , $Sg , $B [ 2 ], " ON $B[1] FROM $cf " ) ||! grant ( " GRANT " , $md , $B [ 2 ], " ON $B[1] TO $cf " ))){ $o = true ; break ;}}} if ( ! $o && isset ( $_GET [ " host " ])){ if ( $pf != $cf ) queries ( " DROP USER $pf " ); elseif ( ! isset ( $_GET [ " grant " ])){ foreach ( $nd
as $jf => $Sg ){ if ( preg_match ( '~^(.+)(\(.*\))?$~U' , $jf , $B )) grant ( " REVOKE " , array_keys ( $Sg ), $B [ 2 ], " ON $B[1] FROM $cf " );}}} queries_redirect ( ME . " privileges= " ,( isset ( $_GET [ " host " ]) ? lang ( 239 ) : lang ( 240 )), ! $o ); if ( $Gb ) $h -> query ( " DROP USER $cf " );}} page_header (( isset ( $_GET [ " host " ]) ? lang ( 36 ) . " : " . h ( " $ha @ $_GET[host] " ) : lang ( 146 )), $o , array ( " privileges " => array ( '' , lang ( 72 )))); if ( $_POST ){ $J = $_POST ; $nd = $af ;} else { $J = $_GET + array ( " host " => $h -> result ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1) " )); $J [ " pass " ] = $of ; if ( $of != " " ) $J [ " hashed " ] = true ; $nd [( DB == " " || $nd ? " " : idf_escape ( addcslashes ( DB , " %_ \\ " ))) . " .* " ] = array ();} echo ' < form action = " " method = " post " >
< table cellspacing = " 0 " class = " layout " >
< tr >< th > ',lang(35),' < td >< input name = " host " data - maxlength = " 60 " value = " ',h( $J["host"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(36),' < td >< input name = " user " data - maxlength = " 80 " value = " ',h( $J["user"] ),' " autocapitalize = " off " >
2018-06-30 00:38:01 +02:00
< tr >< th > ',lang(37),' < td >< input name = " pass " id = " pass " value = " ',h( $J["pass"] ),' " autocomplete = " new-password " >
' ; if ( ! $J [ " hashed " ]) echo
2018-04-01 23:34:54 +02:00
script ( " typePassword(qs('#pass')); " ); echo
2018-12-25 21:50:48 +01:00
checkbox ( " hashed " , 1 , $J [ " hashed " ], lang ( 241 ), " typePassword(this.form['pass'], this.checked); " ), ' </ table >
2014-05-08 19:46:08 +02:00
2018-12-25 21:50:48 +01:00
';echo"<table cellspacing=' 0 '>\n","<thead><tr><th colspan=' 2 '>".lang(72).doc_link(array(' sql ' => " grant.html#priv_level " )); $t = 0 ; foreach ( $nd
as $jf => $md ){ echo '<th>' . ( $jf != " *.* " ? " <input name='objects[ $t ]' value=' " . h ( $jf ) . " ' size='10' autocapitalize='off'> " : " <input type='hidden' name='objects[ $t ]' value='*.*' size='10'>*.* " ); $t ++ ;} echo " </thead> \n " ; foreach ( array ( " " => " " , " Server Admin " => lang ( 35 ), " Databases " => lang ( 38 ), " Tables " => lang ( 131 ), " Columns " => lang ( 49 ), " Procedures " => lang ( 242 ),) as $Bb => $Xb ){ foreach (( array ) $qg [ $Bb ] as $pg => $ub ){ echo " <tr " . odd () . " ><td " . ( $Xb ? " > $Xb <td " : " colspan='2' " ) . ' lang="en" title="' . h ( $ub ) . '">' . h ( $pg ); $t = 0 ; foreach ( $nd
as $jf => $md ){ $C = " 'grants[ $t ][ " . h ( strtoupper ( $pg )) . " ]' " ; $Y = $md [ strtoupper ( $pg )]; if ( $Bb == " Server Admin " && $jf != ( isset ( $nd [ " *.* " ]) ? " *.* " : " .* " )) echo " <td> " ; elseif ( isset ( $_GET [ " grant " ])) echo " <td><select name= $C ><option><option value='1' " . ( $Y ? " selected " : " " ) . " > " . lang ( 243 ) . " <option value='0' " . ( $Y == " 0 " ? " selected " : " " ) . " > " . lang ( 244 ) . " </select> " ; else { echo " <td align='center'><label class='block'> " , " <input type='checkbox' name= $C value='1' " . ( $Y ? " checked " : " " ) . ( $pg == " All privileges " ? " id='grants- $t -all'> " : " > " . ( $pg == " Grant option " ? " " : script ( " qsl('input').onclick = function () { if (this.checked) formUncheck('grants- $t -all'); }; " ))), " </label> " ;} $t ++ ;}}} echo " </table> \n " , ' < p >
2014-05-08 19:46:08 +02:00
< input type = " submit " value = " ',lang(14),' " >
2018-12-25 21:50:48 +01:00
';if(isset($_GET["host"])){echo' < input type = " submit " name = " drop " value = " ',lang(127),' " > ',confirm(lang(175,"$ha@$_GET[host]"));}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$o){$ke=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$ke++;}queries_redirect(ME."processlist=",lang(245,$ke),$ke||!$_POST["kill"]);}page_header(lang(116),$o);echo'
2014-05-08 19:46:08 +02:00
< form action = " " method = " post " >
2018-12-25 21:50:48 +01:00
< div class = " scrollable " >
2018-04-01 23:34:54 +02:00
< table cellspacing = " 0 " class = " nowrap checkable " >
2018-12-25 21:50:48 +01:00
',script("mixin(qsl(' table '), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");$t=-1;foreach(process_list()as$t=>$J){if(!$t){echo"<thead><tr lang=' en ' > " .(support( " kill " )? " < th > " : " " );foreach( $J
as $z => $X ) echo " <th> $z " . doc_link ( array ( 'sql' => " show-processlist.html#processlist_ " . strtolower ( $z ), 'pgsql' => " monitoring-stats.html#PG-STAT-ACTIVITY-VIEW " , 'oracle' => " ../b14237/dynviews_2088.htm " ,)); echo " </thead> \n " ;} echo " <tr " . odd () . " > " . ( support ( " kill " ) ? " <td> " . checkbox ( " kill[] " , $J [ $y == " sql " ? " Id " : " pid " ], 0 ) : " " ); foreach ( $J
as $z => $X ) echo " <td> " . (( $y == " sql " && $z == " Info " && preg_match ( " ~Query|Killed~ " , $J [ " Command " ]) && $X != " " ) || ( $y == " pgsql " && $z == " current_query " && $X != " <IDLE> " ) || ( $y == " oracle " && $z == " sql_text " && $X != " " ) ? " <code class='jush- $y '> " . shorten_utf8 ( $X , 100 , " </code> " ) . ' <a href="' . h ( ME . ( $J [ " db " ] != " " ? " db= " . urlencode ( $J [ " db " ]) . " & " : " " ) . " sql= " . urlencode ( $X )) . '">' . lang ( 246 ) . '</a>' : h ( $X )); echo " \n " ;} echo ' </ table >
</ div >
2014-05-08 19:46:08 +02:00
< p >
2018-12-25 21:50:48 +01:00
';if(support("kill")){echo($t+1)."/".lang(247,max_connections()),"<p><input type=' submit ' value=' " .lang(248). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $pi ,' " >
2014-05-08 19:46:08 +02:00
</ form >
2018-12-25 21:50:48 +01:00
' , script ( " tableCheck(); " );} elseif ( isset ( $_GET [ " select " ])){ $a = $_GET [ " select " ]; $R = table_status1 ( $a ); $x = indexes ( $a ); $q = fields ( $a ); $fd = column_foreign_keys ( $a ); $lf = $R [ " Oid " ]; parse_str ( $_COOKIE [ " adminer_import " ], $za ); $Tg = array (); $f = array (); $ei = null ; foreach ( $q
as $z => $p ){ $C = $b -> fieldName ( $p ); if ( isset ( $p [ " privileges " ][ " select " ]) && $C != " " ){ $f [ $z ] = html_entity_decode ( strip_tags ( $C ), ENT_QUOTES ); if ( is_shortable ( $p )) $ei = $b -> selectLengthProcess ();} $Tg += $p [ " privileges " ];} list ( $L , $od ) = $b -> selectColumnsProcess ( $f , $x ); $Zd = count ( $od ) < count ( $L ); $Z = $b -> selectSearchProcess ( $q , $x ); $Af = $b -> selectOrderProcess ( $q , $x ); $_ = $b -> selectLimitProcess (); if ( $_GET [ " val " ] && is_ajax ()){ header ( " Content-Type: text/plain; charset=utf-8 " ); foreach ( $_GET [ " val " ] as $Gi => $J ){ $Ha = convert_field ( $q [ key ( $J )]); $L = array ( $Ha ? $Ha : idf_escape ( key ( $J ))); $Z [] = where_check ( $Gi , $q ); $I = $n -> select ( $a , $L , $Z , $L ); if ( $I ) echo
reset ( $I -> fetch_row ());} exit ;} $lg = $Ii = null ; foreach ( $x
as $w ){ if ( $w [ " type " ] == " PRIMARY " ){ $lg = array_flip ( $w [ " columns " ]); $Ii = ( $L ? $lg : array ()); foreach ( $Ii
as $z => $X ){ if ( in_array ( idf_escape ( $z ), $L )) unset ( $Ii [ $z ]);} break ;}} if ( $lf &&! $lg ){ $lg = $Ii = array ( $lf => 0 ); $x [] = array ( " type " => " PRIMARY " , " columns " => array ( $lf ));} if ( $_POST &&! $o ){ $jj = $Z ; if ( ! $_POST [ " all " ] && is_array ( $_POST [ " check " ])){ $gb = array (); foreach ( $_POST [ " check " ] as $db ) $gb [] = where_check ( $db , $q ); $jj [] = " (( " . implode ( " ) OR ( " , $gb ) . " )) " ;} $jj = ( $jj ? " \n WHERE " . implode ( " AND " , $jj ) : " " ); if ( $_POST [ " export " ]){ cookie ( " adminer_import " , " output= " . urlencode ( $_POST [ " output " ]) . " &format= " . urlencode ( $_POST [ " format " ])); dump_headers ( $a ); $b -> dumpTable ( $a , " " ); $kd = ( $L ? implode ( " , " , $L ) : " * " ) . convert_fields ( $f , $q , $L ) . " \n FROM " . table ( $a ); $qd = ( $od && $Zd ? " \n GROUP BY " . implode ( " , " , $od ) : " " ) . ( $Af ? " \n ORDER BY " . implode ( " , " , $Af ) : " " ); if ( ! is_array ( $_POST [ " check " ]) || $lg ) $G = " SELECT $kd $jj $qd " ; else { $Ei = array (); foreach ( $_POST [ " check " ] as $X ) $Ei [] = " (SELECT " . limit ( $kd , " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $q ) . $qd , 1 ) . " ) " ; $G = implode ( " UNION ALL " , $Ei );} $b -> dumpData ( $a , " table " , $G ); exit ;} if ( ! $b -> selectEmailProcess ( $Z , $fd )){ if ( $_POST [ " save " ] || $_POST [ " delete " ]){ $H = true ; $_a = 0 ; $O = array (); if ( ! $_POST [ " delete " ]){ foreach ( $f
as $C => $X ){ $X = process_input ( $q [ $C ]); if ( $X !== null && ( $_POST [ " clone " ] || $X !== false )) $O [ idf_escape ( $C )] = ( $X !== false ? $X : idf_escape ( $C ));}} if ( $_POST [ " delete " ] || $O ){ if ( $_POST [ " clone " ]) $G = " INTO " . table ( $a ) . " ( " . implode ( " , " , array_keys ( $O )) . " ) \n SELECT " . implode ( " , " , $O ) . " \n FROM " . table ( $a ); if ( $_POST [ " all " ] || ( $lg && is_array ( $_POST [ " check " ])) || $Zd ){ $H = ( $_POST [ " delete " ] ? $n -> delete ( $a , $jj ) : ( $_POST [ " clone " ] ? queries ( " INSERT $G $jj " ) : $n -> update ( $a , $O , $jj ))); $_a = $h -> affected_rows ;} else { foreach (( array ) $_POST [ " check " ] as $X ){ $fj = " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $q ); $H = ( $_POST [ " delete " ] ? $n -> delete ( $a , $fj , 1 ) : ( $_POST [ " clone " ] ? queries ( " INSERT " . limit1 ( $a , $G , $fj )) : $n -> update ( $a , $O , $fj , 1 ))); if ( ! $H ) break ; $_a += $h -> affected_rows ;}}} $Ne = lang ( 249 , $_a ); if ( $_POST [ " clone " ] && $H && $_a == 1 ){ $qe = last_id (); if ( $qe ) $Ne = lang ( 168 , " $qe " );} queries_redirect ( remove_from_uri ( $_POST [ " all " ] && $_POST [ " delete " ] ? " page " : " " ), $Ne , $H ); if ( ! $_POST [ " delete " ]){ edit_form ( $a , $q ,( array ) $_POST [ " fields " ], ! $_POST [ " clone " ]); page_footer (); exit ;}} elseif ( ! $_POST [ " import " ]){ if ( ! $_POST [ " val " ]) $o = lang ( 250 ); else { $H = true ; $_a = 0 ; foreach ( $_POST [ " val " ] as $Gi => $J ){ $O = array (); foreach ( $J
as $z => $X ){ $z = bracket_escape ( $z , 1 ); $O [ idf_escape ( $z )] = ( preg_match ( '~char|text~' , $q [ $z ][ " type " ]) || $X != " " ? $b -> processInput ( $q [ $z ], $X ) : " NULL " );} $H = $n -> update ( $a , $O , " WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $Gi , $q ), ! $Zd &&! $lg , " " ); if ( ! $H ) break ; $_a += $h -> affected_rows ;} queries_redirect ( remove_from_uri (), lang ( 249 , $_a ), $H );}} elseif ( ! is_string ( $Uc = get_file ( " csv_file " , true ))) $o = upload_error ( $Uc ); elseif ( ! preg_match ( '~~u' , $Uc )) $o = lang ( 251 ); else { cookie ( " adminer_import " , " output= " . urlencode ( $za [ " output " ]) . " &format= " . urlencode ( $_POST [ " separator " ])); $H = true ; $rb = array_keys ( $q ); preg_match_all ( '~(?>"[^"]*"|[^"\r\n]+)+~' , $Uc , $Fe ); $_a = count ( $Fe [ 0 ]); $n -> begin (); $M = ( $_POST [ " separator " ] == " csv " ? " , " : ( $_POST [ " separator " ] == " tsv " ? " \t " : " ; " )); $K = array (); foreach ( $Fe [ 0 ] as $z => $X ){ preg_match_all ( " ~((?> \" [^ \" ]* \" )+|[^ $M ]*) $M ~ " , $X . $M , $Ge ); if ( ! $z &&! array_diff ( $Ge [ 1 ], $rb )){ $rb = $Ge [ 1 ]; $_a -- ;} else { $O = array (); foreach ( $Ge [ 1 ] as $t => $nb ) $O [ idf_escape ( $rb [ $t ])] = ( $nb == " " && $q [ $rb [ $t ]][ " null " ] ? " NULL " : q ( str_replace ( '""' , '"' , preg_replace ( '~^"|"$~' , '' , $nb )))); $K [] = $O ;}} $H = ( ! $K || $n -> insertUpdate ( $a , $K , $lg )); if ( $H ) $H = $n -> commit (); queries_redirect ( remove_from_uri ( " page " ), lang ( 252 , $_a ), $H ); $n -> rollback ();}}} $Qh = $b -> tableName ( $R ); if ( is_ajax ()){ page_headers (); ob_start ();} else
page_header ( lang ( 54 ) . " : $Qh " , $o ); $O = null ; if ( isset ( $Tg [ " insert " ]) ||! support ( " table " )){ $O = " " ; foreach (( array ) $_GET [ " where " ] as $X ){ if ( $fd [ $X [ " col " ]] && count ( $fd [ $X [ " col " ]]) == 1 && ( $X [ " op " ] == " = " || ( ! $X [ " op " ] &&! preg_match ( '~[_%]~' , $X [ " val " ])))) $O .= " &set " . urlencode ( " [ " . bracket_escape ( $X [ " col " ]) . " ] " ) . " = " . urlencode ( $X [ " val " ]);}} $b -> selectLinks ( $R , $O ); if ( ! $f && support ( " table " )) echo " <p class='error'> " . lang ( 253 ) . ( $q ? " . " : " : " . error ()) . " \n " ; else { echo " <form action='' id='form'> \n " , " <div style='display: none;'> " ; hidden_fields_get (); echo ( DB != " " ? '<input type="hidden" name="db" value="' . h ( DB ) . '">' . ( isset ( $_GET [ " ns " ]) ? '<input type="hidden" name="ns" value="' . h ( $_GET [ " ns " ]) . '">' : " " ) : " " ); echo '<input type="hidden" name="select" value="' . h ( $a ) . '">' , " </div> \n " ; $b -> selectColumnsPrint ( $L , $f ); $b -> selectSearchPrint ( $Z , $f , $x ); $b -> selectOrderPrint ( $Af , $f , $x ); $b -> selectLimitPrint ( $_ ); $b -> selectLengthPrint ( $ei ); $b -> selectActionPrint ( $x ); echo " </form> \n " ; $E = $_GET [ " page " ]; if ( $E == " last " ){ $id = $h -> result ( count_rows ( $a , $Z , $Zd , $od )); $E = floor ( max ( 0 , $id - 1 ) / $_ );} $fh = $L ; $pd = $od ; if ( ! $fh ){ $fh [] = " * " ; $Cb = convert_fields ( $f , $q , $L ); if ( $Cb ) $fh [] = substr ( $Cb , 2 );} foreach ( $L
as $z => $X ){ $p = $q [ idf_unescape ( $X )]; if ( $p && ( $Ha = convert_field ( $p ))) $fh [ $z ] = " $Ha AS $X " ;} if ( ! $Zd && $Ii ){ foreach ( $Ii
as $z => $X ){ $fh [] = idf_escape ( $z ); if ( $pd ) $pd [] = idf_escape ( $z );}} $H = $n -> select ( $a , $fh , $Z , $pd , $Af , $_ , $E , true ); if ( ! $H ) echo " <p class='error'> " . error () . " \n " ; else { if ( $y == " mssql " && $E ) $H -> seek ( $_ * $E ); $tc = array (); echo " <form action='' method='post' enctype='multipart/form-data'> \n " ; $K = array (); while ( $J = $H -> fetch_assoc ()){ if ( $E && $y == " oracle " ) unset ( $J [ " RNUM " ]); $K [] = $J ;} if ( $_GET [ " page " ] != " last " && $_ != " " && $od && $Zd && $y == " sql " ) $id = $h -> result ( " SELECT FOUND_ROWS() " ); if ( ! $K ) echo " <p class='message'> " . lang ( 12 ) . " \n " ; else { $Qa = $b -> backwardKeys ( $a , $Qh ); echo " <div class='scrollable'> " , " <table id='table' cellspacing='0' class='nowrap checkable'> " , script ( " mixin(qs('#table'), { onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown}); " ), " <thead><tr> " . ( ! $od && $L ? " " : " <td><input type='checkbox' id='all-page' class='jsonly'> " . script ( " qs('#all-page').onclick = partial(formCheck, /check/); " , " " ) . " <a href=' " . h ( $_GET [ " modify " ] ? remove_from_uri ( " modify " ) : $_SERVER [ " REQUEST_URI " ] . " &modify=1 " ) . " '> " . lang ( 254 ) . " </a> " ); $Ze = array (); $ld = array (); reset ( $L ); $_g = 1 ; foreach ( $K [ 0 ] as $z => $X ){ if ( ! isset ( $Ii [ $z ])){ $X = $_GET [ " columns " ][ key ( $L )]; $p = $q [ $L ? ( $X ? $X [ " col " ] : current ( $L )) : $z ]; $C = ( $p ? $b -> fieldName ( $p , $_g ) : ( $X [ " fun " ] ? " * " : $z )); if ( $C != " " ){ $_g ++ ; $Ze [ $z ] = $C ; $e = idf_escape ( $z ); $Cd = remove_from_uri ( '(order|desc)[^=]*|page' ) . '&order%5B0%5D=' . urlencode ( $z ); $Xb = " &desc%5B0%5D=1 " ; echo " <th> " . script ( " mixin(qsl('th'), { onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')}); " , " " ), '<a href="' . h ( $Cd . ( $Af [ 0 ] == $e || $Af [ 0 ] == $z || ( ! $Af && $Zd && $od [ 0 ] == $e ) ? $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 ( $z ) . " '); " );} echo " </span> " ;} $ld [ $z ] = $X [ " fun " ]; next ( $L );}} $we = array (); if ( $_GET [ " modify " ]){ foreach ( $K
2018-06-30 00:38:01 +02:00
as $J ){ foreach ( $J
2018-12-25 21:50:48 +01:00
as $z => $X ) $we [ $z ] = max ( $we [ $z ], min ( 40 , strlen ( utf8_decode ( $X ))));}} echo ( $Qa ? " <th> " . lang ( 255 ) : " " ) . " </thead> \n " ; if ( is_ajax ()){ if ( $_ % 2 == 1 && $E % 2 == 1 ) odd (); ob_end_clean ();} foreach ( $b -> rowDescriptions ( $K , $fd ) as $Ye => $J ){ $Fi = unique_array ( $K [ $Ye ], $x ); if ( ! $Fi ){ $Fi = array (); foreach ( $K [ $Ye ] as $z => $X ){ if ( ! preg_match ( '~^(COUNT\((\*|(DISTINCT )?`(?:[^`]|``)+`)\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\(`(?:[^`]|``)+`\))$~' , $z )) $Fi [ $z ] = $X ;}} $Gi = " " ; foreach ( $Fi
as $z => $X ){ if (( $y == " sql " || $y == " pgsql " ) && preg_match ( '~char|text|enum|set~' , $q [ $z ][ " type " ]) && strlen ( $X ) > 64 ){ $z = ( strpos ( $z , '(' ) ? $z : idf_escape ( $z )); $z = " MD5( " . ( $y != 'sql' || preg_match ( " ~^utf8~ " , $q [ $z ][ " collation " ]) ? $z : " CONVERT( $z USING " . charset ( $h ) . " ) " ) . " ) " ; $X = md5 ( $X );} $Gi .= " & " . ( $X !== null ? urlencode ( " where[ " . bracket_escape ( $z ) . " ] " ) . " = " . urlencode ( $X ) : " null%5B%5D= " . urlencode ( $z ));} echo " <tr " . odd () . " > " . ( ! $od && $L ? " " : " <td> " . checkbox ( " check[] " , substr ( $Gi , 1 ), in_array ( substr ( $Gi , 1 ),( array ) $_POST [ " check " ])) . ( $Zd || information_schema ( DB ) ? " " : " <a href=' " . h ( ME . " edit= " . urlencode ( $a ) . $Gi ) . " ' class='edit'> " . lang ( 256 ) . " </a> " )); foreach ( $J
as $z => $X ){ if ( isset ( $Ze [ $z ])){ $p = $q [ $z ]; $X = $n -> value ( $X , $p ); if ( $X != " " && ( ! isset ( $tc [ $z ]) || $tc [ $z ] != " " )) $tc [ $z ] = ( is_mail ( $X ) ? $Ze [ $z ] : " " ); $A = " " ; if ( preg_match ( '~blob|bytea|raw|file~' , $p [ " type " ]) && $X != " " ) $A = ME . 'download=' . urlencode ( $a ) . '&field=' . urlencode ( $z ) . $Gi ; if ( ! $A && $X !== null ){ foreach (( array ) $fd [ $z ] as $r ){ if ( count ( $fd [ $z ]) == 1 || end ( $r [ " source " ]) == $z ){ $A = " " ; foreach ( $r [ " source " ] as $t => $wh ) $A .= where_link ( $t , $r [ " target " ][ $t ], $K [ $Ye ][ $wh ]); $A = ( $r [ " db " ] != " " ? preg_replace ( '~([?&]db=)[^&]+~' , '\1' . urlencode ( $r [ " db " ]), ME ) : ME ) . 'select=' . urlencode ( $r [ " table " ]) . $A ; if ( $r [ " ns " ]) $A = preg_replace ( '~([?&]ns=)[^&]+~' , '\1' . urlencode ( $r [ " ns " ]), $A ); if ( count ( $r [ " source " ]) == 1 ) break ;}}} if ( $z == " COUNT(*) " ){ $A = ME . " select= " . urlencode ( $a ); $t = 0 ; foreach (( array ) $_GET [ " where " ] as $W ){ if ( ! array_key_exists ( $W [ " col " ], $Fi )) $A .= where_link ( $t ++ , $W [ " col " ], $W [ " val " ], $W [ " op " ]);} foreach ( $Fi
as $ee => $W ) $A .= where_link ( $t ++ , $ee , $W );} $X = select_value ( $X , $A , $p , $ei ); $u = h ( " val[ $Gi ][ " . bracket_escape ( $z ) . " ] " ); $Y = $_POST [ " val " ][ $Gi ][ bracket_escape ( $z )]; $oc =! is_array ( $J [ $z ]) && is_utf8 ( $X ) && $K [ $Ye ][ $z ] == $J [ $z ] &&! $ld [ $z ]; $di = preg_match ( '~text|lob~' , $p [ " type " ]); if (( $_GET [ " modify " ] && $oc ) || $Y !== null ){ $td = h ( $Y !== null ? $Y : $J [ $z ]); echo " <td> " . ( $di ? " <textarea name=' $u ' cols='30' rows=' " . ( substr_count ( $J [ $z ], " \n " ) + 1 ) . " '> $td </textarea> " : " <input name=' $u ' value=' $td ' size=' $we[$z] '> " );} else { $Ae = strpos ( $X , " <i>...</i> " ); echo " <td id=' $u ' data-text=' " . ( $Ae ? 2 : ( $di ? 1 : 0 )) . " ' " . ( $oc ? " " : " data-warning=' " . h ( lang ( 257 )) . " ' " ) . " > $X </td> " ;}}} if ( $Qa ) echo " <td> " ; $b -> backwardKeysPrint ( $Qa , $K [ $Ye ]); echo " </tr> \n " ;} if ( is_ajax ()) exit ; echo " </table> \n " , " </div> \n " ;} if ( ! is_ajax ()){ if ( $K || $E ){ $Cc = true ; if ( $_GET [ " page " ] != " last " ){ if ( $_ == " " || ( count ( $K ) < $_ && ( $K ||! $E ))) $id = ( $E ? $E * $_ : 0 ) + count ( $K ); elseif ( $y != " sql " ||! $Zd ){ $id = ( $Zd ? false : found_rows ( $R , $Z )); if ( $id < max ( 1e4 , 2 * ( $E + 1 ) * $_ )) $id = reset ( slow_query ( count_rows ( $a , $Z , $Zd , $od ))); else $Cc = false ;}} $Nf = ( $_ != " " && ( $id === false || $id > $_ || $E )); if ( $Nf ){ echo (( $id === false ? count ( $K ) + 1 : $id - $E * $_ ) > $_ ? '<p><a href="' . h ( remove_from_uri ( " page " ) . " &page= " . ( $E + 1 )) . '" class="loadmore">' . lang ( 258 ) . '</a>' . script ( " qsl('a').onclick = partial(selectLoadMore, " . ( + $_ ) . " , ' " . lang ( 259 ) . " ...'); " , " " ) : '' ), " \n " ;}} echo " <div class='footer'><div> \n " ; if ( $K || $E ){ if ( $Nf ){ $Ie = ( $id === false ? $E + ( count ( $K ) >= $_ ? 2 : 1 ) : floor (( $id - 1 ) / $_ )); echo " <fieldset> " ; if ( $y != " simpledb " ){ echo " <legend><a href=' " . h ( remove_from_uri ( " page " )) . " '> " . lang ( 260 ) . " </a></legend> " , script ( " qsl('a').onclick = function () { pageClick(this.href, +prompt(' " . lang ( 260 ) . " ', ' " . ( $E + 1 ) . " ')); return false; }; " ), pagination ( 0 , $E ) . ( $E > 5 ? " ... " : " " ); for ( $t = max ( 1 , $E - 4 ); $t < min ( $Ie , $E + 5 ); $t ++ ) echo
pagination ( $t , $E ); if ( $Ie > 0 ){ echo ( $E + 5 < $Ie ? " ... " : " " ),( $Cc && $id !== false ? pagination ( $Ie , $E ) : " <a href=' " . h ( remove_from_uri ( " page " ) . " &page=last " ) . " ' title='~ $Ie '> " . lang ( 261 ) . " </a> " );}} else { echo " <legend> " . lang ( 260 ) . " </legend> " , pagination ( 0 , $E ) . ( $E > 1 ? " ... " : " " ),( $E ? pagination ( $E , $E ) : " " ),( $Ie > $E ? pagination ( $E + 1 , $E ) . ( $Ie > $E + 1 ? " ... " : " " ) : " " );} echo " </fieldset> \n " ;} echo " <fieldset> " , " <legend> " . lang ( 262 ) . " </legend> " ; $cc = ( $Cc ? " " : " ~ " ) . $id ; echo
checkbox ( " all " , 1 , 0 ,( $id !== false ? ( $Cc ? " " : " ~ " ) . lang ( 150 , $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 ( 254 ), ' </ legend >< div >
< input type = " submit " value = " ',lang(14),' " ',($_GET["modify"]?' ':' title = " '.lang(250).' " '),' >
2014-05-08 19:46:08 +02:00
</ div ></ fieldset >
2018-12-25 21:50:48 +01:00
< fieldset >< legend > ',lang(126),' < span id = " selected " ></ span ></ legend >< div >
2014-05-08 19:46:08 +02:00
< input type = " submit " name = " edit " value = " ',lang(10),' " >
2018-12-25 21:50:48 +01:00
< input type = " submit " name = " clone " value = " ',lang(246),' " >
2018-04-01 23:34:54 +02:00
< input type = " submit " name = " delete " value = " ',lang(18),' " > ',confirm(),' </ div ></ fieldset >
2018-12-25 21:50:48 +01:00
';}$gd=$b->dumpFormat();foreach((array)$_GET["columns"]as$e){if($e["fun"]){unset($gd[' sql ']);break;}}if($gd){print_fieldset("export",lang(74)." <span id=' selected2 '></span>");$Lf=$b->dumpOutput();echo($Lf?html_select("output",$Lf,$za["output"])." ":""),html_select("format",$gd,$za["format"])," <input type=' submit ' name=' export ' value=' " .lang(74). " '>\n","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($tc,' strlen '),$f);}echo"</div></div>\n";if($b->selectImportPrint()){echo"<div>","<a href=' #import'>".lang(73)."</a>",script("qsl('a').onclick = partial(toggle, 'import');",""),"<span id='import' class='hidden'>: ","<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$za["format"],1);echo" <input type='submit' name='import' value='".lang(73)."'>","</span>","</div>";}echo"<input type='hidden' name='token' value='$pi'>\n","</form>\n",(!$od&&$L?"":script("tableCheck();"));}}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$Fh=isset($_GET["status"]);page_header($Fh?lang(118):lang(117));$Wi=($Fh?show_status():show_variables());if(!$Wi)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Wi
as $z => $X ){ echo " <tr> " , " <th><code class='jush- " . $y . ( $Fh ? " status " : " set " ) . " '> " . h ( $z ) . " </code> " , " <td> " . h ( $X );} echo " </table> \n " ;}} elseif ( isset ( $_GET [ " script " ])){ header ( " Content-Type: text/javascript; charset=utf-8 " ); if ( $_GET [ " script " ] == " db " ){ $Nh = array ( " Data_length " => 0 , " Index_length " => 0 , " Data_free " => 0 ); foreach ( table_status () as $C => $R ){ json_row ( " Comment- $C " , h ( $R [ " Comment " ])); if ( ! is_view ( $R )){ foreach ( array ( " Engine " , " Collation " ) as $z ) json_row ( " $z - $C " , h ( $R [ $z ])); foreach ( $Nh + array ( " Auto_increment " => 0 , " Rows " => 0 ) as $z => $X ){ if ( $R [ $z ] != " " ){ $X = format_number ( $R [ $z ]); json_row ( " $z - $C " ,( $z == " Rows " && $X && $R [ " Engine " ] == ( $zh == " pgsql " ? " table " : " InnoDB " ) ? " ~ $X " : $X )); if ( isset ( $Nh [ $z ])) $Nh [ $z ] += ( $R [ " Engine " ] != " InnoDB " || $z != " Data_free " ? $R [ $z ] : 0 );} elseif ( array_key_exists ( $z , $R )) json_row ( " $z - $C " );}}} foreach ( $Nh
as $z => $X ) json_row ( " sum- $z " , format_number ( $X )); json_row ( " " );} elseif ( $_GET [ " script " ] == " kill " ) $h -> query ( " KILL " . number ( $_POST [ " kill " ])); else { foreach ( count_tables ( $b -> databases ()) as $m => $X ){ json_row ( " tables- $m " , $X ); json_row ( " size- $m " , db_size ( $m ));} json_row ( " " );} exit ;} else { $Wh = array_merge (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ]); if ( $Wh &&! $o &&! $_POST [ " search " ]){ $H = true ; $Ne = " " ; if ( $y == " sql " && $_POST [ " tables " ] && count ( $_POST [ " tables " ]) > 1 && ( $_POST [ " drop " ] || $_POST [ " truncate " ] || $_POST [ " copy " ])) queries ( " SET foreign_key_checks = 0 " ); if ( $_POST [ " truncate " ]){ if ( $_POST [ " tables " ]) $H = truncate_tables ( $_POST [ " tables " ]); $Ne = lang ( 263 );} elseif ( $_POST [ " move " ]){ $H = move_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $Ne = lang ( 264 );} elseif ( $_POST [ " copy " ]){ $H = copy_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $Ne = lang ( 265 );} elseif ( $_POST [ " drop " ]){ if ( $_POST [ " views " ]) $H = drop_views ( $_POST [ " views " ]); if ( $H && $_POST [ " tables " ]) $H = drop_tables ( $_POST [ " tables " ]); $Ne = lang ( 266 );} elseif ( $y != " sql " ){ $H = ( $y == " sqlite " ? queries ( " VACUUM " ) : apply_queries ( " VACUUM " . ( $_POST [ " optimize " ] ? " " : " ANALYZE " ), $_POST [ " tables " ])); $Ne = lang ( 267 );} elseif ( ! $_POST [ " tables " ]) $Ne = lang ( 9 ); elseif ( $H = queries (( $_POST [ " optimize " ] ? " OPTIMIZE " : ( $_POST [ " check " ] ? " CHECK " : ( $_POST [ " repair " ] ? " REPAIR " : " ANALYZE " ))) . " TABLE " . implode ( " , " , array_map ( 'idf_escape' , $_POST [ " tables " ])))){ while ( $J = $H -> fetch_assoc ()) $Ne .= " <b> " . h ( $J [ " Table " ]) . " </b>: " . h ( $J [ " Msg_text " ]) . " <br> " ;} queries_redirect ( substr ( ME , 0 , - 1 ), $Ne , $H );} page_header (( $_GET [ " ns " ] == " " ? lang ( 38 ) . " : " . h ( DB ) : lang ( 78 ) . " : " . h ( $_GET [ " ns " ])), $o , true ); if ( $b -> homepage ()){ if ( $_GET [ " ns " ] !== " " ){ echo " <h3 id='tables-views'> " . lang ( 268 ) . " </h3> \n " ; $Vh = tables_list (); if ( ! $Vh ) echo " <p class='message'> " . lang ( 9 ) . " \n " ; else { echo " <form action='' method='post'> \n " ; if ( support ( " table " )){ echo " <fieldset><legend> " . lang ( 269 ) . " <span id='selected2'></span></legend><div> " , " <input type='search' name='query' value=' " . h ( $_POST [ " query " ]) . " '> " , script ( " qsl('input').onkeydown = partialArg(bodyKeydown, 'search'); " , " " ), " <input type='submit' name='search' value=' " . lang ( 57 ) . " '> \n " , " </div></fieldset> \n " ; if ( $_POST [ " search " ] && $_POST [ " query " ] != " " ){ $_GET [ " where " ][ 0 ][ " op " ] = " LIKE %% " ; search_tables ();}} $dc = doc_link ( array ( 'sql' => 'show-table-status.html' )); echo " <div class='scrollable'> \n " , " <table cellspacing='0' class='nowrap checkable'> \n " , script ( " mixin(qsl('table'), { onclick: tableClick, ondblclick: partialArg(tableClick, true)}); " ), '<thead><tr class="wrap">' , '<td><input id="check-all" type="checkbox" class="jsonly">' . script ( " qs('#check-all').onclick = partial(formCheck, /^(tables|views) \ [/); " , " " ), '<th>' . lang ( 131 ), '<td>' . lang ( 270 ) . doc_link ( array ( 'sql' => 'storage-engines.html' )), '<td>' . lang ( 122 ) . doc_link ( array ( 'sql' => 'charset-charsets.html' , 'mariadb' => 'supported-character-sets-and-collations/' )), '<td>' . lang ( 271 ) . $dc , '<td>' . lang ( 272 ) . $dc , '<td>' . lang ( 273 ) . $dc , '<td>' . lang ( 52 ) . doc_link ( array ( 'sql' => 'example-auto-increment.html' , 'mariadb' => 'auto_increment/' )), '<td>' . lang ( 274 ) . $dc ,( support ( " comment " ) ? '<td>' . lang ( 51 ) . $dc : '' ), " </thead> \n " ; $S = 0 ; foreach ( $Vh
as $C => $T ){ $Zi = ( $T !== null &&! preg_match ( '~table~i' , $T )); $u = h ( " Table- " . $C ); echo '<tr' . odd () . '><td>' . checkbox (( $Zi ? " views[] " : " tables[] " ), $C , in_array ( $C , $Wh , true ), " " , " " , " " , $u ), '<th>' . ( support ( " table " ) || support ( " indexes " ) ? " <a href=' " . h ( ME ) . " table= " . urlencode ( $C ) . " ' title=' " . lang ( 43 ) . " ' id=' $u '> " . h ( $C ) . '</a>' : h ( $C )); if ( $Zi ){ echo '<td colspan="6"><a href="' . h ( ME ) . " view= " . urlencode ( $C ) . '" title="' . lang ( 44 ) . '">' . ( preg_match ( '~materialized~i' , $T ) ? lang ( 129 ) : lang ( 130 )) . '</a>' , '<td align="right"><a href="' . h ( ME ) . " select= " . urlencode ( $C ) . '" title="' . lang ( 42 ) . '">?</a>' ;} else { foreach ( array ( " Engine " => array (), " Collation " => array (), " Data_length " => array ( " create " , lang ( 45 )), " Index_length " => array ( " indexes " , lang ( 133 )), " Data_free " => array ( " edit " , lang ( 46 )), " Auto_increment " => array ( " auto_increment=1&create " , lang ( 45 )), " Rows " => array ( " select " , lang ( 42 )),) as $z => $A ){ $u = " id=' $z - " . h ( $C ) . " ' " ; echo ( $A ? " <td align='right'> " . ( support ( " table " ) || $z == " Rows " || ( support ( " indexes " ) && $z != " Data_length " ) ? " <a href=' " . h ( ME . " $A[0] = " ) . urlencode ( $C ) . " ' $u title=' $A[1] '>?</a> " : " <span $u >?</span> " ) : " <td id=' $z - " . h ( $C ) . " '> " );} $S ++ ;} echo ( support ( " comment " ) ? " <td id='Comment- " . h ( $C ) . " '> " : " " );} echo " <tr><td><th> " . lang ( 247 , count ( $Vh )), " <td> " . h ( $y == " sql " ? $h -> result ( " SELECT @@storage_engine " ) : " " ), " <td> " . h ( db_collation ( DB , collations ())); foreach ( array ( " Data_length " , " Index_length " , " Data_free " ) as $z ) echo " <td align='right' id='sum- $z '> " ; echo " </table> \n " , " </div> \n " ; if ( ! information_schema ( DB )){ echo " <div class='footer'><div> \n " ; $Ti = " <input type='submit' value=' " . lang ( 275 ) . " '> " . on_help ( " 'VACUUM' " ); $xf = " <input type='submit' name='optimize' value=' " . lang ( 276 ) . " '> " . on_help ( $y == " sql " ? " 'OPTIMIZE TABLE' " : " 'VACUUM OPTIMIZE' " ); echo " <fieldset><legend> " . lang ( 126 ) . " <span id='selected'></span></legend><div> " . ( $y == " sqlite " ? $Ti : ( $y == " pgsql " ? $Ti . $xf : ( $y == " sql " ? " <input type='submit' value=' " . lang ( 277 ) . " '> " . on_help ( " 'ANALYZE TABLE' " ) . $xf . " <input type='submit' name='check' value=' " . lang ( 278 ) . " '> " . on_help ( " 'CHECK TABLE' " ) . " <input type='submit' name='repair' value=' " . lang ( 279 ) . " '> " . on_help ( " 'REPAIR TABLE' " ) : " " ))) . " <input type='submit' name='truncate' value=' " . lang ( 280 ) . " '> " . on_help ( $y == " sqlite " ? " 'DELETE' " : " 'TRUNCATE " . ( $y == " pgsql " ? " ' " : " TABLE' " )) . confirm () . " <input type='submit' name='drop' value=' " . lang ( 127 ) . " '> " . on_help ( " 'DROP TABLE' " ) . confirm () . " \n " ; $l = ( support ( " scheme " ) ? $b -> schemas () : $b -> databases ()); if ( count ( $l ) != 1 && $y != " sqlite " ){ $m = ( isset ( $_POST [ " target " ]) ? $_POST [ " target " ] : ( support ( " scheme " ) ? $_GET [ " ns " ] : DB )); echo " <p> " . lang ( 281 ) . " : " ,( $l ? html_select ( " target " , $l , $m ) : '<input name="target" value="' . h ( $m ) . '" autocapitalize="off">' ), " <input type='submit' name='move' value=' " . lang ( 282 ) . " '> " ,( support ( " copy " ) ? " <input type='submit' name='copy' value=' " . lang ( 283 ) . " '> " : " " ), " \n " ;} echo " <input type='hidden' name='all' value=''> " ; echo
script ( " qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^(tables|views) \ [/)); " . ( support ( " table " ) ? " selectCount('selected2', formChecked(this, /^tables \ [/) || $S ); " : " " ) . " } " ), " <input type='hidden' name='token' value=' $pi '> \n " , " </div></fieldset> \n " , " </div></div> \n " ;} echo " </form> \n " , script ( " tableCheck(); " );} echo '<p class="links"><a href="' . h ( ME ) . 'create=">' . lang ( 75 ) . " </a> \n " ,( support ( " view " ) ? '<a href="' . h ( ME ) . 'view=">' . lang ( 204 ) . " </a> \n " : " " ); if ( support ( " routine " )){ echo " <h3 id='routines'> " . lang ( 143 ) . " </h3> \n " ; $Xg = routines (); if ( $Xg ){ echo " <table cellspacing='0'> \n " , '<thead><tr><th>' . lang ( 183 ) . '<td>' . lang ( 50 ) . '<td>' . lang ( 221 ) . " <td></thead> \n " ; odd ( '' ); foreach ( $Xg
as $J ){ $C = ( $J [ " SPECIFIC_NAME " ] == $J [ " ROUTINE_NAME " ] ? " " : " &name= " . urlencode ( $J [ " ROUTINE_NAME " ])); echo '<tr' . odd () . '>' , '<th><a href="' . h ( ME . ( $J [ " ROUTINE_TYPE " ] != " PROCEDURE " ? 'callf=' : 'call=' ) . urlencode ( $J [ " SPECIFIC_NAME " ]) . $C ) . '">' . h ( $J [ " ROUTINE_NAME " ]) . '</a>' , '<td>' . h ( $J [ " ROUTINE_TYPE " ]), '<td>' . h ( $J [ " DTD_IDENTIFIER " ]), '<td><a href="' . h ( ME . ( $J [ " ROUTINE_TYPE " ] != " PROCEDURE " ? 'function=' : 'procedure=' ) . urlencode ( $J [ " SPECIFIC_NAME " ]) . $C ) . '">' . lang ( 136 ) . " </a> " ;} echo " </table> \n " ;} echo '<p class="links">' . ( support ( " procedure " ) ? '<a href="' . h ( ME ) . 'procedure=">' . lang ( 220 ) . '</a>' : '' ) . '<a href="' . h ( ME ) . 'function=">' . lang ( 219 ) . " </a> \n " ;} if ( support ( " sequence " )){ echo " <h3 id='sequences'> " . lang ( 284 ) . " </h3> \n " ; $lh = get_vals ( " SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name " ); if ( $lh ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 183 ) . " </thead> \n " ; odd ( '' ); foreach ( $lh
as $X ) echo " <tr " . odd () . " ><th><a href=' " . h ( ME ) . " sequence= " . urlencode ( $X ) . " '> " . h ( $X ) . " </a> \n " ; echo " </table> \n " ;} echo " <p class='links'><a href=' " . h ( ME ) . " sequence='> " . lang ( 226 ) . " </a> \n " ;} if ( support ( " type " )){ echo " <h3 id='user-types'> " . lang ( 26 ) . " </h3> \n " ; $Ri = types (); if ( $Ri ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 183 ) . " </thead> \n " ; odd ( '' ); foreach ( $Ri
as $X ) echo " <tr " . odd () . " ><th><a href=' " . h ( ME ) . " type= " . urlencode ( $X ) . " '> " . h ( $X ) . " </a> \n " ; echo " </table> \n " ;} echo " <p class='links'><a href=' " . h ( ME ) . " type='> " . lang ( 230 ) . " </a> \n " ;} if ( support ( " event " )){ echo " <h3 id='events'> " . lang ( 144 ) . " </h3> \n " ; $K = get_rows ( " SHOW EVENTS " ); if ( $K ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 183 ) . " <td> " . lang ( 285 ) . " <td> " . lang ( 210 ) . " <td> " . lang ( 211 ) . " <td></thead> \n " ; foreach ( $K
as $J ){ echo " <tr> " , " <th> " . h ( $J [ " Name " ]), " <td> " . ( $J [ " Execute at " ] ? lang ( 286 ) . " <td> " . $J [ " Execute at " ] : lang ( 212 ) . " " . $J [ " Interval value " ] . " " . $J [ " Interval field " ] . " <td> $J[Starts] " ), " <td> $J[Ends] " , '<td><a href="' . h ( ME ) . 'event=' . urlencode ( $J [ " Name " ]) . '">' . lang ( 136 ) . '</a>' ;} echo " </table> \n " ; $Ac = $h -> result ( " SELECT @@event_scheduler " ); if ( $Ac && $Ac != " ON " ) echo " <p class='error'><code class='jush-sqlset'>event_scheduler</code>: " . h ( $Ac ) . " \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'event=">' . lang ( 209 ) . " </a> \n " ;} if ( $Vh ) echo
2018-04-01 23:34:54 +02:00
script ( " ajaxSetHtml(' " . js_escape ( ME ) . " script=db'); " );}}} page_footer ();