2014-04-01 18:00:42 +00:00
< ? php
/** Adminer - Compact database management
2016-10-11 12:23:21 +00:00
* @ link https :// www . adminer . org /
2017-04-21 11:23:04 +00:00
* @ author Jakub Vrana , https :// www . vrana . cz /
2014-04-01 18:00:42 +00:00
* @ copyright 2007 Jakub Vrana
* @ license http :// www . apache . org / licenses / LICENSE - 2.0 Apache License , Version 2.0
* @ license http :// www . gnu . org / licenses / gpl - 2.0 . html GNU General Public License , version 2 ( one or other )
2017-04-21 11:23:04 +00:00
* @ version 4.3 . 1
2017-03-01 04:33:28 +00:00
*/
@ ignore_user_abort ( true );
2017-04-21 11:23:04 +00:00
@ set_time_limit ( 3600 * 2 ); //set_time_limit(0) 1day
@ ini_set ( 'memory_limit' , '2028M' ); //2G;
2017-03-01 04:33:28 +00:00
2017-04-21 11:23:04 +00:00
error_reporting ( 6135 ); $Lc =! preg_match ( '~^(unsafe_raw)?$~' , ini_get ( " filter.default " )); if ( $Lc || ini_get ( " filter.default_flags " )){ foreach ( array ( '_GET' , '_POST' , '_COOKIE' , '_SERVER' ) as $X ){ $Wh = filter_input_array ( constant ( " INPUT $X " ), FILTER_UNSAFE_RAW ); if ( $Wh ) $$X = $Wh ;}} if ( function_exists ( " mb_internal_encoding " )) mb_internal_encoding ( " 8bit " ); 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
2014-04-01 18:00:42 +00:00
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
2017-04-21 11:23:04 +00: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> J=<11> <> <EFBFBD> 1L<31> <4C> ?<0F> s =#`<60> 3\$ 4<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> u ȱ<> <C8B1> zG<0F> C YA t<> ?;<3B> Q<EFBFBD> k&<26> <> <EFBFBD> YP<59> u<EFBFBD> <75> ǯ}UaHV%G ;<3B> s<EFBFBD> <73> <A \0 \\ <19> <> P<EFBFBD> \\ <EFBFBD> <12> & ª<> V<16> <> \n <EFBFBD> SU<13> t<EFBFBD> <15> <> r<EFBFBD> <72> <EFBFBD> <EFBFBD> 2<EFBFBD> l^<5E> Z6<5A> ej<65> <6A> <EFBFBD> <EFBFBD> A<0C> d<EFBFBD> [<5B> sն<73> JP<4A> <50> <11> <> <EFBFBD> ҝ<EFBFBD> <D29D> 8<EFBFBD> =<3D> <> <EFBFBD> <EFBFBD> 6 #˂ 74*<2A> <0E> <> #e<> <65> <EFBFBD> !<21> 7{ <EFBFBD> 6<EFBFBD> <EFBFBD> <o<03> C<EFBFBD> 9v[<5B> M<EFBFBD> <4D> -`<60> <> k<EFBFBD> ><3E> l<> ڴ<> <DAB4> I<EFBFBD> <49> H<EFBFBD> 3<EFBFBD> x<EFBFBD> <78> <EFBFBD> <EFBFBD> w0t6<74> <36> %MR%<25> <> j h<> B<EFBFBD> <<05> \0 <EFBFBD> A Q<P<:<3A> <> u/<2F> ;\\ ><3E> <> -<2D> <> ʈ<EFBFBD> <CA88> QH \n v<> L+ v<> æ<EFBFBD> <<3C> \r <EFBFBD> <EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> <15> \\ *<2A> <> <EFBFBD> <EFBFBD> Ӵݢg<DDA2> <67> n˩<6E> <0C> TЩ2P<32> \r <EFBFBD> <EFBFBD> ߋ\" +z<> 8<0E> <> <EFBFBD> : #<23> <> <1E> <> <08> 2<EFBFBD> <32> J[<5B> i<EFBFBD> <69> <EFBFBD> <EFBFBD> ;z<> <7A> <EFBFBD> <EFBFBD> <EFBFBD> r<EFBFBD> 3 #<23> ى<EFBFBD> :<3A> n<EFBFBD> \r 㽃e<EFBFBD> pd ݍ<> <20> 2c<32> <63> 4<EFBFBD> k<EFBFBD> <6B> <EFBFBD> \r G<> <47> E6_<36> <5F> <EFBFBD> =<3D> <> SZUǷ㌞O<E38C9E> <4F> <EFBFBD> ?<1F> <> þ27<32> c<EFBFBD> А <EFBFBD> hnƋ<6E> <C68B> u3<75> E>\$ J[<5B> q[\r <EFBFBD> I<EFBFBD> 6.<2E> J<EFBFBD> \" EP r<> G̊GA<47> <41> W<EFBFBD> <57> <EFBFBD> \r <EFBFBD> <EFBFBD> <EFBFBD> 6<EFBFBD> <EFBFBD> k<06> <> <EFBFBD> `.-<2D> <> B2> #<15> <> h<EFBFBD> <68> <EFBFBD> X<EFBFBD> <58> <EFBFBD> u\r <EFBFBD> <EFBFBD> =<3D> Z<> b<> Ł(<28> ╃!JZ Ȕ u<> yO<79> <4F> Z<EFBFBD> M<EFBFBD> <02> 6<0E> lM[0<> 䖀<EFBFBD> <E49680> !Im<0E> y<EFBFBD> +p<> # ag<61> <67> <02> vW<76> :qp\" 4<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> he<EFBFBD> <EFBFBD> <EFBFBD> 0<EFBFBD> d<EFBFBD> Aq- \" <EFBFBD> <EFBFBD> <0C> <> <EFBFBD> <EFBFBD> \" 2<EFBFBD> <0C> <> @<40> ) o<> ,,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> Rb`@<40> B@<06> <> <1C> <1B> <> <EFBFBD> Q \n <EFBFBD> 芷<EFBFBD> Z<EFBFBD> <EFBFBD> <08> =( r~<7E> l<EFBFBD> ~<7E> <> h<EFBFBD> sAll<6C> \n 7<> ! 1 !<21> <> #<10> \0 K<EFBFBD> <04> A<EFBFBD> LH(<28> !<21> ʘa gH \0 <EFBFBD> T\n i<04> /<2F> \$ <EFBFBD> <EFBFBD> <EFBFBD> 4G a<1A> I<EFBFBD> !<21> .<2E> Ř5<C598> <35> M\r <EFBFBD> 2<> <32> <11> <09> ;<3B> ,<2C> <> L IJ<49> <4A> <EFBFBD> d ?<3F> <> <14> <13> <> %Ո:<06> N@ b.<18> <01> 2<EFBFBD> 5<EFBFBD> <35> <EFBFBD> t: FAw<41> B<EFBFBD> E<EFBFBD> ,<2C> -\$ <EFBFBD> <EFBFBD> '<27> :ө u<0E> ?<3F> tK ;ḱ<6B> <CD81> и<EFBFBD> <D0B8> \0 o uMD)k_Ph<50> <68> <EFBFBD> 5 MC}7<> <37> <EFBFBD> 2<EFBFBD> w.Q<> B<EFBFBD> 8)<29> <> <EFBFBD> 8(DI<44> =<3D> <> y`<10> ed \0 s ,`ɕj<C995> H<EFBFBD> <48> \" ( b<> <62> <EFBFBD> \\ <EFBFBD> <EFBFBD> nl<6E> \" ق^<5E> 쀭eE<65> \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> X!SqX<71> <16> \r <EFBFBD> <EFBFBD> <EFBFBD> 7A<EFBFBD> <EFBFBD> <EFBFBD> 0<EFBFBD> <1C> <> y7pP<70> <50> <EFBFBD> <EFBFBD> a<> A<> 4<EFBFBD> <34> (y<> Jw m<7F> 2<> <32> <0E> <> .<2E> fp<66> <70> <EFBFBD> ;Ƅ 5<C684> J<EFBFBD> c<> q<EFBFBD> Qz\\ \0 [H<0B> <> 3<> f' b<> <62> F<EFBFBD> <46> <EFBFBD> Y<EFBFBD> \n A<EFBFBD> 9_<EFBFBD> I<EFBFBD> <EFBFBD> (<28> f<1B> ӝq<D39D> V<EFBFBD> <56> <02> <08> <> <19> 4<> <34> <EFBFBD> <EFBFBD> <19> <> RI<52> Y<EFBFBD> <59> & J<> <4A> F<EFBFBD> }<7D> { FT<EFBFBD> h9[7<> h \0 <EFBFBD> <1A> T<EFBFBD> ^<5E> <> j<> <6A> q<EFBFBD> j<EFBFBD> <1C> <> Ք<EFBFBD> <D594> <EFBFBD> c<EFBFBD> W I<> @`_<> sV D<> <44> [<5B> \" { 1<EFBFBD> <EFBFBD> 3<10> <> <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <10> <<01> l<EFBFBD> l.<2E> <> <EFBFBD> [<5B> <> <1A> <> #į<> <C4AF> b<EFBFBD> <62> u<EFBFBD> <75> /<2F> \0 <EFBFBD> 3<EFBFBD> va嫑Dp><3E> 2<0C> I<03> DW՚ <57> kK<6B> A<EFBFBD> <41> hH<68> ]<5D> <> F<EFBFBD> <16> <> <EFBFBD> W<EFBFBD> !]<08> ʝ<> lt<6C> ɕR̭4L[<1B> <> <EFBFBD> YC c Tj<c;s<> q<EFBFBD> p<EFBFBD> <17> <20> 5<EFBFBD> t<EFBFBD> J<EFBFBD> m6<6D> %J<> -\\ <05> <> eB=i<0C> -<2D> *%<25> <> <EFBFBD> <EFBFBD> <EFBFBD> TV<54> [&M8<4D> *\r <EFBFBD> b<EFBFBD> Y\r ih<EFBFBD> <09> <> P<EFBFBD> 9T<39> -VɰZ<01> <> <10> ۳<EFBFBD> 49β<39> <CEB2> <EFBFBD> p-<2D> `<60> <> <EFBFBD> <EFBFBD> <EFBFBD> G<EFBFBD> ٛ'<27> <> <16> <> <EFBFBD> M<> :<3A> ř' )0<18> Yu<59> c<> :!<21> x#צ<> <D7A6> -l*<2A> T<EFBFBD> \n Yl<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <1C> <> *D<> <44> X<> V \\ <EFBFBD> <EFBFBD> <EFBFBD> ڮ<EFBFBD> ] y<> <79> \n <EFBFBD> 2r,Ɇ<> <C986> <EFBFBD> ,<2C> d<EFBFBD> <64> ~ų<> <C5B3> s<EFBFBD> -<2D> +ֻu<D6BB> ]<5D> \\ B<16> <> <EFBFBD> <EFBFBD> Iw<49> <77> !<21> Os<4F> ԯl<D4AF> <6C> YC<59> Ђ<EFBFBD> <D082> :<06> @ ƜEU<45> ._)<01> 9u<39> z<EFBFBD> <7A> vψS<CF88> <16> <> 1<1C> <> <02> _(S<> <53> q齡r<E9BDA1> yu<79> +<2B> Z*<2A> 6<EFBFBD> u<EFBFBD> y<EFBFBD> <<3C> <> <EFBFBD> z \\ |<12> Z K;<0B> e<> ז<EFBFBD> oY<6F> <59> <EFBFBD> ;<3B> <1C> <> <EFBFBD> l<EFBFBD> <6C> x<EFBFBD> <78> -7<> <37> <EFBFBD> 4r kYY?<3F> <> GWt<57> <74> <1D> [Kښ<4B> <DA9A> zo<7A> <<3C> <> <EFBFBD> <EFBFBD> t<> <74> <EFBFBD> <F486B6BE> ɀg<C980> <67> j<EFBFBD> <6A> _!<21> <> o<EFBFBD> <6F> <EFBFBD> \$ I<> <49> <EFBFBD> I<EFBFBD> .&<07> 5<> P \\ <EFBFBD> <EFBFBD> ]<5D> <> <EFBFBD> <03> <> \n C<EFBFBD> .<2E> <> _<EFBFBD> <5F> ;<3B> <> s<16> i<> <69> S/g<> :<3A> P<EFBFBD> ɳauNͨ|<7C> a<EFBFBD> <61> <EFBFBD> ᙺ<EFBFBD> <E199BA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 6<EFBFBD> ӎٞ3<D99E> |<7C> <> <EFBFBD> <EFBFBD> { <EFBFBD> ce<EFBFBD> X<> <58> <<3C> e<18> p> N<7F> }<7D> <> ~<1E> <1E> O<EFBFBD> <0F> <> ҙBl<42> <6C> j<EFBFBD> /<2F> <> K<EFBFBD> <4B> Hdc h-˾<> <CBBE> <EFBFBD> <EFBFBD> <0F> <> /<0E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȶ<EFBFBD> hԞ<68> 0<EFBFBD> <30> Ќ<EFBFBD> Ћ<EFBFBD> <D08B> <EFBFBD> <EFBFBD> H<EFBFBD> <48> 8<EFBFBD> j6<6A> \n +d <20> l7 \r <EFBFBD> <EFBFBD> <20> څ0N7 e<06> Z<EFBFBD> 0`m<> <6D> n<05> <> <07> p\0 <EFBFBD> \0 <EFBFBD> }<7D> <> @[<08> <> <06> i 0<> <0B> <> <09> ~<7E> <> <EFBFBD> 4P<34> \n А <EFBFBD> bЯ0<EFBFBD> p<> P<> 4@<40> P<> <0B> <1C> <> <EFBFBD> I\0 ` `f<> <66> \r `<60> ``<60> <> Y<07> <> z<EFBFBD> <7A> P<> <0F> <> \r <EFBFBD> <EFBFBD> <07> <> p<> <0C> y H<> q<06> @<40> <0B> Q<18> q<1C> <> <20> `<60> <0F> <12> bi<62> <69> <EFBFBD> UС <0C> <12> @` )<29> <0E> <> <08> <> <0B> <> )<29> <> <08> Z<EFBFBD> pj(<28> - -l<> <6C> <EFBFBD> <EFBFBD> 1Q<10> <> %<25> p<> <0F> Y<15> \n 1}<18> <> <16> \\ *<2A> <> h<EFBFBD> <10> { <EFBFBD> <EFBFBD> C 0<> #<23> <> H<EFBFBD> <48> 0T<30> qA<07> <> <0C> b<EFBFBD> =<3D>
<EFBFBD> f- <20> <12> <> q<> iA<17> s ' Q<> <1C> <> <1C> <> <1C> Z\r <EFBFBD> Rc '<1A> <> `<60> <08> <> q<> <0B> Y<1D> Q1<1E> ҝ2! r\" Q<EFBFBD> 1<> Q<> !q<> r \0 <EFBFBD> B<16> <> D<08> w<1B> <> \0 <EFBFBD> <11> <> <EFBFBD> <EFBFBD> <EFBFBD> q<> \$ <EFBFBD> S<11> <> \" <EFBFBD> ] q<> <1E> @`豲@,<11> \" r \" <EFBFBD> )&<26> <> &<26> \n t<EFBFBD> <EFBFBD> b<EFBFBD> m 0<1A> 2<EFBFBD> )Qw \n <EFBFBD> <EFBFBD> <0C> <> <20> <0B> <> p (0<> *<2A> <> <1A> Ҏ<EFBFBD> <D28E> <EFBFBD> <1B> q\n <EFBFBD> &i\n <EFBFBD> \" <EFBFBD> p<> <11> <> 1<> <1E> C<08> <> <12> <10> \" <EFBFBD> .1y.q^<0B> <> <EFBFBD> 2<EFBFBD> <11> <> \0 <EFBFBD> .<2E> <> Q<> 0<EFBFBD> <12> r<EFBFBD> <18> )/\0 ڔ !/<12> .S+1R<31> /3:5<> Ɲ<EFBFBD> 11<31> \n B<EFBFBD> 43 4<> G#〜`<60> Sa <20> ra 6<> <06> <> e s7<12> q<12> , 搩<> j3 q 4)<29> \$ <04> <> <EFBFBD> <EFBFBD> <0B> @*<2A> <> -<2D> <> 9<EFBFBD> <06> <> \n <EFBFBD> <EFBFBD> \" 0<EFBFBD> ',<2C> h<EFBFBD> S} \" <04> 3s s 9<> <39> 1<EFBFBD> <31> 7S-=1g4 <09> <pr.<2E> <> )LA9<41> <39> <EFBFBD> ´ <20> <> / 9<10> S<> ?<3F> /5H}><3E> .<2E> <> 4LD ;<3B> <> @2!A<> <41> @<40> <> <07> Br<42> <17> -/<2F> +016 S<> <53> #<23> )<03> <> \" i@<40> `P;.\n <0E> <> <)Ա<> V\n l8<EFBFBD> K #g k<1C> d|<7C> <> 8<> l<EFBFBD> <6C> <EFBFBD> .lf.<2E> ?<11> A @ \r Æ.<2E> \$ J2tN#<23> Rr<52> AE<41> <45> E<EFBFBD> <1C> <> e<19> <> F<EFBFBD> <46> FӦg<D3A6> 8*<2A> " );} elseif ( $_GET [ " file " ] == " functions.js " ){ header ( " Content-Type: text/javascript; charset=utf-8 " ); echo
lzw_decompress ( " f:<3A> <> gCI<43> <49> \n 0<EFBFBD> <0E> S<EFBFBD> <0C> a9<61> <39> S`<60> <> <0F> <> <EFBFBD> &<26> (<28> <> n0<6E> <30> <EFBFBD> QI<51> <49> f<EFBFBD> <66> \$ <EFBFBD> At^ s<> G<07> <> tf6e<1C> <> y<> <79> () L<> S<EFBFBD> <53> P'<17> <> <EFBFBD> <EFBFBD> <EFBFBD> R'<15> f q]\" <EFBFBD> s> )<29> <> `<60> H2<13> Eq9<04> <> ?<13> * )<29> <> t'<27> <> ϧ<EFBFBD> \n \r <EFBFBD> s<<3C> Pi2IN<49> <13> *(=2<1B> gX<67> <58> <EFBFBD> .3<EFBFBD> N<EFBFBD> Y 4<> B<<3C> L<EFBFBD> <4C> <08> i<18> ̥2<CCA5> <05> z=<13> 0 H<> <48> <EFBFBD> '<27> ꌚ<EFBFBD> u<EFBFBD> tt:<3A> <> <EFBFBD> <03> <> <EFBFBD> e<EFBFBD> ]`pX9<58> <39> o5<6F> g<EFBFBD> <67> I<EFBFBD> <49> ,2 O4<4F> <34> х <> M<EFBFBD> S<EFBFBD> (<28> a<EFBFBD> <61> #<23> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> |<7C> G<> b<7F> <62> <EFBFBD> x<EFBFBD> ^Z[<5B> <> <EFBFBD> G<EFBFBD> <47> uTv<0C> (ҝ m@V<> <56> (<0B> <> <0E> bN<<3C> <> `<60> <> X<> <58> 1<EFBFBD> +<2B> <> 9J8<4A> 2\r <EFBFBD> K<EFBFBD> 9<0B> h<EFBFBD> <09> <> <EFBFBD> `<13> <> <EFBFBD> <EFBFBD> <EFBFBD> I8䛱 S<18> <> <EFBFBD> t<> 2<EFBFBD> +,<2C> <> I<EFBFBD> <49> <20> <> p<EFBFBD> 9 m@<40> :<0E> <> <EFBFBD> <05> x<EFBFBD> )<29> <> <EFBFBD> C<11> <> x<EFBFBD> 3<EFBFBD> <33> 4P7<05> <> -<0E> 4<EFBFBD> r\" p3Fh<EFBFBD> <EFBFBD> -5<> <35> U4͉<34> \\ 6<EFBFBD> <EFBFBD> <D \$ <0C> l<EFBFBD> 9<EFBFBD> R4t7<74> <37> dD3<44> p<> Γk<CE93> : )\\ ;<3B> <03> <> <EFBFBD> <06> \r @<40> t<EFBFBD> \$ 4O<EFBFBD> <<3C> <13> !pd<1A> <> <EFBFBD> QJ \r <EFBFBD> H<EFBFBD> }:&<26> <> <EFBFBD> <EFBFBD> Ȅ<EFBFBD> 5YWJ<57> <4A> <EFBFBD> <06> <> `<60> N<EFBFBD> <4E> bKNS<4E> <53> <EFBFBD> a<EFBFBD> <61> <EFBFBD> <12> <0C> d>2W<32> ŅbDj:9[21c<31> <63> <EFBFBD> ȝ<EFBFBD> :X<> @<40> q<EFBFBD> #<23> <> 4<> L<EFBFBD> 'J<12> <> +DHe<48> 3<EFBFBD> .<2E> O<03> <> K˰<4B> <CBB0> <1E> pV<14> <> t 2<> w p ; Ɠ<> <17> <> \r ?<10> OzDq.<14> <18> <> -<2D> \" <EFBFBD> Z<EFBFBD> <EFBFBD> c<EFBFBD> X3!/>P<> F<EFBFBD> s<EFBFBD> ɲ<EFBFBD> <C9B2> 0<EFBFBD> (<28> <> <EFBFBD> <EFBFBD> ʣ<EFBFBD> <CAA3> <EFBFBD> <EFBFBD> <EFBFBD> T63sVQo<51> <6F> SΑ <53> b<EFBFBD> ߅ ^ r\$ <EFBFBD> @C<> r2)<29> <> <EFBFBD> <20> V<EFBFBD> )+nܷz<DCB7> <1E> <> <EFBFBD> <EFBFBD> <EFBFBD> l<> <6C> { <EFBFBD> K#<23> <> 9<EFBFBD> { <EFBFBD> ۯl<03> <> <1D> m<EFBFBD> Q<EFBFBD> <51> h<1E> *ɗP<C997> :<3A> c<EFBFBD> ]<5D> 7<EFBFBD> <37> <EFBFBD> =<3D> <> L<EFBFBD> <4C> <EFBFBD> i;<3B> 2<07> <> <17> <> <EFBFBD> <EFBFBD> <\\ <EFBFBD> J<EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> n<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n<EFBFBD> _iӴ<EFBFBD> J\n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <15> C:<3A> <14> <> `N4<4E> ̖<EFBFBD> 'Aw :4}<7D> ۣ<EFBFBD> W\0 80<38> <30> L3<4C> <1D> J;<3B> i<EFBFBD> )\\ <EFBFBD> =/N<> u=ZV6&cea<65> <61> <EFBFBD> p<EFBFBD> <70> .[<5B> v<EFBFBD> tPZ<0E> <> X`֔<> <D694> +z<1E> '<27> <> 9<> .\$ \$ <EFBFBD> <EFBFBD> <EFBFBD> @\n \r <EFBFBD> ]_<> ٮ<EFBFBD> <D9AE> h<EFBFBD> kk<6B> Ms>`̖<> j<EFBFBD> %<25> \\ 9 ж<> <D0B6> ('<0B> j A<> >BCd \" K \$ CA<17> <0B> <> <1E> <10> .². `<60> <> .E<> 洖<EFBFBD> <10> y y \0 <EFBFBD> D 2<1E> 8t <01> 6<EFBFBD> <36> 8<10> FL<46> <4C> <EFBFBD> <02> <> <EFBFBD> <EFBFBD> B*<2A> <> <EFBFBD> ,<2C> |\n x\\ @<40> <1F> @<40> <03> 3r <20> <> <02> <> WKQb,%<25> <17> <> D B f<07> ȳD|͌<> E0/<2F> 2><3E> Y! Ć'<11> <1E> `<60> f<1E> mH<01> < B<> B0\r * \0 Gx<47> <0B> n<0C> Y4<59> <34> <0E> <> ,<2C> L<EFBFBD> <4C> <EFBFBD> <06> <> <EFBFBD> %S<> ,<2C> v<EFBFBD> 0<EFBFBD> <18> <0C> X<EFBFBD> Q<EFBFBD> 1<05> HI d`<60> !.<2E> V<EFBFBD> <0B> H/<10> <> × <EFBFBD> H<08> <> 0<EFBFBD> U<02> <> 0 <30> <C299> `<60> LI<4C> 8<EFBFBD> <38> k<EFBFBD> <6B> 2<EFBFBD> 4JYN<59> &<26> 8x<38> <78> J<> k:AK㝡nW<12> !<04> <0F> <> <EFBFBD> <1D> I<EFBFBD> ;'<0C> <0B> \" :2<> <32> <EFBFBD> 4<EFBFBD> ~<7E> J<EFBFBD> 8<> <38> <EFBFBD> ᒑ<EFBFBD> <E19291> G<EFBFBD> <47> \" M<EFBFBD> = \r Z'<27> n<EFBFBD> i9F<39> <1F> <> <EFBFBD> r<EFBFBD> <02> R<EFBFBD> t<0B> 3 \0 <EFBFBD> <EFBFBD> Ҳ<EFBFBD> 2<> y<14> <> B^<5E> <> b'<07> <> z<EFBFBD> ɲ (<28> #<23> d9It<49> &W<> jNa<4E> <1B> C(<28> j<> Ė ?h<10> <> <EFBFBD> j<EFBFBD> <6A> <EFBFBD> <01> ք Z\$ 0<EFBFBD> <EFBFBD> ү <EFBFBD> J A_<41> \n <EFBFBD> !T<> O<EFBFBD> 4<> <{ a<EFBFBD> <EFBFBD> ?<3F> <> o <20> <1C> <> -<2D> <> <06> <> ?Hl<48> \" <EFBFBD> 2<EFBFBD> y<> =<3D> 먞<12> R<> <52> <EFBFBD> ф<EFBFBD> <D184> <EFBFBD> <EFBFBD> ͊<> P&<26> G<EFBFBD> <47> <EFBFBD> 4<EFBFBD> <34> %()<14> \r 5M<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> LT<EFBFBD> \0 <EFBFBD> <EFBFBD> <EFBFBD> xBI<EFBFBD> =lt v<> 2Jhv<68> <76> <05> ~/:<3A> <10> p<EFBFBD> <70> :8\" д5<EFBFBD> <EFBFBD> <EFBFBD> 0<EFBFBD> #<23> *<2A> 7<EFBFBD> <37> <EFBFBD> <14> \n <EFBFBD> q<EFBFBD> ><3E> <> G\$ <EFBFBD> <EFBFBD> <02> ): <09> <> \" <EFBFBD> #<23> <> KfI<66> !<21> v<EFBFBD> + ?{ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Qg<51> <67> { <EFBFBD> R<EFBFBD> Q<EFBFBD> <EFBFBD> C<> <43> <0F> }<7D> #<23> <> iIb<49> g<EFBFBD> <67> <EFBFBD> X<EFBFBD> <58> <1B> <> <EFBFBD> }<7D> <> `<60> }3<> %@<40> <1B> { _k<EFBFBD> }0<> <30> <EFBFBD> ȗ<EFBFBD> p<18> !<21> a<EFBFBD> <05> <7<05> e<0C> <> <13> F<EFBFBD> ?<18> <15> <> <EFBFBD> <EFBFBD> X<EFBFBD> D<EFBFBD> <44> <EFBFBD> , <20> <> Ck<43> <0E> <> U<EFBFBD> <55> L><3E> 1<> <31> <EFBFBD> ܇<EFBFBD> <DC87> <06> <> p0<70> #<23> \$ <EFBFBD> <EFBFBD> <EFBFBD> V)pY<70> s5A<35> :<04> <> U<> ( 9<1E> 5<EFBFBD> <1D> ,F+<2B> &<26> *{ <EFBFBD> <EFBFBD> -<2D> <04> <13> <1F> :<3A> <> <EFBFBD> <EFBFBD> :7<> <37> :ʙyP<1F> <> <0E> <> <EFBFBD> <EFBFBD> X<> +<2B> <> <EFBFBD> \n <EFBFBD> I;<3B> <> \\ s<EFBFBD> <EFBFBD> P<EFBFBD> <EFBFBD> 1<EFBFBD> <0C> <> <EFBFBD> <EFBFBD> r<EFBFBD> <12> NJ<4E> AT'-<2D> <> <EFBFBD> k?<3F> <> Y@<40> <> <EFBFBD> <7F> <EFBFBD> f<> <66> bR<F18E9294> J<EFBFBD> i<EFBFBD> m<> B~<7E> <> <EFBFBD> K \r K<EFBFBD> <EFBFBD> t<EFBFBD> 4<EFBFBD> <EFBFBD> ;O<> Kc<4B> 9% H<> 5<EFBFBD> <35> d<EFBFBD> 3<EFBFBD> <33> e8j<38> P<> <50> [s<> <73> 9,<2C> Ę<EFBFBD> bzK<7A> <4B> <EFBFBD> <EFBFBD> W&e<> d 8<> <38> <EFBFBD> )<12> <> <EFBFBD> <0E> uP<75> <50> <0E> <> ><0B> # P&<26> <> P <09> pb a<> <1D> ͨy<CDA8> <79> <EFBFBD> <EFBFBD> \$ 3}<7D> <> { <EFBFBD> <EFBFBD> <EFBFBD> hy<EFBFBD> (<28> d W<03> <> <EFBFBD> <EFBFBD> <02> <> <EFBFBD> _<EFBFBD> :<3A> 'A<41> P<EFBFBD> <14> I\" <EFBFBD> !<21> <> [`<60> n8<6E> <38> i/@<40> <> <EFBFBD> P <09> f<05> Ў冩<D08E> V <09> <> <EFBFBD> <02> s<EFBFBD> C<EFBFBD> 8<0C> <> <15> Ny<4E> <01> h<04> <> tEn Aj.-<2D> <> 6<18> <> q wJ<0C> ?<3F> ù<EFBFBD> A<EFBFBD> hu <09> <> <EFBFBD> s<EFBFBD> <73> A<> <41> O7<4F> <37> j<EFBFBD> <6A> \n ]<5D> 0<> ^<5E> <09> \n Y<0C> <> \$ <EFBFBD> Ζ _<> \r <EFBFBD> \$ <EFBFBD> u*<01> <> ޡ<EFBFBD> Ex/ d<> pdR<64> d<1A> <> :<3A> I<EFBFBD> oD<6F> <44> <EFBFBD> <EFBFBD> sQ<73> <10> f<EFBFBD> <66> I<EFBFBD> <49> <EFBFBD> <EFBFBD> <EFBFBD> 8<EFBFBD> ,<2C> <> K<EFBFBD> <10> IsM@aq\n /<2F> <17> <> M<> R<EFBFBD> <52> <EFBFBD> <EFBFBD> C<1E> -a<> a<EFBFBD> <61> <EFBFBD> /<2F> H<> !<18> 4F<34> <46> I<EFBFBD> <49> <EFBFBD> pŔMϫ<4D> <CFAB> _؇H<D887> 9 { <EFBFBD> .<2E> \$ W<EFBFBD> <EFBFBD> <EFBFBD> # { <1A> <> Ү <EFBFBD> <05> <> :<3A> S<EFBFBD> <53> <EFBFBD> (<28> 'l<> MY<4D> :lʞ<6C> mD\$ <EFBFBD> \0 <EFBFBD> <EFBFBD> <EFBFBD> \0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> '<27> ~<05> <> Z @<40> <0B> <> <EFBFBD> <EFBFBD> V<05> <> <04> L\" <EFBFBD> jn<6A> <6E> 5<EFBFBD> <35> Nl<4E> <6C> <EFBFBD> <EFBFBD> <EFBFBD> K<EFBFBD> fj&<26> M<0C> <1A> O<EFBFBD> <4F> dbӰN<D3B0> <4E> <04> <> O\$ i )<29> N<EFBFBD> (<28> <01> ! P)<02> 0+<2B> 6HpN<70> <4E> <EFBFBD> F<EFBFBD> <46> <EFBFBD> Ж<EFBFBD> <D096> ?L \n <EFBFBD> <EFBFBD> <0E> -h<> 0<EFBFBD> <30> ,.e<> <65> \" <EFBFBD> <07> 6m#<23> <09> <> <EFBFBD> o&<26> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> Z<EFBFBD> @P<> k<08> &̺ _<> <5F> %\\ \\ '<27> <> <EFBFBD> \0 ] \$ (<28> 5<EFBFBD> N fq<66> |<05> p<> `<60> <> <<3C> <> R<EFBFBD> <52> <EFBFBD> <20> <> <EFBFBD> <06> <0E> <> I\0 <EFBFBD> <13> <> <EFBFBD> L<EFBFBD> |<7C> \$ <EFBFBD> <12> <> (<28> <> <EFBFBD> ŬTkQ6k<36> B@0H<30> <48> <EFBFBD> P<EFBFBD> \r <EFBFBD> <EFBFBD> <EFBFBD> #<23> u<10> <> +<18> <> ܲpT<70> <54> Zѱ<5A> /<2F> \r y<02> Pp% \0 ^8<> <38> \r <EFBFBD> <EFBFBD> <EFBFBD> <07> <19> <> 4<EFBFBD> <34> \0 <EFBFBD> <EFBFBD> 1<> <31> <EFBFBD> <EFBFBD> Qn* + B8q<38> ࠎ<EFBFBD> F<> \0 д<EFBFBD> ܱ<EFBFBD> <EFBFBD> <EFBFBD> \n <EFBFBD> <EFBFBD> <EFBFBD> .<2E> <> <EFBFBD> <EFBFBD> H<EFBFBD> <05> %<13> <> 3<EFBFBD> <33> &P<> F<05> ф<> X<> <58> <EFBFBD> <EFBFBD> `O <20> <> <EFBFBD> <EFBFBD> 9 R<19> B<EFBFBD> <42> \r <20> 1 0<> <30> 콇O <20> X<EFBFBD> <58> ^+<2B> <> <EFBFBD> <EFBFBD> <EFBFBD> i<EFBFBD> <69> A rD<72> 4<> <16> `<60> -<2D> .i`4<> '<06> , \$ <EFBFBD> V<EFBFBD> ,_ c~;Bn<<3C> 1\$ ,]%<25> l<EFBFBD> <6C> D=<3D> <> \$ <0C> ) .1b% g<> <67> z<> <7A> <EFBFBD> }<7D> <> G2<47> 1 ] 8uP<75> <50> <EFBFBD> D] /z <20> <> <EFBFBD> g<EFBFBD> +'<27> 7D\0 ]<0B> <> <EFBFBD> <EFBFBD> a<EFBFBD> <61> pV<0E> <> L<0C> <> 0<> +`Xp<58> <70> <20> <18> d<EFBFBD> -h<> +h(<28> <05> <> <EFBFBD> <EFBFBD> <EFBFBD> \n <EFBFBD> <02> <> f<EFBFBD> <66> <10> s 2,<2C> 2<EFBFBD> @z <20> .I` `<60> *<2A> <18> 1 l?<10> <0F> R<EFBFBD> <52> <10> W.<2E> .c%\$ <EFBFBD> <EFBFBD> <EFBFBD> s+4<0B> <> <EFBFBD> <EFBFBD> 6<EFBFBD> \$ Cr<EFBFBD> F)0<> <30> \r <EFBFBD> 1-<2D> `<60> ӌ <20> j<EFBFBD> L<EFBFBD> \r <EFBFBD> 8<13> <> <EFBFBD> l<EFBFBD> 0<> <13> *.L<> Kp<4B> \r <EFBFBD> <EFBFBD> \r <EFBFBD> /r<> L <0F> a8<0E> 2K<32> 1n<31> b<EFBFBD> <62> 4<EFBFBD> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> ,<2C> ˬ<EFBFBD> <CBAC> <EFBFBD> <EFBFBD> \n ij<EFBFBD> <EFBFBD> r<04> i#ǩ8<02> 1<7F> bx<62> 2<04> <> \$ N<EFBFBD> \r e<18> <20> \r \" 8<EFBFBD> '<27> <12> <> <EFBFBD> <EFBFBD> <EFBFBD> \r <EFBFBD> -<2D> P<EFBFBD> <50> Y<11> 0<EFBFBD> <30> Yb<08> S\0 <EFBFBD> <EFBFBD> <EFBFBD> \\ jK+q 6 V<07> h<13> 1<EFBFBD> U<10> z `p<> <70> <EFBFBD> R<> E<EFBFBD> C<> <14> <> X<EFBFBD> <58> <EFBFBD> <EFBFBD> %<0C> F 5<> F4f-<03> t P<> ID6 \0 N F<> <46> N<EFBFBD> 4<EFBFBD> _<0F> 0<EFBFBD> <30> \r i L@<40> n<EFBFBD> <6E> P<EFBFBD> ^<5E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> %'<27> LԨ<0C> G<> <04> <04> <> <EFBFBD> <EFBFBD> <EFBFBD> \\ <EFBFBD> F<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> &<26> 4<EFBFBD> <34> I * 5<07> O<EFBFBD> <4F> O<EFBFBD> <4F> P<04> )8<10> )<29> *L<> ;<3B> <> 4E<34> ]<0C> \$ <EFBFBD> <EFBFBD> <EFBFBD> \0 L 3<> E <20> Ek<45> <6B> <EFBFBD> <EFBFBD> It%e<> \n b<EFBFBD> (<28> <> SM<53> }<7D> <> 7s<37> <16> ۏ<> )g i<> <69> F<EFBFBD> <46> &<26> <> -XH<58> <20> <> <EFBFBD> <EFBFBD> B<> M5~jrPj ̾-|֤<> 9<EFBFBD> <39> <EFBFBD> p<EFBFBD> <07> 5<> <35> ;o<> <6F> 5<EFBFBD> <0C> <> <EFBFBD> <EFBFBD> c \n d<EFBFBD> <EFBFBD> u<EFBFBD> <09> <> <0C> \r L<EFBFBD> h<EFBFBD> ' \n <EFBFBD> ' '<27> < O\0 <EFBFBD> <EFBFBD> e,. <20> <> \" t \r <EFBFBD> k^<5E> { _<03> _gT<05> <> ` \0 <EFBFBD> Mk?<3F> 2<> \r :Db%<15> ]U<> [<5B> <> 1<EFBFBD> <31> cu<63> [<5B> <> [ 9]<5D> <> <EFBFBD> / EV>k@<40> a \r _ \" <EFBFBD> b6 ]<5D> E<> D<0C> Q^)ș<0C> @P s<> ITr vT\0 <EFBFBD> VR<56> W@ <20> iR<69> 2/<2F> b<EFBFBD> ,Xr<58> <0C> j<> ^<5E> <> 0<EFBFBD> <30> <14> <> k<EFBFBD> <6B> <EFBFBD> C<EFBFBD> l<EFBFBD> <6C> f l'8E<38> <45> <14> <> o<> W<EFBFBD> <57> <EFBFBD> I<EFBFBD> <49> mp룶<70> /& <> <7F> +<2B> <> <EFBFBD> <EFBFBD> X<07> <> k.<2E> <> \\ <EFBFBD> 4<0C> 0d<30> r\" <EFBFBD> <EFBFBD> kb\n H \$ Т <EFBFBD> <EFBFBD> KC<EFBFBD> <EFBFBD> o<EFBFBD> Oo<EFBFBD> <0C> G%\r <EFBFBD> <EFBFBD> <10> <> ύl<CF8D> <6C> <EFBFBD> <EFBFBD> <12> <> <20> ]<5D> P7\" * hP P<> \r c<EFBFBD> _<EFBFBD> X[`<60> <> <EFBFBD> <EFBFBD> <0C> <> 7<EFBFBD> :`<60> <> U<EFBFBD> <55> ߨ<EFBFBD> I<EFBFBD> <49> w<EFBFBD> d<07> <> ;<3B> <> <09> <> <17> x<07> t<17> <05> <> 8d \0 <EFBFBD> @<40> jw<6A> v<17> <20> <> { <EFBFBD> <EFBFBD> b<> <09> p<EFBFBD> <70> <EFBFBD> <EFBFBD> c y<> <79> \n <EFBFBD> <EFBFBD> , u< <09> <> \" uyE:<3A> <> Z `< LF<4C> <46> <1E> <> 2<EFBFBD> <32> cw<63> S<EFBFBD> d<> % uw<75> <77> u<EFBFBD> ߀ #pqN N<1A> <> N<07> \n <EFBFBD> #@<07> E<EFBFBD> #\" @|d%kwc\" *<2A> x<05> <0B> <> w<EFBFBD> <77> \0
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> <> N<EFBFBD> \n <EFBFBD> <1A> [<02> b<EFBFBD> <62> <EFBFBD> | ;<3B> <> <EFBFBD> p <70> 74<37> ܔ¢<DC94> <C2A2> I<EFBFBD> C<EFBFBD> \\ <EFBFBD> <1B> X<03> <> \n %<25> h<EFBFBD> I<EFBFBD> <49> 4<> g<EFBFBD> P:<<3C> <> <EFBFBD> k<EFBFBD> 1Q<31> + \\ <EFBFBD> <EFBFBD> ^咠<> V<EFBFBD> <56> C<EFBFBD> <43> <18> W<EFBFBD> <57> `83B-9F@<40> n<17> T><3E> <> <EFBFBD> lj -<2D> <> <EFBFBD> <EFBFBD> &<26> <> `9q<39> <71> <EFBFBD> <01> <1E> <1F> <> P<EFBFBD> y6<79> <36> \r .y<> &<26> <02> <> <EFBFBD> ả<18> <> E8<45> 0<EFBFBD> <30> <EFBFBD> <1F> kA<6B> <41> V<EFBFBD> T7<54> p<EFBFBD> <70> x<EFBFBD> )ޡ~<7E> M<EFBFBD> <4D> <EFBFBD> !<21> E t<13> <> <EFBFBD> P \\ <EFBFBD> <EFBFBD> ϗm~c<> B<EFBFBD> \\ \n <EFBFBD> m<EFBFBD> v{ <EFBFBD> <EFBFBD> <EFBFBD> 9`G[<5B> <06> ~xsL<73> \\ <EFBFBD> I<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Xwy\n <EFBFBD> <EFBFBD> <02> u<EFBFBD> <75> <0E> <> S<EFBFBD> c<07> <> <03> 1?A<> *<2A> <03> <> { <0B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϳ <EFBFBD> |9 /<2F> <> <EFBFBD> <EFBFBD> E<EFBFBD> <45> 4<EFBFBD> <34> /<2F> W<EFBFBD> [ȳ><3E> <> ]<0B> r<EFBFBD> <1F> <> <EFBFBD> v<EFBFBD> ~B<> P B`T<08> H> 0<> B<0F> <0F> )<04> <> ><3E> N !4\" <EFBFBD> <EFBFBD> <EFBFBD> xW-<2D> X)<29> 0<EFBFBD> BhA0<41> <30> J2P@ ><3E> A A )<29> S<EFBFBD> <53> n<EFBFBD> <6E> n<> O<EFBFBD> Q<EFBFBD> <51> <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> r<EFBFBD> <72> <EFBFBD> Ҧ<EFBFBD> <D2A6> <0E> <> <EFBFBD> h<EFBFBD> <68> @ȋ<> <C88B> <EFBFBD> (<28> <> \n <EFBFBD> <EFBFBD> F<EFBFBD> <EFBFBD> ϖ<EFBFBD> ƙ<03> (<28> γ <0E> <> P\0 <EFBFBD> N<EFBFBD> <EFBFBD> o}<01> <> l<EFBFBD> <<3C> n<EFBFBD> <6E> <EFBFBD> <EFBFBD> <EFBFBD> <18> <> l<EFBFBD> oq\0 /Q \0 of*ʑ N<> <0C> P<06> \r /<14> pA<07> Y\0 p \\ <EFBFBD> <EFBFBD> ~<7E> <> b<EFBFBD> Lh <20> !<06> <> <09> P<EFBFBD> <50> d<EFBFBD> .<2E> <07> y\n o \0 <EFBFBD> <0C> <> ж<EFBFBD> P pt<70> P<EFBFBD> ov<6F> Ђkn<6B> <6E> \0 z +<2B> <> l6<6C> <36> <EFBFBD> <01> <> <EFBFBD> 0<EFBFBD> <30> <EFBFBD> <EFBFBD> P<> o F<04> N<EFBFBD> <4E> F<EFBFBD> <46> O p<> <0C> N `<60> <0C> <> \r og<10> <> 0} P<> \n <EFBFBD> <EFBFBD> @<40> <> <EFBFBD> 15\r <EFBFBD> 9\$ M \r <EFBFBD> \\ <EFBFBD> \n g g<> <0C> <> <0E> <> \$ Q \r <EFBFBD> <0F> Dd<44> <64> <EFBFBD> 8\$ <EFBFBD> <EFBFBD> k<EFBFBD> D<EFBFBD> j֢ Ԇ<05> &<26> <> <18> <> <0B> <> <EFBFBD> b Ѭ<> 갿<07> <> <09> =\n 0<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Pؠ~ج6 e<> <65> <EFBFBD> 2%<25> x \" p<EFBFBD> @X<> <58> ~<0C> <> <11> ?<3F> цZelf \0 <EFBFBD> Z), ,^<5E> `<60> \0 <EFBFBD> 8&<26> <04> <0F> ٩<> <1A> r<1A> <> <05> <> <EFBFBD> k FJ<08> <> P> V<> <11> ԍp<D48D> <70> 8%2><3E> B m<> <6D> <18> @<40> <> G(<07> <1A> <> s\$ <EFBFBD> <05> d<EFBFBD> ̜v<CC9C> \" <EFBFBD> p<EFBFBD> w<EFBFBD> <EFBFBD> 6<EFBFBD> <EFBFBD> } (V<0B> Kˠ<4B> K<EFBFBD> L ¾<> <1E> <> W<EFBFBD> <57> q<> \r <EFBFBD> <EFBFBD> <EFBFBD> ̤ʀQ<1C> L%<25> P<EFBFBD> dJ<64> <4A> H<04> NxK:\n <EFBFBD> <EFBFBD> <20> %fn<66> <6E> <EFBFBD> %Ҍ<> D<EFBFBD> M<0B> <20> [#<23> T\r <EFBFBD> <EFBFBD> r<EFBFBD> .<2E> LL<04> &W/> h6 @<40> E<EFBFBD> <45> <0B> LP<4C> v<EFBFBD> C<EFBFBD> <43> 6 O:Yh^ mn6<6E> n<EFBFBD> j>7`z `N<04> \\ <EFBFBD> j\r g<EFBFBD> \r <EFBFBD> i2I\$ \" @<40> [` <05> hM<68> 3 q3d<33> <0B> \0 ֵ<EFBFBD> <EFBFBD> ys \$ `<60> D<EFBFBD> <44> \$ \0 <EFBFBD> QOf1<EFBFBD> &<02> \" ~0<> <30> `<60> <0B> \" @Z G<> ) Y:S<> <53> <EFBFBD> D.S %͈<> <CD88> <EFBFBD> 3<> <33> d<> <07> m<EFBFBD> U5<55> <35> <0B> <04> <<3C> S<EFBFBD> SZ 3<> %r<> <72> <EFBFBD> <04> <> { <EFBFBD> e3Cu6<EFBFBD> o73<EFBFBD> d<EFBFBD> L\" <EFBFBD> c7<EFBFBD> LN<EFBFBD> <EFBFBD> Y<EFBFBD> <EFBFBD> <EFBFBD> k<EFBFBD> ><3E> <> <EFBFBD> <EFBFBD> .<2E> p<EFBFBD> <70> 2<EFBFBD> Q<1E> <> <04> <> <04> <> <EFBFBD> 3<EFBFBD> VذWB<57> Dt Cq#C @<40> I<EFBFBD> P<> DT_D<5F> :<3A> <> Q<<3C> UF<55> =<3D> 1<1B> @\$ <EFBFBD> <EFBFBD> 6<> <c<> r<EFBFBD> f %<25> <0F> ,|<7C> 27#w7<77> Tq<54> <71> 6s<36> l-1cP<63> m<EFBFBD> q<EFBFBD> <71> \n @<40> <0C> <> 5 \0 P!` \\ \r @<40> \" C<EFBFBD> - \0 RR<EFBFBD> tFH8<EFBFBD> |N<> <0C> -<2D> <> d<EFBFBD> g<> <0E> <> \r <EFBFBD> <EFBFBD> )F<> * h<> `<60> <> <EFBFBD> CK4<4B> 1<EFBFBD> ʍkMKCRf@w4B<04> J<> <4A> 2\" 䌴<EFBFBD> \r 1 Q4<51> 2 , \" <EFBFBD> <EFBFBD> '<27> <EFBFBD> x<0C> <> y<05> R<EFBFBD> %RēS<18> 5 K<> <4B> IFz #XP<58> ><0F> <> f<EFBFBD> <18> -WX\r <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> pU<0E> <> D<EFBFBD> t&7@<40> <> <EFBFBD> <EFBFBD> ?<3F> <> <1F> <> <08> <> <EFBFBD> }O1<4F> 2<EFBFBD> <32> 2<EFBFBD> #UK *<2A> )<29> 긋<EFBFBD> 0o<><3E> ]H<> <04> <> ƿr<C6BF> <72> LGN<47> <0E> <> <EFBFBD> W%<25> <> M^<5E> <> 9X :<3A> ɥN<C9A5> <4E> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> E<> <16> @xy<78> (H<> ƙMd<4D> 5<52B<32> <20> <> k!>\r ^J`<60> I<EFBFBD> S<EFBFBD> N<EFBFBD> <4E> 4'ƚ*<05> *`<60> ><03> <> `|<7C> 0,<2C> DJ<44> F xb<78> <0C> <> 4lTؕ<54> [<5B> <> [<5B> <> \\ <EFBFBD> <EFBFBD> <05> Ԡ<EFBFBD> \\ { <EFBFBD> <EFBFBD> 6\\ ޖ<16> <20> <> (#mJԣ,<07> `<60> I<> <49> J<15> խ<EFBFBD> <D5AD> <EFBFBD> l<EFBFBD> <0E> <20> j<EFBFBD> j֟?֣kG<6B> k<EFBFBD> T9<54> <39> ]3ohuJ<75> <4A> <EFBFBD> <0F> <> W<EFBFBD> \r k<EFBFBD> <EFBFBD> ) \0 <EFBFBD> 3<EFBFBD> <0E> @x<> <78> ,<2C> -<1B> 5B<35> <42> <EFBFBD> <EFBFBD> =<3D> <> ࣐#<23> gf<67> <04> &<26> <> <03> Z`<60> #<23> o<EFBFBD> <0B> Xf<58> <66> \r <20> Jh<4A> <68> <EFBFBD> <EFBFBD> <EFBFBD> 5r qnz<0B> <> <16> s<> ,6<> o<EFBFBD> t D<> y<EFBFBD> <79> <EFBFBD> b<EFBFBD> <62> h<EFBFBD> <05> Ctn<74> 9 n<> <6E> <EFBFBD> `<11> X<11> &<26> \r ' tpL<70> 7<12> Η <EFBFBD> &<26> <> <EFBFBD> l<EFBFBD> Z-<02> <08> w<EFBFBD> { r<0F> <> @iUzM<7A> { r xא<EFBFBD> m<EFBFBD> SB<EFBFBD> \r @<40> H*BD.7<EFBFBD> (<28> <12> 3 XCV <20> <W<> у <EFBFBD> |d<08> q*@<40> <> @<40> <> <EFBFBD> +x<> <04> ̼`<60> <> <EFBFBD> ^<5E> ̘߬__<5F> <5F> ND<4E> X \0 Q_D]}t<> Y<EFBFBD> <59> p<EFBFBD> f<0C> w<EFBFBD> <77> \" <EFBFBD> 3
connection (){ global $g ; return $g ;} function
2014-04-01 18:00:42 +00:00
adminer (){ global $b ; return $b ;} function
2017-04-21 11:23:04 +00:00
idf_unescape ( $u ){ $Vd = substr ( $u , - 1 ); return
str_replace ( $Vd . $Vd , $Vd , substr ( $u , 1 , - 1 ));} function
2014-04-01 18:00:42 +00:00
escape_string ( $X ){ return
substr ( q ( $X ), 1 , - 1 );} function
2015-04-01 06:36:56 +00:00
number ( $X ){ return
preg_replace ( '~[^0-9]+~' , '' , $X );} function
2017-04-21 11:23:04 +00:00
remove_slashes ( $Qf , $Lc = false ){ if ( get_magic_quotes_gpc ()){ while ( list ( $y , $X ) = each ( $Qf )){ foreach ( $X
as $Kd => $W ){ unset ( $Qf [ $y ][ $Kd ]); if ( is_array ( $W )){ $Qf [ $y ][ stripslashes ( $Kd )] = $W ; $Qf [] =& $Qf [ $y ][ stripslashes ( $Kd )];} else $Qf [ $y ][ stripslashes ( $Kd )] = ( $Lc ? $W : stripslashes ( $W ));}}}} function
bracket_escape ( $u , $Na = false ){ static $Gh = array ( ':' => ':1' , ']' => ':2' , '[' => ':3' , '"' => ':4' ); return
strtr ( $u ,( $Na ? array_flip ( $Gh ) : $Gh ));} function
charset ( $g ){ return ( version_compare ( $g -> server_info , " 5.5.3 " ) >= 0 ? " utf8mb4 " : " utf8 " );} function
h ( $Q ){ return
str_replace ( " \0 " , " � " , htmlspecialchars ( $Q , ENT_QUOTES , 'utf-8' ));} function
nbsp ( $Q ){ return ( trim ( $Q ) != " " ? h ( $Q ) : " " );} function
nl_br ( $Q ){ return
str_replace ( " \n " , " <br> " , $Q );} function
checkbox ( $C , $Y , $db , $Rd = " " , $Ve = " " , $ib = " " , $Sd = " " ){ $J = " <input type='checkbox' name=' $C ' value=' " . h ( $Y ) . " ' " . ( $db ? " checked " : " " ) . ( $Sd ? " aria-labelledby=' $Sd ' " : " " ) . ( $Ve ? ' onclick="' . h ( $Ve ) . '"' : '' ) . " > " ; return ( $Rd != " " || $ib ? " <label " . ( $ib ? " class=' $ib ' " : " " ) . " > $J " . h ( $Rd ) . " </label> " : $J );} function
optionlist ( $bf , $Bg = null , $ei = false ){ $J = " " ; foreach ( $bf
as $Kd => $W ){ $cf = array ( $Kd => $W ); if ( is_array ( $W )){ $J .= '<optgroup label="' . h ( $Kd ) . '">' ; $cf = $W ;} foreach ( $cf
as $y => $X ) $J .= '<option' . ( $ei || is_string ( $y ) ? ' value="' . h ( $y ) . '"' : '' ) . (( $ei || is_string ( $y ) ? ( string ) $y : $X ) === $Bg ? ' selected' : '' ) . '>' . h ( $X ); if ( is_array ( $W )) $J .= '</optgroup>' ;} return $J ;} function
html_select ( $C , $bf , $Y = " " , $Ue = true , $Sd = " " ){ if ( $Ue ) return " <select name=' " . h ( $C ) . " ' " . ( is_string ( $Ue ) ? ' onchange="' . h ( $Ue ) . '"' : " " ) . ( $Sd ? " aria-labelledby=' $Sd ' " : " " ) . " > " . optionlist ( $bf , $Y ) . " </select> " ; $J = " " ; foreach ( $bf
as $y => $X ) $J .= " <label><input type='radio' name=' " . h ( $C ) . " ' value=' " . h ( $y ) . " ' " . ( $y == $Y ? " checked " : " " ) . " > " . h ( $X ) . " </label> " ; return $J ;} function
select_input ( $Ja , $bf , $Y = " " , $Cf = " " ){ return ( $bf ? " <select $Ja ><option value=''> $Cf " . optionlist ( $bf , $Y , true ) . " </select> " : " <input $Ja size='10' value=' " . h ( $Y ) . " ' placeholder=' $Cf '> " );} function
2014-04-01 18:00:42 +00:00
confirm (){ return " onclick= \" return confirm(' " . lang ( 0 ) . " '); \" " ;} function
2017-04-21 11:23:04 +00:00
print_fieldset ( $t , $ae , $pi = false , $Ve = " " ){ echo " <fieldset><legend><a href='#fieldset- $t ' onclick= \" " . h ( $Ve ) . " return !toggle('fieldset- $t '); \" > $ae </a></legend><div id='fieldset- $t ' " . ( $pi ? " " : " class='hidden' " ) . " > \n " ;} function
2015-04-01 06:36:56 +00:00
bold ( $Va , $ib = " " ){ return ( $Va ? " class='active $ib ' " : ( $ib ? " class=' $ib ' " : " " ));} function
odd ( $J = ' class="odd"' ){ static $s = 0 ; if ( ! $J ) $s =- 1 ; return ( $s ++% 2 ? $J : '' );} function
2017-04-21 11:23:04 +00:00
js_escape ( $Q ){ return
addcslashes ( $Q , " \r \n ' \\ / " );} function
json_row ( $y , $X = null ){ static $Mc = true ; if ( $Mc ) echo " { " ; if ( $y != " " ){ echo ( $Mc ? " " : " , " ) . " \n \t \" " . addcslashes ( $y , " \r \n \t \" \\ / " ) . '": ' . ( $X !== null ? '"' . addcslashes ( $X , " \r \n \" \\ / " ) . '"' : 'null' ); $Mc = false ;} else { echo " \n } \n " ; $Mc = true ;}} function
ini_bool ( $xd ){ $X = ini_get ( $xd ); return ( preg_match ( '~^(on|true|yes)$~i' , $X ) || ( int ) $X );} function
2014-04-01 18:00:42 +00:00
sid (){ static $J ; if ( $J === null ) $J = ( SID &&! ( $_COOKIE && ini_bool ( " session.use_cookies " ))); return $J ;} function
2017-04-21 11:23:04 +00:00
set_password ( $li , $N , $V , $G ){ $_SESSION [ " pwds " ][ $li ][ $N ][ $V ] = ( $_COOKIE [ " adminer_key " ] && is_string ( $G ) ? array ( encrypt_string ( $G , $_COOKIE [ " adminer_key " ])) : $G );} function
2015-04-01 06:36:56 +00:00
get_password (){ $J = get_session ( " pwds " ); if ( is_array ( $J )) $J = ( $_COOKIE [ " adminer_key " ] ? decrypt_string ( $J [ 0 ], $_COOKIE [ " adminer_key " ]) : false ); return $J ;} function
2017-04-21 11:23:04 +00:00
q ( $Q ){ global $g ; return $g -> quote ( $Q );} function
get_vals ( $H , $d = 0 ){ global $g ; $J = array (); $I = $g -> query ( $H ); if ( is_object ( $I )){ while ( $K = $I -> fetch_row ()) $J [] = $K [ $d ];} return $J ;} function
get_key_vals ( $H , $h = null , $wh = 0 ){ global $g ; if ( ! is_object ( $h )) $h = $g ; $J = array (); $h -> timeout = $wh ; $I = $h -> query ( $H ); $h -> timeout = 0 ; if ( is_object ( $I )){ while ( $K = $I -> fetch_row ()) $J [ $K [ 0 ]] = $K [ 1 ];} return $J ;} function
get_rows ( $H , $h = null , $n = " <p class='error'> " ){ global $g ; $vb = ( is_object ( $h ) ? $h : $g ); $J = array (); $I = $vb -> query ( $H ); if ( is_object ( $I )){ while ( $K = $I -> fetch_assoc ()) $J [] = $K ;} elseif ( ! $I &&! is_object ( $h ) && $n && defined ( " PAGE_HEADER " )) echo $n . error () . " \n " ; return $J ;} function
unique_array ( $K , $w ){ foreach ( $w
as $v ){ if ( preg_match ( " ~PRIMARY|UNIQUE~ " , $v [ " type " ])){ $J = array (); foreach ( $v [ " columns " ] as $y ){ if ( ! isset ( $K [ $y ])) continue
2 ; $J [ $y ] = $K [ $y ];} return $J ;}}} function
escape_key ( $y ){ if ( preg_match ( '(^([\w(]+)(' . str_replace ( " _ " , " .* " , preg_quote ( idf_escape ( " _ " ))) . ')([ \w)]+)$)' , $y , $B )) return $B [ 1 ] . idf_escape ( idf_unescape ( $B [ 2 ])) . $B [ 3 ]; return
idf_escape ( $y );} function
where ( $Z , $p = array ()){ global $g , $x ; $J = array (); foreach (( array ) $Z [ " where " ] as $y => $X ){ $y = bracket_escape ( $y , 1 ); $d = escape_key ( $y ); $J [] = $d . ( $x == " sql " && preg_match ( '~^[0-9]*\\.[0-9]*$~' , $X ) ? " LIKE " . q ( addcslashes ( $X , " %_ \\ " )) : ( $x == " mssql " ? " LIKE " . q ( preg_replace ( '~[_%[]~' , '[\0]' , $X )) : " = " . unconvert_field ( $p [ $y ], q ( $X )))); if ( $x == " sql " && preg_match ( '~char|text~' , $p [ $y ][ " type " ]) && preg_match ( " ~[^ -@]~ " , $X )) $J [] = " $d = " . q ( $X ) . " COLLATE " . charset ( $g ) . " _bin " ;} foreach (( array ) $Z [ " null " ] as $y ) $J [] = escape_key ( $y ) . " IS NULL " ; return
2014-04-01 18:00:42 +00:00
implode ( " AND " , $J );} function
2015-04-01 06:36:56 +00:00
where_check ( $X , $p = array ()){ parse_str ( $X , $bb ); remove_slashes ( array ( & $bb )); return
where ( $bb , $p );} function
2017-04-21 11:23:04 +00:00
where_link ( $s , $d , $Y , $Xe = " = " ){ return " &where%5B $s %5D%5Bcol%5D= " . urlencode ( $d ) . " &where%5B $s %5D%5Bop%5D= " . urlencode (( $Y !== null ? $Xe : " IS NULL " )) . " &where%5B $s %5D%5Bval%5D= " . urlencode ( $Y );} function
convert_fields ( $e , $p , $M = array ()){ $J = " " ; foreach ( $e
as $y => $X ){ if ( $M &&! in_array ( idf_escape ( $y ), $M )) continue ; $Ga = convert_field ( $p [ $y ]); if ( $Ga ) $J .= " , $Ga AS " . idf_escape ( $y );} return $J ;} function
cookie ( $C , $Y , $de = 2592000 ){ global $ba ; return
header ( " Set-Cookie: $C = " . urlencode ( $Y ) . ( $de ? " ; expires= " . gmdate ( " D, d M Y H:i:s " , time () + $de ) . " GMT " : " " ) . " ; path= " . preg_replace ( '~\\?.*~' , '' , $_SERVER [ " REQUEST_URI " ]) . ( $ba ? " ; secure " : " " ) . " ; HttpOnly; SameSite=lax " , false );} function
2014-04-01 18:00:42 +00:00
restart_session (){ if ( ! ini_bool ( " session.use_cookies " )) session_start ();} function
2017-04-21 11:23:04 +00:00
stop_session (){ if ( ! ini_bool ( " session.use_cookies " )) session_write_close ();} function & get_session ( $y ){ return $_SESSION [ $y ][ DRIVER ][ SERVER ][ $_GET [ " username " ]];} function
set_session ( $y , $X ){ $_SESSION [ $y ][ DRIVER ][ SERVER ][ $_GET [ " username " ]] = $X ;} function
auth_url ( $li , $N , $V , $m = null ){ global $Yb ; preg_match ( '~([^?]*)\\??(.*)~' , remove_from_uri ( implode ( " | " , array_keys ( $Yb )) . " |username| " . ( $m !== null ? " db| " : " " ) . session_name ()), $B ); return " $B[1] ? " . ( sid () ? SID . " & " : " " ) . ( $li != " server " || $N != " " ? urlencode ( $li ) . " = " . urlencode ( $N ) . " & " : " " ) . " username= " . urlencode ( $V ) . ( $m != " " ? " &db= " . urlencode ( $m ) : " " ) . ( $B [ 2 ] ? " & $B[2] " : " " );} function
2014-04-01 18:00:42 +00:00
is_ajax (){ return ( $_SERVER [ " HTTP_X_REQUESTED_WITH " ] == " XMLHttpRequest " );} function
2017-04-21 11:23:04 +00:00
redirect ( $A , $se = null ){ if ( $se !== null ){ restart_session (); $_SESSION [ " messages " ][ preg_replace ( '~^[^?]*~' , '' ,( $A !== null ? $A : $_SERVER [ " REQUEST_URI " ]))][] = $se ;} if ( $A !== null ){ if ( $A == " " ) $A = " . " ; header ( " Location: $A " ); exit ;}} function
query_redirect ( $H , $A , $se , $ag = true , $xc = true , $Ec = false , $vh = " " ){ global $g , $n , $b ; if ( $xc ){ $Vg = microtime ( true ); $Ec =! $g -> query ( $H ); $vh = format_time ( $Vg );} $Tg = " " ; if ( $H ) $Tg = $b -> messageQuery ( $H , $vh ); if ( $Ec ){ $n = error () . $Tg ; return
false ;} if ( $ag ) redirect ( $A , $se . $Tg ); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
queries ( $H ){ global $g ; static $Uf = array (); static $Vg ; if ( ! $Vg ) $Vg = microtime ( true ); if ( $H === null ) return
array ( implode ( " \n " , $Uf ), format_time ( $Vg )); $Uf [] = ( preg_match ( '~;$~' , $H ) ? " DELIMITER ;; \n $H ; \n DELIMITER " : $H ) . " ; " ; return $g -> query ( $H );} function
apply_queries ( $H , $T , $tc = 'table' ){ foreach ( $T
as $R ){ if ( ! queries ( " $H " . $tc ( $R ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
queries_redirect ( $A , $se , $ag ){ list ( $Uf , $vh ) = queries ( null ); return
query_redirect ( $Uf , $A , $se , $ag , false , ! $ag , $vh );} function
format_time ( $Vg ){ return
lang ( 1 , max ( 0 , microtime ( true ) - $Vg ));} function
remove_from_uri ( $qf = " " ){ return
substr ( preg_replace ( " ~(?<=[?&])( $qf " . ( SID ? " " : " | " . session_name ()) . " )=[^&]*&~ " , '' , " $_SERVER[REQUEST_URI] & " ), 0 , - 1 );} function
pagination ( $E , $Eb ){ return " " . ( $E == $Eb ? $E + 1 : '<a href="' . h ( remove_from_uri ( " page " ) . ( $E ? " &page= $E " . ( $_GET [ " next " ] ? " &next= " . urlencode ( $_GET [ " next " ]) : " " ) : " " )) . '">' . ( $E + 1 ) . " </a> " );} function
get_file ( $y , $Lb = false ){ $Jc = $_FILES [ $y ]; if ( ! $Jc ) return
null ; foreach ( $Jc
as $y => $X ) $Jc [ $y ] = ( array ) $X ; $J = '' ; foreach ( $Jc [ " error " ] as $y => $n ){ if ( $n ) return $n ; $C = $Jc [ " name " ][ $y ]; $Ch = $Jc [ " tmp_name " ][ $y ]; $xb = file_get_contents ( $Lb && preg_match ( '~\\.gz$~' , $C ) ? " compress.zlib:// $Ch " : $Ch ); if ( $Lb ){ $Vg = substr ( $xb , 0 , 3 ); if ( function_exists ( " iconv " ) && preg_match ( " ~^ \xFE \xFF |^ \xFF \xFE ~ " , $Vg , $gg )) $xb = iconv ( " utf-16 " , " utf-8 " , $xb ); elseif ( $Vg == " \xEF \xBB \xBF " ) $xb = substr ( $xb , 3 ); $J .= $xb . " \n \n " ;} else $J .= $xb ;} return $J ;} function
upload_error ( $n ){ $pe = ( $n == UPLOAD_ERR_INI_SIZE ? ini_get ( " upload_max_filesize " ) : 0 ); return ( $n ? lang ( 2 ) . ( $pe ? " " . lang ( 3 , $pe ) : " " ) : lang ( 4 ));} function
repeat_pattern ( $Af , $be ){ return
str_repeat ( " $Af { 0,65535} " , $be / 65535 ) . " $Af { 0, " . ( $be % 65535 ) . " } " ;} function
2014-04-01 18:00:42 +00:00
is_utf8 ( $X ){ return ( preg_match ( '~~u' , $X ) &&! preg_match ( '~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~' , $X ));} function
2017-04-21 11:23:04 +00:00
shorten_utf8 ( $Q , $be = 80 , $bh = " " ){ if ( ! preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n - \ x { 10FFFF}] " , $be ) . " )( $ )?)u " , $Q , $B )) preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n -~] " , $be ) . " )( $ )?) " , $Q , $B ); return
h ( $B [ 1 ]) . $bh . ( isset ( $B [ 2 ]) ? " " : " <i>...</i> " );} function
2015-04-01 06:36:56 +00:00
format_number ( $X ){ return
strtr ( number_format ( $X , 0 , " . " , lang ( 5 )), preg_split ( '~~u' , lang ( 6 ), - 1 , PREG_SPLIT_NO_EMPTY ));} function
2014-04-01 18:00:42 +00:00
friendly_url ( $X ){ return
preg_replace ( '~[^a-z0-9_]~i' , '-' , $X );} function
2017-04-21 11:23:04 +00:00
hidden_fields ( $Qf , $qd = array ()){ while ( list ( $y , $X ) = each ( $Qf )){ if ( ! in_array ( $y , $qd )){ if ( is_array ( $X )){ foreach ( $X
as $Kd => $W ) $Qf [ $y . " [ $Kd ] " ] = $W ;} else
echo '<input type="hidden" name="' . h ( $y ) . '" value="' . h ( $X ) . '">' ;}}} function
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
table_status1 ( $R , $Fc = false ){ $J = table_status ( $R , $Fc ); return ( $J ? $J : array ( " Name " => $R ));} function
column_foreign_keys ( $R ){ global $b ; $J = array (); foreach ( $b -> foreignKeys ( $R ) as $q ){ foreach ( $q [ " source " ] as $X ) $J [ $X ][] = $q ;} return $J ;} function
enum_input ( $U , $Ja , $o , $Y , $nc = null ){ global $b ; preg_match_all ( " ~'((?:[^']|'')*)'~ " , $o [ " length " ], $ke ); $J = ( $nc !== null ? " <label><input type=' $U ' $Ja value=' $nc ' " . (( is_array ( $Y ) ? in_array ( $nc , $Y ) : $Y === 0 ) ? " checked " : " " ) . " ><i> " . lang ( 7 ) . " </i></label> " : " " ); foreach ( $ke [ 1 ] as $s => $X ){ $X = stripcslashes ( str_replace ( " '' " , " ' " , $X )); $db = ( is_int ( $Y ) ? $Y == $s + 1 : ( is_array ( $Y ) ? in_array ( $s + 1 , $Y ) : $Y === $X )); $J .= " <label><input type=' $U ' $Ja value=' " . ( $s + 1 ) . " ' " . ( $db ? ' checked' : '' ) . '>' . h ( $b -> editVal ( $X , $o )) . '</label>' ;} return $J ;} function
input ( $o , $Y , $r ){ global $g , $Rh , $b , $x ; $C = h ( bracket_escape ( $o [ " field " ])); echo " <td class='function'> " ; if ( is_array ( $Y ) &&! $r ){ $Ea = array ( $Y ); if ( version_compare ( PHP_VERSION , 5.4 ) >= 0 ) $Ea [] = JSON_PRETTY_PRINT ; $Y = call_user_func_array ( 'json_encode' , $Ea ); $r = " json " ;} $jg = ( $x == " mssql " && $o [ " auto_increment " ]); if ( $jg &&! $_POST [ " save " ]) $r = null ; $Zc = ( isset ( $_GET [ " select " ]) || $jg ? array ( " orig " => lang ( 8 )) : array ()) + $b -> editFunctions ( $o ); $Ja = " name='fields[ $C ]' " ; if ( $o [ " type " ] == " enum " ) echo
nbsp ( $Zc [ " " ]) . " <td> " . $b -> editInput ( $_GET [ " edit " ], $o , $Ja , $Y ); else { $Mc = 0 ; foreach ( $Zc
as $y => $X ){ if ( $y === " " ||! $X ) break ; $Mc ++ ;} $Ue = ( $Mc ? " onchange= \" var f = this.form['function[ " . h ( js_escape ( bracket_escape ( $o [ " field " ]))) . " ]']; if ( $Mc > f.selectedIndex) f.selectedIndex = $Mc ; \" onkeyup='keyupChange.call(this);' " : " " ); $Ja .= $Ue ; $hd = ( in_array ( $r , $Zc ) || isset ( $Zc [ $r ])); echo ( count ( $Zc ) > 1 ? " <select name='function[ $C ]' onchange='functionChange(this);' " . on_help ( " getTarget(event).value.replace(/^SQL \$ /, '') " , 1 ) . " > " . optionlist ( $Zc , $r === null || $hd ? $r : " " ) . " </select> " : nbsp ( reset ( $Zc ))) . '<td>' ; $zd = $b -> editInput ( $_GET [ " edit " ], $o , $Ja , $Y ); if ( $zd != " " ) echo $zd ; elseif ( preg_match ( '~bool~' , $o [ " type " ])) echo " <input type='hidden' $Ja value='0'> " . " <input type='checkbox' " . ( in_array ( strtolower ( $Y ), array ( '1' , 't' , 'true' , 'y' , 'yes' , 'on' )) ? " checked='checked' " : " " ) . " $Ja value='1'> " ; elseif ( $o [ " type " ] == " set " ){ preg_match_all ( " ~'((?:[^']|'')*)'~ " , $o [ " length " ], $ke ); foreach ( $ke [ 1 ] as $s => $X ){ $X = stripcslashes ( str_replace ( " '' " , " ' " , $X )); $db = ( is_int ( $Y ) ? ( $Y >> $s ) & 1 : in_array ( $X , explode ( " , " , $Y ), true )); echo " <label><input type='checkbox' name='fields[ $C ][ $s ]' value=' " . ( 1 << $s ) . " ' " . ( $db ? ' checked' : '' ) . " $Ue > " . h ( $b -> editVal ( $X , $o )) . '</label>' ;}} elseif ( preg_match ( '~blob|bytea|raw|file~' , $o [ " type " ]) && ini_bool ( " file_uploads " )) echo " <input type='file' name='fields- $C ' $Ue > " ; elseif (( $th = preg_match ( '~text|lob~' , $o [ " type " ])) || preg_match ( " ~ \n ~ " , $Y )){ if ( $th && $x != " sqlite " ) $Ja .= " cols='50' rows='12' " ; else { $L = min ( 12 , substr_count ( $Y , " \n " ) + 1 ); $Ja .= " cols='30' rows=' $L ' " . ( $L == 1 ? " style='height: 1.2em;' " : " " );} echo " <textarea $Ja > " . h ( $Y ) . '</textarea>' ;} elseif ( $r == " json " || preg_match ( '~^jsonb?$~' , $o [ " type " ])) echo " <textarea $Ja cols='50' rows='12' class='jush-js'> " . h ( $Y ) . '</textarea>' ; else { $re = ( ! preg_match ( '~int~' , $o [ " type " ]) && preg_match ( '~^(\\d+)(,(\\d+))?$~' , $o [ " length " ], $B ) ? (( preg_match ( " ~binary~ " , $o [ " type " ]) ? 2 : 1 ) * $B [ 1 ] + ( $B [ 3 ] ? 1 : 0 ) + ( $B [ 2 ] &&! $o [ " unsigned " ] ? 1 : 0 )) : ( $Rh [ $o [ " type " ]] ? $Rh [ $o [ " type " ]] + ( $o [ " unsigned " ] ? 0 : 1 ) : 0 )); if ( $x == 'sql' && $g -> server_info >= 5.6 && preg_match ( '~time~' , $o [ " type " ])) $re += 7 ; echo " <input " . (( ! $hd || $r === " " ) && preg_match ( '~(?<!o)int~' , $o [ " type " ]) &&! preg_match ( '~\[\]~' , $o [ " full_type " ]) ? " type='number' " : " " ) . " value=' " . h ( $Y ) . " ' " . ( $re ? " data-maxlength=' $re ' " : " " ) . ( preg_match ( '~char|binary~' , $o [ " type " ]) && $re > 20 ? " size='40' " : " " ) . " $Ja > " ;}}} function
process_input ( $o ){ global $b ; $u = bracket_escape ( $o [ " field " ]); $r = $_POST [ " function " ][ $u ]; $Y = $_POST [ " fields " ][ $u ]; if ( $o [ " type " ] == " enum " ){ if ( $Y ==- 1 ) return
2015-04-01 06:36:56 +00:00
false ; if ( $Y == " " ) return " NULL " ; return + $Y ;} if ( $o [ " auto_increment " ] && $Y == " " ) return
null ; if ( $r == " orig " ) return ( $o [ " on_update " ] == " CURRENT_TIMESTAMP " ? idf_escape ( $o [ " field " ]) : false ); if ( $r == " NULL " ) return " NULL " ; if ( $o [ " type " ] == " set " ) return
array_sum (( array ) $Y ); if ( $r == " json " ){ $r = " " ; $Y = json_decode ( $Y , true ); if ( ! is_array ( $Y )) return
2017-04-21 11:23:04 +00:00
false ; return $Y ;} if ( preg_match ( '~blob|bytea|raw|file~' , $o [ " type " ]) && ini_bool ( " file_uploads " )){ $Jc = get_file ( " fields- $u " ); if ( ! is_string ( $Jc )) return
2014-04-01 18:00:42 +00:00
false ; return
2017-04-21 11:23:04 +00:00
q ( $Jc );} return $b -> processInput ( $o , $Y , $r );} function
fields_from_edit (){ global $Xb ; $J = array (); foreach (( array ) $_POST [ " field_keys " ] as $y => $X ){ if ( $X != " " ){ $X = bracket_escape ( $X ); $_POST [ " function " ][ $X ] = $_POST [ " field_funs " ][ $y ]; $_POST [ " fields " ][ $X ] = $_POST [ " field_vals " ][ $y ];}} foreach (( array ) $_POST [ " fields " ] as $y => $X ){ $C = bracket_escape ( $y , 1 ); $J [ $C ] = array ( " field " => $C , " privileges " => array ( " insert " => 1 , " update " => 1 ), " null " => 1 , " auto_increment " => ( $y == $Xb -> primary ),);} return $J ;} function
search_tables (){ global $b , $g ; $_GET [ " where " ][ 0 ][ " op " ] = " LIKE %% " ; $_GET [ " where " ][ 0 ][ " val " ] = $_POST [ " query " ]; $Vc = false ; foreach ( table_status ( '' , true ) as $R => $S ){ $C = $b -> tableName ( $S ); if ( isset ( $S [ " Engine " ]) && $C != " " && ( ! $_POST [ " tables " ] || in_array ( $R , $_POST [ " tables " ]))){ $I = $g -> query ( " SELECT " . limit ( " 1 FROM " . table ( $R ), " WHERE " . implode ( " AND " , $b -> selectSearchProcess ( fields ( $R ), array ())), 1 )); if ( ! $I || $I -> fetch_row ()){ if ( ! $Vc ){ echo " <ul> \n " ; $Vc = true ;} echo " <li> " . ( $I ? " <a href=' " . h ( ME . " select= " . urlencode ( $R ) . " &where[0][op]= " . urlencode ( $_GET [ " where " ][ 0 ][ " op " ]) . " &where[0][val]= " . urlencode ( $_GET [ " where " ][ 0 ][ " val " ])) . " '> $C </a> \n " : " $C : <span class='error'> " . error () . " </span> \n " );}}} echo ( $Vc ? " </ul> " : " <p class='message'> " . lang ( 9 )) . " \n " ;} function
dump_headers ( $od , $Ae = false ){ global $b ; $J = $b -> dumpHeaders ( $od , $Ae ); $of = $_POST [ " output " ]; if ( $of != " text " ) header ( " Content-Disposition: attachment; filename= " . $b -> dumpFilename ( $od ) . " . $J " . ( $of != " file " &&! preg_match ( '~[^0-9a-z]~' , $of ) ? " . $of " : " " )); session_write_close (); ob_flush (); flush (); return $J ;} function
2014-04-01 18:00:42 +00:00
dump_csv ( $K ){ foreach ( $K
2017-04-21 11:23:04 +00:00
as $y => $X ){ if ( preg_match ( " ~[ \" \n ,; \t ]~ " , $X ) || $X === " " ) $K [ $y ] = '"' . str_replace ( '"' , '""' , $X ) . '"' ;} echo
2014-04-01 18:00:42 +00:00
implode (( $_POST [ " format " ] == " csv " ? " , " : ( $_POST [ " format " ] == " tsv " ? " \t " : " ; " )), $K ) . " \r \n " ;} function
2017-04-21 11:23:04 +00:00
apply_sql_function ( $r , $d ){ return ( $r ? ( $r == " unixepoch " ? " DATETIME( $d , ' $r ') " : ( $r == " count distinct " ? " COUNT(DISTINCT " : strtoupper ( " $r ( " )) . " $d ) " ) : $d );} function
get_temp_dir (){ $J = ini_get ( " upload_tmp_dir " ); if ( ! $J ){ if ( function_exists ( 'sys_get_temp_dir' )) $J = sys_get_temp_dir (); else { $Kc =@ tempnam ( " " , " " ); if ( ! $Kc ) return
false ; $J = dirname ( $Kc ); unlink ( $Kc );}} return $J ;} function
password_file ( $i ){ $Kc = get_temp_dir () . " /adminer.key " ; $J =@ file_get_contents ( $Kc ); if ( $J ||! $i ) return $J ; $Xc =@ fopen ( $Kc , " w " ); if ( $Xc ){ chmod ( $Kc , 0660 ); $J = rand_string (); fwrite ( $Xc , $J ); fclose ( $Xc );} return $J ;} function
2014-04-01 18:00:42 +00:00
rand_string (){ return
md5 ( uniqid ( mt_rand (), true ));} function
2017-04-21 11:23:04 +00:00
select_value ( $X , $_ , $o , $uh ){ global $b , $ba ; if ( is_array ( $X )){ $J = " " ; foreach ( $X
as $Kd => $W ) $J .= " <tr> " . ( $X != array_values ( $X ) ? " <th> " . h ( $Kd ) : " " ) . " <td> " . select_value ( $W , $_ , $o , $uh ); return " <table cellspacing='0'> $J </table> " ;} if ( ! $_ ) $_ = $b -> selectLink ( $X , $o ); if ( $_ === null ){ if ( is_mail ( $X )) $_ = " mailto: $X " ; if ( $Sf = is_url ( $X )) $_ = (( $Sf == " http " && $ba ) || preg_match ( '~WebKit|Firefox~i' , $_SERVER [ " HTTP_USER_AGENT " ]) ? $X : " https://www.adminer.org/redirect/?url= " . urlencode ( $X ));} $J = $b -> editVal ( $X , $o ); if ( $J !== null ){ if ( $J === " " ) $J = " " ; elseif ( ! is_utf8 ( $J )) $J = " \0 " ; elseif ( $uh != " " && is_shortable ( $o )) $J = shorten_utf8 ( $J , max ( 0 , + $uh )); else $J = h ( $J );} return $b -> selectVal ( $J , $_ , $o , $X );} function
is_mail ( $kc ){ $Ha = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]' ; $Wb = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; $Af = " $Ha +( \\ . $Ha +)*@( $Wb ? \\ .)+ $Wb " ; return
is_string ( $kc ) && preg_match ( " (^ $Af (, \\ s* $Af )* \$ )i " , $kc );} function
is_url ( $Q ){ $Wb = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; return ( preg_match ( " ~^(https?)://( $Wb ? \\ .)+ $Wb (: \\ d+)?(/.*)?( \\ ?.*)?(#.*)? \$ ~i " , $Q , $B ) ? strtolower ( $B [ 1 ]) : " " );} function
2015-04-01 06:36:56 +00:00
is_shortable ( $o ){ return
2017-04-21 11:23:04 +00:00
preg_match ( '~char|text|lob|geometry|point|linestring|polygon|string|bytea~' , $o [ " type " ]);} function
count_rows ( $R , $Z , $Ed , $cd ){ global $x ; $H = " FROM " . table ( $R ) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " ); return ( $Ed && ( $x == " sql " || count ( $cd ) == 1 ) ? " SELECT COUNT(DISTINCT " . implode ( " , " , $cd ) . " ) $H " : " SELECT COUNT(*) " . ( $Ed ? " FROM (SELECT 1 $H $dd ) x " : $H ));} function
slow_query ( $H ){ global $b , $Dh ; $m = $b -> database (); $wh = $b -> queryTimeout (); if ( support ( " kill " ) && is_object ( $h = connect ()) && ( $m == " " || $h -> select_db ( $m ))){ $Pd = $h -> result ( connection_id ()); echo ' < script type = " text/javascript " >
2014-04-01 18:00:42 +00:00
var timeout = setTimeout ( function () {
ajax ( \ '' , js_escape ( ME ), ' script = kill\ ' , function () {
2017-04-21 11:23:04 +00:00
}, \ 'token=' , $Dh , '&kill=' , $Pd , ' \ ' );
}, ',1000*$wh,' );
2014-04-01 18:00:42 +00:00
</ script >
2017-04-21 11:23:04 +00:00
';}else$h=null;ob_flush();flush();$J=@get_key_vals($H,$h,$wh);if($h){echo"<script type=' text / javascript ' > clearTimeout ( timeout ); </ script > \n " ;ob_flush();flush();}return
2014-04-01 18:00:42 +00:00
array_keys ( $J );} function
2017-04-21 11:23:04 +00:00
get_token (){ $Xf = rand ( 1 , 1e6 ); return ( $Xf ^ $_SESSION [ " token " ]) . " : $Xf " ;} function
verify_token (){ list ( $Dh , $Xf ) = explode ( " : " , $_POST [ " token " ]); return ( $Xf ^ $_SESSION [ " token " ]) == $Dh ;} function
lzw_decompress ( $Ra ){ $Sb = 256 ; $Sa = 8 ; $kb = array (); $lg = 0 ; $mg = 0 ; for ( $s = 0 ; $s < strlen ( $Ra ); $s ++ ){ $lg = ( $lg << 8 ) + ord ( $Ra [ $s ]); $mg += 8 ; if ( $mg >= $Sa ){ $mg -= $Sa ; $kb [] = $lg >> $mg ; $lg &= ( 1 << $mg ) - 1 ; $Sb ++ ; if ( $Sb >> $Sa ) $Sa ++ ;}} $Rb = range ( " \0 " , " \xFF " ); $J = " " ; foreach ( $kb
as $s => $jb ){ $jc = $Rb [ $jb ]; if ( ! isset ( $jc )) $jc = $ti . $ti [ 0 ]; $J .= $jc ; if ( $s ) $Rb [] = $ti . $jc [ 0 ]; $ti = $jc ;} return $J ;} function
on_help ( $qb , $Kg = 0 ){ return " onmouseover='helpMouseover(this, event, " . h ( $qb ) . " , $Kg );' onmouseout='helpMouseout(this, event);' " ;} function
edit_form ( $a , $p , $K , $Zh ){ global $b , $x , $Dh , $n ; $gh = $b -> tableName ( table_status1 ( $a , true )); page_header (( $Zh ? lang ( 10 ) : lang ( 11 )), $n , array ( " select " => array ( $a , $gh )), $gh ); if ( $K === false ) echo " <p class='error'> " . lang ( 12 ) . " \n " ; echo ' < form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
2015-04-01 06:36:56 +00:00
';if(!$p)echo"<p class=' error '>".lang(13)."\n";else{echo"<table cellspacing=' 0 ' onkeydown=' return editingKeydown ( event ); ' > \n " ;foreach( $p
2017-04-21 11:23:04 +00:00
as $C => $o ){ echo " <tr><th> " . $b -> fieldName ( $o ); $Mb = $_GET [ " set " ][ bracket_escape ( $C )]; if ( $Mb === null ){ $Mb = $o [ " default " ]; if ( $o [ " type " ] == " bit " && preg_match ( " ~^b'([01]*)' \$ ~ " , $Mb , $gg )) $Mb = $gg [ 1 ];} $Y = ( $K !== null ? ( $K [ $C ] != " " && $x == " sql " && preg_match ( " ~enum|set~ " , $o [ " type " ]) ? ( is_array ( $K [ $C ]) ? array_sum ( $K [ $C ]) :+ $K [ $C ]) : $K [ $C ]) : ( ! $Zh && $o [ " auto_increment " ] ? " " : ( isset ( $_GET [ " select " ]) ? false : $Mb ))); if ( ! $_POST [ " save " ] && is_string ( $Y )) $Y = $b -> editVal ( $Y , $o ); $r = ( $_POST [ " save " ] ? ( string ) $_POST [ " function " ][ $C ] : ( $Zh && $o [ " on_update " ] == " CURRENT_TIMESTAMP " ? " now " : ( $Y === false ? null : ( $Y !== null ? '' : 'NULL' )))); if ( preg_match ( " ~time~ " , $o [ " type " ]) && $Y == " CURRENT_TIMESTAMP " ){ $Y = " " ; $r = " now " ;} input ( $o , $Y , $r ); echo " \n " ;} if ( ! support ( " table " )) echo " <tr> " . " <th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''> " . " <td class='function'> " . html_select ( " field_funs[] " , $b -> editFunctions ( array ( " null " => isset ( $_GET [ " select " ])))) . " <td><input name='field_vals[]'> " . " \n " ; echo " </table> \n " ;} echo " <p> \n " ; if ( $p ){ echo " <input type='submit' value=' " . lang ( 14 ) . " '> \n " ; if ( ! isset ( $_GET [ " select " ])) echo " <input type='submit' name='insert' value=' " . ( $Zh ? lang ( 15 ) . " ' onclick='return !ajaxForm(this.form, \" " . lang ( 16 ) . '...", this)' : lang ( 17 )) . " ' title='Ctrl+Shift+Enter'> \n " ;} echo ( $Zh ? " <input type='submit' name='delete' value=' " . lang ( 18 ) . " ' " . confirm () . " > \n " : ( $_POST ||! $p ? " " : " <script type='text/javascript'>focus(document.getElementById('form').getElementsByTagName('td')[1].firstChild);</script> \n " )); 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 " ]), ' " >
2015-04-01 06:36:56 +00:00
< input type = " hidden " name = " save " value = " 1 " >
2017-04-21 11:23:04 +00:00
< input type = " hidden " name = " token " value = " ', $Dh ,' " >
2015-04-01 06:36:56 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}global$b,$g,$Yb,$gc,$qc,$n,$Zc,$ed,$ba,$yd,$x,$ca,$Ud,$Te,$Bf,$Yg,$id,$Dh,$Ih,$Rh,$Yh,$ia;if(!$_SERVER["REQUEST_URI"])$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"];if(!strpos($_SERVER["REQUEST_URI"],' ? ')&&$_SERVER["QUERY_STRING"]!="")$_SERVER["REQUEST_URI"].="?$_SERVER[QUERY_STRING]";$ba=$_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off");@ini_set("session.use_trans_sid",false);session_cache_limiter("");if(!defined("SID")){session_name("adminer_sid");$F=array(0,preg_replace(' ~ \\ ? .*~ ',' ',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,' 5.2 . 0 ')>=0)$F[]=true;call_user_func_array(' session_set_cookie_params ',$F);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Lc);if(get_magic_quotes_runtime())set_magic_quotes_runtime(false);@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",20);$Ud=array(' en '=>' English ',' ar '=>' العربية ',' bg '=>' Български ',' bn '=>' বাংলা ',' bs '=>' Bosanski ',' ca '=>' Català ',' cs '=>' Čeština ',' da '=>' Dansk ',' de '=>' Deutsch ',' el '=>' Ελληνικά ',' es '=>' Español ',' et '=>' Eesti ',' fa '=>' فارسی ',' fi '=>' Suomi ',' fr '=>' Français ',' gl '=>' Galego ',' hu '=>' Magyar ',' id '=>' Bahasa Indonesia ',' it '=>' Italiano ',' ja '=>' 日本語 ',' ko '=>' 한국어 ',' lt '=>' Lietuvių ',' nl '=>' Nederlands ',' no '=>' Norsk ',' pl '=>' Polski ',' pt '=>' Português ',' pt - br '=>' Português ( Brazil ) ',' ro '=>' Limba Română ',' ru '=>' Русский ',' sk '=>' Slovenčina ',' sl '=>' Slovenski ',' sr '=>' Српски ',' ta '=>' தமிழ் ',' th '=>' ภาษาไทย ',' tr '=>' Türkçe ',' uk '=>' Українська ',' vi '=>' Tiếng Việt ',' zh '=>' 简体中文 ',' zh - tw '=>' 繁體中文 ' ,); function
2014-04-01 18:00:42 +00:00
get_lang (){ global $ca ; return $ca ;} function
2017-04-21 11:23:04 +00:00
lang ( $u , $Ke = null ){ if ( is_string ( $u )){ $Ef = array_search ( $u , get_translations ( " en " )); if ( $Ef !== false ) $u = $Ef ;} global $ca , $Ih ; $Hh = ( $Ih [ $u ] ? $Ih [ $u ] : $u ); if ( is_array ( $Hh )){ $Ef = ( $Ke == 1 ? 0 : ( $ca == 'cs' || $ca == 'sk' ? ( $Ke && $Ke < 5 ? 1 : 2 ) : ( $ca == 'fr' ? ( ! $Ke ? 0 : 1 ) : ( $ca == 'pl' ? ( $Ke % 10 > 1 && $Ke % 10 < 5 && $Ke / 10 % 10 != 1 ? 1 : 2 ) : ( $ca == 'sl' ? ( $Ke % 100 == 1 ? 0 : ( $Ke % 100 == 2 ? 1 : ( $Ke % 100 == 3 || $Ke % 100 == 4 ? 2 : 3 ))) : ( $ca == 'lt' ? ( $Ke % 10 == 1 && $Ke % 100 != 11 ? 0 : ( $Ke % 10 > 1 && $Ke / 10 % 10 != 1 ? 1 : 2 )) : ( $ca == 'bs' || $ca == 'ru' || $ca == 'sr' || $ca == 'uk' ? ( $Ke % 10 == 1 && $Ke % 100 != 11 ? 0 : ( $Ke % 10 > 1 && $Ke % 10 < 5 && $Ke / 10 % 10 != 1 ? 1 : 2 )) : 1 ))))))); $Hh = $Hh [ $Ef ];} $Ea = func_get_args (); array_shift ( $Ea ); $Uc = str_replace ( " %d " , " %s " , $Hh ); if ( $Uc != $Hh ) $Ea [ 0 ] = format_number ( $Ke ); return
vsprintf ( $Uc , $Ea );} function
switch_lang (){ global $ca , $Ud ; echo " <form action='' method='post'> \n <div id='lang'> " , lang ( 19 ) . " : " . html_select ( " lang " , $Ud , $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 ( $Ud [ $_COOKIE [ " adminer_lang " ]])){ cookie ( " adminer_lang " , $_COOKIE [ " adminer_lang " ]); $ca = $_COOKIE [ " adminer_lang " ];} elseif ( isset ( $Ud [ $_SESSION [ " lang " ]])) $ca = $_SESSION [ " lang " ]; else { $ua = array (); preg_match_all ( '~([-a-z]+)(;q=([0-9.]+))?~' , str_replace ( " _ " , " - " , strtolower ( $_SERVER [ " HTTP_ACCEPT_LANGUAGE " ])), $ke , PREG_SET_ORDER ); foreach ( $ke
2014-04-01 18:00:42 +00:00
as $B ) $ua [ $B [ 1 ]] = ( isset ( $B [ 3 ]) ? $B [ 3 ] : 1 ); arsort ( $ua ); foreach ( $ua
2017-04-21 11:23:04 +00:00
as $y => $Tf ){ if ( isset ( $Ud [ $y ])){ $ca = $y ; break ;} $y = preg_replace ( '~-.*~' , '' , $y ); if ( ! isset ( $ua [ $y ]) && isset ( $Ud [ $y ])){ $ca = $y ; break ;}}} $Ih = $_SESSION [ " translations " ]; if ( $_SESSION [ " translations_version " ] != 1854356247 ){ $Ih = array (); $_SESSION [ " translations_version " ] = 1854356247 ;} function
get_translations ( $Td ){ switch ( $Td ){ case " en " : $f = " 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> <EFBFBD> <EFBFBD> <EFBFBD> <0E> Ak<41> <6B> <EFBFBD> <06> }<7D> <> e<EFBFBD> <65> AD<41> <44> <EFBFBD> <EFBFBD> a<EFBFBD> į<EFBFBD> <C4AF> <EFBFBD> \\ <EFBFBD> }<7D> <> 5<EFBFBD> #|@<40> h<EFBFBD> 3<> <33> N<EFBFBD> }@<40> <> i<EFBFBD> <03> <18> t<EFBFBD> <1B> <> ><3E> <> .y8Rm<52> <6D> <15> <> \" 3<EFBFBD> z<> <7A> #kN!-c 䲉<> (<28> ;<3B> <> X #<23> <> |<0C> ,<2C> bz<62> <7A> ʢ<> <CAA2> <0B> 9><3E> <> ) :<3A> <> <EFBFBD> C \0 .#<13> Ӊ<EFBFBD> z<EFBFBD> 7:<3A> <> <EFBFBD> ތ<EFBFBD> <DE8C> @<40> F<EFBFBD> Px<50> <78> <08> <1E> C@<40> :<03> t<17> 㼤 \$ jֿ<05> 8<EFBFBD> Dz<> <C7B2> <1E> o(<28> <17> M<08> ʎ<EFBFBD> @<40> <> 7<EFBFBD> XD + / 6<01> ^0<> <30> <EFBFBD> }<0B> |<08> <0E> <> <EFBFBD> (<28> L<EFBFBD> H<EFBFBD> <0C> <1A> ͮ-D<> ;<3B> <> <EFBFBD> <EFBFBD> E!-8<> 63<36> <33> @Ɍ<> <C98C> K<> -\n ,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <04> <08> <<3C> <> MR Ul<55> <6C> !<21> <> b_ \n <EFBFBD> <EFBFBD> OZ\r <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> 1<EFBFBD> 5<EFBFBD> ^2<> <32> <08> LSc\r lӊtE è<> ELO<4C> <4F> 3<EFBFBD> <33> <08> <> LQ 1<> \0 Sz<<3C> <> <02> ,<2C> <> Ȥ<EFBFBD> q<EFBFBD> <71> <EFBFBD> 9ikl*8<> <38> z3<7A> <33> <EFBFBD> <EFBFBD> <EFBFBD> ږX<DA96> Q'<03> <> @<40> W<EFBFBD> <1A> <> <EFBFBD> <03> MO<4D> <0F> <18> <> x<EFBFBD> C<EFBFBD> <<11> !<21> 0 \n r,# ^<5E> c<0E> 9<EFBFBD> <39> <EFBFBD> <EFBFBD> (<28> N#<23> <> <08> <> d<EFBFBD> <64> <EFBFBD> ;<3B> 4<EFBFBD> <34> d<EFBFBD> <64> y&<<3C> <> <EFBFBD> <EFBFBD> 1 1 4<14> <0C> 0<EFBFBD> +<2B> <11> <EFBFBD> \" <EFBFBD> ލGcp<EFBFBD> <EFBFBD> 9<EFBFBD> c5<EFBFBD> <1F> <> \0 X<EFBFBD> <EFBFBD> i<15> <> <EFBFBD> <EFBFBD> r~<7E> <> <EFBFBD> u<EFBFBD> с :<3A> <> s<EFBFBD> <73> @ǯ<> ;<1C> <> m ۠0<DBA0> <30> e_<65> <5F> l2<6C> ;Y<> JB!<21> b<EFBFBD> <62> ˍ<EFBFBD> \\ z<16> |<7C> <> C2Θpk^<5E> j<> ><3E> <> <EFBFBD> <EFBFBD> e<0F> LOX<4F> 4<EFBFBD> #&Ύ<> <CE8E> <EFBFBD> <EFBFBD> <1B> \\ ܔ%P<> 48EQbB<62> <42> <EFBFBD> <EFBFBD> 1!<21> R4<52> %I<> t<EFBFBD> )<0E> <> ɸ<EFBFBD> Թ1<D4B9> <31> <04> 2L<32> D<EFBFBD> 6 \r <EFBFBD> t<EFBFBD> 9,1<> <31> ;O<13> A>Oܧ<4F> 0<EFBFBD> <30> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> - L8f<38> j\\ TU<EFBFBD> <EFBFBD> \" <EFBFBD> <EFBFBD> 2<12> <02> O#\0 -<2D> <1D> .x<1F> <> &<26> <> (<04> <> z<EFBFBD> <1B> /<2F> <> \0 RH<EFBFBD> \" q<EFBFBD> <EFBFBD> <EFBFBD> <12> <16> Mk<4D> |<7C> <> g bTK q0nA<6E> <41> <EFBFBD> <EFBFBD> <1C> <> <EFBFBD> \$ <EFBFBD> 2 ➼I<E29EBC> 5s Uڝ<55> ֱ\" ) =<05> <> B ]<5D> K)<29> <> ͙<EFBFBD> |@C<> <43> <EFBFBD> <01> <> <EFBFBD> \0 <EFBFBD> <EFBFBD> Һ<EFBFBD> s<EFBFBD> <EFBFBD> 1<EFBFBD> <EFBFBD> <EFBFBD> w<EFBFBD> <03> 2<EFBFBD> <32> <EFBFBD> +<02> xS\n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> MT<EFBFBD> <EFBFBD> (̢<06> <> <EFBFBD> <EFBFBD> c< ( ,גS<D792> <1C> <03> .<2E> l<18> P<EFBFBD> XY<58> 3\$ x<EFBFBD> (<28> <19> <> \n &<26> ɒ0<C992> <20> 7<> <37> v<EFBFBD> \" I H: \" K P<> <50> R<EFBFBD> ۜ<EFBFBD> F<> <46> H<EFBFBD> p<13> p \n <EFBFBD> @\" <10> @T<> \" <EFBFBD> <EFBFBD> <EFBFBD> /<2F> <> <EFBFBD> V<EFBFBD> 0<> <30> <EFBFBD> <EFBFBD> <EFBFBD> j >ȝ /<2F> <> <13> <1A> S<EFBFBD> <53> (<28> RR<1B> Q<1C> 樣<EFBFBD> tq<1D> l<EFBFBD> 4𝧒 |<7C> <> B0e&XŚ<58> <C59A> <EFBFBD> c<EFBFBD> <63> <EFBFBD> <10> U<16> <19> <> gQ<67> <18> <> <EFBFBD> `<60> <> ?C`(+ <20> X<EFBFBD> ϡ<EFBFBD> 3<EFBFBD> Gr: X9<58> `\r <11> <> t<EFBFBD> <74> <EFBFBD> <EFBFBD> <0E> <> 4AH-<1E> <> ( - RBu<42> <75> +<2B> <> p<EFBFBD> <70> Ui-hҸ4TD<54> +<2B> ,<1B> <> Q&u I<> ^<5E> s<EFBFBD> <73> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> x<> KC<4B> 'd<> N)<29> <> T<> \n \n <EFBFBD> <EFBFBD> <EFBFBD> .<2E> <> ~<7E> <01> -ux<75> 2\n <1C> <> ZAI<41> <49> <17> <> M<EFBFBD> l<EFBFBD> ƭ<16> <> <EFBFBD> { h-&U t<> <11> O|3 `<60> <02> <11> <> <EFBFBD> <EFBFBD> <EFBFBD> Q+<2B> @<40> cM<63> <4D> e<0C> ڳ<EFBFBD> [<5B> <> T ! \$ <08> _<EFBFBD> <5F> >ig<0C> A<15> ? (r0q<30> <71> Y<EFBFBD> C /<16> <> E\\ HL<19> ADٶ<44> <D9B6> <EFBFBD> [<5B> ! <09> -<2D> <> <EFBFBD> rH<72> mC<6D> @&<26> <17> <> o<EFBFBD> <1D> <0E> ۃ h<> J<EFBFBD> <4A> <EFBFBD> <05> 5<EFBFBD> z<EFBFBD> <7A> <EFBFBD> s% \n <EFBFBD> <EFBFBD> \\ <EFBFBD> <EFBFBD> tj%<25> `<60> <> <EFBFBD> <EFBFBD> { hO]<5D> <> 7<0C> <> z<EFBFBD> <7A> <EFBFBD> <EFBFBD> M<EFBFBD> 'Т <13> 9% u<> W<> <57> <EFBFBD> <EFBFBD> F]ؔ (r<> <72> <EFBFBD> 0<15> (b<> <62> <EFBFBD> M<EFBFBD> <4D> *<2A> <> !E5 d8@<40> <> _<EFBFBD> Z<EFBFBD> 0<EFBFBD> x6 \\ <EFBFBD> TYϠHCe<EFBFBD> <EFBFBD> <EFBFBD> 3<EFBFBD> <EFBFBD> <0B> x&%<25> \$ <EFBFBD> <EFBFBD> `b<> <62> <EFBFBD> m˼<6D> <CBBC> <EFBFBD> jXLQ׀ 3<D780> <33> (<28> }<7D> <> 8<> m<EFBFBD> <6D> <17> <> \r A<> !<21> | I<> ~`-jTyK%<25> 3?*<2A> [<5B> X<EFBFBD> <58> <EFBFBD> <<3C> <> I<EFBFBD> <49> ,<07> +<2B> u<EFBFBD> <75> <EFBFBD> mJ<6D> H<EFBFBD> <48> <EFBFBD> <EFBFBD> Z<EFBFBD> '<27> g<EFBFBD> Zs3 E\r Y<EFBFBD> н<EFBFBD> B}=H dY<64> ,<2C> R<EFBFBD> <15> <> <EFBFBD> *<2A> 6<EFBFBD> <36> PEϑ<45> %<25> h<EFBFBD> z \n v3 T<> y^~O*<03> 3!<01> <> gS;mC> \" B Ք Wd-<14> ^1<> hI [j)<29> <1B> <> Yh57Tk<54> c<EFBFBD> <63> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> E<EFBFBD> <45> <EFBFBD> <10> ŋX)_b<5F> pMn<4D> <6E> R<01> <> <EFBFBD> <EFBFBD> <14> d<0C> rD<72> m<EFBFBD> ߶<EFBFBD> <DFB6> f<EFBFBD> Yf<59> <1A> ,v<> <76> <EFBFBD> `<60> <> <10> , +[<5B> { 7 \\ <EFBFBD> <EFBFBD> ]<5D> <> <EFBFBD> <EFBFBD> <EFBFBD> 9<EFBFBD> <39> <EFBFBD> <EFBFBD> <EFBFBD> BW<42> <57> @<40> <> HM)<06> <> M<EFBFBD> <<3C> 1\$ \r #<23> d?-<2D> <> B #\0 M[m<> <6D> { <EFBFBD> =<3D> -<15> <> 7<EFBFBD> g-x&<26> <> Z<EFBFBD> )<29> =\r <EFBFBD> ]<5D> <> +<2B> [L<> 5<18> v>bϒ <62> <CF92> <EFBFBD> 9[<5B> ʰ<EFBFBD> 7<37> <DEB8> ]N<> <<3C> <> <EFBFBD> _G<5F> { g<> 57<35> ٥ <EFBFBD> <D9A5> Z<EFBFBD> *<2A> L<EFBFBD> c<EFBFBD> 7 ߖ<> <DF96> u<<3C> J+\n <EFBFBD> <0C> j<EFBFBD> 2.<2E> <> <EFBFBD> <EFBFBD> \n /!<14> u<EFBFBD> <75> 0c%?9.<2E> Ȕ<EFBFBD> U<EFBFBD> <55> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> `<60> <> <EFBFBD> <EFBFBD> <EFBFBD> S<> <1D> ,<2C> @<40> T<> =<3D> <> -e<> <65> <<3C> <> \r <EFBFBD> <EFBFBD> 2)^<5E> <> <EFBFBD> ק>|<7C> y<EFBFBD> 9磸t!-<2D> <> -\0 <EFBFBD> g<EFBFBD> wN<EFBFBD> <EFBFBD> <1F> p<EFBFBD> #<23> <> <0F> <> /l<> '<27> %O<> <4F> <EFBFBD> <04> <> 괮<EFBFBD> <EAB4AE> P<EFBFBD> <50> #<23> <> _~<7E> }o<> <6F> !R<> Wϓ<57> k<EFBFBD> { ><3E> 'FFϫ<46> <CFAB> <EFBFBD> <EFBFBD> <EFBFBD> \0 <EFBFBD> }<7D> H<EFBFBD> 8-z<> <7A> <EFBFBD> *<12> O<EFBFBD> \r <EFBFBD> %<25> <> <EFBFBD> <EFBFBD> }<7D> |J<02> <> <EFBFBD> <EFBFBD> 8<EFBFBD> <04> <> <\\ <EFBFBD> <EFBFBD> <EFBFBD> <08> <10> (<28> <0E> *4<> ^<5E> <> P<EFBFBD> `<60> \$ <EFBFBD> .<2E> <> <EFBFBD> <01> <> <EFBFBD> <EFBFBD> L˰ ܬ<> <DCAC> ö<EFBFBD> <C3B6> <EFBFBD> #\" <EFBFBD> -<2D> <> R:<3A> 6./T<> <20> ⢢c<E2A2A2> U<EFBFBD> N<EFBFBD> <4E> xۍԻP% l<> <6C> .<2E> M<EFBFBD> <4D> <EFBFBD> <EFBFBD> \r <EFBFBD> V<EFBFBD> <EFBFBD> 0\r nH \$ l<EFBFBD> #<06> O<EFBFBD> <4F> ƶ/<03> ' >?<3F> ڗ@<40> <08> Z<02> Z<EFBFBD> <5A> >Kƺΐ<C6BA> <CE90> Z<EFBFBD> Po<0B> t<EFBFBD> <74> } +N<> \" &<26> #0h<30> <68> <EFBFBD> <EFBFBD> z4<7A> <34> P<> <50> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 6<EFBFBD> <36> <EFBFBD> #h.⚰P<E29AB0> 3 <09> .<2E> <> <EFBFBD> <EFBFBD> A<08> P<EFBFBD> <50> <EFBFBD> b<> <62> <EFBFBD> @71 n Z<> ]%j B ! 0<> B<EFBFBD> <42> 0̟ \$ Z<EFBFBD> d<EFBFBD> \n !<13> <12> <> <EFBFBD> 1<EFBFBD> Χ qLˣ \\ u<EFBFBD> <EFBFBD> <15> &̎<> <CC8E> <0C> <02> >m̀@<40> { qJ<71> J<EFBFBD> <4A> 'j<> \n J<EFBFBD> ><3E> fh̓<68> <CD83> <EFBFBD> F <09> <> \\ <EFBFBD> \0 A<19> 2 \\ <EFBFBD> <EFBFBD> \0 <EFBFBD> #N<> t<> <74> <EFBFBD> %邛\$ <EFBFBD> 'e>-<2D> <> <1C> <> <\0 <EFBFBD> BJ,p<> <70> O,@)<29> <1A> <> (<28> q<EFBFBD> <71> <20> ,<2C> <> <EFBFBD> J\" d<EFBFBD> :<3A> <> <EFBFBD> )<29> Բ .<2E> <> h<0C> ZGbL<62> h<EFBFBD> *K<> !R \r <EFBFBD> <EFBFBD> <14> <> !<21> \\ " ; break ; case " ar " : $f = " <EFBFBD> C<EFBFBD> P<EFBFBD> <> <C28D> l*<2A> \r <EFBFBD> ,&\n <EFBFBD> A<EFBFBD> <15> <> <EFBFBD> (J.<19> <> 0Se\\ <EFBFBD> \r <EFBFBD> <EFBFBD> b<> @<40> 0<> ,\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> )<29> <> &<26> <<3C> q)<29> <> <20> <> F>ء<> Ps7X<37> 5g5<67> K<EFBFBD> K<EFBFBD> ¦<EFBFBD> <C2A6> <EFBFBD> <EFBFBD> <EFBFBD> 0ʇƢ<CA87> <C6A2> \n S <20> <> r \$ <EFBFBD> <10> j<> (<28> <> v<EFBFBD> <76> <EFBFBD> <0E> !Jb<4A> <62> <EFBFBD> <EFBFBD> q<02> <> 0\n <EFBFBD> <EFBFBD> j\n <EFBFBD> <10> <> <EFBFBD> <0C> <> j<EFBFBD> <6A> @<40> z<18> l<\$ W<EFBFBD> <EFBFBD> rؓ<EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <1A> U&<26> [<1A> *<2A> <> l<08> ꎠ(B&<26> <> <EFBFBD> <EFBFBD> <04> 4_ !<05> <1A> <> d \\ B<EFBFBD> <EFBFBD> =<3D> t[<17> <09> <> ?<3F> :<3A> X<EFBFBD> <58> ؐ<> eJ \$ <EFBFBD> <EFBFBD> <EFBFBD> \n &<26> 3ޜ:<3A> <> <EFBFBD> <03> <> <EFBFBD> <14> O<EFBFBD> K<EFBFBD> <4B> Ь <16> J<EFBFBD> \0 x0<EFBFBD> #<23> <> 3<07> <10> :<0E> <> <EFBFBD> <05> x<EFBFBD> Q<EFBFBD> <51> <08> 6<EFBFBD> c(<28> \r <EFBFBD> <EFBFBD> <EFBFBD> <17> <> u`<7cp<63> 4<EFBFBD> <34> <EFBFBD> D<EFBFBD> 5p<35> :S\" <EFBFBD> <EFBFBD> 0<EFBFBD> <EFBFBD> XD #h<> <EFBFBD> <D78D> <EFBFBD> <05> |<7C> <> vkz7<7A> <37> <EFBFBD> l9<6C> <39> <EFBFBD> <EFBFBD> &\r -ڞ<> <DA9E> &<26> m I \n <EFBFBD> <EFBFBD> <EFBFBD> H =<3D> s<EFBFBD> <73> 2NA<4E> <41> D<EFBFBD> <44> <EFBFBD> <EFBFBD> \n r \\ <EFBFBD> <EFBFBD> eE]\r <12> Lij<69> &<26> <> \$ <EFBFBD> [2B<32> <42> ݯ<EFBFBD> Z<EFBFBD> ƒ<EFBFBD> Q ?i<> <69> A_Ŗ<1E> !)t<> *<2A> <> P<EFBFBD> K<EFBFBD> #<23> <> :<03> <> 6<0E> +<2B> /s<> I<1A> <> <EFBFBD> <EFBFBD> ' j>\\ <EFBFBD> <EFBFBD> <EFBFBD> lU<EFBFBD> H<EFBFBD> <EFBFBD> E*<2A> <> <EFBFBD> \\ <EFBFBD> <EFBFBD> <EFBFBD> ><3E> f<EFBFBD> d<EFBFBD> Ax<41> o<EFBFBD> ͈Ak<1A> <> M<EFBFBD> <4D> <EFBFBD> B6T6W<36> J9<4A> v\$ DIͼ&-HqZ<71> 8<EFBFBD> 0<> H^G:Mn<4D> <6E> <EFBFBD> OhN<68> |<7C> 3\$ \n l<16> CƼ ̊a q%<25> <> <EFBFBD> <EFBFBD> (Z<> o<> <1E> uώ<75> ]Z<> ٵ<EFBFBD> <D9B5> <EFBFBD> <16> `<60> <> nl<<3C> ;ο <> t<> <74> o<EFBFBD> <6F> <EFBFBD> <<3C> 7l0<6C> <30> V<> <56> F<EFBFBD> <46> <EFBFBD> 6 L<> A^<5E> <> x<EFBFBD> 3 \r <EFBFBD> K\n <EFBFBD> +Wө Mɸ *\r <EFBFBD> @<40> b !\0 <EFBFBD> [<0E> <18> <> c6T\r <EFBFBD> x<EFBFBD> <EFBFBD> <EFBFBD> ach9{ <EFBFBD> <08> 0<EFBFBD> a<07> <12> 5@<40> :<3A> a@<40> \n Jy'!<21> <> 0<> <14> 1 *<2A> |<7C> <> C<EFBFBD> +Arl!<21> <> \0 <EFBFBD> <EFBFBD> <EFBFBD> { ˊ <EFBFBD> Dl<EFBFBD> <EFBFBD> <EFBFBD> t֛[<5B> 1z<31> <> <10> \\ *<2A> <> hu;<3B> <> <EFBFBD> [ <20> <> !<05> C<EFBFBD> <43> PR<50> <52> <11> \\ C9e<EFBFBD> K<EFBFBD> F)н= \n J \n <EFBFBD> `d<> &<26> <10> nÑ<6E> <C391> <EFBFBD> <EFBFBD> ;<3B> ղ C<> p\r *X2A &<26> T<EFBFBD> <54> SjuO<75> F<1D> *<2A> U*<2A> V<EFBFBD> <56> b<EFBFBD> ժ<EFBFBD> W <20> ]<5D> |<7C> <12> \r <EFBFBD> c,<2C> <> <EFBFBD> r<> ZKP -`ж ԅ !<21> Ү R<> <52> <EFBFBD> nYˌ<59> <CB8C> *JO<4A> <4F> 1<EFBFBD> i
2014-04-01 18:00:42 +00:00
Min_PDO
extends
PDO { var $_result , $server_info , $affected_rows , $errno , $error ; function
2017-04-21 11:23:04 +00:00
__construct (){ global $b ; $Ef = array_search ( " SQL " , $b -> operators ); if ( $Ef !== false ) unset ( $b -> operators [ $Ef ]);} function
dsn ( $dc , $V , $G ){ try { parent :: __construct ( $dc , $V , $G );} catch ( Exception $vc ){ auth_error ( h ( $vc -> getMessage ()));} $this -> setAttribute ( 13 , array ( 'Min_PDOStatement' )); $this -> server_info =@ $this -> getAttribute ( 4 );} function
query ( $H , $Sh = false ){ $I = parent :: query ( $H ); $this -> error = " " ; if ( ! $I ){ list (, $this -> errno , $this -> error ) = $this -> errorInfo (); return
2014-04-01 18:00:42 +00:00
false ;} $this -> store_result ( $I ); return $I ;} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result ( $I = null ){ if ( ! $I ){ $I = $this -> _result ; if ( ! $I ) return
false ;} if ( $I -> columnCount ()){ $I -> num_rows = $I -> rowCount (); return $I ;} $this -> affected_rows = $I -> rowCount (); return
true ;} function
next_result (){ if ( ! $this -> _result ) return
false ; $this -> _result -> _offset = 0 ; return @ $this -> _result -> nextRowset ();} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! $I ) return
false ; $K = $I -> fetch (); return $K [ $o ];}} class
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
fetch_field (){ $K = ( object ) $this -> getColumnMeta ( $this -> _offset ++ ); $K -> orgtable = $K -> table ; $K -> orgname = $K -> name ; $K -> charsetnr = ( in_array ( " blob " ,( array ) $K -> flags ) ? 63 : 0 ); return $K ;}}} $Yb = array (); class
2014-04-01 18:00:42 +00:00
Min_SQL { var $_conn ; function
2017-04-21 11:23:04 +00:00
__construct ( $g ){ $this -> _conn = $g ;} function
select ( $R , $M , $Z , $cd , $df = array (), $z = 1 , $E = 0 , $Mf = false ){ global $b , $x ; $Ed = ( count ( $cd ) < count ( $M )); $H = $b -> selectQueryBuild ( $M , $Z , $cd , $df , $z , $E ); if ( ! $H ) $H = " SELECT " . limit (( $_GET [ " page " ] != " last " &&+ $z && $cd && $Ed && $x == " sql " ? " SQL_CALC_FOUND_ROWS " : " " ) . implode ( " , " , $M ) . " \n FROM " . table ( $R ),( $Z ? " \n WHERE " . implode ( " AND " , $Z ) : " " ) . ( $cd && $Ed ? " \n GROUP BY " . implode ( " , " , $cd ) : " " ) . ( $df ? " \n ORDER BY " . implode ( " , " , $df ) : " " ),( $z != " " ? + $z : null ),( $E ? $z * $E : 0 ), " \n " ); $Vg = microtime ( true ); $J = $this -> _conn -> query ( $H ); if ( $Mf ) echo $b -> selectQuery ( $H , format_time ( $Vg )); return $J ;} function
delete ( $R , $Vf , $z = 0 ){ $H = " FROM " . table ( $R ); return
queries ( " DELETE " . ( $z ? limit1 ( $H , $Vf ) : " $H $Vf " ));} function
update ( $R , $O , $Vf , $z = 0 , $Dg = " \n " ){ $ji = array (); foreach ( $O
as $y => $X ) $ji [] = " $y = $X " ; $H = table ( $R ) . " SET $Dg " . implode ( " , $Dg " , $ji ); return
queries ( " UPDATE " . ( $z ? limit1 ( $H , $Vf ) : " $H $Vf " ));} function
insert ( $R , $O ){ return
queries ( " INSERT INTO " . table ( $R ) . ( $O ? " ( " . implode ( " , " , array_keys ( $O )) . " ) \n VALUES ( " . implode ( " , " , $O ) . " ) " : " DEFAULT VALUES " ));} function
insertUpdate ( $R , $L , $Kf ){ return
2014-04-01 18:00:42 +00:00
false ;} function
begin (){ return
queries ( " BEGIN " );} function
commit (){ return
queries ( " COMMIT " );} function
rollback (){ return
2017-04-21 11:23:04 +00:00
queries ( " ROLLBACK " );}} $Yb [ " sqlite " ] = " SQLite 3 " ; $Yb [ " sqlite2 " ] = " SQLite 2 " ; if ( isset ( $_GET [ " sqlite " ]) || isset ( $_GET [ " sqlite2 " ])){ $Hf = 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
2014-04-01 18:00:42 +00:00
Min_SQLite { var $extension = " SQLite3 " , $server_info , $affected_rows , $errno , $error , $_link ; function
2017-04-21 11:23:04 +00:00
__construct ( $Kc ){ $this -> _link = new
SQLite3 ( $Kc ); $mi = $this -> _link -> version (); $this -> server_info = $mi [ " versionString " ];} function
2014-04-01 18:00:42 +00:00
query ( $H ){ $I =@ $this -> _link -> query ( $H ); $this -> error = " " ; if ( ! $I ){ $this -> errno = $this -> _link -> lastErrorCode (); $this -> error = $this -> _link -> lastErrorMsg (); return
false ;} elseif ( $I -> numColumns ()) return
new
Min_Result ( $I ); $this -> affected_rows = $this -> _link -> changes (); return
true ;} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return ( is_utf8 ( $Q ) ? " ' " . $this -> _link -> escapeString ( $Q ) . " ' " : " x' " . reset ( unpack ( 'H*' , $Q )) . " ' " );} function
2014-04-01 18:00:42 +00:00
store_result (){ return $this -> _result ;} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! is_object ( $I )) return
false ; $K = $I -> _result -> fetchArray (); return $K [ $o ];}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ;} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ return $this -> _result -> fetchArray ( SQLITE3_ASSOC );} function
fetch_row (){ return $this -> _result -> fetchArray ( SQLITE3_NUM );} function
2017-04-21 11:23:04 +00:00
fetch_field (){ $d = $this -> _offset ++ ; $U = $this -> _result -> columnType ( $d ); return ( object ) array ( " name " => $this -> _result -> columnName ( $d ), " type " => $U , " charsetnr " => ( $U == SQLITE3_BLOB ? 63 : 0 ),);} function
2014-04-01 18:00:42 +00:00
__desctruct (){ return $this -> _result -> finalize ();}}} else { class
Min_SQLite { var $extension = " SQLite " , $server_info , $affected_rows , $error , $_link ; function
2017-04-21 11:23:04 +00:00
__construct ( $Kc ){ $this -> server_info = sqlite_libversion (); $this -> _link = new
SQLiteDatabase ( $Kc );} function
query ( $H , $Sh = false ){ $ye = ( $Sh ? " unbufferedQuery " : " query " ); $I =@ $this -> _link -> $ye ( $H , SQLITE_BOTH , $n ); $this -> error = " " ; if ( ! $I ){ $this -> error = $n ; return
2014-04-01 18:00:42 +00:00
false ;} elseif ( $I === true ){ $this -> affected_rows = $this -> changes (); return
true ;} return
new
Min_Result ( $I );} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return " ' " . sqlite_escape_string ( $Q ) . " ' " ;} function
2014-04-01 18:00:42 +00:00
store_result (){ return $this -> _result ;} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! is_object ( $I )) return
false ; $K = $I -> _result -> fetch (); return $K [ $o ];}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ; if ( method_exists ( $I , 'numRows' )) $this -> num_rows = $I -> numRows ();} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ $K = $this -> _result -> fetch ( SQLITE_ASSOC ); if ( ! $K ) return
false ; $J = array (); foreach ( $K
2017-04-21 11:23:04 +00:00
as $y => $X ) $J [( $y [ 0 ] == '"' ? idf_unescape ( $y ) : $y )] = $X ; return $J ;} function
2014-04-01 18:00:42 +00:00
fetch_row (){ return $this -> _result -> fetch ( SQLITE_NUM );} function
2017-04-21 11:23:04 +00:00
fetch_field (){ $C = $this -> _result -> fieldName ( $this -> _offset ++ ); $Af = '(\\[.*]|"(?:[^"]|"")*"|(.+))' ; if ( preg_match ( " ~^( $Af\\ .)? $Af\ $ ~ " , $C , $B )){ $R = ( $B [ 3 ] != " " ? $B [ 3 ] : idf_unescape ( $B [ 2 ])); $C = ( $B [ 5 ] != " " ? $B [ 5 ] : idf_unescape ( $B [ 4 ]));} return ( object ) array ( " name " => $C , " orgname " => $C , " orgtable " => $R ,);}}}} elseif ( extension_loaded ( " pdo_sqlite " )){ class
2014-04-01 18:00:42 +00:00
Min_SQLite
extends
Min_PDO { var $extension = " PDO_SQLite " ; function
2017-04-21 11:23:04 +00:00
__construct ( $Kc ){ $this -> dsn ( DRIVER . " : $Kc " , " " , " " );}}} if ( class_exists ( " Min_SQLite " )){ class
2014-04-01 18:00:42 +00:00
Min_DB
extends
Min_SQLite { function
2016-10-11 12:23:21 +00:00
__construct (){ parent :: __construct ( " :memory: " );} function
2017-04-21 11:23:04 +00:00
select_db ( $Kc ){ if ( is_readable ( $Kc ) && $this -> query ( " ATTACH " . $this -> quote ( preg_match ( " ~(^[/ \\ \\ ]|:)~ " , $Kc ) ? $Kc : dirname ( $_SERVER [ " SCRIPT_FILENAME " ]) . " / $Kc " ) . " AS a " )){ parent :: __construct ( $Kc ); return
2014-04-01 18:00:42 +00:00
true ;} return
false ;} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
next_result (){ return
false ;}}} class
Min_Driver
extends
Min_SQL { function
2017-04-21 11:23:04 +00:00
insertUpdate ( $R , $L , $Kf ){ $ji = array (); foreach ( $L
as $O ) $ji [] = " ( " . implode ( " , " , $O ) . " ) " ; return
queries ( " REPLACE INTO " . table ( $R ) . " ( " . implode ( " , " , array_keys ( reset ( $L ))) . " ) VALUES \n " . implode ( " , \n " , $ji ));}} function
idf_escape ( $u ){ return '"' . str_replace ( '"' , '""' , $u ) . '"' ;} function
table ( $u ){ return
idf_escape ( $u );} function
2014-04-01 18:00:42 +00:00
connect (){ return
new
Min_DB ;} function
get_databases (){ return
array ();} function
2017-04-21 11:23:04 +00:00
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ return " $H $Z " . ( $z !== null ? $Dg . " LIMIT $z " . ( $D ? " OFFSET $D " : " " ) : " " );} function
limit1 ( $H , $Z ){ global $g ; return ( $g -> result ( " SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT') " ) ? limit ( $H , $Z , 1 ) : " $H $Z " );} function
db_collation ( $m , $ob ){ global $g ; return $g -> result ( " PRAGMA encoding " );} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
logged_user (){ return
get_current_user ();} function
tables_list (){ return
get_key_vals ( " SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') ORDER BY (name = 'sqlite_sequence'), name " , 1 );} function
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2017-04-21 11:23:04 +00:00
table_status ( $C = " " ){ global $g ; $J = array (); foreach ( get_rows ( " SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view') " . ( $C != " " ? " AND name = " . q ( $C ) : " ORDER BY name " )) as $K ){ $K [ " Oid " ] = 1 ; $K [ " Auto_increment " ] = " " ; $K [ " Rows " ] = $g -> result ( " SELECT COUNT(*) FROM " . idf_escape ( $K [ " Name " ])); $J [ $K [ " Name " ]] = $K ;} foreach ( get_rows ( " SELECT * FROM sqlite_sequence " , null , " " ) as $K ) $J [ $K [ " name " ]][ " Auto_increment " ] = $K [ " seq " ]; return ( $C != " " ? $J [ $C ] : $J );} function
is_view ( $S ){ return $S [ " Engine " ] == " view " ;} function
fk_support ( $S ){ global $g ; return ! $g -> result ( " SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY') " );} function
fields ( $R ){ global $g ; $J = array (); $Kf = " " ; foreach ( get_rows ( " PRAGMA table_info( " . table ( $R ) . " ) " ) as $K ){ $C = $K [ " name " ]; $U = strtolower ( $K [ " type " ]); $Mb = $K [ " dflt_value " ]; $J [ $C ] = array ( " field " => $C , " type " => ( preg_match ( '~int~i' , $U ) ? " integer " : ( preg_match ( '~char|clob|text~i' , $U ) ? " text " : ( preg_match ( '~blob~i' , $U ) ? " blob " : ( preg_match ( '~real|floa|doub~i' , $U ) ? " real " : " numeric " )))), " full_type " => $U , " default " => ( preg_match ( " ~'(.*)'~ " , $Mb , $B ) ? str_replace ( " '' " , " ' " , $B [ 1 ]) : ( $Mb == " NULL " ? null : $Mb )), " null " =>! $K [ " notnull " ], " privileges " => array ( " select " => 1 , " insert " => 1 , " update " => 1 ), " primary " => $K [ " pk " ],); if ( $K [ " pk " ]){ if ( $Kf != " " ) $J [ $Kf ][ " auto_increment " ] = false ; elseif ( preg_match ( '~^integer$~i' , $U )) $J [ $C ][ " auto_increment " ] = true ; $Kf = $C ;}} $Tg = $g -> result ( " SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q ( $R )); preg_match_all ( '~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i' , $Tg , $ke , PREG_SET_ORDER ); foreach ( $ke
2014-04-01 18:00:42 +00:00
as $B ){ $C = str_replace ( '""' , '"' , preg_replace ( '~^"|"$~' , '' , $B [ 1 ])); if ( $J [ $C ]) $J [ $C ][ " collation " ] = trim ( $B [ 3 ], " ' " );} return $J ;} function
2017-04-21 11:23:04 +00:00
indexes ( $R , $h = null ){ global $g ; if ( ! is_object ( $h )) $h = $g ; $J = array (); $Tg = $h -> result ( " SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q ( $R )); if ( preg_match ( '~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*")++)~i' , $Tg , $B )){ $J [ " " ] = array ( " type " => " PRIMARY " , " columns " => array (), " lengths " => array (), " descs " => array ()); preg_match_all ( '~((("[^"]*+")+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i' , $B [ 1 ], $ke , PREG_SET_ORDER ); foreach ( $ke
as $B ){ $J [ " " ][ " columns " ][] = idf_unescape ( $B [ 2 ]) . $B [ 4 ]; $J [ " " ][ " descs " ][] = ( preg_match ( '~DESC~i' , $B [ 5 ]) ? '1' : null );}} if ( ! $J ){ foreach ( fields ( $R ) as $C => $o ){ if ( $o [ " primary " ]) $J [ " " ] = array ( " type " => " PRIMARY " , " columns " => array ( $C ), " lengths " => array (), " descs " => array ( null ));}} $Ug = get_key_vals ( " SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q ( $R ), $h ); foreach ( get_rows ( " PRAGMA index_list( " . table ( $R ) . " ) " , $h ) as $K ){ $C = $K [ " name " ]; $v = array ( " type " => ( $K [ " unique " ] ? " UNIQUE " : " INDEX " )); $v [ " lengths " ] = array (); $v [ " descs " ] = array (); foreach ( get_rows ( " PRAGMA index_info( " . idf_escape ( $C ) . " ) " , $h ) as $ug ){ $v [ " columns " ][] = $ug [ " name " ]; $v [ " descs " ][] = null ;} if ( preg_match ( '~^CREATE( UNIQUE)? INDEX ' . preg_quote ( idf_escape ( $C ) . ' ON ' . idf_escape ( $R ), '~' ) . ' \((.*)\)$~i' , $Ug [ $C ], $gg )){ preg_match_all ( '/("[^"]*+")+( DESC)?/' , $gg [ 2 ], $ke ); foreach ( $ke [ 2 ] as $y => $X ){ if ( $X ) $v [ " descs " ][ $y ] = '1' ;}} if ( ! $J [ " " ] || $v [ " type " ] != " UNIQUE " || $v [ " columns " ] != $J [ " " ][ " columns " ] || $v [ " descs " ] != $J [ " " ][ " descs " ] ||! preg_match ( " ~^sqlite_~ " , $C )) $J [ $C ] = $v ;} return $J ;} function
foreign_keys ( $R ){ $J = array (); foreach ( get_rows ( " PRAGMA foreign_key_list( " . table ( $R ) . " ) " ) as $K ){ $q =& $J [ $K [ " id " ]]; if ( ! $q ) $q = $K ; $q [ " source " ][] = $K [ " from " ]; $q [ " target " ][] = $K [ " to " ];} return $J ;} function
view ( $C ){ global $g ; return
array ( " select " => preg_replace ( '~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\\s+~iU' , '' , $g -> result ( " SELECT sql FROM sqlite_master WHERE name = " . q ( $C ))));} function
2014-04-01 18:00:42 +00:00
collations (){ return ( isset ( $_GET [ " create " ]) ? get_vals ( " PRAGMA collation_list " , 1 ) : array ());} function
2015-04-01 06:36:56 +00:00
information_schema ( $m ){ return
2014-04-01 18:00:42 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
error (){ global $g ; return
h ( $g -> error );} function
check_sqlite_name ( $C ){ global $g ; $Dc = " db|sdb|sqlite " ; if ( ! preg_match ( " ~^[^ \\ 0]* \\ .( $Dc ) \$ ~ " , $C )){ $g -> error = lang ( 21 , str_replace ( " | " , " , " , $Dc )); return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
create_database ( $m , $nb ){ global $g ; if ( file_exists ( $m )){ $g -> error = lang ( 22 ); return
2015-04-01 06:36:56 +00:00
false ;} if ( ! check_sqlite_name ( $m )) return
2014-04-01 18:00:42 +00:00
false ; try { $_ = new
2017-04-21 11:23:04 +00:00
Min_SQLite ( $m );} catch ( Exception $vc ){ $g -> error = $vc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;} $_ -> query ( 'PRAGMA encoding = "UTF-8"' ); $_ -> query ( 'CREATE TABLE adminer (i)' ); $_ -> query ( 'DROP TABLE adminer' ); return
true ;} function
2017-04-21 11:23:04 +00:00
drop_databases ( $l ){ global $g ; $g -> __construct ( " :memory: " ); foreach ( $l
as $m ){ if ( !@ unlink ( $m )){ $g -> error = lang ( 22 ); return
2014-04-01 18:00:42 +00:00
false ;}} return
true ;} function
2017-04-21 11:23:04 +00:00
rename_database ( $C , $nb ){ global $g ; if ( ! check_sqlite_name ( $C )) return
false ; $g -> __construct ( " :memory: " ); $g -> error = lang ( 22 ); return @ rename ( DB , $C );} function
2014-04-01 18:00:42 +00:00
auto_increment (){ return " PRIMARY KEY " . ( DRIVER == " sqlite " ? " AUTOINCREMENT " : " " );} function
2017-04-21 11:23:04 +00:00
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ $di = ( $R == " " || $Rc ); foreach ( $p
as $o ){ if ( $o [ 0 ] != " " ||! $o [ 1 ] || $o [ 2 ]){ $di = true ; break ;}} $c = array (); $mf = array (); foreach ( $p
as $o ){ if ( $o [ 1 ]){ $c [] = ( $di ? $o [ 1 ] : " ADD " . implode ( $o [ 1 ])); if ( $o [ 0 ] != " " ) $mf [ $o [ 0 ]] = $o [ 1 ][ 0 ];}} if ( ! $di ){ foreach ( $c
as $X ){ if ( ! queries ( " ALTER TABLE " . table ( $R ) . " $X " )) return
false ;} if ( $R != $C &&! queries ( " ALTER TABLE " . table ( $R ) . " RENAME TO " . table ( $C ))) return
false ;} elseif ( ! recreate_table ( $R , $C , $c , $mf , $Rc )) return
2015-04-01 06:36:56 +00:00
false ; if ( $La ) queries ( " UPDATE sqlite_sequence SET seq = $La WHERE name = " . q ( $C )); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
recreate_table ( $R , $C , $p , $mf , $Rc , $w = array ()){ if ( $R != " " ){ if ( ! $p ){ foreach ( fields ( $R ) as $y => $o ){ $p [] = process_field ( $o , $o ); $mf [ $y ] = idf_escape ( $y );}} $Lf = false ; foreach ( $p
as $o ){ if ( $o [ 6 ]) $Lf = true ;} $bc = array (); foreach ( $w
as $y => $X ){ if ( $X [ 2 ] == " DROP " ){ $bc [ $X [ 1 ]] = true ; unset ( $w [ $y ]);}} foreach ( indexes ( $R ) as $Nd => $v ){ $e = array (); foreach ( $v [ " columns " ] as $y => $d ){ if ( ! $mf [ $d ]) continue
2 ; $e [] = $mf [ $d ] . ( $v [ " descs " ][ $y ] ? " DESC " : " " );} if ( ! $bc [ $Nd ]){ if ( $v [ " type " ] != " PRIMARY " ||! $Lf ) $w [] = array ( $v [ " type " ], $Nd , $e );}} foreach ( $w
as $y => $X ){ if ( $X [ 0 ] == " PRIMARY " ){ unset ( $w [ $y ]); $Rc [] = " PRIMARY KEY ( " . implode ( " , " , $X [ 2 ]) . " ) " ;}} foreach ( foreign_keys ( $R ) as $Nd => $q ){ foreach ( $q [ " source " ] as $y => $d ){ if ( ! $mf [ $d ]) continue
2 ; $q [ " source " ][ $y ] = idf_unescape ( $mf [ $d ]);} if ( ! isset ( $Rc [ " $Nd " ])) $Rc [] = " " . format_foreign_key ( $q );} queries ( " BEGIN " );} foreach ( $p
as $y => $o ) $p [ $y ] = " " . implode ( $o ); $p = array_merge ( $p , array_filter ( $Rc )); if ( ! queries ( " CREATE TABLE " . table ( $R != " " ? " adminer_ $C " : $C ) . " ( \n " . implode ( " , \n " , $p ) . " \n ) " )) return
false ; if ( $R != " " ){ if ( $mf &&! queries ( " INSERT INTO " . table ( " adminer_ $C " ) . " ( " . implode ( " , " , $mf ) . " ) SELECT " . implode ( " , " , array_map ( 'idf_escape' , array_keys ( $mf ))) . " FROM " . table ( $R ))) return
false ; $Oh = array (); foreach ( triggers ( $R ) as $Mh => $xh ){ $Lh = trigger ( $Mh ); $Oh [] = " CREATE TRIGGER " . idf_escape ( $Mh ) . " " . implode ( " " , $xh ) . " ON " . table ( $C ) . " \n $Lh[Statement] " ;} if ( ! queries ( " DROP TABLE " . table ( $R ))) return
false ; queries ( " ALTER TABLE " . table ( " adminer_ $C " ) . " RENAME TO " . table ( $C )); if ( ! alter_indexes ( $C , $w )) return
false ; foreach ( $Oh
as $Lh ){ if ( ! queries ( $Lh )) return
2014-04-01 18:00:42 +00:00
false ;} queries ( " COMMIT " );} return
true ;} function
2017-04-21 11:23:04 +00:00
index_sql ( $R , $U , $C , $e ){ return " CREATE $U " . ( $U != " INDEX " ? " INDEX " : " " ) . idf_escape ( $C != " " ? $C : uniqid ( $R . " _ " )) . " ON " . table ( $R ) . " $e " ;} function
alter_indexes ( $R , $c ){ foreach ( $c
as $Kf ){ if ( $Kf [ 0 ] == " PRIMARY " ) return
recreate_table ( $R , $R , array (), array (), array (), $c );} foreach ( array_reverse ( $c ) as $X ){ if ( ! queries ( $X [ 2 ] == " DROP " ? " DROP INDEX " . idf_escape ( $X [ 1 ]) : index_sql ( $R , $X [ 0 ], $X [ 1 ], " ( " . implode ( " , " , $X [ 2 ]) . " ) " ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
truncate_tables ( $T ){ return
apply_queries ( " DELETE FROM " , $T );} function
drop_views ( $oi ){ return
apply_queries ( " DROP VIEW " , $oi );} function
drop_tables ( $T ){ return
apply_queries ( " DROP TABLE " , $T );} function
move_tables ( $T , $oi , $oh ){ return
2014-04-01 18:00:42 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
trigger ( $C ){ global $g ; if ( $C == " " ) return
array ( " Statement " => " BEGIN \n \t ; \n END " ); $u = '(?:[^`"\\s]+|`[^`]*`|"[^"]*")+' ; $Nh = trigger_options (); preg_match ( " ~^CREATE \\ s+TRIGGER \\ s* $u\\s *( " . implode ( " | " , $Nh [ " Timing " ]) . " ) \\ s+([a-z]+)(?: \\ s+OF \\ s+( $u ))? \\ s+ON \\ s* $u\\s *(?:FOR \\ s+EACH \\ s+ROW \\ s)?(.*)~is " , $g -> result ( " SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = " . q ( $C )), $B ); $Me = $B [ 3 ]; return
array ( " Timing " => strtoupper ( $B [ 1 ]), " Event " => strtoupper ( $B [ 2 ]) . ( $Me ? " OF " : " " ), " Of " => ( $Me [ 0 ] == '`' || $Me [ 0 ] == '"' ? idf_unescape ( $Me ) : $Me ), " Trigger " => $C , " Statement " => $B [ 4 ],);} function
triggers ( $R ){ $J = array (); $Nh = trigger_options (); foreach ( get_rows ( " SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $R )) as $K ){ preg_match ( '~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*(' . implode ( " | " , $Nh [ " Timing " ]) . ')\\s*(.*)\\s+ON\\b~iU' , $K [ " sql " ], $B ); $J [ $K [ " name " ]] = array ( $B [ 1 ], $B [ 2 ]);} return $J ;} function
2014-04-01 18:00:42 +00:00
trigger_options (){ return
2015-04-01 06:36:56 +00:00
array ( " Timing " => array ( " BEFORE " , " AFTER " , " INSTEAD OF " ), " Event " => array ( " INSERT " , " UPDATE " , " UPDATE OF " , " DELETE " ), " Type " => array ( " FOR EACH ROW " ),);} function
2014-04-01 18:00:42 +00:00
routine ( $C , $U ){} function
routines (){} function
routine_languages (){} function
begin (){ return
queries ( " BEGIN " );} function
2017-04-21 11:23:04 +00:00
last_id (){ global $g ; return $g -> result ( " SELECT LAST_INSERT_ROWID() " );} function
explain ( $g , $H ){ return $g -> query ( " EXPLAIN QUERY PLAN $H " );} function
found_rows ( $S , $Z ){} function
2014-04-01 18:00:42 +00:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2017-04-21 11:23:04 +00:00
set_schema ( $yg ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
create_sql ( $R , $La ){ global $g ; $J = $g -> result ( " SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q ( $R )); foreach ( indexes ( $R ) as $C => $v ){ if ( $C == '' ) continue ; $J .= " ; \n \n " . index_sql ( $R , $v [ 'type' ], $C , " ( " . implode ( " , " , array_map ( 'idf_escape' , $v [ 'columns' ])) . " ) " );} return $J ;} function
truncate_sql ( $R ){ return " DELETE FROM " . table ( $R );} function
use_sql ( $k ){} function
trigger_sql ( $R , $Zg ){ return
implode ( get_vals ( " SELECT sql || ';; \n ' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $R )));} function
show_variables (){ global $g ; $J = array (); foreach ( array ( " auto_vacuum " , " cache_size " , " count_changes " , " default_cache_size " , " empty_result_callbacks " , " encoding " , " foreign_keys " , " full_column_names " , " fullfsync " , " journal_mode " , " journal_size_limit " , " legacy_file_format " , " locking_mode " , " page_size " , " max_page_count " , " read_uncommitted " , " recursive_triggers " , " reverse_unordered_selects " , " secure_delete " , " short_column_names " , " synchronous " , " temp_store " , " temp_store_directory " , " schema_version " , " integrity_check " , " quick_check " ) as $y ) $J [ $y ] = $g -> result ( " PRAGMA $y " ); return $J ;} function
show_status (){ $J = array (); foreach ( get_vals ( " PRAGMA compile_options " ) as $af ){ list ( $y , $X ) = explode ( " = " , $af , 2 ); $J [ $y ] = $X ;} return $J ;} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ return
preg_match ( '~^(columns|database|drop_col|dump|indexes|move_col|sql|status|table|trigger|variables|view|view_trigger)$~' , $Gc );} $x = " sqlite " ; $Rh = array ( " integer " => 0 , " real " => 0 , " numeric " => 0 , " text " => 0 , " blob " => 0 ); $Yg = array_keys ( $Rh ); $Yh = array (); $Ye = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Zc = array ( " hex " , " length " , " lower " , " round " , " unixepoch " , " upper " ); $ed = array ( " avg " , " count " , " count distinct " , " group_concat " , " max " , " min " , " sum " ); $gc = array ( array (), array ( " integer|real|numeric " => " +/- " , " text " => " || " ,));} $Yb [ " pgsql " ] = " PostgreSQL " ; if ( isset ( $_GET [ " pgsql " ])){ $Hf = array ( " PgSQL " , " PDO_PgSQL " ); define ( " DRIVER " , " pgsql " ); if ( extension_loaded ( " pgsql " )){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " PgSQL " , $_link , $_result , $_string , $_database = true , $server_info , $affected_rows , $error ; function
2017-04-21 11:23:04 +00:00
_error ( $rc , $n ){ if ( ini_bool ( " html_errors " )) $n = html_entity_decode ( strip_tags ( $n )); $n = preg_replace ( '~^[^:]*: ~' , '' , $n ); $this -> error = $n ;} function
connect ( $N , $V , $G ){ global $b ; $m = $b -> database (); set_error_handler ( array ( $this , '_error' )); $this -> _string = " host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $N , " ' \\ " )) . " ' user=' " . addcslashes ( $V , " ' \\ " ) . " ' password=' " . addcslashes ( $G , " ' \\ " ) . " ' " ; $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 ){ $mi = pg_version ( $this -> _link ); $this -> server_info = $mi [ " server " ]; pg_set_client_encoding ( $this -> _link , " UTF8 " );} return ( bool ) $this -> _link ;} function
quote ( $Q ){ return " ' " . pg_escape_string ( $this -> _link , $Q ) . " ' " ;} function
select_db ( $k ){ global $b ; if ( $k == $b -> database ()) return $this -> _database ; $J =@ pg_connect ( " $this->_string dbname=' " . addcslashes ( $k , " ' \\ " ) . " ' " , PGSQL_CONNECT_FORCE_NEW ); if ( $J ) $this -> _link = $J ; return $J ;} function
2014-04-01 18:00:42 +00:00
close (){ $this -> _link =@ pg_connect ( " $this->_string dbname='postgres' " );} function
2017-04-21 11:23:04 +00:00
query ( $H , $Sh = false ){ $I =@ pg_query ( $this -> _link , $H ); $this -> error = " " ; if ( ! $I ){ $this -> error = pg_last_error ( $this -> _link ); return
2014-04-01 18:00:42 +00:00
false ;} elseif ( ! pg_num_fields ( $I )){ $this -> affected_rows = pg_affected_rows ( $I ); return
true ;} return
new
Min_Result ( $I );} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! $I ||! $I -> num_rows ) return
2014-04-01 18:00:42 +00:00
false ; return
2015-04-01 06:36:56 +00:00
pg_fetch_result ( $I -> _result , 0 , $o );}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ; $this -> num_rows = pg_num_rows ( $I );} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ return
pg_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
pg_fetch_row ( $this -> _result );} function
2017-04-21 11:23:04 +00:00
fetch_field (){ $d = $this -> _offset ++ ; $J = new
stdClass ; if ( function_exists ( 'pg_field_table' )) $J -> orgtable = pg_field_table ( $this -> _result , $d ); $J -> name = pg_field_name ( $this -> _result , $d ); $J -> orgname = $J -> name ; $J -> type = pg_field_type ( $this -> _result , $d ); $J -> charsetnr = ( $J -> type == " bytea " ? 63 : 0 ); return $J ;} function
2014-04-01 18:00:42 +00:00
__destruct (){ pg_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_pgsql " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_PgSQL " ; function
2017-04-21 11:23:04 +00:00
connect ( $N , $V , $G ){ global $b ; $m = $b -> database (); $Q = " pgsql:host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $N , " ' \\ " )) . " ' options='-c client_encoding=utf8' " ; $this -> dsn ( " $Q dbname=' " . ( $m != " " ? addcslashes ( $m , " ' \\ " ) : " postgres " ) . " ' " , $V , $G ); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
select_db ( $k ){ global $b ; return ( $b -> database () == $k );} function
2014-04-01 18:00:42 +00:00
close (){}}} class
Min_Driver
extends
Min_SQL { function
2017-04-21 11:23:04 +00:00
insertUpdate ( $R , $L , $Kf ){ global $g ; foreach ( $L
as $O ){ $Zh = array (); $Z = array (); foreach ( $O
as $y => $X ){ $Zh [] = " $y = $X " ; if ( isset ( $Kf [ idf_unescape ( $y )])) $Z [] = " $y = $X " ;} if ( ! (( $Z && queries ( " UPDATE " . table ( $R ) . " SET " . implode ( " , " , $Zh ) . " WHERE " . implode ( " AND " , $Z )) && $g -> affected_rows ) || queries ( " INSERT INTO " . table ( $R ) . " ( " . implode ( " , " , array_keys ( $O )) . " ) VALUES ( " . implode ( " , " , $O ) . " ) " ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;}} function
2017-04-21 11:23:04 +00:00
idf_escape ( $u ){ return '"' . str_replace ( '"' , '""' , $u ) . '"' ;} function
table ( $u ){ return
idf_escape ( $u );} function
connect (){ global $b , $Rh , $Yg ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])){ if ( $g -> server_info >= 9 ){ $g -> query ( " SET application_name = 'Adminer' " ); if ( $g -> server_info >= 9.2 ){ $Yg [ lang ( 23 )][] = " json " ; $Rh [ " json " ] = 4294967295 ; if ( $g -> server_info >= 9.4 ){ $Yg [ lang ( 23 )][] = " jsonb " ; $Rh [ " jsonb " ] = 4294967295 ;}}} return $g ;} return $g -> error ;} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
2017-04-21 11:23:04 +00:00
get_vals ( " SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname " );} function
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ return " $H $Z " . ( $z !== null ? $Dg . " LIMIT $z " . ( $D ? " OFFSET $D " : " " ) : " " );} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ return " $H $Z " ;} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){ global $g ; return $g -> result ( " SHOW LC_COLLATE " );} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
logged_user (){ global $g ; return $g -> result ( " SELECT user " );} function
2015-04-01 06:36:56 +00:00
tables_list (){ $H = " SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() " ; if ( support ( 'materializedview' )) $H .= "
UNION ALL
SELECT matviewname , 'MATERIALIZED VIEW'
FROM pg_matviews
WHERE schemaname = current_schema () " ; $H .= "
ORDER BY 1 " ;return
get_key_vals ( $H );} function
count_tables ( $l ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2017-04-21 11:23:04 +00:00
table_status ( $C = " " ){ $J = 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 \" , c.relhasoids::int AS \" Oid \" , c.reltuples as \" Rows \" , n.nspname
FROM pg_class c
JOIN pg_namespace n ON ( n . nspname = current_schema () AND n . oid = c . relnamespace )
WHERE relkind IN ( 'r' , 'm' , 'v' )
" .( $C != " " ? " AND relname = " .q( $C ): " ORDER BY c . oid " ))as $K ) $J[$K["Name"] ]= $K ;return( $C != " " ? $J[$C] : $J );}function
is_view ( $S ){ return
in_array ( $S [ " Engine " ], array ( " view " , " materialized view " ));} function
fk_support ( $S ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
fields ( $R ){ $J = array (); $Ca = array ( 'timestamp without time zone' => 'timestamp' , 'timestamp with time zone' => 'timestamptz' ,); foreach ( get_rows ( " SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
WHERE c . relname = " .q( $R ). "
2014-04-01 18:00:42 +00:00
AND n . nspname = current_schema ()
AND NOT a . attisdropped
AND a . attnum > 0
2017-04-21 11:23:04 +00:00
ORDER BY a . attnum " )as $K ) { preg_match('~([^([]+)( \ ((.*) \ ))?([a-z ]+)?(( \ [[0-9]*])*) $ ~', $K["full_type"] , $B );list(, $U , $be , $K["length"] , $wa , $Fa )= $B ; $K["length"] .= $Fa ; $cb = $U . $wa ;if(isset( $Ca[$cb] )) { $K [ " type " ] = $Ca [ $cb ]; $K [ " full_type " ] = $K [ " type " ] . $be . $Fa ; } else { $K [ " type " ] = $U ; $K [ " full_type " ] = $K [ " type " ] . $be . $wa . $Fa ; } $K["null"] =! $K["attnotnull"] ; $K["auto_increment"] =preg_match('~^nextval \\ (~i', $K["default"] ); $K["privileges"] =array( " insert " =>1, " select " =>1, " update " =>1);if(preg_match('~(.+)::[^)]+(.*)~', $K["default"] , $B )) $K["default"] =( $B[1] [0]== " ' " ?idf_unescape( $B[1] ): $B[1] ). $B[2] ; $J[$K["field"] ]= $K ;}return $J ;}function
indexes ( $R , $h = null ){ global $g ; if ( ! is_object ( $h )) $h = $g ; $J = array (); $hh = $h -> result ( " SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q ( $R )); $e = get_key_vals ( " SELECT attnum, attname FROM pg_attribute WHERE attrelid = $hh AND attnum > 0 " , $h ); foreach ( get_rows ( " SELECT relname, indisunique::int, indisprimary::int, indkey, indoption , (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $hh AND ci.oid = i.indexrelid " , $h ) as $K ){ $hg = $K [ " relname " ]; $J [ $hg ][ " type " ] = ( $K [ " indispartial " ] ? " INDEX " : ( $K [ " indisprimary " ] ? " PRIMARY " : ( $K [ " indisunique " ] ? " UNIQUE " : " INDEX " ))); $J [ $hg ][ " columns " ] = array (); foreach ( explode ( " " , $K [ " indkey " ]) as $ud ) $J [ $hg ][ " columns " ][] = $e [ $ud ]; $J [ $hg ][ " descs " ] = array (); foreach ( explode ( " " , $K [ " indoption " ]) as $vd ) $J [ $hg ][ " descs " ][] = ( $vd & 1 ? '1' : null ); $J [ $hg ][ " lengths " ] = array ();} return $J ;} function
foreign_keys ( $R ){ global $Te ; $J = array (); foreach ( get_rows ( " SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
2014-04-01 18:00:42 +00:00
FROM pg_constraint
2017-04-21 11:23:04 +00: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( $R ). " AND pn . nspname = current_schema ())
2014-04-01 18:00:42 +00:00
AND contype = 'f' :: char
2017-04-21 11:23:04 +00:00
ORDER BY conkey , conname " )as $K ) { if(preg_match('~FOREIGN KEY \ s* \ ((.+) \ ) \ s*REFERENCES (.+) \ ((.+) \ )(.*) $ ~iA', $K['definition'] , $B )) { $K [ 'source' ] = array_map ( 'trim' , explode ( ',' , $B [ 1 ])); if ( preg_match ( '~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~' , $B [ 2 ], $je )){ $K [ 'ns' ] = str_replace ( '""' , '"' , preg_replace ( '~^"(.+)"$~' , '\1' , $je [ 2 ])); $K [ 'table' ] = str_replace ( '""' , '"' , preg_replace ( '~^"(.+)"$~' , '\1' , $je [ 4 ])); } $K['target'] =array_map('trim',explode(',', $B[3] )); $K['on_delete'] =(preg_match( " ~ ON DELETE ( $Te ) ~ " , $B[4] , $je )? $je[1] :'NO ACTION'); $K['on_update'] =(preg_match( " ~ ON UPDATE ( $Te ) ~ " , $B[4] , $je )? $je[1] :'NO ACTION'); $J[$K['conname'] ]= $K ;}}return $J ;}function
view ( $C ){ global $g ; return
array ( " select " => trim ( $g -> result ( " SELECT pg_get_viewdef( " . q ( $C ) . " ) " )));} function
2014-04-01 18:00:42 +00:00
collations (){ return
array ();} function
2015-04-01 06:36:56 +00:00
information_schema ( $m ){ return ( $m == " information_schema " );} function
2017-04-21 11:23:04 +00:00
error (){ global $g ; $J = h ( $g -> error ); if ( preg_match ( '~^(.*\\n)?([^\\n]*)\\n( *)\\^(\\n.*)?$~s' , $J , $B )) $J = $B [ 1 ] . preg_replace ( '~((?:[^&]|&[^;]*;){' . strlen ( $B [ 3 ]) . '})(.*)~' , '\\1<b>\\2</b>' , $B [ 2 ]) . $B [ 4 ]; return
2014-04-01 18:00:42 +00:00
nl_br ( $J );} function
2017-04-21 11:23:04 +00:00
create_database ( $m , $nb ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $nb ? " ENCODING " . idf_escape ( $nb ) : " " ));} function
drop_databases ( $l ){ global $g ; $g -> close (); return
2015-04-01 06:36:56 +00:00
apply_queries ( " DROP DATABASE " , $l , 'idf_escape' );} function
2017-04-21 11:23:04 +00:00
rename_database ( $C , $nb ){ return
2014-04-01 18:00:42 +00:00
queries ( " ALTER DATABASE " . idf_escape ( DB ) . " RENAME TO " . idf_escape ( $C ));} function
auto_increment (){ return " " ;} function
2017-04-21 11:23:04 +00:00
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ $c = array (); $Uf = array (); foreach ( $p
as $o ){ $d = idf_escape ( $o [ 0 ]); $X = $o [ 1 ]; if ( ! $X ) $c [] = " DROP $d " ; else { $ii = $X [ 5 ]; unset ( $X [ 5 ]); if ( isset ( $X [ 6 ]) && $o [ 0 ] == " " ) $X [ 1 ] = ( $X [ 1 ] == " bigint " ? " big " : " " ) . " serial " ; if ( $o [ 0 ] == " " ) $c [] = ( $R != " " ? " ADD " : " " ) . implode ( $X ); else { if ( $d != $X [ 0 ]) $Uf [] = " ALTER TABLE " . table ( $R ) . " RENAME $d TO $X[0] " ; $c [] = " ALTER $d TYPE $X[1] " ; if ( ! $X [ 6 ]){ $c [] = " ALTER $d " . ( $X [ 3 ] ? " SET $X[3] " : " DROP DEFAULT " ); $c [] = " ALTER $d " . ( $X [ 2 ] == " NULL " ? " DROP NOT " : " SET " ) . $X [ 2 ];}} if ( $o [ 0 ] != " " || $ii != " " ) $Uf [] = " COMMENT ON COLUMN " . table ( $R ) . " . $X[0] IS " . ( $ii != " " ? substr ( $ii , 9 ) : " '' " );}} $c = array_merge ( $c , $Rc ); if ( $R == " " ) array_unshift ( $Uf , " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); elseif ( $c ) array_unshift ( $Uf , " ALTER TABLE " . table ( $R ) . " \n " . implode ( " , \n " , $c )); if ( $R != " " && $R != $C ) $Uf [] = " ALTER TABLE " . table ( $R ) . " RENAME TO " . table ( $C ); if ( $R != " " || $sb != " " ) $Uf [] = " COMMENT ON TABLE " . table ( $C ) . " IS " . q ( $sb ); if ( $La != " " ){} foreach ( $Uf
2014-04-01 18:00:42 +00:00
as $H ){ if ( ! queries ( $H )) return
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
alter_indexes ( $R , $c ){ $i = array (); $Zb = array (); $Uf = array (); foreach ( $c
as $X ){ if ( $X [ 0 ] != " INDEX " ) $i [] = ( $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 " ) $Zb [] = idf_escape ( $X [ 1 ]); else $Uf [] = " CREATE INDEX " . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $R . " _ " )) . " ON " . table ( $R ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " ;} if ( $i ) array_unshift ( $Uf , " ALTER TABLE " . table ( $R ) . implode ( " , " , $i )); if ( $Zb ) array_unshift ( $Uf , " DROP INDEX " . implode ( " , " , $Zb )); foreach ( $Uf
2014-04-01 18:00:42 +00:00
as $H ){ if ( ! queries ( $H )) return
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
truncate_tables ( $T ){ return
queries ( " TRUNCATE " . implode ( " , " , array_map ( 'table' , $T ))); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
drop_views ( $oi ){ return
drop_tables ( $oi );} function
drop_tables ( $T ){ foreach ( $T
as $R ){ $P = table_status ( $R ); if ( ! queries ( " DROP " . strtoupper ( $P [ " Engine " ]) . " " . table ( $R ))) return
2015-04-01 06:36:56 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
move_tables ( $T , $oi , $oh ){ foreach ( array_merge ( $T , $oi ) as $R ){ $P = table_status ( $R ); if ( ! queries ( " ALTER " . strtoupper ( $P [ " Engine " ]) . " " . table ( $R ) . " SET SCHEMA " . idf_escape ( $oh ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
trigger ( $C , $R = null ){ if ( $C == " " ) return
array ( " Statement " => " EXECUTE PROCEDURE () " ); if ( $R === null ) $R = $_GET [ 'trigger' ]; $L = get_rows ( 'SELECT t.trigger_name AS "Trigger", t.action_timing AS "Timing", (SELECT STRING_AGG(event_manipulation, \' OR \') FROM information_schema.triggers WHERE event_object_table = t.event_object_table AND trigger_name = t.trigger_name ) AS "Events", t.event_manipulation AS "Event", \'FOR EACH \' || t.action_orientation AS "Type", t.action_statement AS "Statement" FROM information_schema.triggers t WHERE t.event_object_table = ' . q ( $R ) . ' AND t.trigger_name = ' . q ( $C )); return
2014-04-01 18:00:42 +00:00
reset ( $L );} function
2017-04-21 11:23:04 +00:00
triggers ( $R ){ $J = array (); foreach ( get_rows ( " SELECT * FROM information_schema.triggers WHERE event_object_table = " . q ( $R )) as $K ) $J [ $K [ " trigger_name " ]] = array ( $K [ " action_timing " ], $K [ " event_manipulation " ]); return $J ;} function
2014-04-01 18:00:42 +00:00
trigger_options (){ return
2015-04-01 06:36:56 +00:00
array ( " Timing " => array ( " BEFORE " , " AFTER " ), " Event " => array ( " INSERT " , " UPDATE " , " DELETE " ), " Type " => array ( " FOR EACH ROW " , " FOR EACH STATEMENT " ),);} function
2014-04-01 18:00:42 +00:00
routines (){ return
get_rows ( ' SELECT p . proname AS " ROUTINE_NAME " , p . proargtypes AS " ROUTINE_TYPE " , pg_catalog . format_type ( p . prorettype , NULL ) AS " DTD_IDENTIFIER "
FROM pg_catalog . pg_namespace n
JOIN pg_catalog . pg_proc p ON p . pronamespace = n . oid
WHERE n . nspname = current_schema ()
ORDER BY p . proname ' );} function
routine_languages (){ return
get_vals ( " SELECT langname FROM pg_catalog.pg_language " );} function
last_id (){ return
0 ;} function
2017-04-21 11:23:04 +00:00
explain ( $g , $H ){ return $g -> query ( " EXPLAIN $H " );} function
found_rows ( $S , $Z ){ global $g ; if ( preg_match ( " ~ rows=([0-9]+)~ " , $g -> result ( " EXPLAIN SELECT * FROM " . idf_escape ( $S [ " Name " ]) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " )), $gg )) return $gg [ 1 ]; return
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
get_schema (){ global $g ; return $g -> result ( " SELECT current_schema() " );} function
set_schema ( $xg ){ global $g , $Rh , $Yg ; $J = $g -> query ( " SET search_path TO " . idf_escape ( $xg )); foreach ( types () as $U ){ if ( ! isset ( $Rh [ $U ])){ $Rh [ $U ] = 0 ; $Yg [ lang ( 24 )][] = $U ;}} return $J ;} function
create_sql ( $R , $La ){ global $g ; $J = '' ; $ng = array (); $Fg = array (); $P = table_status ( $R ); $p = fields ( $R ); $w = indexes ( $R ); ksort ( $w ); $Pc = foreign_keys ( $R ); ksort ( $Pc ); $Oh = triggers ( $R ); if ( ! $P || empty ( $p )) return
false ; $J = " CREATE TABLE " . idf_escape ( $P [ 'nspname' ]) . " . " . idf_escape ( $P [ 'Name' ]) . " ( \n " ; foreach ( $p
as $Ic => $o ){ $tf = idf_escape ( $o [ 'field' ]) . ' ' . $o [ 'full_type' ] . ( is_null ( $o [ 'default' ]) ? " " : " DEFAULT $o[default] " ) . ( $o [ 'attnotnull' ] ? " NOT NULL " : " " ); $ng [] = $tf ; if ( preg_match ( '~nextval\(\'([^\']+)\'\)~' , $o [ 'default' ], $ke )){ $Eg = $ke [ 1 ]; $Sg = reset ( get_rows ( " SELECT * FROM $Eg " )); $Fg [] = " CREATE SEQUENCE $Eg INCREMENT $Sg[increment_by] MINVALUE $Sg[min_value] MAXVALUE $Sg[max_value] START " . ( $La ? $Sg [ 'last_value' ] : 1 ) . " CACHE $Sg[cache_value] ; " ;}} if ( ! empty ( $Fg )) $J = implode ( " \n \n " , $Fg ) . " \n \n $J " ; foreach ( $w
as $sd => $v ){ switch ( $v [ 'type' ]){ case 'UNIQUE' : $ng [] = " CONSTRAINT " . idf_escape ( $sd ) . " UNIQUE ( " . implode ( ', ' , array_map ( 'idf_escape' , $v [ 'columns' ])) . " ) " ; break ; case 'PRIMARY' : $ng [] = " CONSTRAINT " . idf_escape ( $sd ) . " PRIMARY KEY ( " . implode ( ', ' , array_map ( 'idf_escape' , $v [ 'columns' ])) . " ) " ; break ;}} foreach ( $Pc
as $Oc => $Nc ) $ng [] = " CONSTRAINT " . idf_escape ( $Oc ) . " $Nc[definition] " . ( $Nc [ 'deferrable' ] ? 'DEFERRABLE' : 'NOT DEFERRABLE' ); $J .= implode ( " , \n " , $ng ) . " \n ) WITH (oids = " . ( $P [ 'Oid' ] ? 'true' : 'false' ) . " ); " ; foreach ( $w
as $sd => $v ){ if ( $v [ 'type' ] == 'INDEX' ) $J .= " \n \n CREATE INDEX " . idf_escape ( $sd ) . " ON " . idf_escape ( $P [ 'nspname' ]) . " . " . idf_escape ( $P [ 'Name' ]) . " USING btree ( " . implode ( ', ' , array_map ( 'idf_escape' , $v [ 'columns' ])) . " ); " ;} if ( $P [ 'Comment' ]) $J .= " \n \n COMMENT ON TABLE " . idf_escape ( $P [ 'nspname' ]) . " . " . idf_escape ( $P [ 'Name' ]) . " IS " . q ( $P [ 'Comment' ]) . " ; " ; foreach ( $p
as $Ic => $o ){ if ( $o [ 'comment' ]) $J .= " \n \n COMMENT ON COLUMN " . idf_escape ( $P [ 'nspname' ]) . " . " . idf_escape ( $P [ 'Name' ]) . " . " . idf_escape ( $Ic ) . " IS " . q ( $o [ 'comment' ]) . " ; " ;} foreach ( $Oh
as $Kh => $Jh ){ $Lh = trigger ( $Kh , $P [ 'Name' ]); $J .= " \n \n CREATE TRIGGER " . idf_escape ( $Lh [ 'Trigger' ]) . " $Lh[Timing] $Lh[Events] ON " . idf_escape ( $P [ " nspname " ]) . " . " . idf_escape ( $P [ 'Name' ]) . " $Lh[Type] $Lh[Statement] ; " ;} return
rtrim ( $J , ';' );} function
trigger_sql ( $R , $Zg ){ $J = " " ; return
false ;} function
use_sql ( $k ){ return " \ connect " . idf_escape ( $k );} function
2014-04-01 18:00:42 +00:00
show_variables (){ return
get_key_vals ( " SHOW ALL " );} function
2017-04-21 11:23:04 +00:00
process_list (){ global $g ; return
get_rows ( " SELECT * FROM pg_stat_activity ORDER BY " . ( $g -> server_info < 9.2 ? " procpid " : " pid " ));} function
2014-04-01 18:00:42 +00:00
show_status (){} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ global $g ; return
preg_match ( '~^(database|table|columns|sql|indexes|comment|view|' . ( $g -> server_info >= 9.3 ? 'materializedview|' : '' ) . 'scheme|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~' , $Gc );} function
2016-10-11 12:23:21 +00:00
kill_process ( $X ){ return
queries ( " SELECT pg_terminate_backend( " . number ( $X ) . " ) " );} function
2017-04-21 11:23:04 +00:00
connection_id (){ return " SELECT pg_backend_pid() " ;} function
max_connections (){ global $g ; return $g -> result ( " SHOW max_connections " );} $x = " pgsql " ; $Rh = array (); $Yg = array (); foreach ( array ( lang ( 25 ) => array ( " smallint " => 5 , " integer " => 10 , " bigint " => 19 , " boolean " => 1 , " numeric " => 0 , " real " => 7 , " double precision " => 16 , " money " => 20 ), lang ( 26 ) => array ( " date " => 13 , " time " => 17 , " timestamp " => 20 , " timestamptz " => 21 , " interval " => 0 ), lang ( 23 ) => array ( " character " => 0 , " character varying " => 0 , " text " => 0 , " tsquery " => 0 , " tsvector " => 0 , " uuid " => 0 , " xml " => 0 ), lang ( 27 ) => array ( " bit " => 0 , " bit varying " => 0 , " bytea " => 0 ), lang ( 28 ) => array ( " cidr " => 43 , " inet " => 43 , " macaddr " => 17 , " txid_snapshot " => 0 ), lang ( 29 ) => array ( " box " => 0 , " circle " => 0 , " line " => 0 , " lseg " => 0 , " path " => 0 , " point " => 0 , " polygon " => 0 ),) as $y => $X ){ $Rh += $X ; $Yg [ $y ] = array_keys ( $X );} $Yh = array (); $Ye = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " ~ " , " !~ " , " LIKE " , " LIKE %% " , " ILIKE " , " ILIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " ); $Zc = array ( " char_length " , " lower " , " round " , " to_hex " , " to_timestamp " , " upper " ); $ed = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $gc = array ( array ( " char " => " md5 " , " date|time " => " now " ,), array ( " int|numeric|real|money " => " +/- " , " date|time " => " + interval/- interval " , " char|text " => " || " ,));} $Yb [ " oracle " ] = " Oracle " ; if ( isset ( $_GET [ " oracle " ])){ $Hf = array ( " OCI8 " , " PDO_OCI " ); define ( " DRIVER " , " oracle " ); if ( extension_loaded ( " oci8 " )){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " oci8 " , $_link , $_result , $server_info , $affected_rows , $errno , $error ; function
2017-04-21 11:23:04 +00:00
_error ( $rc , $n ){ if ( ini_bool ( " html_errors " )) $n = html_entity_decode ( strip_tags ( $n )); $n = preg_replace ( '~^[^:]*: ~' , '' , $n ); $this -> error = $n ;} function
2014-04-01 18:00:42 +00:00
connect ( $N , $V , $G ){ $this -> _link =@ oci_new_connect ( $V , $G , $N , " AL32UTF8 " ); if ( $this -> _link ){ $this -> server_info = oci_server_version ( $this -> _link ); return
2015-04-01 06:36:56 +00:00
true ;} $n = oci_error (); $this -> error = $n [ " message " ]; return
2014-04-01 18:00:42 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return " ' " . str_replace ( " ' " , " '' " , $Q ) . " ' " ;} function
select_db ( $k ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
query ( $H , $Sh = false ){ $I = oci_parse ( $this -> _link , $H ); $this -> error = " " ; if ( ! $I ){ $n = oci_error ( $this -> _link ); $this -> errno = $n [ " code " ]; $this -> error = $n [ " message " ]; return
2014-04-01 18:00:42 +00:00
false ;} set_error_handler ( array ( $this , '_error' )); $J =@ oci_execute ( $I ); restore_error_handler (); if ( $J ){ if ( oci_num_fields ( $I )) return
new
Min_Result ( $I ); $this -> affected_rows = oci_num_rows ( $I );} return $J ;} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 1 ){ $I = $this -> query ( $H ); if ( ! is_object ( $I ) ||! oci_fetch ( $I -> _result )) return
2014-04-01 18:00:42 +00:00
false ; return
2015-04-01 06:36:56 +00:00
oci_result ( $I -> _result , $o );}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $_result , $_offset = 1 , $num_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ;} function
2014-04-01 18:00:42 +00:00
_convert ( $K ){ foreach (( array ) $K
2017-04-21 11:23:04 +00:00
as $y => $X ){ if ( is_a ( $X , 'OCI-Lob' )) $K [ $y ] = $X -> load ();} return $K ;} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ return $this -> _convert ( oci_fetch_assoc ( $this -> _result ));} function
fetch_row (){ return $this -> _convert ( oci_fetch_row ( $this -> _result ));} function
2017-04-21 11:23:04 +00:00
fetch_field (){ $d = $this -> _offset ++ ; $J = new
stdClass ; $J -> name = oci_field_name ( $this -> _result , $d ); $J -> orgname = $J -> name ; $J -> type = oci_field_type ( $this -> _result , $d ); $J -> charsetnr = ( preg_match ( " ~raw|blob|bfile~ " , $J -> type ) ? 63 : 0 ); return $J ;} function
2014-04-01 18:00:42 +00:00
__destruct (){ oci_free_statement ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_oci " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_OCI " ; function
connect ( $N , $V , $G ){ $this -> dsn ( " oci:dbname=// $N ;charset=AL32UTF8 " , $V , $G ); return
true ;} function
2017-04-21 11:23:04 +00:00
select_db ( $k ){ return
2014-04-01 18:00:42 +00:00
true ;}}} class
Min_Driver
extends
Min_SQL { function
begin (){ return
true ;}} function
2017-04-21 11:23:04 +00:00
idf_escape ( $u ){ return '"' . str_replace ( '"' , '""' , $u ) . '"' ;} function
table ( $u ){ return
idf_escape ( $u );} function
connect (){ global $b ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])) return $g ; return $g -> error ;} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
get_vals ( " SELECT tablespace_name FROM user_tablespaces " );} function
2017-04-21 11:23:04 +00:00
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ return ( $D ? " * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $H $Z ) t WHERE rownum <= " . ( $z + $D ) . " ) WHERE rnum > $D " : ( $z !== null ? " * FROM (SELECT $H $Z ) WHERE rownum <= " . ( $z + $D ) : " $H $Z " ));} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ return " $H $Z " ;} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){ global $g ; return $g -> result ( " SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET' " );} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
logged_user (){ global $g ; return $g -> result ( " SELECT USER FROM DUAL " );} function
2014-04-01 18:00:42 +00: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
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2017-04-21 11:23:04 +00:00
table_status ( $C = " " ){ $J = array (); $zg = q ( $C ); foreach ( get_rows ( 'SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = ' . q ( DB ) . ( $C != " " ? " AND table_name = $zg " : " " ) . "
UNION SELECT view_name , 'view' , 0 , 0 FROM user_views " .( $C != " " ? " WHERE view_name = $zg " : " " ). "
2014-04-01 18:00:42 +00:00
ORDER BY 1 " )as $K ) { if( $C != " " )return $K ; $J[$K["Name"] ]= $K ;}return $J ;}function
2017-04-21 11:23:04 +00:00
is_view ( $S ){ return $S [ " Engine " ] == " view " ;} function
fk_support ( $S ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
fields ( $R ){ $J = array (); foreach ( get_rows ( " SELECT * FROM all_tab_columns WHERE table_name = " . q ( $R ) . " ORDER BY column_id " ) as $K ){ $U = $K [ " DATA_TYPE " ]; $be = " $K[DATA_PRECISION] , $K[DATA_SCALE] " ; if ( $be == " , " ) $be = $K [ " DATA_LENGTH " ]; $J [ $K [ " COLUMN_NAME " ]] = array ( " field " => $K [ " COLUMN_NAME " ], " full_type " => $U . ( $be ? " ( $be ) " : " " ), " type " => strtolower ( $U ), " length " => $be , " default " => $K [ " DATA_DEFAULT " ], " null " => ( $K [ " NULLABLE " ] == " Y " ), " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ),);} return $J ;} function
indexes ( $R , $h = null ){ $J = array (); foreach ( get_rows ( " SELECT uic.*, uc.constraint_type
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
WHERE uic . table_name = " .q( $R ). "
ORDER BY uc . constraint_type , uic . column_position " , $h )as $K ) { $sd = $K [ " INDEX_NAME " ]; $J [ $sd ][ " type " ] = ( $K [ " CONSTRAINT_TYPE " ] == " P " ? " PRIMARY " : ( $K [ " CONSTRAINT_TYPE " ] == " U " ? " UNIQUE " : " INDEX " )); $J [ $sd ][ " columns " ][] = $K [ " COLUMN_NAME " ]; $J [ $sd ][ " lengths " ][] = ( $K [ " CHAR_LENGTH " ] && $K [ " CHAR_LENGTH " ] != $K [ " COLUMN_LENGTH " ] ? $K [ " CHAR_LENGTH " ] : null ); $J [ $sd ][ " descs " ][] = ( $K [ " DESCEND " ] ? '1' : null ); } return $J ;}function
2014-04-01 18:00:42 +00:00
view ( $C ){ $L = get_rows ( 'SELECT text "select" FROM user_views WHERE view_name = ' . q ( $C )); return
reset ( $L );} function
collations (){ return
array ();} function
2015-04-01 06:36:56 +00:00
information_schema ( $m ){ return
2014-04-01 18:00:42 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
error (){ global $g ; return
h ( $g -> error );} function
explain ( $g , $H ){ $g -> query ( " EXPLAIN PLAN FOR $H " ); return $g -> query ( " SELECT * FROM plan_table " );} function
found_rows ( $S , $Z ){} function
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ $c = $Zb = array (); foreach ( $p
as $o ){ $X = $o [ 1 ]; if ( $X && $o [ 0 ] != " " && idf_escape ( $o [ 0 ]) != $X [ 0 ]) queries ( " ALTER TABLE " . table ( $R ) . " RENAME COLUMN " . idf_escape ( $o [ 0 ]) . " TO $X[0] " ); if ( $X ) $c [] = ( $R != " " ? ( $o [ 0 ] != " " ? " MODIFY ( " : " ADD ( " ) : " " ) . implode ( $X ) . ( $R != " " ? " ) " : " " ); else $Zb [] = idf_escape ( $o [ 0 ]);} if ( $R == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); return ( ! $c || queries ( " ALTER TABLE " . table ( $R ) . " \n " . implode ( " \n " , $c ))) && ( ! $Zb || queries ( " ALTER TABLE " . table ( $R ) . " DROP ( " . implode ( " , " , $Zb ) . " ) " )) && ( $R == $C || queries ( " ALTER TABLE " . table ( $R ) . " RENAME TO " . table ( $C )));} function
foreign_keys ( $R ){ $J = array (); $H = " SELECT c_list.CONSTRAINT_NAME as NAME,
2015-04-01 06:36:56 +00: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'
2017-04-21 11:23:04 +00:00
AND c_src . TABLE_NAME = " .q( $R );foreach(get_rows( $H )as $K ) $J[$K['NAME'] ]=array( " db " => $K['DEST_DB'] , " table " => $K['DEST_TABLE'] , " source " =>array( $K['SRC_COLUMN'] ), " target " =>array( $K['DEST_COLUMN'] ), " on_delete " => $K['ON_DELETE'] , " on_update " =>null,);return $J ;}function
truncate_tables ( $T ){ return
apply_queries ( " TRUNCATE TABLE " , $T );} function
drop_views ( $oi ){ return
apply_queries ( " DROP VIEW " , $oi );} function
drop_tables ( $T ){ return
apply_queries ( " DROP TABLE " , $T );} function
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
get_schema (){ global $g ; return $g -> result ( " SELECT sys_context('USERENV', 'SESSION_USER') FROM dual " );} function
set_schema ( $yg ){ global $g ; return $g -> query ( " ALTER SESSION SET CURRENT_SCHEMA = " . idf_escape ( $yg ));} function
2014-04-01 18:00:42 +00: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
show_status (){ $L = get_rows ( 'SELECT * FROM v$instance' ); return
reset ( $L );} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ return
preg_match ( '~^(columns|database|drop_col|indexes|processlist|scheme|sql|status|table|variables|view|view_trigger)$~' , $Gc );} $x = " oracle " ; $Rh = array (); $Yg = array (); foreach ( array ( lang ( 25 ) => array ( " number " => 38 , " binary_float " => 12 , " binary_double " => 21 ), lang ( 26 ) => array ( " date " => 10 , " timestamp " => 29 , " interval year " => 12 , " interval day " => 28 ), lang ( 23 ) => array ( " char " => 2000 , " varchar2 " => 4000 , " nchar " => 2000 , " nvarchar2 " => 4000 , " clob " => 4294967295 , " nclob " => 4294967295 ), lang ( 27 ) => array ( " raw " => 2000 , " long raw " => 2147483648 , " blob " => 4294967295 , " bfile " => 4294967296 ),) as $y => $X ){ $Rh += $X ; $Yg [ $y ] = array_keys ( $X );} $Yh = array (); $Ye = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT REGEXP " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Zc = array ( " length " , " lower " , " round " , " upper " ); $ed = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $gc = array ( array ( " date " => " current_date " , " timestamp " => " current_timestamp " ,), array ( " number|float|double " => " +/- " , " date|timestamp " => " + interval/- interval " , " char|clob " => " || " ,));} $Yb [ " mssql " ] = " MS SQL " ; if ( isset ( $_GET [ " mssql " ])){ $Hf = array ( " SQLSRV " , " MSSQL " , " PDO_DBLIB " ); define ( " DRIVER " , " mssql " ); if ( extension_loaded ( " sqlsrv " )){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " sqlsrv " , $_link , $_result , $server_info , $affected_rows , $errno , $error ; function
2015-04-01 06:36:56 +00:00
_get_error (){ $this -> error = " " ; foreach ( sqlsrv_errors () as $n ){ $this -> errno = $n [ " code " ]; $this -> error .= " $n[message] \n " ;} $this -> error = rtrim ( $this -> error );} function
2017-04-21 11:23:04 +00:00
connect ( $N , $V , $G ){ $this -> _link =@ sqlsrv_connect ( $N , array ( " UID " => $V , " PWD " => $G , " CharacterSet " => " UTF-8 " )); if ( $this -> _link ){ $wd = sqlsrv_server_info ( $this -> _link ); $this -> server_info = $wd [ 'SQLServerVersion' ];} else $this -> _get_error (); return ( bool ) $this -> _link ;} function
quote ( $Q ){ return " ' " . str_replace ( " ' " , " '' " , $Q ) . " ' " ;} function
select_db ( $k ){ return $this -> query ( " USE " . idf_escape ( $k ));} function
query ( $H , $Sh = false ){ $I = sqlsrv_query ( $this -> _link , $H ); $this -> error = " " ; if ( ! $I ){ $this -> _get_error (); return
2014-04-01 18:00:42 +00:00
false ;} return $this -> store_result ( $I );} function
multi_query ( $H ){ $this -> _result = sqlsrv_query ( $this -> _link , $H ); $this -> error = " " ; if ( ! $this -> _result ){ $this -> _get_error (); return
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
store_result ( $I = null ){ if ( ! $I ) $I = $this -> _result ; if ( ! $I ) return
false ; if ( sqlsrv_field_metadata ( $I )) return
2014-04-01 18:00:42 +00:00
new
Min_Result ( $I ); $this -> affected_rows = sqlsrv_rows_affected ( $I ); return
true ;} function
2015-04-01 06:36:56 +00:00
next_result (){ return $this -> _result ? sqlsrv_next_result ( $this -> _result ) : null ;} function
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! is_object ( $I )) return
false ; $K = $I -> fetch_row (); return $K [ $o ];}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $_result , $_offset = 0 , $_fields , $num_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ;} function
2014-04-01 18:00:42 +00:00
_convert ( $K ){ foreach (( array ) $K
2017-04-21 11:23:04 +00:00
as $y => $X ){ if ( is_a ( $X , 'DateTime' )) $K [ $y ] = $X -> format ( " Y-m-d H:i:s " );} return $K ;} function
fetch_assoc (){ return $this -> _convert ( sqlsrv_fetch_array ( $this -> _result , SQLSRV_FETCH_ASSOC ));} function
fetch_row (){ return $this -> _convert ( sqlsrv_fetch_array ( $this -> _result , SQLSRV_FETCH_NUMERIC ));} function
2015-04-01 06:36:56 +00:00
fetch_field (){ if ( ! $this -> _fields ) $this -> _fields = sqlsrv_field_metadata ( $this -> _result ); $o = $this -> _fields [ $this -> _offset ++ ]; $J = new
stdClass ; $J -> name = $o [ " Name " ]; $J -> orgname = $o [ " Name " ]; $J -> type = ( $o [ " Type " ] == 1 ? 254 : 0 ); return $J ;} function
seek ( $D ){ for ( $s = 0 ; $s < $D ; $s ++ ) sqlsrv_fetch ( $this -> _result );} function
2014-04-01 18:00:42 +00: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
connect ( $N , $V , $G ){ $this -> _link =@ mssql_connect ( $N , $V , $G ); if ( $this -> _link ){ $I = $this -> query ( " SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition') " ); $K = $I -> fetch_row (); $this -> server_info = $this -> result ( " sp_server_info 2 " , 2 ) . " [ $K[0] ] $K[1] " ;} else $this -> error = mssql_get_last_message (); return ( bool ) $this -> _link ;} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return " ' " . str_replace ( " ' " , " '' " , $Q ) . " ' " ;} function
select_db ( $k ){ return
mssql_select_db ( $k );} function
query ( $H , $Sh = false ){ $I =@ mssql_query ( $H , $this -> _link ); $this -> error = " " ; if ( ! $I ){ $this -> error = mssql_get_last_message (); return
2014-04-01 18:00:42 +00:00
false ;} if ( $I === true ){ $this -> affected_rows = mssql_rows_affected ( $this -> _link ); return
true ;} return
new
Min_Result ( $I );} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
2017-04-21 11:23:04 +00:00
mssql_next_result ( $this -> _result -> _result );} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! is_object ( $I )) return
2014-04-01 18:00:42 +00:00
false ; return
2015-04-01 06:36:56 +00:00
mssql_result ( $I -> _result , 0 , $o );}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $_result , $_offset = 0 , $_fields , $num_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ; $this -> num_rows = mssql_num_rows ( $I );} function
2014-04-01 18:00:42 +00: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
fetch_field (){ $J = mssql_fetch_field ( $this -> _result ); $J -> orgtable = $J -> table ; $J -> orgname = $J -> name ; return $J ;} function
seek ( $D ){ mssql_data_seek ( $this -> _result , $D );} function
2017-04-21 11:23:04 +00:00
__destruct (){ mssql_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_dblib " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_DBLIB " ; function
connect ( $N , $V , $G ){ $this -> dsn ( " dblib:charset=utf8;host= " . str_replace ( " : " , " ;unix_socket= " , preg_replace ( '~:(\\d)~' , ';port=\\1' , $N )), $V , $G ); return
true ;} function
select_db ( $k ){ return $this -> query ( " USE " . idf_escape ( $k ));}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
Min_SQL { function
2017-04-21 11:23:04 +00:00
insertUpdate ( $R , $L , $Kf ){ foreach ( $L
as $O ){ $Zh = array (); $Z = array (); foreach ( $O
as $y => $X ){ $Zh [] = " $y = $X " ; if ( isset ( $Kf [ idf_unescape ( $y )])) $Z [] = " $y = $X " ;} if ( ! queries ( " MERGE " . table ( $R ) . " USING (VALUES( " . implode ( " , " , $O ) . " )) AS source (c " . implode ( " , c " , range ( 1 , count ( $O ))) . " ) ON " . implode ( " AND " , $Z ) . " WHEN MATCHED THEN UPDATE SET " . implode ( " , " , $Zh ) . " WHEN NOT MATCHED THEN INSERT ( " . implode ( " , " , array_keys ( $O )) . " ) VALUES ( " . implode ( " , " , $O ) . " ); " )) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
begin (){ return
queries ( " BEGIN TRANSACTION " );}} function
2017-04-21 11:23:04 +00:00
idf_escape ( $u ){ return " [ " . str_replace ( " ] " , " ]] " , $u ) . " ] " ;} function
table ( $u ){ return ( $_GET [ " ns " ] != " " ? idf_escape ( $_GET [ " ns " ]) . " . " : " " ) . idf_escape ( $u );} function
connect (){ global $b ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])) return $g ; return $g -> error ;} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
2017-04-21 11:23:04 +00:00
get_vals ( " SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb') " );} function
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ return ( $z !== null ? " TOP ( " . ( $z + $D ) . " ) " : " " ) . " $H $Z " ;} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ return
limit ( $H , $Z , 1 );} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){ global $g ; return $g -> result ( " SELECT collation_name FROM sys.databases WHERE name = " . q ( $m ));} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
logged_user (){ global $g ; return $g -> result ( " SELECT SUSER_NAME() " );} function
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
count_tables ( $l ){ global $g ; $J = array (); foreach ( $l
as $m ){ $g -> select_db ( $m ); $J [ $m ] = $g -> result ( " SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " );} return $J ;} function
2014-04-01 18:00:42 +00:00
table_status ( $C = " " ){ $J = 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 $K ){ if ( $C != " " ) return $K ; $J [ $K [ " Name " ]] = $K ;} return $J ;} function
2017-04-21 11:23:04 +00:00
is_view ( $S ){ return $S [ " Engine " ] == " VIEW " ;} function
fk_support ( $S ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
fields ( $R ){ $J = array (); foreach ( get_rows ( " SELECT c.*, t.name type, d.definition [default]
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
WHERE o . schema_id = SCHEMA_ID ( " .q(get_schema()). " ) AND o . type IN ( 'S' , 'U' , 'V' ) AND o . name = " .q( $R ))as $K ) { $U = $K [ " type " ]; $be = ( preg_match ( " ~char|binary~ " , $U ) ? $K [ " max_length " ] : ( $U == " decimal " ? " $K[precision] , $K[scale] " : " " )); $J [ $K [ " name " ]] = array ( " field " => $K [ " name " ], " full_type " => $U . ( $be ? " ( $be ) " : " " ), " type " => $U , " length " => $be , " default " => $K [ " default " ], " null " => $K [ " is_nullable " ], " auto_increment " => $K [ " is_identity " ], " collation " => $K [ " collation_name " ], " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ), " primary " => $K [ " is_identity " ],); } return $J ;}function
indexes ( $R , $h = null ){ $J = array (); foreach ( get_rows ( " SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
WHERE OBJECT_NAME ( i . object_id ) = " .q( $R ), $h )as $K ) { $C = $K [ " name " ]; $J [ $C ][ " type " ] = ( $K [ " is_primary_key " ] ? " PRIMARY " : ( $K [ " is_unique " ] ? " UNIQUE " : " INDEX " )); $J [ $C ][ " lengths " ] = array (); $J [ $C ][ " columns " ][ $K [ " key_ordinal " ]] = $K [ " column_name " ]; $J [ $C ][ " descs " ][ $K [ " key_ordinal " ]] = ( $K [ " is_descending_key " ] ? '1' : null ); } return $J ;}function
view ( $C ){ global $g ; return
array ( " select " => preg_replace ( '~^(?:[^[]|\\[[^]]*])*\\s+AS\\s+~isU' , '' , $g -> result ( " SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = " . q ( $C ))));} function
collations (){ $J = array (); foreach ( get_vals ( " SELECT name FROM fn_helpcollations() " ) as $nb ) $J [ preg_replace ( '~_.*~' , '' , $nb )][] = $nb ; return $J ;} function
2015-04-01 06:36:56 +00:00
information_schema ( $m ){ return
2014-04-01 18:00:42 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
error (){ global $g ; return
nl_br ( h ( preg_replace ( '~^(\\[[^]]*])+~m' , '' , $g -> error )));} function
create_database ( $m , $nb ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( preg_match ( '~^[a-z0-9_]+$~i' , $nb ) ? " COLLATE $nb " : " " ));} function
2015-04-01 06:36:56 +00:00
drop_databases ( $l ){ return
queries ( " DROP DATABASE " . implode ( " , " , array_map ( 'idf_escape' , $l )));} function
2017-04-21 11:23:04 +00:00
rename_database ( $C , $nb ){ if ( preg_match ( '~^[a-z0-9_]+$~i' , $nb )) queries ( " ALTER DATABASE " . idf_escape ( DB ) . " COLLATE $nb " ); queries ( " ALTER DATABASE " . idf_escape ( DB ) . " MODIFY NAME = " . idf_escape ( $C )); return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
auto_increment (){ return " IDENTITY " . ( $_POST [ " Auto_increment " ] != " " ? " ( " . number ( $_POST [ " Auto_increment " ]) . " ,1) " : " " ) . " PRIMARY KEY " ;} function
2017-04-21 11:23:04 +00:00
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ $c = array (); foreach ( $p
as $o ){ $d = idf_escape ( $o [ 0 ]); $X = $o [ 1 ]; if ( ! $X ) $c [ " DROP " ][] = " COLUMN $d " ; else { $X [ 1 ] = preg_replace ( " ~( COLLATE )'( \\ w+)'~ " , " \\ 1 \\ 2 " , $X [ 1 ]); if ( $o [ 0 ] == " " ) $c [ " ADD " ][] = " \n " . implode ( " " , $X ) . ( $R == " " ? substr ( $Rc [ $X [ 0 ]], 16 + strlen ( $X [ 0 ])) : " " ); else { unset ( $X [ 6 ]); if ( $d != $X [ 0 ]) queries ( " EXEC sp_rename " . q ( table ( $R ) . " . $d " ) . " , " . q ( idf_unescape ( $X [ 0 ])) . " , 'COLUMN' " ); $c [ " ALTER COLUMN " . implode ( " " , $X )][] = " " ;}}} if ( $R == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( " . implode ( " , " ,( array ) $c [ " ADD " ]) . " \n ) " ); if ( $R != $C ) queries ( " EXEC sp_rename " . q ( table ( $R )) . " , " . q ( $C )); if ( $Rc ) $c [ " " ] = $Rc ; foreach ( $c
as $y => $X ){ if ( ! queries ( " ALTER TABLE " . idf_escape ( $C ) . " $y " . implode ( " , " , $X ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
alter_indexes ( $R , $c ){ $v = array (); $Zb = array (); foreach ( $c
as $X ){ if ( $X [ 2 ] == " DROP " ){ if ( $X [ 0 ] == " PRIMARY " ) $Zb [] = idf_escape ( $X [ 1 ]); else $v [] = idf_escape ( $X [ 1 ]) . " ON " . table ( $R );} elseif ( ! queries (( $X [ 0 ] != " PRIMARY " ? " CREATE $X[0] " . ( $X [ 0 ] != " INDEX " ? " INDEX " : " " ) . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $R . " _ " )) . " ON " . table ( $R ) : " ALTER TABLE " . table ( $R ) . " ADD PRIMARY KEY " ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " )) return
false ;} return ( ! $v || queries ( " DROP INDEX " . implode ( " , " , $v ))) && ( ! $Zb || queries ( " ALTER TABLE " . table ( $R ) . " DROP " . implode ( " , " , $Zb )));} function
last_id (){ global $g ; return $g -> result ( " SELECT SCOPE_IDENTITY() " );} function
explain ( $g , $H ){ $g -> query ( " SET SHOWPLAN_ALL ON " ); $J = $g -> query ( $H ); $g -> query ( " SET SHOWPLAN_ALL OFF " ); return $J ;} function
found_rows ( $S , $Z ){} function
foreign_keys ( $R ){ $J = array (); foreach ( get_rows ( " EXEC sp_fkeys @fktable_name = " . q ( $R )) as $K ){ $q =& $J [ $K [ " FK_NAME " ]]; $q [ " table " ] = $K [ " PKTABLE_NAME " ]; $q [ " source " ][] = $K [ " FKCOLUMN_NAME " ]; $q [ " target " ][] = $K [ " PKCOLUMN_NAME " ];} return $J ;} function
truncate_tables ( $T ){ return
apply_queries ( " TRUNCATE TABLE " , $T );} function
drop_views ( $oi ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $oi )));} function
drop_tables ( $T ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $T )));} function
move_tables ( $T , $oi , $oh ){ return
apply_queries ( " ALTER SCHEMA " . idf_escape ( $oh ) . " TRANSFER " , array_merge ( $T , $oi ));} function
2014-04-01 18:00:42 +00:00
trigger ( $C ){ if ( $C == " " ) return
array (); $L = get_rows ( " SELECT s.name [Trigger],
CASE WHEN OBJECTPROPERTY ( s . id , 'ExecIsInsertTrigger' ) = 1 THEN 'INSERT' WHEN OBJECTPROPERTY ( s . id , 'ExecIsUpdateTrigger' ) = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY ( s . id , 'ExecIsDeleteTrigger' ) = 1 THEN 'DELETE' END [ Event ],
CASE WHEN OBJECTPROPERTY ( s . id , 'ExecIsInsteadOfTrigger' ) = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [ Timing ],
c . text
FROM sysobjects s
JOIN syscomments c ON s . id = c . id
WHERE s . xtype = 'TR' AND s . name = " .q( $C )); $J =reset( $L );if( $J ) $J["Statement"] =preg_replace('~^.+ \\ s+AS \\ s+~isU','', $J["text"] );return $J ;}function
2017-04-21 11:23:04 +00:00
triggers ( $R ){ $J = array (); foreach ( get_rows ( " SELECT sys1.name,
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
WHERE sys1 . xtype = 'TR' AND sys2 . name = " .q( $R ))as $K ) $J[$K["name"] ]=array( $K["Timing"] , $K["Event"] );return $J ;}function
2014-04-01 18:00:42 +00:00
trigger_options (){ return
2015-04-01 06:36:56 +00:00
array ( " Timing " => array ( " AFTER " , " INSTEAD OF " ), " Event " => array ( " INSERT " , " UPDATE " , " DELETE " ), " Type " => array ( " AS " ),);} function
2014-04-01 18:00:42 +00:00
schemas (){ return
get_vals ( " SELECT name FROM sys.schemas " );} function
2017-04-21 11:23:04 +00:00
get_schema (){ global $g ; if ( $_GET [ " ns " ] != " " ) return $_GET [ " ns " ]; return $g -> result ( " SELECT SCHEMA_NAME() " );} function
set_schema ( $xg ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
use_sql ( $k ){ return " USE " . idf_escape ( $k );} function
2014-04-01 18:00:42 +00:00
show_variables (){ return
array ();} function
show_status (){ return
array ();} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ return
preg_match ( '~^(columns|database|drop_col|indexes|scheme|sql|table|trigger|view|view_trigger)$~' , $Gc );} $x = " mssql " ; $Rh = array (); $Yg = array (); foreach ( array ( lang ( 25 ) => array ( " tinyint " => 3 , " smallint " => 5 , " int " => 10 , " bigint " => 20 , " bit " => 1 , " decimal " => 0 , " real " => 12 , " float " => 53 , " smallmoney " => 10 , " money " => 20 ), lang ( 26 ) => array ( " date " => 10 , " smalldatetime " => 19 , " datetime " => 19 , " datetime2 " => 19 , " time " => 8 , " datetimeoffset " => 10 ), lang ( 23 ) => array ( " char " => 8000 , " varchar " => 8000 , " text " => 2147483647 , " nchar " => 4000 , " nvarchar " => 4000 , " ntext " => 1073741823 ), lang ( 27 ) => array ( " binary " => 8000 , " varbinary " => 8000 , " image " => 2147483647 ),) as $y => $X ){ $Rh += $X ; $Yg [ $y ] = array_keys ( $X );} $Yh = array (); $Ye = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " ); $Zc = array ( " len " , " lower " , " round " , " upper " ); $ed = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $gc = array ( array ( " date|time " => " getdate " ,), array ( " int|decimal|real|float|money|datetime " => " +/- " , " char|text " => " + " ,));} $Yb [ 'firebird' ] = 'Firebird (alpha)' ; if ( isset ( $_GET [ " firebird " ])){ $Hf = array ( " interbase " ); define ( " DRIVER " , " firebird " ); if ( extension_loaded ( " interbase " )){ class
2015-04-01 06:36:56 +00:00
Min_DB { var $extension = " Firebird " , $server_info , $affected_rows , $errno , $error , $_link , $_result ; function
2017-04-21 11:23:04 +00:00
connect ( $N , $V , $G ){ $this -> _link = ibase_connect ( $N , $V , $G ); if ( $this -> _link ){ $bi = explode ( ':' , $N ); $this -> service_link = ibase_service_attach ( $bi [ 0 ], $V , $G ); $this -> server_info = ibase_server_info ( $this -> service_link , IBASE_SVC_SERVER_VERSION );} else { $this -> errno = ibase_errcode (); $this -> error = ibase_errmsg ();} return ( bool ) $this -> _link ;} function
quote ( $Q ){ return " ' " . str_replace ( " ' " , " '' " , $Q ) . " ' " ;} function
select_db ( $k ){ return ( $k == " domain " );} function
query ( $H , $Sh = false ){ $I = ibase_query ( $H , $this -> _link ); if ( ! $I ){ $this -> errno = ibase_errcode (); $this -> error = ibase_errmsg (); return
2015-04-01 06:36:56 +00:00
false ;} $this -> error = " " ; if ( $I === true ){ $this -> affected_rows = ibase_affected_rows ( $this -> _link ); return
true ;} return
new
Min_Result ( $I );} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! $I ||! $I -> num_rows ) return
false ; $K = $I -> fetch_row (); return $K [ $o ];}} class
Min_Result { var $num_rows , $_result , $_offset = 0 ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ;} function
2015-04-01 06:36:56 +00:00
fetch_assoc (){ return
ibase_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
ibase_fetch_row ( $this -> _result );} function
fetch_field (){ $o = ibase_field_info ( $this -> _result , $this -> _offset ++ ); return ( object ) array ( 'name' => $o [ 'name' ], 'orgname' => $o [ 'name' ], 'type' => $o [ 'type' ], 'charsetnr' => $o [ 'length' ],);} function
__destruct (){ ibase_free_result ( $this -> _result );}}} class
Min_Driver
extends
Min_SQL {} function
2017-04-21 11:23:04 +00:00
idf_escape ( $u ){ return '"' . str_replace ( '"' , '""' , $u ) . '"' ;} function
table ( $u ){ return
idf_escape ( $u );} function
connect (){ global $b ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])) return $g ; return $g -> error ;} function
get_databases ( $Qc ){ return
2015-04-01 06:36:56 +00:00
array ( " domain " );} function
2017-04-21 11:23:04 +00:00
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ $J = '' ; $J .= ( $z !== null ? $Dg . " FIRST $z " . ( $D ? " SKIP $D " : " " ) : " " ); $J .= " $H $Z " ; return $J ;} function
2015-04-01 06:36:56 +00:00
limit1 ( $H , $Z ){ return
limit ( $H , $Z , 1 );} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){} function
2015-04-01 06:36:56 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
logged_user (){ global $b ; $j = $b -> credentials (); return $j [ 1 ];} function
tables_list (){ global $g ; $H = 'SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0' ; $I = ibase_query ( $g -> _link , $H ); $J = array (); while ( $K = ibase_fetch_assoc ( $I )) $J [ $K [ 'RDB$RELATION_NAME' ]] = 'table' ; ksort ( $J ); return $J ;} function
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ return
array ();} function
2017-04-21 11:23:04 +00:00
table_status ( $C = " " , $Fc = false ){ global $g ; $J = array (); $Gb = tables_list (); foreach ( $Gb
as $v => $X ){ $v = trim ( $v ); $J [ $v ] = array ( 'Name' => $v , 'Engine' => 'standard' ,); if ( $C == $v ) return $J [ $v ];} return $J ;} function
is_view ( $S ){ return
2015-04-01 06:36:56 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
fk_support ( $S ){ return
preg_match ( '~InnoDB|IBMDB2I~i' , $S [ " Engine " ]);} function
fields ( $R ){ global $g ; $J = array (); $H = ' SELECT r . RDB $FIELD_NAME AS field_name ,
2015-04-01 06:36:56 +00: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
2017-04-21 11:23:04 +00:00
WHERE r . RDB $RELATION_NAME = '.q($R).'
ORDER BY r . RDB $FIELD_POSITION ';$I=ibase_query($g->_link,$H);while($K=ibase_fetch_assoc($I))$J[trim($K[' FIELD_NAME '])]=array("field"=>trim($K["FIELD_NAME"]),"full_type"=>trim($K["FIELD_TYPE"]),"type"=>trim($K["FIELD_SUB_TYPE"]),"default"=>trim($K[' FIELD_DEFAULT_VALUE ']),"null"=>(trim($K["FIELD_NOT_NULL_CONSTRAINT"])=="YES"),"auto_increment"=>' 0 ' , " collation " => trim ( $K [ " FIELD_COLLATION " ]), " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ), " comment " => trim ( $K [ " FIELD_DESCRIPTION " ]),); return $J ;} function
indexes ( $R , $h = null ){ $J = array (); return $J ;} function
foreign_keys ( $R ){ return
2015-04-01 06:36:56 +00:00
array ();} function
collations (){ return
array ();} function
information_schema ( $m ){ return
false ;} function
2017-04-21 11:23:04 +00:00
error (){ global $g ; return
h ( $g -> error );} function
2015-04-01 06:36:56 +00:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2017-04-21 11:23:04 +00:00
set_schema ( $xg ){ return
2015-04-01 06:36:56 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ return
preg_match ( " ~^(columns|sql|status|table) $ ~ " , $Gc );} $x = " firebird " ; $Ye = array ( " = " ); $Zc = array (); $ed = array (); $gc = array ();} $Yb [ " simpledb " ] = " SimpleDB " ; if ( isset ( $_GET [ " simpledb " ])){ $Hf = array ( " SimpleXML " ); define ( " DRIVER " , " simpledb " ); if ( class_exists ( 'SimpleXMLElement' )){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " SimpleXML " , $server_info = '2009-04-15' , $error , $timeout , $next , $affected_rows , $_result ; function
2017-04-21 11:23:04 +00:00
select_db ( $k ){ return ( $k == " domain " );} function
query ( $H , $Sh = false ){ $F = array ( 'SelectExpression' => $H , 'ConsistentRead' => 'true' ); if ( $this -> next ) $F [ 'NextToken' ] = $this -> next ; $I = sdb_request_all ( 'Select' , 'Item' , $F , $this -> timeout ); if ( $I === false ) return $I ; if ( preg_match ( '~^\s*SELECT\s+COUNT\(~i' , $H )){ $ch = 0 ; foreach ( $I
as $Id ) $ch += $Id -> Attribute -> Value ; $I = array (( object ) array ( 'Attribute' => array (( object ) array ( 'Name' => 'Count' , 'Value' => $ch ,))));} return
2014-04-01 18:00:42 +00:00
new
Min_Result ( $I );} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return " ' " . str_replace ( " ' " , " '' " , $Q ) . " ' " ;}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ foreach ( $I
2017-04-21 11:23:04 +00:00
as $Id ){ $K = array (); if ( $Id -> Name != '' ) $K [ 'itemName()' ] = ( string ) $Id -> Name ; foreach ( $Id -> Attribute
2015-04-01 06:36:56 +00:00
as $Ia ){ $C = $this -> _processValue ( $Ia -> Name ); $Y = $this -> _processValue ( $Ia -> Value ); if ( isset ( $K [ $C ])){ $K [ $C ] = ( array ) $K [ $C ]; $K [ $C ][] = $Y ;} else $K [ $C ] = $Y ;} $this -> _rows [] = $K ; foreach ( $K
2017-04-21 11:23:04 +00:00
as $y => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $y ])) $this -> _rows [ 0 ][ $y ] = null ;}} $this -> num_rows = count ( $this -> _rows );} function
_processValue ( $jc ){ return ( is_object ( $jc ) && $jc [ 'encoding' ] == 'base64' ? base64_decode ( $jc ) : ( string ) $jc );} function
fetch_assoc (){ $K = current ( $this -> _rows ); if ( ! $K ) return $K ; $J = array (); foreach ( $this -> _rows [ 0 ] as $y => $X ) $J [ $y ] = $K [ $y ]; next ( $this -> _rows ); return $J ;} function
2014-04-01 18:00:42 +00:00
fetch_row (){ $J = $this -> fetch_assoc (); if ( ! $J ) return $J ; return
array_values ( $J );} function
2017-04-21 11:23:04 +00:00
fetch_field (){ $Od = array_keys ( $this -> _rows [ 0 ]); return ( object ) array ( 'name' => $Od [ $this -> _offset ++ ]);}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
2017-04-21 11:23:04 +00:00
Min_SQL { public $Kf = " itemName() " ; function
_chunkRequest ( $pd , $va , $F , $zc = array ()){ global $g ; foreach ( array_chunk ( $pd , 25 ) as $gb ){ $rf = $F ; foreach ( $gb
as $s => $t ){ $rf [ " Item. $s .ItemName " ] = $t ; foreach ( $zc
as $y => $X ) $rf [ " Item. $s . $y " ] = $X ;} if ( ! sdb_request ( $va , $rf )) return
false ;} $g -> affected_rows = count ( $pd ); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
_extractIds ( $R , $Vf , $z ){ $J = array (); if ( preg_match_all ( " ~itemName \ ( \ ) = (('[^']*+')+)~ " , $Vf , $ke )) $J = array_map ( 'idf_unescape' , $ke [ 1 ]); else { foreach ( sdb_request_all ( 'Select' , 'Item' , array ( 'SelectExpression' => 'SELECT itemName() FROM ' . table ( $R ) . $Vf . ( $z ? " LIMIT 1 " : " " ))) as $Id ) $J [] = $Id -> Name ;} return $J ;} function
select ( $R , $M , $Z , $cd , $df = array (), $z = 1 , $E = 0 , $Mf = false ){ global $g ; $g -> next = $_GET [ " next " ]; $J = parent :: select ( $R , $M , $Z , $cd , $df , $z , $E , $Mf ); $g -> next = 0 ; return $J ;} function
delete ( $R , $Vf , $z = 0 ){ return $this -> _chunkRequest ( $this -> _extractIds ( $R , $Vf , $z ), 'BatchDeleteAttributes' , array ( 'DomainName' => $R ));} function
update ( $R , $O , $Vf , $z = 0 , $Dg = " \n " ){ $Nb = array (); $_d = array (); $s = 0 ; $pd = $this -> _extractIds ( $R , $Vf , $z ); $t = idf_unescape ( $O [ " `itemName()` " ]); unset ( $O [ " `itemName()` " ]); foreach ( $O
as $y => $X ){ $y = idf_unescape ( $y ); if ( $X == " NULL " || ( $t != " " && array ( $t ) != $pd )) $Nb [ " Attribute. " . count ( $Nb ) . " .Name " ] = $y ; if ( $X != " NULL " ){ foreach (( array ) $X
as $Kd => $W ){ $_d [ " Attribute. $s .Name " ] = $y ; $_d [ " Attribute. $s .Value " ] = ( is_array ( $X ) ? $W : idf_unescape ( $W )); if ( ! $Kd ) $_d [ " Attribute. $s .Replace " ] = " true " ; $s ++ ;}}} $F = array ( 'DomainName' => $R ); return ( ! $_d || $this -> _chunkRequest (( $t != " " ? array ( $t ) : $pd ), 'BatchPutAttributes' , $F , $_d )) && ( ! $Nb || $this -> _chunkRequest ( $pd , 'BatchDeleteAttributes' , $F , $Nb ));} function
insert ( $R , $O ){ $F = array ( " DomainName " => $R ); $s = 0 ; foreach ( $O
2014-04-01 18:00:42 +00:00
as $C => $Y ){ if ( $Y != " NULL " ){ $C = idf_unescape ( $C ); if ( $C == " itemName() " ) $F [ " ItemName " ] = idf_unescape ( $Y ); else { foreach (( array ) $Y
2015-04-01 06:36:56 +00:00
as $X ){ $F [ " Attribute. $s .Name " ] = $C ; $F [ " Attribute. $s .Value " ] = ( is_array ( $Y ) ? $X : idf_unescape ( $Y )); $s ++ ;}}}} return
2014-04-01 18:00:42 +00:00
sdb_request ( 'PutAttributes' , $F );} function
2017-04-21 11:23:04 +00:00
insertUpdate ( $R , $L , $Kf ){ foreach ( $L
as $O ){ if ( ! $this -> update ( $R , $O , " WHERE `itemName()` = " . q ( $O [ " `itemName()` " ]))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
begin (){ return
false ;} function
commit (){ return
false ;} function
rollback (){ return
false ;}} function
connect (){ return
new
Min_DB ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ return
preg_match ( '~sql~' , $Gc );} function
logged_user (){ global $b ; $j = $b -> credentials (); return $j [ 1 ];} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
array ( " domain " );} function
collations (){ return
array ();} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){} function
tables_list (){ global $g ; $J = array (); foreach ( sdb_request_all ( 'ListDomains' , 'DomainName' ) as $R ) $J [( string ) $R ] = 'table' ; if ( $g -> error && defined ( " PAGE_HEADER " )) echo " <p class='error'> " . error () . " \n " ; return $J ;} function
table_status ( $C = " " , $Fc = false ){ $J = array (); foreach (( $C != " " ? array ( $C => true ) : tables_list ()) as $R => $U ){ $K = array ( " Name " => $R , " Auto_increment " => " " ); if ( ! $Fc ){ $xe = sdb_request ( 'DomainMetadata' , array ( 'DomainName' => $R )); if ( $xe ){ foreach ( array ( " Rows " => " ItemCount " , " Data_length " => " ItemNamesSizeBytes " , " Index_length " => " AttributeValuesSizeBytes " , " Data_free " => " AttributeNamesSizeBytes " ,) as $y => $X ) $K [ $y ] = ( string ) $xe -> $X ;}} if ( $C != " " ) return $K ; $J [ $R ] = $K ;} return $J ;} function
explain ( $g , $H ){} function
error (){ global $g ; return
h ( $g -> error );} function
2014-04-01 18:00:42 +00:00
information_schema (){} function
2017-04-21 11:23:04 +00:00
is_view ( $S ){} function
indexes ( $R , $h = null ){ return
2014-04-01 18:00:42 +00:00
array ( array ( " type " => " PRIMARY " , " columns " => array ( " itemName() " )),);} function
2017-04-21 11:23:04 +00:00
fields ( $R ){ return
2014-04-01 18:00:42 +00:00
fields_from_edit ();} function
2017-04-21 11:23:04 +00:00
foreign_keys ( $R ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2017-04-21 11:23:04 +00:00
table ( $u ){ return
idf_escape ( $u );} function
idf_escape ( $u ){ return " ` " . str_replace ( " ` " , " `` " , $u ) . " ` " ;} function
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ return " $H $Z " . ( $z !== null ? $Dg . " LIMIT $z " : " " );} function
2015-04-01 06:36:56 +00:00
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
fk_support ( $S ){} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ return ( $R == " " && sdb_request ( 'CreateDomain' , array ( 'DomainName' => $C )));} function
drop_tables ( $T ){ foreach ( $T
as $R ){ if ( ! sdb_request ( 'DeleteDomain' , array ( 'DomainName' => $R ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ foreach ( $l
as $m ) return
array ( $m => count ( tables_list ()));} function
2017-04-21 11:23:04 +00:00
found_rows ( $S , $Z ){ return ( $Z ? null : $S [ " Rows " ]);} function
2014-04-01 18:00:42 +00:00
last_id (){} function
2017-04-21 11:23:04 +00:00
hmac ( $Ba , $Gb , $y , $Zf = false ){ $Ua = 64 ; if ( strlen ( $y ) > $Ua ) $y = pack ( " H* " , $Ba ( $y )); $y = str_pad ( $y , $Ua , " \0 " ); $Ld = $y ^ str_repeat ( " \x36 " , $Ua ); $Md = $y ^ str_repeat ( " \x5C " , $Ua ); $J = $Ba ( $Md . pack ( " H* " , $Ba ( $Ld . $Gb ))); if ( $Zf ) $J = pack ( " H* " , $J ); return $J ;} function
sdb_request ( $va , $F = array ()){ global $b , $g ; list ( $md , $F [ 'AWSAccessKeyId' ], $_g ) = $b -> credentials (); $F [ 'Action' ] = $va ; $F [ 'Timestamp' ] = gmdate ( 'Y-m-d\TH:i:s+00:00' ); $F [ 'Version' ] = '2009-04-15' ; $F [ 'SignatureVersion' ] = 2 ; $F [ 'SignatureMethod' ] = 'HmacSHA1' ; ksort ( $F ); $H = '' ; foreach ( $F
as $y => $X ) $H .= '&' . rawurlencode ( $y ) . '=' . rawurlencode ( $X ); $H = str_replace ( '%7E' , '~' , substr ( $H , 1 )); $H .= " &Signature= " . urlencode ( base64_encode ( hmac ( 'sha1' , " POST \n " . preg_replace ( '~^https?://~' , '' , $md ) . " \n / \n $H " , $_g , true ))); @ ini_set ( 'track_errors' , 1 ); $Jc =@ file_get_contents (( preg_match ( '~^https?://~' , $md ) ? $md : " http:// $md " ), false , stream_context_create ( array ( 'http' => array ( 'method' => 'POST' , 'content' => $H , 'ignore_errors' => 1 ,)))); if ( ! $Jc ){ $g -> error = $php_errormsg ; return
false ;} libxml_use_internal_errors ( true ); $ui = simplexml_load_string ( $Jc ); if ( ! $ui ){ $n = libxml_get_last_error (); $g -> error = $n -> message ; return
false ;} if ( $ui -> Errors ){ $n = $ui -> Errors -> Error ; $g -> error = " $n->Message ( $n->Code ) " ; return
false ;} $g -> error = '' ; $nh = $va . " Result " ; return ( $ui -> $nh ? $ui -> $nh : true );} function
sdb_request_all ( $va , $nh , $F = array (), $wh = 0 ){ $J = array (); $Vg = ( $wh ? microtime ( true ) : 0 ); $z = ( preg_match ( '~LIMIT\s+(\d+)\s*$~i' , $F [ 'SelectExpression' ], $B ) ? $B [ 1 ] : 0 ); do { $ui = sdb_request ( $va , $F ); if ( ! $ui ) break ; foreach ( $ui -> $nh
as $jc ) $J [] = $jc ; if ( $z && count ( $J ) >= $z ){ $_GET [ " next " ] = $ui -> NextToken ; break ;} if ( $wh && microtime ( true ) - $Vg > $wh ) return
false ; $F [ 'NextToken' ] = $ui -> NextToken ; if ( $z ) $F [ 'SelectExpression' ] = preg_replace ( '~\d+\s*$~' , $z - count ( $J ), $F [ 'SelectExpression' ]);} while ( $ui -> NextToken ); return $J ;} $x = " simpledb " ; $Ye = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " IS NOT NULL " ); $Zc = array (); $ed = array ( " count " ); $gc = array ( array ( " json " ));} $Yb [ " mongo " ] = " MongoDB (beta) " ; if ( isset ( $_GET [ " mongo " ])){ $Hf = array ( " mongo " ); define ( " DRIVER " , " mongo " ); if ( class_exists ( 'MongoDB' )){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " Mongo " , $error , $last_id , $_link , $_db ; function
2017-04-21 11:23:04 +00:00
connect ( $N , $V , $G ){ global $b ; $m = $b -> database (); $bf = array (); if ( $V != " " ){ $bf [ " username " ] = $V ; $bf [ " password " ] = $G ;} if ( $m != " " ) $bf [ " db " ] = $m ; try { $this -> _link =@ new
MongoClient ( " mongodb:// $N " , $bf ); return
true ;} catch ( Exception $vc ){ $this -> error = $vc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;}} function
query ( $H ){ return
false ;} function
2017-04-21 11:23:04 +00:00
select_db ( $k ){ try { $this -> _db = $this -> _link -> selectDB ( $k ); return
true ;} catch ( Exception $vc ){ $this -> error = $vc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;}} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return $Q ;}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 , $_charset = array (); function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ foreach ( $I
2017-04-21 11:23:04 +00:00
as $Id ){ $K = array (); foreach ( $Id
as $y => $X ){ if ( is_a ( $X , 'MongoBinData' )) $this -> _charset [ $y ] = 63 ; $K [ $y ] = ( is_a ( $X , 'MongoId' ) ? 'ObjectId("' . strval ( $X ) . '")' : ( is_a ( $X , 'MongoDate' ) ? gmdate ( " Y-m-d H:i:s " , $X -> sec ) . " GMT " : ( is_a ( $X , 'MongoBinData' ) ? $X -> bin : ( is_a ( $X , 'MongoRegex' ) ? strval ( $X ) : ( is_object ( $X ) ? get_class ( $X ) : $X )))));} $this -> _rows [] = $K ; foreach ( $K
as $y => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $y ])) $this -> _rows [ 0 ][ $y ] = null ;}} $this -> num_rows = count ( $this -> _rows );} function
fetch_assoc (){ $K = current ( $this -> _rows ); if ( ! $K ) return $K ; $J = array (); foreach ( $this -> _rows [ 0 ] as $y => $X ) $J [ $y ] = $K [ $y ]; next ( $this -> _rows ); return $J ;} function
2014-04-01 18:00:42 +00:00
fetch_row (){ $J = $this -> fetch_assoc (); if ( ! $J ) return $J ; return
array_values ( $J );} function
2017-04-21 11:23:04 +00:00
fetch_field (){ $Od = array_keys ( $this -> _rows [ 0 ]); $C = $Od [ $this -> _offset ++ ]; return ( object ) array ( 'name' => $C , 'charsetnr' => $this -> _charset [ $C ],);}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
2017-04-21 11:23:04 +00:00
Min_SQL { public $Kf = " _id " ; function
select ( $R , $M , $Z , $cd , $df = array (), $z = 1 , $E = 0 , $Mf = false ){ $M = ( $M == array ( " * " ) ? array () : array_fill_keys ( $M , true )); $Pg = array (); foreach ( $df
as $X ){ $X = preg_replace ( '~ DESC$~' , '' , $X , 1 , $Bb ); $Pg [ $X ] = ( $Bb ? - 1 : 1 );} return
2014-04-01 18:00:42 +00:00
new
2017-04-21 11:23:04 +00:00
Min_Result ( $this -> _conn -> _db -> selectCollection ( $R ) -> find ( array (), $M ) -> sort ( $Pg ) -> limit ( + $z ) -> skip ( $E * $z ));} function
insert ( $R , $O ){ try { $J = $this -> _conn -> _db -> selectCollection ( $R ) -> insert ( $O ); $this -> _conn -> errno = $J [ 'code' ]; $this -> _conn -> error = $J [ 'err' ]; $this -> _conn -> last_id = $O [ '_id' ]; return ! $J [ 'err' ];} catch ( Exception $vc ){ $this -> _conn -> error = $vc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;}}} function
2017-04-21 11:23:04 +00:00
connect (){ global $b ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])) return $g ; return $g -> error ;} function
error (){ global $g ; return
h ( $g -> error );} function
logged_user (){ global $b ; $j = $b -> credentials (); return $j [ 1 ];} function
get_databases ( $Qc ){ global $g ; $J = array (); $Kb = $g -> _link -> listDBs (); foreach ( $Kb [ 'databases' ] as $m ) $J [] = $m [ 'name' ]; return $J ;} function
2014-04-01 18:00:42 +00:00
collations (){ return
array ();} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){} function
count_tables ( $l ){ global $g ; $J = array (); foreach ( $l
as $m ) $J [ $m ] = count ( $g -> _link -> selectDB ( $m ) -> getCollectionNames ( true )); return $J ;} function
tables_list (){ global $g ; return
array_fill_keys ( $g -> _db -> getCollectionNames ( true ), 'table' );} function
table_status ( $C = " " , $Fc = false ){ $J = array (); foreach ( tables_list () as $R => $U ){ $J [ $R ] = array ( " Name " => $R ); if ( $C == $R ) return $J [ $R ];} return $J ;} function
2014-04-01 18:00:42 +00:00
information_schema (){} function
2017-04-21 11:23:04 +00:00
is_view ( $S ){} function
drop_databases ( $l ){ global $g ; foreach ( $l
as $m ){ $kg = $g -> _link -> selectDB ( $m ) -> drop (); if ( ! $kg [ 'ok' ]) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
indexes ( $R , $h = null ){ global $g ; $J = array (); foreach ( $g -> _db -> selectCollection ( $R ) -> getIndexInfo () as $v ){ $Qb = array (); foreach ( $v [ " key " ] as $d => $U ) $Qb [] = ( $U ==- 1 ? '1' : null ); $J [ $v [ " name " ]] = array ( " type " => ( $v [ " name " ] == " _id_ " ? " PRIMARY " : ( $v [ " unique " ] ? " UNIQUE " : " INDEX " )), " columns " => array_keys ( $v [ " key " ]), " lengths " => array (), " descs " => $Qb ,);} return $J ;} function
fields ( $R ){ return
2014-04-01 18:00:42 +00:00
fields_from_edit ();} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
foreign_keys ( $R ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2017-04-21 11:23:04 +00:00
fk_support ( $S ){} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
found_rows ( $S , $Z ){ global $g ; return $g -> _db -> selectCollection ( $_GET [ " select " ]) -> count ( $Z );} function
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ global $g ; if ( $R == " " ){ $g -> _db -> createCollection ( $C ); return
2014-04-01 18:00:42 +00:00
true ;}} function
2017-04-21 11:23:04 +00:00
drop_tables ( $T ){ global $g ; foreach ( $T
as $R ){ $kg = $g -> _db -> selectCollection ( $R ) -> drop (); if ( ! $kg [ 'ok' ]) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
truncate_tables ( $T ){ global $g ; foreach ( $T
as $R ){ $kg = $g -> _db -> selectCollection ( $R ) -> remove (); if ( ! $kg [ 'ok' ]) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2017-04-21 11:23:04 +00:00
alter_indexes ( $R , $c ){ global $g ; foreach ( $c
as $X ){ list ( $U , $C , $O ) = $X ; if ( $O == " DROP " ) $J = $g -> _db -> command ( array ( " deleteIndexes " => $R , " index " => $C )); else { $e = array (); foreach ( $O
as $d ){ $d = preg_replace ( '~ DESC$~' , '' , $d , 1 , $Bb ); $e [ $d ] = ( $Bb ? - 1 : 1 );} $J = $g -> _db -> selectCollection ( $R ) -> ensureIndex ( $e , array ( " unique " => ( $U == " UNIQUE " ), " name " => $C ,));} if ( $J [ 'errmsg' ]){ $g -> error = $J [ 'errmsg' ]; return
2014-04-01 18:00:42 +00:00
false ;}} return
true ;} function
2017-04-21 11:23:04 +00:00
last_id (){ global $g ; return $g -> last_id ;} function
table ( $u ){ return $u ;} function
idf_escape ( $u ){ return $u ;} function
support ( $Gc ){ return
preg_match ( " ~database|indexes~ " , $Gc );} $x = " mongo " ; $Ye = array ( " = " ); $Zc = array (); $ed = array (); $gc = array ( array ( " json " ));} $Yb [ " elastic " ] = " Elasticsearch (beta) " ; if ( isset ( $_GET [ " elastic " ])){ $Hf = array ( " json " ); define ( " DRIVER " , " elastic " ); if ( function_exists ( 'json_decode' )){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " JSON " , $server_info , $errno , $error , $_url ; function
2017-04-21 11:23:04 +00:00
rootQuery ( $zf , $xb = array (), $ye = 'GET' ){ @ ini_set ( 'track_errors' , 1 ); $Jc =@ file_get_contents ( $this -> _url . '/' . ltrim ( $zf , '/' ), false , stream_context_create ( array ( 'http' => array ( 'method' => $ye , 'content' => json_encode ( $xb ), 'ignore_errors' => 1 ,)))); if ( ! $Jc ){ $this -> error = $php_errormsg ; return $Jc ;} if ( ! preg_match ( '~^HTTP/[0-9.]+ 2~i' , $http_response_header [ 0 ])){ $this -> error = $Jc ; return
false ;} $J = json_decode ( $Jc , true ); if ( $J === null ){ $this -> errno = json_last_error (); if ( function_exists ( 'json_last_error_msg' )) $this -> error = json_last_error_msg (); else { $wb = get_defined_constants ( true ); foreach ( $wb [ 'json' ] as $C => $Y ){ if ( $Y == $this -> errno && preg_match ( '~^JSON_ERROR_~' , $C )){ $this -> error = $C ; break ;}}}} return $J ;} function
query ( $zf , $xb = array (), $ye = 'GET' ){ return $this -> rootQuery (( $this -> _db != " " ? " $this->_db / " : " / " ) . ltrim ( $zf , '/' ), $xb , $ye );} function
connect ( $N , $V , $G ){ preg_match ( '~^(https?://)?(.*)~' , $N , $B ); $this -> _url = ( $B [ 1 ] ? $B [ 1 ] : " http:// " ) . " $V : $G @ $B[2] / " ; $J = $this -> query ( '' ); if ( $J ) $this -> server_info = $J [ 'version' ][ 'number' ]; return ( bool ) $J ;} function
select_db ( $k ){ $this -> _db = $k ; return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return $Q ;}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $num_rows , $_rows ; function
2016-10-11 12:23:21 +00:00
__construct ( $L ){ $this -> num_rows = count ( $this -> _rows ); $this -> _rows = $L ; reset ( $this -> _rows );} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ $J = current ( $this -> _rows ); next ( $this -> _rows ); return $J ;} function
fetch_row (){ return
array_values ( $this -> fetch_assoc ());}}} class
Min_Driver
extends
Min_SQL { function
2017-04-21 11:23:04 +00:00
select ( $R , $M , $Z , $cd , $df = array (), $z = 1 , $E = 0 , $Mf = false ){ global $b ; $Gb = array (); $H = " $R /_search " ; if ( $M != array ( " * " )) $Gb [ " fields " ] = $M ; if ( $df ){ $Pg = array (); foreach ( $df
as $lb ){ $lb = preg_replace ( '~ DESC$~' , '' , $lb , 1 , $Bb ); $Pg [] = ( $Bb ? array ( $lb => " desc " ) : $lb );} $Gb [ " sort " ] = $Pg ;} if ( $z ){ $Gb [ " size " ] =+ $z ; if ( $E ) $Gb [ " from " ] = ( $E * $z );} foreach ( $Z
as $X ){ list ( $lb , $We , $X ) = explode ( " " , $X , 3 ); if ( $lb == " _id " ) $Gb [ " query " ][ " ids " ][ " values " ][] = $X ; elseif ( $lb . $X != " " ){ $rh = array ( " term " => array (( $lb != " " ? $lb : " _all " ) => $X )); if ( $We == " = " ) $Gb [ " query " ][ " filtered " ][ " filter " ][ " and " ][] = $rh ; else $Gb [ " query " ][ " filtered " ][ " query " ][ " bool " ][ " must " ][] = $rh ;}} if ( $Gb [ " query " ] &&! $Gb [ " query " ][ " filtered " ][ " query " ] &&! $Gb [ " query " ][ " ids " ]) $Gb [ " query " ][ " filtered " ][ " query " ] = array ( " match_all " => array ()); $Vg = microtime ( true ); $zg = $this -> _conn -> query ( $H , $Gb ); if ( $Mf ) echo $b -> selectQuery ( " $H : " . print_r ( $Gb , true ), format_time ( $Vg )); if ( ! $zg ) return
false ; $J = array (); foreach ( $zg [ 'hits' ][ 'hits' ] as $ld ){ $K = array (); if ( $M == array ( " * " )) $K [ " _id " ] = $ld [ " _id " ]; $p = $ld [ '_source' ]; if ( $M != array ( " * " )){ $p = array (); foreach ( $M
as $y ) $p [ $y ] = $ld [ 'fields' ][ $y ];} foreach ( $p
as $y => $X ){ if ( $Gb [ " fields " ]) $X = $X [ 0 ]; $K [ $y ] = ( is_array ( $X ) ? json_encode ( $X ) : $X );} $J [] = $K ;} return
2014-04-01 18:00:42 +00:00
new
Min_Result ( $J );}} function
2017-04-21 11:23:04 +00:00
connect (){ global $b ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])) return $g ; return $g -> error ;} function
support ( $Gc ){ return
preg_match ( " ~database|table|columns~ " , $Gc );} function
logged_user (){ global $b ; $j = $b -> credentials (); return $j [ 1 ];} function
get_databases (){ global $g ; $J = $g -> rootQuery ( '_aliases' ); if ( $J ){ $J = array_keys ( $J ); sort ( $J , SORT_STRING );} return $J ;} function
2014-04-01 18:00:42 +00:00
collations (){ return
array ();} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){} function
2015-04-01 06:36:56 +00:00
engines (){ return
array ();} function
2017-04-21 11:23:04 +00:00
count_tables ( $l ){ global $g ; $J = $g -> query ( '_mapping' ); if ( $J ) $J = array_map ( 'count' , $J ); return $J ;} function
tables_list (){ global $g ; $J = $g -> query ( '_mapping' ); if ( $J ) $J = array_fill_keys ( array_keys ( $J [ $g -> _db ][ " mappings " ]), 'table' ); return $J ;} function
table_status ( $C = " " , $Fc = false ){ global $g ; $zg = $g -> query ( " _search?search_type=count " , array ( " facets " => array ( " count_by_type " => array ( " terms " => array ( " field " => " _type " ,)))), " POST " ); $J = array (); if ( $zg ){ foreach ( $zg [ " facets " ][ " count_by_type " ][ " terms " ] as $R ){ $J [ $R [ " term " ]] = array ( " Name " => $R [ " term " ], " Engine " => " table " , " Rows " => $R [ " count " ],); if ( $C != " " && $C == $R [ " term " ]) return $J [ $C ];}} return $J ;} function
error (){ global $g ; return
h ( $g -> error );} function
2014-04-01 18:00:42 +00:00
information_schema (){} function
2017-04-21 11:23:04 +00:00
is_view ( $S ){} function
indexes ( $R , $h = null ){ return
2014-04-01 18:00:42 +00:00
array ( array ( " type " => " PRIMARY " , " columns " => array ( " _id " )),);} function
2017-04-21 11:23:04 +00:00
fields ( $R ){ global $g ; $I = $g -> query ( " $R /_mapping " ); $J = array (); if ( $I ){ $he = $I [ $R ][ 'properties' ]; if ( ! $he ) $he = $I [ $g -> _db ][ 'mappings' ][ $R ][ 'properties' ]; if ( $he ){ foreach ( $he
2015-04-01 06:36:56 +00:00
as $C => $o ){ $J [ $C ] = array ( " field " => $C , " full_type " => $o [ " type " ], " type " => $o [ " type " ], " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ),); if ( $o [ " properties " ]){ unset ( $J [ $C ][ " privileges " ][ " insert " ]); unset ( $J [ $C ][ " privileges " ][ " update " ]);}}}} return $J ;} function
2017-04-21 11:23:04 +00:00
foreign_keys ( $R ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2017-04-21 11:23:04 +00:00
table ( $u ){ return $u ;} function
idf_escape ( $u ){ return $u ;} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2017-04-21 11:23:04 +00:00
fk_support ( $S ){} function
found_rows ( $S , $Z ){ return
2014-04-01 18:00:42 +00:00
null ;} function
2017-04-21 11:23:04 +00:00
create_database ( $m ){ global $g ; return $g -> rootQuery ( urlencode ( $m ), array (), 'PUT' );} function
drop_databases ( $l ){ global $g ; return $g -> rootQuery ( urlencode ( implode ( ',' , $l )), array (), 'DELETE' );} function
drop_tables ( $T ){ global $g ; $J = true ; foreach ( $T
as $R ) $J = $J && $g -> query ( urlencode ( $R ), array (), 'DELETE' ); return $J ;} $x = " elastic " ; $Ye = array ( " = " , " query " ); $Zc = array (); $ed = array (); $gc = array ( array ( " json " ));} $Yb = array ( " server " => " MySQL " ) + $Yb ; if ( ! defined ( " DRIVER " )){ $Hf = array ( " MySQLi " , " MySQL " , " PDO_MySQL " ); define ( " DRIVER " , " server " ); if ( extension_loaded ( " mysqli " )){ class
2014-04-01 18:00:42 +00:00
Min_DB
extends
MySQLi { var $extension = " MySQLi " ; function
2016-10-11 12:23:21 +00:00
__construct (){ parent :: init ();} function
2017-04-21 11:23:04 +00:00
connect ( $N = " " , $V = " " , $G = " " , $k = null , $Df = null , $Og = null ){ mysqli_report ( MYSQLI_REPORT_OFF ); list ( $md , $Df ) = explode ( " : " , $N , 2 ); $J =@ $this -> real_connect (( $N != " " ? $md : ini_get ( " mysqli.default_host " )),( $N . $V != " " ? $V : ini_get ( " mysqli.default_user " )),( $N . $V . $G != " " ? $G : ini_get ( " mysqli.default_pw " )), $k ,( is_numeric ( $Df ) ? $Df : ini_get ( " mysqli.default_port " )),( ! is_numeric ( $Df ) ? $Df : $Og )); return $J ;} function
2015-04-01 06:36:56 +00:00
set_charset ( $ab ){ if ( parent :: set_charset ( $ab )) return
true ; parent :: set_charset ( 'utf8' ); return $this -> query ( " SET NAMES $ab " );} function
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! $I ) return
false ; $K = $I -> fetch_array (); return $K [ $o ];} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return " ' " . $this -> escape_string ( $Q ) . " ' " ;}}} elseif ( extension_loaded ( " mysql " ) &&! ( ini_get ( " sql.safe_mode " ) && extension_loaded ( " pdo_mysql " ))){ class
2014-04-01 18:00:42 +00:00
Min_DB { var $extension = " MySQL " , $server_info , $affected_rows , $errno , $error , $_link , $_result ; function
2015-04-01 06:36:56 +00:00
connect ( $N , $V , $G ){ $this -> _link =@ mysql_connect (( $N != " " ? $N : ini_get ( " mysql.default_host " )),( " $N $V " != " " ? $V : ini_get ( " mysql.default_user " )),( " $N $V $G " != " " ? $G : ini_get ( " mysql.default_password " )), true , 131072 ); if ( $this -> _link ) $this -> server_info = mysql_get_server_info ( $this -> _link ); else $this -> error = mysql_error (); return ( bool ) $this -> _link ;} function
set_charset ( $ab ){ if ( function_exists ( 'mysql_set_charset' )){ if ( mysql_set_charset ( $ab , $this -> _link )) return
true ; mysql_set_charset ( 'utf8' , $this -> _link );} return $this -> query ( " SET NAMES $ab " );} function
2017-04-21 11:23:04 +00:00
quote ( $Q ){ return " ' " . mysql_real_escape_string ( $Q , $this -> _link ) . " ' " ;} function
select_db ( $k ){ return
mysql_select_db ( $k , $this -> _link );} function
query ( $H , $Sh = false ){ $I =@ ( $Sh ? mysql_unbuffered_query ( $H , $this -> _link ) : mysql_query ( $H , $this -> _link )); $this -> error = " " ; if ( ! $I ){ $this -> errno = mysql_errno ( $this -> _link ); $this -> error = mysql_error ( $this -> _link ); return
2014-04-01 18:00:42 +00:00
false ;} if ( $I === true ){ $this -> affected_rows = mysql_affected_rows ( $this -> _link ); $this -> info = mysql_info ( $this -> _link ); return
true ;} return
new
Min_Result ( $I );} function
multi_query ( $H ){ return $this -> _result = $this -> query ( $H );} function
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2015-04-01 06:36:56 +00:00
result ( $H , $o = 0 ){ $I = $this -> query ( $H ); if ( ! $I ||! $I -> num_rows ) return
2014-04-01 18:00:42 +00:00
false ; return
2015-04-01 06:36:56 +00:00
mysql_result ( $I -> _result , 0 , $o );}} class
2014-04-01 18:00:42 +00:00
Min_Result { var $num_rows , $_result , $_offset = 0 ; function
2016-10-11 12:23:21 +00:00
__construct ( $I ){ $this -> _result = $I ; $this -> num_rows = mysql_num_rows ( $I );} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ return
mysql_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
mysql_fetch_row ( $this -> _result );} function
fetch_field (){ $J = mysql_fetch_field ( $this -> _result , $this -> _offset ++ ); $J -> orgtable = $J -> table ; $J -> orgname = $J -> name ; $J -> charsetnr = ( $J -> blob ? 63 : 0 ); return $J ;} function
__destruct (){ mysql_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_mysql " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_MySQL " ; function
2015-04-01 06:36:56 +00:00
connect ( $N , $V , $G ){ $this -> dsn ( " mysql:charset=utf8;host= " . str_replace ( " : " , " ;unix_socket= " , preg_replace ( '~:(\\d)~' , ';port=\\1' , $N )), $V , $G ); return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
set_charset ( $ab ){ $this -> query ( " SET NAMES $ab " );} function
2017-04-21 11:23:04 +00:00
select_db ( $k ){ return $this -> query ( " USE " . idf_escape ( $k ));} function
query ( $H , $Sh = false ){ $this -> setAttribute ( 1000 , ! $Sh ); return
parent :: query ( $H , $Sh );}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
Min_SQL { function
2017-04-21 11:23:04 +00:00
insert ( $R , $O ){ return ( $O ? parent :: insert ( $R , $O ) : queries ( " INSERT INTO " . table ( $R ) . " () \n VALUES () " ));} function
insertUpdate ( $R , $L , $Kf ){ $e = array_keys ( reset ( $L )); $If = " INSERT INTO " . table ( $R ) . " ( " . implode ( " , " , $e ) . " ) VALUES \n " ; $ji = array (); foreach ( $e
as $y ) $ji [ $y ] = " $y = VALUES( $y ) " ; $bh = " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $ji ); $ji = array (); $be = 0 ; foreach ( $L
as $O ){ $Y = " ( " . implode ( " , " , $O ) . " ) " ; if ( $ji && ( strlen ( $If ) + $be + strlen ( $Y ) + strlen ( $bh ) > 1e6 )){ if ( ! queries ( $If . implode ( " , \n " , $ji ) . $bh )) return
false ; $ji = array (); $be = 0 ;} $ji [] = $Y ; $be += strlen ( $Y ) + 2 ;} return
queries ( $If . implode ( " , \n " , $ji ) . $bh );}} function
idf_escape ( $u ){ return " ` " . str_replace ( " ` " , " `` " , $u ) . " ` " ;} function
table ( $u ){ return
idf_escape ( $u );} function
connect (){ global $b , $Rh , $Yg ; $g = new
Min_DB ; $j = $b -> credentials (); if ( $g -> connect ( $j [ 0 ], $j [ 1 ], $j [ 2 ])){ $g -> set_charset ( charset ( $g )); $g -> query ( " SET sql_quote_show_create = 1, autocommit = 1 " ); if ( version_compare ( $g -> server_info , '5.7.8' ) >= 0 ){ $Yg [ lang ( 23 )][] = " json " ; $Rh [ " json " ] = 4294967295 ;} return $g ;} $J = $g -> error ; if ( function_exists ( 'iconv' ) &&! is_utf8 ( $J ) && strlen ( $vg = iconv ( " windows-1250 " , " utf-8 " , $J )) > strlen ( $J )) $J = $vg ; return $J ;} function
get_databases ( $Qc ){ global $g ; $J = get_session ( " dbs " ); if ( $J === null ){ $H = ( $g -> server_info >= 5 ? " SELECT SCHEMA_NAME FROM information_schema.SCHEMATA " : " SHOW DATABASES " ); $J = ( $Qc ? slow_query ( $H ) : get_vals ( $H )); restart_session (); set_session ( " dbs " , $J ); stop_session ();} return $J ;} function
limit ( $H , $Z , $z , $D = 0 , $Dg = " " ){ return " $H $Z " . ( $z !== null ? $Dg . " LIMIT $z " . ( $D ? " OFFSET $D " : " " ) : " " );} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ return
limit ( $H , $Z , 1 );} function
2017-04-21 11:23:04 +00:00
db_collation ( $m , $ob ){ global $g ; $J = null ; $i = $g -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ); if ( preg_match ( '~ COLLATE ([^ ]+)~' , $i , $B )) $J = $B [ 1 ]; elseif ( preg_match ( '~ CHARACTER SET ([^ ]+)~' , $i , $B )) $J = $ob [ $B [ 1 ]][ - 1 ]; return $J ;} function
2014-04-01 18:00:42 +00:00
engines (){ $J = array (); foreach ( get_rows ( " SHOW ENGINES " ) as $K ){ if ( preg_match ( " ~YES|DEFAULT~ " , $K [ " Support " ])) $J [] = $K [ " Engine " ];} return $J ;} function
2017-04-21 11:23:04 +00:00
logged_user (){ global $g ; return $g -> result ( " SELECT USER() " );} function
tables_list (){ global $g ; return
get_key_vals ( $g -> server_info >= 5 ? " SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME " : " SHOW TABLES " );} function
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ $J = array (); foreach ( $l
as $m ) $J [ $m ] = count ( get_vals ( " SHOW TABLES IN " . idf_escape ( $m ))); return $J ;} function
2017-04-21 11:23:04 +00:00
table_status ( $C = " " , $Fc = false ){ global $g ; $J = array (); foreach ( get_rows ( $Fc && $g -> server_info >= 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 $K ){ if ( $K [ " Engine " ] == " InnoDB " ) $K [ " Comment " ] = preg_replace ( '~(?:(.+); )?InnoDB free: .*~' , '\\1' , $K [ " Comment " ]); if ( ! isset ( $K [ " Engine " ])) $K [ " Comment " ] = " " ; if ( $C != " " ) return $K ; $J [ $K [ " Name " ]] = $K ;} return $J ;} function
is_view ( $S ){ return $S [ " Engine " ] === null ;} function
fk_support ( $S ){ global $g ; return
preg_match ( '~InnoDB|IBMDB2I~i' , $S [ " Engine " ]) || ( preg_match ( '~NDB~i' , $S [ " Engine " ]) && version_compare ( $g -> server_info , '5.6' ) >= 0 );} function
fields ( $R ){ $J = array (); foreach ( get_rows ( " SHOW FULL COLUMNS FROM " . table ( $R )) as $K ){ preg_match ( '~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~' , $K [ " Type " ], $B ); $J [ $K [ " Field " ]] = array ( " field " => $K [ " Field " ], " full_type " => $K [ " Type " ], " type " => $B [ 1 ], " length " => $B [ 2 ], " unsigned " => ltrim ( $B [ 3 ] . $B [ 4 ]), " default " => ( $K [ " Default " ] != " " || preg_match ( " ~char|set~ " , $B [ 1 ]) ? $K [ " Default " ] : null ), " null " => ( $K [ " Null " ] == " YES " ), " auto_increment " => ( $K [ " Extra " ] == " auto_increment " ), " on_update " => ( preg_match ( '~^on update (.+)~i' , $K [ " Extra " ], $B ) ? $B [ 1 ] : " " ), " collation " => $K [ " Collation " ], " privileges " => array_flip ( preg_split ( '~, *~' , $K [ " Privileges " ])), " comment " => $K [ " Comment " ], " primary " => ( $K [ " Key " ] == " PRI " ),);} return $J ;} function
indexes ( $R , $h = null ){ $J = array (); foreach ( get_rows ( " SHOW INDEX FROM " . table ( $R ), $h ) as $K ){ $C = $K [ " Key_name " ]; $J [ $C ][ " type " ] = ( $C == " PRIMARY " ? " PRIMARY " : ( $K [ " Index_type " ] == " FULLTEXT " ? " FULLTEXT " : ( $K [ " Non_unique " ] ? ( $K [ " Index_type " ] == " SPATIAL " ? " SPATIAL " : " INDEX " ) : " UNIQUE " ))); $J [ $C ][ " columns " ][] = $K [ " Column_name " ]; $J [ $C ][ " lengths " ][] = ( $K [ " Index_type " ] == " SPATIAL " ? null : $K [ " Sub_part " ]); $J [ $C ][ " descs " ][] = null ;} return $J ;} function
foreign_keys ( $R ){ global $g , $Te ; static $Af = '`(?:[^`]|``)+`' ; $J = array (); $Cb = $g -> result ( " SHOW CREATE TABLE " . table ( $R ), 1 ); if ( $Cb ){ preg_match_all ( " ~CONSTRAINT ( $Af ) FOREIGN KEY ? \\ (((?: $Af ,? ?)+) \\ ) REFERENCES ( $Af )(?: \\ .( $Af ))? \\ (((?: $Af ,? ?)+) \\ )(?: ON DELETE ( $Te ))?(?: ON UPDATE ( $Te ))?~ " , $Cb , $ke , PREG_SET_ORDER ); foreach ( $ke
as $B ){ preg_match_all ( " ~ $Af ~ " , $B [ 2 ], $Qg ); preg_match_all ( " ~ $Af ~ " , $B [ 5 ], $oh ); $J [ 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' , $Qg [ 0 ]), " target " => array_map ( 'idf_unescape' , $oh [ 0 ]), " on_delete " => ( $B [ 6 ] ? $B [ 6 ] : " RESTRICT " ), " on_update " => ( $B [ 7 ] ? $B [ 7 ] : " RESTRICT " ),);}} return $J ;} function
view ( $C ){ global $g ; return
array ( " select " => preg_replace ( '~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU' , '' , $g -> result ( " SHOW CREATE VIEW " . table ( $C ), 1 )));} function
2014-04-01 18:00:42 +00:00
collations (){ $J = array (); foreach ( get_rows ( " SHOW COLLATION " ) as $K ){ if ( $K [ " Default " ]) $J [ $K [ " Charset " ]][ - 1 ] = $K [ " Collation " ]; else $J [ $K [ " Charset " ]][] = $K [ " Collation " ];} ksort ( $J ); foreach ( $J
2017-04-21 11:23:04 +00:00
as $y => $X ) asort ( $J [ $y ]); return $J ;} function
information_schema ( $m ){ global $g ; return ( $g -> server_info >= 5 && $m == " information_schema " ) || ( $g -> server_info >= 5.5 && $m == " performance_schema " );} function
error (){ global $g ; return
h ( preg_replace ( '~^You have an error.*syntax to use~U' , " Syntax error " , $g -> error ));} function
create_database ( $m , $nb ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $nb ? " COLLATE " . q ( $nb ) : " " ));} function
2015-04-01 06:36:56 +00:00
drop_databases ( $l ){ $J = apply_queries ( " DROP DATABASE " , $l , 'idf_escape' ); restart_session (); set_session ( " dbs " , null ); return $J ;} function
2017-04-21 11:23:04 +00:00
rename_database ( $C , $nb ){ $J = false ; if ( create_database ( $C , $nb )){ $ig = array (); foreach ( tables_list () as $R => $U ) $ig [] = table ( $R ) . " TO " . idf_escape ( $C ) . " . " . table ( $R ); $J = ( ! $ig || queries ( " RENAME TABLE " . implode ( " , " , $ig ))); if ( $J ) queries ( " DROP DATABASE " . idf_escape ( DB )); restart_session (); set_session ( " dbs " , null );} return $J ;} function
auto_increment (){ $Ma = " PRIMARY KEY " ; if ( $_GET [ " create " ] != " " && $_POST [ " auto_increment_col " ]){ foreach ( indexes ( $_GET [ " create " ]) as $v ){ if ( in_array ( $_POST [ " fields " ][ $_POST [ " auto_increment_col " ]][ " orig " ], $v [ " columns " ], true )){ $Ma = " " ; break ;} if ( $v [ " type " ] == " PRIMARY " ) $Ma = " UNIQUE " ;}} return " AUTO_INCREMENT $Ma " ;} function
alter_table ( $R , $C , $p , $Rc , $sb , $oc , $nb , $La , $wf ){ $c = array (); foreach ( $p
as $o ) $c [] = ( $o [ 1 ] ? ( $R != " " ? ( $o [ 0 ] != " " ? " CHANGE " . idf_escape ( $o [ 0 ]) : " ADD " ) : " " ) . " " . implode ( $o [ 1 ]) . ( $R != " " ? $o [ 2 ] : " " ) : " DROP " . idf_escape ( $o [ 0 ])); $c = array_merge ( $c , $Rc ); $P = ( $sb !== null ? " COMMENT= " . q ( $sb ) : " " ) . ( $oc ? " ENGINE= " . q ( $oc ) : " " ) . ( $nb ? " COLLATE " . q ( $nb ) : " " ) . ( $La != " " ? " AUTO_INCREMENT= $La " : " " ); if ( $R == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) $P $wf " ); if ( $R != $C ) $c [] = " RENAME TO " . table ( $C ); if ( $P ) $c [] = ltrim ( $P ); return ( $c || $wf ? queries ( " ALTER TABLE " . table ( $R ) . " \n " . implode ( " , \n " , $c ) . $wf ) : true );} function
alter_indexes ( $R , $c ){ foreach ( $c
as $y => $X ) $c [ $y ] = ( $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 ( $R ) . implode ( " , " , $c ));} function
truncate_tables ( $T ){ return
apply_queries ( " TRUNCATE TABLE " , $T );} function
drop_views ( $oi ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $oi )));} function
drop_tables ( $T ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $T )));} function
move_tables ( $T , $oi , $oh ){ $ig = array (); foreach ( array_merge ( $T , $oi ) as $R ) $ig [] = table ( $R ) . " TO " . idf_escape ( $oh ) . " . " . table ( $R ); return
queries ( " RENAME TABLE " . implode ( " , " , $ig ));} function
copy_tables ( $T , $oi , $oh ){ queries ( " SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' " ); foreach ( $T
as $R ){ $C = ( $oh == DB ? table ( " copy_ $R " ) : idf_escape ( $oh ) . " . " . table ( $R )); if ( ! queries ( " \n DROP TABLE IF EXISTS $C " ) ||! queries ( " CREATE TABLE $C LIKE " . table ( $R )) ||! queries ( " INSERT INTO $C SELECT * FROM " . table ( $R ))) return
false ;} foreach ( $oi
as $R ){ $C = ( $oh == DB ? table ( " copy_ $R " ) : idf_escape ( $oh ) . " . " . table ( $R )); $ni = view ( $R ); if ( ! queries ( " DROP VIEW IF EXISTS $C " ) ||! queries ( " CREATE VIEW $C AS $ni[select] " )) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
trigger ( $C ){ if ( $C == " " ) return
array (); $L = get_rows ( " SHOW TRIGGERS WHERE `Trigger` = " . q ( $C )); return
reset ( $L );} function
2017-04-21 11:23:04 +00:00
triggers ( $R ){ $J = array (); foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $R , " %_ \\ " ))) as $K ) $J [ $K [ " Trigger " ]] = array ( $K [ " Timing " ], $K [ " Event " ]); return $J ;} function
2014-04-01 18:00:42 +00:00
trigger_options (){ return
2015-04-01 06:36:56 +00:00
array ( " Timing " => array ( " BEFORE " , " AFTER " ), " Event " => array ( " INSERT " , " UPDATE " , " DELETE " ), " Type " => array ( " FOR EACH ROW " ),);} function
2017-04-21 11:23:04 +00:00
routine ( $C , $U ){ global $g , $qc , $yd , $Rh ; $Ca = array ( " bool " , " boolean " , " integer " , " double precision " , " real " , " dec " , " numeric " , " fixed " , " national char " , " national varchar " ); $Qh = " (( " . implode ( " | " , array_merge ( array_keys ( $Rh ), $Ca )) . " ) \\ b(?: \\ s* \\ (((?:[^' \" )]| $qc )++) \\ ))? \\ s*(zerofill \\ s*)?(unsigned(?: \\ s+zerofill)?)?)(?: \\ s*(?:CHARSET|CHARACTER \\ s+SET) \\ s*[' \" ]?([^' \" \\ s,]+)[' \" ]?)? " ; $Af = " \\ s*( " . ( $U == " FUNCTION " ? " " : $yd ) . " )? \\ s*(?:`((?:[^`]|``)*)` \\ s*| \\ b( \\ S+) \\ s+) $Qh " ; $i = $g -> result ( " SHOW CREATE $U " . idf_escape ( $C ), 2 ); preg_match ( " ~ \\ (((?: $Af\\s *,?)*) \\ ) \\ s* " . ( $U == " FUNCTION " ? " RETURNS \\ s+ $Qh\\s + " : " " ) . " (.*)~is " , $i , $B ); $p = array (); preg_match_all ( " ~ $Af\\s *,?~is " , $B [ 1 ], $ke , PREG_SET_ORDER ); foreach ( $ke
as $qf ){ $C = str_replace ( " `` " , " ` " , $qf [ 2 ]) . $qf [ 3 ]; $p [] = array ( " field " => $C , " type " => strtolower ( $qf [ 5 ]), " length " => preg_replace_callback ( " ~ $qc ~s " , 'normalize_enum' , $qf [ 6 ]), " unsigned " => strtolower ( preg_replace ( '~\\s+~' , ' ' , trim ( " $qf[8] $qf[7] " ))), " null " => 1 , " full_type " => $qf [ 4 ], " inout " => strtoupper ( $qf [ 1 ]), " collation " => strtolower ( $qf [ 9 ]),);} if ( $U != " FUNCTION " ) return
2015-04-01 06:36:56 +00:00
array ( " fields " => $p , " definition " => $B [ 11 ]); return
array ( " fields " => $p , " returns " => array ( " type " => $B [ 12 ], " length " => $B [ 13 ], " unsigned " => $B [ 15 ], " collation " => $B [ 16 ]), " definition " => $B [ 17 ], " language " => " SQL " ,);} function
2014-04-01 18:00:42 +00:00
routines (){ return
get_rows ( " SELECT ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q ( DB ));} function
routine_languages (){ return
array ();} function
2017-04-21 11:23:04 +00:00
last_id (){ global $g ; return $g -> result ( " SELECT LAST_INSERT_ID() " );} function
explain ( $g , $H ){ return $g -> query ( " EXPLAIN " . ( $g -> server_info >= 5.1 ? " PARTITIONS " : " " ) . $H );} function
found_rows ( $S , $Z ){ return ( $Z || $S [ " Engine " ] != " InnoDB " ? null : $S [ " Rows " ]);} function
2014-04-01 18:00:42 +00:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2017-04-21 11:23:04 +00:00
set_schema ( $xg ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
create_sql ( $R , $La ){ global $g ; $J = $g -> result ( " SHOW CREATE TABLE " . table ( $R ), 1 ); if ( ! $La ) $J = preg_replace ( '~ AUTO_INCREMENT=\\d+~' , '' , $J ); return $J ;} function
truncate_sql ( $R ){ return " TRUNCATE " . table ( $R );} function
use_sql ( $k ){ return " USE " . idf_escape ( $k );} function
trigger_sql ( $R , $Zg ){ $J = " " ; foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $R , " %_ \\ " )), null , " -- " ) as $K ) $J .= " \n " . ( $Zg == 'CREATE+ALTER' ? " DROP TRIGGER IF EXISTS " . idf_escape ( $K [ " Trigger " ]) . " ;; \n " : " " ) . " CREATE TRIGGER " . idf_escape ( $K [ " Trigger " ]) . " $K[Timing] $K[Event] ON " . table ( $K [ " Table " ]) . " FOR EACH ROW \n $K[Statement] ;; \n " ; return $J ;} function
2014-04-01 18:00:42 +00: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
2017-04-21 11:23:04 +00:00
replication_status ( $U ){ return
get_rows ( " SHOW $U STATUS " );} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){ if ( preg_match ( " ~binary~ " , $o [ " type " ])) return " HEX( " . idf_escape ( $o [ " field " ]) . " ) " ; if ( $o [ " type " ] == " bit " ) return " BIN( " . idf_escape ( $o [ " field " ]) . " + 0) " ; if ( preg_match ( " ~geometry|point|linestring|polygon~ " , $o [ " type " ])) return " AsWKT( " . idf_escape ( $o [ " field " ]) . " ) " ;} function
unconvert_field ( $o , $J ){ if ( preg_match ( " ~binary~ " , $o [ " type " ])) $J = " UNHEX( $J ) " ; if ( $o [ " type " ] == " bit " ) $J = " CONV( $J , 2, 10) + 0 " ; if ( preg_match ( " ~geometry|point|linestring|polygon~ " , $o [ " type " ])) $J = " GeomFromText( $J ) " ; return $J ;} function
2017-04-21 11:23:04 +00:00
support ( $Gc ){ global $g ; return ! preg_match ( " ~scheme|sequence|type|view_trigger|materializedview " . ( $g -> server_info < 5.1 ? " |event|partitioning " . ( $g -> server_info < 5 ? " |routine|trigger|view " : " " ) : " " ) . " ~ " , $Gc );} function
2016-10-11 12:23:21 +00:00
kill_process ( $X ){ return
queries ( " KILL " . number ( $X ));} function
2017-04-21 11:23:04 +00:00
connection_id (){ return " SELECT CONNECTION_ID() " ;} function
max_connections (){ global $g ; return $g -> result ( " SELECT @@max_connections " );} $x = " sql " ; $Rh = array (); $Yg = array (); foreach ( array ( lang ( 25 ) => array ( " tinyint " => 3 , " smallint " => 5 , " mediumint " => 8 , " int " => 10 , " bigint " => 20 , " decimal " => 66 , " float " => 12 , " double " => 21 ), lang ( 26 ) => array ( " date " => 10 , " datetime " => 19 , " timestamp " => 19 , " time " => 10 , " year " => 4 ), lang ( 23 ) => array ( " char " => 255 , " varchar " => 65535 , " tinytext " => 255 , " text " => 65535 , " mediumtext " => 16777215 , " longtext " => 4294967295 ), lang ( 30 ) => array ( " enum " => 65535 , " set " => 64 ), lang ( 27 ) => array ( " bit " => 20 , " binary " => 255 , " varbinary " => 65535 , " tinyblob " => 255 , " blob " => 65535 , " mediumblob " => 16777215 , " longblob " => 4294967295 ), lang ( 29 ) => array ( " geometry " => 0 , " point " => 0 , " linestring " => 0 , " polygon " => 0 , " multipoint " => 0 , " multilinestring " => 0 , " multipolygon " => 0 , " geometrycollection " => 0 ),) as $y => $X ){ $Rh += $X ; $Yg [ $y ] = array_keys ( $X );} $Yh = array ( " unsigned " , " zerofill " , " unsigned zerofill " ); $Ye = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " REGEXP " , " IN " , " IS NULL " , " NOT LIKE " , " NOT REGEXP " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Zc = array ( " char_length " , " date " , " from_unixtime " , " lower " , " round " , " sec_to_time " , " time_to_sec " , " upper " ); $ed = array ( " avg " , " count " , " count distinct " , " group_concat " , " max " , " min " , " sum " ); $gc = array ( array ( " char " => " md5/sha1/password/encrypt/uuid " , " binary " => " md5/sha1 " , " date|time " => " now " ,), array ( " (^|[^o])int|float|double|decimal " => " +/- " , " 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.3.1 " ; class
2014-04-01 18:00:42 +00:00
Adminer { var $operators ; function
2016-10-11 12:23:21 +00:00
name (){ return " <a href='https://www.adminer.org/' target='_blank' id='h1'>Adminer</a> " ;} function
2014-04-01 18:00:42 +00:00
credentials (){ return
array ( SERVER , $_GET [ " username " ], get_password ());} function
2017-04-21 11:23:04 +00:00
permanentLogin ( $i = false ){ return
password_file ( $i );} function
2015-04-01 06:36:56 +00:00
bruteForceKey (){ return $_SERVER [ " REMOTE_ADDR " ];} function
2014-04-01 18:00:42 +00:00
database (){ return
DB ;} function
2017-04-21 11:23:04 +00:00
databases ( $Qc = true ){ return
get_databases ( $Qc );} function
2014-04-01 18:00:42 +00:00
schemas (){ return
schemas ();} function
queryTimeout (){ return
5 ;} function
headers (){ return
true ;} function
head (){ return
true ;} function
2017-04-21 11:23:04 +00:00
loginForm (){ global $Yb ; echo ' < table cellspacing = " 0 " >
< tr >< th > ',lang(31),' < td > ',html_select("auth[driver]",$Yb,DRIVER),' < tr >< th > ',lang(32),' < td >< input name = " auth[server] " value = " ',h(SERVER),' " title = " hostname[:port] " placeholder = " localhost " autocapitalize = " off " >
2015-04-01 06:36:56 +00:00
< tr >< th > ',lang(33),' < td >< input name = " auth[username] " id = " username " value = " ',h( $_GET["username"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(34),' < td >< input type = " password " name = " auth[password] " >
2016-10-11 12:23:21 +00:00
< tr >< th > ',lang(35),' < td >< input name = " auth[db] " value = " ',h( $_GET["db"] ),' " autocapitalize = " off " >
2014-04-01 18:00:42 +00:00
</ table >
< script type = " text/javascript " >
2016-10-11 12:23:21 +00:00
focus ( document . getElementById ( \ ' username\ ' ));
2014-04-01 18:00:42 +00:00
</ script >
2016-10-11 12:23:21 +00:00
',"<p><input type=' submit ' value=' " .lang(36). " ' > \n " ,checkbox( " auth [ permanent ] " ,1, $_COOKIE["adminer_permanent"] ,lang(37)). " \n " ;}function
2017-04-21 11:23:04 +00:00
login ( $fe , $G ){ global $x ; if ( $x == " sqlite " ) return
lang ( 38 , '<code>login()</code>' ); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
tableName ( $fh ){ return
h ( $fh [ " Name " ]);} function
fieldName ( $o , $df = 0 ){ return '<span title="' . h ( $o [ " full_type " ]) . '">' . h ( $o [ " field " ]) . '</span>' ;} function
selectLinks ( $fh , $O = " " ){ echo '<p class="links">' ; $ee = array ( " select " => lang ( 39 )); if ( support ( " table " ) || support ( " indexes " )) $ee [ " table " ] = lang ( 40 ); if ( support ( " table " )){ if ( is_view ( $fh )) $ee [ " view " ] = lang ( 41 ); else $ee [ " create " ] = lang ( 42 );} if ( $O !== null ) $ee [ " edit " ] = lang ( 43 ); foreach ( $ee
as $y => $X ) echo " <a href=' " . h ( ME ) . " $y = " . urlencode ( $fh [ " Name " ]) . ( $y == " edit " ? $O : " " ) . " ' " . bold ( isset ( $_GET [ $y ])) . " > $X </a> " ; echo " \n " ;} function
foreignKeys ( $R ){ return
foreign_keys ( $R );} function
backwardKeys ( $R , $eh ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2015-04-01 06:36:56 +00:00
backwardKeysPrint ( $Oa , $K ){} function
2017-04-21 11:23:04 +00:00
selectQuery ( $H , $vh ){ global $x ; return " <p><code class='jush- $x '> " . h ( str_replace ( " \n " , " " , $H )) . " </code> <span class='time'>( $vh )</span> " . ( support ( " sql " ) ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( $H ) . " '> " . lang ( 10 ) . " </a> " : " " ) . " </p> " ;} function
sqlCommandQuery ( $H ){ return
shorten_utf8 ( trim ( $H ), 1000 );} function
rowDescription ( $R ){ return " " ;} function
rowDescriptions ( $L , $Sc ){ return $L ;} function
2015-04-01 06:36:56 +00:00
selectLink ( $X , $o ){} function
2017-04-21 11:23:04 +00:00
selectVal ( $X , $_ , $o , $lf ){ $J = ( $X === null ? " <i>NULL</i> " : ( preg_match ( " ~char|binary~ " , $o [ " type " ]) &&! preg_match ( " ~var~ " , $o [ " type " ]) ? " <code> $X </code> " : $X )); if ( preg_match ( '~blob|bytea|raw|file~' , $o [ " type " ]) &&! is_utf8 ( $X )) $J = " <i> " . lang ( 44 , strlen ( $lf )) . " </i> " ; if ( preg_match ( '~json~' , $o [ " type " ])) $J = " <code class='jush-js'> $J </code> " ; return ( $_ ? " <a href=' " . h ( $_ ) . " ' " . ( is_url ( $_ ) ? " rel='noreferrer' " : " " ) . " > $J </a> " : $J );} function
2015-04-01 06:36:56 +00:00
editVal ( $X , $o ){ return $X ;} function
2017-04-21 11:23:04 +00:00
tableStructurePrint ( $p ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 45 ) . " <td> " . lang ( 46 ) . ( support ( " comment " ) ? " <td> " . lang ( 47 ) : " " ) . " </thead> \n " ; foreach ( $p
as $o ){ echo " <tr " . odd () . " ><th> " . h ( $o [ " field " ]), " <td><span title=' " . h ( $o [ " collation " ]) . " '> " . h ( $o [ " full_type " ]) . " </span> " ,( $o [ " null " ] ? " <i>NULL</i> " : " " ),( $o [ " auto_increment " ] ? " <i> " . lang ( 48 ) . " </i> " : " " ),( isset ( $o [ " default " ]) ? " <span title=' " . lang ( 49 ) . " '>[<b> " . h ( $o [ " default " ]) . " </b>]</span> " : " " ),( support ( " comment " ) ? " <td> " . nbsp ( $o [ " comment " ]) : " " ), " \n " ;} echo " </table> \n " ;} function
tableIndexesPrint ( $w ){ echo " <table cellspacing='0'> \n " ; foreach ( $w
as $C => $v ){ ksort ( $v [ " columns " ]); $Mf = array (); foreach ( $v [ " columns " ] as $y => $X ) $Mf [] = " <i> " . h ( $X ) . " </i> " . ( $v [ " lengths " ][ $y ] ? " ( " . $v [ " lengths " ][ $y ] . " ) " : " " ) . ( $v [ " descs " ][ $y ] ? " DESC " : " " ); echo " <tr title=' " . h ( $C ) . " '><th> $v[type] <td> " . implode ( " , " , $Mf ) . " \n " ;} echo " </table> \n " ;} function
selectColumnsPrint ( $M , $e ){ global $Zc , $ed ; print_fieldset ( " select " , lang ( 50 ), $M ); $s = 0 ; $M [ " " ] = array (); foreach ( $M
as $y => $X ){ $X = $_GET [ " columns " ][ $y ]; $d = select_input ( " name='columns[ $s ][col]' onchange=' " . ( $y !== " " ? " selectFieldChange(this.form) " : " selectAddRow(this) " ) . " ;' " , $e , $X [ " col " ]); echo " <div> " . ( $Zc || $ed ? " <select name='columns[ $s ][fun]' onchange='helpClose(); " . ( $y !== " " ? " " : " this.nextSibling.nextSibling.onchange(); " ) . " ' " . on_help ( " getTarget(event).value && getTarget(event).value.replace(/ | \$ /, '(') + ')' " , 1 ) . " > " . optionlist ( array ( - 1 => " " ) + array_filter ( array ( lang ( 51 ) => $Zc , lang ( 52 ) => $ed )), $X [ " fun " ]) . " </select> " . " ( $d ) " : $d ) . " </div> \n " ; $s ++ ;} echo " </div></fieldset> \n " ;} function
selectSearchPrint ( $Z , $e , $w ){ print_fieldset ( " search " , lang ( 53 ), $Z ); foreach ( $w
as $s => $v ){ if ( $v [ " type " ] == " FULLTEXT " ){ echo " (<i> " . implode ( " </i>, <i> " , array_map ( 'h' , $v [ " columns " ])) . " </i>) AGAINST " , " <input type='search' name='fulltext[ $s ]' value=' " . h ( $_GET [ " fulltext " ][ $s ]) . " ' onchange='selectFieldChange(this.form);'> " , checkbox ( " boolean[ $s ] " , 1 , isset ( $_GET [ " boolean " ][ $s ]), " BOOL " ), " <br> \n " ;}} $_GET [ " where " ] = ( array ) $_GET [ " where " ]; reset ( $_GET [ " where " ]); $Za = " this.nextSibling.onchange(); " ; for ( $s = 0 ; $s <= count ( $_GET [ " where " ]); $s ++ ){ list (, $X ) = each ( $_GET [ " where " ]); if ( ! $X || ( " $X[col] $X[val] " != " " && in_array ( $X [ " op " ], $this -> operators ))){ echo " <div> " . select_input ( " name='where[ $s ][col]' onchange=' $Za ' " , $e , $X [ " col " ], " ( " . lang ( 54 ) . " ) " ), html_select ( " where[ $s ][op] " , $this -> operators , $X [ " op " ], $Za ), " <input type='search' name='where[ $s ][val]' value=' " . h ( $X [ " val " ]) . " ' onchange=' " . ( $X ? " selectFieldChange(this.form) " : " selectAddRow(this) " ) . " ;' onkeydown='selectSearchKeydown(this, event);' onsearch='selectSearchSearch(this);'></div> \n " ;}} echo " </div></fieldset> \n " ;} function
selectOrderPrint ( $df , $e , $w ){ print_fieldset ( " sort " , lang ( 55 ), $df ); $s = 0 ; foreach (( array ) $_GET [ " order " ] as $y => $X ){ if ( $X != " " ){ echo " <div> " . select_input ( " name='order[ $s ]' onchange='selectFieldChange(this.form);' " , $e , $X ), checkbox ( " desc[ $s ] " , 1 , isset ( $_GET [ " desc " ][ $y ]), lang ( 56 )) . " </div> \n " ; $s ++ ;}} echo " <div> " . select_input ( " name='order[ $s ]' onchange='selectAddRow(this);' " , $e ), checkbox ( " desc[ $s ] " , 1 , false , lang ( 56 )) . " </div> \n " , " </div></fieldset> \n " ;} function
selectLimitPrint ( $z ){ echo " <fieldset><legend> " . lang ( 57 ) . " </legend><div> " ; echo " <input type='number' name='limit' class='size' value=' " . h ( $z ) . " ' onchange='selectFieldChange(this.form);'> " , " </div></fieldset> \n " ;} function
selectLengthPrint ( $uh ){ if ( $uh !== null ){ echo " <fieldset><legend> " . lang ( 58 ) . " </legend><div> " , " <input type='number' name='text_length' class='size' value=' " . h ( $uh ) . " '> " , " </div></fieldset> \n " ;}} function
selectActionPrint ( $w ){ echo " <fieldset><legend> " . lang ( 59 ) . " </legend><div> " , " <input type='submit' value=' " . lang ( 50 ) . " '> " , " <span id='noindex' title=' " . lang ( 60 ) . " '></span> " , " <script type='text/javascript'> \n " , " var indexColumns = " ; $e = array (); foreach ( $w
as $v ){ $Fb = reset ( $v [ " columns " ]); if ( $v [ " type " ] != " FULLTEXT " && $Fb ) $e [ $Fb ] = 1 ;} $e [ " " ] = 1 ; foreach ( $e
as $y => $X ) json_row ( $y ); echo " ; \n " , " selectFieldChange(document.getElementById('form')); \n " , " </script> \n " , " </div></fieldset> \n " ;} function
2014-04-01 18:00:42 +00:00
selectCommandPrint (){ return ! information_schema ( DB );} function
selectImportPrint (){ return ! information_schema ( DB );} function
2017-04-21 11:23:04 +00:00
selectEmailPrint ( $lc , $e ){} function
selectColumnsProcess ( $e , $w ){ global $Zc , $ed ; $M = array (); $cd = array (); foreach (( array ) $_GET [ " columns " ] as $y => $X ){ if ( $X [ " fun " ] == " count " || ( $X [ " col " ] != " " && ( ! $X [ " fun " ] || in_array ( $X [ " fun " ], $Zc ) || in_array ( $X [ " fun " ], $ed )))){ $M [ $y ] = apply_sql_function ( $X [ " fun " ],( $X [ " col " ] != " " ? idf_escape ( $X [ " col " ]) : " * " )); if ( ! in_array ( $X [ " fun " ], $ed )) $cd [] = $M [ $y ];}} return
array ( $M , $cd );} function
selectSearchProcess ( $p , $w ){ global $g , $x ; $J = array (); foreach ( $w
as $s => $v ){ if ( $v [ " type " ] == " FULLTEXT " && $_GET [ " fulltext " ][ $s ] != " " ) $J [] = " MATCH ( " . implode ( " , " , array_map ( 'idf_escape' , $v [ " columns " ])) . " ) AGAINST ( " . q ( $_GET [ " fulltext " ][ $s ]) . ( isset ( $_GET [ " boolean " ][ $s ]) ? " IN BOOLEAN MODE " : " " ) . " ) " ;} foreach (( array ) $_GET [ " where " ] as $X ){ if ( " $X[col] $X[val] " != " " && in_array ( $X [ " op " ], $this -> operators )){ $ub = " $X[op] " ; if ( preg_match ( '~IN$~' , $X [ " op " ])){ $rd = process_length ( $X [ " val " ]); $ub .= " " . ( $rd != " " ? $rd : " (NULL) " );} elseif ( $X [ " op " ] == " SQL " ) $ub = " $X[val] " ; elseif ( $X [ " op " ] == " LIKE %% " ) $ub = " LIKE " . $this -> processInput ( $p [ $X [ " col " ]], " % $X[val] % " ); elseif ( $X [ " op " ] == " ILIKE %% " ) $ub = " ILIKE " . $this -> processInput ( $p [ $X [ " col " ]], " % $X[val] % " ); elseif ( ! preg_match ( '~NULL$~' , $X [ " op " ])) $ub .= " " . $this -> processInput ( $p [ $X [ " col " ]], $X [ " val " ]); if ( $X [ " col " ] != " " ) $J [] = idf_escape ( $X [ " col " ]) . $ub ; else { $pb = array (); foreach ( $p
as $C => $o ){ $Gd = preg_match ( '~char|text|enum|set~' , $o [ " type " ]); if (( is_numeric ( $X [ " val " ]) ||! preg_match ( '~(^|[^o])int|float|double|decimal|bit~' , $o [ " type " ])) && ( ! preg_match ( " ~[ \x80 - \xFF ]~ " , $X [ " val " ]) || $Gd )){ $C = idf_escape ( $C ); $pb [] = ( $x == " sql " && $Gd &&! preg_match ( " ~^utf8_~ " , $o [ " collation " ]) ? " CONVERT( $C USING " . charset ( $g ) . " ) " : $C );}} $J [] = ( $pb ? " ( " . implode ( " $ub OR " , $pb ) . " $ub ) " : " 0 " );}}} return $J ;} function
selectOrderProcess ( $p , $w ){ $J = array (); foreach (( array ) $_GET [ " order " ] as $y => $X ){ if ( $X != " " ) $J [] = ( preg_match ( '~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~' , $X ) ? $X : idf_escape ( $X )) . ( isset ( $_GET [ " desc " ][ $y ]) ? " DESC " : " " );} return $J ;} function
2014-04-01 18:00:42 +00:00
selectLimitProcess (){ return ( isset ( $_GET [ " limit " ]) ? $_GET [ " limit " ] : " 50 " );} function
selectLengthProcess (){ return ( isset ( $_GET [ " text_length " ]) ? $_GET [ " text_length " ] : " 100 " );} function
2017-04-21 11:23:04 +00:00
selectEmailProcess ( $Z , $Sc ){ return
2014-04-01 18:00:42 +00:00
false ;} function
2017-04-21 11:23:04 +00:00
selectQueryBuild ( $M , $Z , $cd , $df , $z , $E ){ return " " ;} function
messageQuery ( $H , $vh ){ global $x ; restart_session (); $jd =& get_session ( " queries " ); $t = " sql- " . count ( $jd [ $_GET [ " db " ]]); if ( strlen ( $H ) > 1e6 ) $H = preg_replace ( '~[\x80-\xFF]+$~' , '' , substr ( $H , 0 , 1e6 )) . " \n ... " ; $jd [ $_GET [ " db " ]][] = array ( $H , time (), $vh ); return " <span class='time'> " .@ date ( " H:i:s " ) . " </span> <a href='# $t ' onclick= \" return !toggle(' $t '); \" > " . lang ( 61 ) . " </a> " . " <div id=' $t ' class='hidden'><pre><code class='jush- $x '> " . shorten_utf8 ( $H , 1000 ) . '</code></pre>' . ( $vh ? " <span class='time'>( $vh )</span> " : '' ) . ( support ( " sql " ) ? '<p><a href="' . h ( str_replace ( " db= " . urlencode ( DB ), " db= " . urlencode ( $_GET [ " db " ]), ME ) . 'sql=&history=' . ( count ( $jd [ $_GET [ " db " ]]) - 1 )) . '">' . lang ( 10 ) . '</a>' : '' ) . '</div>' ;} function
editFunctions ( $o ){ global $gc ; $J = ( $o [ " null " ] ? " NULL/ " : " " ); foreach ( $gc
as $y => $Zc ){ if ( ! $y || ( ! isset ( $_GET [ " call " ]) && ( isset ( $_GET [ " select " ]) || where ( $_GET )))){ foreach ( $Zc
as $Af => $X ){ if ( ! $Af || preg_match ( " ~ $Af ~ " , $o [ " type " ])) $J .= " / $X " ;} if ( $y &&! preg_match ( '~set|blob|bytea|raw|file~' , $o [ " type " ])) $J .= " /SQL " ;}} if ( $o [ " auto_increment " ] &&! isset ( $_GET [ " select " ]) &&! where ( $_GET )) $J = lang ( 48 ); return
2014-04-01 18:00:42 +00:00
explode ( " / " , $J );} function
2017-04-21 11:23:04 +00:00
editInput ( $R , $o , $Ja , $Y ){ if ( $o [ " type " ] == " enum " ) return ( isset ( $_GET [ " select " ]) ? " <label><input type='radio' $Ja value='-1' checked><i> " . lang ( 8 ) . " </i></label> " : " " ) . ( $o [ " null " ] ? " <label><input type='radio' $Ja value='' " . ( $Y !== null || isset ( $_GET [ " select " ]) ? " " : " checked " ) . " ><i>NULL</i></label> " : " " ) . enum_input ( " radio " , $Ja , $o , $Y , 0 ); return " " ;} function
2015-04-01 06:36:56 +00:00
processInput ( $o , $Y , $r = " " ){ if ( $r == " SQL " ) return $Y ; $C = $o [ " field " ]; $J = q ( $Y ); if ( preg_match ( '~^(now|getdate|uuid)$~' , $r )) $J = " $r () " ; elseif ( preg_match ( '~^current_(date|timestamp)$~' , $r )) $J = $r ; elseif ( preg_match ( '~^([+-]|\\|\\|)$~' , $r )) $J = idf_escape ( $C ) . " $r $J " ; elseif ( preg_match ( '~^[+-] interval$~' , $r )) $J = idf_escape ( $C ) . " $r " . ( preg_match ( " ~^( \\ d+|'[0-9.: -]') [A-Z_]+ $ ~i " , $Y ) ? $Y : $J ); elseif ( preg_match ( '~^(addtime|subtime|concat)$~' , $r )) $J = " $r ( " . idf_escape ( $C ) . " , $J ) " ; elseif ( preg_match ( '~^(md5|sha1|password|encrypt)$~' , $r )) $J = " $r ( $J ) " ; return
unconvert_field ( $o , $J );} function
2017-04-21 11:23:04 +00:00
dumpOutput (){ $J = array ( 'text' => lang ( 62 ), 'file' => lang ( 63 )); if ( function_exists ( 'gzencode' )) $J [ 'gz' ] = 'gzip' ; return $J ;} function
2014-04-01 18:00:42 +00:00
dumpFormat (){ return
array ( 'sql' => 'SQL' , 'csv' => 'CSV,' , 'csv;' => 'CSV;' , 'tsv' => 'TSV' );} function
2015-04-01 06:36:56 +00:00
dumpDatabase ( $m ){} function
2017-04-21 11:23:04 +00:00
dumpTable ( $R , $Zg , $Hd = 0 ){ if ( $_POST [ " format " ] != " sql " ){ echo " \xef \xbb \xbf " ; if ( $Zg ) dump_csv ( array_keys ( fields ( $R )));} else { if ( $Hd == 2 ){ $p = array (); foreach ( fields ( $R ) as $C => $o ) $p [] = idf_escape ( $C ) . " $o[full_type] " ; $i = " CREATE TABLE " . table ( $R ) . " ( " . implode ( " , " , $p ) . " ) " ;} else $i = create_sql ( $R , $_POST [ " auto_increment " ]); set_utf8mb4 ( $i ); if ( $Zg && $i ){ if ( $Zg == " DROP+CREATE " || $Hd == 1 ) echo " DROP " . ( $Hd == 2 ? " VIEW " : " TABLE " ) . " IF EXISTS " . table ( $R ) . " ; \n " ; if ( $Hd == 1 ) $i = remove_definer ( $i ); echo " $i ; \n \n " ;}}} function
dumpData ( $R , $Zg , $H ){ global $g , $x ; $me = ( $x == " sqlite " ? 0 : 1048576 ); if ( $Zg ){ if ( $_POST [ " format " ] == " sql " ){ if ( $Zg == " TRUNCATE+INSERT " ) echo
truncate_sql ( $R ) . " ; \n " ; $p = fields ( $R );} $I = $g -> query ( $H , 1 ); if ( $I ){ $_d = " " ; $Xa = " " ; $Od = array (); $bh = " " ; $Hc = ( $R != '' ? 'fetch_assoc' : 'fetch_row' ); while ( $K = $I -> $Hc ()){ if ( ! $Od ){ $ji = array (); foreach ( $K
as $X ){ $o = $I -> fetch_field (); $Od [] = $o -> name ; $y = idf_escape ( $o -> name ); $ji [] = " $y = VALUES( $y ) " ;} $bh = ( $Zg == " INSERT+UPDATE " ? " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $ji ) : " " ) . " ; \n " ;} if ( $_POST [ " format " ] != " sql " ){ if ( $Zg == " table " ){ dump_csv ( $Od ); $Zg = " INSERT " ;} dump_csv ( $K );} else { if ( ! $_d ) $_d = " INSERT INTO " . table ( $R ) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $Od )) . " ) VALUES " ; foreach ( $K
as $y => $X ){ $o = $p [ $y ]; $K [ $y ] = ( $X !== null ? unconvert_field ( $o , preg_match ( '~(^|[^o])int|float|double|decimal~' , $o [ " type " ]) && $X != '' ? $X : q ( $X )) : " NULL " );} $vg = ( $me ? " \n " : " " ) . " ( " . implode ( " , \t " , $K ) . " ) " ; if ( ! $Xa ) $Xa = $_d . $vg ; elseif ( strlen ( $Xa ) + 4 + strlen ( $vg ) + strlen ( $bh ) < $me ) $Xa .= " , $vg " ; else { echo $Xa . $bh ; $Xa = $_d . $vg ;}}} if ( $Xa ) echo $Xa . $bh ;} elseif ( $_POST [ " format " ] == " sql " ) echo " -- " . str_replace ( " \n " , " " , $g -> error ) . " \n " ;}} function
dumpFilename ( $od ){ return
friendly_url ( $od != " " ? $od : ( SERVER != " " ? SERVER : " localhost " ));} function
dumpHeaders ( $od , $Ae = false ){ $of = $_POST [ " output " ]; $Bc = ( preg_match ( '~sql~' , $_POST [ " format " ]) ? " sql " : ( $Ae ? " tar " : " csv " )); header ( " Content-Type: " . ( $of == " gz " ? " application/x-gzip " : ( $Bc == " tar " ? " application/x-tar " : ( $Bc == " sql " || $of != " file " ? " text/plain " : " text/csv " ) . " ; charset=utf-8 " ))); if ( $of == " gz " ) ob_start ( 'ob_gzencode' , 1e6 ); return $Bc ;} function
homepage (){ echo '<p class="links">' . ( $_GET [ " ns " ] == " " && support ( " database " ) ? '<a href="' . h ( ME ) . 'database=">' . lang ( 64 ) . " </a> \n " : " " ),( support ( " scheme " ) ? " <a href=' " . h ( ME ) . " scheme='> " . ( $_GET [ " ns " ] != " " ? lang ( 65 ) : lang ( 66 )) . " </a> \n " : " " ),( $_GET [ " ns " ] !== " " ? '<a href="' . h ( ME ) . 'schema=">' . lang ( 67 ) . " </a> \n " : " " ),( support ( " privileges " ) ? " <a href=' " . h ( ME ) . " privileges='> " . lang ( 68 ) . " </a> \n " : " " ); return
2014-04-01 18:00:42 +00:00
true ;} function
2017-04-21 11:23:04 +00:00
navigation ( $_e ){ global $ia , $x , $Yb , $g ; echo ' < h1 >
2014-04-01 18:00:42 +00:00
',$this->name(),' < span class = " version " > ',$ia,' </ span >
2016-10-11 12:23:21 +00:00
< a href = " https://www.adminer.org/#download " target = " _blank " id = " version " > ',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),' </ a >
2014-04-01 18:00:42 +00:00
</ h1 >
2017-04-21 11:23:04 +00:00
' ; if ( $_e == " auth " ){ $Mc = true ; foreach (( array ) $_SESSION [ " pwds " ] as $li => $Ig ){ foreach ( $Ig
as $N => $gi ){ foreach ( $gi
as $V => $G ){ if ( $G !== null ){ if ( $Mc ){ echo " <p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'> \n " ; $Mc = false ;} $Kb = $_SESSION [ " db " ][ $li ][ $N ][ $V ]; foreach (( $Kb ? array_keys ( $Kb ) : array ( " " )) as $m ) echo " <a href=' " . h ( auth_url ( $li , $N , $V , $m )) . " '>( $Yb[$li] ) " . h ( $V . ( $N != " " ? " @ $N " : " " ) . ( $m != " " ? " - $m " : " " )) . " </a><br> \n " ;}}}}} else { if ( $_GET [ " ns " ] !== " " &&! $_e && DB != " " ){ $g -> select_db ( DB ); $T = table_status ( '' , true );} echo '<script type="text/javascript" src="' , h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=jush.js&version=4.3.1 " , ' " ></script>
';if(support("sql")){echo' < script type = " text/javascript " >
' ; if ( $T ){ $ee = array (); foreach ( $T
as $R => $U ) $ee [] = preg_quote ( $R , '/' ); echo " var jushLinks = { $x : [ ' " . js_escape ( ME ) . ( support ( " table " ) ? " table= " : " select= " ) . " \$ &', / \\ b( " . implode ( " | " , $ee ) . " ) \\ b/g ] }; \n " ; foreach ( array ( " bac " , " bra " , " sqlite_quo " , " mssql_bra " ) as $X ) echo " jushLinks. $X = jushLinks. $x ; \n " ;} echo 'bodyLoad(\'' ,( is_object ( $g ) ? substr ( $g -> server_info , 0 , 3 ) : " " ), ' \ ' );
2014-04-01 18:00:42 +00:00
</ script >
2017-04-21 11:23:04 +00:00
';}$this->databasesPrint($_e);if(DB==""||!$_e){echo"<p class=' links '>".(support("sql")?"<a href=' " .h(ME). " sql = '".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(61)."</a>\n<a href=' " .h(ME). " import = '".bold(isset($_GET["import"])).">".lang(69)."</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(70)."</a>\n";}if($_GET["ns"]!==""&&!$_e&&DB!=""){echo' < a href = " '.h(ME).'create= " '.bold($_GET["create"]==="").">".lang(71)."</a>\n";if(!$T)echo"<p class=' message ' > " .lang(9). " \n " ;else $this->tablesPrint ( $T );}}}function
databasesPrint ( $_e ){ global $b , $g ; $l = $this -> databases (); echo ' < form action = " " >
2014-04-01 18:00:42 +00:00
< p id = " dbs " >
2017-04-21 11:23:04 +00:00
';hidden_fields_get();$Ib=" onmousedown=' dbMouseDown ( event , this ); ' onchange=' dbChange ( this ); '";echo"<span title=' " .lang(72). " '>DB</span>: ".($l?"<select name=' db '$Ib>".optionlist(array(""=>"")+$l,DB)."</select>":' < input name = " db " value = " '.h(DB).' " autocapitalize = " off " > '),"<input type=' submit ' value=' " .lang(20). " '".($l?" class=' hidden '":"").">\n";if($_e!="db"&&DB!=""&&$g->select_db(DB)){if(support("scheme")){echo"<br>".lang(73).": <select name=' ns '$Ib>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>";if($_GET["ns"]!="")set_schema($_GET["ns"]);}}echo(isset($_GET["sql"])?' < input type = " hidden " name = " sql " value = " " > ':(isset($_GET["schema"])?' < input type = " hidden " name = " schema " value = " " > ':(isset($_GET["dump"])?' < input type = " hidden " name = " dump " value = " " > ':(isset($_GET["privileges"])?' < input type = " hidden " name = " privileges " value = " " > ' : " " )))), " </p></form> \n " ;} function
tablesPrint ( $T ){ echo " <ul id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'> \n " ; foreach ( $T
as $R => $P ){ echo '<li><a href="' . h ( ME ) . 'select=' . urlencode ( $R ) . '"' . bold ( $_GET [ " select " ] == $R || $_GET [ " edit " ] == $R , " select " ) . " > " . lang ( 74 ) . " </a> " ; $C = $this -> tableName ( $P ); echo ( support ( " table " ) || support ( " indexes " ) ? '<a href="' . h ( ME ) . 'table=' . urlencode ( $R ) . '"' . bold ( in_array ( $R , array ( $_GET [ " table " ], $_GET [ " create " ], $_GET [ " indexes " ], $_GET [ " foreign " ], $_GET [ " trigger " ])),( is_view ( $P ) ? " view " : " structure " )) . " title=' " . lang ( 40 ) . " '> $C </a> " : " <span> $C </span> " ) . " \n " ;} echo " </ul> \n " ;}} $b = ( function_exists ( 'adminer_object' ) ? adminer_object () : new
Adminer ); if ( $b -> operators === null ) $b -> operators = $Ye ; function
page_header ( $yh , $n = " " , $Wa = array (), $zh = " " ){ global $ca , $ia , $b , $Yb , $x ; page_headers (); if ( is_ajax () && $n ){ page_messages ( $n ); exit ;} $_h = $yh . ( $zh != " " ? " : $zh " : " " ); $Ah = strip_tags ( $_h . ( SERVER != " " && SERVER != " localhost " ? h ( " - " . SERVER ) : " " ) . " - " . $b -> name ()); echo ' <! DOCTYPE html >
< html lang = " ', $ca ,' " dir = " ',lang(75),' " >
2014-04-01 18:00:42 +00:00
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " >
< meta http - equiv = " Content-Script-Type " content = " text/javascript " >
< meta name = " robots " content = " noindex " >
2015-04-01 06:36:56 +00:00
< meta name = " referrer " content = " origin-when-crossorigin " >
2017-04-21 11:23:04 +00:00
< title > ',$Ah,' </ title >
< link rel = " stylesheet " type = " text/css " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = default . css & amp ; version = 4.3 . 1 " ,' " >
< script type = " text/javascript " src = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = functions . js & amp ; version = 4.3 . 1 " ,' " ></ script >
';if($b->head()){echo' < link rel = " shortcut icon " type = " image/x-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = favicon . ico & amp ; version = 4.3 . 1 " ,' " >
< link rel = " apple-touch-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = favicon . ico & amp ; version = 4.3 . 1 " ,' " >
2014-04-01 18:00:42 +00:00
';if(file_exists("adminer.css")){echo' < link rel = " stylesheet " type = " text/css " href = " adminer.css " >
';}}echo'
2017-04-21 11:23:04 +00:00
< body class = " ',lang(75),' nojs " onkeydown = " bodyKeydown(event); " onclick = " bodyClick(event); " ',(isset($_COOKIE["adminer_version"])?"":" onload=\"verifyVersion(' $ia ' ); \ " " ); ?> >
2014-04-01 18:00:42 +00:00
< script type = " text/javascript " >
2015-04-01 06:36:56 +00:00
document . body . className = document . body . className . replace ( / nojs / , ' js' );
var offlineMessage = ' < ? php echo
2017-04-21 11:23:04 +00:00
js_escape ( lang ( 76 )), ' \ ' ;
2014-04-01 18:00:42 +00:00
</ script >
2017-04-21 11:23:04 +00:00
< div id = " help " class = " jush-', $x ,' jsonly hidden " onmouseover = " helpOpen = 1; " onmouseout = " helpMouseout(this, event); " ></ div >
2014-04-01 18:00:42 +00:00
< div id = " content " >
2017-04-21 11:23:04 +00:00
';if($Wa!==null){$_=substr(preg_replace(' ~ \b ( username | db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);echo' < p id = " breadcrumb " >< a href = " '.h( $_ ? $_ : " . " ).' " > '.$Yb[DRIVER].' </ a > & raquo ; ';$_=substr(preg_replace(' ~ \b ( db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);$N=(SERVER!=""?h(SERVER):lang(32));if($Wa===false)echo"$N\n";else{echo"<a href=' " .( $_ ?h( $_ ): " . " ). " ' accesskey=' 1 ' title=' Alt + Shift + 1 '>$N</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Wa)))echo' < a href = " '.h( $_ . " & db = " .urlencode(DB).(support( " scheme " )? " & ns = " : " " )).' " > '.h(DB).' </ a > & raquo ; ';if(is_array($Wa)){if($_GET["ns"]!="")echo' < a href = " '.h(substr(ME,0,-1)).' " > '.h($_GET["ns"]).' </ a > & raquo ; ' ; foreach ( $Wa
as $y => $X ){ $Pb = ( is_array ( $X ) ? $X [ 1 ] : h ( $X )); if ( $Pb != " " ) echo " <a href=' " . h ( ME . " $y = " ) . urlencode ( is_array ( $X ) ? $X [ 0 ] : $X ) . " '> $Pb </a> » " ;}} echo " $yh\n " ;}} echo " <h2> $_h </h2> \n " , " <div id='ajaxstatus' class='jsonly hidden'></div> \n " ; restart_session (); page_messages ( $n ); $l =& get_session ( " dbs " ); if ( DB != " " && $l &&! in_array ( DB , $l , true )) $l = null ; stop_session (); define ( " PAGE_HEADER " , 1 );} function
page_headers (){ global $b ; header ( " Content-Type: text/html; charset=utf-8 " ); header ( " Cache-Control: no-cache " ); if ( $b -> headers ()){ header ( " X-Frame-Options: deny " ); header ( " X-XSS-Protection: 0 " );}} function
page_messages ( $n ){ $ai = preg_replace ( '~^[^?]*~' , '' , $_SERVER [ " REQUEST_URI " ]); $we = $_SESSION [ " messages " ][ $ai ]; if ( $we ){ echo " <div class='message'> " . implode ( " </div> \n <div class='message'> " , $we ) . " </div> \n " ; unset ( $_SESSION [ " messages " ][ $ai ]);} if ( $n ) echo " <div class='error'> $n </div> \n " ;} function
page_footer ( $_e = " " ){ global $b , $Dh ; echo ' </ div >
2014-04-01 18:00:42 +00:00
2017-04-21 11:23:04 +00:00
';switch_lang();if($_e!="auth"){echo' < form action = " " method = " post " >
2014-04-01 18:00:42 +00:00
< p class = " logout " >
2017-04-21 11:23:04 +00:00
< input type = " submit " name = " logout " value = " ',lang(77),' " id = " logout " >
< input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ p >
</ form >
';}echo' < div id = " menu " >
2017-04-21 11:23:04 +00:00
';$b->navigation($_e);echo' </ div >
2014-04-01 18:00:42 +00:00
< script type = " text/javascript " > setupSubmitHighlight ( document ); </ script >
' ;} function
2017-04-21 11:23:04 +00:00
int32 ( $Ce ){ while ( $Ce >= 2147483648 ) $Ce -= 4294967296 ; while ( $Ce <=- 2147483649 ) $Ce += 4294967296 ; return ( int ) $Ce ;} function
long2str ( $W , $qi ){ $vg = '' ; foreach ( $W
as $X ) $vg .= pack ( 'V' , $X ); if ( $qi ) return
substr ( $vg , 0 , end ( $W )); return $vg ;} function
str2long ( $vg , $qi ){ $W = array_values ( unpack ( 'V*' , str_pad ( $vg , 4 * ceil ( strlen ( $vg ) / 4 ), " \0 " ))); if ( $qi ) $W [] = strlen ( $vg ); return $W ;} function
xxtea_mx ( $wi , $vi , $ch , $Kd ){ return
int32 ((( $wi >> 5 & 0x7FFFFFF ) ^ $vi << 2 ) + (( $vi >> 3 & 0x1FFFFFFF ) ^ $wi << 4 )) ^ int32 (( $ch ^ $vi ) + ( $Kd ^ $wi ));} function
encrypt_string ( $Xg , $y ){ if ( $Xg == " " ) return " " ; $y = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $y )))); $W = str2long ( $Xg , true ); $Ce = count ( $W ) - 1 ; $wi = $W [ $Ce ]; $vi = $W [ 0 ]; $Tf = floor ( 6 + 52 / ( $Ce + 1 )); $ch = 0 ; while ( $Tf --> 0 ){ $ch = int32 ( $ch + 0x9E3779B9 ); $fc = $ch >> 2 & 3 ; for ( $pf = 0 ; $pf < $Ce ; $pf ++ ){ $vi = $W [ $pf + 1 ]; $Be = xxtea_mx ( $wi , $vi , $ch , $y [ $pf & 3 ^ $fc ]); $wi = int32 ( $W [ $pf ] + $Be ); $W [ $pf ] = $wi ;} $vi = $W [ 0 ]; $Be = xxtea_mx ( $wi , $vi , $ch , $y [ $pf & 3 ^ $fc ]); $wi = int32 ( $W [ $Ce ] + $Be ); $W [ $Ce ] = $wi ;} return
2014-04-01 18:00:42 +00:00
long2str ( $W , false );} function
2017-04-21 11:23:04 +00:00
decrypt_string ( $Xg , $y ){ if ( $Xg == " " ) return " " ; if ( ! $y ) return
false ; $y = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $y )))); $W = str2long ( $Xg , false ); $Ce = count ( $W ) - 1 ; $wi = $W [ $Ce ]; $vi = $W [ 0 ]; $Tf = floor ( 6 + 52 / ( $Ce + 1 )); $ch = int32 ( $Tf * 0x9E3779B9 ); while ( $ch ){ $fc = $ch >> 2 & 3 ; for ( $pf = $Ce ; $pf > 0 ; $pf -- ){ $wi = $W [ $pf - 1 ]; $Be = xxtea_mx ( $wi , $vi , $ch , $y [ $pf & 3 ^ $fc ]); $vi = int32 ( $W [ $pf ] - $Be ); $W [ $pf ] = $vi ;} $wi = $W [ $Ce ]; $Be = xxtea_mx ( $wi , $vi , $ch , $y [ $pf & 3 ^ $fc ]); $vi = int32 ( $W [ 0 ] - $Be ); $W [ 0 ] = $vi ; $ch = int32 ( $ch - 0x9E3779B9 );} return
long2str ( $W , true );} $g = '' ; $id = $_SESSION [ " token " ]; if ( ! $id ) $_SESSION [ " token " ] = rand ( 1 , 1e6 ); $Dh = get_token (); $Bf = array (); if ( $_COOKIE [ " adminer_permanent " ]){ foreach ( explode ( " " , $_COOKIE [ " adminer_permanent " ]) as $X ){ list ( $y ) = explode ( " : " , $X ); $Bf [ $y ] = $X ;}} function
add_invalid_login (){ global $b ; $Kc = get_temp_dir () . " /adminer.invalid " ; $Xc =@ fopen ( $Kc , " r+ " ); if ( ! $Xc ){ $Xc =@ fopen ( $Kc , " w " ); if ( ! $Xc ) return ;} flock ( $Xc , LOCK_EX ); $Cd = unserialize ( stream_get_contents ( $Xc )); $vh = time (); if ( $Cd ){ foreach ( $Cd
as $Dd => $X ){ if ( $X [ 0 ] < $vh ) unset ( $Cd [ $Dd ]);}} $Bd =& $Cd [ $b -> bruteForceKey ()]; if ( ! $Bd ) $Bd = array ( $vh + 30 * 60 , 0 ); $Bd [ 1 ] ++ ; $Gg = serialize ( $Cd ); rewind ( $Xc ); fwrite ( $Xc , $Gg ); ftruncate ( $Xc , strlen ( $Gg )); flock ( $Xc , LOCK_UN ); fclose ( $Xc );} $Ka = $_POST [ " auth " ]; if ( $Ka ){ $Cd = unserialize ( @ file_get_contents ( get_temp_dir () . " /adminer.invalid " )); $Bd = $Cd [ $b -> bruteForceKey ()]; $Ie = ( $Bd [ 1 ] > 30 ? $Bd [ 0 ] - time () : 0 ); if ( $Ie > 0 ) auth_error ( lang ( 78 , ceil ( $Ie / 60 ))); session_regenerate_id (); $li = $Ka [ " driver " ]; $N = $Ka [ " server " ]; $V = $Ka [ " username " ]; $G = ( string ) $Ka [ " password " ]; $m = $Ka [ " db " ]; set_password ( $li , $N , $V , $G ); $_SESSION [ " db " ][ $li ][ $N ][ $V ][ $m ] = true ; if ( $Ka [ " permanent " ]){ $y = base64_encode ( $li ) . " - " . base64_encode ( $N ) . " - " . base64_encode ( $V ) . " - " . base64_encode ( $m ); $Nf = $b -> permanentLogin ( true ); $Bf [ $y ] = " $y : " . base64_encode ( $Nf ? encrypt_string ( $G , $Nf ) : " " ); cookie ( " adminer_permanent " , implode ( " " , $Bf ));} if ( count ( $_POST ) == 1 || DRIVER != $li || SERVER != $N || $_GET [ " username " ] !== $V || DB != $m ) redirect ( auth_url ( $li , $N , $V , $m ));} elseif ( $_POST [ " logout " ]){ if ( $id &&! verify_token ()){ page_header ( lang ( 77 ), lang ( 79 )); page_footer ( " db " ); exit ;} else { foreach ( array ( " pwds " , " db " , " dbs " , " queries " ) as $y ) set_session ( $y , null ); unset_permanent (); redirect ( substr ( preg_replace ( '~\b(username|db|ns)=[^&]*&~' , '' , ME ), 0 , - 1 ), lang ( 80 ));}} elseif ( $Bf &&! $_SESSION [ " pwds " ]){ session_regenerate_id (); $Nf = $b -> permanentLogin (); foreach ( $Bf
as $y => $X ){ list (, $hb ) = explode ( " : " , $X ); list ( $li , $N , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $y )); set_password ( $li , $N , $V , decrypt_string ( base64_decode ( $hb ), $Nf )); $_SESSION [ " db " ][ $li ][ $N ][ $V ][ $m ] = true ;}} function
unset_permanent (){ global $Bf ; foreach ( $Bf
as $y => $X ){ list ( $li , $N , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $y )); if ( $li == DRIVER && $N == SERVER && $V == $_GET [ " username " ] && $m == DB ) unset ( $Bf [ $y ]);} cookie ( " adminer_permanent " , implode ( " " , $Bf ));} function
auth_error ( $n ){ global $b , $id ; $Jg = session_name (); if ( isset ( $_GET [ " username " ])){ header ( " HTTP/1.1 403 Forbidden " ); if (( $_COOKIE [ $Jg ] || $_GET [ $Jg ]) &&! $id ) $n = lang ( 81 ); else { add_invalid_login (); $G = get_password (); if ( $G !== null ){ if ( $G === false ) $n .= '<br>' . lang ( 82 , '<code>permanentLogin()</code>' ); set_password ( DRIVER , SERVER , $_GET [ " username " ], null );} unset_permanent ();}} if ( ! $_COOKIE [ $Jg ] && $_GET [ $Jg ] && ini_bool ( " session.use_only_cookies " )) $n = lang ( 83 ); $F = session_get_cookie_params (); cookie ( " adminer_key " ,( $_COOKIE [ " adminer_key " ] ? $_COOKIE [ " adminer_key " ] : rand_string ()), $F [ " lifetime " ]); page_header ( lang ( 36 ), $n , null ); echo " <form action='' method='post'> \n " ; $b -> loginForm (); echo " <div> " ; hidden_fields ( $_POST , array ( " auth " )); echo " </div> \n " , " </form> \n " ; page_footer ( " auth " ); exit ;} if ( isset ( $_GET [ " username " ])){ if ( ! class_exists ( " Min_DB " )){ unset ( $_SESSION [ " pwds " ][ DRIVER ]); unset_permanent (); page_header ( lang ( 84 ), lang ( 85 , implode ( " , " , $Hf )), false ); page_footer ( " auth " ); exit ;} $g = connect ();} $Xb = new
Min_Driver ( $g ); if ( ! is_object ( $g ) || ( $fe = $b -> login ( $_GET [ " username " ], get_password ())) !== true ) auth_error (( is_string ( $g ) ? h ( $g ) : ( is_string ( $fe ) ? $fe : lang ( 86 )))); if ( $Ka && $_POST [ " token " ]) $_POST [ " token " ] = $Dh ; $n = '' ; if ( $_POST ){ if ( ! verify_token ()){ $xd = " max_input_vars " ; $qe = ini_get ( $xd ); if ( extension_loaded ( " suhosin " )){ foreach ( array ( " suhosin.request.max_vars " , " suhosin.post.max_vars " ) as $y ){ $X = ini_get ( $y ); if ( $X && ( ! $qe || $X < $qe )){ $xd = $y ; $qe = $X ;}}} $n = ( ! $_POST [ " token " ] && $qe ? lang ( 87 , " ' $xd ' " ) : lang ( 79 ) . ' ' . lang ( 88 ));}} elseif ( $_SERVER [ " REQUEST_METHOD " ] == " POST " ){ $n = lang ( 89 , " 'post_max_size' " ); if ( isset ( $_GET [ " sql " ])) $n .= ' ' . lang ( 90 );} if ( ! ini_bool ( " session.use_cookies " ) ||@ ini_set ( " session.use_cookies " , false ) !== false ) session_write_close (); function
select ( $I , $h = null , $gf = array (), $z = 0 ){ global $x ; $ee = array (); $w = array (); $e = array (); $Ta = array (); $Rh = array (); $J = array (); odd ( '' ); for ( $s = 0 ;( ! $z || $s < $z ) && ( $K = $I -> fetch_row ()); $s ++ ){ if ( ! $s ){ echo " <table cellspacing='0' class='nowrap'> \n " , " <thead><tr> " ; for ( $Jd = 0 ; $Jd < count ( $K ); $Jd ++ ){ $o = $I -> fetch_field (); $C = $o -> name ; $ff = $o -> orgtable ; $ef = $o -> orgname ; $J [ $o -> table ] = $ff ; if ( $gf && $x == " sql " ) $ee [ $Jd ] = ( $C == " table " ? " table= " : ( $C == " possible_keys " ? " indexes= " : null )); elseif ( $ff != " " ){ if ( ! isset ( $w [ $ff ])){ $w [ $ff ] = array (); foreach ( indexes ( $ff , $h ) as $v ){ if ( $v [ " type " ] == " PRIMARY " ){ $w [ $ff ] = array_flip ( $v [ " columns " ]); break ;}} $e [ $ff ] = $w [ $ff ];} if ( isset ( $e [ $ff ][ $ef ])){ unset ( $e [ $ff ][ $ef ]); $w [ $ff ][ $ef ] = $Jd ; $ee [ $Jd ] = $ff ;}} if ( $o -> charsetnr == 63 ) $Ta [ $Jd ] = true ; $Rh [ $Jd ] = $o -> type ; echo " <th " . ( $ff != " " || $o -> name != $ef ? " title=' " . h (( $ff != " " ? " $ff . " : " " ) . $ef ) . " ' " : " " ) . " > " . h ( $C ) . ( $gf ? doc_link ( array ( 'sql' => " explain-output.html#explain_ " . strtolower ( $C ))) : " " );} echo " </thead> \n " ;} echo " <tr " . odd () . " > " ; foreach ( $K
as $y => $X ){ if ( $X === null ) $X = " <i>NULL</i> " ; elseif ( $Ta [ $y ] &&! is_utf8 ( $X )) $X = " <i> " . lang ( 44 , strlen ( $X )) . " </i> " ; elseif ( ! strlen ( $X )) $X = " " ; else { $X = h ( $X ); if ( $Rh [ $y ] == 254 ) $X = " <code> $X </code> " ;} if ( isset ( $ee [ $y ]) &&! $e [ $ee [ $y ]]){ if ( $gf && $x == " sql " ){ $R = $K [ array_search ( " table= " , $ee )]; $_ = $ee [ $y ] . urlencode ( $gf [ $R ] != " " ? $gf [ $R ] : $R );} else { $_ = " edit= " . urlencode ( $ee [ $y ]); foreach ( $w [ $ee [ $y ]] as $lb => $Jd ) $_ .= " &where " . urlencode ( " [ " . bracket_escape ( $lb ) . " ] " ) . " = " . urlencode ( $K [ $Jd ]);} $X = " <a href=' " . h ( ME . $_ ) . " '> $X </a> " ;} echo " <td> $X " ;}} echo ( $s ? " </table> " : " <p class='message'> " . lang ( 12 )) . " \n " ; return $J ;} function
referencable_primary ( $Cg ){ $J = array (); foreach ( table_status ( '' , true ) as $gh => $R ){ if ( $gh != $Cg && fk_support ( $R )){ foreach ( fields ( $gh ) as $o ){ if ( $o [ " primary " ]){ if ( $J [ $gh ]){ unset ( $J [ $gh ]); break ;} $J [ $gh ] = $o ;}}}} return $J ;} function
textarea ( $C , $Y , $L = 10 , $pb = 80 ){ global $x ; echo " <textarea name=' $C ' rows=' $L ' cols=' $pb ' class='sqlarea jush- $x ' spellcheck='false' wrap='off'> " ; if ( is_array ( $Y )){ foreach ( $Y
2014-04-01 18:00:42 +00:00
as $X ) echo
h ( $X [ 0 ]) . " \n \n \n " ;} else
echo
h ( $Y ); echo " </textarea> " ;} function
2017-04-21 11:23:04 +00:00
edit_type ( $y , $o , $ob , $Tc = array ()){ global $Yg , $Rh , $Yh , $Te ; $U = $o [ " type " ]; echo '<td><select name="' , h ( $y ), '[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"' , on_help ( " getTarget(event).value " , 1 ), ' aria-labelledby="label-type">' ; if ( $U &&! isset ( $Rh [ $U ]) &&! isset ( $Tc [ $U ])) array_unshift ( $Yg , $U ); if ( $Tc ) $Yg [ lang ( 91 )] = $Tc ; echo
optionlist ( $Yg , $U ), ' </ select >
< td >< input name = " ',h( $y ),'[length] " value = " ',h( $o["length"] ),' " size = " 3 " onfocus = " editingLengthFocus(this); " ',(!$o["length"]&&preg_match(' ~ var ( char | binary ) $ ~ ',$U)?" class=' required '":""),' onchange = " editingLengthChange(this); " onkeyup = " this.onchange(); " aria - labelledby = " label-length " >< td class = " options " > ';echo"<select name=' " .h( $y ). " [ collation ] '".(preg_match(' ~ ( char | text | enum | set ) $ ~ ',$U)?"":" class=' hidden '").' >< option value = " " > ( '.lang(92).' ) '.optionlist($ob,$o["collation"]).' </ select > ',($Yh?"<select name=' " .h( $y ). " [ unsigned ] '".(!$U||preg_match(' ~ (( ^| [ ^ o ]) int | float | double | decimal ) $ ~ ',$U)?"":" class=' hidden '").' >< option > '.optionlist($Yh,$o["unsigned"]).' </ select > ':' '),(isset($o[' on_update '])?"<select name=' " .h( $y ). " [ on_update ] '".(preg_match(' ~ timestamp | datetime ~ ',$U)?"":" class=' hidden '").' > '.optionlist(array(""=>"(".lang(93).")","CURRENT_TIMESTAMP"),$o["on_update"]).' </ select > ':' '),($Tc?"<select name=' " .h( $y ). " [ on_delete ] '".(preg_match("~`~",$U)?"":" class=' hidden '")."><option value=' ' > ( " .lang(94). " ) " .optionlist(explode( " | " , $Te ), $o["on_delete"] ). " </ select > " : " " );}function
process_length ( $be ){ global $qc ; return ( preg_match ( " ~^ \\ s* \\ (? \\ s* $qc (?: \\ s*, \\ s* $qc )*+ \\ s* \\ )? \\ s* \$ ~ " , $be ) && preg_match_all ( " ~ $qc ~ " , $be , $ke ) ? " ( " . implode ( " , " , $ke [ 0 ]) . " ) " : preg_replace ( '~^[0-9].*~' , '(\0)' , preg_replace ( '~[^-0-9,+()[\]]~' , '' , $be )));} function
process_type ( $o , $mb = " COLLATE " ){ global $Yh ; return " $o[type] " . process_length ( $o [ " length " ]) . ( preg_match ( '~(^|[^o])int|float|double|decimal~' , $o [ " type " ]) && in_array ( $o [ " unsigned " ], $Yh ) ? " $o[unsigned] " : " " ) . ( preg_match ( '~char|text|enum|set~' , $o [ " type " ]) && $o [ " collation " ] ? " $mb " . q ( $o [ " collation " ]) : " " );} function
process_field ( $o , $Ph ){ global $x ; $Mb = $o [ " default " ]; return
array ( idf_escape ( trim ( $o [ " field " ])), process_type ( $Ph ),( $o [ " null " ] ? " NULL " : " NOT NULL " ),( isset ( $Mb ) ? " DEFAULT " . (( preg_match ( '~time~' , $o [ " type " ]) && preg_match ( '~^CURRENT_TIMESTAMP$~i' , $Mb )) || ( $x == " sqlite " && preg_match ( '~^CURRENT_(TIME|TIMESTAMP|DATE)$~i' , $Mb )) || ( $o [ " type " ] == " bit " && preg_match ( " ~^([0-9]+|b'[0-1]+') \$ ~ " , $Mb )) || ( $x == " pgsql " && preg_match ( " ~^[a-z]+ \\ (('[^']*')+ \\ ) \$ ~ " , $Mb )) ? $Mb : q ( $Mb )) : " " ),( preg_match ( '~timestamp|datetime~' , $o [ " type " ]) && $o [ " on_update " ] ? " ON UPDATE $o[on_update] " : " " ),( support ( " comment " ) && $o [ " comment " ] != " " ? " COMMENT " . q ( $o [ " comment " ]) : " " ),( $o [ " auto_increment " ] ? auto_increment () : null ),);} function
type_class ( $U ){ foreach ( array ( 'char' => 'text' , 'date' => 'time|year' , 'binary' => 'blob' , 'enum' => 'set' ,) as $y => $X ){ if ( preg_match ( " ~ $y | $X ~ " , $U )) return " class=' $y ' " ;}} function
edit_fields ( $p , $ob , $U = " TABLE " , $Tc = array (), $tb = false ){ global $g , $yd ; $p = array_values ( $p ); echo ' < thead >< tr class = " wrap " >
';if($U=="PROCEDURE"){echo' < td >& nbsp ; ';}echo' < th id = " label-name " > ',($U=="TABLE"?lang(95):lang(96)),' < td id = " label-type " > ',lang(46),' < textarea id = " enum-edit " rows = " 4 " cols = " 12 " wrap = " off " style = " display: none; " onblur = " editingLengthBlur(this); " ></ textarea >
< td id = " label-length " > ',lang(97),' < td > ',lang(98);if($U=="TABLE"){echo' < td id = " label-null " > NULL
< td >< input type = " radio " name = " auto_increment_col " value = " " >< acronym id = " label-ai " title = " ',lang(48),' " > AI </ acronym > ',doc_link(array(' sql '=>"example-auto-increment.html",' sqlite '=>"autoinc.html",' pgsql '=>"datatype.html#DATATYPE-SERIAL",' mssql '=>"ms186775.aspx",)),' < td id = " label-default " > ',lang(49),(support("comment")?"<td id=' label - comment '".($tb?"":" class=' hidden '").">".lang(47):"");}echo' < td > ',"<input type=' image ' class=' icon ' name=' add [ " .(support( " move_col " )?0:count( $p )). " ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = plus . gif & amp ; version = 4.3 . 1 ' alt=' + ' title=' " .lang(99). " '>",' < script type = " text/javascript " > row_count = ',count($p),' ; </ script >
2014-04-01 18:00:42 +00:00
</ thead >
< tbody onkeydown = " return editingKeydown(event); " >
2015-04-01 06:36:56 +00:00
' ; foreach ( $p
2017-04-21 11:23:04 +00:00
as $s => $o ){ $s ++ ; $hf = $o [( $_POST ? " orig " : " field " )]; $Tb = ( isset ( $_POST [ " add " ][ $s - 1 ]) || ( isset ( $o [ " field " ]) &&! $_POST [ " drop_col " ][ $s ])) && ( support ( " drop_col " ) || $hf == " " ); echo '<tr' ,( $Tb ? " " : " style='display: none;' " ), ' >
',($U=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$yd),$o["inout"]):""),' < th > ';if($Tb){echo' < input name = " fields[', $s ,'][field] " value = " ',h( $o["field"] ),' " onchange = " editingNameChange(this);',( $o["field"] != " " ||count( $p )>1?'':' editingAddRow(this); " onkeyup = " if (this.value) editingAddRow(this);'),' " maxlength = " 64 " autocapitalize = " off " aria - labelledby = " label-name " > ';}echo' < input type = " hidden " name = " fields[', $s ,'][orig] " value = " ',h( $hf ),' " >
';edit_type("fields[$s]",$o,$ob,$Tc);if($U=="TABLE"){echo' < td > ',checkbox("fields[$s][null]",1,$o["null"],"","","block","label-null"),' < td >< label class = " block " >< input type = " radio " name = " auto_increment_col " value = " ', $s ,' " ';if($o["auto_increment"]){echo' checked ';}?> onclick="var field = this.form[' fields [ ' + this.value + ' ][ field ] ']; if (!field.value) { field.value = ' id ' ; field . onchange (); } " aria-labelledby= " label - ai " ></label><td><?php
2014-04-01 18:00:42 +00:00
echo
2017-04-21 11:23:04 +00:00
checkbox ( " fields[ $s ][has_default] " , 1 , $o [ " has_default " ], " " , " " , " " , " label-default " ), '<input name="fields[' , $s , '][default]" value="' , h ( $o [ " default " ]), ' " onkeyup= " keyupChange . call ( this ); " onchange= " this . previousSibling . checked = true ; " aria-labelledby= " label - default " >
',(support("comment")?"<td".($tb?"":" class=' hidden '")."><input name=' fields [ $s ][ comment ] ' value=' " .h( $o["comment"] ). " ' maxlength=' " .( $g->server_info >=5.5?1024:255). " ' aria-labelledby=' label - comment '>":"");}echo"<td>",(support("move_col")?"<input type=' image ' class=' icon ' name=' add [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = plus . gif & amp ; version = 4.3 . 1 ' alt=' + ' title=' " .lang(99). " ' onclick=' return ! editingAddRow ( this , 1 ); '> "."<input type=' image ' class=' icon ' name=' up [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = up . gif & amp ; version = 4.3 . 1 ' alt=' ^ ' title=' " .lang(100). " ' onclick=' return ! editingMoveRow ( this , 1 ); '> "."<input type=' image ' class=' icon ' name=' down [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = down . gif & amp ; version = 4.3 . 1 ' alt=' v ' title=' " .lang(101). " ' onclick=' return ! editingMoveRow ( this , 0 ); '> ":""),($hf==""||support("drop_col")?"<input type=' image ' class=' icon ' name=' drop_col [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = cross . gif & amp ; version = 4.3 . 1 ' alt=' x ' title=' " .lang(102). " ' onclick=\"return !editingRemoveRow(this, ' fields\ $ 1 [ field ] ' ); \ " > " : " " ), " \n " ;}} function
process_fields ( & $p ){ $D = 0 ; if ( $_POST [ " up " ]){ $Vd = 0 ; foreach ( $p
as $y => $o ){ if ( key ( $_POST [ " up " ]) == $y ){ unset ( $p [ $y ]); array_splice ( $p , $Vd , 0 , array ( $o )); break ;} if ( isset ( $o [ " field " ])) $Vd = $D ; $D ++ ;}} elseif ( $_POST [ " down " ]){ $Vc = false ; foreach ( $p
as $y => $o ){ if ( isset ( $o [ " field " ]) && $Vc ){ unset ( $p [ key ( $_POST [ " down " ])]); array_splice ( $p , $D , 0 , array ( $Vc )); break ;} if ( key ( $_POST [ " down " ]) == $y ) $Vc = $o ; $D ++ ;}} elseif ( $_POST [ " add " ]){ $p = array_values ( $p ); array_splice ( $p , key ( $_POST [ " add " ]), 0 , array ( array ()));} elseif ( ! $_POST [ " drop_col " ]) return
2014-04-01 18:00:42 +00:00
false ; return
true ;} function
normalize_enum ( $B ){ return " ' " . str_replace ( " ' " , " '' " , addcslashes ( stripcslashes ( str_replace ( $B [ 0 ][ 0 ] . $B [ 0 ][ 0 ], $B [ 0 ][ 0 ], substr ( $B [ 0 ], 1 , - 1 ))), '\\' )) . " ' " ;} function
2017-04-21 11:23:04 +00:00
grant ( $ad , $Pf , $e , $Se ){ if ( ! $Pf ) return
true ; if ( $Pf == array ( " ALL PRIVILEGES " , " GRANT OPTION " )) return ( $ad == " GRANT " ? queries ( " $ad ALL PRIVILEGES $Se WITH GRANT OPTION " ) : queries ( " $ad ALL PRIVILEGES $Se " ) && queries ( " $ad GRANT OPTION $Se " )); return
queries ( " $ad " . preg_replace ( '~(GRANT OPTION)\\([^)]*\\)~' , '\\1' , implode ( " $e , " , $Pf ) . $e ) . $Se );} function
drop_create ( $Zb , $i , $ac , $sh , $cc , $A , $ve , $te , $ue , $Pe , $Fe ){ if ( $_POST [ " drop " ]) query_redirect ( $Zb , $A , $ve ); elseif ( $Pe == " " ) query_redirect ( $i , $A , $ue ); elseif ( $Pe != $Fe ){ $Db = queries ( $i ); queries_redirect ( $A , $te , $Db && queries ( $Zb )); if ( $Db ) queries ( $ac );} else
queries_redirect ( $A , $te , queries ( $sh ) && queries ( $cc ) && queries ( $Zb ) && queries ( $i ));} function
create_trigger ( $Se , $K ){ global $x ; $xh = " $K[Timing] $K[Event] " . ( $K [ " Event " ] == " UPDATE OF " ? " " . idf_escape ( $K [ " Of " ]) : " " ); return " CREATE TRIGGER " . idf_escape ( $K [ " Trigger " ]) . ( $x == " mssql " ? $Se . $xh : $xh . $Se ) . rtrim ( " $K[Type] \n $K[Statement] " , " ; " ) . " ; " ;} function
create_routine ( $rg , $K ){ global $yd ; $O = array (); $p = ( array ) $K [ " fields " ]; ksort ( $p ); foreach ( $p
as $o ){ if ( $o [ " field " ] != " " ) $O [] = ( preg_match ( " ~^( $yd ) \$ ~ " , $o [ " inout " ]) ? " $o[inout] " : " " ) . idf_escape ( $o [ " field " ]) . process_type ( $o , " CHARACTER SET " );} return " CREATE $rg " . idf_escape ( trim ( $K [ " name " ])) . " ( " . implode ( " , " , $O ) . " ) " . ( isset ( $_GET [ " function " ]) ? " RETURNS " . process_type ( $K [ " returns " ], " CHARACTER SET " ) : " " ) . ( $K [ " language " ] ? " LANGUAGE $K[language] " : " " ) . rtrim ( " \n $K[definition] " , " ; " ) . " ; " ;} function
2014-04-01 18:00:42 +00:00
remove_definer ( $H ){ return
preg_replace ( '~^([A-Z =]+) DEFINER=`' . preg_replace ( '~@(.*)~' , '`@`(%|\\1)' , logged_user ()) . '`~' , '\\1' , $H );} function
2017-04-21 11:23:04 +00:00
format_foreign_key ( $q ){ global $Te ; return " FOREIGN KEY ( " . implode ( " , " , array_map ( 'idf_escape' , $q [ " source " ])) . " ) REFERENCES " . table ( $q [ " table " ]) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $q [ " target " ])) . " ) " . ( preg_match ( " ~^( $Te ) \$ ~ " , $q [ " on_delete " ]) ? " ON DELETE $q[on_delete] " : " " ) . ( preg_match ( " ~^( $Te ) \$ ~ " , $q [ " on_update " ]) ? " ON UPDATE $q[on_update] " : " " );} function
tar_file ( $Kc , $Bh ){ $J = pack ( " a100a8a8a8a12a12 " , $Kc , 644 , 0 , 0 , decoct ( $Bh -> size ), decoct ( time ())); $fb = 8 * 32 ; for ( $s = 0 ; $s < strlen ( $J ); $s ++ ) $fb += ord ( $J [ $s ]); $J .= sprintf ( " %06o " , $fb ) . " \0 " ; echo $J , str_repeat ( " \0 " , 512 - strlen ( $J )); $Bh -> send (); echo
str_repeat ( " \0 " , 511 - ( $Bh -> size + 511 ) % 512 );} function
ini_bytes ( $xd ){ $X = ini_get ( $xd ); switch ( strtolower ( substr ( $X , - 1 ))){ case 'g' : $X *= 1024 ; case 'm' : $X *= 1024 ; case 'k' : $X *= 1024 ;} return $X ;} function
doc_link ( $_f ){ global $x , $g ; $ci = array ( 'sql' => " http://dev.mysql.com/doc/refman/ " . substr ( $g -> server_info , 0 , 3 ) . " /en/ " , 'sqlite' => " http://www.sqlite.org/ " , 'pgsql' => " http://www.postgresql.org/docs/ " . substr ( $g -> server_info , 0 , 3 ) . " /static/ " , 'mssql' => " http://msdn.microsoft.com/library/ " , 'oracle' => " http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/ " ,); return ( $_f [ $x ] ? " <a href=' $ci[$x] $_f[$x] ' target='_blank' rel='noreferrer'><sup>?</sup></a> " : " " );} function
ob_gzencode ( $Q ){ return
gzencode ( $Q );} function
db_size ( $m ){ global $g ; if ( ! $g -> select_db ( $m )) return " ? " ; $J = 0 ; foreach ( table_status () as $S ) $J += $S [ " Data_length " ] + $S [ " Index_length " ]; return
2015-04-01 06:36:56 +00:00
format_number ( $J );} function
2017-04-21 11:23:04 +00:00
set_utf8mb4 ( $i ){ global $g ; static $O = false ; if ( ! $O && preg_match ( '~\butf8mb4~i' , $i )){ $O = true ; echo " SET NAMES " . charset ( $g ) . " ; \n \n " ;}} function
connect_error (){ global $b , $g , $Dh , $n , $Yb ; if ( DB != " " ){ header ( " HTTP/1.1 404 Not Found " ); page_header ( lang ( 35 ) . " : " . h ( DB ), lang ( 103 ), true );} else { if ( $_POST [ " db " ] &&! $n ) queries_redirect ( substr ( ME , 0 , - 1 ), lang ( 104 ), drop_databases ( $_POST [ " db " ])); page_header ( lang ( 105 ), $n , false ); echo " <p class='links'> \n " ; foreach ( array ( 'database' => lang ( 106 ), 'privileges' => lang ( 68 ), 'processlist' => lang ( 107 ), 'variables' => lang ( 108 ), 'status' => lang ( 109 ), 'replication' => lang ( 110 ),) as $y => $X ){ if ( support ( $y )) echo " <a href=' " . h ( ME ) . " $y ='> $X </a> \n " ;} echo " <p> " . lang ( 111 , $Yb [ DRIVER ], " <b> " . h ( $g -> server_info ) . " </b> " , " <b> $g->extension </b> " ) . " \n " , " <p> " . lang ( 112 , " <b> " . h ( logged_user ()) . " </b> " ) . " \n " ; $l = $b -> databases (); if ( $l ){ $yg = support ( " scheme " ); $ob = collations (); echo " <form action='' method='post'> \n " , " <table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'> \n " , " <thead><tr> " . ( support ( " database " ) ? " <td> " : " " ) . " <th> " . lang ( 35 ) . " - <a href=' " . h ( ME ) . " refresh=1'> " . lang ( 113 ) . " </a> " . " <td> " . lang ( 114 ) . " <td> " . lang ( 115 ) . " <td> " . lang ( 116 ) . " - <a href=' " . h ( ME ) . " dbsize=1' onclick= \" return !ajaxSetHtml(' " . h ( js_escape ( ME )) . " script=connect'); \" > " . lang ( 117 ) . " </a> " . " </thead> \n " ; $l = ( $_GET [ " dbsize " ] ? count_tables ( $l ) : array_flip ( $l )); foreach ( $l
as $m => $T ){ $qg = h ( ME ) . " db= " . urlencode ( $m ); $t = h ( " Db- " . $m ); echo " <tr " . odd () . " > " . ( support ( " database " ) ? " <td> " . checkbox ( " db[] " , $m , in_array ( $m ,( array ) $_POST [ " db " ]), " " , " " , " " , $t ) : " " ), " <th><a href=' $qg ' id=' $m '> " . h ( $m ) . " </a> " ; $nb = nbsp ( db_collation ( $m , $ob )); echo " <td> " . ( support ( " database " ) ? " <a href=' $qg " . ( $yg ? " &ns= " : " " ) . " &database=' title=' " . lang ( 64 ) . " '> $nb </a> " : $nb ), " <td align='right'><a href=' $qg &schema=' id='tables- " . h ( $m ) . " ' title=' " . lang ( 67 ) . " '> " . ( $_GET [ " dbsize " ] ? $T : " ? " ) . " </a> " , " <td align='right' id='size- " . h ( $m ) . " '> " . ( $_GET [ " dbsize " ] ? db_size ( $m ) : " ? " ), " \n " ;} echo " </table> \n " ,( support ( " database " ) ? " <fieldset><legend> " . lang ( 118 ) . " <span id='selected'></span></legend><div> \n " . " <input type='hidden' name='all' value='' onclick= \" selectCount('selected', formChecked(this, /^db/)); \" > \n " . " <input type='submit' name='drop' value=' " . lang ( 119 ) . " ' " . confirm () . " > \n " . " </div></fieldset> \n " : " " ), " <script type='text/javascript'>tableCheck();</script> \n " , " <input type='hidden' name='token' value=' $Dh '> \n " , " </form> \n " ;}} page_footer ( " db " );} if ( isset ( $_GET [ " status " ])) $_GET [ " variables " ] = $_GET [ " status " ]; if ( isset ( $_GET [ " import " ])) $_GET [ " sql " ] = $_GET [ " import " ]; if ( ! ( DB != " " ? $g -> select_db ( DB ) : isset ( $_GET [ " sql " ]) || isset ( $_GET [ " dump " ]) || isset ( $_GET [ " database " ]) || isset ( $_GET [ " processlist " ]) || isset ( $_GET [ " privileges " ]) || isset ( $_GET [ " user " ]) || isset ( $_GET [ " replication " ]) || 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 ( 73 ) . " : " . h ( $_GET [ " ns " ]), lang ( 120 ), true ); page_footer ( " ns " ); exit ;}} $Te = " RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT " ; class
2014-04-01 18:00:42 +00:00
TmpFile { var $handler ; var $size ; function
2016-10-11 12:23:21 +00:00
__construct (){ $this -> handler = tmpfile ();} function
2017-04-21 11:23:04 +00:00
write ( $yb ){ $this -> size += strlen ( $yb ); fwrite ( $this -> handler , $yb );} function
send (){ fseek ( $this -> handler , 0 ); fpassthru ( $this -> handler ); fclose ( $this -> handler );}} $qc = " '(?:''|[^' \\ \\ ]| \\ \\ .)*' " ; $yd = " IN|OUT|INOUT " ; if ( isset ( $_GET [ " select " ]) && ( $_POST [ " edit " ] || $_POST [ " clone " ]) &&! $_POST [ " save " ]) $_GET [ " edit " ] = $_GET [ " select " ]; if ( isset ( $_GET [ " callf " ])) $_GET [ " call " ] = $_GET [ " callf " ]; if ( isset ( $_GET [ " function " ])) $_GET [ " procedure " ] = $_GET [ " function " ]; if ( isset ( $_GET [ " download " ])){ $a = $_GET [ " download " ]; $p = fields ( $a ); header ( " Content-Type: application/octet-stream " ); header ( " Content-Disposition: attachment; filename= " . friendly_url ( " $a - " . implode ( " _ " , $_GET [ " where " ])) . " . " . friendly_url ( $_GET [ " field " ])); $M = array ( idf_escape ( $_GET [ " field " ])); $I = $Xb -> select ( $a , $M , array ( where ( $_GET , $p )), $M ); $K = ( $I ? $I -> fetch_row () : array ()); echo $K [ 0 ]; exit ;} elseif ( isset ( $_GET [ " table " ])){ $a = $_GET [ " table " ]; $p = fields ( $a ); if ( ! $p ) $n = error (); $S = table_status1 ( $a , true ); page_header (( $p && is_view ( $S ) ? $S [ 'Engine' ] == 'materialized view' ? lang ( 121 ) : lang ( 122 ) : lang ( 123 )) . " : " . h ( $a ), $n ); $b -> selectLinks ( $S ); $sb = $S [ " Comment " ]; if ( $sb != " " ) echo " <p> " . lang ( 47 ) . " : " . h ( $sb ) . " \n " ; if ( $p ) $b -> tableStructurePrint ( $p ); if ( ! is_view ( $S )){ if ( support ( " indexes " )){ echo " <h3 id='indexes'> " . lang ( 124 ) . " </h3> \n " ; $w = indexes ( $a ); if ( $w ) $b -> tableIndexesPrint ( $w ); echo '<p class="links"><a href="' . h ( ME ) . 'indexes=' . urlencode ( $a ) . '">' . lang ( 125 ) . " </a> \n " ;} if ( fk_support ( $S )){ echo " <h3 id='foreign-keys'> " . lang ( 91 ) . " </h3> \n " ; $Tc = foreign_keys ( $a ); if ( $Tc ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 126 ) . " <td> " . lang ( 127 ) . " <td> " . lang ( 94 ) . " <td> " . lang ( 93 ) . " <td> </thead> \n " ; foreach ( $Tc
as $C => $q ){ echo " <tr title=' " . h ( $C ) . " '> " , " <th><i> " . implode ( " </i>, <i> " , array_map ( 'h' , $q [ " source " ])) . " </i> " , " <td><a href=' " . h ( $q [ " db " ] != " " ? preg_replace ( '~db=[^&]*~' , " db= " . urlencode ( $q [ " db " ]), ME ) : ( $q [ " ns " ] != " " ? preg_replace ( '~ns=[^&]*~' , " ns= " . urlencode ( $q [ " ns " ]), ME ) : ME )) . " table= " . urlencode ( $q [ " table " ]) . " '> " . ( $q [ " db " ] != " " ? " <b> " . h ( $q [ " db " ]) . " </b>. " : " " ) . ( $q [ " ns " ] != " " ? " <b> " . h ( $q [ " ns " ]) . " </b>. " : " " ) . h ( $q [ " table " ]) . " </a> " , " (<i> " . implode ( " </i>, <i> " , array_map ( 'h' , $q [ " target " ])) . " </i>) " , " <td> " . nbsp ( $q [ " on_delete " ]) . " \n " , " <td> " . nbsp ( $q [ " on_update " ]) . " \n " , '<td><a href="' . h ( ME . 'foreign=' . urlencode ( $a ) . '&name=' . urlencode ( $C )) . '">' . lang ( 128 ) . '</a>' ;} echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'foreign=' . urlencode ( $a ) . '">' . lang ( 129 ) . " </a> \n " ;}} if ( support ( is_view ( $S ) ? " view_trigger " : " trigger " )){ echo " <h3 id='triggers'> " . lang ( 130 ) . " </h3> \n " ; $Oh = triggers ( $a ); if ( $Oh ){ echo " <table cellspacing='0'> \n " ; foreach ( $Oh
as $y => $X ) echo " <tr valign='top'><td> " . h ( $X [ 0 ]) . " <td> " . h ( $X [ 1 ]) . " <th> " . h ( $y ) . " <td><a href=' " . h ( ME . 'trigger=' . urlencode ( $a ) . '&name=' . urlencode ( $y )) . " '> " . lang ( 128 ) . " </a> \n " ; echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'trigger=' . urlencode ( $a ) . '">' . lang ( 131 ) . " </a> \n " ;}} elseif ( isset ( $_GET [ " schema " ])){ page_header ( lang ( 67 ), " " , array (), h ( DB . ( $_GET [ " ns " ] ? " . $_GET[ns] " : " " ))); $ih = array (); $jh = array (); $ea = ( $_GET [ " schema " ] ? $_GET [ " schema " ] : $_COOKIE [ " adminer_schema- " . str_replace ( " . " , " _ " , DB )]); preg_match_all ( '~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~' , $ea , $ke , PREG_SET_ORDER ); foreach ( $ke
as $s => $B ){ $ih [ $B [ 1 ]] = array ( $B [ 2 ], $B [ 3 ]); $jh [] = " \n \t ' " . js_escape ( $B [ 1 ]) . " ': [ $B[2] , $B[3] ] " ;} $Eh = 0 ; $Qa =- 1 ; $xg = array (); $eg = array (); $Zd = array (); foreach ( table_status ( '' , true ) as $R => $S ){ if ( is_view ( $S )) continue ; $Ef = 0 ; $xg [ $R ][ " fields " ] = array (); foreach ( fields ( $R ) as $C => $o ){ $Ef += 1.25 ; $o [ " pos " ] = $Ef ; $xg [ $R ][ " fields " ][ $C ] = $o ;} $xg [ $R ][ " pos " ] = ( $ih [ $R ] ? $ih [ $R ] : array ( $Eh , 0 )); foreach ( $b -> foreignKeys ( $R ) as $X ){ if ( ! $X [ " db " ]){ $Xd = $Qa ; if ( $ih [ $R ][ 1 ] || $ih [ $X [ " table " ]][ 1 ]) $Xd = min ( floatval ( $ih [ $R ][ 1 ]), floatval ( $ih [ $X [ " table " ]][ 1 ])) - 1 ; else $Qa -=. 1 ; while ( $Zd [( string ) $Xd ]) $Xd -=. 0001 ; $xg [ $R ][ " references " ][ $X [ " table " ]][( string ) $Xd ] = array ( $X [ " source " ], $X [ " target " ]); $eg [ $X [ " table " ]][ $R ][( string ) $Xd ] = $X [ " target " ]; $Zd [( string ) $Xd ] = true ;}} $Eh = max ( $Eh , $xg [ $R ][ " pos " ][ 0 ] + 2.5 + $Ef );} echo '<div id="schema" style="height: ' , $Eh , ' em ; " onselectstart= " return false ; " >
2014-04-01 18:00:42 +00:00
< script type = " text/javascript " >
2017-04-21 11:23:04 +00:00
var tablePos = { ',implode(",",$jh)."\n",' };
var em = document . getElementById ( \ 'schema\').offsetHeight / ' , $Eh , ' ;
2014-04-01 18:00:42 +00:00
document . onmousemove = schemaMousemove ;
document . onmouseup = function ( ev ) {
schemaMouseup ( ev , \ '' , js_escape ( DB ), ' \ ' );
};
</ script >
2017-04-21 11:23:04 +00:00
' ; foreach ( $xg
as $C => $R ){ echo " <div class='table' style='top: " . $R [ " pos " ][ 0 ] . " em; left: " . $R [ " pos " ][ 1 ] . " em;' onmousedown='schemaMousedown(this, event);'> " , '<a href="' . h ( ME ) . 'table=' . urlencode ( $C ) . '"><b>' . h ( $C ) . " </b></a> " ; foreach ( $R [ " fields " ] as $o ){ $X = '<span' . type_class ( $o [ " type " ]) . ' title="' . h ( $o [ " full_type " ] . ( $o [ " null " ] ? " NULL " : '' )) . '">' . h ( $o [ " field " ]) . '</span>' ; echo " <br> " . ( $o [ " primary " ] ? " <i> $X </i> " : $X );} foreach (( array ) $R [ " references " ] as $ph => $fg ){ foreach ( $fg
as $Xd => $bg ){ $Yd = $Xd - $ih [ $C ][ 1 ]; $s = 0 ; foreach ( $bg [ 0 ] as $Qg ) echo " \n <div class='references' title=' " . h ( $ph ) . " ' id='refs $Xd - " . ( $s ++ ) . " ' style='left: $Yd " . " em; top: " . $R [ " fields " ][ $Qg ][ " pos " ] . " em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: " . ( - $Yd ) . " em;'></div></div> " ;}} foreach (( array ) $eg [ $C ] as $ph => $fg ){ foreach ( $fg
as $Xd => $e ){ $Yd = $Xd - $ih [ $C ][ 1 ]; $s = 0 ; foreach ( $e
as $oh ) echo " \n <div class='references' title=' " . h ( $ph ) . " ' id='refd $Xd - " . ( $s ++ ) . " ' style='left: $Yd " . " em; top: " . $R [ " fields " ][ $oh ][ " pos " ] . " em; height: 1.25em; background: url( " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=arrow.gif) no-repeat right center;&version=4.3.1'><div style='height: .5em; border-bottom: 1px solid Gray; width: " . ( - $Yd ) . " em;'></div></div> " ;}} echo " \n </div> \n " ;} foreach ( $xg
as $C => $R ){ foreach (( array ) $R [ " references " ] as $ph => $fg ){ foreach ( $fg
as $Xd => $bg ){ $ze = $Eh ; $oe =- 10 ; foreach ( $bg [ 0 ] as $y => $Qg ){ $Ff = $R [ " pos " ][ 0 ] + $R [ " fields " ][ $Qg ][ " pos " ]; $Gf = $xg [ $ph ][ " pos " ][ 0 ] + $xg [ $ph ][ " fields " ][ $bg [ 1 ][ $y ]][ " pos " ]; $ze = min ( $ze , $Ff , $Gf ); $oe = max ( $oe , $Ff , $Gf );} echo " <div class='references' id='refl $Xd ' style='left: $Xd " . " em; top: $ze " . " em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: " . ( $oe - $ze ) . " em;'></div></div> \n " ;}}} echo ' </ div >
< p class = " links " >< a href = " ',h(ME. " schema = " .urlencode( $ea )),' " id = " schema-link " > ',lang(132),' </ a >
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$n){$Ab="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$y)$Ab.="&$y=".urlencode($_POST[$y]);cookie("adminer_export",substr($Ab,1));$T=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Bc=dump_headers((count($T)==1?key($T):DB),(DB==""||count($T)>1));$Fd=preg_match(' ~ sql ~ ' , $_POST [ " format " ]); if ( $Fd ){ echo " -- Adminer $ia " . $Yb [ DRIVER ] . " dump \n \n " ; if ( $x == " sql " ){ echo " SET NAMES utf8;
2015-04-01 06:36:56 +00:00
SET time_zone = '+00:00' ;
2014-04-01 18:00:42 +00:00
" .( $_POST["data_style"] ? " SET foreign_key_checks = 0 ;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' ;
" : " " ). "
2017-04-21 11:23:04 +00:00
" ; $g->query ( " SET time_zone = '+00:00' ; " );}} $Zg = $_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 ( $g -> select_db ( $m )){ if ( $Fd && preg_match ( '~CREATE~' , $Zg ) && ( $i = $g -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ))){ set_utf8mb4 ( $i ); if ( $Zg == " DROP+CREATE " ) echo " DROP DATABASE IF EXISTS " . idf_escape ( $m ) . " ; \n " ; echo " $i ; \n " ;} if ( $Fd ){ if ( $Zg ) echo
use_sql ( $m ) . " ; \n \n " ; $nf = " " ; if ( $_POST [ " routines " ]){ foreach ( array ( " FUNCTION " , " PROCEDURE " ) as $rg ){ foreach ( get_rows ( " SHOW $rg STATUS WHERE Db = " . q ( $m ), null , " -- " ) as $K ){ $i = remove_definer ( $g -> result ( " SHOW CREATE $rg " . idf_escape ( $K [ " Name " ]), 2 )); set_utf8mb4 ( $i ); $nf .= ( $Zg != 'DROP+CREATE' ? " DROP $rg IF EXISTS " . idf_escape ( $K [ " Name " ]) . " ;; \n " : " " ) . " $i ;; \n \n " ;}}} if ( $_POST [ " events " ]){ foreach ( get_rows ( " SHOW EVENTS " , null , " -- " ) as $K ){ $i = remove_definer ( $g -> result ( " SHOW CREATE EVENT " . idf_escape ( $K [ " Name " ]), 3 )); set_utf8mb4 ( $i ); $nf .= ( $Zg != 'DROP+CREATE' ? " DROP EVENT IF EXISTS " . idf_escape ( $K [ " Name " ]) . " ;; \n " : " " ) . " $i ;; \n \n " ;}} if ( $nf ) echo " DELIMITER ;; \n \n $nf " . " DELIMITER ; \n \n " ;} if ( $_POST [ " table_style " ] || $_POST [ " data_style " ]){ $oi = array (); foreach ( table_status ( '' , true ) as $C => $S ){ $R = ( DB == " " || in_array ( $C ,( array ) $_POST [ " tables " ])); $Gb = ( DB == " " || in_array ( $C ,( array ) $_POST [ " data " ])); if ( $R || $Gb ){ if ( $Bc == " tar " ){ $Bh = new
TmpFile ; ob_start ( array ( $Bh , 'write' ), 1e5 );} $b -> dumpTable ( $C ,( $R ? $_POST [ " table_style " ] : " " ),( is_view ( $S ) ? 2 : 0 )); if ( is_view ( $S )) $oi [] = $C ; elseif ( $Gb ){ $p = fields ( $C ); $b -> dumpData ( $C , $_POST [ " data_style " ], " SELECT * " . convert_fields ( $p , $p ) . " FROM " . table ( $C ));} if ( $Fd && $_POST [ " triggers " ] && $R && ( $Oh = trigger_sql ( $C , $_POST [ " table_style " ]))) echo " \n DELIMITER ;; \n $Oh\nDELIMITER ; \n " ; if ( $Bc == " tar " ){ ob_end_flush (); tar_file (( DB != " " ? " " : " $m / " ) . " $C .csv " , $Bh );} elseif ( $Fd ) echo " \n " ;}} foreach ( $oi
as $ni ) $b -> dumpTable ( $ni , $_POST [ " table_style " ], 1 ); if ( $Bc == " tar " ) echo
pack ( " x512 " );}}} if ( $Fd ) echo " -- " . $g -> result ( " SELECT NOW() " ) . " \n " ; exit ;} page_header ( lang ( 70 ), $n ,( $_GET [ " export " ] != " " ? array ( " table " => $_GET [ " export " ]) : array ()), h ( DB )); echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< table cellspacing = " 0 " >
2017-04-21 11:23:04 +00:00
';$Jb=array(' ',' USE ',' DROP + CREATE ',' CREATE ');$kh=array(' ',' DROP + CREATE ',' CREATE ');$Hb=array(' ',' TRUNCATE + INSERT ',' INSERT ');if($x=="sql")$Hb[]=' INSERT + UPDATE ';parse_str($_COOKIE["adminer_export"],$K);if(!$K)$K=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($K["events"])){$K["routines"]=$K["events"]=($_GET["dump"]=="");$K["triggers"]=$K["table_style"];}echo"<tr><th>".lang(133)."<td>".html_select("output",$b->dumpOutput(),$K["output"],0)."\n";echo"<tr><th>".lang(134)."<td>".html_select("format",$b->dumpFormat(),$K["format"],0)."\n";echo($x=="sqlite"?"":"<tr><th>".lang(35)."<td>".html_select(' db_style ',$Jb,$K["db_style"]).(support("routine")?checkbox("routines",1,$K["routines"],lang(135)):"").(support("event")?checkbox("events",1,$K["events"],lang(136)):"")),"<tr><th>".lang(115)."<td>".html_select(' table_style ',$kh,$K["table_style"]).checkbox("auto_increment",1,$K["auto_increment"],lang(48)).(support("trigger")?checkbox("triggers",1,$K["triggers"],lang(130)):""),"<tr><th>".lang(137)."<td>".html_select(' data_style ',$Hb,$K["data_style"]),' </ table >
< p >< input type = " submit " value = " ',lang(70),' " >
< input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
< table cellspacing = " 0 " >
2017-04-21 11:23:04 +00:00
';$Jf=array();if(DB!=""){$db=($a!=""?"":" checked");echo"<thead><tr>","<th style=' text - align : left ; '><label class=' block '><input type=' checkbox ' id=' check - tables '$db onclick=' formCheck ( this , /^ tables\\ [ / ); '>".lang(115)."</label>","<th style=' text - align : right ; '><label class=' block '>".lang(137)."<input type=' checkbox ' id=' check - data '$db onclick=' formCheck ( this , /^ data\\ [ / ); ' ></ label > " , " </ thead > \n " ; $oi = " " ; $lh =tables_list();foreach( $lh
as $C => $U ){ $If = preg_replace ( '~_.*~' , '' , $C ); $db = ( $a == " " || $a == ( substr ( $a , - 1 ) == " % " ? " $If % " : $C )); $Mf = " <tr><td> " . checkbox ( " tables[] " , $C , $db , $C , " checkboxClick(event, this); formUncheck('check-tables'); " , " block " ); if ( $U !== null &&! preg_match ( '~table~i' , $U )) $oi .= " $Mf\n " ; else
echo " $Mf <td align='right'><label class='block'><span id='Rows- " . h ( $C ) . " '></span> " . checkbox ( " data[] " , $C , $db , " " , " checkboxClick(event, this); formUncheck('check-data'); " ) . " </label> \n " ; $Jf [ $If ] ++ ;} echo $oi ; if ( $lh ) echo " <script type='text/javascript'>ajaxSetHtml(' " . js_escape ( ME ) . " script=db');</script> \n " ;} else { echo " <thead><tr><th style='text-align: left;'><label class='block'><input type='checkbox' id='check-databases' " . ( $a == " " ? " checked " : " " ) . " onclick='formCheck(this, /^databases \\ [/);'> " . lang ( 35 ) . " </label></thead> \n " ; $l = $b -> databases (); if ( $l ){ foreach ( $l
as $m ){ if ( ! information_schema ( $m )){ $If = preg_replace ( '~_.*~' , '' , $m ); echo " <tr><td> " . checkbox ( " databases[] " , $m , $a == " " || $a == " $If % " , $m , " formUncheck('check-databases'); " , " block " ) . " \n " ; $Jf [ $If ] ++ ;}}} else
2014-04-01 18:00:42 +00:00
echo " <tr><td><textarea name='databases' rows='10' cols='20'></textarea> " ;} echo ' </ table >
</ form >
2017-04-21 11:23:04 +00:00
' ; $Mc = true ; foreach ( $Jf
as $y => $X ){ if ( $y != " " && $X > 1 ){ echo ( $Mc ? " <p> " : " " ) . " <a href=' " . h ( ME ) . " dump= " . urlencode ( " $y % " ) . " '> " . h ( $y ) . " </a> " ; $Mc = false ;}}} elseif ( isset ( $_GET [ " privileges " ])){ page_header ( lang ( 68 )); echo '<p class="links"><a href="' . h ( ME ) . 'user=">' . lang ( 138 ) . " </a> " ; $I = $g -> query ( " SELECT User, Host FROM mysql. " . ( DB == " " ? " user " : " db WHERE " . q ( DB ) . " LIKE Db " ) . " ORDER BY Host, User " ); $ad = $I ; if ( ! $I ) $I = $g -> query ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host " ); echo " <form action=''><p> \n " ; hidden_fields_get (); echo " <input type='hidden' name='db' value=' " . h ( DB ) . " '> \n " ,( $ad ? " " : " <input type='hidden' name='grant' value=''> \n " ), " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 33 ) . " <th> " . lang ( 32 ) . " <th> </thead> \n " ; while ( $K = $I -> fetch_assoc ()) echo '<tr' . odd () . '><td>' . h ( $K [ " User " ]) . " <td> " . h ( $K [ " Host " ]) . '<td><a href="' . h ( ME . 'user=' . urlencode ( $K [ " User " ]) . '&host=' . urlencode ( $K [ " Host " ])) . '">' . lang ( 10 ) . " </a> \n " ; if ( ! $ad || DB != " " ) echo " <tr " . odd () . " ><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value=' " . lang ( 10 ) . " '> \n " ; echo " </table> \n " , " </form> \n " ;} elseif ( isset ( $_GET [ " sql " ])){ if ( ! $n && $_POST [ " export " ]){ dump_headers ( " sql " ); $b -> dumpTable ( " " , " " ); $b -> dumpData ( " " , " table " , $_POST [ " query " ]); exit ;} restart_session (); $kd =& get_session ( " queries " ); $jd =& $kd [ DB ]; if ( ! $n && $_POST [ " clear " ]){ $jd = array (); redirect ( remove_from_uri ( " history " ));} page_header (( isset ( $_GET [ " import " ]) ? lang ( 69 ) : lang ( 61 )), $n ); if ( ! $n && $_POST ){ $Xc = false ; if ( ! isset ( $_GET [ " import " ])) $H = $_POST [ " query " ]; elseif ( $_POST [ " webfile " ]){ $Xc =@ fopen (( file_exists ( " adminer.sql " ) ? " adminer.sql " : " compress.zlib://adminer.sql.gz " ), " rb " ); $H = ( $Xc ? fread ( $Xc , 1e6 ) : false );} else $H = get_file ( " sql_file " , true ); if ( is_string ( $H )){ if ( function_exists ( 'memory_get_usage' )) @ ini_set ( " memory_limit " , max ( ini_bytes ( " memory_limit " ), 2 * strlen ( $H ) + memory_get_usage () + 8e6 )); if ( $H != " " && strlen ( $H ) < 1e6 ){ $Tf = $H . ( preg_match ( " ~;[ \t \r \n ]* \$ ~ " , $H ) ? " " : " ; " ); if ( ! $jd || reset ( end ( $jd )) != $Tf ){ restart_session (); $jd [] = array ( $Tf , time ()); set_session ( " queries " , $kd ); stop_session ();}} $Rg = " (?: \\ s|/ \\ *[ \ s \ S]*? \\ */|(?:#|-- )[^ \n ]* \n ?|-- \r ? \n ) " ; $Ob = " ; " ; $D = 0 ; $nc = true ; $h = connect (); if ( is_object ( $h ) && DB != " " ) $h -> select_db ( DB ); $rb = 0 ; $sc = array (); $sf = '[\'"' . ( $x == " sql " ? '`#' : ( $x == " sqlite " ? '`[' : ( $x == " mssql " ? '[' : '' ))) . ']|/\\*|-- |$' . ( $x == " pgsql " ? '|\\$[^$]*\\$' : '' ); $Fh = microtime ( true ); parse_str ( $_COOKIE [ " adminer_export " ], $xa ); $ec = $b -> dumpFormat (); unset ( $ec [ " sql " ]); while ( $H != " " ){ if ( ! $D && preg_match ( " ~^ $Rg *+DELIMITER \\ s+( \\ S+)~i " , $H , $B )){ $Ob = $B [ 1 ]; $H = substr ( $H , strlen ( $B [ 0 ]));} else { preg_match ( '(' . preg_quote ( $Ob ) . " \\ s*| $sf ) " , $H , $B , PREG_OFFSET_CAPTURE , $D ); list ( $Vc , $Ef ) = $B [ 0 ]; if ( ! $Vc && $Xc &&! feof ( $Xc )) $H .= fread ( $Xc , 1e5 ); else { if ( ! $Vc && rtrim ( $H ) == " " ) break ; $D = $Ef + strlen ( $Vc ); if ( $Vc && rtrim ( $Vc ) != $Ob ){ while ( preg_match ( '(' . ( $Vc == '/*' ? '\\*/' : ( $Vc == '[' ? ']' : ( preg_match ( '~^-- |^#~' , $Vc ) ? " \n " : preg_quote ( $Vc ) . " | \\ \\ . " ))) . '|$)s' , $H , $B , PREG_OFFSET_CAPTURE , $D )){ $vg = $B [ 0 ][ 0 ]; if ( ! $vg && $Xc &&! feof ( $Xc )) $H .= fread ( $Xc , 1e5 ); else { $D = $B [ 0 ][ 1 ] + strlen ( $vg ); if ( $vg [ 0 ] != " \\ " ) break ;}}} else { $nc = false ; $Tf = substr ( $H , 0 , $Ef ); $rb ++ ; $Mf = " <pre id='sql- $rb '><code class='jush- $x '> " . $b -> sqlCommandQuery ( $Tf ) . " </code></pre> \n " ; if ( $x == " sqlite " && preg_match ( " ~^ $Rg *+ATTACH \\ b~i " , $Tf , $B )){ echo $Mf , " <p class='error'> " . lang ( 139 ) . " \n " ; $sc [] = " <a href='#sql- $rb '> $rb </a> " ; if ( $_POST [ " error_stops " ]) break ;} else { if ( ! $_POST [ " only_errors " ]){ echo $Mf ; ob_flush (); flush ();} $Vg = microtime ( true ); if ( $g -> multi_query ( $Tf ) && is_object ( $h ) && preg_match ( " ~^ $Rg *+USE \\ b~i " , $Tf )) $h -> query ( $Tf ); do { $I = $g -> store_result (); $vh = " <span class='time'>( " . format_time ( $Vg ) . " )</span> " . ( strlen ( $Tf ) < 1000 ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( trim ( $Tf )) . " '> " . lang ( 10 ) . " </a> " : " " ); if ( $g -> error ){ echo ( $_POST [ " only_errors " ] ? $Mf : " " ), " <p class='error'> " . lang ( 140 ) . ( $g -> errno ? " ( $g->errno ) " : " " ) . " : " . error () . " \n " ; $sc [] = " <a href='#sql- $rb '> $rb </a> " ; if ( $_POST [ " error_stops " ]) break
2 ;} elseif ( is_object ( $I )){ $z = $_POST [ " limit " ]; $gf = select ( $I , $h , array (), $z ); if ( ! $_POST [ " only_errors " ]){ echo " <form action='' method='post'> \n " ; $Je = $I -> num_rows ; echo " <p> " . ( $Je ? ( $z && $Je > $z ? lang ( 141 , $z ) : " " ) . lang ( 142 , $Je ) : " " ), $vh ; $t = " export- $rb " ; $Ac = " , <a href='# $t ' onclick= \" return !toggle(' $t '); \" > " . lang ( 70 ) . " </a><span id=' $t ' class='hidden'>: " . html_select ( " output " , $b -> dumpOutput (), $xa [ " output " ]) . " " . html_select ( " format " , $ec , $xa [ " format " ]) . " <input type='hidden' name='query' value=' " . h ( $Tf ) . " '> " . " <input type='submit' name='export' value=' " . lang ( 70 ) . " '><input type='hidden' name='token' value=' $Dh '></span> \n " ; if ( $h && preg_match ( " ~^( $Rg | \\ ()*+SELECT \\ b~i " , $Tf ) && ( $_c = explain ( $h , $Tf ))){ $t = " explain- $rb " ; echo " , <a href='# $t ' onclick= \" return !toggle(' $t '); \" >EXPLAIN</a> $Ac " , " <div id=' $t ' class='hidden'> \n " ; select ( $_c , $h , $gf ); echo " </div> \n " ;} else
echo $Ac ; echo " </form> \n " ;}} else { if ( preg_match ( " ~^ $Rg *+(CREATE|DROP|ALTER) $Rg ++(DATABASE|SCHEMA) \\ b~i " , $Tf )){ restart_session (); set_session ( " dbs " , null ); stop_session ();} if ( ! $_POST [ " only_errors " ]) echo " <p class='message' title=' " . h ( $g -> info ) . " '> " . lang ( 143 , $g -> affected_rows ) . " $vh\n " ;} $Vg = microtime ( true );} while ( $g -> next_result ());} $H = substr ( $H , $D ); $D = 0 ;}}}} if ( $nc ) echo " <p class='message'> " . lang ( 144 ) . " \n " ; elseif ( $_POST [ " only_errors " ]){ echo " <p class='message'> " . lang ( 145 , $rb - count ( $sc )), " <span class='time'>( " . format_time ( $Fh ) . " )</span> \n " ;} elseif ( $sc && $rb > 1 ) echo " <p class='error'> " . lang ( 140 ) . " : " . implode ( " " , $sc ) . " \n " ;} else
2014-04-01 18:00:42 +00:00
echo " <p class='error'> " . upload_error ( $H ) . " \n " ;} echo '
< form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
2017-04-21 11:23:04 +00:00
';$xc="<input type=' submit ' value=' " .lang(146). " ' title=' Ctrl + Enter '>";if(!isset($_GET["import"])){$Tf=$_GET["sql"];if($_POST)$Tf=$_POST["query"];elseif($_GET["history"]=="all")$Tf=$jd;elseif($_GET["history"]!="")$Tf=$jd[$_GET["history"]][0];echo"<p>";textarea("query",$Tf,20);echo($_POST?"":"<script type=' text / javascript '>document.getElementsByTagName(' textarea ')[0].focus();</script>\n"),"<p>$xc\n",lang(147).": <input type=' number ' name=' limit ' class=' size ' value=' " .h( $_POST ? $_POST["limit"] : $_GET["limit"] ). " '>\n";}else{echo"<fieldset><legend>".lang(148)."</legend><div>",(ini_bool("file_uploads")?"SQL (< ".ini_get("upload_max_filesize")."B): <input type=' file ' name=' sql_file [] ' multiple>\n$xc":lang(149)),"</div></fieldset>\n","<fieldset><legend>".lang(150)."</legend><div>",lang(151,"<code>adminer.sql".(extension_loaded("zlib")?"[.gz]":"")."</code>"),' < input type = " submit " name = " webfile " value = " '.lang(152).' " > ' , " </div></fieldset> \n " , " <p> " ;} echo
checkbox ( " error_stops " , 1 ,( $_POST ? $_POST [ " error_stops " ] : isset ( $_GET [ " import " ])), lang ( 153 )) . " \n " , checkbox ( " only_errors " , 1 ,( $_POST ? $_POST [ " only_errors " ] : isset ( $_GET [ " import " ])), lang ( 154 )) . " \n " , " <input type='hidden' name='token' value=' $Dh '> \n " ; if ( ! isset ( $_GET [ " import " ]) && $jd ){ print_fieldset ( " history " , lang ( 155 ), $_GET [ " history " ] != " " ); for ( $X = end ( $jd ); $X ; $X = prev ( $jd )){ $y = key ( $jd ); list ( $Tf , $vh , $ic ) = $X ; echo '<a href="' . h ( ME . " sql=&history= $y " ) . '">' . lang ( 10 ) . " </a> " . " <span class='time' title=' " .@ date ( 'Y-m-d' , $vh ) . " '> " .@ date ( " H:i:s " , $vh ) . " </span> " . " <code class='jush- $x '> " . shorten_utf8 ( ltrim ( str_replace ( " \n " , " " , str_replace ( " \r " , " " , preg_replace ( '~^(#|-- ).*~m' , '' , $Tf )))), 80 , " </code> " ) . ( $ic ? " <span class='time'>( $ic )</span> " : " " ) . " <br> \n " ;} echo " <input type='submit' name='clear' value=' " . lang ( 156 ) . " '> \n " , " <a href=' " . h ( ME . " sql=&history=all " ) . " '> " . lang ( 157 ) . " </a> \n " , " </div></fieldset> \n " ;} echo ' </ form >
' ;} elseif ( isset ( $_GET [ " edit " ])){ $a = $_GET [ " edit " ]; $p = fields ( $a ); $Z = ( isset ( $_GET [ " select " ]) ? ( count ( $_POST [ " check " ]) == 1 ? where_check ( $_POST [ " check " ][ 0 ], $p ) : " " ) : where ( $_GET , $p )); $Zh = ( isset ( $_GET [ " select " ]) ? $_POST [ " edit " ] : $Z ); foreach ( $p
as $C => $o ){ if ( ! isset ( $o [ " privileges " ][ $Zh ? " update " : " insert " ]) || $b -> fieldName ( $o ) == " " ) unset ( $p [ $C ]);} if ( $_POST &&! $n &&! isset ( $_GET [ " select " ])){ $A = $_POST [ " referer " ]; if ( $_POST [ " insert " ]) $A = ( $Zh ? null : $_SERVER [ " REQUEST_URI " ]); elseif ( ! preg_match ( '~^.+&select=.+$~' , $A )) $A = ME . " select= " . urlencode ( $a ); $w = indexes ( $a ); $Uh = unique_array ( $_GET [ " where " ], $w ); $Wf = " \n WHERE $Z " ; if ( isset ( $_POST [ " delete " ])) queries_redirect ( $A , lang ( 158 ), $Xb -> delete ( $a , $Wf , ! $Uh )); else { $O = array (); foreach ( $p
as $C => $o ){ $X = process_input ( $o ); if ( $X !== false && $X !== null ) $O [ idf_escape ( $C )] = $X ;} if ( $Zh ){ if ( ! $O ) redirect ( $A ); queries_redirect ( $A , lang ( 159 ), $Xb -> update ( $a , $O , $Wf , ! $Uh )); if ( is_ajax ()){ page_headers (); page_messages ( $n ); exit ;}} else { $I = $Xb -> insert ( $a , $O ); $Wd = ( $I ? last_id () : 0 ); queries_redirect ( $A , lang ( 160 ,( $Wd ? " $Wd " : " " )), $I );}}} $K = null ; if ( $_POST [ " save " ]) $K = ( array ) $_POST [ " fields " ]; elseif ( $Z ){ $M = array (); foreach ( $p
as $C => $o ){ if ( isset ( $o [ " privileges " ][ " select " ])){ $Ga = convert_field ( $o ); if ( $_POST [ " clone " ] && $o [ " auto_increment " ]) $Ga = " '' " ; if ( $x == " sql " && preg_match ( " ~enum|set~ " , $o [ " type " ])) $Ga = " 1* " . idf_escape ( $C ); $M [] = ( $Ga ? " $Ga AS " : " " ) . idf_escape ( $C );}} $K = array (); if ( ! support ( " table " )) $M = array ( " * " ); if ( $M ){ $I = $Xb -> select ( $a , $M , array ( $Z ), $M , array (),( isset ( $_GET [ " select " ]) ? 2 : 1 )); $K = $I -> fetch_assoc (); if ( ! $K ) $K = false ; if ( isset ( $_GET [ " select " ]) && ( ! $K || $I -> fetch_assoc ())) $K = null ;}} if ( ! support ( " table " ) &&! $p ){ if ( ! $Z ){ $I = $Xb -> select ( $a , array ( " * " ), $Z , array ( " * " )); $K = ( $I ? $I -> fetch_assoc () : false ); if ( ! $K ) $K = array ( $Xb -> primary => " " );} if ( $K ){ foreach ( $K
as $y => $X ){ if ( ! $Z ) $K [ $y ] = null ; $p [ $y ] = array ( " field " => $y , " null " => ( $y != $Xb -> primary ), " auto_increment " => ( $y == $Xb -> primary ));}}} edit_form ( $a , $p , $K , $Zh );} elseif ( isset ( $_GET [ " create " ])){ $a = $_GET [ " create " ]; $uf = array (); foreach ( array ( 'HASH' , 'LINEAR HASH' , 'KEY' , 'LINEAR KEY' , 'RANGE' , 'LIST' ) as $y ) $uf [ $y ] = $y ; $dg = referencable_primary ( $a ); $Tc = array (); foreach ( $dg
as $gh => $o ) $Tc [ str_replace ( " ` " , " `` " , $gh ) . " ` " . str_replace ( " ` " , " `` " , $o [ " field " ])] = $gh ; $jf = array (); $S = array (); if ( $a != " " ){ $jf = fields ( $a ); $S = table_status ( $a ); if ( ! $S ) $n = lang ( 9 );} $K = $_POST ; $K [ " fields " ] = ( array ) $K [ " fields " ]; if ( $K [ " auto_increment_col " ]) $K [ " fields " ][ $K [ " auto_increment_col " ]][ " auto_increment " ] = true ; if ( $_POST &&! process_fields ( $K [ " fields " ]) &&! $n ){ if ( $_POST [ " drop " ]) queries_redirect ( substr ( ME , 0 , - 1 ), lang ( 161 ), drop_tables ( array ( $a ))); else { $p = array (); $Da = array (); $di = false ; $Rc = array (); $if = reset ( $jf ); $Aa = " FIRST " ; foreach ( $K [ " fields " ] as $y => $o ){ $q = $Tc [ $o [ " type " ]]; $Ph = ( $q !== null ? $dg [ $q ] : $o ); if ( $o [ " field " ] != " " ){ if ( ! $o [ " has_default " ]) $o [ " default " ] = null ; if ( $y == $K [ " auto_increment_col " ]) $o [ " auto_increment " ] = true ; $Rf = process_field ( $o , $Ph ); $Da [] = array ( $o [ " orig " ], $Rf , $Aa ); if ( $Rf != process_field ( $if , $if )){ $p [] = array ( $o [ " orig " ], $Rf , $Aa ); if ( $o [ " orig " ] != " " || $Aa ) $di = true ;} if ( $q !== null ) $Rc [ idf_escape ( $o [ " field " ])] = ( $a != " " && $x != " sqlite " ? " ADD " : " " ) . format_foreign_key ( array ( 'table' => $Tc [ $o [ " type " ]], 'source' => array ( $o [ " field " ]), 'target' => array ( $Ph [ " field " ]), 'on_delete' => $o [ " on_delete " ],)); $Aa = " AFTER " . idf_escape ( $o [ " field " ]);} elseif ( $o [ " orig " ] != " " ){ $di = true ; $p [] = array ( $o [ " orig " ]);} if ( $o [ " orig " ] != " " ){ $if = next ( $jf ); if ( ! $if ) $Aa = " " ;}} $wf = " " ; if ( $uf [ $K [ " partition_by " ]]){ $xf = array (); if ( $K [ " partition_by " ] == 'RANGE' || $K [ " partition_by " ] == 'LIST' ){ foreach ( array_filter ( $K [ " partition_names " ]) as $y => $X ){ $Y = $K [ " partition_values " ][ $y ]; $xf [] = " \n PARTITION " . idf_escape ( $X ) . " VALUES " . ( $K [ " partition_by " ] == 'RANGE' ? " LESS THAN " : " IN " ) . ( $Y != " " ? " ( $Y ) " : " MAXVALUE " );}} $wf .= " \n PARTITION BY $K[partition_by] ( $K[partition] ) " . ( $xf ? " ( " . implode ( " , " , $xf ) . " \n ) " : ( $K [ " partitions " ] ? " PARTITIONS " . ( + $K [ " partitions " ]) : " " ));} elseif ( support ( " partitioning " ) && preg_match ( " ~partitioned~ " , $S [ " Create_options " ])) $wf .= " \n REMOVE PARTITIONING " ; $se = lang ( 162 ); if ( $a == " " ){ cookie ( " adminer_engine " , $K [ " Engine " ]); $se = lang ( 163 );} $C = trim ( $K [ " name " ]); queries_redirect ( ME . ( support ( " table " ) ? " table= " : " select= " ) . urlencode ( $C ), $se , alter_table ( $a , $C ,( $x == " sqlite " && ( $di || $Rc ) ? $Da : $p ), $Rc ,( $K [ " Comment " ] != $S [ " Comment " ] ? $K [ " Comment " ] : null ),( $K [ " Engine " ] && $K [ " Engine " ] != $S [ " Engine " ] ? $K [ " Engine " ] : " " ),( $K [ " Collation " ] && $K [ " Collation " ] != $S [ " Collation " ] ? $K [ " Collation " ] : " " ),( $K [ " Auto_increment " ] != " " ? number ( $K [ " Auto_increment " ]) : " " ), $wf ));}} page_header (( $a != " " ? lang ( 42 ) : lang ( 71 )), $n , array ( " table " => $a ), h ( $a )); if ( ! $_POST ){ $K = array ( " Engine " => $_COOKIE [ " adminer_engine " ], " fields " => array ( array ( " field " => " " , " type " => ( isset ( $Rh [ " int " ]) ? " int " : ( isset ( $Rh [ " integer " ]) ? " integer " : " " )))), " partition_names " => array ( " " ),); if ( $a != " " ){ $K = $S ; $K [ " name " ] = $a ; $K [ " fields " ] = array (); if ( ! $_GET [ " auto_increment " ]) $K [ " Auto_increment " ] = " " ; foreach ( $jf
as $o ){ $o [ " has_default " ] = isset ( $o [ " default " ]); $K [ " fields " ][] = $o ;} if ( support ( " partitioning " )){ $Yc = " FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q ( DB ) . " AND TABLE_NAME = " . q ( $a ); $I = $g -> query ( " SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $Yc ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1 " ); list ( $K [ " partition_by " ], $K [ " partitions " ], $K [ " partition " ]) = $I -> fetch_row (); $xf = get_key_vals ( " SELECT PARTITION_NAME, PARTITION_DESCRIPTION $Yc AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION " ); $xf [ " " ] = " " ; $K [ " partition_names " ] = array_keys ( $xf ); $K [ " partition_values " ] = array_values ( $xf );}}} $ob = collations (); $pc = engines (); foreach ( $pc
as $oc ){ if ( ! strcasecmp ( $oc , $K [ " Engine " ])){ $K [ " Engine " ] = $oc ; break ;}} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " id = " form " >
< p >
' ; if ( support ( " columns " ) || $a == " " ){ echo
2017-04-21 11:23:04 +00:00
lang ( 164 ), ': <input name="name" maxlength="64" value="' , h ( $K [ " name " ]), ' " autocapitalize= " off " >
';if($a==""&&!$_POST){?><script type=' text / javascript '>focus(document.getElementById(' form ')[' name ']);</script><?php }echo($pc?"<select name=' Engine ' onchange=' helpClose (); '".on_help("getTarget(event).value",1).">".optionlist(array(""=>"(".lang(165).")")+$pc,$K["Engine"])."</select>":""),' ',($ob&&!preg_match("~sqlite|mssql~",$x)?html_select("Collation",array(""=>"(".lang(92).")")+$ob,$K["Collation"]):""),' < input type = " submit " value = " ',lang(14),' " >
2014-04-01 18:00:42 +00:00
';}echo'
';if(support("columns")){echo' < table cellspacing = " 0 " id = " edit-fields " class = " nowrap " >
2017-04-21 11:23:04 +00:00
';$tb=($_POST?$_POST["comments"]:$K["Comment"]!="");if(!$_POST&&!$tb){foreach($K["fields"]as$o){if($o["comment"]!=""){$tb=true;break;}}}edit_fields($K["fields"],$ob,"TABLE",$Tc,$tb);echo' </ table >
2014-04-01 18:00:42 +00:00
< p >
2017-04-21 11:23:04 +00:00
',lang(48),' : < input type = " number " name = " Auto_increment " size = " 6 " value = " ',h( $K["Auto_increment"] ),' " >
',checkbox("defaults",1,true,lang(166),"columnShow(this.checked, 5)","jsonly");if(!$_POST["defaults"]){echo' < script type = " text/javascript " > editingHideDefaults () </ script > ';}echo(support("comment")?"<label><input type=' checkbox ' name=' comments ' value=' 1 ' class=' jsonly ' onclick=\"columnShow(this.checked, 6); toggle(' Comment '); if (this.checked) this.form[' Comment '].focus();\"".($tb?" checked":"").">".lang(47)."</label>".' < input name = " Comment " id = " Comment " value = " '.h( $K["Comment"] ).' " maxlength = " '.( $g->server_info >=5.5?2048:60).' " '.($tb?' ':' class = " hidden " ').' > ':' '),' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2014-04-01 18:00:42 +00:00
';}echo'
2017-04-21 11:23:04 +00:00
';if($a!=""){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}if(support("partitioning")){$vf=preg_match(' ~ RANGE | LIST ~ ',$K["partition_by"]);print_fieldset("partition",lang(167),$K["partition_by"]);echo' < p >
',"<select name=' partition_by ' onchange=' partitionByChange ( this ); '".on_help("getTarget(event).value.replace(/./, ' PARTITION BY \ $ & ')",1).">".optionlist(array(""=>"")+$uf,$K["partition_by"])."</select>",' ( < input name = " partition " value = " ',h( $K["partition"] ),' " > )
',lang(168),' : < input type = " number " name = " partitions " class = " size',( $vf ||! $K["partition_by"] ? " hidden " : " " ),' " value = " ',h( $K["partitions"] ),' " >
< table cellspacing = " 0 " id = " partition-table " ',($vf?"":" class=' hidden '"),' >
< thead >< tr >< th > ',lang(169),' < th > ',lang(170),' </ thead >
';foreach($K["partition_names"]as$y=>$X){echo' < tr > ',' < td >< input name = " partition_names[] " value = " '.h( $X ).' " '.($y==count($K["partition_names"])-1?' onchange = " partitionNameChange(this); " ':' ').' autocapitalize = " off " > ',' < td >< input name = " partition_values[] " value = " '.h( $K["partition_values"] [ $y ]).' " > ';}echo' </ table >
2014-04-01 18:00:42 +00:00
</ div ></ fieldset >
2017-04-21 11:23:04 +00:00
';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$td=array("PRIMARY","UNIQUE","INDEX");$S=table_status($a,true);if(preg_match(' ~ MyISAM | M ? aria '.($g->server_info>=5.6?' | InnoDB ':' ').' ~ i ',$S["Engine"]))$td[]="FULLTEXT";if(preg_match(' ~ MyISAM | M ? aria '.($g->server_info>=5.7?' | InnoDB ':' ').' ~ i ' , $S [ " Engine " ])) $td [] = " SPATIAL " ; $w = indexes ( $a ); $Kf = array (); if ( $x == " mongo " ){ $Kf = $w [ " _id_ " ]; unset ( $td [ 0 ]); unset ( $w [ " _id_ " ]);} $K = $_POST ; if ( $_POST &&! $n &&! $_POST [ " add " ] &&! $_POST [ " drop_col " ]){ $c = array (); foreach ( $K [ " indexes " ] as $v ){ $C = $v [ " name " ]; if ( in_array ( $v [ " type " ], $td )){ $e = array (); $ce = array (); $Qb = array (); $O = array (); ksort ( $v [ " columns " ]); foreach ( $v [ " columns " ] as $y => $d ){ if ( $d != " " ){ $be = $v [ " lengths " ][ $y ]; $Pb = $v [ " descs " ][ $y ]; $O [] = idf_escape ( $d ) . ( $be ? " ( " . ( + $be ) . " ) " : " " ) . ( $Pb ? " DESC " : " " ); $e [] = $d ; $ce [] = ( $be ? $be : null ); $Qb [] = $Pb ;}} if ( $e ){ $yc = $w [ $C ]; if ( $yc ){ ksort ( $yc [ " columns " ]); ksort ( $yc [ " lengths " ]); ksort ( $yc [ " descs " ]); if ( $v [ " type " ] == $yc [ " type " ] && array_values ( $yc [ " columns " ]) === $e && ( ! $yc [ " lengths " ] || array_values ( $yc [ " lengths " ]) === $ce ) && array_values ( $yc [ " descs " ]) === $Qb ){ unset ( $w [ $C ]); continue ;}} $c [] = array ( $v [ " type " ], $C , $O );}}} foreach ( $w
as $C => $yc ) $c [] = array ( $yc [ " type " ], $C , " DROP " ); if ( ! $c ) redirect ( ME . " table= " . urlencode ( $a )); queries_redirect ( ME . " table= " . urlencode ( $a ), lang ( 171 ), alter_indexes ( $a , $c ));} page_header ( lang ( 124 ), $n , array ( " table " => $a ), h ( $a )); $p = array_keys ( fields ( $a )); if ( $_POST [ " add " ]){ foreach ( $K [ " indexes " ] as $y => $v ){ if ( $v [ " columns " ][ count ( $v [ " columns " ])] != " " ) $K [ " indexes " ][ $y ][ " columns " ][] = " " ;} $v = end ( $K [ " indexes " ]); if ( $v [ " type " ] || array_filter ( $v [ " columns " ], 'strlen' )) $K [ " indexes " ][] = array ( " columns " => array ( 1 => " " ));} if ( ! $K ){ foreach ( $w
as $y => $v ){ $w [ $y ][ " name " ] = $y ; $w [ $y ][ " columns " ][] = " " ;} $w [] = array ( " columns " => array ( 1 => " " )); $K [ " indexes " ] = $w ;} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< table cellspacing = " 0 " class = " nowrap " >
< thead >< tr >
2017-04-21 11:23:04 +00:00
< th id = " label-type " > ',lang(172),' < th >< input type = " submit " class = " wayoff " > ',lang(173),' < th id = " label-name " > ' , lang ( 174 ); ?>
< th >< noscript >< input type = 'image' class = 'icon' name = 'add[0]' src = '" . h(preg_replace("~\\?.*~", "", ME)) . "?file=plus.gif&version=4.3.1' alt = '+' title = ' < ? php echo
lang ( 99 ), ' \ ' ></ noscript >& nbsp ;
2014-04-01 18:00:42 +00:00
</ thead >
2017-04-21 11:23:04 +00:00
' ; if ( $Kf ){ echo " <tr><td>PRIMARY<td> " ; foreach ( $Kf [ " columns " ] as $y => $d ){ echo
select_input ( " disabled " , $p , $d ), " <label><input disabled type='checkbox'> " . lang ( 56 ) . " </label> " ;} echo " <td><td> \n " ;} $Jd = 1 ; foreach ( $K [ " indexes " ] as $v ){ if ( ! $_POST [ " drop_col " ] || $Jd != key ( $_POST [ " drop_col " ])){ echo " <tr><td> " . html_select ( " indexes[ $Jd ][type] " , array ( - 1 => " " ) + $td , $v [ " type " ],( $Jd == count ( $K [ " indexes " ]) ? " indexesAddRow(this); " : 1 ), " label-type " ), " <td> " ; ksort ( $v [ " columns " ]); $s = 1 ; foreach ( $v [ " columns " ] as $y => $d ){ echo " <span> " . select_input ( " name='indexes[ $Jd ][columns][ $s ]' onchange= \" " . ( $s == count ( $v [ " columns " ]) ? " indexesAddColumn " : " indexesChangeColumn " ) . " (this, ' " . h ( js_escape ( $x == " sql " ? " " : $_GET [ " indexes " ] . " _ " )) . " '); \" title=' " . lang ( 45 ) . " ' " ,( $p ? array_combine ( $p , $p ) : $p ), $d ),( $x == " sql " || $x == " mssql " ? " <input type='number' name='indexes[ $Jd ][lengths][ $s ]' class='size' value=' " . h ( $v [ " lengths " ][ $y ]) . " ' title=' " . lang ( 97 ) . " '> " : " " ),( $x != " sql " ? checkbox ( " indexes[ $Jd ][descs][ $s ] " , 1 , $v [ " descs " ][ $y ], lang ( 56 )) : " " ), " </span> " ; $s ++ ;} echo " <td><input name='indexes[ $Jd ][name]' value=' " . h ( $v [ " name " ]) . " ' autocapitalize='off' aria-labelledby='label-name'> \n " , " <td><input type='image' class='icon' name='drop_col[ $Jd ]' src=' " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=cross.gif&version=4.3.1' alt='x' title=' " . lang ( 102 ) . " ' onclick= \" return !editingRemoveRow(this, 'indexes \$ 1[type]'); \" > \n " ;} $Jd ++ ;} echo ' </ table >
2014-04-01 18:00:42 +00:00
< p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
< input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["database"])){$K=$_POST;if($_POST&&!$n&&!isset($_POST["add_x"])){$C=trim($K["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(175),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace(' ~ \bdb = [ ^& ] *&~ ',' ' , ME ) . " db= " . urlencode ( $C ), lang ( 176 ), rename_database ( $C , $K [ " collation " ]));} else { $l = explode ( " \n " , str_replace ( " \r " , " " , $C )); $ah = true ; $Vd = " " ; foreach ( $l
as $m ){ if ( count ( $l ) == 1 || $m != " " ){ if ( ! create_database ( $m , $K [ " collation " ])) $ah = false ; $Vd = $m ;}} restart_session (); set_session ( " dbs " , null ); queries_redirect ( ME . " db= " . urlencode ( $Vd ), lang ( 177 ), $ah );}} else { if ( ! $K [ " collation " ]) redirect ( substr ( ME , 0 , - 1 )); query_redirect ( " ALTER DATABASE " . idf_escape ( $C ) . ( preg_match ( '~^[a-z0-9_]+$~i' , $K [ " collation " ]) ? " COLLATE $K[collation] " : " " ), substr ( ME , 0 , - 1 ), lang ( 178 ));}} page_header ( DB != " " ? lang ( 64 ) : lang ( 106 ), $n , array (), h ( DB )); $ob = collations (); $C = DB ; if ( $_POST ) $C = $K [ " name " ]; elseif ( DB != " " ) $K [ " collation " ] = db_collation ( DB , $ob ); elseif ( $x == " sql " ){ foreach ( get_vals ( " SHOW GRANTS " ) as $ad ){ if ( preg_match ( '~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~' , $ad , $B ) && $B [ 1 ]){ $C = stripcslashes ( idf_unescape ( " ` $B[2] ` " )); break ;}}} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >
2017-04-21 11:23:04 +00: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 ).' " maxlength = " 64 " autocapitalize = " off " > ')."\n".($ob?html_select("collation",array(""=>"(".lang(92).")")+$ob,$K["collation"]).doc_link(array(' sql '=>"charset-charsets.html",' mssql ' => " ms187963.aspx " ,)) : " " ); ?>
2014-04-01 18:00:42 +00:00
< script type = 'text/javascript' > focus ( document . getElementById ( 'name' )); </ script >
< input type = " submit " value = " <?php echo
2015-04-01 06:36:56 +00:00
lang ( 14 ), ' " >
2017-04-21 11:23:04 +00:00
';if(DB!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(119). " '".confirm().">\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type=' image ' class=' icon ' name=' add ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = plus . gif & amp ; version = 4.3 . 1 ' alt=' + ' title=' " .lang(99). " '>\n";echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["scheme"])){$K=$_POST;if($_POST&&!$n){$_=preg_replace(' ~ ns = [ ^& ] *&~ ',' ' , ME ) . " ns= " ; if ( $_POST [ " drop " ]) query_redirect ( " DROP SCHEMA " . idf_escape ( $_GET [ " ns " ]), $_ , lang ( 179 )); else { $C = trim ( $K [ " name " ]); $_ .= urlencode ( $C ); if ( $_GET [ " ns " ] == " " ) query_redirect ( " CREATE SCHEMA " . idf_escape ( $C ), $_ , lang ( 180 )); elseif ( $_GET [ " ns " ] != $C ) query_redirect ( " ALTER SCHEMA " . idf_escape ( $_GET [ " ns " ]) . " RENAME TO " . idf_escape ( $C ), $_ , lang ( 181 )); else
redirect ( $_ );}} page_header ( $_GET [ " ns " ] != " " ? lang ( 65 ) : lang ( 66 ), $n ); if ( ! $K ) $K [ " name " ] = $_GET [ " ns " ]; echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >< input name = " name " id = " name " value = " ',h( $K["name"] );?> " autocapitalize = " off " >
< script type = 'text/javascript' > focus ( document . getElementById ( 'name' )); </ script >
< input type = " submit " value = " <?php echo
2015-04-01 06:36:56 +00:00
lang ( 14 ), ' " >
2017-04-21 11:23:04 +00:00
';if($_GET["ns"]!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(119). " '".confirm().">\n";echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header(lang(182).": ".h($da),$n);$rg=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$rd=array();$nf=array();foreach($rg["fields"]as$s=>$o){if(substr($o["inout"],-3)=="OUT")$nf[$s]="@".idf_escape($o["field"])." AS ".idf_escape($o["field"]);if(!$o["inout"]||substr($o["inout"],0,2)=="IN")$rd[]=$s;}if(!$n&&$_POST){$Ya=array();foreach($rg["fields"]as$y=>$o){if(in_array($y,$rd)){$X=process_input($o);if($X===false)$X="' '";if(isset($nf[$y]))$g->query("SET @".idf_escape($o["field"])." = $X");}$Ya[]=(isset($nf[$y])?"@".idf_escape($o["field"]):$X);}$H=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$Ya).")";echo"<p><code class=' jush - $x '>".h($H)."</code> <a href=' " .h(ME). " sql = " .urlencode( $H ). " '>".lang(10)."</a>\n";if(!$g->multi_query($H))echo"<p class=' error ' > " .error(). " \n " ;else { $h =connect();if(is_object( $h )) $h->select_db (DB);do { $I = $g->store_result ();if(is_object( $I ))select( $I , $h );else
echo " <p class='message'> " . lang ( 183 , $g -> affected_rows ) . " \n " ;} while ( $g -> next_result ()); if ( $nf ) select ( $g -> query ( " SELECT " . implode ( " , " , $nf )));}} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
2017-04-21 11:23:04 +00:00
';if($rd){echo"<table cellspacing=' 0 ' > \n " ;foreach( $rd
as $y ){ $o = $rg [ " fields " ][ $y ]; $C = $o [ " field " ]; echo " <tr><th> " . $b -> fieldName ( $o ); $Y = $_POST [ " fields " ][ $C ]; if ( $Y != " " ){ if ( $o [ " type " ] == " enum " ) $Y =+ $Y ; if ( $o [ " type " ] == " set " ) $Y = array_sum ( $Y );} input ( $o , $Y ,( string ) $_POST [ " function " ][ $C ]); echo " \n " ;} echo " </table> \n " ;} echo ' < p >
< input type = " submit " value = " ',lang(182),' " >
< input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$K=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$se=($_POST["drop"]?lang(184):($C!=""?lang(185):lang(186)));$A=ME."table=".urlencode($a);if(!$_POST["drop"]){$K["source"]=array_filter($K["source"],' strlen ');ksort($K["source"]);$oh=array();foreach($K["source"]as$y=>$X)$oh[$y]=$K["target"][$y];$K["target"]=$oh;}if($x=="sqlite")queries_redirect($A,$se,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($K)))));else{$c="ALTER TABLE ".table($a);$Zb="\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$Zb,$A,$se);else{query_redirect($c.($C!=""?"$Zb,":"")."\nADD".format_foreign_key($K),$A,$se);$n=lang(187)."<br>$n";}}}page_header(lang(188),$n,array("table"=>$a),h($a));if($_POST){ksort($K["source"]);if($_POST["add"])$K["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$K["target"]=array();}elseif($C!=""){$Tc=foreign_keys($a);$K=$Tc[$C];$K["source"][]="";}else{$K["table"]=$a;$K["source"]=array("");}$Qg=array_keys(fields($a));$oh=($a===$K["table"]?$Qg:array_keys(fields($K["table"])));$cg=array_keys(array_filter(table_status(' ',true),' fk_support '));echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >
' ; if ( $K [ " db " ] == " " && $K [ " ns " ] == " " ){ echo
2017-04-21 11:23:04 +00:00
lang ( 189 ), ' :
',html_select("table",$cg,$K["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(190),' " ></ noscript >
2014-04-01 18:00:42 +00:00
< table cellspacing = " 0 " >
2017-04-21 11:23:04 +00:00
< thead >< tr >< th id = " label-source " > ',lang(126),' < th id = " label-target " > ',lang(127),' </ thead >
';$Jd=0;foreach($K["source"]as$y=>$X){echo"<tr>","<td>".html_select("source[".(+$y)."]",array(-1=>"")+$Qg,$X,($Jd==count($K["source"])-1?"foreignAddRow(this);":1),"label-source"),"<td>".html_select("target[".(+$y)."]",$oh,$K["target"][$y],1,"label-target");$Jd++;}echo' </ table >
2014-04-01 18:00:42 +00:00
< p >
2017-04-21 11:23:04 +00:00
',lang(94),' : ',html_select("on_delete",array(-1=>"")+explode("|",$Te),$K["on_delete"]),' ',lang(93),' : ',html_select("on_update",array(-1=>"")+explode("|",$Te),$K["on_update"]),doc_link(array(' sql '=>"innodb-foreign-key-constraints.html",' pgsql '=>"sql-createtable.html#SQL-CREATETABLE-REFERENCES",' mssql '=>"ms174979.aspx",' oracle '=>"clauses002.htm#sthref2903",)),' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
< noscript >< p >< input type = " submit " name = " add " value = " ',lang(191),' " ></ noscript >
';}if($C!=""){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$K=$_POST;$kf="VIEW";if($x=="pgsql"&&$a!=""){$P=table_status($a);$kf=strtoupper($P["Engine"]);}if($_POST&&!$n){$C=trim($K["name"]);$Ga=" AS\n$K[select]";$A=ME."table=".urlencode($C);$se=lang(192);$U=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$C&&$x!="sqlite"&&$U=="VIEW"&&$kf=="VIEW")query_redirect(($x=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ga,$A,$se);else{$qh=$C."_adminer_".uniqid();drop_create("DROP $kf ".table($a),"CREATE $U ".table($C).$Ga,"DROP $U ".table($C),"CREATE $U ".table($qh).$Ga,"DROP $U ".table($qh),($_POST["drop"]?substr(ME,0,-1):$A),lang(193),$se,lang(194),$a,$C);}}if(!$_POST&&$a!=""){$K=view($a);$K["name"]=$a;$K["materialized"]=($kf!="VIEW");if(!$n)$n=error();}page_header(($a!=""?lang(41):lang(195)),$n,array("table"=>$a),h($a));echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
2017-04-21 11:23:04 +00:00
< p > ',lang(174),' : < input name = " name " value = " ',h( $K["name"] ),' " maxlength = " 64 " autocapitalize = " off " >
',(support("materializedview")?" ".checkbox("materialized",1,$K["materialized"],lang(121)):""),' < p > ';textarea("select",$K["select"]);echo' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
';if($_GET["view"]!=""){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Ad=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Wg=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$K=$_POST;if($_POST&&!$n){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(196));elseif(in_array($K["INTERVAL_FIELD"],$Ad)&&isset($Wg[$K["STATUS"]])){$wg="\nON SCHEDULE ".($K["INTERVAL_VALUE"]?"EVERY ".q($K["INTERVAL_VALUE"])." $K[INTERVAL_FIELD]".($K["STARTS"]?" STARTS ".q($K["STARTS"]):"").($K["ENDS"]?" ENDS ".q($K["ENDS"]):""):"AT ".q($K["STARTS"]))." ON COMPLETION".($K["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(197):lang(198)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$wg.($aa!=$K["EVENT_NAME"]?"\nRENAME TO ".idf_escape($K["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($K["EVENT_NAME"]).$wg)."\n".$Wg[$K["STATUS"]]." COMMENT ".q($K["EVENT_COMMENT"]).rtrim(" DO\n$K[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(199).": ".h($aa):lang(200)),$n);if(!$K&&$aa!=""){$L=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$K=reset($L);}echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< table cellspacing = " 0 " >
2017-04-21 11:23:04 +00:00
< tr >< th > ',lang(174),' < td >< input name = " EVENT_NAME " value = " ',h( $K["EVENT_NAME"] ),' " maxlength = " 64 " autocapitalize = " off " >
< tr >< th title = " datetime " > ',lang(201),' < td >< input name = " STARTS " value = " ',h( " $K [ EXECUTE_AT ] $K [ STARTS ] " ),' " >
< tr >< th title = " datetime " > ',lang(202),' < td >< input name = " ENDS " value = " ',h( $K["ENDS"] ),' " >
< tr >< th > ',lang(203),' < td >< input type = " number " name = " INTERVAL_VALUE " value = " ',h( $K["INTERVAL_VALUE"] ),' " class = " size " > ',html_select("INTERVAL_FIELD",$Ad,$K["INTERVAL_FIELD"]),' < tr >< th > ',lang(109),' < td > ',html_select("STATUS",$Wg,$K["STATUS"]),' < tr >< th > ',lang(47),' < td >< input name = " EVENT_COMMENT " value = " ',h( $K["EVENT_COMMENT"] ),' " maxlength = " 64 " >
< tr >< th >& nbsp ; < td > ',checkbox("ON_COMPLETION","PRESERVE",$K["ON_COMPLETION"]=="PRESERVE",lang(204)),' </ table >
2014-04-01 18:00:42 +00:00
< p > ';textarea("EVENT_DEFINITION",$K["EVENT_DEFINITION"]);echo' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
';if($aa!=""){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$rg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$K=$_POST;$K["fields"]=(array)$K["fields"];if($_POST&&!process_fields($K["fields"])&&!$n){$qh="$K[name]_adminer_".uniqid();drop_create("DROP $rg ".idf_escape($da),create_routine($rg,$K),"DROP $rg ".idf_escape($K["name"]),create_routine($rg,array("name"=>$qh)+$K),"DROP $rg ".idf_escape($qh),substr(ME,0,-1),lang(205),lang(206),lang(207),$da,$K["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(208):lang(209)).": ".h($da):(isset($_GET["function"])?lang(210):lang(211))),$n);if(!$_POST&&$da!=""){$K=routine($da,$rg);$K["name"]=$da;}$ob=get_vals("SHOW CHARACTER SET");sort($ob);$sg=routine_languages();echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " id = " form " >
2017-04-21 11:23:04 +00:00
< p > ',lang(174),' : < input name = " name " value = " ',h( $K["name"] ),' " maxlength = " 64 " autocapitalize = " off " >
',($sg?lang(19).": ".html_select("language",$sg,$K["language"]):""),' < input type = " submit " value = " ',lang(14),' " >
2014-04-01 18:00:42 +00:00
< table cellspacing = " 0 " class = " nowrap " >
2017-04-21 11:23:04 +00:00
';edit_fields($K["fields"],$ob,$rg);if(isset($_GET["function"])){echo"<tr><td>".lang(212);edit_type("returns",$K["returns"],$ob);}echo' </ table >
2014-04-01 18:00:42 +00:00
< p > ';textarea("definition",$K["definition"]);echo' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
';if($da!=""){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
' ;} elseif ( isset ( $_GET [ " sequence " ])){ $fa = $_GET [ " sequence " ]; $K = $_POST ; if ( $_POST &&! $n ){ $_ = substr ( ME , 0 , - 1 ); $C = trim ( $K [ " name " ]); if ( $_POST [ " drop " ]) query_redirect ( " DROP SEQUENCE " . idf_escape ( $fa ), $_ , lang ( 213 )); elseif ( $fa == " " ) query_redirect ( " CREATE SEQUENCE " . idf_escape ( $C ), $_ , lang ( 214 )); elseif ( $fa != $C ) query_redirect ( " ALTER SEQUENCE " . idf_escape ( $fa ) . " RENAME TO " . idf_escape ( $C ), $_ , lang ( 215 )); else
redirect ( $_ );} page_header ( $fa != " " ? lang ( 216 ) . " : " . h ( $fa ) : lang ( 217 ), $n ); if ( ! $K ) $K [ " name " ] = $fa ; echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >< input name = " name " value = " ',h( $K["name"] ),' " autocapitalize = " off " >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
';if($fa!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(119). " '".confirm().">\n";echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
' ;} elseif ( isset ( $_GET [ " type " ])){ $ga = $_GET [ " type " ]; $K = $_POST ; if ( $_POST &&! $n ){ $_ = substr ( ME , 0 , - 1 ); if ( $_POST [ " drop " ]) query_redirect ( " DROP TYPE " . idf_escape ( $ga ), $_ , lang ( 218 )); else
query_redirect ( " CREATE TYPE " . idf_escape ( trim ( $K [ " name " ])) . " $K[as] " , $_ , lang ( 219 ));} page_header ( $ga != " " ? lang ( 220 ) . " : " . h ( $ga ) : lang ( 221 ), $n ); if ( ! $K ) $K [ " as " ] = " AS " ; echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >
2017-04-21 11:23:04 +00:00
';if($ga!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(119). " '".confirm().">\n";else{echo"<input name=' name ' value=' " .h( $K['name'] ). " ' autocapitalize=' off '>\n";textarea("as",$K["as"]);echo"<p><input type=' submit ' value=' " .lang(14). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$Nh=trigger_options();$K=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$n&&in_array($_POST["Timing"],$Nh["Timing"])&&in_array($_POST["Event"],$Nh["Event"])&&in_array($_POST["Type"],$Nh["Type"])){$Se=" ON ".table($a);$Zb="DROP TRIGGER ".idf_escape($C).($x=="pgsql"?$Se:"");$A=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($Zb,$A,lang(222));else{if($C!="")queries($Zb);queries_redirect($A,($C!=""?lang(223):lang(224)),queries(create_trigger($Se,$_POST)));if($C!="")queries(create_trigger($Se,$K+array("Type"=>reset($Nh["Type"]))));}}$K=$_POST;}page_header(($C!=""?lang(225).": ".h($C):lang(226)),$n,array("table"=>$a));echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " id = " form " >
< table cellspacing = " 0 " >
2017-04-21 11:23:04 +00:00
< tr >< th > ',lang(227),' < td > ',html_select("Timing",$Nh["Timing"],$K["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, ' " .js_escape( $a ). " ', this.form);"),' < tr >< th > ',lang(228),' < td > ',html_select("Event",$Nh["Event"],$K["Event"],"this.form[' Timing '].onchange();"),(in_array("UPDATE OF",$Nh["Event"])?" <input name=' Of ' value=' " .h( $K["Of"] ). " ' class=' hidden '>":""),' < tr >< th > ',lang(46),' < td > ',html_select("Type",$Nh["Type"],$K["Type"]),' </ table >
< p > ',lang(174),' : < input name = " Trigger " value = " ',h( $K["Trigger"] );?> " maxlength = " 64 " autocapitalize = " off " >
2015-04-01 06:36:56 +00:00
< script type = " text/javascript " > document . getElementById ( 'form' )[ 'Timing' ] . onchange (); </ script >
< p >< ? php textarea ( " Statement " , $K [ " Statement " ]); echo ' < p >
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
';if($C!=""){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$Pf=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$K){foreach(explode(",",($K["Privilege"]=="Grant option"?"":$K["Context"]))as$zb)$Pf[$zb][$K["Privilege"]]=$K["Comment"];}$Pf["Server Admin"]+=$Pf["File access on server"];$Pf["Databases"]["Create routine"]=$Pf["Procedures"]["Create routine"];unset($Pf["Procedures"]["Create routine"]);$Pf["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$Pf["Columns"][$X]=$Pf["Tables"][$X];unset($Pf["Server Admin"]["Usage"]);foreach($Pf["Tables"]as$y=>$X)unset($Pf["Databases"][$y]);$Ee=array();if($_POST){foreach($_POST["objects"]as$y=>$X)$Ee[$X]=(array)$Ee[$X]+(array)$_POST["grants"][$y];}$bd=array();$Qe="";if(isset($_GET["host"])&&($I=$g->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($K=$I->fetch_row()){if(preg_match(' ~ GRANT ( .* ) ON ( .* ) TO ~ ',$K[0],$B)&&preg_match_all(' ~ * ([ ^ (,] * [ ^ ,(])( * \\ ([ ^ )] + \\ )) ? ~ ' , $B [ 1 ], $ke , PREG_SET_ORDER )){ foreach ( $ke
as $X ){ if ( $X [ 1 ] != " USAGE " ) $bd [ " $B[2] $X[2] " ][ $X [ 1 ]] = true ; if ( preg_match ( '~ WITH GRANT OPTION~' , $K [ 0 ])) $bd [ " $B[2] $X[2] " ][ " GRANT OPTION " ] = true ;}} if ( preg_match ( " ~ IDENTIFIED BY PASSWORD '([^']+)~ " , $K [ 0 ], $B )) $Qe = $B [ 1 ];}} if ( $_POST &&! $n ){ $Re = ( isset ( $_GET [ " host " ]) ? q ( $ha ) . " @ " . q ( $_GET [ " host " ]) : " '' " ); if ( $_POST [ " drop " ]) query_redirect ( " DROP USER $Re " , ME . " privileges= " , lang ( 229 )); else { $Ge = q ( $_POST [ " user " ]) . " @ " . q ( $_POST [ " host " ]); $yf = $_POST [ " pass " ]; if ( $yf != '' &&! $_POST [ " hashed " ]){ $yf = $g -> result ( " SELECT PASSWORD( " . q ( $yf ) . " ) " ); $n =! $yf ;} $Db = false ; if ( ! $n ){ if ( $Re != $Ge ){ $Db = queries (( $g -> server_info < 5 ? " GRANT USAGE ON *.* TO " : " CREATE USER " ) . " $Ge IDENTIFIED BY PASSWORD " . q ( $yf )); $n =! $Db ;} elseif ( $yf != $Qe ) queries ( " SET PASSWORD FOR $Ge = " . q ( $yf ));} if ( ! $n ){ $og = array (); foreach ( $Ee
as $Le => $ad ){ if ( isset ( $_GET [ " grant " ])) $ad = array_filter ( $ad ); $ad = array_keys ( $ad ); if ( isset ( $_GET [ " grant " ])) $og = array_diff ( array_keys ( array_filter ( $Ee [ $Le ], 'strlen' )), $ad ); elseif ( $Re == $Ge ){ $Oe = array_keys (( array ) $bd [ $Le ]); $og = array_diff ( $Oe , $ad ); $ad = array_diff ( $ad , $Oe ); unset ( $bd [ $Le ]);} if ( preg_match ( '~^(.+)\\s*(\\(.*\\))?$~U' , $Le , $B ) && ( ! grant ( " REVOKE " , $og , $B [ 2 ], " ON $B[1] FROM $Ge " ) ||! grant ( " GRANT " , $ad , $B [ 2 ], " ON $B[1] TO $Ge " ))){ $n = true ; break ;}}} if ( ! $n && isset ( $_GET [ " host " ])){ if ( $Re != $Ge ) queries ( " DROP USER $Re " ); elseif ( ! isset ( $_GET [ " grant " ])){ foreach ( $bd
as $Le => $og ){ if ( preg_match ( '~^(.+)(\\(.*\\))?$~U' , $Le , $B )) grant ( " REVOKE " , array_keys ( $og ), $B [ 2 ], " ON $B[1] FROM $Ge " );}}} queries_redirect ( ME . " privileges= " ,( isset ( $_GET [ " host " ]) ? lang ( 230 ) : lang ( 231 )), ! $n ); if ( $Db ) $g -> query ( " DROP USER $Ge " );}} page_header (( isset ( $_GET [ " host " ]) ? lang ( 33 ) . " : " . h ( " $ha @ $_GET[host] " ) : lang ( 138 )), $n , array ( " privileges " => array ( '' , lang ( 68 )))); if ( $_POST ){ $K = $_POST ; $bd = $Ee ;} else { $K = $_GET + array ( " host " => $g -> result ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1) " )); $K [ " pass " ] = $Qe ; if ( $Qe != " " ) $K [ " hashed " ] = true ; $bd [( DB == " " || $bd ? " " : idf_escape ( addcslashes ( DB , " %_ \\ " ))) . " .* " ] = array ();} echo ' < form action = " " method = " post " >
2014-04-01 18:00:42 +00:00
< table cellspacing = " 0 " >
2015-04-01 06:36:56 +00:00
< tr >< th > ',lang(32),' < td >< input name = " host " maxlength = " 60 " value = " ',h( $K["host"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(33),' < td >< input name = " user " maxlength = " 16 " value = " ',h( $K["user"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(34),' < td >< input name = " pass " id = " pass " value = " ',h( $K["pass"] ),' " >
2014-04-01 18:00:42 +00:00
';if(!$K["hashed"]){echo' < script type = " text/javascript " > typePassword ( document . getElementById ( \ 'pass\'));</script>' ;} echo
2017-04-21 11:23:04 +00:00
checkbox ( " hashed " , 1 , $K [ " hashed " ], lang ( 232 ), " typePassword(this.form['pass'], this.checked); " ), ' </ table >
2014-04-01 18:00:42 +00:00
2017-04-21 11:23:04 +00:00
';echo"<table cellspacing=' 0 '>\n","<thead><tr><th colspan=' 2 '>".lang(68).doc_link(array(' sql ' => " grant.html#priv_level " )); $s = 0 ; foreach ( $bd
as $Le => $ad ){ echo '<th>' . ( $Le != " *.* " ? " <input name='objects[ $s ]' value=' " . h ( $Le ) . " ' size='10' autocapitalize='off'> " : " <input type='hidden' name='objects[ $s ]' value='*.*' size='10'>*.* " ); $s ++ ;} echo " </thead> \n " ; foreach ( array ( " " => " " , " Server Admin " => lang ( 32 ), " Databases " => lang ( 35 ), " Tables " => lang ( 123 ), " Columns " => lang ( 45 ), " Procedures " => lang ( 233 ),) as $zb => $Pb ){ foreach (( array ) $Pf [ $zb ] as $Of => $sb ){ echo " <tr " . odd () . " ><td " . ( $Pb ? " > $Pb <td " : " colspan='2' " ) . ' lang="en" title="' . h ( $sb ) . '">' . h ( $Of ); $s = 0 ; foreach ( $bd
as $Le => $ad ){ $C = " 'grants[ $s ][ " . h ( strtoupper ( $Of )) . " ]' " ; $Y = $ad [ strtoupper ( $Of )]; if ( $zb == " Server Admin " && $Le != ( isset ( $bd [ " *.* " ]) ? " *.* " : " .* " )) echo " <td> " ; elseif ( isset ( $_GET [ " grant " ])) echo " <td><select name= $C ><option><option value='1' " . ( $Y ? " selected " : " " ) . " > " . lang ( 234 ) . " <option value='0' " . ( $Y == " 0 " ? " selected " : " " ) . " > " . lang ( 235 ) . " </select> " ; else
echo " <td align='center'><label class='block'><input type='checkbox' name= $C value='1' " . ( $Y ? " checked " : " " ) . ( $Of == " All privileges " ? " id='grants- $s -all' " : ( $Of == " Grant option " ? " " : " onclick= \" if (this.checked) formUncheck('grants- $s -all'); \" " )) . " ></label> " ; $s ++ ;}}} echo " </table> \n " , ' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
2017-04-21 11:23:04 +00:00
';if(isset($_GET["host"])){echo' < input type = " submit " name = " drop " value = " ',lang(119),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$n){$Qd=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$Qd++;}queries_redirect(ME."processlist=",lang(236,$Qd),$Qd||!$_POST["kill"]);}page_header(lang(107),$n);echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< table cellspacing = " 0 " onclick = " tableClick(event); " ondblclick = " tableClick(event, true); " class = " nowrap checkable " >
2015-04-01 06:36:56 +00:00
';$s=-1;foreach(process_list()as$s=>$K){if(!$s){echo"<thead><tr lang=' en ' > " .(support( " kill " )? " < th >& nbsp ; " : " " );foreach( $K
2017-04-21 11:23:04 +00:00
as $y => $X ) echo " <th> $y " . doc_link ( array ( 'sql' => " show-processlist.html#processlist_ " . strtolower ( $y ), 'pgsql' => " monitoring-stats.html#PG-STAT-ACTIVITY-VIEW " , 'oracle' => " ../b14237/dynviews_2088.htm " ,)); echo " </thead> \n " ;} echo " <tr " . odd () . " > " . ( support ( " kill " ) ? " <td> " . checkbox ( " kill[] " , $K [ $x == " sql " ? " Id " : " pid " ], 0 ) : " " ); foreach ( $K
as $y => $X ) echo " <td> " . (( $x == " sql " && $y == " Info " && preg_match ( " ~Query|Killed~ " , $K [ " Command " ]) && $X != " " ) || ( $x == " pgsql " && $y == " current_query " && $X != " <IDLE> " ) || ( $x == " oracle " && $y == " sql_text " && $X != " " ) ? " <code class='jush- $x '> " . shorten_utf8 ( $X , 100 , " </code> " ) . ' <a href="' . h ( ME . ( $K [ " db " ] != " " ? " db= " . urlencode ( $K [ " db " ]) . " & " : " " ) . " sql= " . urlencode ( $X )) . '">' . lang ( 237 ) . '</a>' : nbsp ( $X )); echo " \n " ;} echo ' </ table >
2014-04-01 18:00:42 +00:00
< script type = \ ' text / javascript\ ' > tableCheck (); </ script >
< p >
2017-04-21 11:23:04 +00:00
';if(support("kill")){echo($s+1)."/".lang(238,max_connections()),"<p><input type=' submit ' value=' " .lang(239). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $Dh ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2017-04-21 11:23:04 +00:00
';}elseif(isset($_GET["replication"])){page_header(lang(110));echo"<h3>".lang(240).doc_link(array("sql"=>"show-master-status.html"))."</h3>\n";$ie=replication_status("MASTER");if(!$ie)echo"<p class=' message '>".lang(12)."\n";else{echo"<table cellspacing=' 0 '>\n";foreach($ie[0]as$y=>$X){echo"<tr>","<th>".h($y),"<td>".nbsp($X);}echo"</table>\n";}$Ng=replication_status("SLAVE");if($Ng){echo"<h3>".lang(241).doc_link(array("sql"=>"show-slave-status.html"))."</h3>\n";foreach($Ng[0]as$Mg){echo"<table cellspacing=' 0 ' > \n " ;foreach( $Mg
as $y => $X ){ echo " <tr> " , " <th> " . h ( $y ), " <td> " . nbsp ( $X );} echo " </table> \n " ;}}} elseif ( isset ( $_GET [ " select " ])){ $a = $_GET [ " select " ]; $S = table_status1 ( $a ); $w = indexes ( $a ); $p = fields ( $a ); $Tc = column_foreign_keys ( $a ); $Ne = " " ; if ( $S [ " Oid " ]){ $Ne = ( $x == " sqlite " ? " rowid " : " oid " ); $w [] = array ( " type " => " PRIMARY " , " columns " => array ( $Ne ));} parse_str ( $_COOKIE [ " adminer_import " ], $ya ); $pg = array (); $e = array (); $uh = null ; foreach ( $p
as $y => $o ){ $C = $b -> fieldName ( $o ); if ( isset ( $o [ " privileges " ][ " select " ]) && $C != " " ){ $e [ $y ] = html_entity_decode ( strip_tags ( $C ), ENT_QUOTES ); if ( is_shortable ( $o )) $uh = $b -> selectLengthProcess ();} $pg += $o [ " privileges " ];} list ( $M , $cd ) = $b -> selectColumnsProcess ( $e , $w ); $Ed = count ( $cd ) < count ( $M ); $Z = $b -> selectSearchProcess ( $p , $w ); $df = $b -> selectOrderProcess ( $p , $w ); $z = $b -> selectLimitProcess (); $Yc = ( $M ? implode ( " , " , $M ) : " * " . ( $Ne ? " , $Ne " : " " )) . convert_fields ( $e , $p , $M ) . " \n FROM " . table ( $a ); $dd = ( $cd && $Ed ? " \n GROUP BY " . implode ( " , " , $cd ) : " " ) . ( $df ? " \n ORDER BY " . implode ( " , " , $df ) : " " ); if ( $_GET [ " val " ] && is_ajax ()){ header ( " Content-Type: text/plain; charset=utf-8 " ); foreach ( $_GET [ " val " ] as $Vh => $K ){ $Ga = convert_field ( $p [ key ( $K )]); $M = array ( $Ga ? $Ga : idf_escape ( key ( $K ))); $Z [] = where_check ( $Vh , $p ); $J = $Xb -> select ( $a , $M , $Z , $M ); if ( $J ) echo
reset ( $J -> fetch_row ());} exit ;} if ( $_POST &&! $n ){ $si = $Z ; if ( ! $_POST [ " all " ] && is_array ( $_POST [ " check " ])){ $eb = array (); foreach ( $_POST [ " check " ] as $bb ) $eb [] = where_check ( $bb , $p ); $si [] = " (( " . implode ( " ) OR ( " , $eb ) . " )) " ;} $si = ( $si ? " \n WHERE " . implode ( " AND " , $si ) : " " ); $Kf = $Xh = null ; foreach ( $w
as $v ){ if ( $v [ " type " ] == " PRIMARY " ){ $Kf = array_flip ( $v [ " columns " ]); $Xh = ( $M ? $Kf : array ()); break ;}} foreach (( array ) $Xh
as $y => $X ){ if ( in_array ( idf_escape ( $y ), $M )) unset ( $Xh [ $y ]);} if ( $_POST [ " export " ]){ cookie ( " adminer_import " , " output= " . urlencode ( $_POST [ " output " ]) . " &format= " . urlencode ( $_POST [ " format " ])); dump_headers ( $a ); $b -> dumpTable ( $a , " " ); if ( ! is_array ( $_POST [ " check " ]) || $Xh === array ()) $H = " SELECT $Yc $si $dd " ; else { $Th = array (); foreach ( $_POST [ " check " ] as $X ) $Th [] = " (SELECT " . limit ( $Yc , " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $p ) . $dd , 1 ) . " ) " ; $H = implode ( " UNION ALL " , $Th );} $b -> dumpData ( $a , " table " , $H ); exit ;} if ( ! $b -> selectEmailProcess ( $Z , $Tc )){ if ( $_POST [ " save " ] || $_POST [ " delete " ]){ $I = true ; $za = 0 ; $O = array (); if ( ! $_POST [ " delete " ]){ foreach ( $e
as $C => $X ){ $X = process_input ( $p [ $C ]); if ( $X !== null && ( $_POST [ " clone " ] || $X !== false )) $O [ idf_escape ( $C )] = ( $X !== false ? $X : idf_escape ( $C ));}} if ( $_POST [ " delete " ] || $O ){ if ( $_POST [ " clone " ]) $H = " INTO " . table ( $a ) . " ( " . implode ( " , " , array_keys ( $O )) . " ) \n SELECT " . implode ( " , " , $O ) . " \n FROM " . table ( $a ); if ( $_POST [ " all " ] || ( $Xh === array () && is_array ( $_POST [ " check " ])) || $Ed ){ $I = ( $_POST [ " delete " ] ? $Xb -> delete ( $a , $si ) : ( $_POST [ " clone " ] ? queries ( " INSERT $H $si " ) : $Xb -> update ( $a , $O , $si ))); $za = $g -> affected_rows ;} else { foreach (( array ) $_POST [ " check " ] as $X ){ $ri = " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $p ); $I = ( $_POST [ " delete " ] ? $Xb -> delete ( $a , $ri , 1 ) : ( $_POST [ " clone " ] ? queries ( " INSERT " . limit1 ( $H , $ri )) : $Xb -> update ( $a , $O , $ri ))); if ( ! $I ) break ; $za += $g -> affected_rows ;}}} $se = lang ( 242 , $za ); if ( $_POST [ " clone " ] && $I && $za == 1 ){ $Wd = last_id (); if ( $Wd ) $se = lang ( 160 , " $Wd " );} queries_redirect ( remove_from_uri ( $_POST [ " all " ] && $_POST [ " delete " ] ? " page " : " " ), $se , $I ); if ( ! $_POST [ " delete " ]){ edit_form ( $a , $p ,( array ) $_POST [ " fields " ], ! $_POST [ " clone " ]); page_footer (); exit ;}} elseif ( ! $_POST [ " import " ]){ if ( ! $_POST [ " val " ]) $n = lang ( 243 ); else { $I = true ; $za = 0 ; foreach ( $_POST [ " val " ] as $Vh => $K ){ $O = array (); foreach ( $K
as $y => $X ){ $y = bracket_escape ( $y , 1 ); $O [ idf_escape ( $y )] = ( preg_match ( '~char|text~' , $p [ $y ][ " type " ]) || $X != " " ? $b -> processInput ( $p [ $y ], $X ) : " NULL " );} $I = $Xb -> update ( $a , $O , " WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $Vh , $p ), ! ( $Ed || $Xh === array ()), " " ); if ( ! $I ) break ; $za += $g -> affected_rows ;} queries_redirect ( remove_from_uri (), lang ( 242 , $za ), $I );}} elseif ( ! is_string ( $Jc = get_file ( " csv_file " , true ))) $n = upload_error ( $Jc ); elseif ( ! preg_match ( '~~u' , $Jc )) $n = lang ( 244 ); else { cookie ( " adminer_import " , " output= " . urlencode ( $ya [ " output " ]) . " &format= " . urlencode ( $_POST [ " separator " ])); $I = true ; $pb = array_keys ( $p ); preg_match_all ( '~(?>"[^"]*"|[^"\\r\\n]+)+~' , $Jc , $ke ); $za = count ( $ke [ 0 ]); $Xb -> begin (); $Dg = ( $_POST [ " separator " ] == " csv " ? " , " : ( $_POST [ " separator " ] == " tsv " ? " \t " : " ; " )); $L = array (); foreach ( $ke [ 0 ] as $y => $X ){ preg_match_all ( " ~((?> \" [^ \" ]* \" )+|[^ $Dg ]*) $Dg ~ " , $X . $Dg , $le ); if ( ! $y &&! array_diff ( $le [ 1 ], $pb )){ $pb = $le [ 1 ]; $za -- ;} else { $O = array (); foreach ( $le [ 1 ] as $s => $lb ) $O [ idf_escape ( $pb [ $s ])] = ( $lb == " " && $p [ $pb [ $s ]][ " null " ] ? " NULL " : q ( str_replace ( '""' , '"' , preg_replace ( '~^"|"$~' , '' , $lb )))); $L [] = $O ;}} $I = ( ! $L || $Xb -> insertUpdate ( $a , $L , $Kf )); if ( $I ) $I = $Xb -> commit (); queries_redirect ( remove_from_uri ( " page " ), lang ( 245 , $za ), $I ); $Xb -> rollback ();}}} $gh = $b -> tableName ( $S ); if ( is_ajax ()){ page_headers (); ob_start ();} else
page_header ( lang ( 50 ) . " : $gh " , $n ); $O = null ; if ( isset ( $pg [ " insert " ]) ||! support ( " table " )){ $O = " " ; foreach (( array ) $_GET [ " where " ] as $X ){ if ( count ( $Tc [ $X [ " col " ]]) == 1 && ( $X [ " op " ] == " = " || ( ! $X [ " op " ] &&! preg_match ( '~[_%]~' , $X [ " val " ])))) $O .= " &set " . urlencode ( " [ " . bracket_escape ( $X [ " col " ]) . " ] " ) . " = " . urlencode ( $X [ " val " ]);}} $b -> selectLinks ( $S , $O ); if ( ! $e && support ( " table " )) echo " <p class='error'> " . lang ( 246 ) . ( $p ? " . " : " : " . error ()) . " \n " ; else { echo " <form action='' id='form'> \n " , " <div style='display: none;'> " ; hidden_fields_get (); echo ( DB != " " ? '<input type="hidden" name="db" value="' . h ( DB ) . '">' . ( isset ( $_GET [ " ns " ]) ? '<input type="hidden" name="ns" value="' . h ( $_GET [ " ns " ]) . '">' : " " ) : " " ); echo '<input type="hidden" name="select" value="' . h ( $a ) . '">' , " </div> \n " ; $b -> selectColumnsPrint ( $M , $e ); $b -> selectSearchPrint ( $Z , $e , $w ); $b -> selectOrderPrint ( $df , $e , $w ); $b -> selectLimitPrint ( $z ); $b -> selectLengthPrint ( $uh ); $b -> selectActionPrint ( $w ); echo " </form> \n " ; $E = $_GET [ " page " ]; if ( $E == " last " ){ $Wc = $g -> result ( count_rows ( $a , $Z , $Ed , $cd )); $E = floor ( max ( 0 , $Wc - 1 ) / $z );} $Ag = $M ; if ( ! $Ag ){ $Ag [] = " * " ; if ( $Ne ) $Ag [] = $Ne ;} $_b = convert_fields ( $e , $p , $M ); if ( $_b ) $Ag [] = substr ( $_b , 2 ); $I = $Xb -> select ( $a , $Ag , $Z , $cd , $df , $z , $E , true ); if ( ! $I ) echo " <p class='error'> " . error () . " \n " ; else { if ( $x == " mssql " && $E ) $I -> seek ( $z * $E ); $mc = array (); echo " <form action='' method='post' enctype='multipart/form-data'> \n " ; $L = array (); while ( $K = $I -> fetch_assoc ()){ if ( $E && $x == " oracle " ) unset ( $K [ " RNUM " ]); $L [] = $K ;} if ( $_GET [ " page " ] != " last " &&+ $z && $cd && $Ed && $x == " sql " ) $Wc = $g -> result ( " SELECT FOUND_ROWS() " ); if ( ! $L ) echo " <p class='message'> " . lang ( 12 ) . " \n " ; else { $Pa = $b -> backwardKeys ( $a , $gh ); echo " <table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);' onkeydown='return editingKeydown(event);'> \n " , " <thead><tr> " . ( ! $cd && $M ? " " : " <td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);' class='jsonly'> <a href=' " . h ( $_GET [ " modify " ] ? remove_from_uri ( " modify " ) : $_SERVER [ " REQUEST_URI " ] . " &modify=1 " ) . " '> " . lang ( 247 ) . " </a> " ); $De = array (); $Zc = array (); reset ( $M ); $Yf = 1 ; foreach ( $L [ 0 ] as $y => $X ){ if ( $y != $Ne ){ $X = $_GET [ " columns " ][ key ( $M )]; $o = $p [ $M ? ( $X ? $X [ " col " ] : current ( $M )) : $y ]; $C = ( $o ? $b -> fieldName ( $o , $Yf ) : ( $X [ " fun " ] ? " * " : $y )); if ( $C != " " ){ $Yf ++ ; $De [ $y ] = $C ; $d = idf_escape ( $y ); $nd = remove_from_uri ( '(order|desc)[^=]*|page' ) . '&order%5B0%5D=' . urlencode ( $y ); $Pb = " &desc%5B0%5D=1 " ; echo '<th onmouseover="columnMouse(this);" onmouseout="columnMouse(this, \' hidden\');">' , '<a href="' . h ( $nd . ( $df [ 0 ] == $d || $df [ 0 ] == $y || ( ! $df && $Ed && $cd [ 0 ] == $d ) ? $Pb : '' )) . '">' ; echo
apply_sql_function ( $X [ " fun " ], $C ) . " </a> " ; echo " <span class='column hidden'> " , " <a href=' " . h ( $nd . $Pb ) . " ' title=' " . lang ( 56 ) . " ' class='text'> ↓</a> " ; if ( ! $X [ " fun " ]) echo '<a href="#fieldset-search" onclick="selectSearch(\'' . h ( js_escape ( $y )) . '\'); return false;" title="' . lang ( 53 ) . '" class="text jsonly"> =</a>' ; echo " </span> " ;} $Zc [ $y ] = $X [ " fun " ]; next ( $M );}} $ce = array (); if ( $_GET [ " modify " ]){ foreach ( $L
2014-04-01 18:00:42 +00:00
as $K ){ foreach ( $K
2017-04-21 11:23:04 +00:00
as $y => $X ) $ce [ $y ] = max ( $ce [ $y ], min ( 40 , strlen ( utf8_decode ( $X ))));}} echo ( $Pa ? " <th> " . lang ( 248 ) : " " ) . " </thead> \n " ; if ( is_ajax ()){ if ( $z % 2 == 1 && $E % 2 == 1 ) odd (); ob_end_clean ();} foreach ( $b -> rowDescriptions ( $L , $Tc ) as $Ce => $K ){ $Uh = unique_array ( $L [ $Ce ], $w ); if ( ! $Uh ){ $Uh = array (); foreach ( $L [ $Ce ] as $y => $X ){ if ( ! preg_match ( '~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~' , $y )) $Uh [ $y ] = $X ;}} $Vh = " " ; foreach ( $Uh
as $y => $X ){ if (( $x == " sql " || $x == " pgsql " ) && strlen ( $X ) > 64 ){ $y = ( strpos ( $y , '(' ) ? $y : idf_escape ( $y )); $y = " MD5( " . ( $x == 'sql' && preg_match ( " ~^utf8_~ " , $p [ $y ][ " collation " ]) ? $y : " CONVERT( $y USING " . charset ( $g ) . " ) " ) . " ) " ; $X = md5 ( $X );} $Vh .= " & " . ( $X !== null ? urlencode ( " where[ " . bracket_escape ( $y ) . " ] " ) . " = " . urlencode ( $X ) : " null%5B%5D= " . urlencode ( $y ));} echo " <tr " . odd () . " > " . ( ! $cd && $M ? " " : " <td> " . checkbox ( " check[] " , substr ( $Vh , 1 ), in_array ( substr ( $Vh , 1 ),( array ) $_POST [ " check " ]), " " , " this.form['all'].checked = false; formUncheck('all-page'); " ) . ( $Ed || information_schema ( DB ) ? " " : " <a href=' " . h ( ME . " edit= " . urlencode ( $a ) . $Vh ) . " '> " . lang ( 249 ) . " </a> " )); foreach ( $K
as $y => $X ){ if ( isset ( $De [ $y ])){ $o = $p [ $y ]; if ( $X != " " && ( ! isset ( $mc [ $y ]) || $mc [ $y ] != " " )) $mc [ $y ] = ( is_mail ( $X ) ? $De [ $y ] : " " ); $_ = " " ; if ( preg_match ( '~blob|bytea|raw|file~' , $o [ " type " ]) && $X != " " ) $_ = ME . 'download=' . urlencode ( $a ) . '&field=' . urlencode ( $y ) . $Vh ; if ( ! $_ && $X !== null ){ foreach (( array ) $Tc [ $y ] as $q ){ if ( count ( $Tc [ $y ]) == 1 || end ( $q [ " source " ]) == $y ){ $_ = " " ; foreach ( $q [ " source " ] as $s => $Qg ) $_ .= where_link ( $s , $q [ " target " ][ $s ], $L [ $Ce ][ $Qg ]); $_ = ( $q [ " db " ] != " " ? preg_replace ( '~([?&]db=)[^&]+~' , '\\1' . urlencode ( $q [ " db " ]), ME ) : ME ) . 'select=' . urlencode ( $q [ " table " ]) . $_ ; if ( $q [ " ns " ]) $_ = preg_replace ( '~([?&]ns=)[^&]+~' , '\\1' . urlencode ( $q [ " ns " ]), $_ ); if ( count ( $q [ " source " ]) == 1 ) break ;}}} if ( $y == " COUNT(*) " ){ $_ = ME . " select= " . urlencode ( $a ); $s = 0 ; foreach (( array ) $_GET [ " where " ] as $W ){ if ( ! array_key_exists ( $W [ " col " ], $Uh )) $_ .= where_link ( $s ++ , $W [ " col " ], $W [ " val " ], $W [ " op " ]);} foreach ( $Uh
as $Kd => $W ) $_ .= where_link ( $s ++ , $Kd , $W );} $X = select_value ( $X , $_ , $o , $uh ); $t = h ( " val[ $Vh ][ " . bracket_escape ( $y ) . " ] " ); $Y = $_POST [ " val " ][ $Vh ][ bracket_escape ( $y )]; $hc =! is_array ( $K [ $y ]) && is_utf8 ( $X ) && $L [ $Ce ][ $y ] == $K [ $y ] &&! $Zc [ $y ]; $th = preg_match ( '~text|lob~' , $o [ " type " ]); if (( $_GET [ " modify " ] && $hc ) || $Y !== null ){ $fd = h ( $Y !== null ? $Y : $K [ $y ]); echo " <td> " . ( $th ? " <textarea name=' $t ' cols='30' rows=' " . ( substr_count ( $K [ $y ], " \n " ) + 1 ) . " '> $fd </textarea> " : " <input name=' $t ' value=' $fd ' size=' $ce[$y] '> " );} else { $ge = strpos ( $X , " <i>...</i> " ); echo " <td id=' $t ' onclick= \" selectClick(this, event, " . ( $ge ? 2 : ( $th ? 1 : 0 )) . ( $hc ? " " : " , ' " . h ( lang ( 250 )) . " ' " ) . " ); \" > $X " ;}}} if ( $Pa ) echo " <td> " ; $b -> backwardKeysPrint ( $Pa , $L [ $Ce ]); echo " </tr> \n " ;} if ( is_ajax ()) exit ; echo " </table> \n " ;} if (( $L || $E ) &&! is_ajax ()){ $wc = true ; if ( $_GET [ " page " ] != " last " ){ if ( !+ $z ) $Wc = count ( $L ); elseif ( $x != " sql " ||! $Ed ){ $Wc = ( $Ed ? false : found_rows ( $S , $Z )); if ( $Wc < max ( 1e4 , 2 * ( $E + 1 ) * $z )) $Wc = reset ( slow_query ( count_rows ( $a , $Z , $Ed , $cd ))); else $wc = false ;}} if ( + $z && ( $Wc === false || $Wc > $z || $E )){ echo " <p class='pages'> " ; $ne = ( $Wc === false ? $E + ( count ( $L ) >= $z ? 2 : 1 ) : floor (( $Wc - 1 ) / $z )); if ( $x != " simpledb " ){ echo '<a href="' . h ( remove_from_uri ( " page " )) . " \" onclick= \" pageClick(this.href, +prompt(' " . lang ( 251 ) . " ', ' " . ( $E + 1 ) . " '), event); return false; \" > " . lang ( 251 ) . " </a>: " , pagination ( 0 , $E ) . ( $E > 5 ? " ... " : " " ); for ( $s = max ( 1 , $E - 4 ); $s < min ( $ne , $E + 5 ); $s ++ ) echo
pagination ( $s , $E ); if ( $ne > 0 ){ echo ( $E + 5 < $ne ? " ... " : " " ),( $wc && $Wc !== false ? pagination ( $ne , $E ) : " <a href=' " . h ( remove_from_uri ( " page " ) . " &page=last " ) . " ' title='~ $ne '> " . lang ( 252 ) . " </a> " );} echo (( $Wc === false ? count ( $L ) + 1 : $Wc - $E * $z ) > $z ? ' <a href="' . h ( remove_from_uri ( " page " ) . " &page= " . ( $E + 1 )) . '" onclick="return !selectLoadMore(this, ' . ( + $z ) . ', \'' . lang ( 253 ) . '...\');" class="loadmore">' . lang ( 254 ) . '</a>' : '' );} else { echo
lang ( 251 ) . " : " , pagination ( 0 , $E ) . ( $E > 1 ? " ... " : " " ),( $E ? pagination ( $E , $E ) : " " ),( $ne > $E ? pagination ( $E + 1 , $E ) . ( $ne > $E + 1 ? " ... " : " " ) : " " );}} echo " <p class='count'> \n " ,( $Wc !== false ? " ( " . ( $wc ? " " : " ~ " ) . lang ( 142 , $Wc ) . " ) " : " " ); $Ub = ( $wc ? " " : " ~ " ) . $Wc ; echo
checkbox ( " all " , 1 , 0 , lang ( 255 ), " var checked = formChecked(this, /check/); selectCount('selected', this.checked ? ' $Ub ' : checked); selectCount('selected2', this.checked || !checked ? ' $Ub ' : checked); " ) . " \n " ; if ( $b -> selectCommandPrint ()){ echo '<fieldset' ,( $_GET [ " modify " ] ? '' : ' class="jsonly"' ), '><legend>' , lang ( 247 ), ' </ legend >< div >
< input type = " submit " value = " ',lang(14),' " ',($_GET["modify"]?' ':' title = " '.lang(243).' " '),' >
2014-04-01 18:00:42 +00:00
</ div ></ fieldset >
2017-04-21 11:23:04 +00:00
< fieldset >< legend > ',lang(118),' < span id = " selected " ></ span ></ legend >< div >
2015-04-01 06:36:56 +00:00
< input type = " submit " name = " edit " value = " ',lang(10),' " >
2017-04-21 11:23:04 +00:00
< input type = " submit " name = " clone " value = " ',lang(237),' " >
2015-04-01 06:36:56 +00:00
< input type = " submit " name = " delete " value = " ',lang(18),' " ',confirm(),' >
2014-04-01 18:00:42 +00:00
</ div ></ fieldset >
2017-04-21 11:23:04 +00:00
';}$Uc=$b->dumpFormat();foreach((array)$_GET["columns"]as$d){if($d["fun"]){unset($Uc[' sql ']);break;}}if($Uc){print_fieldset("export",lang(70)." <span id=' selected2 '></span>");$of=$b->dumpOutput();echo($of?html_select("output",$of,$ya["output"])." ":""),html_select("format",$Uc,$ya["format"])," <input type=' submit ' name=' export ' value=' " .lang(70). " '>\n","</div></fieldset>\n";}echo(!$cd&&$M?"":"<script type=' text / javascript '>tableCheck();</script>\n");}if($b->selectImportPrint()){print_fieldset("import",lang(69),!$L);echo"<input type=' file ' name=' csv_file '> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$ya["format"],1);echo" <input type=' submit ' name=' import ' value=' " .lang(69). " '>","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($mc,' strlen '),$e);echo"<p><input type=' hidden ' name=' token ' value=' $Dh '></p>\n","</form>\n";}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$P=isset($_GET["status"]);page_header($P?lang(109):lang(108));$ki=($P?show_status():show_variables());if(!$ki)echo"<p class=' message '>".lang(12)."\n";else{echo"<table cellspacing=' 0 ' > \n " ;foreach( $ki
as $y => $X ){ echo " <tr> " , " <th><code class='jush- " . $x . ( $P ? " status " : " set " ) . " '> " . h ( $y ) . " </code> " , " <td> " . nbsp ( $X );} echo " </table> \n " ;}} elseif ( isset ( $_GET [ " script " ])){ header ( " Content-Type: text/javascript; charset=utf-8 " ); if ( $_GET [ " script " ] == " db " ){ $dh = array ( " Data_length " => 0 , " Index_length " => 0 , " Data_free " => 0 ); foreach ( table_status () as $C => $S ){ json_row ( " Comment- $C " , nbsp ( $S [ " Comment " ])); if ( ! is_view ( $S )){ foreach ( array ( " Engine " , " Collation " ) as $y ) json_row ( " $y - $C " , nbsp ( $S [ $y ])); foreach ( $dh + array ( " Auto_increment " => 0 , " Rows " => 0 ) as $y => $X ){ if ( $S [ $y ] != " " ){ $X = format_number ( $S [ $y ]); json_row ( " $y - $C " ,( $y == " Rows " && $X && $S [ " Engine " ] == ( $Tg == " pgsql " ? " table " : " InnoDB " ) ? " ~ $X " : $X )); if ( isset ( $dh [ $y ])) $dh [ $y ] += ( $S [ " Engine " ] != " InnoDB " || $y != " Data_free " ? $S [ $y ] : 0 );} elseif ( array_key_exists ( $y , $S )) json_row ( " $y - $C " );}}} foreach ( $dh
as $y => $X ) json_row ( " sum- $y " , format_number ( $X )); json_row ( " " );} elseif ( $_GET [ " script " ] == " kill " ) $g -> query ( " KILL " . number ( $_POST [ " kill " ])); else { foreach ( count_tables ( $b -> databases ()) as $m => $X ){ json_row ( " tables- $m " , $X ); json_row ( " size- $m " , db_size ( $m ));} json_row ( " " );} exit ;} else { $mh = array_merge (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ]); if ( $mh &&! $n &&! $_POST [ " search " ]){ $I = true ; $se = " " ; if ( $x == " sql " && count ( $_POST [ " tables " ]) > 1 && ( $_POST [ " drop " ] || $_POST [ " truncate " ] || $_POST [ " copy " ])) queries ( " SET foreign_key_checks = 0 " ); if ( $_POST [ " truncate " ]){ if ( $_POST [ " tables " ]) $I = truncate_tables ( $_POST [ " tables " ]); $se = lang ( 256 );} elseif ( $_POST [ " move " ]){ $I = move_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $se = lang ( 257 );} elseif ( $_POST [ " copy " ]){ $I = copy_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $se = lang ( 258 );} elseif ( $_POST [ " drop " ]){ if ( $_POST [ " views " ]) $I = drop_views ( $_POST [ " views " ]); if ( $I && $_POST [ " tables " ]) $I = drop_tables ( $_POST [ " tables " ]); $se = lang ( 259 );} elseif ( $x != " sql " ){ $I = ( $x == " sqlite " ? queries ( " VACUUM " ) : apply_queries ( " VACUUM " . ( $_POST [ " optimize " ] ? " " : " ANALYZE " ), $_POST [ " tables " ])); $se = lang ( 260 );} elseif ( ! $_POST [ " tables " ]) $se = lang ( 9 ); elseif ( $I = queries (( $_POST [ " optimize " ] ? " OPTIMIZE " : ( $_POST [ " check " ] ? " CHECK " : ( $_POST [ " repair " ] ? " REPAIR " : " ANALYZE " ))) . " TABLE " . implode ( " , " , array_map ( 'idf_escape' , $_POST [ " tables " ])))){ while ( $K = $I -> fetch_assoc ()) $se .= " <b> " . h ( $K [ " Table " ]) . " </b>: " . h ( $K [ " Msg_text " ]) . " <br> " ;} queries_redirect ( substr ( ME , 0 , - 1 ), $se , $I );} page_header (( $_GET [ " ns " ] == " " ? lang ( 35 ) . " : " . h ( DB ) : lang ( 73 ) . " : " . h ( $_GET [ " ns " ])), $n , true ); if ( $b -> homepage ()){ if ( $_GET [ " ns " ] !== " " ){ echo " <h3 id='tables-views'> " . lang ( 261 ) . " </h3> \n " ; $lh = tables_list (); if ( ! $lh ) echo " <p class='message'> " . lang ( 9 ) . " \n " ; else { echo " <form action='' method='post'> \n " ; if ( support ( " table " )){ echo " <fieldset><legend> " . lang ( 262 ) . " <span id='selected2'></span></legend><div> " , " <input type='search' name='query' value=' " . h ( $_POST [ " query " ]) . " '> <input type='submit' name='search' value=' " . lang ( 53 ) . " '> \n " , " </div></fieldset> \n " ; if ( $_POST [ " search " ] && $_POST [ " query " ] != " " ) search_tables ();} $Vb = doc_link ( array ( 'sql' => 'show-table-status.html' )); echo " <table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'> \n " , '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);" class="jsonly">' , '<th>' . lang ( 123 ), '<td>' . lang ( 263 ) . doc_link ( array ( 'sql' => 'storage-engines.html' )), '<td>' . lang ( 114 ) . doc_link ( array ( 'sql' => 'charset-mysql.html' )), '<td>' . lang ( 264 ) . $Vb , '<td>' . lang ( 265 ) . $Vb , '<td>' . lang ( 266 ) . $Vb , '<td>' . lang ( 48 ) . doc_link ( array ( 'sql' => 'example-auto-increment.html' )), '<td>' . lang ( 267 ) . $Vb ,( support ( " comment " ) ? '<td>' . lang ( 47 ) . $Vb : '' ), " </thead> \n " ; $T = 0 ; foreach ( $lh
as $C => $U ){ $ni = ( $U !== null &&! preg_match ( '~table~i' , $U )); $t = h ( " Table- " . $C ); echo '<tr' . odd () . '><td>' . checkbox (( $ni ? " views[] " : " tables[] " ), $C , in_array ( $C , $mh , true ), " " , " formUncheck('check-all'); " , " " , $t ), '<th>' . ( support ( " table " ) || support ( " indexes " ) ? " <a href=' " . h ( ME ) . " table= " . urlencode ( $C ) . " ' title=' " . lang ( 40 ) . " ' id=' $t '> " . h ( $C ) . '</a>' : h ( $C )); if ( $ni ){ echo '<td colspan="6"><a href="' . h ( ME ) . " view= " . urlencode ( $C ) . '" title="' . lang ( 41 ) . '">' . ( preg_match ( '~materialized~i' , $U ) ? lang ( 121 ) : lang ( 122 )) . '</a>' , '<td align="right"><a href="' . h ( ME ) . " select= " . urlencode ( $C ) . '" title="' . lang ( 39 ) . '">?</a>' ;} else { foreach ( array ( " Engine " => array (), " Collation " => array (), " Data_length " => array ( " create " , lang ( 42 )), " Index_length " => array ( " indexes " , lang ( 125 )), " Data_free " => array ( " edit " , lang ( 43 )), " Auto_increment " => array ( " auto_increment=1&create " , lang ( 42 )), " Rows " => array ( " select " , lang ( 39 )),) as $y => $_ ){ $t = " id=' $y - " . h ( $C ) . " ' " ; echo ( $_ ? " <td align='right'> " . ( support ( " table " ) || $y == " Rows " || ( support ( " indexes " ) && $y != " Data_length " ) ? " <a href=' " . h ( ME . " $_[0] = " ) . urlencode ( $C ) . " ' $t title=' $_[1] '>?</a> " : " <span $t >?</span> " ) : " <td id=' $y - " . h ( $C ) . " '> " );} $T ++ ;} echo ( support ( " comment " ) ? " <td id='Comment- " . h ( $C ) . " '> " : " " );} echo " <tr><td> <th> " . lang ( 238 , count ( $lh )), " <td> " . nbsp ( $x == " sql " ? $g -> result ( " SELECT @@storage_engine " ) : " " ), " <td> " . nbsp ( db_collation ( DB , collations ())); foreach ( array ( " Data_length " , " Index_length " , " Data_free " ) as $y ) echo " <td align='right' id='sum- $y '> " ; echo " </table> \n " ; if ( ! information_schema ( DB )){ $hi = " <input type='submit' value=' " . lang ( 268 ) . " ' " . on_help ( " 'VACUUM' " ) . " > " ; $Ze = " <input type='submit' name='optimize' value=' " . lang ( 269 ) . " ' " . on_help ( $x == " sql " ? " 'OPTIMIZE TABLE' " : " 'VACUUM OPTIMIZE' " ) . " > " ; echo " <fieldset><legend> " . lang ( 118 ) . " <span id='selected'></span></legend><div> " . ( $x == " sqlite " ? $hi : ( $x == " pgsql " ? $hi . $Ze : ( $x == " sql " ? " <input type='submit' value=' " . lang ( 270 ) . " ' " . on_help ( " 'ANALYZE TABLE' " ) . " > " . $Ze . " <input type='submit' name='check' value=' " . lang ( 271 ) . " ' " . on_help ( " 'CHECK TABLE' " ) . " > " . " <input type='submit' name='repair' value=' " . lang ( 272 ) . " ' " . on_help ( " 'REPAIR TABLE' " ) . " > " : " " ))) . " <input type='submit' name='truncate' value=' " . lang ( 273 ) . " ' " . confirm () . on_help ( $x == " sqlite " ? " 'DELETE' " : " 'TRUNCATE " . ( $x == " pgsql " ? " ' " : " TABLE' " )) . " > " . " <input type='submit' name='drop' value=' " . lang ( 119 ) . " ' " . confirm () . on_help ( " 'DROP TABLE' " ) . " > \n " ; $l = ( support ( " scheme " ) ? $b -> schemas () : $b -> databases ()); if ( count ( $l ) != 1 && $x != " sqlite " ){ $m = ( isset ( $_POST [ " target " ]) ? $_POST [ " target " ] : ( support ( " scheme " ) ? $_GET [ " ns " ] : DB )); echo " <p> " . lang ( 274 ) . " : " ,( $l ? html_select ( " target " , $l , $m ) : '<input name="target" value="' . h ( $m ) . '" autocapitalize="off">' ), " <input type='submit' name='move' value=' " . lang ( 275 ) . " '> " ,( support ( " copy " ) ? " <input type='submit' name='copy' value=' " . lang ( 276 ) . " '> " : " " ), " \n " ;} echo " <input type='hidden' name='all' value='' onclick= \" selectCount('selected', formChecked(this, /^(tables|views) \ [/)); " . ( support ( " table " ) ? " selectCount('selected2', formChecked(this, /^tables \ [/) || $T ); " : " " ) . " \" > \n " ; echo " <input type='hidden' name='token' value=' $Dh '> \n " , " </div></fieldset> \n " ;} echo " </form> \n " , " <script type='text/javascript'>tableCheck();</script> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'create=">' . lang ( 71 ) . " </a> \n " ,( support ( " view " ) ? '<a href="' . h ( ME ) . 'view=">' . lang ( 195 ) . " </a> \n " : " " ); if ( support ( " routine " )){ echo " <h3 id='routines'> " . lang ( 135 ) . " </h3> \n " ; $tg = routines (); if ( $tg ){ echo " <table cellspacing='0'> \n " , '<thead><tr><th>' . lang ( 174 ) . '<td>' . lang ( 46 ) . '<td>' . lang ( 212 ) . " <td> </thead> \n " ; odd ( '' ); foreach ( $tg
as $K ){ echo '<tr' . odd () . '>' , '<th><a href="' . h ( ME ) . ( $K [ " ROUTINE_TYPE " ] != " PROCEDURE " ? 'callf=' : 'call=' ) . urlencode ( $K [ " ROUTINE_NAME " ]) . '">' . h ( $K [ " ROUTINE_NAME " ]) . '</a>' , '<td>' . h ( $K [ " ROUTINE_TYPE " ]), '<td>' . h ( $K [ " DTD_IDENTIFIER " ]), '<td><a href="' . h ( ME ) . ( $K [ " ROUTINE_TYPE " ] != " PROCEDURE " ? 'function=' : 'procedure=' ) . urlencode ( $K [ " ROUTINE_NAME " ]) . '">' . lang ( 128 ) . " </a> " ;} echo " </table> \n " ;} echo '<p class="links">' . ( support ( " procedure " ) ? '<a href="' . h ( ME ) . 'procedure=">' . lang ( 211 ) . '</a>' : '' ) . '<a href="' . h ( ME ) . 'function=">' . lang ( 210 ) . " </a> \n " ;} if ( support ( " sequence " )){ echo " <h3 id='sequences'> " . lang ( 277 ) . " </h3> \n " ; $Fg = get_vals ( " SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name " ); if ( $Fg ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 174 ) . " </thead> \n " ; odd ( '' ); foreach ( $Fg
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 ( 217 ) . " </a> \n " ;} if ( support ( " type " )){ echo " <h3 id='user-types'> " . lang ( 24 ) . " </h3> \n " ; $fi = types (); if ( $fi ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 174 ) . " </thead> \n " ; odd ( '' ); foreach ( $fi
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 ( 221 ) . " </a> \n " ;} if ( support ( " event " )){ echo " <h3 id='events'> " . lang ( 136 ) . " </h3> \n " ; $L = get_rows ( " SHOW EVENTS " ); if ( $L ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 174 ) . " <td> " . lang ( 278 ) . " <td> " . lang ( 201 ) . " <td> " . lang ( 202 ) . " <td></thead> \n " ; foreach ( $L
as $K ){ echo " <tr> " , " <th> " . h ( $K [ " Name " ]), " <td> " . ( $K [ " Execute at " ] ? lang ( 279 ) . " <td> " . $K [ " Execute at " ] : lang ( 203 ) . " " . $K [ " Interval value " ] . " " . $K [ " Interval field " ] . " <td> $K[Starts] " ), " <td> $K[Ends] " , '<td><a href="' . h ( ME ) . 'event=' . urlencode ( $K [ " Name " ]) . '">' . lang ( 128 ) . '</a>' ;} echo " </table> \n " ; $uc = $g -> result ( " SELECT @@event_scheduler " ); if ( $uc && $uc != " ON " ) echo " <p class='error'><code class='jush-sqlset'>event_scheduler</code>: " . h ( $uc ) . " \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'event=">' . lang ( 200 ) . " </a> \n " ;} if ( $lh ) echo " <script type='text/javascript'>ajaxSetHtml(' " . js_escape ( ME ) . " script=db');</script> \n " ;}}} page_footer ();